On Fri, Feb 28, 2020 at 11:59:58PM +0800, Dongchun Zhu wrote: > This patch adds a V4L2 sub-device driver for DW9768 lens voice coil, > and provides control to set the desired focus via I2C serial interface. ... > --- a/MAINTAINERS > +++ b/MAINTAINERS > @@ -5139,6 +5139,7 @@ M: Dongchun Zhu <dongchun.zhu@xxxxxxxxxxxx> > L: linux-media@xxxxxxxxxxxxxxx > T: git git://linuxtv.org/media_tree.git > S: Maintained > +F: drivers/media/i2c/dw9768.c > F: Documentation/devicetree/bindings/media/i2c/dongwoon,dw9768.yaml Had you run parse-maintainers.pl? I believe the order is wrong here. ... > +#define DW9768_MAX_FOCUS_POS 1023 Is this value being dictated by amount of bits available in the hardware? If so, I would rather put it in a form (1024 - 1) or alike to show that it has 10 bit resolution. ... > +static int dw9768_set_dac(struct dw9768 *dw9768, u16 val) > +{ > + struct i2c_client *client = v4l2_get_subdevdata(&dw9768->sd); > + > + /* Write VCM position to registers */ > + return i2c_smbus_write_word_data(client, DW9768_MSB_ADDR, > + swab16(val)); i2c_smbus_write_word_swapped() ? > +} ... > +static int dw9768_release(struct dw9768 *dw9768) > +{ > + struct i2c_client *client = v4l2_get_subdevdata(&dw9768->sd); > + int ret, val; > + > + for (val = round_down(dw9768->focus->val, DW9768_MOVE_STEPS); > + val >= 0; val -= DW9768_MOVE_STEPS) { Perhaps val = round_down(dw9768->focus->val, DW9768_MOVE_STEPS); for ( ; val >= 0; val -= DW9768_MOVE_STEPS) { > + ret = dw9768_set_dac(dw9768, val); > + if (ret) { > + dev_err(&client->dev, "%s I2C failure: %d", > + __func__, ret); Do you need __func__? What for? > + return ret; > + } > + usleep_range(DW9768_MOVE_DELAY_US, > + DW9768_MOVE_DELAY_US + 1000); It's exactly one line. Perhaps you have to check your editor settings. And check entire code for a such. > + } > + > + /* > + * Wait for the motor to stabilize after the last movement > + * to prevent the motor from shaking. > + */ > + usleep_range(DW9768_STABLE_TIME_US - DW9768_MOVE_DELAY_US, > + DW9768_STABLE_TIME_US - DW9768_MOVE_DELAY_US + 1000); > + > + ret = i2c_smbus_write_byte_data(client, DW9768_RING_PD_CONTROL_REG, > + DW9768_PD_MODE_EN); > + if (ret < 0) > + return ret; > + > + /* > + * DW9769 requires waiting delay time of t_OPR > + * after PD reset takes place. > + */ > + usleep_range(DW9768_T_OPR_US, DW9768_T_OPR_US + 100); > + > + return 0; > +} -- With Best Regards, Andy Shevchenko