Skip to contentSkip to conversation

Pinefeat cef168 lens control board driver

PATCH Superseded Aliaksandr Smirnou 4 participants 16 messages Oct 7, 2025 – Jun 1

Subsystems (2)

v6 of 7 Superseded Latest is v7 →

lore
Share & tools
lore
#0 lore raw

v6 cover Pinefeat cef168 lens control board driver

This patch series adds support for the Pinefeat adapter, which interfaces Canon EF and EF-S lenses to non-Canon camera bodies. The cef168 circuit control board provides an I2C interface for electronic focus and aperture control. The driver integrates with the V4L2 sub-device API.

For more information about the product, see:
https://github.com/pinefeat/cef168

Changes in v6:
- removed "focus_range" custom control, instead modified the range of the standard "focus_absolute"

There were no changes in dt-bindings patch.

Link to v5: https://lore.kernel.org/all/[email protected]/

Patches:
dt-bindings: Pinefeat cef168 lens control board
media: i2c: Pinefeat cef168 lens control board driver

 .../bindings/media/i2c/pinefeat,cef168.yaml   |  47 +++
 .../devicetree/bindings/vendor-prefixes.yaml  |   2 +
 MAINTAINERS                                   |   7 +
 drivers/media/i2c/Kconfig                     |   9 +
 drivers/media/i2c/Makefile                    |   1 +
 drivers/media/i2c/cef168.c                    | 317 ++++++++++++++++++
 include/uapi/linux/v4l2-controls.h            |   6 +
 7 files changed, 389 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/media/i2c/pinefeat,cef168.yaml
 create mode 100644 drivers/media/i2c/cef168.c

base-commit: 6093a688a07da07808f0122f9aa2a3eed250d853

Signature · 1 line
2.34.1
#1 lore raw

PATCH v6 1/2 dt-bindings: Pinefeat cef168 lens control board

Add the Device Tree schema and examples for the Pinefeat cef168 lens control board. This board interfaces Canon EF & EF-S lenses with non-Canon camera bodies, enabling electronic control of focus and aperture via V4L2.

Power supply is derived from fixed supplies via connector or GPIO header. Therefore, the driver does not manage any regulator, so representing any supply in the binding is redundant.

---
 .../bindings/media/i2c/pinefeat,cef168.yaml   | 47 +++++++++++++++++++
 .../devicetree/bindings/vendor-prefixes.yaml  |  2 +
 MAINTAINERS                                   |  6 +++
 3 files changed, 55 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/media/i2c/pinefeat,cef168.yaml
Documentation/devicetree/bindings/media/i2c/pinefeat,cef168.yaml new file +47 -0
new file mode 100644
index 000000000000..1295b1f4edeb
@@ -0,0 +1,47 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+# Copyright (c) 2025 Pinefeat LLP
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/media/i2c/pinefeat,cef168.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Pinefeat cef168 lens driver
+
+maintainers:
+  - Aliaksandr Smirnou <[email protected]>
+
+description: |
+  Pinefeat produces an adapter designed to interface between
+  Canon EF & EF-S lenses and non-Canon camera bodies, incorporating
+  features for electronic focus and aperture adjustment. The cef168
+  circuit board, included with the adapter, provides a software
+  programming interface that allows control of lens focus and
+  aperture positions.
+
+properties:
+  compatible:
+    enum:
+      - pinefeat,cef168
+
+  reg:
+    maxItems: 1
+
+required:
+  - compatible
+  - reg
+
+additionalProperties: false
+
+examples:
+  - |
+    i2c {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        camera-lens@d {
+            compatible = "pinefeat,cef168";
+            reg = <0x0d>;
+        };
+    };
+
+...
Documentation/devicetree/bindings/vendor-prefixes.yaml +2 -0
index f1d1882009ba..4f50c35ed670 100644
@@ -1241,6 +1241,8 @@ patternProperties:
     description: Picochip Ltd
   "^pine64,.*":
     description: Pine64
+  "^pinefeat,.*":
+    description: Pinefeat LLP
   "^pineriver,.*":
     description: Shenzhen PineRiver Designs Co., Ltd.
   "^pixcir,.*":
MAINTAINERS +6 -0
index 5a2cde903910..a59cd27caf11 100644
@@ -20332,6 +20332,12 @@ S:	Supported
 F:	Documentation/devicetree/bindings/input/pine64,pinephone-keyboard.yaml
 F:	drivers/input/keyboard/pinephone-keyboard.c
 
