mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2 0/2] media: ov13858: device tree support for the Surface Pro 11 (Snapdragon)
@ 2026-10-18 21:10 George Neacsu via B4 Relay
  2026-10-18 21:10 ` [PATCH v2 1/2] dt-bindings: media: i2c: Add OmniVision OV13858 George Neacsu via B4 Relay
  2026-10-18 21:10 ` [PATCH v2 2/2] media: i2c: ov13858: Add device tree support George Neacsu via B4 Relay
  0 siblings, 2 replies; 3+ messages in thread
From: George Neacsu via B4 Relay @ 2026-10-18 21:10 UTC (permalink / raw)
  To: Sakari Ailus
  Cc: Mauro Carvalho Chehab, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Sergey Lebedev, German Pablo Lindo,
	Bryan O'Donoghue, linux-media, devicetree, linux-arm-msm,
	linux-kernel, George Neacsu, Krzysztof Kozlowski

Hi Sakari,

The Surface Pro 11 with a Snapdragon X Elite (X1E80100) has an OV13858
rear camera on Qualcomm CAMSS over four D-PHY lanes. This two-patch
series adds the DT binding and the OF/endpoint support for the existing
sensor driver.

v2 keeps Sergey's power-management work as a prerequisite, updated to
his v4:
<20261016210246.58562-1-lsa.uz@pm.me>

On the Snapdragon model, the v4 runtime-PM callbacks are equivalent to
the v3 callbacks used for the hardware test. I ran 20 open/stream/close
cycles on the rear sensor; it runtime-suspended between every cycle and
streamed again each time. Three additional cycles saved complete
4224x3136 RAW10 frames. The camera rails were enabled while streaming
and disabled between sessions.

System suspend has not yet been tested on the Snapdragon model.
Suspend/resume support for this platform is currently being brought up
separately, and I plan to include the camera in that testing once it is
ready. This series therefore makes no suspend/resume claim.

Sergey tested the DT patches on the Intel Surface Pro 11: the endpoint
check passes, 4224x3136 streams at 29.95 fps, and v4l2-compliance passes
46/46 on the subdev. His Tested-by is carried on both patches.

Thanks to Sakari, Krzysztof and Bryan for the review and guidance.
Krzysztof's Reviewed-by is carried on the binding, and Sakari's latest
review feedback is folded into v2.

Changes in v2:
- update the prerequisite from Sergey's v3 to v4;
- carry Sergey's Tested-by on both patches;
- remove the fixed 19.2 MHz claim from the binding description;
- let v4l2_fwnode_endpoint_alloc_parse() handle missing-endpoint deferral;
- trim the driver commit message to the implementation change;
- document the Snapdragon runtime-PM cycle results.

Link to v1:
https://lore.kernel.org/r/20261015-ov13858-x1e-v1-0-acdd918f4fb6@gmail.com

Signed-off-by: George Neacsu <geocausa@gmail.com>
---
George Neacsu (2):
      dt-bindings: media: i2c: Add OmniVision OV13858
      media: i2c: ov13858: Add device tree support

 .../bindings/media/i2c/ovti,ov13858.yaml           | 113 +++++++++++++++++++++
 MAINTAINERS                                        |   1 +
 drivers/media/i2c/ov13858.c                        |  54 ++++++++++
 3 files changed, 168 insertions(+)
---
base-commit: d7e7bca7169873b46e857c025c10f3336c1258d8
change-id: 20261015-ov13858-x1e-88fbdb884f82
prerequisite-patch-id: c4ab7c01d2ee19e6dd6c12f21e95e06527aec23e

Best regards,
-- 
George Neacsu <geocausa@gmail.com>



^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH v2 1/2] dt-bindings: media: i2c: Add OmniVision OV13858
  2026-10-18 21:10 [PATCH v2 0/2] media: ov13858: device tree support for the Surface Pro 11 (Snapdragon) George Neacsu via B4 Relay
@ 2026-10-18 21:10 ` George Neacsu via B4 Relay
  2026-10-18 21:10 ` [PATCH v2 2/2] media: i2c: ov13858: Add device tree support George Neacsu via B4 Relay
  1 sibling, 0 replies; 3+ messages in thread
From: George Neacsu via B4 Relay @ 2026-10-18 21:10 UTC (permalink / raw)
  To: Sakari Ailus
  Cc: Mauro Carvalho Chehab, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Sergey Lebedev, German Pablo Lindo,
	Bryan O'Donoghue, linux-media, devicetree, linux-arm-msm,
	linux-kernel, George Neacsu, Krzysztof Kozlowski

From: George Neacsu <geocausa@gmail.com>

The OV13858 is a 13 megapixel sensor with a four-lane MIPI CSI-2 D-PHY
output. So far its driver has only been probed through ACPI. The
Microsoft Surface Pro 11 with a Snapdragon X Elite uses it as the rear
camera and describes it in the device tree.

