Hi Sakari, On Tue, 2020-05-12 at 11:58 +0300, Sakari Ailus wrote: > Hi Dongchun, > > On Tue, May 12, 2020 at 11:33:23AM +0800, Dongchun Zhu wrote: > > Hi Tomasz, > > > > On Mon, 2020-05-11 at 20:20 +0200, Tomasz Figa wrote: > > > Hi Dongchun, > > > > > > On Sat, May 9, 2020 at 4:25 AM Dongchun Zhu <dongchun.zhu@xxxxxxxxxxxx> wrote: > > > > > > > > Hi Sakari, > > > > > > > > On Sat, 2020-05-09 at 00:13 +0300, Sakari Ailus wrote: > > > > > Hi Dongchun, > > > > > > > > > > On Fri, May 08, 2020 at 11:08:08AM +0800, Dongchun Zhu wrote: > > > > > > Hi Sakari, Tomasz, > > > > > > > > > > > > Thanks for the review. > > > > > > > > > > > > On Thu, 2020-05-07 at 15:46 +0200, Tomasz Figa wrote: > > > > > > > Hi Sakari, Dongchun, > > > > > > > > > > > > > > On Thu, May 7, 2020 at 3:12 PM Sakari Ailus > > > > > > > <sakari.ailus@xxxxxxxxxxxxxxx> wrote: > > > > > > > > > > > > > > > > HI Dongchun, > > > > > > > > > > > > > > > > On Thu, May 07, 2020 at 08:45:24PM +0800, Dongchun Zhu wrote: > > > > > > > > > Hi Sakari, > > > > > > > > > > > > > > > > > > Thanks for the review. > > > > > > > > > > > > > > > > > > On Wed, 2020-05-06 at 18:13 +0300, Sakari Ailus wrote: > > > > > > > > > > Hi Dongchun, > > > > > > > > > > > > > > > > > > > > On Sun, May 03, 2020 at 12:17:27AM +0800, Dongchun Zhu wrote: > > > > > > > > > > > Add a V4L2 sub-device driver for DW9768 voice coil motor, providing > > > > > > > > > > > control to set the desired focus via IIC serial interface. > > > > > > > > > > > > > > > > > > > > > > Signed-off-by: Dongchun Zhu <dongchun.zhu@xxxxxxxxxxxx> > > > > > > > > > > > --- > > > > > > > > > > > MAINTAINERS | 1 + > > > > > > > > > > > drivers/media/i2c/Kconfig | 11 ++ > > > > > > > > > > > drivers/media/i2c/Makefile | 1 + > > > > > > > > > > > drivers/media/i2c/dw9768.c | 440 +++++++++++++++++++++++++++++++++++++++++++++ > > > > > > > > > > > 4 files changed, 453 insertions(+) > > > > > > > > > > > create mode 100644 drivers/media/i2c/dw9768.c > > > > > > > > > > > > > > > > > > > > > > diff --git a/MAINTAINERS b/MAINTAINERS > > > > > > > > > > > index 8d72c41..c92dc99 100644 > > > > > > > > > > > --- a/MAINTAINERS > > > > > > > > > > > +++ b/MAINTAINERS > > > > > > > > > > > @@ -5157,6 +5157,7 @@ L: linux-media@xxxxxxxxxxxxxxx > > > > > > > > > > > S: Maintained > > > > > > > > > > > T: git git://linuxtv.org/media_tree.git > > > > > > > > > > > F: Documentation/devicetree/bindings/media/i2c/dongwoon,dw9768.yaml > > > > > > > > > > > +F: drivers/media/i2c/dw9768.c > > > > > > > > > > > > > > > > > > > > > > DONGWOON DW9807 LENS VOICE COIL DRIVER > > > > > > > > > > > M: Sakari Ailus <sakari.ailus@xxxxxxxxxxxxxxx> > > > > > > > > > > > diff --git a/drivers/media/i2c/Kconfig b/drivers/media/i2c/Kconfig > > > > > > > > > > > index 125d596..6a3f9da 100644 > > > > > > > > > > > --- a/drivers/media/i2c/Kconfig > > > > > > > > > > > +++ b/drivers/media/i2c/Kconfig > > > > > > > > > > > @@ -1040,6 +1040,17 @@ config VIDEO_DW9714 > > > > > > > > > > > capability. This is designed for linear control of > > > > > > > > > > > voice coil motors, controlled via I2C serial interface. > > > > > > > > > > > > > > > > > > > > > > +config VIDEO_DW9768 > > > > > > > > > > > + tristate "DW9768 lens voice coil support" > > > > > > > > > > > + depends on I2C && VIDEO_V4L2 && MEDIA_CONTROLLER > > > > > > > > > > > + depends on VIDEO_V4L2_SUBDEV_API > > > > > > > > > > > > > > > > > > > > Please check how this works in the media tree master branch now --- it's > > > > > > > > > > largely select based. > > > > > > > > > > > > > > > > > > > > > > > > > > > > The actuator driver uses some structures that require the > > > > > > > > > VIDEO_V4L2_SUBDEV_API code, so here we add VIDEO_V4L2_SUBDEV_API > > > > > > > > > dependency to avoid possible build error when it's not enabled. > > > > > > > > > > > > > > > > Please make sure this works with current media tree master. Right now it > > > > > > > > does not. > > > > > > > > > > > > > > > > > > > > > > Dongchun, as Sakari said, please make sure to base the patches on the > > > > > > > master branch of the media tree. > > > > > > > (https://git.linuxtv.org/media_tree.git/). The approach for Kconfig > > > > > > > dependency selection there seems to have changed recently. > > > > > > > > > > > > > > > > > > > I searched the patches on the media tree master branch. > > > > > > It seems that we need to remove the VIDEO_V4L2_SUBDEV_API dependency in > > > > > > Kconfig, and add #ifdef CONFIG_VIDEO_V4L2_SUBDEV_API to include > > > > > > v4l2-subdev code. > > > > > > The change mainly is to make build pass, and don't return ENOTTY if > > > > > > SUBDEV_API is not set. > > > > > > Am I right? > > > > > > > > > > Please see Kconfig entries for other similar drivers from Dongwoon. > > > > > > > > > > > > > Sorry for the mistake :-) > > > > Just found the current media tree master branch code... > > > > I would update Kconfig entries in next release by referring to: > > > > https://git.linuxtv.org/media_tree.git/tree/drivers/media/i2c/Kconfig > > > > > > Sorry for last minute comments again. We had a short discussion > > > offline with Sakari and we think there are some changes needed to this > > > driver, namely: > > > > > > 1) The hardware being driven in our case is a gt9769, which could be > > > compatible with dw9768, but it's still a different implementation and > > > could have slightly different characteristics. Thus we think the > > > driver name and compatible strings should be renamed from > > > dongwoon,dw9768 to giantec,gt9769. In the future, if there is a device > > Sorry, I actually meant just the compatible string --- Dongwoon is likely > the original manufacturer. Therefore I'd name the driver according to that, > and just add a second compatible string for the Giantec device. > > Either works for me though. > Just checked the legacy lens driver based on Mediatek architecture. I found that both DW9718 and DW9719 have been using some configuration registers to initialize VCM. Unlickily, I cannot see any upstream patches about these two lens drivers on the community. For your suggestion, I think it is okay. In fact, I just synced with Giantec FAE. Dongwoon Anatech and Giantec are two different driver companies. Their most VCM driver products are compatible with each other. In fact, they have a mapping table of DW & GT. For user, the actuator driver is common, such as DW9768 and GT9769. However, algorithms inside the chip from different Manufactures differs. For GT9769/DW9768, there is one read-only register 0x00 that could be read out to distinguish VCM IC Manufacture ID. The default value 0xE1 represents Giantec. Finally I would add one more compatible for Giantec in next release. Like this: static const struct of_device_id dw9768_of_table[] = { { .compatible = "dongwoon,dw9768" }, { .compatible = "giantec,gt9769" }, {} }; MODULE_DEVICE_TABLE(of, dw9768_of_table);