+PINEFEAT CEF168 LENS DRIVER
+M:	Aliaksandr Smirnou <[email protected]>
+L:	[email protected]
+S:	Supported
+F:	Documentation/devicetree/bindings/media/i2c/pinefeat,cef168.yaml
+
 PLANTOWER PMS7003 AIR POLLUTION SENSOR DRIVER
 M:	Tomasz Duszynski <[email protected]>
 S:	Maintained
Signature · 1 line
2.34.1
#2 lore raw

Re: [PATCH v6 1/2] dt-bindings: Pinefeat cef168 lens control board

Quoted 10 lines · Aliaksandr Smirnou

Add the Device Tree schema and examples for the Pinefeat cef168 lens control board. This board interfaces Canon EF & EF-S lenses with non-Canon camera bodies, enabling electronic control of focus and aperture via V4L2.

Power supply is derived from fixed supplies via connector or GPIO header. Therefore, the driver does not manage any regulator, so representing any supply in the binding is redundant.

I acked v5, any reason for not applying it?
https://lore.kernel.org/all/20251007-geologic-epidemic-2f667f232cf6@spud/#t

#3 lore raw

Re: [PATCH v6 1/2] dt-bindings: Pinefeat cef168 lens control board

Quoted 2 lines · Conor Dooley

I acked v5, any reason for not applying it?
https://lore.kernel.org/all/20251007-geologic-epidemic-2f667f232cf6@spud/#t

Yes, the dt-bindings patch can be applied.
The v6 series does not change anything in the dt-bindings patch - only another patch in the series was updated, so v6 was sent.

Apologies - I wasn't aware that an acked patch could be omitted from the new revision.

Acked-by
#4 lore raw

Re: [PATCH v6 1/2] dt-bindings: Pinefeat cef168 lens control board

Quoted 11 lines · Aliaksandr Smirnou
Quoted 2 lines · Conor Dooley

I acked v5, any reason for not applying it?
https://lore.kernel.org/all/20251007-geologic-epidemic-2f667f232cf6@spud/#t

Yes, the dt-bindings patch can be applied.
The v6 series does not change anything in the dt-bindings patch - only another patch in the series was updated, so v6 was sent.

Apologies - I wasn't aware that an acked patch could be omitted from the new revision.

No no, it's not that it should have been omitted - it's that you should have applied my ack on v5 when submitting your v6. I guess timing worked against you because I sent it like 20 mins before you sent v6.

#5 lore raw

Re: [PATCH v6 1/2] dt-bindings: Pinefeat cef168 lens control board

Quoted 10 lines · Conor Dooley
Quoted 9 lines · Aliaksandr Smirnou
Quoted 2 lines · Conor Dooley

I acked v5, any reason for not applying it?
https://lore.kernel.org/all/20251007-geologic-epidemic-2f667f232cf6@spud/#t

Yes, the dt-bindings patch can be applied.
The v6 series does not change anything in the dt-bindings patch - only another patch in the series was updated, so v6 was sent.

Quoted 7 lines
Quoted 2 lines

Apologies - I wasn't aware that an acked patch could be omitted from the new revision.

No no, it's not that it should have been omitted - it's that you should have applied my ack on v5 when submitting your v6. I guess timing worked against you because I sent it like 20 mins before you sent v6.

Thanks for clarifying. I'll make sure to include your Acked-by tag in the next version.

#6 lore raw

Re: [PATCH v6 1/2] dt-bindings: Pinefeat cef168 lens control board

In reply to Aliaksandr Smirnou
Quoted 10 lines · Aliaksandr Smirnou

Add the Device Tree schema and examples for the Pinefeat cef168 lens control board. This board interfaces Canon EF & EF-S lenses with non-Canon camera bodies, enabling electronic control of focus and aperture via V4L2.

Power supply is derived from fixed supplies via connector or GPIO header. Therefore, the driver does not manage any regulator, so representing any supply in the binding is redundant.

You already got review at v4! Why are you forcing us to do the job multiple times?

<form letter>
This is a friendly reminder during the review process.

It looks like you received a tag and forgot to add it.

If you do not know the process, here is a short explanation:
Please add Acked-by/Reviewed-by/Tested-by tags when posting new versions of patchset, under or above your Signed-off-by tag, unless patch changed significantly (e.g. new properties added to the DT bindings). Tag is "received", when provided in a message replied to you on the mailing list. Tools like b4 can help here. However, there's no need to repost patches *only* to add the tags. The upstream maintainer will do that for tags received on the version they apply.

Please read:
https://elixir.bootlin.com/linux/v6.12-rc3/source/Documentation/process/submitting-patches.rst#L577