Describe the sensor input clock, three supplies, reset GPIO and
four-lane CSI-2 endpoint.

Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
Tested-by: Sergey Lebedev <lsa.uz@pm.me> # Surface Pro 11 (Intel)
Assisted-by: Claude:claude-opus-5-5
Assisted-by: ChatGPT:gpt-5.6-sol
Signed-off-by: George Neacsu <geocausa@gmail.com>
---
 .../bindings/media/i2c/ovti,ov13858.yaml           | 113 +++++++++++++++++++++
 MAINTAINERS                                        |   1 +
 2 files changed, 114 insertions(+)

diff --git a/Documentation/devicetree/bindings/media/i2c/ovti,ov13858.yaml b/Documentation/devicetree/bindings/media/i2c/ovti,ov13858.yaml
new file mode 100644
index 0000000000..62bfb27782
--- /dev/null
+++ b/Documentation/devicetree/bindings/media/i2c/ovti,ov13858.yaml
@@ -0,0 +1,113 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/media/i2c/ovti,ov13858.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: OmniVision OV13858 CMOS Sensor
+
+maintainers:
+  - George Neacsu <geocausa@gmail.com>
+
+description:
+  The OmniVision OV13858 is a 13 megapixel CMOS image sensor with an I2C
+  control interface. It outputs 10-bit Bayer data over a four-lane MIPI
+  CSI-2 D-PHY interface.
+
+allOf:
+  - $ref: /schemas/media/video-interface-devices.yaml#
+
+properties:
+  compatible:
+    const: ovti,ov13858
+
+  reg:
+    maxItems: 1
+
+  clocks:
+    description: Input clock.
+    maxItems: 1
+
+  avdd-supply:
+    description: Analogue circuit voltage supply.
+
+  dovdd-supply:
+    description: I/O circuit voltage supply.
+
+  dvdd-supply:
+    description: Digital circuit voltage supply.
+
+  reset-gpios:
+    description: Active low GPIO connected to the XSHUTDN pad of the sensor.
+    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:
+            items:
+              - const: 1
+              - const: 2
+              - const: 3
+              - const: 4
+
+        required:
+          - data-lanes
+          - link-frequencies
+
+    required:
+      - endpoint
+
+required:
+  - compatible
+  - reg
+  - clocks
+  - avdd-supply
+  - dovdd-supply
+  - dvdd-supply
+  - port
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/gpio/gpio.h>
+
+    i2c {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        camera@10 {
+            compatible = "ovti,ov13858";
+            reg = <0x10>;
+
+            clocks = <&cam_mclk>;
+            assigned-clocks = <&cam_mclk>;
+            assigned-clock-rates = <19200000>;
+
+            avdd-supply = <&vreg_cam_2p8>;
+            dovdd-supply = <&vreg_cam_1p8>;
+            dvdd-supply = <&vreg_cam_1p2>;
+
+            reset-gpios = <&tlmm 110 GPIO_ACTIVE_LOW>;
+
+            orientation = <1>;
+            rotation = <0>;
+
+            port {
+                endpoint {
+                    remote-endpoint = <&csiphy1_ep>;
+                    data-lanes = <1 2 3 4>;
+                    link-frequencies = /bits/ 64 <540000000 270000000>;
+                };
+            };
+        };
+    };
+...
diff --git a/MAINTAINERS b/MAINTAINERS
index 760791e363..d4348a56a9 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -20235,6 +20235,7 @@ M:	Sakari Ailus <sakari.ailus@linux.intel.com>
 L:	linux-media@vger.kernel.org
 S:	Maintained
 T:	git git://linuxtv.org/media.git
+F:	Documentation/devicetree/bindings/media/i2c/ovti,ov13858.yaml
 F:	drivers/media/i2c/ov13858.c
 
 OMNIVISION OV13B10 SENSOR DRIVER

-- 
2.53.0



^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH v2 2/2] media: i2c: ov13858: Add device tree support
  2026-10-18 21:10 [PATCH v2 0/2] media: ov13858: device tree support for the Surface Pro 11 (Snapdragon) George Neacsu via B4 Relay
  2026-10-18 21:10 ` [PATCH v2 1/2] dt-bindings: media: i2c: Add OmniVision OV13858 George Neacsu via B4 Relay
@ 2026-10-18 21:10 ` George Neacsu via B4 Relay
  1 sibling, 0 replies; 3+ messages in thread
From: George Neacsu via B4 Relay @ 2026-10-18 21:10 UTC (permalink / raw)
  To: Sakari Ailus
  Cc: Mauro Carvalho Chehab, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Sergey Lebedev, German Pablo Lindo,
	Bryan O'Donoghue, linux-media, devicetree, linux-arm-msm,
	linux-kernel, George Neacsu

From: George Neacsu <geocausa@gmail.com>

