Skip to contentSkip to conversation

media: i2c: IMX355 for the Pixel 3a

PATCH Superseded Richard Acayan 5 participants 23 messages Feb 17 – Apr 28

Subsystems (8)

v9 of 11 Superseded Latest is v11 →

lore
Share & tools
lore
#0 lore raw

v9 cover media: i2c: IMX355 for the Pixel 3a

This adds support for the IMX355 in devicetree and adds support for the Pixel 3a front camera.

Changes since v8 (https://lore.kernel.org/r/[email protected]):
- allow clock-lanes, but make it optional (1/7)

Changes since v7 (https://lore.kernel.org/r/[email protected]):
- restrict data-lanes to 4 (4/7)
- include first patch (1/7)
- add back optional data-lanes in bindings (2/7)
- remove assert low on power on again (Bryan's review retained) (3/7)
- use dev_err_probe in power on (3/7)
- remove second error on probe power on (3/7)
- add review tags (2/7, 3/7, 7/7)

Changes since v6 (https://lore.kernel.org/r/[email protected]):
- remove NAK from Krzysztof (3/6)
- assert reset GPIO on probe (3/6)
- change delays in reset sequence (3/6)
- remove __maybe_unused from OF match table (3/6)
- fix alignment for arguments to devm_regulator_bulk_get_const (3/6)
- remove front camera pin configuration (6/6)
- remove clock-lanes from camss endpoint (1/6, 6/6)
- remove data-lanes from camera sensor endpoint (2/6, 6/6)
- remove blank line at top of binding (2/6)
- add review tags (2/6, 3/6, 5/6, 6/6)

Changes since v5 (https://lore.kernel.org/r/[email protected]):
- add Bryan to CC who added a Reviewed-by

Changes since v4 (https://lore.kernel.org/r/[email protected]):
- add NAK from Krzysztof (2/5)
- label the camss ports (3/5, 5/5)
- define endpoint properties correctly (1/5)
- use devm_regulator_bulk_get_const (2/5)
- remove clock-names (1/5, 5/5)
- set reset GPIO as active low (1/5, 2/5, 5/5)
- explicitly drive reset low at start of sequence (2/5)
- make data-lanes in endpoint optional and start at 1 (1/5, 5/5)
- add mclk3 pin (4/5)
- add Reviewed-by's (4/5)

Changes since v3 (https://lore.kernel.org/r/[email protected]):
- separate camera mclk pins and move to different patch (4/5, 5/5)
- remove polarity from rear camera pin (5/5)
- remove output-low from front camera pins (5/5)
- mention effects of dcf6fb89e6f7 ("media: qcom: camss: remove a check for unavailable CAMSS endpoint") (3/5)
- specify single clock-name without items nesting (1/5)
- rebase on 49c6ac166cf7 ("media: i2c: imx355: Replace client->dev
usage") and eaa7d46d9654 ("media: i2c: imx335: Use V4L2 sensor clock
helper") (2/5)
- do not use of_match_ptr for OF match table (2/5)
- remove redundant GPIO validity checks (2/5)
- describe endpoint data-lanes (1/5)

Changes since v2 (https://lore.kernel.org/r/[email protected]):
- use devm_v4l2_sensor_clk_get (2/4)
- require supplies and clock-names (1/4)
- move unevaluatedProperties down (1/4)
- disable clocks as last power-off action (2/4)
- use 0 in gpio pin power-supply (4/4)

Changes since v1 (https://lore.kernel.org/r/[email protected]):
- too much to have a complete list (1-4/4)
- squash camera orientation patch (4/4, previously 5/5)
- squash driver changes (2/4, previously 3/5)
- remove labelled endpoint node in sdm670.dtsi (3/4, 4/4)
- change init sequence to match other similar drivers (2/4)
- retrieve clock frequency from devicetree-defined clock (4/4)
- remove clock-frequency from dt-bindings (1/4)
- remove redundant descriptions of child nodes (1/4)
- switch initial drive of the reset GPIO to low (2/4)
- set mclk frequency to 19.2 MHz (4/4)
- add vdda-pll supply for camss (4/4)
- use common power on and off functions (2/4)
- use devm_clk_get_optional (2/4)
- remove extra layer when describing mclk pin (4/4)
- rename regulators (1/4, 2/4, 4/4)

Richard Acayan (7):
dt-bindings: media: qcom,sdm670-camss: Remove clock-lanes requirement
dt-bindings: media: i2c: Add Sony IMX355
media: i2c: imx355: Support devicetree and power management
media: i2c: imx355: Restrict data lanes to 4
arm64: dts: qcom: sdm670: label the camss ports instead of endpoints
arm64: dts: qcom: sdm670: add camera mclk pins
arm64: dts: qcom: sdm670-google-sargo: add imx355 front camera

 .../bindings/media/i2c/sony,imx355.yaml       | 111 ++++++++++++++++
 .../bindings/media/qcom,sdm670-camss.yaml     |   3 -
 .../boot/dts/qcom/sdm670-google-sargo.dts     |  95 ++++++++++++++
 arch/arm64/boot/dts/qcom/sdm670.dtsi          |  46 ++++---
 drivers/media/i2c/imx355.c                    | 118 ++++++++++++++++--
 5 files changed, 347 insertions(+), 26 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/media/i2c/sony,imx355.yaml
Signature · 1 line
2.53.0
#1 lore raw

PATCH v9 1/7 dt-bindings: media: qcom,sdm670-camss: Remove clock-lanes requirement

The clock-lanes property has no effect on the hardware configuration, as of commit 336136e197e2 ("media: dt-bindings: media: camss: Remove clock-lane property"). Since boards with new camss support can omit the property, remove it from the required lists.

---
 Documentation/devicetree/bindings/media/qcom,sdm670-camss.yaml | 3 ---
 1 file changed, 3 deletions(-)
Documentation/devicetree/bindings/media/qcom,sdm670-camss.yaml +0 -3
index 35c40fe22376..38b308f441ec 100644
@@ -124,7 +124,6 @@ properties:
                 maxItems: 4
 
             required:
-              - clock-lanes
               - data-lanes
 
       port@1:
@@ -147,7 +146,6 @@ properties:
                 maxItems: 4
 
             required:
-              - clock-lanes
               - data-lanes
 
       port@2:
@@ -170,7 +168,6 @@ properties:
                 maxItems: 4
 
             required:
-              - clock-lanes
               - data-lanes
 
 required:
Signature · 1 line
2.53.0
#5 lore raw

PATCH v9 2/7 dt-bindings: media: i2c: Add Sony IMX355

In reply to Richard Acayan

The IMX355 camera sensor is a camera sensor that can be found as the front camera in some smartphones, such as the Pixel 3, Pixel 3 XL, Pixel 3a, and Pixel 3a XL. It already has a driver, but needs support for device tree. Document the IMX355 to support defining it in device tree.

---
 .../bindings/media/i2c/sony,imx355.yaml       | 111 ++++++++++++++++++
 1 file changed, 111 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/media/i2c/sony,imx355.yaml
Documentation/devicetree/bindings/media/i2c/sony,imx355.yaml new file +111 -0
new file mode 100644
index 000000000000..6050d7e7dcfe
@@ -0,0 +1,111 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/media/i2c/sony,imx355.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Sony IMX355 Sensor
+
+maintainers:
+  - Richard Acayan <[email protected]>
+
+description:
+  The IMX355 sensor is a 3280x2464 image sensor, commonly found as the front
+  camera in smartphones.
+
+allOf:
+  - $ref: /schemas/media/video-interface-devices.yaml#
+
+properties:
+  compatible:
+    const: sony,imx355
+
+  reg:
+    maxItems: 1
+
+  clocks:
+    maxItems: 1
+
+  avdd-supply:
+    description: Analog power supply.
+
+  dvdd-supply:
+    description: Digital power supply.
+
+  dovdd-supply:
+    description: Interface power supply.
+
+  reset-gpios:
+    description: Reset GPIO (active low).
+    maxItems: 1
+
+  port:
+    $ref: /schemas/graph.yaml#/$defs/port-base
+    additionalProperties: false
+
+    properties:
+      endpoint:
+        $ref: /schemas/media/video-interfaces.yaml
+        unevaluatedProperties: false
+
+        properties:
+          data-lanes:
+            minItems: 4
+            maxItems: 4
+
+        required:
+          - link-frequencies
+
+    required:
+      - endpoint
+
+required:
+  - compatible
+  - reg
+  - clocks
+  - avdd-supply
+  - dvdd-supply
+  - dovdd-supply
+  - port
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/clock/qcom,camcc-sdm845.h>
+    #include <dt-bindings/gpio/gpio.h>
+
+    i2c {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        camera@1a {
+            compatible = "sony,imx355";
+            reg = <0x1a>;
+
+            clocks = <&camcc CAM_CC_MCLK2_CLK>;
+
+            assigned-clocks = <&camcc CAM_CC_MCLK2_CLK>;
+            assigned-clock-rates = <24000000>;
+
+            reset-gpios = <&tlmm 9 GPIO_ACTIVE_LOW>;
+
+            avdd-supply = <&cam_front_ldo>;
+            dvdd-supply = <&cam_front_ldo>;
+            dovdd-supply = <&cam_vio_ldo>;
+
+            pinctrl-names = "default";
+            pinctrl-0 = <&cam_front_default>;
+
+            rotation = <270>;
+            orientation = <0>;
+
+            port {
+                cam_front_endpoint: endpoint {
+                    data-lanes = <1 2 3 4>;
+                    link-frequencies = /bits/ 64 <360000000>;
+                    remote-endpoint = <&camss_endpoint1>;
+                };
+            };
+        };
+    };
Signature · 1 line
2.53.0
#6 lore raw

PATCH v9 3/7 media: i2c: imx355: Support devicetree and power management

In reply to Richard Acayan

A device tree compatible makes it possible for this driver to be used on Open Firmware devices. Initialization of power-managed resources such as the reset GPIO and voltage regulators can be specified in the device tree and handled by the driver. Add support for this so the Pixel 3a can use the driver.

---
 drivers/media/i2c/imx355.c | 111 ++++++++++++++++++++++++++++++++++---
 1 file changed, 103 insertions(+), 8 deletions(-)
drivers/media/i2c/imx355.c +103 -8
index 776107efe386..9ca87488c933 100644
@@ -3,9 +3,13 @@
 
 #include <linux/acpi.h>
 #include <linux/clk.h>
+#include <linux/delay.h>
+#include <linux/gpio/consumer.h>
 #include <linux/i2c.h>
 #include <linux/module.h>
+#include <linux/of.h>
 #include <linux/pm_runtime.h>
+#include <linux/regulator/consumer.h>
 #include <linux/unaligned.h>
 
 #include <media/v4l2-ctrls.h>
@@ -125,6 +129,15 @@ struct imx355 {
 	 * Protect access to sensor v4l2 controls.
 	 */
 	struct mutex mutex;
+
+	struct gpio_desc *reset_gpio;
+	struct regulator_bulk_data *supplies;
+};
+
+static const struct regulator_bulk_data imx355_supplies[] = {
+	{ .supply = "avdd" },
+	{ .supply = "dvdd" },
+	{ .supply = "dovdd" },
 };
 
 static const struct imx355_reg imx355_global_regs[] = {
@@ -1515,6 +1528,52 @@ static const struct v4l2_subdev_internal_ops imx355_internal_ops = {
 	.open = imx355_open,
 };
 
+static int imx355_power_off(struct device *dev)
+{
+	struct i2c_client *client = container_of(dev, struct i2c_client, dev);
+	struct v4l2_subdev *sd = i2c_get_clientdata(client);
+	struct imx355 *imx355 = to_imx355(sd);
+
+	gpiod_set_value_cansleep(imx355->reset_gpio, 1);
+
+	regulator_bulk_disable(ARRAY_SIZE(imx355_supplies), imx355->supplies);
+	clk_disable_unprepare(imx355->clk);
+
+	return 0;
+}
+
+static int imx355_power_on(struct device *dev)
+{
+	struct i2c_client *client = container_of(dev, struct i2c_client, dev);
+	struct v4l2_subdev *sd = i2c_get_clientdata(client);
+	struct imx355 *imx355 = to_imx355(sd);
+	int ret;
+
+	ret = clk_prepare_enable(imx355->clk);
+	if (ret)
+		return dev_err_probe(dev, ret, "failed to enable clocks");
+
+	ret = regulator_bulk_enable(ARRAY_SIZE(imx355_supplies),
+				    imx355->supplies);
+	if (ret) {
+		dev_err_probe(dev, ret, "failed to enable regulators");
+		goto error_disable_clocks;
+	}
+
+	usleep_range(1000, 2000);
+	gpiod_set_value_cansleep(imx355->reset_gpio, 0);
+	usleep_range(10000, 11000);
+
+	return 0;
+
+error_disable_clocks:
+	clk_disable_unprepare(imx355->clk);
+	return ret;
+}
+
+static DEFINE_RUNTIME_DEV_PM_OPS(imx355_pm_ops, imx355_power_off,
+				 imx355_power_on, NULL);
+
 /* Initialize control handlers */
 static int imx355_init_controls(struct imx355 *imx355)
 {
@@ -1689,16 +1748,26 @@ static int imx355_probe(struct i2c_client *client)
 				     "external clock %lu is not supported\n",
 				     freq);
 
-	/* Initialize subdev */
-	v4l2_i2c_subdev_init(&imx355->sd, client, &imx355_subdev_ops);
-
-	/* Check module identity */
-	ret = imx355_identify_module(imx355);
+	ret = devm_regulator_bulk_get_const(imx355->dev,
+					    ARRAY_SIZE(imx355_supplies),
+					    imx355_supplies,
+					    &imx355->supplies);
 	if (ret) {
-		dev_err(imx355->dev, "failed to find sensor: %d", ret);
+		dev_err_probe(imx355->dev, ret, "could not get regulators");
 		goto error_probe;
 	}
 
+	imx355->reset_gpio = devm_gpiod_get_optional(imx355->dev, "reset",
+						     GPIOD_OUT_HIGH);
+	if (IS_ERR(imx355->reset_gpio)) {
+		ret = dev_err_probe(imx355->dev, PTR_ERR(imx355->reset_gpio),
+				    "failed to get gpios");
+		goto error_probe;
+	}
+
+	/* Initialize subdev */
+	v4l2_i2c_subdev_init(&imx355->sd, client, &imx355_subdev_ops);
+
 	imx355->hwcfg = imx355_get_hwcfg(imx355->dev);
 	if (!imx355->hwcfg) {
 		dev_err(imx355->dev, "failed to get hwcfg");
@@ -1706,13 +1775,24 @@ static int imx355_probe(struct i2c_client *client)
 		goto error_probe;
 	}
 
+	ret = imx355_power_on(imx355->dev);
+	if (ret)
+		goto error_probe;
+
+	/* Check module identity */
+	ret = imx355_identify_module(imx355);
+	if (ret) {
+		dev_err(imx355->dev, "failed to find sensor: %d", ret);
+		goto error_power_off;
+	}
+
 	/* Set default mode to max resolution */
 	imx355->cur_mode = &supported_modes[0];
 
 	ret = imx355_init_controls(imx355);
 	if (ret) {
 		dev_err(imx355->dev, "failed to init controls: %d", ret);
-		goto error_probe;
+		goto error_power_off;
 	}
 
 	/* Initialize subdev */
@@ -1752,6 +1832,9 @@ static int imx355_probe(struct i2c_client *client)
 error_handler_free:
 	v4l2_ctrl_handler_free(imx355->sd.ctrl_handler);
 
+error_power_off:
+	imx355_power_off(imx355->dev);
+
 error_probe:
 	mutex_destroy(&imx355->mutex);
 
@@ -1768,7 +1851,11 @@ static void imx355_remove(struct i2c_client *client)
 	v4l2_ctrl_handler_free(sd->ctrl_handler);
 
 	pm_runtime_disable(imx355->dev);
-	pm_runtime_set_suspended(imx355->dev);
+
+	if (!pm_runtime_status_suspended(imx355->dev)) {
+		imx355_power_off(imx355->dev);
+		pm_runtime_set_suspended(imx355->dev);
+	}
 
 	mutex_destroy(&imx355->mutex);
 }
@@ -1779,10 +1866,18 @@ static const struct acpi_device_id imx355_acpi_ids[] __maybe_unused = {
 };
 MODULE_DEVICE_TABLE(acpi, imx355_acpi_ids);
 
+static const struct of_device_id imx355_match_table[] = {
+	{ .compatible = "sony,imx355", },
+	{ /* sentinel */ }
+};
+MODULE_DEVICE_TABLE(of, imx355_match_table);
+
 static struct i2c_driver imx355_i2c_driver = {
 	.driver = {
 		.name = "imx355",
 		.acpi_match_table = ACPI_PTR(imx355_acpi_ids),
+		.of_match_table = imx355_match_table,
+		.pm = &imx355_pm_ops,
 	},
 	.probe = imx355_probe,
 	.remove = imx355_remove,
Signature · 1 line
2.53.0
#7 lore raw

PATCH v9 4/7 media: i2c: imx355: Restrict data lanes to 4

In reply to Richard Acayan

The IMX355 sensor driver currently supports having 4 data lanes. There can't be more or less, so check if the firmware specifies 4 lanes.

Existing ACPI hardware descriptions may not have the data lanes defined so this check also accepts a placeholder of 0 lanes.

---
 drivers/media/i2c/imx355.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/media/i2c/imx355.c +7 -0
index 9ca87488c933..0d6aabea7d59 100644
@@ -66,6 +66,9 @@
 #define IMX355_EXT_CLK			19200000
 #define IMX355_LINK_FREQ_INDEX		0
 
+/* number of data lanes */
+#define IMX355_DATA_LANES		4
+
 struct imx355_reg {
 	u16 address;
 	u8 val;
@@ -1705,6 +1708,10 @@ static struct imx355_hwcfg *imx355_get_hwcfg(struct device *dev)
 	if (!cfg)
 		goto out_err;
 
+	if (bus_cfg.bus.mipi_csi2.num_data_lanes != 0
+	 && bus_cfg.bus.mipi_csi2.num_data_lanes != IMX355_DATA_LANES)
+		goto out_err;
+
 	ret = v4l2_link_freq_to_bitmap(dev, bus_cfg.link_frequencies,
 				       bus_cfg.nr_of_link_frequencies,
 				       link_freq_menu_items,
Signature · 1 line
2.53.0
#11 lore raw

PATCH v9 5/7 arm64: dts: qcom: sdm670: label the camss ports instead of endpoints

In reply to Richard Acayan

Endpoints cannot be pre-defined since commit dcf6fb89e6f7 ("media: qcom:
camss: remove a check for unavailable CAMSS endpoint") was applied, probing all endpoint nodes and requiring them to have a remote. There is no sensible remote in the SoC devicetree because camera sensors are board-specific.

The ports are meant to be extended by a board devicetree in order to define fully configured endpoints and connect the ports to camera sensors. For nodes that are only meaningful if extended, labels are usually assigned. Label these ports so they can be extended directly.

---
 arch/arm64/boot/dts/qcom/sdm670.dtsi | 18 +++---------------
 1 file changed, 3 insertions(+), 15 deletions(-)
arch/arm64/boot/dts/qcom/sdm670.dtsi +3 -15
index b8a8dcbdfbe3..3eb4eaf7b8d7 100644
@@ -1776,28 +1776,16 @@ ports {
 				#address-cells = <1>;
 				#size-cells = <0>;
 
-				port@0 {
+				camss_port0: port@0 {
 					reg = <0>;
-
-					camss_endpoint0: endpoint {
-						status = "disabled";
-					};
 				};
 
-				port@1 {
+				camss_port1: port@1 {
 					reg = <1>;
-
-					camss_endpoint1: endpoint {
-						status = "disabled";
-					};
 				};
 
-				port@2 {
+				camss_port2: port@2 {
 					reg = <2>;
-
-					camss_endpoint2: endpoint {
-						status = "disabled";
-					};
 				};
 			};
 		};
Signature · 1 line
2.53.0
#12 lore raw

PATCH v9 6/7 arm64: dts: qcom: sdm670: add camera mclk pins

In reply to Richard Acayan

The camera subsystem is added for the SoC common devicetree, but the mclk pins should also be common across the SoC. Add the mclk pins for the cameras.

---
 arch/arm64/boot/dts/qcom/sdm670.dtsi | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)
arch/arm64/boot/dts/qcom/sdm670.dtsi +28 -0
index 3eb4eaf7b8d7..f21e60a6a2ef 100644
@@ -1196,6 +1196,34 @@ tlmm: pinctrl@3400000 {
 			gpio-ranges = <&tlmm 0 0 151>;
 			wakeup-parent = <&pdc>;
 
+			cam_mclk0_default: cam-mclk0-default-state {
+				pins = "gpio13";
+				function = "cam_mclk";
+				drive-strength = <2>;
+				bias-disable;
+			};
+
+			cam_mclk1_default: cam-mclk1-default-state {
+				pins = "gpio14";
+				function = "cam_mclk";
+				drive-strength = <2>;
+				bias-disable;
+			};
+
+			cam_mclk2_default: cam-mclk2-default-state {
+				pins = "gpio15";
+				function = "cam_mclk";
+				drive-strength = <2>;
+				bias-disable;
+			};
+
+			cam_mclk3_default: cam-mclk3-default-state {
+				pins = "gpio16";
+				function = "cam_mclk";
+				drive-strength = <2>;
+				bias-disable;
+			};
+
 			cci0_default: cci0-default-state {
 				pins = "gpio17", "gpio18";
 				function = "cci_i2c";
Signature · 1 line
2.53.0
#13 lore raw

PATCH v9 7/7 arm64: dts: qcom: sdm670-google-sargo: add imx355 front camera

In reply to Richard Acayan

The Sony IMX355 is the front camera on the Pixel 3a, mounted in portrait mode. It is connected to CSIPHY1 and CCI I2C1, and uses MCLK2. Add support for it.

---
 .../boot/dts/qcom/sdm670-google-sargo.dts     | 95 +++++++++++++++++++
 1 file changed, 95 insertions(+)
arch/arm64/boot/dts/qcom/sdm670-google-sargo.dts +95 -0
index ed55646ca419..e925cba0381f 100644
@@ -172,6 +172,34 @@ vreg_s2b_1p05: vreg-s2b-regulator {
 		regulator-min-microvolt = <1050000>;
 		regulator-max-microvolt = <1050000>;
 	};
+
+	cam_front_ldo: cam-front-ldo-regulator {
+		compatible = "regulator-fixed";
+		regulator-name = "cam_front_ldo";
+		regulator-min-microvolt = <1352000>;
+		regulator-max-microvolt = <1352000>;
+		regulator-enable-ramp-delay = <135>;
+
+		gpios = <&pm660l_gpios 4 GPIO_ACTIVE_HIGH>;
+		enable-active-high;
+
+		pinctrl-0 = <&cam_front_ldo_pin>;
+		pinctrl-names = "default";
+	};
+
+	cam_vio_ldo: cam-vio-ldo-regulator {
+		compatible = "regulator-fixed";
+		regulator-name = "cam_vio_ldo";
+		regulator-min-microvolt = <1800000>;
+		regulator-max-microvolt = <1800000>;
+		regulator-enable-ramp-delay = <233>;
+
+		gpios = <&pm660_gpios 13 GPIO_ACTIVE_HIGH>;
+		enable-active-high;
+
+		pinctrl-0 = <&cam_vio_pin>;
+		pinctrl-names = "default";
+	};
 };
 
 &apps_rsc {
@@ -392,6 +420,59 @@ vreg_bob: bob {
 	};
 };
 
+&camss {
+	vdda-phy-supply = <&vreg_l1a_1p225>;
+	vdda-pll-supply = <&vreg_s6a_0p87>;
+
+	status = "okay";
+};
+
+&camss_port1 {
+	camss_endpoint1: endpoint {
+		data-lanes = <0 1 2 3>;
+		remote-endpoint = <&cam_front_endpoint>;
+	};
+};
+
+&cci {
+	pinctrl-0 = <&cci1_default>;
+	pinctrl-1 = <&cci1_sleep>;
+	pinctrl-names = "default", "sleep";
+
+	status = "okay";
+};
+
+&cci_i2c1 {
+	camera@1a {
+		compatible = "sony,imx355";
+		reg = <0x1a>;
+
+		clocks = <&camcc CAM_CC_MCLK2_CLK>;
+
+		assigned-clocks = <&camcc CAM_CC_MCLK2_CLK>;
+		assigned-clock-rates = <19200000>;
+
+		reset-gpios = <&tlmm 9 GPIO_ACTIVE_LOW>;
+
+		avdd-supply = <&cam_front_ldo>;
+		dvdd-supply = <&cam_front_ldo>;
+		dovdd-supply = <&cam_vio_ldo>;
+
+		pinctrl-0 = <&cam_mclk2_default>;
+		pinctrl-names = "default";
+
+		rotation = <270>;
+		orientation = <0>;
+
+		port {
+			cam_front_endpoint: endpoint {
+				link-frequencies = /bits/ 64 <360000000>;
+				remote-endpoint = <&camss_endpoint1>;
+			};
+		};
+	};
+};
+
 &gcc {
 	protected-clocks = <GCC_QSPI_CORE_CLK>,
 			   <GCC_QSPI_CORE_CLK_SRC>,
@@ -490,6 +571,14 @@ &pm660_charger {
 	status = "okay";
 };
 
+&pm660_gpios {
+	cam_vio_pin: cam-vio-state {
+		pins = "gpio13";
+		function = "normal";
+		power-source = <0>;
+	};
+};
+
 &pm660_rradc {
 	status = "okay";
 };
@@ -508,6 +597,12 @@ led-0 {
 };
 
 &pm660l_gpios {
+	cam_front_ldo_pin: cam-front-state {
+		pins = "gpio4";
+		function = "normal";
+		power-source = <0>;
+	};
+
 	vol_up_pin: vol-up-state {
 		pins = "gpio7";
 		function = "normal";
Signature · 1 line
2.53.0
Reviewed-by on v9 1/7
#2 lore raw

Re: [PATCH v9 1/7] dt-bindings: media: qcom,sdm670-camss: Remove clock-lanes requirement

In reply to Richard Acayan
Quoted 9 lines · Richard Acayan

The clock-lanes property has no effect on the hardware configuration, as of commit 336136e197e2 ("media: dt-bindings: media: camss: Remove clock-lane property"). Since boards with new camss support can omit the property, remove it from the required lists.

---
 Documentation/devicetree/bindings/media/qcom,sdm670-camss.yaml | 3 ---
 1 file changed, 3 deletions(-)

Best regards,
Krzysztof

maintainer
#8 lore raw

Re: [PATCH v9 4/7] media: i2c: imx355: Restrict data lanes to 4

In reply to Richard Acayan

Hi Richard,

Quoted 28 lines · Richard Acayan

The IMX355 sensor driver currently supports having 4 data lanes. There can't be more or less, so check if the firmware specifies 4 lanes.

Existing ACPI hardware descriptions may not have the data lanes defined so this check also accepts a placeholder of 0 lanes.

---
 drivers/media/i2c/imx355.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/media/i2c/imx355.c +3 -0
index 9ca87488c933..0d6aabea7d59 100644
@@ -66,6 +66,9 @@
 #define IMX355_EXT_CLK			19200000
 #define IMX355_LINK_FREQ_INDEX		0
 
+/* number of data lanes */
+#define IMX355_DATA_LANES		4
+
 struct imx355_reg {
 	u16 address;
 	u8 val;

drivers/media/i2c/imx355.c static struct imx355_hwcfg *imx355_get_hwcfg(struct device *dev) · line 1711

Quoted 4 lines
drivers/media/i2c/imx355.c +1 -0
@@ -1705,6 +1708,10 @@ static struct imx355_hwcfg *imx355_get_hwcfg(struct device *dev)
 	if (!cfg)
 		goto out_err;
 
+	if (bus_cfg.bus.mipi_csi2.num_data_lanes != 0

The number of lanes should be available from system firmware, so no need for this check.

drivers/media/i2c/imx355.c static struct imx355_hwcfg *imx355_get_hwcfg(struct device *dev) · line 1712

Quoted 1 line
drivers/media/i2c/imx355.c +1 -0
+	 && bus_cfg.bus.mipi_csi2.num_data_lanes != IMX355_DATA_LANES)

Indentation.

Quoted 5 lines
drivers/media/i2c/imx355.c +2 -0
+		goto out_err;
+
 	ret = v4l2_link_freq_to_bitmap(dev, bus_cfg.link_frequencies,
 				       bus_cfg.nr_of_link_frequencies,
 				       link_freq_menu_items,
Signature · 3 lines
Regards,

Sakari Ailus
#14 lore raw

Re: [PATCH v9 7/7] arm64: dts: qcom: sdm670-google-sargo: add imx355 front camera

In reply to Richard Acayan
Quoted 14 lines · Richard Acayan

The Sony IMX355 is the front camera on the Pixel 3a, mounted in portrait mode. It is connected to CSIPHY1 and CCI I2C1, and uses MCLK2. Add support for it.

---
 .../boot/dts/qcom/sdm670-google-sargo.dts     | 95 +++++++++++++++++++
 1 file changed, 95 insertions(+)

(snip)

Quoted 18 lines
arch/arm64/boot/dts/qcom/sdm670-google-sargo.dts +18 -0
+
+&cci_i2c1 {
+	camera@1a {
+		compatible = "sony,imx355";
+		reg = <0x1a>;
+
+		clocks = <&camcc CAM_CC_MCLK2_CLK>;
+
+		assigned-clocks = <&camcc CAM_CC_MCLK2_CLK>;
+		assigned-clock-rates = <19200000>;
+
+		reset-gpios = <&tlmm 9 GPIO_ACTIVE_LOW>;
+
+		avdd-supply = <&cam_front_ldo>;
+		dvdd-supply = <&cam_front_ldo>;
+		dovdd-supply = <&cam_vio_ldo>;
+
+		pinctrl-0 = <&cam_mclk2_default>;

arch/arm64/boot/dts/qcom/sdm670-google-sargo.dts vreg_bob: bob { · line 471

Quoted 10 lines
arch/arm64/boot/dts/qcom/sdm670-google-sargo.dts +10 -0
+		pinctrl-names = "default";
+
+		rotation = <270>;
+		orientation = <0>;
+
+		port {
+			cam_front_endpoint: endpoint {
+				link-frequencies = /bits/ 64 <360000000>;
+				remote-endpoint = <&camss_endpoint1>;
+			};

This also needs data-lanes.

#15 lore raw

Re: [PATCH v9 7/7] arm64: dts: qcom: sdm670-google-sargo: add imx355 front camera

In reply to Richard Acayan
Quoted 37 lines · Richard Acayan

The Sony IMX355 is the front camera on the Pixel 3a, mounted in portrait mode. It is connected to CSIPHY1 and CCI I2C1, and uses MCLK2. Add support for it.

---
  .../boot/dts/qcom/sdm670-google-sargo.dts     | 95 +++++++++++++++++++
  1 file changed, 95 insertions(+)
arch/arm64/boot/dts/qcom/sdm670-google-sargo.dts +15 -0
index ed55646ca419..e925cba0381f 100644
@@ -172,6 +172,34 @@ vreg_s2b_1p05: vreg-s2b-regulator {
  		regulator-min-microvolt = <1050000>;
  		regulator-max-microvolt = <1050000>;
  	};
+
+	cam_front_ldo: cam-front-ldo-regulator {
+		compatible = "regulator-fixed";
+		regulator-name = "cam_front_ldo";
+		regulator-min-microvolt = <1352000>;
+		regulator-max-microvolt = <1352000>;
+		regulator-enable-ramp-delay = <135>;
+
+		gpios = <&pm660l_gpios 4 GPIO_ACTIVE_HIGH>;
+		enable-active-high;
+
+		pinctrl-0 = <&cam_front_ldo_pin>;
+		pinctrl-names = "default";
+	};
+

[...]

Quoted 5 lines
arch/arm64/boot/dts/qcom/sdm670-google-sargo.dts +5 -0
+
+&cci_i2c1 {
+	camera@1a {
+		compatible = "sony,imx355";
+		reg = <0x1a>;

arch/arm64/boot/dts/qcom/sdm670-google-sargo.dts vreg_bob: bob { · line 458

Quoted 10 lines
arch/arm64/boot/dts/qcom/sdm670-google-sargo.dts +10 -0
+
+		clocks = <&camcc CAM_CC_MCLK2_CLK>;
+
+		assigned-clocks = <&camcc CAM_CC_MCLK2_CLK>;
+		assigned-clock-rates = <19200000>;
+
+		reset-gpios = <&tlmm 9 GPIO_ACTIVE_LOW>;
+
+		avdd-supply = <&cam_front_ldo>;
+		dvdd-supply = <&cam_front_ldo>;

It's unlikely that one supply is used both for digital and analog supply?

I see downstream does it, but I don't think it's correct.

Quoted 48 lines
arch/arm64/boot/dts/qcom/sdm670-google-sargo.dts +31 -0
+		dovdd-supply = <&cam_vio_ldo>;
+
+		pinctrl-0 = <&cam_mclk2_default>;
+		pinctrl-names = "default";
+
+		rotation = <270>;
+		orientation = <0>;
+
+		port {
+			cam_front_endpoint: endpoint {
+				link-frequencies = /bits/ 64 <360000000>;
+				remote-endpoint = <&camss_endpoint1>;
+			};
+		};
+	};
+};
+
  &gcc {
  	protected-clocks = <GCC_QSPI_CORE_CLK>,
  			   <GCC_QSPI_CORE_CLK_SRC>,
@@ -490,6 +571,14 @@ &pm660_charger {
  	status = "okay";
  };
 
+&pm660_gpios {
+	cam_vio_pin: cam-vio-state {
+		pins = "gpio13";
+		function = "normal";
+		power-source = <0>;
+	};
+};
+
  &pm660_rradc {
  	status = "okay";
  };
@@ -508,6 +597,12 @@ led-0 {
  };
 
  &pm660l_gpios {
+	cam_front_ldo_pin: cam-front-state {
+		pins = "gpio4";
+		function = "normal";
+		power-source = <0>;
+	};
+
  	vol_up_pin: vol-up-state {
  		pins = "gpio7";
  		function = "normal";
Signature · 1 line
David Heidelberg
#16 lore raw

Re: [PATCH v9 7/7] arm64: dts: qcom: sdm670-google-sargo: add imx355 front camera

In reply to Richard Acayan

On 17/02/2026 01:27, Richard Acayan wrote:
[...]

arch/arm64/boot/dts/qcom/sdm670-google-sargo.dts vreg_bob: bob { · line 453

Quoted 9 lines

+&cci_i2c1 {

arch/arm64/boot/dts/qcom/sdm670-google-sargo.dts +8 -0
+	camera@1a {
+		compatible = "sony,imx355";
+		reg = <0x1a>;
+
+		clocks = <&camcc CAM_CC_MCLK2_CLK>;
+
+		assigned-clocks = <&camcc CAM_CC_MCLK2_CLK>;
+		assigned-clock-rates = <19200000>;

Extract from #sdm670-mainline:erebion.eu discussion:
The imx355 can operate on 24 MHz (on both Pixel 3 and 3a), but Linux kernel driver can operate only with 19.2 MHz.

I assume it would be worth it mention at least by comment here.

David

Quoted 53 lines
arch/arm64/boot/dts/qcom/sdm670-google-sargo.dts +36 -0
+
+		reset-gpios = <&tlmm 9 GPIO_ACTIVE_LOW>;
+
+		avdd-supply = <&cam_front_ldo>;
+		dvdd-supply = <&cam_front_ldo>;
+		dovdd-supply = <&cam_vio_ldo>;
+
+		pinctrl-0 = <&cam_mclk2_default>;
+		pinctrl-names = "default";
+
+		rotation = <270>;
+		orientation = <0>;
+
+		port {
+			cam_front_endpoint: endpoint {
+				link-frequencies = /bits/ 64 <360000000>;
+				remote-endpoint = <&camss_endpoint1>;
+			};
+		};
+	};
+};
+
  &gcc {
  	protected-clocks = <GCC_QSPI_CORE_CLK>,
  			   <GCC_QSPI_CORE_CLK_SRC>,
@@ -490,6 +571,14 @@ &pm660_charger {
  	status = "okay";
  };
 
+&pm660_gpios {
+	cam_vio_pin: cam-vio-state {
+		pins = "gpio13";
+		function = "normal";
+		power-source = <0>;
+	};
+};
+
  &pm660_rradc {
  	status = "okay";
  };
@@ -508,6 +597,12 @@ led-0 {
  };
 
  &pm660l_gpios {
+	cam_front_ldo_pin: cam-front-state {
+		pins = "gpio4";
+		function = "normal";
+		power-source = <0>;
+	};
+
  	vol_up_pin: vol-up-state {
  		pins = "gpio7";
  		function = "normal";
Signature · 1 line
David Heidelberg
#17 lore raw

Re: [PATCH v9 7/7] arm64: dts: qcom: sdm670-google-sargo: add imx355 front camera

Quoted 17 lines · David Heidelberg

On 17/02/2026 01:27, Richard Acayan wrote:
[...]

arch/arm64/boot/dts/qcom/sdm670-google-sargo.dts vreg_bob: bob { · line 453

Quoted 9 lines

+&cci_i2c1 {

arch/arm64/boot/dts/qcom/sdm670-google-sargo.dts +8 -0
+	camera@1a {
+		compatible = "sony,imx355";
+		reg = <0x1a>;
+
+		clocks = <&camcc CAM_CC_MCLK2_CLK>;
+
+		assigned-clocks = <&camcc CAM_CC_MCLK2_CLK>;
+		assigned-clock-rates = <19200000>;

Extract from #sdm670-mainline:erebion.eu discussion:
The imx355 can operate on 24 MHz (on both Pixel 3 and 3a), but Linux kernel driver can operate only with 19.2 MHz.

Quoted 1 line

I assume it would be worth it mention at least by comment here.

This might set the series back because the devicetree isn't meant to be written for specific software, but it's included in v11 because you already asked twice.

The frequency could also be stated as having "better software support" in general without mentioning Linux as the reason.

#18 lore raw

Re: [PATCH v9 7/7] arm64: dts: qcom: sdm670-google-sargo: add imx355 front camera

Quoted 18 lines · Richard Acayan
Quoted 17 lines · David Heidelberg

On 17/02/2026 01:27, Richard Acayan wrote:
[...]

arch/arm64/boot/dts/qcom/sdm670-google-sargo.dts vreg_bob: bob { · line 453

Quoted 9 lines

+&cci_i2c1 {

arch/arm64/boot/dts/qcom/sdm670-google-sargo.dts +8 -0
+	camera@1a {
+		compatible = "sony,imx355";
+		reg = <0x1a>;
+
+		clocks = <&camcc CAM_CC_MCLK2_CLK>;
+
+		assigned-clocks = <&camcc CAM_CC_MCLK2_CLK>;
+		assigned-clock-rates = <19200000>;

Extract from #sdm670-mainline:erebion.eu discussion:
The imx355 can operate on 24 MHz (on both Pixel 3 and 3a), but Linux kernel driver can operate only with 19.2 MHz.

Quoted 6 lines
Quoted 1 line

I assume it would be worth it mention at least by comment here.

This might set the series back because the devicetree isn't meant to be written for specific software, but it's included in v11 because you already asked twice.

I would say node with lower clock frequency is still much better than nothing or placeholder saying "i2c camera here". Instead we'll have small placeholder that value can be bumped to 24 MHz. Important is this can be easily improved when at least one consumer of the device-tree gains support.

We have very scarce support of cameras on mobile phones in mainline, thus leaving a comment that HW can do 24 MHz is reasonable compromise IMHO.

I personally got confused why Android sets higher clock, thus it may happen to other people looking at Pixel 3a as an example for their imx363 bring-up.

David

Quoted 2 lines

The frequency could also be stated as having "better software support" in general without mentioning Linux as the reason.

Signature · 1 line
David Heidelberg
maintainer
#19 lore raw

Re: [PATCH v9 7/7] arm64: dts: qcom: sdm670-google-sargo: add imx355 front camera

Hi David, Richard,

Quoted 28 lines · David Heidelberg
Quoted 18 lines · Richard Acayan
Quoted 17 lines · David Heidelberg

On 17/02/2026 01:27, Richard Acayan wrote:
[...]

arch/arm64/boot/dts/qcom/sdm670-google-sargo.dts vreg_bob: bob { · line 453

Quoted 9 lines

+&cci_i2c1 {

arch/arm64/boot/dts/qcom/sdm670-google-sargo.dts +8 -0
+	camera@1a {
+		compatible = "sony,imx355";
+		reg = <0x1a>;
+
+		clocks = <&camcc CAM_CC_MCLK2_CLK>;
+
+		assigned-clocks = <&camcc CAM_CC_MCLK2_CLK>;
+		assigned-clock-rates = <19200000>;

Extract from #sdm670-mainline:erebion.eu discussion:
The imx355 can operate on 24 MHz (on both Pixel 3 and 3a), but Linux kernel driver can operate only with 19.2 MHz.

Quoted 6 lines
Quoted 1 line

I assume it would be worth it mention at least by comment here.

This might set the series back because the devicetree isn't meant to be written for specific software, but it's included in v11 because you already asked twice.

Quoted 7 lines

I would say node with lower clock frequency is still much better than nothing or placeholder saying "i2c camera here". Instead we'll have small placeholder that value can be bumped to 24 MHz. Important is this can be easily improved when at least one consumer of the device-tree gains support.

We have very scarce support of cameras on mobile phones in mainline, thus leaving a comment that HW can do 24 MHz is reasonable compromise IMHO.

The bindings could document the supported frequency range.

In DTS it may make sense to set the frequency the vendor uses as it may affect the link frequencies (albeit I guess they're the same in this case?).

Quoted 9 lines

I personally got confused why Android sets higher clock, thus it may happen to other people looking at Pixel 3a as an example for their imx363 bring-up.

David

Quoted 2 lines

The frequency could also be stated as having "better software support" in general without mentioning Linux as the reason.

Signature · 3 lines
Regards,

Sakari Ailus
#20 lore raw

Re: [PATCH v9 7/7] arm64: dts: qcom: sdm670-google-sargo: add imx355 front camera

Quoted 36 lines · Sakari Ailus

Hi David, Richard,

Quoted 33 lines · David Heidelberg
Quoted 18 lines · Richard Acayan
Quoted 17 lines · David Heidelberg

On 17/02/2026 01:27, Richard Acayan wrote:
[...]

arch/arm64/boot/dts/qcom/sdm670-google-sargo.dts vreg_bob: bob { · line 453

Quoted 9 lines

+&cci_i2c1 {

arch/arm64/boot/dts/qcom/sdm670-google-sargo.dts +8 -0
+	camera@1a {
+		compatible = "sony,imx355";
+		reg = <0x1a>;
+
+		clocks = <&camcc CAM_CC_MCLK2_CLK>;
+
+		assigned-clocks = <&camcc CAM_CC_MCLK2_CLK>;
+		assigned-clock-rates = <19200000>;

Extract from #sdm670-mainline:erebion.eu discussion:
The imx355 can operate on 24 MHz (on both Pixel 3 and 3a), but Linux kernel driver can operate only with 19.2 MHz.

Quoted 6 lines
Quoted 1 line

I assume it would be worth it mention at least by comment here.

This might set the series back because the devicetree isn't meant to be written for specific software, but it's included in v11 because you already asked twice.

I would say node with lower clock frequency is still much better than nothing or placeholder saying "i2c camera here". Instead we'll have small placeholder that value can be bumped to 24 MHz. Important is this can be easily improved when at least one consumer of the device-tree gains support.

Quoted 8 lines
Quoted 2 lines

We have very scarce support of cameras on mobile phones in mainline, thus leaving a comment that HW can do 24 MHz is reasonable compromise IMHO.

The bindings could document the supported frequency range.

In DTS it may make sense to set the frequency the vendor uses as it may affect the link frequencies (albeit I guess they're the same in this case?).

Is this review relevant to v11?

maintainer
#21 lore raw

Re: [PATCH v9 7/7] arm64: dts: qcom: sdm670-google-sargo: add imx355 front camera

Quoted 40 lines · Richard Acayan
Quoted 39 lines · Sakari Ailus

Hi David, Richard,

Quoted 35 lines · David Heidelberg
Quoted 18 lines · Richard Acayan
Quoted 17 lines · David Heidelberg

On 17/02/2026 01:27, Richard Acayan wrote:
[...]

arch/arm64/boot/dts/qcom/sdm670-google-sargo.dts vreg_bob: bob { · line 453

Quoted 9 lines

+&cci_i2c1 {

arch/arm64/boot/dts/qcom/sdm670-google-sargo.dts +8 -0
+	camera@1a {
+		compatible = "sony,imx355";
+		reg = <0x1a>;
+
+		clocks = <&camcc CAM_CC_MCLK2_CLK>;
+
+		assigned-clocks = <&camcc CAM_CC_MCLK2_CLK>;
+		assigned-clock-rates = <19200000>;

Extract from #sdm670-mainline:erebion.eu discussion:
The imx355 can operate on 24 MHz (on both Pixel 3 and 3a), but Linux kernel driver can operate only with 19.2 MHz.

Quoted 6 lines
Quoted 1 line

I assume it would be worth it mention at least by comment here.

This might set the series back because the devicetree isn't meant to be written for specific software, but it's included in v11 because you already asked twice.

I would say node with lower clock frequency is still much better than nothing or placeholder saying "i2c camera here". Instead we'll have small placeholder that value can be bumped to 24 MHz. Important is this can be easily improved when at least one consumer of the device-tree gains support.

We have very scarce support of cameras on mobile phones in mainline, thus leaving a comment that HW can do 24 MHz is reasonable compromise IMHO.

Quoted 7 lines
Quoted 5 lines

The bindings could document the supported frequency range.

In DTS it may make sense to set the frequency the vendor uses as it may affect the link frequencies (albeit I guess they're the same in this case?).

Is this review relevant to v11?

I'd think so: it doesn't mention the frequency should be 24 MHz.

Signature · 1 line
Sakari Ailus
#22 lore raw

Re: [PATCH v9 7/7] arm64: dts: qcom: sdm670-google-sargo: add imx355 front camera

Quoted 43 lines · Sakari Ailus
Quoted 42 lines · Richard Acayan
Quoted 41 lines · Sakari Ailus

Hi David, Richard,

Quoted 28 lines · David Heidelberg
Quoted 18 lines · Richard Acayan
Quoted 17 lines · David Heidelberg

On 17/02/2026 01:27, Richard Acayan wrote:
[...]

Review

Quoted 9 lines

+&cci_i2c1 {

(quoted diff) +8 -0
+	camera@1a {
+		compatible = "sony,imx355";
+		reg = <0x1a>;
+
+		clocks = <&camcc CAM_CC_MCLK2_CLK>;
+
+		assigned-clocks = <&camcc CAM_CC_MCLK2_CLK>;
+		assigned-clock-rates = <19200000>;

Extract from #sdm670-mainline:erebion.eu discussion:
The imx355 can operate on 24 MHz (on both Pixel 3 and 3a), but Linux kernel driver can operate only with 19.2 MHz.

Quoted 6 lines
Quoted 1 line

I assume it would be worth it mention at least by comment here.

This might set the series back because the devicetree isn't meant to be written for specific software, but it's included in v11 because you already asked twice.

Quoted 7 lines

I would say node with lower clock frequency is still much better than nothing or placeholder saying "i2c camera here". Instead we'll have small placeholder that value can be bumped to 24 MHz. Important is this can be easily improved when at least one consumer of the device-tree gains support.

We have very scarce support of cameras on mobile phones in mainline, thus leaving a comment that HW can do 24 MHz is reasonable compromise IMHO.

The bindings could document the supported frequency range.

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines

In DTS it may make sense to set the frequency the vendor uses as it may affect the link frequencies (albeit I guess they're the same in this case?).

Is this review relevant to v11?

I'd think so: it doesn't mention the frequency should be 24 MHz.

Ok, please check the dts comment in v12 when I send it and continue there.

reviewer Reviewed-by on v9 1/7
#3 lore raw

Re: [PATCH v9 1/7] dt-bindings: media: qcom,sdm670-camss: Remove clock-lanes requirement

In reply to Richard Acayan
Quoted 6 lines · Richard Acayan

The clock-lanes property has no effect on the hardware configuration, as of commit 336136e197e2 ("media: dt-bindings: media: camss: Remove clock-lane property"). Since boards with new camss support can omit the property, remove it from the required lists.

If you send another v10 of the series, please remove 'clock-lanes' property from the example as well. Anyway, feel free to add my

Signature · 2 lines
Best wishes,
Vladimir
#9 lore raw

Re: [PATCH v9 4/7] media: i2c: imx355: Restrict data lanes to 4

In reply to Richard Acayan
Quoted 2 lines · Richard Acayan

The IMX355 sensor driver currently supports having 4 data lanes. There can't be more or less, so check if the firmware specifies 4 lanes.

Does IMX355 sensor hardware support any other number of lanes?

1) If no, then it makes no practical sense to check for data lanes number given by firmware, there can be any stored value, but it's known that the number of sensor data lanes is 4.

2) If yes, then please return to the sensor dt bindings, and reflect any other options, right now it is set strictly to 4 lanes only. In case if 'data-lanes' property is omitted, you can use 4 lanes as a default number of data lanes, and this information shall be documented in the dt bindings.

Quoted 36 lines

Existing ACPI hardware descriptions may not have the data lanes defined so this check also accepts a placeholder of 0 lanes.

---
  drivers/media/i2c/imx355.c | 7 +++++++
  1 file changed, 7 insertions(+)
drivers/media/i2c/imx355.c +7 -0
index 9ca87488c933..0d6aabea7d59 100644
@@ -66,6 +66,9 @@
  #define IMX355_EXT_CLK			19200000
  #define IMX355_LINK_FREQ_INDEX		0
 
+/* number of data lanes */
+#define IMX355_DATA_LANES		4
+
  struct imx355_reg {
  	u16 address;
  	u8 val;
@@ -1705,6 +1708,10 @@ static struct imx355_hwcfg *imx355_get_hwcfg(struct device *dev)
  	if (!cfg)
  		goto out_err;
 
+	if (bus_cfg.bus.mipi_csi2.num_data_lanes != 0
+	 && bus_cfg.bus.mipi_csi2.num_data_lanes != IMX355_DATA_LANES)
+		goto out_err;
+
  	ret = v4l2_link_freq_to_bitmap(dev, bus_cfg.link_frequencies,
  				       bus_cfg.nr_of_link_frequencies,
  				       link_freq_menu_items,
Signature · 2 lines
Best wishes,
Vladimir
#10 lore raw

Re: [PATCH v9 4/7] media: i2c: imx355: Restrict data lanes to 4

Quoted 3 lines · Vladimir Zapolskiy
Quoted 2 lines · Richard Acayan

The IMX355 sensor driver currently supports having 4 data lanes. There can't be more or less, so check if the firmware specifies 4 lanes.

This patch is superseded:

v10: https://lore.kernel.org/all/[email protected]/
v11: https://lore.kernel.org/all/[email protected]/

If my workflow somehow caused you not to receive the new versions, please let me know.

Quoted 1 line

Does IMX355 sensor hardware support any other number of lanes?

Actually, I don't have hardware docs so I don't know. There can't be more or less without driver support.

Quoted 6 lines

1) If no, then it makes no practical sense to check for data lanes number given by firmware, there can be any stored value, but it's known that the number of sensor data lanes is 4.

2) If yes, then please return to the sensor dt bindings, and reflect any other options, right now it is set strictly to 4 lanes only.

I think more lane configurations in dt-bindings can be added as they are discovered, either by reading hardware docs or by finding a board that has a different number of lanes.

Quoted 3 lines

In case if
'data-lanes' property is omitted, you can use 4 lanes as a default number of data lanes, and this information shall be documented in the dt bindings.

Later revisions of the patch require data-lanes.

#4 lore raw

Re: [PATCH v9 1/7] dt-bindings: media: qcom,sdm670-camss: Remove clock-lanes requirement

In reply to Vladimir Zapolskiy
Quoted 10 lines · Vladimir Zapolskiy
Quoted 6 lines · Richard Acayan

The clock-lanes property has no effect on the hardware configuration, as of commit 336136e197e2 ("media: dt-bindings: media: camss: Remove clock-lane property"). Since boards with new camss support can omit the property, remove it from the required lists.

If you send another v10 of the series, please remove 'clock-lanes' property from the example as well.

I don't think I can send a new revision of this patch since it's already applied, though there may be an opportunity if clock-lanes requirements are removed in bulk.