mbox series

[0/2] media: i2c: Add support for GC08A3 sensor

Message ID 20231123115104.32094-1-zhi.mao@mediatek.com
Headers show
Series media: i2c: Add support for GC08A3 sensor | expand

Message

Zhi Mao (毛智) Nov. 23, 2023, 11:51 a.m. UTC
This series adds YAML DT binding and V4L2 sub-device driver for Galaxycore's
GC08A3 8-megapixel 10-bit RAW CMOS 1/4" sensor, with an MIPI CSI-2 image data
interface and the I2C control bus.

The driver is implemented with V4L2 framework.
 - Async registered as a V4L2 sub-device.
 - As the first component of camera system including Seninf, ISP pipeline.
 - A media entity that provides one source pad in common.
 - Used in camera features on ChromeOS application.

Also this driver supports following features:
 - manual exposure and analog gain control support
 - vertical blanking control support
 - test pattern support
 - media controller support
 - runtime PM support
 - support resolution: 3264x2448@30fps, 1920x1080@60fps

Thanks

Zhi Mao (2):
  media: dt-bindings: media: i2c: Document GC08A3 bindings
  media: i2c: Add GC08A3 image sensor driver

 .../bindings/media/i2c/galaxycore,gc08a3.yaml |  128 ++
 .../devicetree/bindings/vendor-prefixes.yaml  |    2 +
 drivers/media/i2c/Kconfig                     |   14 +
 drivers/media/i2c/Makefile                    |    1 +
 drivers/media/i2c/gc08a3.c                    | 2046 +++++++++++++++++
 5 files changed, 2191 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/media/i2c/galaxycore,gc08a3.yaml
 create mode 100644 drivers/media/i2c/gc08a3.c

Comments

Laurent Pinchart Dec. 7, 2023, 10:25 a.m. UTC | #1
On Thu, Nov 23, 2023 at 05:31:35PM +0000, Conor Dooley wrote:
> On Thu, Nov 23, 2023 at 07:51:03PM +0800, Zhi Mao wrote:
> > Add YAML device tree binding for GC08A3 CMOS image sensor, 
> > and the relevant MAINTAINERS entries.
> > 
> > Signed-off-by: Zhi Mao <zhi.mao@mediatek.com>
> 
> Please test your bindings.
> 
> > ---
> >  .../bindings/media/i2c/galaxycore,gc08a3.yaml | 128 ++++++++++++++++++
> >  .../devicetree/bindings/vendor-prefixes.yaml  |   2 +
> >  2 files changed, 130 insertions(+)
> >  create mode 100644 Documentation/devicetree/bindings/media/i2c/galaxycore,gc08a3.yaml
> > 
> > diff --git a/Documentation/devicetree/bindings/media/i2c/galaxycore,gc08a3.yaml b/Documentation/devicetree/bindings/media/i2c/galaxycore,gc08a3.yaml
> > new file mode 100644
> > index 000000000000..089ea321da91
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/media/i2c/galaxycore,gc08a3.yaml
> > @@ -0,0 +1,128 @@
> > +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> > +%YAML 1.2
> > +---
> > +$id: http://devicetree.org/schemas/media/i2c/galaxycore,gc08a3.yaml#
> > +$schema: http://devicetree.org/meta-schemas/core.yaml#
> > +
> > +title: GalaxyCore gc08a3 1/4" 8M Pixel MIPI CSI-2 sensor
> > +
> > +maintainers:
> > +  - Zhi Mao <zhi.mao@mediatek.com>
> > +
> > +description: |-
> 
> The |- is not needed, you have no formatting to preserve.
> 
> > +  The gc08a3 is a raw image sensor with an MIPI CSI-2 image data
> > +  interface and CCI (I2C compatible) control bus. The output format
> > +  is raw Bayer.
> > +
> > +properties:
> > +  compatible:
> > +    const: GalaxyCore,gc08a3
> 
> Please remove the capitals.
> 
> > +
> > +  reg:
> > +    maxItems: 1
> > +
> > +  clocks:
> > +    items:
> > +      - description: Reference to the mclk clock.
> 
> Pointless, just use maxItems: 1.
> 
> > +
> > +  assigned-clocks:
> > +    maxItems: 1
> > +
> > +  assigned-clock-rates:
> > +    maxItems: 1
> > +
> > +  enable-gpios:
> > +    description: Reference to the GPIO connected to the RESETB pin. Active low.
> > +    maxItems: 1
> > +