Add an OF match table for OV13858 and parse its firmware endpoint at
probe time. Require a four-lane D-PHY endpoint and both link frequencies
used by the existing sensor modes.

v4l2_fwnode_endpoint_alloc_parse() returns -EPROBE_DEFER if a software
node endpoint has not been instantiated yet, preserving bridge-created
endpoint probe ordering.

Tested-by: Sergey Lebedev <lsa.uz@pm.me> # Surface Pro 11 (Intel)
Assisted-by: Claude:claude-opus-5-5
Assisted-by: ChatGPT:gpt-5.6-sol
Signed-off-by: George Neacsu <geocausa@gmail.com>
---
 drivers/media/i2c/ov13858.c | 54 +++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 54 insertions(+)

diff --git a/drivers/media/i2c/ov13858.c b/drivers/media/i2c/ov13858.c
index 5d7b3c335d..2957124404 100644
--- a/drivers/media/i2c/ov13858.c
+++ b/drivers/media/i2c/ov13858.c
@@ -1765,6 +1765,49 @@ static const struct dev_pm_ops ov13858_pm_ops = {
 	RUNTIME_PM_OPS(ov13858_power_off, ov13858_power_on, NULL)
 };
 
+static int ov13858_check_hwcfg(struct device *dev)
+{
+	struct v4l2_fwnode_endpoint bus_cfg = {
+		.bus_type = V4L2_MBUS_CSI2_DPHY
+	};
+	unsigned long link_freq_bitmap;
+	struct fwnode_handle *ep;
+	int ret;
+
+	ep = fwnode_graph_get_next_endpoint(dev_fwnode(dev), NULL);
+	ret = v4l2_fwnode_endpoint_alloc_parse(ep, &bus_cfg);
+	fwnode_handle_put(ep);
+	if (ret)
+		return dev_err_probe(dev, ret, "parsing endpoint failed\n");
+
+	if (bus_cfg.bus.mipi_csi2.num_data_lanes != 4) {
+		ret = dev_err_probe(dev, -EINVAL,
+				    "%u data lanes are not supported, only 4\n",
+				    bus_cfg.bus.mipi_csi2.num_data_lanes);
+		goto out;
+	}
+
+	/* The modes use both link frequencies, so both have to be allowed. */
+	ret = v4l2_link_freq_to_bitmap(dev, bus_cfg.link_frequencies,
+				       bus_cfg.nr_of_link_frequencies,
+				       link_freq_menu_items,
+				       ARRAY_SIZE(link_freq_menu_items),
+				       &link_freq_bitmap);
+	if (ret)
+		goto out;
+
+	if (link_freq_bitmap != GENMASK(ARRAY_SIZE(link_freq_menu_items) - 1, 0))
+		ret = dev_err_probe(dev, -EINVAL,
+				    "link frequencies %lld and %lld are both needed\n",
+				    link_freq_menu_items[0],
+				    link_freq_menu_items[1]);
+
+out:
+	v4l2_fwnode_endpoint_free(&bus_cfg);
+
+	return ret;
+}
+
 static int ov13858_probe(struct i2c_client *client)
 {
 	struct ov13858 *ov13858;
@@ -1777,6 +1820,10 @@ static int ov13858_probe(struct i2c_client *client)
 
 	ov13858->dev = &client->dev;
 
+	ret = ov13858_check_hwcfg(ov13858->dev);
+	if (ret)
+		return ret;
+
 	ov13858->clk = devm_v4l2_sensor_clk_get(ov13858->dev, NULL);
 	if (IS_ERR(ov13858->clk))
 		return dev_err_probe(ov13858->dev, PTR_ERR(ov13858->clk),
@@ -1897,10 +1944,17 @@ static const struct acpi_device_id ov13858_acpi_ids[] = {
 MODULE_DEVICE_TABLE(acpi, ov13858_acpi_ids);
 #endif
 
+static const struct of_device_id ov13858_of_match[] = {
+	{ .compatible = "ovti,ov13858" },
+	{ /* sentinel */ }
+};
+MODULE_DEVICE_TABLE(of, ov13858_of_match);
+
 static struct i2c_driver ov13858_i2c_driver = {
 	.driver = {
 		.name = "ov13858",
 		.acpi_match_table = ACPI_PTR(ov13858_acpi_ids),
+		.of_match_table = ov13858_of_match,
 		.pm = pm_ptr(&ov13858_pm_ops),
 	},
 	.probe = ov13858_probe,

-- 
2.53.0



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-10-18 21:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-18 21:10 [PATCH v2 0/2] media: ov13858: device tree support for the Surface Pro 11 (Snapdragon) George Neacsu via B4 Relay
2026-10-18 21:10 ` [PATCH v2 1/2] dt-bindings: media: i2c: Add OmniVision OV13858 George Neacsu via B4 Relay
2026-10-18 21:10 ` [PATCH v2 2/2] media: i2c: ov13858: Add device tree support George Neacsu via B4 Relay

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®