Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
137 changes: 105 additions & 32 deletions Documentation/devicetree/bindings/media/google,gs201-csis.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
$id: http://devicetree.org/schemas/media/google,gs201-csis.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: Google gs201 CSIS camera receiver link and CSIS WDMA
title: Google gs201 and zumapro CSIS camera receiver link and CSIS WDMA

maintainers:
- Derek Ross <derekross@gmail.com>
Expand All @@ -13,57 +13,45 @@ description:
The camera block of Google's gs201 SoC has eight MIPI CSI-2 receiver links
(CSIS) and a DMA block whose CSIS WDMA contexts write a link's frames to
memory. One node describes one link and the WDMA context it feeds.
zumapro (Tensor G4) has the same receiver link in its ISP front end, with
twelve link contexts; its DMA path is different and not described here.

properties:
compatible:
const: google,gs201-csis
enum:
- google,gs201-csis
- google,zumapro-csis

reg:
minItems: 3
items:
- description: the CSIS link registers
- description: the CSIS DMA block's common page (shared by all links)
- description: the CSIS WDMA context (links may share one; they then
stream one at a time)
- description: the EBUF control (shared by all links), bypassed on the
way to the WDMA
minItems: 1
maxItems: 4

reg-names:
minItems: 3
items:
- const: link
- const: dma
- const: wdma
- const: ebuf
minItems: 1
maxItems: 4

interrupts:
items:
- description: link interrupt
- description: WDMA context interrupt
minItems: 1
maxItems: 2

interrupt-names:
items:
- const: link
- const: wdma
minItems: 1
maxItems: 2

clocks:
items:
- description: the camera block's DVFS domain
- description: the bus (INT) DVFS domain
maxItems: 2

clock-names:
items:
- const: cam
- const: int
maxItems: 2

phys:
maxItems: 1
description: The link's DC-PHY receiver.

google,csis-link:
$ref: /schemas/types.yaml#/definitions/uint32
maximum: 7
description: Index of the CSIS link.
maximum: 11
description: Index of the CSIS link (0-7 on gs201).

google,wdma-context:
$ref: /schemas/types.yaml#/definitions/uint32
Expand All @@ -82,6 +70,13 @@ properties:
description:
WDMA input slot the link is routed to; defaults to the context index.

google,image-loch:
$ref: /schemas/types.yaml#/definitions/uint32
maximum: 6
description:
zumapro only. The CSIS core's image logical channel the link writes
its frames through; defaults to 0.

google,lrte-packet-delimiters:
type: boolean
description:
Expand Down Expand Up @@ -132,10 +127,88 @@ required:
- interrupt-names
- phys
- google,csis-link
- google,wdma-context
- google,csis-sysreg
- port

allOf:
- if:
properties:
compatible:
const: google,gs201-csis
then:
properties:
reg:
minItems: 3
items:
- description: the CSIS link registers
- description: the CSIS DMA block's common page (shared by all links)
- description: the CSIS WDMA context (links may share one; they
then stream one at a time)
- description: the EBUF control (shared by all links), bypassed on
the way to the WDMA
reg-names:
minItems: 3
items:
- const: link
- const: dma
- const: wdma
- const: ebuf
interrupts:
items:
- description: link interrupt
- description: WDMA context interrupt
interrupt-names:
items:
- const: link
- const: wdma
clocks:
items:
- description: the camera block's DVFS domain
- description: the bus (INT) DVFS domain
clock-names:
items:
- const: cam
- const: int
google,csis-link:
maximum: 7
google,image-loch: false
required:
- google,wdma-context
- google,csis-sysreg
else:
properties:
reg:
minItems: 1
items:
- description: the CSIS link registers
- description: the ISP front end's CSIS core page, shared by all
links; without it the link runs without DMA
reg-names:
minItems: 1
items:
- const: link
- const: core
interrupts:
minItems: 1
items:
- description: link interrupt
- description: CSIS core interrupt, shared by all links
interrupt-names:
minItems: 1
items:
- const: link
- const: core
clocks:
items:
- description: the INT DVFS domain, the ISP front end clock's rail
- description: the ISP front end's NOC clock
clock-names:
items:
- const: int
- const: fe
google,wdma-context: false
google,csis-sysreg: false
google,ebuf: false