If that's the RESETB pin, it should be reset-gpios.

> > +  vddio-supply:
> > +    description: Definition of the regulator used for the VDDIO power supply.
> > +
> > +  vdda-supply:
> > +    description: Definition of the regulator used for the VDDA power supply.
> > +
> > +  vddd-supply:
> > +    description: Definition of the regulator used for the VDDD power supply.
> 
> These descriptions can all be replaced with "foo-supply: true" IMO.
> 
> > +  port:
> > +    $ref: /schemas/graph.yaml#/$defs/port-base
> > +    unevaluatedProperties: false
> > +
> > +    properties:
> > +      endpoint:
> > +        $ref: /schemas/media/video-interfaces.yaml#
> > +        unevaluatedProperties: false
> > +
> > +        properties:
> > +          data-lanes:
> > +            oneOf:
> > +              - items:
> > +                  - const: 1
> > +                  - const: 2
> > +                  - const: 3
> > +                  - const: 4
> > +              - items:
> > +                  - const: 1
> > +                  - const: 2
> > +
> > +          link-frequencies: true
> > +
> > +        required:
> > +          - data-lanes
> > +          - link-frequencies
> > +
> > +required:
> > +  - compatible
> > +  - reg
> > +  - clocks
> 
> > +  - assigned-clocks
> > +  - assigned-clock-rates
> 
> Why are these required?
> 
> > +  - vddio-supply
> > +  - vdda-supply
> > +  - vddd-supply
> > +  - port
> > +
> > +additionalProperties: false
> > +
> > +examples:
> > +  - |
> > +    #include <dt-bindings/gpio/gpio.h>
> > +
> > +    i2c {
> > +        #address-cells = <1>;
> > +        #size-cells = <0>;
> > +
> > +        sensor0@2 {
> > +            status = "okay";
> > +            compatible = "GalaxyCore,gc08a3";
> > +            reg = <0x31>;
> > +
> > +            clocks = <&topckgen CLK_TOP_CAMTG>,
> > +                <&topckgen CLK_TOP_UNIVPLL_192M_D8>;
> > +            clock-names = "xvclk", "freq_mux";
> > +            clock-frequency = <24000000>;
> > +
> > +            assigned-clocks = <&topckgen CLK_TOP_CAMTG>,
> > +                    <&topckgen CLK_TOP_UNIVPLL_192M_D8>;
> > +            assigned-clock-parents = <&topckgen CLK_TOP_UNIVPLL_192M_D8>;
> > +            assigned-clock-rates = <0>, <24000000>;
> > +
> > +            enable-gpios = <&pio 19 GPIO_ACTIVE_HIGH>;
> > +
> > +            pinctrl-names = "default";
> > +            pinctrl-0 = <&camera_pins_cam0>;
> > +
> > +            avdd-supply = <&mt6359_vfe28_ldo_reg>;
> > +
> > +            port {
> > +                sensor0_out_2: endpoint {
> > +                    data-lanes = <1 2 3 4>;
> > +                    link-frequencies = /bits/ 64 <336000000 207000000>;
> > +                    remote-endpoint = <&seninf_csi_port_0_in_2>;
> > +                };
> > +            };
> > +        };
> > +
> > +    };
> > +
> > +...
> > diff --git a/Documentation/devicetree/bindings/vendor-prefixes.yaml b/Documentation/devicetree/bindings/vendor-prefixes.yaml
> > index 309b94c328c8..a0bbec0bfee2 100644
> > --- a/Documentation/devicetree/bindings/vendor-prefixes.yaml
> > +++ b/Documentation/devicetree/bindings/vendor-prefixes.yaml
> > @@ -502,6 +502,8 @@ patternProperties:
> >      description: Fujitsu Ltd.
> >    "^fxtec,.*":
> >      description: FX Technology Ltd.
> > +  "^GalaxyCore,.*":
> > +    description: GalaxyCore Inc.
> >    "^gardena,.*":
> >      description: GARDENA GmbH
> >    "^gateway,.*":
Zhi Mao (毛智) Jan. 9, 2024, 9:11 a.m. UTC | #2
On Thu, 2023-12-07 at 12:25 +0200, Laurent Pinchart wrote:
>  	 
> External email : Please do not click links or open attachments until
> you have verified the sender or the content.
>  On Thu, Nov 23, 2023 at 05:31:35PM +0000, Conor Dooley wrote:
> > On Thu, Nov 23, 2023 at 07:51:03PM +0800, Zhi Mao wrote:
> > > Add YAML device tree binding for GC08A3 CMOS image sensor, 
> > > and the relevant MAINTAINERS entries.
> > > 
> > > Signed-off-by: Zhi Mao <zhi.mao@mediatek.com>
> > 
> > Please test your bindings.
> > 
> > > ---
> > >  .../bindings/media/i2c/galaxycore,gc08a3.yaml | 128
> ++++++++++++++++++
> > >  .../devicetree/bindings/vendor-prefixes.yaml  |   2 +
> > >  2 files changed, 130 insertions(+)
> > >  create mode 100644
> Documentation/devicetree/bindings/media/i2c/galaxycore,gc08a3.yaml
> > > 
> > > diff --git
> a/Documentation/devicetree/bindings/media/i2c/galaxycore,gc08a3.yaml
> b/Documentation/devicetree/bindings/media/i2c/galaxycore,gc08a3.yaml
> > > new file mode 100644
> > > index 000000000000..089ea321da91
> > > --- /dev/null
> > > +++
> b/Documentation/devicetree/bindings/media/i2c/galaxycore,gc08a3.yaml
> > > @@ -0,0 +1,128 @@
> > > +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> > > +%YAML 1.2
> > > +---
> > > +$id: 
> http://devicetree.org/schemas/media/i2c/galaxycore,gc08a3.yaml#
> > > +$schema: http://devicetree.org/meta-schemas/core.yaml#
> > > +
> > > +title: GalaxyCore gc08a3 1/4" 8M Pixel MIPI CSI-2 sensor
> > > +
> > > +maintainers:
> > > +  - Zhi Mao <zhi.mao@mediatek.com>
> > > +
> > > +description: |-
> > 
> > The |- is not needed, you have no formatting to preserve.
> > 
> > > +  The gc08a3 is a raw image sensor with an MIPI CSI-2 image data
> > > +  interface and CCI (I2C compatible) control bus. The output
> format
> > > +  is raw Bayer.
> > > +
> > > +properties:
> > > +  compatible:
> > > +    const: GalaxyCore,gc08a3
> > 
> > Please remove the capitals.
> > 
> > > +
> > > +  reg:
> > > +    maxItems: 1
> > > +
> > > +  clocks:
> > > +    items:
> > > +      - description: Reference to the mclk clock.
> > 
> > Pointless, just use maxItems: 1.
> > 
> > > +
> > > +  assigned-clocks:
> > > +    maxItems: 1
> > > +
> > > +  assigned-clock-rates:
> > > +    maxItems: 1
> > > +
> > > +  enable-gpios:
> > > +    description: Reference to the GPIO connected to the RESETB
> pin. Active low.
> > > +    maxItems: 1
> > > +
> 
> If that's the RESETB pin, it should be reset-gpios.
[mtk]: yes, it's reset-pin, fixed in patch:v3.
and some other comments also fixed, please review patch:v3.

