mbox series

[V3,0/2] media: i2c: add support for DW9768 VCM driver

Message ID 20200228155958.20657-1-dongchun.zhu@mediatek.com
Headers show
Series media: i2c: add support for DW9768 VCM driver | expand

Message

Dongchun Zhu Feb. 28, 2020, 3:59 p.m. UTC
Hello,

Add DT bindings in YAML and v4l2 driver for DW9768 lens voice coil actuator.
This is a 10-bit DAC with 100mA output current sink capability from Dongwoon,
designed for linear control of voice coil motor, and controlled via I2C serial
interface to set the desired focus position.

The DW9768 controls the position with 10-bit DAC data D[9:0] and seperates
two 8-bit registers to control the VCM position as belows.
DAC_MSB: D[9:8] (ADD: 0x03)
     +---+---+---+---+---+---+---+---+
     |---|---|---|---|---|---|D09|D08|
     +---+---+---+---+---+---+---+---+
DAC_LSB: D[7:0] (ADD: 0x04)
     +---+---+---+---+---+---+---+---+
     |D07|D06|D05|D04|D03|D02|D01|D00|
     +---+---+---+---+---+---+---+---+

This driver supports:
 - set DW9768 to standby mode once suspend and turn it back to active if resume
 - set the position via V4L2_CID_FOCUS_ABSOLUTE ctrl

Changes of v3 are mainly addressing comments from Andy, Rob, Sakari, Tomasz,
compared to v2:
 - Rebase onto 5.6-rc1
 - Convert text documentation to YAML schema
 - Add documents for the register addresses and bits in the registers
 - Merge _power_off/on with runtime PM suspend/resume function
 - Drop the I2C ID table
 - Refine DW9768 power sequencing timing
 - Use the regulator bulk API to enable/disable regulators
 - Change i2c_smbus_write_block_data() to i2c_smbus_write_word_data()
 - Fixup coding style and improve code quality
 - Fix other reviewed issues in V2

Mainly changes of v2 are addressing the comments from Tomasz, Bingbu, Andy,
including,
 - Use i2c_smbus_write_byte_data to replace of the custom dw9768_i2c_write
 - Use i2c_smbus_write_block_data to set vcm postion
 - Use the runtime PM suspend/resume callbacks to power off/on
 - Check the PM runtime status before powering off in dw9768_remove function
 - Add one more regulator vin for the I2C interface
 - Remove or refine log print
 - Fix other reviewed issues in v1

Dongchun Zhu (2):
  media: i2c: dw9768: Add DT support and MAINTAINERS entry
  media: i2c: Add DW9768 VCM driver

 .../bindings/media/i2c/dongwoon,dw9768.yaml        |  55 +++
 MAINTAINERS                                        |   8 +
 drivers/media/i2c/Kconfig                          |  10 +
 drivers/media/i2c/Makefile                         |   1 +
 drivers/media/i2c/dw9768.c                         | 437 +++++++++++++++++++++
 5 files changed, 511 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/media/i2c/dongwoon,dw9768.yaml
 create mode 100644 drivers/media/i2c/dw9768.c

-- 
2.9.2