If a tag was not added on purpose, please state why and what changed. </form letter>

Best regards,
Krzysztof

#7 lore raw

Re: [PATCH v6 1/2] dt-bindings: Pinefeat cef168 lens control board

Quoted 2 lines · Krzysztof Kozlowski

You already got review at v4! Why are you forcing us to do the job multiple times?

Apologies for the oversight. There were no changes in the dt-bindings patch; I should have kept the Reviewed-by tag from the earlier one. I'll make sure to include it next time.

#8 lore raw

PATCH v6 2/2 media: i2c: Pinefeat cef168 lens control board driver

In reply to Aliaksandr Smirnou

Add support for the Pinefeat cef168 lens control board that provides electronic focus and aperture control for Canon EF & EF-S lenses on non-Canon camera bodies.

---
 MAINTAINERS                        |   1 +
 drivers/media/i2c/Kconfig          |   9 +
 drivers/media/i2c/Makefile         |   1 +
 drivers/media/i2c/cef168.c         | 317 +++++++++++++++++++++++++++++
 include/uapi/linux/v4l2-controls.h |   6 +
 5 files changed, 334 insertions(+)
 create mode 100644 drivers/media/i2c/cef168.c
MAINTAINERS +1 -0
index a59cd27caf11..0cf3b3a35827 100644
@@ -20337,6 +20337,7 @@ M:	Aliaksandr Smirnou <[email protected]>
 L:	[email protected]
 S:	Supported
 F:	Documentation/devicetree/bindings/media/i2c/pinefeat,cef168.yaml
+F:	drivers/media/i2c/cef168.c
 
 PLANTOWER PMS7003 AIR POLLUTION SENSOR DRIVER
 M:	Tomasz Duszynski <[email protected]>
drivers/media/i2c/Kconfig +9 -0
index cdd7ba5da0d5..694b2571de37 100644
@@ -823,6 +823,15 @@ config VIDEO_AK7375
 	  capability. This is designed for linear control of
 	  voice coil motors, controlled via I2C serial interface.
 
+config VIDEO_CEF168
+	tristate "CEF168 lens control support"
+	select CRC8
+	help
+	  This is a driver for the CEF168 lens control board.
+	  The board provides an I2C interface for electronic focus
+	  and aperture control of EF and EF-S lenses. The driver
+	  integrates with the V4L2 sub-device API.
+
 config VIDEO_DW9714
 	tristate "DW9714 lens voice coil support"
 	depends on GPIOLIB
drivers/media/i2c/Makefile +1 -0
index 57cdd8dc96f6..2e8f0a968352 100644
@@ -25,6 +25,7 @@ obj-$(CONFIG_VIDEO_BT856) += bt856.o
 obj-$(CONFIG_VIDEO_BT866) += bt866.o
 obj-$(CONFIG_VIDEO_CCS) += ccs/
 obj-$(CONFIG_VIDEO_CCS_PLL) += ccs-pll.o
+obj-$(CONFIG_VIDEO_CEF168) += cef168.o
 obj-$(CONFIG_VIDEO_CS3308) += cs3308.o
 obj-$(CONFIG_VIDEO_CS5345) += cs5345.o
 obj-$(CONFIG_VIDEO_CS53L32A) += cs53l32a.o
drivers/media/i2c/cef168.c new file +317 -0

317 lines not on this page · raw message