additionalProperties: false

examples:
Expand Down
26 changes: 24 additions & 2 deletions Documentation/devicetree/bindings/media/i2c/samsung,s5kgn1.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,38 @@ description:
Samsung Bayer CMOS sensors with a MIPI CSI-2 C-PHY or D-PHY output,
controlled over I2C - the S5KGN1 (ISOCELL GN1, 50 MP, dual-pixel phase
detection), the S5K3J1 (10.5 MP, dual-pixel phase detection) and the
S5KGM5 (ISOCELL GM5, 48 MP). Their initialisation and readout modes are
S5KGM5 (ISOCELL GM5, 48 MP), and the S5KGN8 (model 0x08e8, the Pixel 9a
main camera). Their initialisation and readout modes are
loaded from a data file named by firmware-name.

allOf:
- $ref: /schemas/media/video-interface-devices.yaml#
- if:
properties:
compatible:
const: samsung,s5kgn1
enum:
- samsung,s5kgn1
- samsung,s5kgn8
then:
required:
- vaux-supply
- vana-supply
else:
properties:
vaux-supply: false
- if:
properties:
compatible:
const: samsung,s5kgn8
then:
required:
- vaux2-supply
- vdig-supply
properties:
vsw-supply: false
else:
properties:
vaux2-supply: false
- if:
properties:
compatible:
Expand All @@ -52,6 +68,7 @@ properties:
- samsung,s5k3j1
- samsung,s5kgm5
- samsung,s5kgn1
- samsung,s5kgn8

reg:
maxItems: 1
Expand All @@ -71,6 +88,11 @@ properties:
The module's auxiliary supply (2.9 V on the Pixel 7 Pro, shared with
its focus actuator), switched on right after the interface supply.

