Re: [V2, 2/2] media: i2c: Add DW9768 VCM driver
From: Dongchun Zhu <hidden>
Date: 2020-01-20 08:35:03
Also in:
linux-devicetree, linux-media, linux-mediatek
Hello Andy, Thanks for the review. Please see the replies below. On Mon, 2019-09-05 at 12:26 +0200, Andy Shevchenko wrote:
On Thu, Sep 05, 2019 at 03:21:42PM +0800, dongchun.zhu@mediatek.com wrote:quoted
From: Dongchun Zhu <redacted> This patch adds a V4L2 sub-device driver for DW9768 lens voice coil, and provides control to set the desired focus. The DW9768 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.quoted
Signed-off-by: Dongchun Zhu <redacted> --- MAINTAINERS | 1 +This should go to the same patch, where you introduce a record in the MAINTAINERS database.quoted
+#define DW9768_SET_POSITION_ADDR 0x03Indentation issue.
Fixed in next release.
quoted
+static struct regval_list dw9768_init_regs[] = { +{0x02, 0x02}, +{DW9768_CMD_DELAY, DW9768_CMD_DELAY}, +{0x06, 0x41}, +{0x07, 0x39}, +{DW9768_CMD_DELAY, DW9768_CMD_DELAY}, }; + +static struct regval_list dw9768_release_regs[] = { +{0x02, 0x00}, +{DW9768_CMD_DELAY, DW9768_CMD_DELAY}, +{0x01, 0x00}, +{DW9768_CMD_DELAY, DW9768_CMD_DELAY}, }; + +static int dw9768_write_smbus(struct dw9768 *dw9768, unsigned char reg, + unsigned char value) +{ +struct i2c_client *client = v4l2_get_subdevdata(&dw9768->sd); +int ret; +quoted
+if (reg == DW9768_CMD_DELAY && value == DW9768_CMD_DELAY)Indentation issue. But see other's comments.quoted
+usleep_range(DW9768_CTRL_DELAY_US, + DW9768_CTRL_DELAY_US + 100);quoted
+elseThis needs an explanation.
Fixed in next release.
quoted
+ret = i2c_smbus_write_byte_data(client, reg, value); +return ret; +}I'm wondering if we can benefit from regmap I²C API in this driver.quoted
+static int __maybe_unused dw9768_vcm_suspend(struct device *dev) {quoted
+struct i2c_client *client = to_i2c_client(dev); +struct v4l2_subdev *sd = i2c_get_clientdata(client);isn't is simple dev_get_drvdata() ?
As discussed in another group mail, even dev_set_drvdata() is set when probe, the pointer that point to the private device struct changes when using dev_get_drvdata() API. Then resume/power on would result in kernel exception in regulator_enable. This is so weird. We filed one Google issue to trace this behavior. https://partnerissuetracker.corp.google.com/issues/147957975 I am wondering whether there is any condition of the use of dev_get_drvdata(). I checked the other drivers and found that most devices that use dev_get_drvdata() are platform devices or non i2c client devices. So maybe dw9768 or other media/i2c devices cannot support dev_get_drvdata()?
quoted
+struct dw9768 *dw9768 = sd_to_dw9768_vcm(sd); + +return dw9768_power_off(dw9768); +} + +static int __maybe_unused dw9768_vcm_resume(struct device *dev) {quoted
+struct i2c_client *client = to_i2c_client(dev); +struct v4l2_subdev *sd = i2c_get_clientdata(client);Ditto.quoted
+struct dw9768 *dw9768 = sd_to_dw9768_vcm(sd); + +return dw9768_power_on(dw9768); +}quoted
+static const struct i2c_device_id dw9768_id_table[] = { +{ DW9768_NAME, 0 },quoted
+{ },No comma.
This struct would be removed in next release.
quoted
+};quoted
+static const struct of_device_id dw9768_of_table[] = { +{ .compatible = "dongwoon,dw9768" },quoted
+{ },Ditto.
Fixed in next release.
quoted
+};-- With Best Regards, Andy Shevchenko *********************MEDIATEK Confidential/Internal Use*********************
_______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel