Camera Sensor Drivers
Subsystems (6)
cover Camera Sensor Drivers
From: Martina Krasteva <[email protected]>
Patch series contains Sony IMX335, Sony IMX412 and OmniVision OV9282 camera sensor drivers and respective binding documentation.
Martina Krasteva (6):
dt-bindings: media: Add bindings for imx335
media: i2c: Add imx335 camera sensor driver
dt-bindings: media: Add bindings for imx412
media: i2c: Add imx412 camera sensor driver
dt-bindings: media: Add bindings for ov9282
media: i2c: Add ov9282 camera sensor driver
.../devicetree/bindings/media/i2c/ovti,ov9282.yaml | 90 ++ .../devicetree/bindings/media/i2c/sony,imx335.yaml | 90 ++ .../devicetree/bindings/media/i2c/sony,imx412.yaml | 90 ++ MAINTAINERS | 27 + drivers/media/i2c/Kconfig | 42 + drivers/media/i2c/Makefile | 4 +- drivers/media/i2c/imx335.c | 1126 +++++++++++++++++ drivers/media/i2c/imx412.c | 1269 ++++++++++++++++++++ drivers/media/i2c/ov9282.c | 1134 +++++++++++++++++ 9 files changed, 3871 insertions(+), 1 deletion(-) create mode 100644 Documentation/devicetree/bindings/media/i2c/ovti,ov9282.yaml create mode 100644 Documentation/devicetree/bindings/media/i2c/sony,imx335.yaml create mode 100644 Documentation/devicetree/bindings/media/i2c/sony,imx412.yaml create mode 100644 drivers/media/i2c/imx335.c create mode 100644 drivers/media/i2c/imx412.c create mode 100644 drivers/media/i2c/ov9282.c
base-commit: 9d49ed9ca93b8c564033c1d6808017bc9052b5db
Signature · 1 line
2.11.0
PATCH 1/6 dt-bindings: media: Add bindings for imx335
From: Martina Krasteva <[email protected]>
- Add dt-bindings documentation for Sony imx335 sensor driver
- Add MAINTAINERS entry for Sony imx335 binding documentation
--- .../devicetree/bindings/media/i2c/sony,imx335.yaml | 90 ++++++++++++++++++++++ MAINTAINERS | 8 ++ 2 files changed, 98 insertions(+) create mode 100644 Documentation/devicetree/bindings/media/i2c/sony,imx335.yaml
Documentation/devicetree/bindings/media/i2c/sony,imx335.yaml new file +90 -0
@@ -0,0 +1,90 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +# Copyright (C) 2021 Intel Corporation +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/media/i2c/sony,imx335.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Sony IMX335 Sensor + +maintainers: + - Paul J. Murphy <[email protected]> + - Daniele Alessandrelli <[email protected]> + +description: + IMX335 sensor is a Sony CMOS active pixel digital image sensor with an active + array size of 2592H x 1944V. It is programmable through I2C interface. The + I2C client address is fixed to 0x1a as per sensor data sheet. Image data is + sent through MIPI CSI-2. + +properties: + compatible: + const: sony,imx335 + reg: + description: I2C address + maxItems: 1 + + assigned-clocks: true + assigned-clock-parents: true + assigned-clock-rates: true + + clocks: + description: Clock frequency from 6 to 27 MHz, 37.125MHz, 74.25MHz + maxItems: 1 + + reset-gpios: + description: Reference to the GPIO connected to the XCLR pin, if any. + + port: + additionalProperties: false + $ref: /schemas/graph.yaml#/properties/port + + properties: + endpoint: + $ref: /schemas/media/video-interfaces.yaml# + unevaluatedProperties: false + + properties: + data-lanes: true + link-frequencies: true + + required: + - data-lanes + - link-frequencies + + required: + - endpoint + +required: + - compatible + - reg + - clocks + - port + +additionalProperties: false + +examples: + - | + i2c0 { + #address-cells = <1>; + #size-cells = <0>; + + camera@1a { + compatible = "sony,imx335"; + reg = <0x1a>; + clocks = <&imx335_clk>; + + assigned-clocks = <&imx335_clk>; + assigned-clock-parents = <&imx335_clk_parent>; + assigned-clock-rates = <24000000>; + + port { + imx335: endpoint { + remote-endpoint = <&cam>; + data-lanes = <1 2 3 4>; + link-frequencies = /bits/ 64 <594000000>; + }; + }; + }; + }; +...
MAINTAINERS +8 -0
@@ -16875,6 +16875,14 @@ T: git git://linuxtv.org/media_tree.git F: Documentation/devicetree/bindings/media/i2c/sony,imx334.yaml F: drivers/media/i2c/imx334.c +SONY IMX335 SENSOR DRIVER +M: Paul J. Murphy <[email protected]> +M: Daniele Alessandrelli <[email protected]> +L: [email protected] +S: Maintained +T: git git://linuxtv.org/media_tree.git +F: Documentation/devicetree/bindings/media/i2c/sony,imx335.yaml + SONY IMX355 SENSOR DRIVER M: Tianshu Qiu <[email protected]> L: [email protected]
Signature · 1 line
2.11.0
Re: [PATCH 1/6] dt-bindings: media: Add bindings for imx335
Quoted 5 lines · Martina Krasteva
From: Martina Krasteva <[email protected]>
- Add dt-bindings documentation for Sony imx335 sensor driver
- AddMAINTAINERSentry for Sony imx335 binding documentation
Quoted 9 lines
Signed-off-by Martina Krasteva <[email protected]>Acked-by Paul J. Murphy <[email protected]>--- .../devicetree/bindings/media/i2c/sony,imx335.yaml | 90 ++++++++++++++++++++++ MAINTAINERS | 8 ++ 2 files changed, 98 insertions(+) create mode 100644 Documentation/devicetree/bindings/media/i2c/sony,imx335.yaml
Rob Herring
maintainerRe: [PATCH 1/6] dt-bindings: media: Add bindings for imx335
In reply to Martina KrastevaQuoted 46 lines · Martina Krasteva
From: Martina Krasteva <[email protected]>
- Add dt-bindings documentation for Sony imx335 sensor driver
- AddMAINTAINERSentry for Sony imx335 binding documentationSigned-off-by Martina Krasteva <[email protected]>Acked-by Paul J. Murphy <[email protected]>--- .../devicetree/bindings/media/i2c/sony,imx335.yaml | 90 ++++++++++++++++++++++ MAINTAINERS | 8 ++ 2 files changed, 98 insertions(+) create mode 100644 Documentation/devicetree/bindings/media/i2c/sony,imx335.yamlDocumentation/devicetree/bindings/media/i2c/sony,imx335.yaml new file +26
-0@@ -0,0 +1,90 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +# Copyright (C) 2021 Intel Corporation +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/media/i2c/sony,imx335.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Sony IMX335 Sensor + +maintainers: + - Paul J. Murphy <[email protected]> + - Daniele Alessandrelli <[email protected]> + +description: + IMX335 sensor is a Sony CMOS active pixel digital image sensor with an active + array size of 2592H x 1944V. It is programmable through I2C interface. The + I2C client address is fixed to 0x1a as per sensor data sheet. Image data is + sent through MIPI CSI-2. + +properties: + compatible: + const: sony,imx335 + reg: + description: I2C address + maxItems: 1 +
Documentation/devicetree/bindings/media/i2c/sony,imx335.yaml line 36
Quoted 10 lines
Documentation/devicetree/bindings/media/i2c/sony,imx335.yaml new file +10
-0+ assigned-clocks: true + assigned-clock-parents: true + assigned-clock-rates: true + + clocks: + description: Clock frequency from 6 to 27 MHz, 37.125MHz, 74.25MHz + maxItems: 1 + + reset-gpios: + description: Reference to the GPIO connected to the XCLR pin, if any.
Missed one thing. You need 'maxItems: 1' to define how many gpios.
Quoted 76 lines
Documentation/devicetree/bindings/media/i2c/sony,imx335.yaml new file +54
-0+ + port: + additionalProperties: false + $ref: /schemas/graph.yaml#/properties/port + + properties: + endpoint: + $ref: /schemas/media/video-interfaces.yaml# + unevaluatedProperties: false + + properties: + data-lanes: true + link-frequencies: true + + required: + - data-lanes + - link-frequencies + + required: + - endpoint + +required: + - compatible + - reg + - clocks + - port + +additionalProperties: false + +examples: + - | + i2c0 { + #address-cells = <1>; + #size-cells = <0>; + + camera@1a { + compatible = "sony,imx335"; + reg = <0x1a>; + clocks = <&imx335_clk>; + + assigned-clocks = <&imx335_clk>; + assigned-clock-parents = <&imx335_clk_parent>; + assigned-clock-rates = <24000000>; + + port { + imx335: endpoint { + remote-endpoint = <&cam>; + data-lanes = <1 2 3 4>; + link-frequencies = /bits/ 64 <594000000>; + }; + }; + }; + }; +...MAINTAINERS +8
-0@@ -16875,6 +16875,14 @@ T: git git://linuxtv.org/media_tree.git F: Documentation/devicetree/bindings/media/i2c/sony,imx334.yaml F: drivers/media/i2c/imx334.c +SONY IMX335 SENSOR DRIVER +M: Paul J. Murphy <[email protected]> +M: Daniele Alessandrelli <[email protected]> +L: [email protected] +S: Maintained +T: git git://linuxtv.org/media_tree.git +F: Documentation/devicetree/bindings/media/i2c/sony,imx335.yaml + SONY IMX355 SENSOR DRIVER M: Tianshu Qiu <[email protected]> L: [email protected]Signature · 1 line
2.11.0
RE: [PATCH 1/6] dt-bindings: media: Add bindings for imx335
Hi Rob,
Thank you for the review
Quoted 56 lines · Martina Krasteva
Quoted 10 lines
From: Martina Krasteva <[email protected]>
- Add dt-bindings documentation for Sony imx335 sensor driver
- AddMAINTAINERSentry for Sony imx335 binding documentationSigned-off-by Martina Krasteva <[email protected]>Acked-by Paul J. Murphy <[email protected]>--- .../devicetree/bindings/media/i2c/sony,imx335.yaml | 90++++++++++++++++++++++
Quoted 43 lines
MAINTAINERS | 8 ++ 2 files changed, 98 insertions(+) create mode 100644
Documentation/devicetree/bindings/media/i2c/sony,imx335.yamldiff --git
a/Documentation/devicetree/bindings/media/i2c/sony,imx335.yamlb/Documentation/devicetree/bindings/media/i2c/sony,imx335.yamlnew file mode 100644
index 000000000000..0e286226ad9bDocumentation/devicetree/bindings/media/i2c/sony,imx335.yaml new file +30
-0@@ -0,0 +1,90 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) # Copyright +(C) 2021 Intel Corporation %YAML 1.2 +--- +$id: http://devicetree.org/schemas/media/i2c/sony,imx335.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Sony IMX335 Sensor + +maintainers: + - Paul J. Murphy <[email protected]> + - Daniele Alessandrelli <[email protected]> + +description: + IMX335 sensor is a Sony CMOS active pixel digital image sensor with +an active + array size of 2592H x 1944V. It is programmable through I2C +interface. The + I2C client address is fixed to 0x1a as per sensor data sheet. Image +data is + sent through MIPI CSI-2. + +properties: + compatible: + const: sony,imx335 + reg: + description: I2C address + maxItems: 1 + + assigned-clocks: true + assigned-clock-parents: true
Quoted 8 lines
Documentation/devicetree/bindings/media/i2c/sony,imx335.yaml
Quoted 8 lines
Documentation/devicetree/bindings/media/i2c/sony,imx335.yaml new file +8
-0+ assigned-clock-rates: true + + clocks: + description: Clock frequency from 6 to 27 MHz, 37.125MHz, 74.25MHz + maxItems: 1 + + reset-gpios: + description: Reference to the GPIO connected to the XCLR pin, if
any.
Quoted 3 lines
Missed one thing. You need 'maxItems: 1' to define how many gpios.
Will be added in next version :)
Quoted 62 lines
Quoted 62 lines
Documentation/devicetree/bindings/media/i2c/sony,imx335.yaml new file +54
-0+ + port: + additionalProperties: false + $ref: /schemas/graph.yaml#/properties/port + + properties: + endpoint: + $ref: /schemas/media/video-interfaces.yaml# + unevaluatedProperties: false + + properties: + data-lanes: true + link-frequencies: true + + required: + - data-lanes + - link-frequencies + + required: + - endpoint + +required: + - compatible + - reg + - clocks + - port + +additionalProperties: false + +examples: + - | + i2c0 { + #address-cells = <1>; + #size-cells = <0>; + + camera@1a { + compatible = "sony,imx335"; + reg = <0x1a>; + clocks = <&imx335_clk>; + + assigned-clocks = <&imx335_clk>; + assigned-clock-parents = <&imx335_clk_parent>; + assigned-clock-rates = <24000000>; + + port { + imx335: endpoint { + remote-endpoint = <&cam>; + data-lanes = <1 2 3 4>; + link-frequencies = /bits/ 64 <594000000>; + }; + }; + }; + }; +...MAINTAINERS index renamed from MAINTAINERS +0
-0
cd988b258fe0..510e3c4a45b6100644MAINTAINERS +0
-0@@ -16875,6 +16875,14 @@ T: git git://linuxtv.org/media_tree.git F: Documentation/devicetree/bindings/media/i2c/sony,imx334.yaml F: drivers/media/i2c/imx334.c
Quoted 14 lines
Quoted 12 lines
MAINTAINERS +8
-1+SONY IMX335 SENSOR DRIVER +M: Paul J. Murphy <[email protected]> +M: Daniele Alessandrelli <[email protected]> +L: [email protected] +S: Maintained +T: git git://linuxtv.org/media_tree.git +F: Documentation/devicetree/bindings/media/i2c/sony,imx335.yaml + SONY IMX355 SENSOR DRIVER M: Tianshu Qiu <[email protected]> L: [email protected] --Quoted 2 lines
2.11.0
Best Regards,
Martina
PATCH 2/6 media: i2c: Add imx335 camera sensor driver
In reply to Martina KrastevaFrom: Martina Krasteva <[email protected]>
Add a v4l2 sub-device driver for the Sony imx335 image sensor. ThE camera sensor uses the i2c bus for control and the csi-2 bus for data.
The following features are supported:
- manual exposure and analog gain control support
- vblank/hblank/pixel rate/link freq control support
- supported resolution:
- 2592x1940 @ 30fps
- supported bayer order output:
- SRGGB12
--- MAINTAINERS | 1 + drivers/media/i2c/Kconfig | 14 + drivers/media/i2c/Makefile | 1 + drivers/media/i2c/imx335.c | 1126 ++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 1142 insertions(+) create mode 100644 drivers/media/i2c/imx335.c
MAINTAINERS +1 -0
@@ -16882,6 +16882,7 @@ L: [email protected] S: Maintained T: git git://linuxtv.org/media_tree.git F: Documentation/devicetree/bindings/media/i2c/sony,imx335.yaml +F: drivers/media/i2c/imx335.c SONY IMX355 SENSOR DRIVER M: Tianshu Qiu <[email protected]>
drivers/media/i2c/Kconfig +14 -0
@@ -827,6 +827,20 @@ config VIDEO_IMX334 To compile this driver as a module, choose M here: the module will be called imx334. +config VIDEO_IMX335 + tristate "Sony IMX335 sensor support" + depends on OF_GPIO + depends on I2C && VIDEO_V4L2 + select VIDEO_V4L2_SUBDEV_API + select MEDIA_CONTROLLER + select V4L2_FWNODE + help + This is a Video4Linux2 sensor driver for the Sony + IMX335 camera. + + To compile this driver as a module, choose M here: the + module will be called imx335. + config VIDEO_IMX355 tristate "Sony IMX355 sensor support" depends on I2C && VIDEO_V4L2
drivers/media/i2c/Makefile +1 -0
@@ -123,6 +123,7 @@ obj-$(CONFIG_VIDEO_IMX274) += imx274.o obj-$(CONFIG_VIDEO_IMX290) += imx290.o obj-$(CONFIG_VIDEO_IMX319) += imx319.o obj-$(CONFIG_VIDEO_IMX334) += imx334.o +obj-$(CONFIG_VIDEO_IMX335) += imx335.o obj-$(CONFIG_VIDEO_IMX355) += imx355.o obj-$(CONFIG_VIDEO_MAX9286) += max9286.o obj-$(CONFIG_VIDEO_MAX9271_LIB) += max9271.o
drivers/media/i2c/imx335.c new file +1126 -0
1,126 lines not on this page · raw message
Signature · 1 line
2.11.0
Sakari Ailus
maintainerRe: [PATCH 2/6] media: i2c: Add imx335 camera sensor driver
Hi Martina,
Thanks for the a of new drivers. Also my apologies for reviewing them so late.
On Tue, Mar 30, 2021 at 03:20:19PM +0100, Martina Krasteva wrote:
...
Quoted 89 lines
drivers/media/i2c/imx335.c new file +89
-0+static int imx335_probe (struct i2c_client *client) +{ +struct imx335 *imx335; +int ret; + + imx335 =devm_kzalloc (&client->dev,sizeof (*imx335),GFP_KERNEL ); +if (!imx335) +return -ENOMEM ; + + imx335->dev = &client->dev; + +/* Initialize subdev */ +v4l2_i2c_subdev_init (&imx335->sd, client, &imx335_subdev_ops); + + ret =imx335_parse_hw_config (imx335); +if (ret) { +dev_err (imx335->dev,"HW configuration is not supported" ); +return ret; + } + +mutex_init (&imx335->mutex); + + ret =imx335_power_on (imx335->dev); +if (ret) { +dev_err (imx335->dev,"failed to power-on the sensor" ); + goto error_mutex_destroy; + } + +/* Check module identity */ + ret =imx335_detect (imx335); +if (ret) { +dev_err (imx335->dev,"failed to find sensor: %d" , ret); + goto error_power_off; + } + +/* Set default mode to max resolution */ + imx335->cur_mode = &supported_mode; + imx335->vblank = imx335->cur_mode->vblank; + + ret =imx335_init_controls (imx335); +if (ret) { +dev_err (imx335->dev,"failed to init controls: %d" , ret); + goto error_power_off; + } + +/* Initialize subdev */ + imx335->sd.flags |=V4L2_SUBDEV_FL_HAS_DEVNODE ; + imx335->sd.entity.function =MEDIA_ENT_F_CAM_SENSOR ; + +/* Initialize source pad */ + imx335->pad.flags =MEDIA_PAD_FL_SOURCE ; + ret =media_entity_pads_init (&imx335->sd.entity,1 , &imx335->pad); +if (ret) { +dev_err (imx335->dev,"failed to init entity pads: %d" , ret); + goto error_handler_free; + } + + ret =v4l2_async_register_subdev_sensor_common (&imx335->sd); +if (ret <0 ) { +dev_err (imx335->dev, +"failed to register async subdev: %d" , ret); + goto error_media_entity; + } + +pm_runtime_set_active (imx335->dev); +pm_runtime_enable (imx335->dev); +pm_runtime_idle (imx335->dev); + +return 0 ; + +error_media_entity: +media_entity_cleanup (&imx335->sd.entity); +error_handler_free: +v4l2_ctrl_handler_free (imx335->sd.ctrl_handler); +error_power_off: +imx335_power_off (imx335->dev); +error_mutex_destroy: +mutex_destroy (&imx335->mutex); + +return ret; +} + +/** +* imx335_remove() - I2C client device unbinding +* @client: pointer to I2C client device +* +* Return: 0 if successful, error code otherwise. +*/ +static int imx335_remove (struct i2c_client *client)
drivers/media/i2c/imx335.c line 1095
Quoted 10 lines
drivers/media/i2c/imx335.c new file +10
-0+{ +struct v4l2_subdev *sd =i2c_get_clientdata (client); +struct imx335 *imx335 =to_imx335 (sd); + +v4l2_async_unregister_subdev (sd); +media_entity_cleanup (&sd->entity); +v4l2_ctrl_handler_free (sd->ctrl_handler); + +pm_runtime_disable (&client->dev); +pm_runtime_suspended (&client->dev);
The sensor will be powered off here only if runtime PM is enabled.
Could you use pm_runtime_status_suspended() to check whether the device is still powered on, as e.g. the CCS driver (drivers/media/i2c/ccs/ccs-core.c) does?
I think I'll merge these when this and Rob's comments have been addressed.
Quoted 31 lines
drivers/media/i2c/imx335.c new file +31
-0+ +mutex_destroy (&imx335->mutex); + +return 0 ; +} + +static const struct dev_pm_ops imx335_pm_ops = { +SET_RUNTIME_PM_OPS (imx335_power_off, imx335_power_on,NULL ) +}; + +static const struct of_device_id imx335_of_match[] = { + { .compatible ="sony,imx335" }, + { } +}; + +MODULE_DEVICE_TABLE (of, imx335_of_match); + +static struct i2c_driver imx335_driver = { + .probe_new = imx335_probe, + .remove = imx335_remove, + .driver = { + .name ="imx335" , + .pm = &imx335_pm_ops, + .of_match_table = imx335_of_match, + }, +}; + +module_i2c_driver (imx335_driver); + +MODULE_DESCRIPTION ("Sony imx335 sensor driver" ); +MODULE_LICENSE ("GPL" );
Signature · 3 lines
Kind regards, Sakari Ailus
RE: [PATCH 2/6] media: i2c: Add imx335 camera sensor driver
Hi Sakari,
Thank you for your review. I will address both your and Rob's comments.
I have a question regarding the switch from pm_runtime_get_sync() to pm_runtime_resume_and_get()
In my understanding get_sync() is fine to use in case the error handling is correct, but for convenience resume_and_get() is recommended.
So should I do this change in my drivers as well?
Best Regards,
Martina
Quoted 153 lines
Hi Martina,
Thanks for the a of new drivers. Also my apologies for reviewing them so late.
On Tue, Mar 30, 2021 at 03:20:19PM +0100, Martina Krasteva wrote:
...
Quoted 89 lines
drivers/media/i2c/imx335.c new file +89
-0+static int imx335_probe (struct i2c_client *client) +{ +struct imx335 *imx335; +int ret; + + imx335 =devm_kzalloc (&client->dev,sizeof (*imx335),GFP_KERNEL ); +if (!imx335) +return -ENOMEM ; + + imx335->dev = &client->dev; + +/* Initialize subdev */ +v4l2_i2c_subdev_init (&imx335->sd, client, &imx335_subdev_ops); + + ret =imx335_parse_hw_config (imx335); +if (ret) { +dev_err (imx335->dev,"HW configuration is not supported" ); +return ret; + } + +mutex_init (&imx335->mutex); + + ret =imx335_power_on (imx335->dev); +if (ret) { +dev_err (imx335->dev,"failed to power-on the sensor" ); + goto error_mutex_destroy; + } + +/* Check module identity */ + ret =imx335_detect (imx335); +if (ret) { +dev_err (imx335->dev,"failed to find sensor: %d" , ret); + goto error_power_off; + } + +/* Set default mode to max resolution */ + imx335->cur_mode = &supported_mode; + imx335->vblank = imx335->cur_mode->vblank; + + ret =imx335_init_controls (imx335); +if (ret) { +dev_err (imx335->dev,"failed to init controls: %d" , ret); + goto error_power_off; + } + +/* Initialize subdev */ + imx335->sd.flags |=V4L2_SUBDEV_FL_HAS_DEVNODE ; + imx335->sd.entity.function =MEDIA_ENT_F_CAM_SENSOR ; + +/* Initialize source pad */ + imx335->pad.flags =MEDIA_PAD_FL_SOURCE ; + ret =media_entity_pads_init (&imx335->sd.entity,1 , &imx335->pad); +if (ret) { +dev_err (imx335->dev,"failed to init entity pads: %d" , ret); + goto error_handler_free; + } + + ret =v4l2_async_register_subdev_sensor_common (&imx335->sd); +if (ret <0 ) { +dev_err (imx335->dev, +"failed to register async subdev: %d" , ret); + goto error_media_entity; + } + +pm_runtime_set_active (imx335->dev); +pm_runtime_enable (imx335->dev); +pm_runtime_idle (imx335->dev); + +return 0 ; + +error_media_entity: +media_entity_cleanup (&imx335->sd.entity); +error_handler_free: +v4l2_ctrl_handler_free (imx335->sd.ctrl_handler); +error_power_off: +imx335_power_off (imx335->dev); +error_mutex_destroy: +mutex_destroy (&imx335->mutex); + +return ret; +} + +/** +* imx335_remove() - I2C client device unbinding +* @client: pointer to I2C client device +* +* Return: 0 if successful, error code otherwise. +*/ +static int imx335_remove (struct i2c_client *client)drivers/media/i2c/imx335.c line 1095
Quoted 10 lines
drivers/media/i2c/imx335.c new file +10
-0+{ +struct v4l2_subdev *sd =i2c_get_clientdata (client); +struct imx335 *imx335 =to_imx335 (sd); + +v4l2_async_unregister_subdev (sd); +media_entity_cleanup (&sd->entity); +v4l2_ctrl_handler_free (sd->ctrl_handler); + +pm_runtime_disable (&client->dev); +pm_runtime_suspended (&client->dev);The sensor will be powered off here only if runtime PM is enabled.
Could you use
pm_runtime_status_suspended()to check whether the device is still powered on, as e.g. the CCS driver (drivers/media/i2c/ccs/ccs-core.c) does?I think I'll merge these when this and Rob's comments have been addressed.
Quoted 21 lines
drivers/media/i2c/imx335.c new file +21
-0+ +mutex_destroy (&imx335->mutex); + +return 0 ; +} + +static const struct dev_pm_ops imx335_pm_ops = { +SET_RUNTIME_PM_OPS (imx335_power_off, imx335_power_on,NULL ) +}; + +static const struct of_device_id imx335_of_match[] = { + { .compatible ="sony,imx335" }, + { } +}; + +MODULE_DEVICE_TABLE (of, imx335_of_match); + +static struct i2c_driver imx335_driver = { + .probe_new = imx335_probe, + .remove = imx335_remove, + .driver = {drivers/media/i2c/imx335.c line 1126
Quoted 10 lines
drivers/media/i2c/imx335.c new file +10
-0+ .name = "imx335", + .pm = &imx335_pm_ops, + .of_match_table = imx335_of_match, + }, +}; + +module_i2c_driver (imx335_driver); + +MODULE_DESCRIPTION ("Sony imx335 sensor driver" ); +MODULE_LICENSE ("GPL" );--
Kind regards,Sakari Ailus
PATCH 3/6 dt-bindings: media: Add bindings for imx412
In reply to Martina KrastevaFrom: Martina Krasteva <[email protected]>
- Add dt-bindings documentation for Sony imx412 sensor driver
- Add MAINTAINERS entry for Sony imx412 binding documentation
--- .../devicetree/bindings/media/i2c/sony,imx412.yaml | 90 ++++++++++++++++++++++ MAINTAINERS | 8 ++ 2 files changed, 98 insertions(+) create mode 100644 Documentation/devicetree/bindings/media/i2c/sony,imx412.yaml
Documentation/devicetree/bindings/media/i2c/sony,imx412.yaml new file +90 -0
@@ -0,0 +1,90 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +# Copyright (C) 2021 Intel Corporation +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/media/i2c/sony,imx412.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Sony IMX412 Sensor + +maintainers: + - Paul J. Murphy <[email protected]> + - Daniele Alessandrelli <[email protected]> + +description: + IMX412 sensor is a Sony CMOS active pixel digital image sensor with an active + array size of 4072H x 3176V. It is programmable through I2C interface. The + I2C client address is fixed to 0x1a as per sensor data sheet. Image data is + sent through MIPI CSI-2. + +properties: + compatible: + const: sony,imx412 + reg: + description: I2C address + maxItems: 1 + + assigned-clocks: true + assigned-clock-parents: true + assigned-clock-rates: true + + clocks: + description: Clock frequency 6MHz, 12MHz, 18MHz, 24MHz or 27MHz + maxItems: 1 + + reset-gpios: + description: Reference to the GPIO connected to the XCLR pin, if any. + + port: + additionalProperties: false + $ref: /schemas/graph.yaml#/properties/port + + properties: + endpoint: + $ref: /schemas/media/video-interfaces.yaml# + unevaluatedProperties: false + + properties: + data-lanes: true + link-frequencies: true + + required: + - data-lanes + - link-frequencies + + required: + - endpoint + +required: + - compatible + - reg + - clocks + - port + +additionalProperties: false + +examples: + - | + i2c0 { + #address-cells = <1>; + #size-cells = <0>; + + camera@1a { + compatible = "sony,imx412"; + reg = <0x1a>; + clocks = <&imx412_clk>; + + assigned-clocks = <&imx412_clk>; + assigned-clock-parents = <&imx412_clk_parent>; + assigned-clock-rates = <24000000>; + + port { + imx412: endpoint { + remote-endpoint = <&cam>; + data-lanes = <1 2 3 4>; + link-frequencies = /bits/ 64 <600000000>; + }; + }; + }; + }; +...
MAINTAINERS +8 -0
@@ -16891,6 +16891,14 @@ S: Maintained T: git git://linuxtv.org/media_tree.git F: drivers/media/i2c/imx355.c +SONY IMX412 SENSOR DRIVER +M: Paul J. Murphy <[email protected]> +M: Daniele Alessandrelli <[email protected]> +L: [email protected] +S: Maintained +T: git git://linuxtv.org/media_tree.git +F: Documentation/devicetree/bindings/media/i2c/sony,imx412.yaml + SONY MEMORYSTICK SUBSYSTEM M: Maxim Levitsky <[email protected]> M: Alex Dubov <[email protected]>
Signature · 1 line
2.11.0
PATCH 4/6 media: i2c: Add imx412 camera sensor driver
In reply to Martina KrastevaFrom: Martina Krasteva <[email protected]>
Add a v4l2 sub-device driver for the Sony imx412 image sensor. This is a camera sensor using the i2c bus for control and the csi-2 bus for data.
The following features are supported:
- manual exposure and analog gain control support
- vblank/hblank/pixel rate/link freq control support
- supported resolution:
- 4056x3040 @ 30fps
- supported bayer order output:
- SRGGB10
--- MAINTAINERS | 1 + drivers/media/i2c/Kconfig | 14 + drivers/media/i2c/Makefile | 2 +- drivers/media/i2c/imx412.c | 1269 ++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 1285 insertions(+), 1 deletion(-) create mode 100644 drivers/media/i2c/imx412.c
MAINTAINERS +1 -0
@@ -16898,6 +16898,7 @@ L: [email protected] S: Maintained T: git git://linuxtv.org/media_tree.git F: Documentation/devicetree/bindings/media/i2c/sony,imx412.yaml +F: drivers/media/i2c/imx412.c SONY MEMORYSTICK SUBSYSTEM M: Maxim Levitsky <[email protected]>
drivers/media/i2c/Kconfig +14 -0
@@ -853,6 +853,20 @@ config VIDEO_IMX355 To compile this driver as a module, choose M here: the module will be called imx355. +config VIDEO_IMX412 + tristate "Sony IMX412 sensor support" + depends on OF_GPIO + depends on I2C && VIDEO_V4L2 + select VIDEO_V4L2_SUBDEV_API + select MEDIA_CONTROLLER + select V4L2_FWNODE + help + This is a Video4Linux2 sensor driver for the Sony + IMX412 camera. + + To compile this driver as a module, choose M here: the + module will be called imx412. + config VIDEO_OV02A10 tristate "OmniVision OV02A10 sensor support" depends on VIDEO_V4L2 && I2C
drivers/media/i2c/Makefile +1 -1
@@ -125,10 +125,10 @@ obj-$(CONFIG_VIDEO_IMX319) += imx319.o obj-$(CONFIG_VIDEO_IMX334) += imx334.o obj-$(CONFIG_VIDEO_IMX335) += imx335.o obj-$(CONFIG_VIDEO_IMX355) += imx355.o +obj-$(CONFIG_VIDEO_IMX412) += imx412.o obj-$(CONFIG_VIDEO_MAX9286) += max9286.o obj-$(CONFIG_VIDEO_MAX9271_LIB) += max9271.o obj-$(CONFIG_VIDEO_RDACM20) += rdacm20.o obj-$(CONFIG_VIDEO_RDACM21) += rdacm21.o obj-$(CONFIG_VIDEO_ST_MIPID02) += st-mipid02.o - obj-$(CONFIG_SDR_MAX2175) += max2175.o
drivers/media/i2c/imx412.c new file +1269 -0
1,269 lines not on this page · raw message
Signature · 1 line
2.11.0
PATCH 5/6 dt-bindings: media: Add bindings for ov9282
In reply to Martina KrastevaFrom: Martina Krasteva <[email protected]>
- Add dt-bindings documentation for OmniVision ov9282 sensor driver
- Add MAINTAINERS entry for OmniVision ov9282 binding documentation
--- .../devicetree/bindings/media/i2c/ovti,ov9282.yaml | 90 ++++++++++++++++++++++ MAINTAINERS | 8 ++ 2 files changed, 98 insertions(+) create mode 100644 Documentation/devicetree/bindings/media/i2c/ovti,ov9282.yaml
Documentation/devicetree/bindings/media/i2c/ovti,ov9282.yaml new file +90 -0
@@ -0,0 +1,90 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +# Copyright (C) 2021 Intel Corporation +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/media/i2c/ovti,ov9282.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: OmniVision OV9282 Sensor + +maintainers: + - Paul J. Murphy <[email protected]> + - Daniele Alessandrelli <[email protected]> + +description: + OV9282 sensor is an OmniVision black & white CMOS active pixel digital image + sensor with an active array size of 1296H x 816V. It is programmable through + I2C interface. The I2C client address is fixed to 0x60/0x70 as per sensor data + sheet. Image data is sent through MIPI CSI-2. + +properties: + compatible: + const: ovti,ov9282 + reg: + description: I2C address + maxItems: 1 + + assigned-clocks: true + assigned-clock-parents: true + assigned-clock-rates: true + + clocks: + description: Clock frequency from 6 to 27MHz + maxItems: 1 + + reset-gpios: + description: Reference to the GPIO connected to the XCLR pin, if any. + + port: + additionalProperties: false + $ref: /schemas/graph.yaml#/properties/port + + properties: + endpoint: + $ref: /schemas/media/video-interfaces.yaml# + unevaluatedProperties: false + + properties: + data-lanes: true + link-frequencies: true + + required: + - data-lanes + - link-frequencies + + required: + - endpoint + +required: + - compatible + - reg + - clocks + - port + +additionalProperties: false + +examples: + - | + i2c0 { + #address-cells = <1>; + #size-cells = <0>; + + camera@60 { + compatible = "ovti,ov9282"; + reg = <0x60>; + clocks = <&ov9282_clk>; + + assigned-clocks = <&ov9282_clk>; + assigned-clock-parents = <&ov9282_clk_parent>; + assigned-clock-rates = <24000000>; + + port { + ov9282: endpoint { + remote-endpoint = <&cam>; + data-lanes = <1 2>; + link-frequencies = /bits/ 64 <800000000>; + }; + }; + }; + }; +...
MAINTAINERS +8 -0
@@ -13421,6 +13421,14 @@ T: git git://linuxtv.org/media_tree.git F: Documentation/devicetree/bindings/media/i2c/ov8856.yaml F: drivers/media/i2c/ov8856.c +OMNIVISION OV9282 SENSOR DRIVER +M: Paul J. Murphy <[email protected]> +M: Daniele Alessandrelli <[email protected]> +L: [email protected] +S: Maintained +T: git git://linuxtv.org/media_tree.git +F: Documentation/devicetree/bindings/media/i2c/ovti,ov9282.yaml + OMNIVISION OV9640 SENSOR DRIVER M: Petr Cvek <[email protected]> L: [email protected]
Signature · 1 line
2.11.0
PATCH 6/6 media: i2c: Add ov9282 camera sensor driver
In reply to Martina KrastevaFrom: Martina Krasteva <[email protected]>
Add a v4l2 sub-device driver for the OmniVisison ov9282 black&white image sensor.
The camera sensor uses the i2c bus for control and the csi-2 bus for data.
The following features are supported:
- manual exposure and analog gain control support
- vblank/hblank/pixel rate/link freq control support
- supported resolution:
- 1280x720 @ 30fps
--- MAINTAINERS | 1 + drivers/media/i2c/Kconfig | 14 + drivers/media/i2c/Makefile | 1 + drivers/media/i2c/ov9282.c | 1134 ++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 1150 insertions(+) create mode 100644 drivers/media/i2c/ov9282.c
MAINTAINERS +1 -0
@@ -13428,6 +13428,7 @@ L: [email protected] S: Maintained T: git git://linuxtv.org/media_tree.git F: Documentation/devicetree/bindings/media/i2c/ovti,ov9282.yaml +F: drivers/media/i2c/ov9282.c OMNIVISION OV9640 SENSOR DRIVER M: Petr Cvek <[email protected]>
drivers/media/i2c/Kconfig +14 -0
@@ -1116,6 +1116,20 @@ config VIDEO_OV8865 To compile this driver as a module, choose M here: the module will be called ov8865. +config VIDEO_OV9282 + tristate "OmniVision OV9282 sensor support" + depends on OF_GPIO + depends on I2C && VIDEO_V4L2 + select VIDEO_V4L2_SUBDEV_API + select MEDIA_CONTROLLER + select V4L2_FWNODE + help + This is a Video4Linux2 sensor driver for the OmniVision + OV9282 camera sensor. + + To compile this driver as a module, choose M here: the + module will be called ov9282. + config VIDEO_OV9640 tristate "OmniVision OV9640 sensor support" depends on I2C && VIDEO_V4L2
drivers/media/i2c/Makefile +1 -0
@@ -84,6 +84,7 @@ obj-$(CONFIG_VIDEO_OV772X) += ov772x.o obj-$(CONFIG_VIDEO_OV7740) += ov7740.o obj-$(CONFIG_VIDEO_OV8856) += ov8856.o obj-$(CONFIG_VIDEO_OV8865) += ov8865.o +obj-$(CONFIG_VIDEO_OV9282) += ov9282.o obj-$(CONFIG_VIDEO_OV9640) += ov9640.o obj-$(CONFIG_VIDEO_OV9650) += ov9650.o obj-$(CONFIG_VIDEO_OV9734) += ov9734.o
drivers/media/i2c/ov9282.c new file +1134 -0
1,134 lines not on this page · raw message
Signature · 1 line
2.11.0