media: i2c: Add driver for AD5823 VCM
v2 cover media: i2c: Add driver for AD5823 VCM
Hi All,
Here is v2 of my patches to add a driver for the AD5823 lens voice coil.
The kernel test robot <[email protected]> reported an issue in v1 with missing depends / selects in the Kconfig snippet. Instead of copy and pasting the usual depends + selects for VCM drivers I decided to follow what was done to simplify this for sensor drivers and to turn the "Lens drivers" menu into a menuconfig with the necessary depends and selects, cleaning up the Kconfig parts of all the VCM drivers in the process.
The actual driver itself (patch 2/2) is unchanged in v2.
Regards,
Hans
Hans de Goede (2):
media: i2c: Automatically select common options for lens drivers
media: i2c: Add driver for AD5823 VCM
drivers/media/i2c/Kconfig | 45 +++--- drivers/media/i2c/Makefile | 1 + drivers/media/i2c/ad5823.c | 312 +++++++++++++++++++++++++++++++++++++ 3 files changed, 332 insertions(+), 26 deletions(-) create mode 100644 drivers/media/i2c/ad5823.c
Signature · 1 line
2.47.0
PATCH v2 1/2 media: i2c: Automatically select common options for lens drivers
In commit 7d3c7d2a2914 ("media: i2c: Add a camera sensor top level menu") a top level menu was added for sensor drivers so that all sensor drivers would depend on I2C and so that MEDIA_CONTROLLER, FWNODE and VIDEO_V4L2_SUBDEV_API would be automatically selected for all sensor drivers.
All lens drivers must depend on I2C and VIDEO_DEV and must select MEDIA_CONTROLLER, V4L2_FWNODE and VIDEO_V4L2_SUBDEV_API and most already do, but e.g. VIDEO_V4L2_SUBDEV_API is not consistenly selected.
Change the "Lens drivers" menu into a menuconfig option with the necessary depends and selects. This ensures that these options are depended on / selected consistently and simplifies the Kconfig snippets for the various lens voice coil drivers.
--- drivers/media/i2c/Kconfig | 37 +++++++++++-------------------------- 1 file changed, 11 insertions(+), 26 deletions(-)
drivers/media/i2c/Kconfig +11 -26
@@ -742,24 +742,25 @@ config VIDEO_THP7312 endmenu -menu "Lens drivers" - visible if MEDIA_CAMERA_SUPPORT +menuconfig VIDEO_CAMERA_LENS + bool "Lens drivers" + depends on MEDIA_CAMERA_SUPPORT && I2C + select MEDIA_CONTROLLER + select V4L2_FWNODE + select VIDEO_V4L2_SUBDEV_API + default y + +if VIDEO_CAMERA_LENS config VIDEO_AD5820 tristate "AD5820 lens voice coil support" - depends on GPIOLIB && I2C && VIDEO_DEV - select MEDIA_CONTROLLER - select V4L2_ASYNC + depends on GPIOLIB help This is a driver for the AD5820 camera lens voice coil. It is used for example in Nokia N900 (RX-51). config VIDEO_AK7375 tristate "AK7375 lens voice coil support" - depends on I2C && VIDEO_DEV - select MEDIA_CONTROLLER - select VIDEO_V4L2_SUBDEV_API - select V4L2_ASYNC help This is a driver for the AK7375 camera lens voice coil. AK7375 is a 12 bit DAC with 120mA output current sink
@@ -768,10 +769,6 @@ config VIDEO_AK7375 config VIDEO_DW9714 tristate "DW9714 lens voice coil support" - depends on I2C && VIDEO_DEV - select MEDIA_CONTROLLER - select VIDEO_V4L2_SUBDEV_API - select V4L2_ASYNC help This is a driver for the DW9714 camera lens voice coil. DW9714 is a 10 bit DAC with 120mA output current sink
@@ -780,10 +777,6 @@ config VIDEO_DW9714 config VIDEO_DW9719 tristate "DW9719 lens voice coil support" - depends on I2C && VIDEO_DEV - select MEDIA_CONTROLLER - select VIDEO_V4L2_SUBDEV_API - select V4L2_ASYNC select V4L2_CCI_I2C help This is a driver for the DW9719 camera lens voice coil.
@@ -792,10 +785,6 @@ config VIDEO_DW9719 config VIDEO_DW9768 tristate "DW9768 lens voice coil support" - depends on I2C && VIDEO_DEV - select MEDIA_CONTROLLER - select VIDEO_V4L2_SUBDEV_API - select V4L2_FWNODE help This is a driver for the DW9768 camera lens voice coil. DW9768 is a 10 bit DAC with 100mA output current sink
@@ -804,17 +793,13 @@ config VIDEO_DW9768 config VIDEO_DW9807_VCM tristate "DW9807 lens voice coil support" - depends on I2C && VIDEO_DEV - select MEDIA_CONTROLLER - select VIDEO_V4L2_SUBDEV_API - select V4L2_ASYNC help This is a driver for the DW9807 camera lens voice coil. DW9807 is a 10 bit DAC with 100mA output current sink capability. This is designed for linear control of voice coil motors, controlled via I2C serial interface. -endmenu +endif menu "Flash devices" visible if MEDIA_CAMERA_SUPPORT
Signature · 1 line
2.47.0
PATCH v2 2/2 media: i2c: Add driver for AD5823 VCM
In reply to Hans de GoedeAdd a driver for the AD5823 VCM. The driver creates a v4l2 subdevice and registers a control to set the desired focus.
--- drivers/media/i2c/Kconfig | 8 + drivers/media/i2c/Makefile | 1 + drivers/media/i2c/ad5823.c | 312 +++++++++++++++++++++++++++++++++++++ 3 files changed, 321 insertions(+) create mode 100644 drivers/media/i2c/ad5823.c
drivers/media/i2c/Kconfig +8 -0
@@ -759,6 +759,14 @@ config VIDEO_AD5820 This is a driver for the AD5820 camera lens voice coil. It is used for example in Nokia N900 (RX-51). +config VIDEO_AD5823 + tristate "AD5823 lens voice coil support" + select V4L2_CCI_I2C + help + This is a driver for the AD5823 camera lens voice coil / VCM. + This is designed for linear control of voice coil motors, + controlled via I2C serial interface. + config VIDEO_AK7375 tristate "AK7375 lens voice coil support" help
drivers/media/i2c/Makefile +1 -0
@@ -4,6 +4,7 @@ msp3400-objs := msp3400-driver.o msp3400-kthreads.o obj-$(CONFIG_SDR_MAX2175) += max2175.o obj-$(CONFIG_VIDEO_AD5820) += ad5820.o +obj-$(CONFIG_VIDEO_AD5823) += ad5823.o obj-$(CONFIG_VIDEO_ADP1653) += adp1653.o obj-$(CONFIG_VIDEO_ADV7170) += adv7170.o obj-$(CONFIG_VIDEO_ADV7175) += adv7175.o
drivers/media/i2c/ad5823.c new file +312 -0
312 lines not on this page · raw message
Signature · 1 line
2.47.0