https://lore.kernel.org/linux-media/20240109022715.30278-1-zhi.mao@mediatek.com/
> 
> > > +  vddio-supply:
> > > +    description: Definition of the regulator used for the VDDIO
> power supply.
> > > +
> > > +  vdda-supply:
> > > +    description: Definition of the regulator used for the VDDA
> power supply.
> > > +
> > > +  vddd-supply:
> > > +    description: Definition of the regulator used for the VDDD
> power supply.
> > 
> > These descriptions can all be replaced with "foo-supply: true" IMO.
> > 
> > > +  port:
> > > +    $ref: /schemas/graph.yaml#/$defs/port-base
> > > +    unevaluatedProperties: false
> > > +
> > > +    properties:
> > > +      endpoint:
> > > +        $ref: /schemas/media/video-interfaces.yaml#
> > > +        unevaluatedProperties: false
> > > +
> > > +        properties:
> > > +          data-lanes:
> > > +            oneOf:
> > > +              - items:
> > > +                  - const: 1
> > > +                  - const: 2
> > > +                  - const: 3
> > > +                  - const: 4
> > > +              - items:
> > > +                  - const: 1
> > > +                  - const: 2
> > > +
> > > +          link-frequencies: true
> > > +
> > > +        required:
> > > +          - data-lanes
> > > +          - link-frequencies
> > > +
> > > +required:
> > > +  - compatible
> > > +  - reg
> > > +  - clocks
> > 
> > > +  - assigned-clocks
> > > +  - assigned-clock-rates
> > 
> > Why are these required?
> > 
> > > +  - vddio-supply
> > > +  - vdda-supply
> > > +  - vddd-supply
> > > +  - port
> > > +
> > > +additionalProperties: false
> > > +
> > > +examples:
> > > +  - |
> > > +    #include <dt-bindings/gpio/gpio.h>
> > > +
> > > +    i2c {
> > > +        #address-cells = <1>;
> > > +        #size-cells = <0>;
> > > +
> > > +        sensor0@2 {
> > > +            status = "okay";
> > > +            compatible = "GalaxyCore,gc08a3";
> > > +            reg = <0x31>;
> > > +
> > > +            clocks = <&topckgen CLK_TOP_CAMTG>,
> > > +                <&topckgen CLK_TOP_UNIVPLL_192M_D8>;
> > > +            clock-names = "xvclk", "freq_mux";
> > > +            clock-frequency = <24000000>;
> > > +
> > > +            assigned-clocks = <&topckgen CLK_TOP_CAMTG>,
> > > +                    <&topckgen CLK_TOP_UNIVPLL_192M_D8>;
> > > +            assigned-clock-parents = <&topckgen
> CLK_TOP_UNIVPLL_192M_D8>;
> > > +            assigned-clock-rates = <0>, <24000000>;
> > > +
> > > +            enable-gpios = <&pio 19 GPIO_ACTIVE_HIGH>;
> > > +
> > > +            pinctrl-names = "default";
> > > +            pinctrl-0 = <&camera_pins_cam0>;
> > > +
> > > +            avdd-supply = <&mt6359_vfe28_ldo_reg>;
> > > +
> > > +            port {
> > > +                sensor0_out_2: endpoint {
> > > +                    data-lanes = <1 2 3 4>;
> > > +                    link-frequencies = /bits/ 64 <336000000
> 207000000>;
> > > +                    remote-endpoint = <&seninf_csi_port_0_in_2>;
> > > +                };
> > > +            };
> > > +        };
> > > +
> > > +    };
> > > +
> > > +...
> > > diff --git a/Documentation/devicetree/bindings/vendor-
> prefixes.yaml b/Documentation/devicetree/bindings/vendor-
> prefixes.yaml
> > > index 309b94c328c8..a0bbec0bfee2 100644
> > > --- a/Documentation/devicetree/bindings/vendor-prefixes.yaml
> > > +++ b/Documentation/devicetree/bindings/vendor-prefixes.yaml
> > > @@ -502,6 +502,8 @@ patternProperties:
> > >      description: Fujitsu Ltd.
> > >    "^fxtec,.*":
> > >      description: FX Technology Ltd.
> > > +  "^GalaxyCore,.*":
> > > +    description: GalaxyCore Inc.
> > >    "^gardena,.*":
> > >      description: GARDENA GmbH
> > >    "^gateway,.*":
> 
> -- 
> Regards,
> 
> Laurent Pinchart