vaux2-supply:
description:
A second auxiliary supply (2.9 V on the Pixel 9a, shared with the
module's focus actuator and EEPROM), switched on after vaux-supply.

vsw-supply:
description:
A switched module supply, on before the core supplies (S5KGN1) or
Expand Down
11 changes: 7 additions & 4 deletions Documentation/devicetree/bindings/media/i2c/sony,imx386.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,25 @@
$id: http://devicetree.org/schemas/media/i2c/sony,imx386.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: Sony IMX386 image sensor
title: Sony IMX386 and IMX712 image sensors

maintainers:
- Derek Ross <derekross@gmail.com>

description:
Sony IMX386 12 MP Bayer CMOS sensor with a MIPI CSI-2 D-PHY output,
controlled over I2C. Its initialisation and readout modes are loaded from
a data file named by firmware-name.
controlled over I2C, and the IMX712 (the Pixel 9a's ultrawide and front
cameras), which has the same register map. Their initialisation and
readout modes are loaded from a data file named by firmware-name.

allOf:
- $ref: /schemas/media/video-interface-devices.yaml#

properties:
compatible:
const: sony,imx386
enum:
- sony,imx386
- sony,imx712

reg:
maxItems: 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
$id: http://devicetree.org/schemas/phy/google,gs201-mipi-dcphy-rx.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: Google gs201 MIPI DC-PHY receiver
title: Google gs201 and zumapro MIPI DC-PHY receiver

maintainers:
- Derek Ross <derekross@gmail.com>
Expand All @@ -17,11 +17,15 @@ description:
one PMU isolation control. The PHY cell selects the link. Each slave
receives D-PHY or C-PHY (up to three trios on links 0 and 1, two on the
others); the consumer selects the mode at run time, from its endpoint's
bus type.
bus type. zumapro (Tensor G4) has nine slaves for twelve CSIS links, the
clock lane first on each, and one reset bit per slave; the PHY cell is
the CSIS link.

properties:
compatible:
const: google,gs201-mipi-dcphy-rx
enum:
- google,gs201-mipi-dcphy-rx
- google,zumapro-mipi-dcphy-rx

reg:
maxItems: 1
Expand All @@ -42,7 +46,7 @@ properties:
items:
- items:
- description: the camera block's system registers
- description: offset of the per-slave reset register (bit = link)
- description: offset of the per-slave reset register (bit = slave)
description:
The register that holds each DC-PHY slave in reset (bit clear) or
releases it (bit set).
Expand Down
16 changes: 11 additions & 5 deletions drivers/media/i2c/imx386.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include <linux/math64.h>
#include <linux/module.h>
#include <linux/pm_runtime.h>
#include <linux/property.h>
#include <linux/regulator/consumer.h>
#include <linux/unaligned.h>

Expand All @@ -40,6 +41,7 @@
#define IMX386_REG_FRAME_COUNT CCI_REG8(0x0005)
#define IMX386_REG_CHIP_ID CCI_REG16(0x0016)
#define IMX386_CHIP_ID 0x0386
#define IMX712_CHIP_ID 0x0712
#define IMX386_REG_EXPOSURE CCI_REG16(0x0202)
#define IMX386_REG_ANALOG_GAIN CCI_REG16(0x0204)
/* per colour channel: Gr, R, B, Gb (CCS) */
Expand Down Expand Up @@ -152,6 +154,7 @@ struct imx386 {

struct clk *mclk;
struct gpio_desc *reset;
u16 chip_id; /* IMX386 (Pixel 7 Pro) or IMX712 (Pixel 9a), from the compatible */
struct regulator *supplies[IMX386_NUM_SUPPLIES];
u32 delays_us[3]; /* after the last supply, after MCLK, after reset */
u32 max_line_mbps; /* receiver's line throughput, MB/s; 0: none */
Expand Down Expand Up @@ -297,7 +300,7 @@ static int imx386_load_data(struct imx386 *s)
h = (const void *)s->fw->data;
if (le32_to_cpu(h->magic) != IMX386_FW_MAGIC ||
le16_to_cpu(h->version) != IMX386_FW_VERSION ||
le16_to_cpu(h->chip_id) != IMX386_CHIP_ID)
le16_to_cpu(h->chip_id) != s->chip_id)
goto bad;

s->num_modes = le16_to_cpu(h->num_modes);
Expand Down Expand Up @@ -897,10 +900,10 @@ static int imx386_identify(struct imx386 *s)
if (ret)
return dev_err_probe(s->dev, ret, "chip ID read failed\n");

if (id != IMX386_CHIP_ID)
if (id != s->chip_id)
return dev_err_probe(s->dev, -ENODEV,
"chip ID 0x%04llx, expected 0x%04x\n",
id, IMX386_CHIP_ID);
id, s->chip_id);

dev_info(s->dev, "model 0x%04llx\n", id);

Expand All @@ -919,6 +922,7 @@ static int imx386_probe(struct i2c_client *client)
return -ENOMEM;

s->dev = dev;
s->chip_id = (uintptr_t)device_get_match_data(dev) ?: IMX386_CHIP_ID;
v4l2_i2c_subdev_init(&s->sd, client, &imx386_subdev_ops);
s->sd.internal_ops = &imx386_internal_ops;

Expand Down Expand Up @@ -1042,7 +1046,9 @@ static DEFINE_RUNTIME_DEV_PM_OPS(imx386_pm_ops, imx386_power_off,
imx386_power_on, NULL);

static const struct of_device_id imx386_of_match[] = {
{ .compatible = "sony,imx386" },
{ .compatible = "sony,imx386", .data = (void *)IMX386_CHIP_ID },
/* Pixel 9a ultrawide: same CCS-style register map, own init and modes in its data file */
{ .compatible = "sony,imx712", .data = (void *)IMX712_CHIP_ID },
{ }
};
MODULE_DEVICE_TABLE(of, imx386_of_match);
Expand All @@ -1058,5 +1064,5 @@ static struct i2c_driver imx386_driver = {
};
module_i2c_driver(imx386_driver);

MODULE_DESCRIPTION("Sony IMX386 sensor driver");
MODULE_DESCRIPTION("Sony IMX386 and IMX712 sensor driver");
MODULE_LICENSE("GPL");
Loading