include/uapi/linux/v4l2-controls.h +6 -0
index 2d30107e047e..f8ca4f8c89af 100644
@@ -228,6 +228,12 @@ enum v4l2_colorfx {
  */
 #define V4L2_CID_USER_RKISP1_BASE		(V4L2_CID_USER_BASE + 0x1220)
 
+/*
+ * The base for Pinefeat CEF168 driver controls.
+ * We reserve 16 controls for this driver.
+ */
+#define V4L2_CID_USER_CEF168_BASE		(V4L2_CID_USER_BASE + 0x1230)
+
 /* MPEG-class control IDs */
 /* The MPEG controls are applicable to all codec controls
  * and the 'MPEG' part of the define is historical */
Signature · 1 line
2.34.1
#9 lore raw
In reply to Aliaksandr Smirnou

Hi Aliaksandr,

I've been asked by Kieran Bingham to review your patches, I've reproduced your work on setup with a Pi 5 with a 6.18 kernel and I got a few questions

Quoted 7 lines · Aliaksandr Smirnou

This patch series adds support for the Pinefeat adapter, which interfaces Canon EF and EF-S lenses to non-Canon camera bodies. The cef168 circuit control board provides an I2C interface for electronic focus and aperture control. The driver integrates with the V4L2 sub-device API.

For more information about the product, see:
https://github.com/pinefeat/cef168

I built the calibration application but it would not work out the box,
I can see that CEF168_V4L2_CID_CUSTOM is different between that is in the patch and in the application? Which is the correct one, does the patch need updating?

The tool to modify the device tree also did not work with the IMX477, I needed to manually modify my device tree to get the dtbo to build, there needs to be some further discussions on how we could improve the user experience when it comes to enabling the vcm with camera sensors.

Quoted 21 lines

Changes in v6:
- removed "focus_range" custom control, instead modified the range of the standard "focus_absolute"

There were no changes in dt-bindings patch.

Link to v5: https://lore.kernel.org/all/[email protected]/

Patches:
dt-bindings: Pinefeat cef168 lens control board
media: i2c: Pinefeat cef168 lens control board driver

  .../bindings/media/i2c/pinefeat,cef168.yaml   |  47 +++
  .../devicetree/bindings/vendor-prefixes.yaml  |   2 +
  MAINTAINERS                                   |   7 +
  drivers/media/i2c/Kconfig                     |   9 +
  drivers/media/i2c/Makefile                    |   1 +
  drivers/media/i2c/cef168.c                    | 317 ++++++++++++++++++
  include/uapi/linux/v4l2-controls.h            |   6 +
  7 files changed, 389 insertions(+)
Quoted 5 lines

create mode 100644 Documentation/devicetree/bindings/media/i2c/pinefeat,cef168.yaml create mode 100644 drivers/media/i2c/cef168.c

base-commit: 6093a688a07da07808f0122f9aa2a3eed250d853

Thank you,
Alen Karnil

#10 lore raw
Quoted 3 lines · Alen Karnil

I've been asked by Kieran Bingham to review your patches, I've reproduced your work on setup with a Pi 5 with a 6.18 kernel and I got a few questions

Hi Alen,

Thank you for resuming the work on the patch.

Quoted 4 lines

I built the calibration application but it would not work out the box, I can see that CEF168_V4L2_CID_CUSTOM is different between that is in the patch and in the application? Which is the correct one, does the patch need updating?

The CEF168_V4L2_CID_CUSTOM value used in the patch is the correct one.

Although the repository currently defines it with a different value, this does not cause any issues for users because the driver is built and installed locally together with the calibration tool.

I can update the value in the cef168 repository at any time, so as long as users pull the latest version of the repository, everything will work correctly.

If the driver is eventually merged into the Linux kernel source tree, the repository will need to be updated accordingly anyway, because there will be no need to build the driver locally.

Quoted 3 lines

The tool to modify the device tree also did not work with the IMX477, I needed to manually modify my device tree to get the dtbo to build,

I just double-checked the setup on a Raspberry Pi 5 running the latest 6.18 kernel from the stock Raspberry Pi OS, and everything works correctly. Are you using a customized Linux distribution?

Could you provide the build error logs and the overlay files generated by the tool before you modified them?

The modifications applied by the tool are shown in this diff:

https://gist.github.com/pinefeat/1b3a258a193754f073e171b1ed33a0cc

Were the generated files different in your setup?

Quoted 3 lines

there needs to be some further discussions on how we could improve the user experience when it comes to enabling the vcm with camera sensors.

I agree. I started the discussion on the Raspberry Pi forum, but the driver needs to be merged first before moving forward with that.

https://forums.raspberrypi.com/viewtopic.php?p=2318070#p2318070

#11 lore raw
Quoted 29 lines · Aliaksandr Smirnou
Quoted 3 lines · Alen Karnil

I've been asked by Kieran Bingham to review your patches, I've reproduced your work on setup with a Pi 5 with a 6.18 kernel and I got a few questions

Hi Alen,

Thank you for resuming the work on the patch.

Quoted 4 lines

I built the calibration application but it would not work out the box, I can see that CEF168_V4L2_CID_CUSTOM is different between that is in the patch and in the application? Which is the correct one, does the patch need updating?

The CEF168_V4L2_CID_CUSTOM value used in the patch is the correct one.

Although the repository currently defines it with a different value, this does not cause any issues for users because the driver is built and installed locally together with the calibration tool.

I can update the value in the cef168 repository at any time, so as long as users pull the latest version of the repository, everything will work correctly.

If the driver is eventually merged into the Linux kernel source tree, the repository will need to be updated accordingly anyway, because there will be no need to build the driver locally.

Quoted 8 lines
Quoted 3 lines

The tool to modify the device tree also did not work with the IMX477, I needed to manually modify my device tree to get the dtbo to build,

I just double-checked the setup on a Raspberry Pi 5 running the latest 6.18 kernel from the stock Raspberry Pi OS, and everything works correctly. Are you using a customized Linux distribution?

Strange, I've taken the latest RPi lite trxie OS, but I replaced the kernel from the rpi-6.18.y branch.

Quoted 2 lines

Could you provide the build error logs and the overlay files generated by the tool before you modified them?

using the configure.sh tool with imx477
imx477_378-overlay.dtsi

```
// SPDX-License-Identifier: GPL-2.0-only
// Definitions for IMX477 camera module on VC I2C bus

/{
	compatible = "brcm,bcm2835";

	fragment@0 {
		target = <&i2c0if>;
		__overlay__ {
			status = "okay";
		};
	};

	clk_frag: fragment@1 {
		target = <&cam1_clk>;
		cam_clk: __overlay__ {
			clock-frequency = <24000000>;
			status = "okay";
		};
	};

	fragment@2 {
		target = <&i2c0mux>;
		__overlay__ {
			status = "okay";
		};
	};

	reg_frag: fragment@3 {
		target = <&cam1_reg>;
		cam_reg: __overlay__ {
			startup-delay-us = <300000>;
		};
	};

	fragment@4 {
		target = <&cam_node>;
		__overlay__ {
			lens-focus = <&vcm_node>;
		};
	};

	reg_alwayson_frag: fragment@99 {
		target = <&cam1_reg>;
		__dormant__ {
			regulator-always-on;
		};
	};

	i2c_frag: fragment@100 {
		target = <&i2c_csi_dsi>;
		__overlay__ {
			#address-cells = <1>;
			#size-cells = <0>;
			status = "okay";

			#include "imx477_378.dtsi"
		};
	};

	csi_frag: fragment@101 {
		target = <&csi1>;
		csi: __overlay__ {
			status = "okay";

			port {
				csi_ep: endpoint {
					remote-endpoint = <&cam_endpoint>;
					clock-lanes = <0>;
					data-lanes = <1 2>;
					clock-noncontinuous;
				};
			};
		};
	};

	fragment@102 {
		target = <&csi1>;
		__dormant__ {
			compatible = "brcm,bcm2835-unicam-legacy";
		};
	};

	__overrides__ {
		rotation = <&cam_node>,"rotation:0";
		orientation = <&cam_node>,"orientation:0";
		media-controller = <0>,"!102";
		cam0 = <&i2c_frag>, "target:0=",<&i2c_csi_dsi0>,
		       <&csi_frag>, "target:0=",<&csi0>,
		       <&clk_frag>, "target:0=",<&cam0_clk>,
		       <&reg_frag>, "target:0=",<&cam0_reg>,
		       <&reg_alwayson_frag>, "target:0=",<&cam0_reg>,
		       <&cam_node>, "clocks:0=",<&cam0_clk>,
		       <&cam_node>, "VANA-supply:0=",<&cam0_reg>;
		always-on = <0>, "+99";
		link-frequency = <&cam_endpoint>,"link-frequencies#0";
		vcm = <&vcm_node>, "status",
		      <0>, "=4";
	};
};

&cam_node {
	status = "okay";
};

&cam_endpoint {
	remote-endpoint = <&csi_ep>;
};

&vcm_node {
	status = "okay";
};
```

And imx477_378.dtsi

```
cam_node: imx477@1a {
	reg = <0x1a>;
	status = "disabled";

	clocks = <&cam1_clk>;
	clock-names = "xclk";

	VANA-supply = <&cam1_reg>;	/* 2.8v */
	VDIG-supply = <&cam_dummy_reg>;	/* 1.05v */
	VDDL-supply = <&cam_dummy_reg>;	/* 1.8v */

	rotation = <180>;
	orientation = <2>;

	port {
		cam_endpoint: endpoint {
			clock-lanes = <0>;
			data-lanes = <1 2>;
			clock-noncontinuous;
			link-frequencies =
				/bits/ 64 <450000000>;
		};
	};
};

vcm_node: cef168@d {
	compatible = "pinefeat,cef168";
	reg = <0x0d>;
	status = "disabled";
	vcc-supply = <&vdd_3v3_reg>;
};
```

If put these into my kernel build I get:

$ make dtbs
  DTCO     arch/arm64/boot/dts/overlays/camera-mux-2port.dtbo
arch/arm64/boot/dts/overlays/imx477_378.dtsi:26.20-31.3: ERROR (duplicate_label): /fragment@200/__overlay__/pca@70/i2c@1/cef168@d: Duplicate label 'vcm_node' on /fragment@200/__overlay__/pca@70/i2c@1/cef168@d and /fragment@200/__overlay__/pca@70/i2c@0/cef168@d
ERROR: Input tree has errors, aborting (use -f to force output)
make[3]: *** [scripts/Makefile.dtbs:142: arch/arm64/boot/dts/overlays/camera-mux-2port.dtbo] Error 2
make[2]: *** [scripts/Makefile.build:544: arch/arm64/boot/dts/overlays] Error 2
make[1]: *** [/home/admin/linux/Makefile:1498: dtbs] Error 2
make: *** [Makefile:248: __sub-make] Error 2
Quoted 6 lines

The modifications applied by the tool are shown in this diff:

https://gist.github.com/pinefeat/1b3a258a193754f073e171b1ed33a0cc

Were the generated files different in your setup?

I will include my working dts* for the imx477

imx477_378-overlay.dtsi

```
// SPDX-License-Identifier: GPL-2.0-only
// Definitions for IMX477 camera module on VC I2C bus

/{
	compatible = "brcm,bcm2835";

	fragment@0 {
		target = <&i2c0if>;
		__overlay__ {
			status = "okay";
		};
	};

	clk_frag: fragment@1 {
		target = <&cam1_clk>;
		cam_clk: __overlay__ {
			clock-frequency = <24000000>;
			status = "okay";
		};
	};

	fragment@2 {
		target = <&i2c0mux>;
		__overlay__ {
			status = "okay";
		};
	};

	reg_frag: fragment@3 {
		target = <&cam1_reg>;
		cam_reg: __overlay__ {
			startup-delay-us = <300000>;
		};
	};

	reg_alwayson_frag: fragment@99 {
		target = <&cam1_reg>;
		__dormant__ {
			regulator-always-on;
		};
	};

	i2c_frag: fragment@100 {
		target = <&i2c_csi_dsi>;
		__overlay__ {
			#address-cells = <1>;
			#size-cells = <0>;
			status = "okay";

			#include "imx477_378.dtsi"

			vcm: cef168@d {
				compatible = "pinefeat,cef168";
				reg = <0x0d>;
				status = "disabled";
				vcc-supply = <&vdd_3v3_reg>;
			};
		};
	};

	csi_frag: fragment@101 {
		target = <&csi1>;
		csi: __overlay__ {
			status = "okay";

			port {
				csi_ep: endpoint {
					remote-endpoint = <&cam_endpoint>;
					clock-lanes = <0>;
					data-lanes = <1 2>;
					clock-noncontinuous;
				};
			};
		};
	};

	fragment@102 {
		target = <&csi1>;
		__dormant__ {
			compatible = "brcm,bcm2835-unicam-legacy";
		};
	};

	__overrides__ {
		rotation = <&cam_node>,"rotation:0";
		orientation = <&cam_node>,"orientation:0";
		media-controller = <0>,"!102";
		cam0 = <&i2c_frag>, "target:0=",<&i2c_csi_dsi0>,
		       <&csi_frag>, "target:0=",<&csi0>,
		       <&clk_frag>, "target:0=",<&cam0_clk>,
		       <&reg_frag>, "target:0=",<&cam0_reg>,
		       <&reg_alwayson_frag>, "target:0=",<&cam0_reg>,
		       <&cam_node>, "clocks:0=",<&cam0_clk>,
		       <&cam_node>, "VANA-supply:0=",<&cam0_reg>;
		always-on = <0>, "+99";
		vcm = <&vcm>, "status=okay",
		      <&cam_node>,"lens-focus:0=", <&vcm>;
		link-frequency = <&cam_endpoint>,"link-frequencies#0";
	};

};

&cam_node {
	status = "okay";
};

&cam_endpoint {
	remote-endpoint = <&csi_ep>;
};
```

Also I needed to add vcm to my dtoverlay for the pi's config.txt

Quoted 7 lines
Quoted 4 lines

there needs to be some further discussions on how we could improve the user experience when it comes to enabling the vcm with camera sensors.

I agree. I started the discussion on the Raspberry Pi forum, but the driver needs to be merged first before moving forward with that.

Sure that makes sense, lets focus on the driver for now.

Quoted 2 lines

https://forums.raspberrypi.com/viewtopic.php?p=2318070#p2318070

Also you will most likely need to update the patch since the line offsets have moved to work 6.18

#12 lore raw
Quoted 5 lines · Alen Karnil
Quoted 2 lines

Could you provide the build error logs and the overlay files generated by the tool before you modified them?

using the configure.sh tool with imx477
imx477_378-overlay.dtsi
...

The files generated after running the configure.sh tool look correct and match mine exactly.

Quoted 16 lines

If put these into my kernel build I get:

$ make dtbs
   DTCO     arch/arm64/boot/dts/overlays/camera-mux-2port.dtbo
arch/arm64/boot/dts/overlays/imx477_378.dtsi:26.20-31.3: ERROR 
(duplicate_label): /fragment@200/__overlay__/pca@70/i2c@1/cef168@d: 
Duplicate label 'vcm_node' on 
/fragment@200/__overlay__/pca@70/i2c@1/cef168@d and 
/fragment@200/__overlay__/pca@70/i2c@0/cef168@d
ERROR: Input tree has errors, aborting (use -f to force output)
make[3]: *** [scripts/Makefile.dtbs:142: 
arch/arm64/boot/dts/overlays/camera-mux-2port.dtbo] Error 2
make[2]: *** [scripts/Makefile.build:544: arch/arm64/boot/dts/overlays] 
Error 2
make[1]: *** [/home/admin/linux/Makefile:1498: dtbs] Error 2
make: *** [Makefile:248: __sub-make] Error 2

It looks like a different Makefile is being used. In the cef168 repository's Makefile, there is no dtbs target. Also, our Makefile is only 27 lines long, while the log output indicates the error occurs at line 1498.

Could you please ensure you are using the Makefile provided in the cef168 repository?

Quoted 4 lines
Quoted 4 lines
Quoted 3 lines

there needs to be some further discussions on how we could improve the user experience when it comes to enabling the vcm with camera sensors.

Quoted 8 lines
Quoted 2 lines

I agree. I started the discussion on the Raspberry Pi forum, but the driver needs to be merged first before moving forward with that.

Sure that makes sense, lets focus on the driver for now.

Quoted 2 lines

https://forums.raspberrypi.com/viewtopic.php?p=2318070#p2318070

Also you will most likely need to update the patch since the line offsets have moved to work 6.18

Will do. Should I update the patch before or after your review?

#13 lore raw
Quoted 28 lines · Aliaksandr Smirnou
Quoted 5 lines · Alen Karnil
Quoted 2 lines

Could you provide the build error logs and the overlay files generated by the tool before you modified them?

using the configure.sh tool with imx477
imx477_378-overlay.dtsi
...

The files generated after running the configure.sh tool look correct and match mine exactly.

Quoted 16 lines

If put these into my kernel build I get:

$ make dtbs
    DTCO     arch/arm64/boot/dts/overlays/camera-mux-2port.dtbo
arch/arm64/boot/dts/overlays/imx477_378.dtsi:26.20-31.3: ERROR
(duplicate_label): /fragment@200/__overlay__/pca@70/i2c@1/cef168@d:
Duplicate label 'vcm_node' on
/fragment@200/__overlay__/pca@70/i2c@1/cef168@d and
/fragment@200/__overlay__/pca@70/i2c@0/cef168@d
ERROR: Input tree has errors, aborting (use -f to force output)
make[3]: *** [scripts/Makefile.dtbs:142:
arch/arm64/boot/dts/overlays/camera-mux-2port.dtbo] Error 2
make[2]: *** [scripts/Makefile.build:544: arch/arm64/boot/dts/overlays]
Error 2
make[1]: *** [/home/admin/linux/Makefile:1498: dtbs] Error 2
make: *** [Makefile:248: __sub-make] Error 2
Quoted 5 lines

It looks like a different Makefile is being used. In the cef168 repository's Makefile, there is no dtbs target. Also, our Makefile is only 27 lines long, while the log output indicates the error occurs at line 1498.

I was using the kernel's makefile, basically following
https://www.raspberrypi.com/documentation/computers/linux_kernel.html
The kernel I am running has a LOCALVERSION set so it is 6.18.32-v8-afk+ (for reference)

Quoted 2 lines

Could you please ensure you are using the Makefile provided in the cef168 repository?

```
$ make
make -C "/lib/modules/`uname -r`/build" M="/home/admin/work/cef168" DTC_INCLUDE="/usr/src/linux-headers-`uname -r | sed 's/rpt-.*/rpt-common-rpi/'`/include"
make[1]: Entering directory '/home/admin/linux'
make[2]: Entering directory '/home/admin/work/cef168'
  CC [M]  cef168.o
make[4]: *** No rule to make target 'imx477.dtbo', needed by 'modules.order'.  Stop.
make[3]: *** [/home/admin/linux/Makefile:2024: .] Error 2
make[2]: *** [/home/admin/linux/Makefile:248: __sub-make] Error 2
make[2]: Leaving directory '/home/admin/work/cef168'
make[1]: *** [Makefile:248: __sub-make] Error 2
make[1]: Leaving directory '/home/admin/linux'
make: *** [Makefile:16: default] Error 2
```

This is what I got hung up on, which is why I moved onto copying the .dts* and building it from the kernel directory, which lead into the previous issue and me needing to roll my own .dts*

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 4 lines

there needs to be some further discussions on how we could improve the user experience when it comes to enabling the vcm with camera sensors.

I agree. I started the discussion on the Raspberry Pi forum, but the driver needs to be merged first before moving forward with that.

Quoted 8 lines
Quoted 6 lines

Sure that makes sense, lets focus on the driver for now.

Quoted 2 lines

https://forums.raspberrypi.com/viewtopic.php?p=2318070#p2318070

Also you will most likely need to update the patch since the line offsets have moved to work 6.18

Will do. Should I update the patch before or after your review?

I would prefer if you were to update it before just so we are in sync, thank you.

#14 lore raw
Quoted 20 lines · Alen Karnil
Quoted 2 lines

Could you please ensure you are using the Makefile provided in the cef168 repository?

```
$ make
make -C "/lib/modules/`uname -r`/build" M="/home/admin/work/cef168" 
DTC_INCLUDE="/usr/src/linux-headers-`uname -r | sed 
's/rpt-.*/rpt-common-rpi/'`/include"
make[1]: Entering directory '/home/admin/linux'
make[2]: Entering directory '/home/admin/work/cef168'
   CC [M]  cef168.o
make[4]: *** No rule to make target 'imx477.dtbo', needed by 
'modules.order'.  Stop.
make[3]: *** [/home/admin/linux/Makefile:2024: .] Error 2
make[2]: *** [/home/admin/linux/Makefile:248: __sub-make] Error 2
make[2]: Leaving directory '/home/admin/work/cef168'
make[1]: *** [Makefile:248: __sub-make] Error 2
make[1]: Leaving directory '/home/admin/linux'
make: *** [Makefile:16: default] Error 2
```
Quoted 3 lines

This is what I got hung up on, which is why I moved onto copying the .dts* and building it from the kernel directory, which lead into the previous issue and me needing to roll my own .dts*

Could you pull the latest version of the main branch from the cef168 repository? This issue was fixed recently, so it looks like the code you pulled was from before that fix was merged.

The fix involved using the dtb-y target instead of obj-m in the Makefile.

Quoted 4 lines
Quoted 1 line

Will do. Should I update the patch before or after your review?

I would prefer if you were to update it before just so we are in sync, thank you.

Will do.

#15 lore raw
Quoted 26 lines · Aliaksandr Smirnou
Quoted 20 lines · Alen Karnil
Quoted 2 lines

Could you please ensure you are using the Makefile provided in the cef168 repository?

```
$ make
make -C "/lib/modules/`uname -r`/build" M="/home/admin/work/cef168"
DTC_INCLUDE="/usr/src/linux-headers-`uname -r | sed
's/rpt-.*/rpt-common-rpi/'`/include"
make[1]: Entering directory '/home/admin/linux'
make[2]: Entering directory '/home/admin/work/cef168'
    CC [M]  cef168.o
make[4]: *** No rule to make target 'imx477.dtbo', needed by
'modules.order'.  Stop.
make[3]: *** [/home/admin/linux/Makefile:2024: .] Error 2
make[2]: *** [/home/admin/linux/Makefile:248: __sub-make] Error 2
make[2]: Leaving directory '/home/admin/work/cef168'
make[1]: *** [Makefile:248: __sub-make] Error 2
make[1]: Leaving directory '/home/admin/linux'
make: *** [Makefile:16: default] Error 2
```
Quoted 3 lines

This is what I got hung up on, which is why I moved onto copying the .dts* and building it from the kernel directory, which lead into the previous issue and me needing to roll my own .dts*

Quoted 5 lines

Could you pull the latest version of the main branch from the cef168 repository? This issue was fixed recently, so it looks like the code you pulled was from before that fix was merged.

The fix involved using the dtb-y target instead of obj-m in the Makefile.

Just tested it, now it works, thanks.

Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

Will do. Should I update the patch before or after your review?

I would prefer if you were to update it before just so we are in sync, thank you.

Will do.

I will continue the review once it's received.