Pinefeat cef168 lens control board driver
Subsystems (2)
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
Patches:
dt-bindings: Pinefeat cef168 lens control board media/i2c: Pinefeat cef168 lens control board driver
.../bindings/media/i2c/pinefeat,cef168.yaml | 48 +++ .../devicetree/bindings/vendor-prefixes.yaml | 2 + MAINTAINERS | 9 + drivers/media/i2c/Kconfig | 8 + drivers/media/i2c/Makefile | 1 + drivers/media/i2c/cef168.c | 342 ++++++++++++++++++ drivers/media/i2c/cef168.h | 51 +++ 7 files changed, 461 insertions(+) create mode 100644 Documentation/devicetree/bindings/media/i2c/pinefeat,cef168.yaml create mode 100644 drivers/media/i2c/cef168.c create mode 100644 drivers/media/i2c/cef168.h
base-commit: 2b38afce25c4e1b8f943ff4f0a2b51d6c40f2ed2
Signature · 1 line
2.34.1
PATCH 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.
--- .../bindings/media/i2c/pinefeat,cef168.yaml | 48 +++++++++++++++++++ .../devicetree/bindings/vendor-prefixes.yaml | 2 + MAINTAINERS | 7 +++ 3 files changed, 57 insertions(+) create mode 100644 Documentation/devicetree/bindings/media/i2c/pinefeat,cef168.yaml
Documentation/devicetree/bindings/media/i2c/pinefeat,cef168.yaml new file +48 -0
@@ -0,0 +1,48 @@ +# 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. This driver enables controlling the lens + focus and aperture via the V4L2 (Video4Linux2) API. + +properties: + compatible: + enum: + - pinefeat,cef168 + + reg: + maxItems: 1 + +required: + - compatible + - reg + +additionalProperties: false + +examples: + - | + i2c { + #address-cells = <1>; + #size-cells = <0>; + + lens_node: cef168@d { + compatible = "pinefeat,cef168"; + reg = <0x0d>; + }; + }; + +...
Documentation/devicetree/bindings/vendor-prefixes.yaml +2 -0
@@ -1195,6 +1195,8 @@ patternProperties: description: Picochip Ltd "^pine64,.*": description: Pine64 + "^pinefeat,.*": + description: Pinefeat LLP "^pineriver,.*": description: Shenzhen PineRiver Designs Co., Ltd. "^pixcir,.*":
MAINTAINERS +7 -0
@@ -19985,6 +19985,13 @@ 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 +T: git git://linuxtv.org/media.git +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
PATCH 2/2 media/i2c: Pinefeat cef168 lens control board driver
In reply to Aliaksandr SmirnouAdd 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 | 2 + drivers/media/i2c/Kconfig | 8 + drivers/media/i2c/Makefile | 1 + drivers/media/i2c/cef168.c | 342 +++++++++++++++++++++++++++++++++++++ drivers/media/i2c/cef168.h | 51 ++++++ 5 files changed, 404 insertions(+) create mode 100644 drivers/media/i2c/cef168.c create mode 100644 drivers/media/i2c/cef168.h
MAINTAINERS +2 -0
@@ -19991,6 +19991,8 @@ L: [email protected] S: Supported T: git git://linuxtv.org/media.git F: Documentation/devicetree/bindings/media/i2c/pinefeat,cef168.yaml +F: drivers/media/i2c/cef168.c +F: drivers/media/i2c/cef168.h PLANTOWER PMS7003 AIR POLLUTION SENSOR DRIVER M: Tomasz Duszynski <[email protected]>
drivers/media/i2c/Kconfig +8 -0
@@ -791,6 +791,14 @@ 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" + 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
@@ -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 +342 -0
342 lines not on this page · raw message
drivers/media/i2c/cef168.h new file +51 -0
51 lines not on this page · raw message
Signature · 1 line
2.34.1
Re: [PATCH 1/2] dt-bindings: Pinefeat cef168 lens control board
In reply to Aliaksandr SmirnouQuoted 6 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.Signed-off-by Aliaksandr Smirnou <[email protected]>
<form letter>
Please use scripts/get_maintainers.pl to get a list of necessary people and lists to CC (and consider --no-git-fallback argument, so you will not CC people just because they made one commit years ago). It might happen, that command when run on an older kernel, gives you outdated entries. Therefore please be sure you base your patches on recent Linux kernel.
Tools like b4 or scripts/get_maintainer.pl provide you proper list of people, so fix your workflow. Tools might also fail if you work on some ancient tree (don't, instead use mainline) or work on fork of kernel (don't, instead use mainline). Just use b4 and everything should be fine, although remember about b4 prep --auto-to-cc if you added new patches to the patchset.
</form letter>
Quoted 31 lines
--- .../bindings/media/i2c/pinefeat,cef168.yaml | 48 +++++++++++++++++++ .../devicetree/bindings/vendor-prefixes.yaml | 2 + MAINTAINERS | 7 +++ 3 files changed, 57 insertions(+) create mode 100644 Documentation/devicetree/bindings/media/i2c/pinefeat,cef168.yamlDocumentation/devicetree/bindings/media/i2c/pinefeat,cef168.yaml new file +18
-0@@ -0,0 +1,48 @@ +# 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
Documentation/devicetree/bindings/media/i2c/pinefeat,cef168.yaml line 28
Quoted 10 lines
Documentation/devicetree/bindings/media/i2c/pinefeat,cef168.yaml new file +10
-0+ aperture positions. This driver enables controlling the lens + focus and aperture via the V4L2 (Video4Linux2) API. + +properties: + compatible: + enum: + - pinefeat,cef168 + + reg: + maxItems: 1
Missing supply
Documentation/devicetree/bindings/media/i2c/pinefeat,cef168.yaml line 32
Quoted 4 lines
Documentation/devicetree/bindings/media/i2c/pinefeat,cef168.yaml new file +4
-0+ +required: + - compatible + - reg
Also here
Documentation/devicetree/bindings/media/i2c/pinefeat,cef168.yaml line 42
Quoted 10 lines
Documentation/devicetree/bindings/media/i2c/pinefeat,cef168.yaml new file +10
-0+ +additionalProperties: false + +examples: + - | + i2c { + #address-cells = <1>; + #size-cells = <0>; + + lens_node: cef168@d {
Node names should be generic. See also an explanation and list of examples (not exhaustive) in DT specification:
https://devicetree-specification.readthedocs.io/en/latest/chapter2-devicetree-basics.html#generic-names-recommendation
Quoted 24 lines
Documentation/devicetree/bindings/media/i2c/pinefeat,cef168.yaml new file +6
-0+ compatible = "pinefeat,cef168"; + reg = <0x0d>; + }; + }; + +...Documentation/devicetree/bindings/vendor-prefixes.yaml +2
-0@@ -1195,6 +1195,8 @@ patternProperties: description: Picochip Ltd "^pine64,.*": description: Pine64 + "^pinefeat,.*": + description: Pinefeat LLP "^pineriver,.*": description: Shenzhen PineRiver Designs Co., Ltd. "^pixcir,.*":MAINTAINERS +0
-0
MAINTAINERS S: Supported · line 19992
Quoted 8 lines
MAINTAINERS +5
-0@@ -19985,6 +19985,13 @@ 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 +T: git git://linuxtv.org/media.git
Drop, unless you have commit rights there.
Best regards,
Krzysztof
Re: [PATCH 2/2] media/i2c: Pinefeat cef168 lens control board driver
In reply to Aliaksandr Smirnoudrivers/media/i2c/cef168.c line 270
Quoted 7 lines · Aliaksandr Smirnou
drivers/media/i2c/cef168.c new file +7
-0+static int cef168_probe (struct i2c_client *client) +{ +struct cef168_device *cef168_dev; +int rval; + + cef168_dev = +devm_kzalloc (&client->dev,sizeof (*cef168_dev),GFP_KERNEL );
Wrap according to Linux coding style. Not clang.
Quoted 39 lines
drivers/media/i2c/cef168.c new file +39
-0+if (cef168_dev ==NULL ) +return -ENOMEM ; + +v4l2_i2c_subdev_init (&cef168_dev->sd, client, &cef168_ops); + cef168_dev->sd.flags |=V4L2_SUBDEV_FL_HAS_DEVNODE | +V4L2_SUBDEV_FL_HAS_EVENTS ; + cef168_dev->sd.internal_ops = &cef168_int_ops; + + rval =cef168_init_controls (cef168_dev); +if (rval) + goto err_cleanup; + + rval =media_entity_pads_init (&cef168_dev->sd.entity,0 ,NULL ); +if (rval <0 ) + goto err_cleanup; + + cef168_dev->sd.entity.function =MEDIA_ENT_F_LENS ; + + rval =v4l2_async_register_subdev (&cef168_dev->sd); +if (rval <0 ) + goto err_cleanup; + +crc8_populate_msb (cef168_crc8_table,CEF_CRC8_POLYNOMIAL ); + +pm_runtime_set_active (&client->dev); +pm_runtime_enable (&client->dev); +pm_runtime_idle (&client->dev); + +return 0 ; + +err_cleanup: +v4l2_ctrl_handler_free (&cef168_dev->ctrls); +media_entity_cleanup (&cef168_dev->sd.entity); + +return rval; +} + +static void cef168_remove (struct i2c_client *client) +{
drivers/media/i2c/cef168.c line 319
Quoted 10 lines
drivers/media/i2c/cef168.c new file +10
-0+struct v4l2_subdev *sd =i2c_get_clientdata (client); +struct cef168_device *cef168_dev =sd_to_cef168 (sd); + +pm_runtime_disable (&client->dev); +pm_runtime_set_suspended (&client->dev); +cef168_subdev_cleanup (cef168_dev); +} + +static const struct i2c_device_id cef168_id_table[] = { {CEF168_NAME ,0 }, + { {0 } } };
This is some oddly formed style. You need to use Linux coding style.
drivers/media/i2c/cef168.c line 324
Quoted 5 lines
drivers/media/i2c/cef168.c new file +5
-0+MODULE_DEVICE_TABLE (i2c, cef168_id_table); + +static const struct of_device_id cef168_of_table[] = { + { .compatible ="pinefeat,cef168" }, + { {0 } }
Also here, there is no such style in the kernel. It's just {}
Best regards,
Krzysztof