* [V2, 0/2] media: i2c: add support for DW9768 VCM driver
@ 2019-09-05 7:21 dongchun.zhu
2019-09-05 7:21 ` [V2, 1/2] media: i2c: dw9768: Add DT support and MAINTAINERS entry dongchun.zhu
2019-09-05 7:21 ` [V2, 2/2] media: i2c: Add DW9768 VCM driver dongchun.zhu
0 siblings, 2 replies; 20+ messages in thread
From: dongchun.zhu @ 2019-09-05 7:21 UTC (permalink / raw)
To: mchehab, andriy.shevchenko, robh+dt, mark.rutland, sakari.ailus,
drinkcat, tfiga, matthias.bgg, bingbu.cao
Cc: devicetree, srv_heupstream, shengnan.wang, sj.huang,
linux-mediatek, dongchun.zhu, sam.hung, linux-arm-kernel,
linux-media
From: Dongchun Zhu <dongchun.zhu@mediatek.com>
Hello,
Add a v4l2 sub-device driver for Dongwoon's DW9768 lens voice coil.
This is a voice coil module using the i2c bus to control the focus position.
The DW9768 can control the position with 10 bits value and
consists of two 8 bit registers show as below.
register 0x04(DW9768_REG_POSITION):
+---+---+---+---+---+---+---+---+
|D07|D06|D05|D04|D03|D02|D01|D00|
+---+---+---+---+---+---+---+---+
register 0x03:
+---+---+---+---+---+---+---+---+
|---|---|---|---|---|---|D09|D08|
+---+---+---+---+---+---+---+---+
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
Mainly changes of v2 are addressing the comments from Tomasz, Bingbu, Andy,
including,
- Use i2c_smbus_write_byte_data/i2c_smbus_write_block_data to write I2C register
- Adopt the runtime PM suspend/resume callbacks to powering 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 redundant 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.txt | 9 +
MAINTAINERS | 8 +
drivers/media/i2c/Kconfig | 10 +
drivers/media/i2c/Makefile | 1 +
drivers/media/i2c/dw9768.c | 349 +++++++++++++++++++++
5 files changed, 377 insertions(+)
create mode 100644 Documentation/devicetree/bindings/media/i2c/dongwoon,dw9768.txt
create mode 100644 drivers/media/i2c/dw9768.c
--
2.9.2
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 20+ messages in thread
* [V2, 1/2] media: i2c: dw9768: Add DT support and MAINTAINERS entry
2019-09-05 7:21 [V2, 0/2] media: i2c: add support for DW9768 VCM driver dongchun.zhu
@ 2019-09-05 7:21 ` dongchun.zhu
2019-09-05 10:14 ` Andy Shevchenko
2019-09-05 7:21 ` [V2, 2/2] media: i2c: Add DW9768 VCM driver dongchun.zhu
1 sibling, 1 reply; 20+ messages in thread
From: dongchun.zhu @ 2019-09-05 7:21 UTC (permalink / raw)
To: mchehab, andriy.shevchenko, robh+dt, mark.rutland, sakari.ailus,
drinkcat, tfiga, matthias.bgg, bingbu.cao
Cc: devicetree, srv_heupstream, shengnan.wang, sj.huang,
linux-mediatek, dongchun.zhu, sam.hung, linux-arm-kernel,
linux-media
From: Dongchun Zhu <dongchun.zhu@mediatek.com>
This patch is to add the Devicetree binding documentation and
MAINTAINERS entry for dw9768 actuator.
Signed-off-by: Dongchun Zhu <dongchun.zhu@mediatek.com>
---
Documentation/devicetree/bindings/media/i2c/dongwoon,dw9768.txt | 9 +++++++++
MAINTAINERS | 7 +++++++
2 files changed, 16 insertions(+)
create mode 100644 Documentation/devicetree/bindings/media/i2c/dongwoon,dw9768.txt
diff --git a/Documentation/devicetree/bindings/media/i2c/dongwoon,dw9768.txt b/Documentation/devicetree/bindings/media/i2c/dongwoon,dw9768.txt
new file mode 100644
index 0000000..94b8ec3
--- /dev/null
+++ b/Documentation/devicetree/bindings/media/i2c/dongwoon,dw9768.txt
@@ -0,0 +1,9 @@
+Dongwoon Anatech DW9768 camera voice coil lens driver
+
+DW9768 is a 10-bit DAC with current sink capability. It is intended
+for driving voice coil lenses in camera modules.
+
+Mandatory properties:
+
+- compatible: "dongwoon,dw9768"
+- reg: I²C slave address
diff --git a/MAINTAINERS b/MAINTAINERS
index 783569e..192a671 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -4971,6 +4971,13 @@ S: Maintained
F: drivers/media/i2c/dw9714.c
F: Documentation/devicetree/bindings/media/i2c/dongwoon,dw9714.txt
+DONGWOON DW9768 LENS VOICE COIL DRIVER
+M: Dongchun Zhu <dongchun.zhu@mediatek.com>
+L: linux-media@vger.kernel.org
+T: git git://linuxtv.org/media_tree.git
+S: Maintained
+F: Documentation/devicetree/bindings/media/i2c/dongwoon,dw9768.txt
+
DONGWOON DW9807 LENS VOICE COIL DRIVER
M: Sakari Ailus <sakari.ailus@linux.intel.com>
L: linux-media@vger.kernel.org
--
2.9.2
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [V2, 2/2] media: i2c: Add DW9768 VCM driver
2019-09-05 7:21 [V2, 0/2] media: i2c: add support for DW9768 VCM driver dongchun.zhu
2019-09-05 7:21 ` [V2, 1/2] media: i2c: dw9768: Add DT support and MAINTAINERS entry dongchun.zhu
@ 2019-09-05 7:21 ` dongchun.zhu
2019-09-05 8:21 ` Sakari Ailus
` (4 more replies)
1 sibling, 5 replies; 20+ messages in thread
From: dongchun.zhu @ 2019-09-05 7:21 UTC (permalink / raw)
To: mchehab, andriy.shevchenko, robh+dt, mark.rutland, sakari.ailus,
drinkcat, tfiga, matthias.bgg, bingbu.cao
Cc: devicetree, srv_heupstream, shengnan.wang, sj.huang,
linux-mediatek, dongchun.zhu, sam.hung, linux-arm-kernel,
linux-media
From: Dongchun Zhu <dongchun.zhu@mediatek.com>
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.
Signed-off-by: Dongchun Zhu <dongchun.zhu@mediatek.com>
---
MAINTAINERS | 1 +
drivers/media/i2c/Kconfig | 10 ++
drivers/media/i2c/Makefile | 1 +
drivers/media/i2c/dw9768.c | 349 +++++++++++++++++++++++++++++++++++++++++++++
4 files changed, 361 insertions(+)
create mode 100644 drivers/media/i2c/dw9768.c
diff --git a/MAINTAINERS b/MAINTAINERS
index 192a671..c5c9a0e 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -4976,6 +4976,7 @@ M: Dongchun Zhu <dongchun.zhu@mediatek.com>
L: linux-media@vger.kernel.org
T: git git://linuxtv.org/media_tree.git
S: Maintained
+F: drivers/media/i2c/dw9768.c
F: Documentation/devicetree/bindings/media/i2c/dongwoon,dw9768.txt
DONGWOON DW9807 LENS VOICE COIL DRIVER
diff --git a/drivers/media/i2c/Kconfig b/drivers/media/i2c/Kconfig
index 79ce9ec..dfb665c 100644
--- a/drivers/media/i2c/Kconfig
+++ b/drivers/media/i2c/Kconfig
@@ -1016,6 +1016,16 @@ 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
+ help
+ This is a driver for the DW9768 camera lens voice coil.
+ DW9768 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.
+
config VIDEO_DW9807_VCM
tristate "DW9807 lens voice coil support"
depends on I2C && VIDEO_V4L2 && MEDIA_CONTROLLER
diff --git a/drivers/media/i2c/Makefile b/drivers/media/i2c/Makefile
index fd4ea86..2561239 100644
--- a/drivers/media/i2c/Makefile
+++ b/drivers/media/i2c/Makefile
@@ -24,6 +24,7 @@ obj-$(CONFIG_VIDEO_SAA6752HS) += saa6752hs.o
obj-$(CONFIG_VIDEO_AD5820) += ad5820.o
obj-$(CONFIG_VIDEO_AK7375) += ak7375.o
obj-$(CONFIG_VIDEO_DW9714) += dw9714.o
+obj-$(CONFIG_VIDEO_DW9768) += dw9768.o
obj-$(CONFIG_VIDEO_DW9807_VCM) += dw9807-vcm.o
obj-$(CONFIG_VIDEO_ADV7170) += adv7170.o
obj-$(CONFIG_VIDEO_ADV7175) += adv7175.o
diff --git a/drivers/media/i2c/dw9768.c b/drivers/media/i2c/dw9768.c
new file mode 100644
index 0000000..66d1712
--- /dev/null
+++ b/drivers/media/i2c/dw9768.c
@@ -0,0 +1,349 @@
+// SPDX-License-Identifier: GPL-2.0
+// Copyright (c) 2019 MediaTek Inc.
+
+#include <linux/delay.h>
+#include <linux/i2c.h>
+#include <linux/module.h>
+#include <linux/regulator/consumer.h>
+#include <linux/pm_runtime.h>
+#include <media/v4l2-ctrls.h>
+#include <media/v4l2-device.h>
+#include <media/v4l2-subdev.h>
+
+#define DW9768_NAME "dw9768"
+#define DW9768_MAX_FOCUS_POS 1023
+/*
+ * This sets the minimum granularity for the focus positions.
+ * A value of 1 gives maximum accuracy for a desired focus position
+ */
+#define DW9768_FOCUS_STEPS 1
+/*
+ * DW9768 separates two registers to control the VCM position.
+ * One for MSB value, another is LSB value.
+ */
+#define DW9768_REG_MASK_MSB 0x03
+#define DW9768_REG_MASK_LSB 0xff
+#define DW9768_SET_POSITION_ADDR 0x03
+
+#define DW9768_CMD_DELAY 0xff
+#define DW9768_CTRL_DELAY_US 5000
+
+#define DW9768_DAC_SHIFT 8
+
+/* dw9768 device structure */
+struct dw9768 {
+ struct v4l2_ctrl_handler ctrls;
+ struct v4l2_subdev sd;
+ struct regulator *vin;
+ struct regulator *vdd;
+};
+
+static inline struct dw9768 *to_dw9768_vcm(struct v4l2_ctrl *ctrl)
+{
+ return container_of(ctrl->handler, struct dw9768, ctrls);
+}
+
+static inline struct dw9768 *sd_to_dw9768_vcm(struct v4l2_subdev *subdev)
+{
+ return container_of(subdev, struct dw9768, sd);
+}
+
+struct regval_list {
+ unsigned char reg_num;
+ unsigned char value;
+};
+
+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;
+
+ if (reg == DW9768_CMD_DELAY && value == DW9768_CMD_DELAY)
+ usleep_range(DW9768_CTRL_DELAY_US,
+ DW9768_CTRL_DELAY_US + 100);
+ else
+ ret = i2c_smbus_write_byte_data(client, reg, value);
+ return ret;
+}
+
+static int dw9768_write_array(struct dw9768 *dw9768, struct regval_list *vals,
+ u32 len)
+{
+ unsigned int i;
+ int ret;
+
+ for (i = 0; i < len; i++) {
+ ret = dw9768_write_smbus(dw9768, vals->reg_num, vals->value);
+ if (ret < 0)
+ return ret;
+ }
+ return 0;
+}
+
+static int dw9768_set_position(struct dw9768 *dw9768, u16 val)
+{
+ struct i2c_client *client = v4l2_get_subdevdata(&dw9768->sd);
+ u8 addr[2];
+
+ addr[0] = (val >> DW9768_DAC_SHIFT) & DW9768_REG_MASK_MSB;
+ addr[1] = val & DW9768_REG_MASK_LSB;
+
+ return i2c_smbus_write_block_data(client, DW9768_SET_POSITION_ADDR,
+ ARRAY_SIZE(addr), addr);
+}
+
+static int dw9768_release(struct dw9768 *dw9768)
+{
+ return dw9768_write_array(dw9768, dw9768_release_regs,
+ ARRAY_SIZE(dw9768_release_regs));
+}
+
+static int dw9768_init(struct dw9768 *dw9768)
+{
+ return dw9768_write_array(dw9768, dw9768_init_regs,
+ ARRAY_SIZE(dw9768_init_regs));
+}
+
+/* Power handling */
+static int dw9768_power_off(struct dw9768 *dw9768)
+{
+ struct i2c_client *client = v4l2_get_subdevdata(&dw9768->sd);
+ int ret;
+
+ ret = dw9768_release(dw9768);
+ if (ret)
+ dev_err(&client->dev, "dw9768 release failed!\n");
+
+ ret = regulator_disable(dw9768->vin);
+ if (ret)
+ return ret;
+
+ return regulator_disable(dw9768->vdd);
+}
+
+static int dw9768_power_on(struct dw9768 *dw9768)
+{
+ int ret;
+
+ ret = regulator_enable(dw9768->vin);
+ if (ret < 0)
+ return ret;
+
+ ret = regulator_enable(dw9768->vdd);
+ if (ret < 0)
+ return ret;
+
+ ret = dw9768_init(dw9768);
+ if (ret < 0)
+ goto fail;
+
+ return 0;
+
+fail:
+ regulator_disable(dw9768->vin);
+ regulator_disable(dw9768->vdd);
+
+ return ret;
+}
+
+static int dw9768_set_ctrl(struct v4l2_ctrl *ctrl)
+{
+ struct dw9768 *dw9768 = to_dw9768_vcm(ctrl);
+
+ if (ctrl->id == V4L2_CID_FOCUS_ABSOLUTE)
+ return dw9768_set_position(dw9768, ctrl->val);
+
+ return 0;
+}
+
+static const struct v4l2_ctrl_ops dw9768_vcm_ctrl_ops = {
+ .s_ctrl = dw9768_set_ctrl,
+};
+
+static int dw9768_open(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh)
+{
+ int ret;
+
+ ret = pm_runtime_get_sync(sd->dev);
+ if (ret < 0) {
+ pm_runtime_put_noidle(sd->dev);
+ return ret;
+ }
+
+ return 0;
+}
+
+static int dw9768_close(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh)
+{
+ pm_runtime_put(sd->dev);
+
+ return 0;
+}
+
+static const struct v4l2_subdev_internal_ops dw9768_int_ops = {
+ .open = dw9768_open,
+ .close = dw9768_close,
+};
+
+static const struct v4l2_subdev_ops dw9768_ops = { };
+
+static void dw9768_subdev_cleanup(struct dw9768 *dw9768)
+{
+ v4l2_async_unregister_subdev(&dw9768->sd);
+ v4l2_ctrl_handler_free(&dw9768->ctrls);
+ media_entity_cleanup(&dw9768->sd.entity);
+}
+
+static int dw9768_init_controls(struct dw9768 *dw9768)
+{
+ struct v4l2_ctrl_handler *hdl = &dw9768->ctrls;
+ const struct v4l2_ctrl_ops *ops = &dw9768_vcm_ctrl_ops;
+
+ v4l2_ctrl_handler_init(hdl, 1);
+
+ v4l2_ctrl_new_std(hdl, ops, V4L2_CID_FOCUS_ABSOLUTE,
+ 0, DW9768_MAX_FOCUS_POS, DW9768_FOCUS_STEPS, 0);
+
+ if (hdl->error)
+ return hdl->error;
+
+ dw9768->sd.ctrl_handler = hdl;
+
+ return 0;
+}
+
+static int dw9768_probe(struct i2c_client *client)
+{
+ struct device *dev = &client->dev;
+ struct dw9768 *dw9768;
+ int ret;
+
+ dw9768 = devm_kzalloc(dev, sizeof(*dw9768), GFP_KERNEL);
+ if (!dw9768)
+ return -ENOMEM;
+
+ dw9768->vin = devm_regulator_get(dev, "vin");
+ if (IS_ERR(dw9768->vin)) {
+ ret = PTR_ERR(dw9768->vin);
+ if (ret != -EPROBE_DEFER)
+ dev_err(dev, "cannot get vin regulator\n");
+ return ret;
+ }
+
+ dw9768->vdd = devm_regulator_get(dev, "vdd");
+ if (IS_ERR(dw9768->vdd)) {
+ ret = PTR_ERR(dw9768->vdd);
+ if (ret != -EPROBE_DEFER)
+ dev_err(dev, "cannot get vdd regulator\n");
+ return ret;
+ }
+
+ v4l2_i2c_subdev_init(&dw9768->sd, client, &dw9768_ops);
+ dw9768->sd.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
+ dw9768->sd.internal_ops = &dw9768_int_ops;
+
+ ret = dw9768_init_controls(dw9768);
+ if (ret)
+ goto err_cleanup;
+
+ ret = media_entity_pads_init(&dw9768->sd.entity, 0, NULL);
+ if (ret < 0)
+ goto err_cleanup;
+
+ dw9768->sd.entity.function = MEDIA_ENT_F_LENS;
+
+ ret = v4l2_async_register_subdev(&dw9768->sd);
+ if (ret < 0)
+ goto err_cleanup;
+
+ pm_runtime_enable(dev);
+
+ return 0;
+
+err_cleanup:
+ dw9768_subdev_cleanup(dw9768);
+ return ret;
+}
+
+static int dw9768_remove(struct i2c_client *client)
+{
+ struct v4l2_subdev *sd = i2c_get_clientdata(client);
+ struct dw9768 *dw9768 = sd_to_dw9768_vcm(sd);
+
+ dw9768_subdev_cleanup(dw9768);
+ pm_runtime_disable(&client->dev);
+ if (!pm_runtime_status_suspended(&client->dev))
+ dw9768_power_off(dw9768);
+ pm_runtime_set_suspended(&client->dev);
+
+ return 0;
+}
+
+static int __maybe_unused dw9768_vcm_suspend(struct device *dev)
+{
+ struct i2c_client *client = to_i2c_client(dev);
+ struct v4l2_subdev *sd = i2c_get_clientdata(client);
+ struct dw9768 *dw9768 = sd_to_dw9768_vcm(sd);
+
+ return dw9768_power_off(dw9768);
+}
+
+static int __maybe_unused dw9768_vcm_resume(struct device *dev)
+{
+ struct i2c_client *client = to_i2c_client(dev);
+ struct v4l2_subdev *sd = i2c_get_clientdata(client);
+ struct dw9768 *dw9768 = sd_to_dw9768_vcm(sd);
+
+ return dw9768_power_on(dw9768);
+}
+
+static const struct i2c_device_id dw9768_id_table[] = {
+ { DW9768_NAME, 0 },
+ { },
+};
+MODULE_DEVICE_TABLE(i2c, dw9768_id_table);
+
+static const struct of_device_id dw9768_of_table[] = {
+ { .compatible = "dongwoon,dw9768" },
+ { },
+};
+MODULE_DEVICE_TABLE(of, dw9768_of_table);
+
+static const struct dev_pm_ops dw9768_pm_ops = {
+ SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend,
+ pm_runtime_force_resume)
+ SET_RUNTIME_PM_OPS(dw9768_vcm_suspend, dw9768_vcm_resume, NULL)
+};
+
+static struct i2c_driver dw9768_i2c_driver = {
+ .driver = {
+ .name = DW9768_NAME,
+ .pm = &dw9768_pm_ops,
+ .of_match_table = dw9768_of_table,
+ },
+ .probe_new = dw9768_probe,
+ .remove = dw9768_remove,
+ .id_table = dw9768_id_table,
+};
+
+module_i2c_driver(dw9768_i2c_driver);
+
+MODULE_AUTHOR("Dongchun Zhu <dongchun.zhu@mediatek.com>");
+MODULE_DESCRIPTION("DW9768 VCM driver");
+MODULE_LICENSE("GPL v2");
--
2.9.2
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 20+ messages in thread
* Re: [V2, 2/2] media: i2c: Add DW9768 VCM driver
2019-09-05 7:21 ` [V2, 2/2] media: i2c: Add DW9768 VCM driver dongchun.zhu
@ 2019-09-05 8:21 ` Sakari Ailus
2019-09-05 10:19 ` Andy Shevchenko
2019-09-05 8:28 ` Tomasz Figa
` (3 subsequent siblings)
4 siblings, 1 reply; 20+ messages in thread
From: Sakari Ailus @ 2019-09-05 8:21 UTC (permalink / raw)
To: dongchun.zhu
Cc: mark.rutland, drinkcat, andriy.shevchenko, srv_heupstream,
devicetree, sam.hung, shengnan.wang, tfiga, sj.huang, robh+dt,
linux-mediatek, matthias.bgg, bingbu.cao, mchehab,
linux-arm-kernel, linux-media
Hi Dongchun,
Thanks for the update. A few comments below.
On Thu, Sep 05, 2019 at 03:21:42PM +0800, dongchun.zhu@mediatek.com wrote:
> From: Dongchun Zhu <dongchun.zhu@mediatek.com>
>
> 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.
>
> Signed-off-by: Dongchun Zhu <dongchun.zhu@mediatek.com>
> ---
> MAINTAINERS | 1 +
> drivers/media/i2c/Kconfig | 10 ++
> drivers/media/i2c/Makefile | 1 +
> drivers/media/i2c/dw9768.c | 349 +++++++++++++++++++++++++++++++++++++++++++++
> 4 files changed, 361 insertions(+)
> create mode 100644 drivers/media/i2c/dw9768.c
>
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 192a671..c5c9a0e 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -4976,6 +4976,7 @@ M: Dongchun Zhu <dongchun.zhu@mediatek.com>
> L: linux-media@vger.kernel.org
> T: git git://linuxtv.org/media_tree.git
> S: Maintained
> +F: drivers/media/i2c/dw9768.c
> F: Documentation/devicetree/bindings/media/i2c/dongwoon,dw9768.txt
>
> DONGWOON DW9807 LENS VOICE COIL DRIVER
> diff --git a/drivers/media/i2c/Kconfig b/drivers/media/i2c/Kconfig
> index 79ce9ec..dfb665c 100644
> --- a/drivers/media/i2c/Kconfig
> +++ b/drivers/media/i2c/Kconfig
> @@ -1016,6 +1016,16 @@ 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
> + help
> + This is a driver for the DW9768 camera lens voice coil.
> + DW9768 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.
> +
> config VIDEO_DW9807_VCM
> tristate "DW9807 lens voice coil support"
> depends on I2C && VIDEO_V4L2 && MEDIA_CONTROLLER
> diff --git a/drivers/media/i2c/Makefile b/drivers/media/i2c/Makefile
> index fd4ea86..2561239 100644
> --- a/drivers/media/i2c/Makefile
> +++ b/drivers/media/i2c/Makefile
> @@ -24,6 +24,7 @@ obj-$(CONFIG_VIDEO_SAA6752HS) += saa6752hs.o
> obj-$(CONFIG_VIDEO_AD5820) += ad5820.o
> obj-$(CONFIG_VIDEO_AK7375) += ak7375.o
> obj-$(CONFIG_VIDEO_DW9714) += dw9714.o
> +obj-$(CONFIG_VIDEO_DW9768) += dw9768.o
> obj-$(CONFIG_VIDEO_DW9807_VCM) += dw9807-vcm.o
> obj-$(CONFIG_VIDEO_ADV7170) += adv7170.o
> obj-$(CONFIG_VIDEO_ADV7175) += adv7175.o
> diff --git a/drivers/media/i2c/dw9768.c b/drivers/media/i2c/dw9768.c
> new file mode 100644
> index 0000000..66d1712
> --- /dev/null
> +++ b/drivers/media/i2c/dw9768.c
> @@ -0,0 +1,349 @@
> +// SPDX-License-Identifier: GPL-2.0
> +// Copyright (c) 2019 MediaTek Inc.
> +
> +#include <linux/delay.h>
> +#include <linux/i2c.h>
> +#include <linux/module.h>
> +#include <linux/regulator/consumer.h>
> +#include <linux/pm_runtime.h>
> +#include <media/v4l2-ctrls.h>
> +#include <media/v4l2-device.h>
> +#include <media/v4l2-subdev.h>
> +
> +#define DW9768_NAME "dw9768"
> +#define DW9768_MAX_FOCUS_POS 1023
> +/*
> + * This sets the minimum granularity for the focus positions.
> + * A value of 1 gives maximum accuracy for a desired focus position
> + */
> +#define DW9768_FOCUS_STEPS 1
> +/*
> + * DW9768 separates two registers to control the VCM position.
> + * One for MSB value, another is LSB value.
> + */
> +#define DW9768_REG_MASK_MSB 0x03
> +#define DW9768_REG_MASK_LSB 0xff
> +#define DW9768_SET_POSITION_ADDR 0x03
> +
> +#define DW9768_CMD_DELAY 0xff
> +#define DW9768_CTRL_DELAY_US 5000
> +
> +#define DW9768_DAC_SHIFT 8
> +
> +/* dw9768 device structure */
> +struct dw9768 {
> + struct v4l2_ctrl_handler ctrls;
> + struct v4l2_subdev sd;
> + struct regulator *vin;
> + struct regulator *vdd;
> +};
> +
> +static inline struct dw9768 *to_dw9768_vcm(struct v4l2_ctrl *ctrl)
> +{
> + return container_of(ctrl->handler, struct dw9768, ctrls);
> +}
> +
> +static inline struct dw9768 *sd_to_dw9768_vcm(struct v4l2_subdev *subdev)
> +{
> + return container_of(subdev, struct dw9768, sd);
> +}
> +
> +struct regval_list {
> + unsigned char reg_num;
> + unsigned char value;
> +};
> +
> +static struct regval_list dw9768_init_regs[] = {
> + {0x02, 0x02},
> + {DW9768_CMD_DELAY, DW9768_CMD_DELAY},
> + {0x06, 0x41},
> + {0x07, 0x39},
These need to be documented. Please add #defines for the register addresses
and bits in the registers as needed.
The writes would better be done as function calls; the same applies to the
delays.
> + {DW9768_CMD_DELAY, DW9768_CMD_DELAY},
> +};
> +
> +static struct regval_list dw9768_release_regs[] = {
> + {0x02, 0x00},
> + {DW9768_CMD_DELAY, DW9768_CMD_DELAY},
> + {0x01, 0x00},
Same here.
> + {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;
> +
> + if (reg == DW9768_CMD_DELAY && value == DW9768_CMD_DELAY)
> + usleep_range(DW9768_CTRL_DELAY_US,
> + DW9768_CTRL_DELAY_US + 100);
> + else
> + ret = i2c_smbus_write_byte_data(client, reg, value);
> + return ret;
> +}
> +
> +static int dw9768_write_array(struct dw9768 *dw9768, struct regval_list *vals,
> + u32 len)
> +{
> + unsigned int i;
> + int ret;
> +
> + for (i = 0; i < len; i++) {
> + ret = dw9768_write_smbus(dw9768, vals->reg_num, vals->value);
> + if (ret < 0)
> + return ret;
> + }
> + return 0;
> +}
> +
> +static int dw9768_set_position(struct dw9768 *dw9768, u16 val)
> +{
> + struct i2c_client *client = v4l2_get_subdevdata(&dw9768->sd);
> + u8 addr[2];
> +
> + addr[0] = (val >> DW9768_DAC_SHIFT) & DW9768_REG_MASK_MSB;
> + addr[1] = val & DW9768_REG_MASK_LSB;
> +
> + return i2c_smbus_write_block_data(client, DW9768_SET_POSITION_ADDR,
> + ARRAY_SIZE(addr), addr);
> +}
> +
> +static int dw9768_release(struct dw9768 *dw9768)
> +{
> + return dw9768_write_array(dw9768, dw9768_release_regs,
> + ARRAY_SIZE(dw9768_release_regs));
> +}
> +
> +static int dw9768_init(struct dw9768 *dw9768)
> +{
> + return dw9768_write_array(dw9768, dw9768_init_regs,
> + ARRAY_SIZE(dw9768_init_regs));
> +}
> +
> +/* Power handling */
> +static int dw9768_power_off(struct dw9768 *dw9768)
> +{
> + struct i2c_client *client = v4l2_get_subdevdata(&dw9768->sd);
> + int ret;
> +
> + ret = dw9768_release(dw9768);
> + if (ret)
> + dev_err(&client->dev, "dw9768 release failed!\n");
> +
> + ret = regulator_disable(dw9768->vin);
> + if (ret)
> + return ret;
You'll need to disable the other regulator unconditionally here.
> +
> + return regulator_disable(dw9768->vdd);
> +}
> +
> +static int dw9768_power_on(struct dw9768 *dw9768)
> +{
> + int ret;
> +
> + ret = regulator_enable(dw9768->vin);
> + if (ret < 0)
> + return ret;
> +
> + ret = regulator_enable(dw9768->vdd);
> + if (ret < 0)
You'll need another label to disable only vin.
> + return ret;
> +
> + ret = dw9768_init(dw9768);
> + if (ret < 0)
> + goto fail;
> +
> + return 0;
> +
> +fail:
> + regulator_disable(dw9768->vin);
> + regulator_disable(dw9768->vdd);
> +
> + return ret;
> +}
> +
> +static int dw9768_set_ctrl(struct v4l2_ctrl *ctrl)
> +{
> + struct dw9768 *dw9768 = to_dw9768_vcm(ctrl);
> +
> + if (ctrl->id == V4L2_CID_FOCUS_ABSOLUTE)
> + return dw9768_set_position(dw9768, ctrl->val);
> +
> + return 0;
> +}
> +
> +static const struct v4l2_ctrl_ops dw9768_vcm_ctrl_ops = {
> + .s_ctrl = dw9768_set_ctrl,
> +};
> +
> +static int dw9768_open(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh)
> +{
> + int ret;
> +
> + ret = pm_runtime_get_sync(sd->dev);
> + if (ret < 0) {
> + pm_runtime_put_noidle(sd->dev);
> + return ret;
> + }
> +
> + return 0;
> +}
> +
> +static int dw9768_close(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh)
> +{
> + pm_runtime_put(sd->dev);
> +
> + return 0;
> +}
> +
> +static const struct v4l2_subdev_internal_ops dw9768_int_ops = {
> + .open = dw9768_open,
> + .close = dw9768_close,
> +};
> +
> +static const struct v4l2_subdev_ops dw9768_ops = { };
> +
> +static void dw9768_subdev_cleanup(struct dw9768 *dw9768)
> +{
> + v4l2_async_unregister_subdev(&dw9768->sd);
> + v4l2_ctrl_handler_free(&dw9768->ctrls);
> + media_entity_cleanup(&dw9768->sd.entity);
> +}
> +
> +static int dw9768_init_controls(struct dw9768 *dw9768)
> +{
> + struct v4l2_ctrl_handler *hdl = &dw9768->ctrls;
> + const struct v4l2_ctrl_ops *ops = &dw9768_vcm_ctrl_ops;
> +
> + v4l2_ctrl_handler_init(hdl, 1);
> +
> + v4l2_ctrl_new_std(hdl, ops, V4L2_CID_FOCUS_ABSOLUTE,
> + 0, DW9768_MAX_FOCUS_POS, DW9768_FOCUS_STEPS, 0);
> +
> + if (hdl->error)
> + return hdl->error;
> +
> + dw9768->sd.ctrl_handler = hdl;
> +
> + return 0;
> +}
> +
> +static int dw9768_probe(struct i2c_client *client)
> +{
> + struct device *dev = &client->dev;
> + struct dw9768 *dw9768;
> + int ret;
> +
> + dw9768 = devm_kzalloc(dev, sizeof(*dw9768), GFP_KERNEL);
> + if (!dw9768)
> + return -ENOMEM;
> +
> + dw9768->vin = devm_regulator_get(dev, "vin");
> + if (IS_ERR(dw9768->vin)) {
> + ret = PTR_ERR(dw9768->vin);
> + if (ret != -EPROBE_DEFER)
> + dev_err(dev, "cannot get vin regulator\n");
> + return ret;
> + }
> +
> + dw9768->vdd = devm_regulator_get(dev, "vdd");
> + if (IS_ERR(dw9768->vdd)) {
> + ret = PTR_ERR(dw9768->vdd);
> + if (ret != -EPROBE_DEFER)
> + dev_err(dev, "cannot get vdd regulator\n");
> + return ret;
> + }
> +
> + v4l2_i2c_subdev_init(&dw9768->sd, client, &dw9768_ops);
> + dw9768->sd.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
> + dw9768->sd.internal_ops = &dw9768_int_ops;
> +
> + ret = dw9768_init_controls(dw9768);
> + if (ret)
> + goto err_cleanup;
> +
> + ret = media_entity_pads_init(&dw9768->sd.entity, 0, NULL);
> + if (ret < 0)
> + goto err_cleanup;
> +
> + dw9768->sd.entity.function = MEDIA_ENT_F_LENS;
> +
> + ret = v4l2_async_register_subdev(&dw9768->sd);
> + if (ret < 0)
> + goto err_cleanup;
> +
> + pm_runtime_enable(dev);
> +
> + return 0;
> +
> +err_cleanup:
> + dw9768_subdev_cleanup(dw9768);
> + return ret;
> +}
> +
> +static int dw9768_remove(struct i2c_client *client)
> +{
> + struct v4l2_subdev *sd = i2c_get_clientdata(client);
> + struct dw9768 *dw9768 = sd_to_dw9768_vcm(sd);
> +
> + dw9768_subdev_cleanup(dw9768);
> + pm_runtime_disable(&client->dev);
> + if (!pm_runtime_status_suspended(&client->dev))
> + dw9768_power_off(dw9768);
> + pm_runtime_set_suspended(&client->dev);
> +
> + return 0;
> +}
> +
> +static int __maybe_unused dw9768_vcm_suspend(struct device *dev)
> +{
> + struct i2c_client *client = to_i2c_client(dev);
> + struct v4l2_subdev *sd = i2c_get_clientdata(client);
> + struct dw9768 *dw9768 = sd_to_dw9768_vcm(sd);
> +
> + return dw9768_power_off(dw9768);
Please merge this function with dw9768_power_off(); same for
dw9768_vcm_resume() below.
> +}
> +
> +static int __maybe_unused dw9768_vcm_resume(struct device *dev)
> +{
> + struct i2c_client *client = to_i2c_client(dev);
> + struct v4l2_subdev *sd = i2c_get_clientdata(client);
> + struct dw9768 *dw9768 = sd_to_dw9768_vcm(sd);
> +
> + return dw9768_power_on(dw9768);
> +}
> +
> +static const struct i2c_device_id dw9768_id_table[] = {
> + { DW9768_NAME, 0 },
> + { },
Could you drop the I²C ID table?
> +};
> +MODULE_DEVICE_TABLE(i2c, dw9768_id_table);
> +
> +static const struct of_device_id dw9768_of_table[] = {
> + { .compatible = "dongwoon,dw9768" },
> + { },
> +};
> +MODULE_DEVICE_TABLE(of, dw9768_of_table);
> +
> +static const struct dev_pm_ops dw9768_pm_ops = {
> + SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend,
> + pm_runtime_force_resume)
> + SET_RUNTIME_PM_OPS(dw9768_vcm_suspend, dw9768_vcm_resume, NULL)
> +};
> +
> +static struct i2c_driver dw9768_i2c_driver = {
> + .driver = {
> + .name = DW9768_NAME,
> + .pm = &dw9768_pm_ops,
> + .of_match_table = dw9768_of_table,
> + },
> + .probe_new = dw9768_probe,
> + .remove = dw9768_remove,
> + .id_table = dw9768_id_table,
> +};
> +
> +module_i2c_driver(dw9768_i2c_driver);
> +
> +MODULE_AUTHOR("Dongchun Zhu <dongchun.zhu@mediatek.com>");
> +MODULE_DESCRIPTION("DW9768 VCM driver");
> +MODULE_LICENSE("GPL v2");
--
Kind regards,
Sakari Ailus
sakari.ailus@linux.intel.com
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [V2, 2/2] media: i2c: Add DW9768 VCM driver
2019-09-05 7:21 ` [V2, 2/2] media: i2c: Add DW9768 VCM driver dongchun.zhu
2019-09-05 8:21 ` Sakari Ailus
@ 2019-09-05 8:28 ` Tomasz Figa
2019-09-05 10:26 ` Andy Shevchenko
` (2 subsequent siblings)
4 siblings, 0 replies; 20+ messages in thread
From: Tomasz Figa @ 2019-09-05 8:28 UTC (permalink / raw)
To: Dongchun Zhu
Cc: Mark Rutland, Nicolas Boichat, andriy.shevchenko, srv_heupstream,
devicetree, sam.hung, shengnan.wang, Sj Huang, Rob Herring,
moderated list:ARM/Mediatek SoC support, Sakari Ailus,
Matthias Brugger, Cao Bing Bu, Mauro Carvalho Chehab,
list@263.net:IOMMU DRIVERS
<iommu@lists.linux-foundation.org>,
Joerg Roedel <joro@8bytes.org>, ,
Linux Media Mailing List
Hi Dongchun,
On Thu, Sep 5, 2019 at 4:22 PM <dongchun.zhu@mediatek.com> wrote:
>
> From: Dongchun Zhu <dongchun.zhu@mediatek.com>
>
> 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.
>
> Signed-off-by: Dongchun Zhu <dongchun.zhu@mediatek.com>
> ---
> MAINTAINERS | 1 +
> drivers/media/i2c/Kconfig | 10 ++
> drivers/media/i2c/Makefile | 1 +
> drivers/media/i2c/dw9768.c | 349 +++++++++++++++++++++++++++++++++++++++++++++
> 4 files changed, 361 insertions(+)
> create mode 100644 drivers/media/i2c/dw9768.c
>
Thanks for v2! Please see my comments inline.
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 192a671..c5c9a0e 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -4976,6 +4976,7 @@ M: Dongchun Zhu <dongchun.zhu@mediatek.com>
> L: linux-media@vger.kernel.org
> T: git git://linuxtv.org/media_tree.git
> S: Maintained
> +F: drivers/media/i2c/dw9768.c
> F: Documentation/devicetree/bindings/media/i2c/dongwoon,dw9768.txt
>
> DONGWOON DW9807 LENS VOICE COIL DRIVER
> diff --git a/drivers/media/i2c/Kconfig b/drivers/media/i2c/Kconfig
> index 79ce9ec..dfb665c 100644
> --- a/drivers/media/i2c/Kconfig
> +++ b/drivers/media/i2c/Kconfig
> @@ -1016,6 +1016,16 @@ 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
> + help
> + This is a driver for the DW9768 camera lens voice coil.
> + DW9768 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.
> +
> config VIDEO_DW9807_VCM
> tristate "DW9807 lens voice coil support"
> depends on I2C && VIDEO_V4L2 && MEDIA_CONTROLLER
> diff --git a/drivers/media/i2c/Makefile b/drivers/media/i2c/Makefile
> index fd4ea86..2561239 100644
> --- a/drivers/media/i2c/Makefile
> +++ b/drivers/media/i2c/Makefile
> @@ -24,6 +24,7 @@ obj-$(CONFIG_VIDEO_SAA6752HS) += saa6752hs.o
> obj-$(CONFIG_VIDEO_AD5820) += ad5820.o
> obj-$(CONFIG_VIDEO_AK7375) += ak7375.o
> obj-$(CONFIG_VIDEO_DW9714) += dw9714.o
> +obj-$(CONFIG_VIDEO_DW9768) += dw9768.o
> obj-$(CONFIG_VIDEO_DW9807_VCM) += dw9807-vcm.o
> obj-$(CONFIG_VIDEO_ADV7170) += adv7170.o
> obj-$(CONFIG_VIDEO_ADV7175) += adv7175.o
> diff --git a/drivers/media/i2c/dw9768.c b/drivers/media/i2c/dw9768.c
> new file mode 100644
> index 0000000..66d1712
> --- /dev/null
> +++ b/drivers/media/i2c/dw9768.c
> @@ -0,0 +1,349 @@
> +// SPDX-License-Identifier: GPL-2.0
> +// Copyright (c) 2019 MediaTek Inc.
> +
> +#include <linux/delay.h>
> +#include <linux/i2c.h>
> +#include <linux/module.h>
> +#include <linux/regulator/consumer.h>
> +#include <linux/pm_runtime.h>
> +#include <media/v4l2-ctrls.h>
> +#include <media/v4l2-device.h>
> +#include <media/v4l2-subdev.h>
> +
> +#define DW9768_NAME "dw9768"
> +#define DW9768_MAX_FOCUS_POS 1023
> +/*
> + * This sets the minimum granularity for the focus positions.
> + * A value of 1 gives maximum accuracy for a desired focus position
> + */
> +#define DW9768_FOCUS_STEPS 1
> +/*
> + * DW9768 separates two registers to control the VCM position.
> + * One for MSB value, another is LSB value.
> + */
> +#define DW9768_REG_MASK_MSB 0x03
> +#define DW9768_REG_MASK_LSB 0xff
> +#define DW9768_SET_POSITION_ADDR 0x03
> +
> +#define DW9768_CMD_DELAY 0xff
> +#define DW9768_CTRL_DELAY_US 5000
> +
> +#define DW9768_DAC_SHIFT 8
> +
> +/* dw9768 device structure */
> +struct dw9768 {
> + struct v4l2_ctrl_handler ctrls;
> + struct v4l2_subdev sd;
> + struct regulator *vin;
> + struct regulator *vdd;
> +};
> +
> +static inline struct dw9768 *to_dw9768_vcm(struct v4l2_ctrl *ctrl)
> +{
> + return container_of(ctrl->handler, struct dw9768, ctrls);
> +}
> +
> +static inline struct dw9768 *sd_to_dw9768_vcm(struct v4l2_subdev *subdev)
> +{
> + return container_of(subdev, struct dw9768, sd);
> +}
> +
> +struct regval_list {
> + unsigned char reg_num;
> + unsigned char value;
> +};
> +
> +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;
> +
> + if (reg == DW9768_CMD_DELAY && value == DW9768_CMD_DELAY)
Do we really need both to be set to this command?
> + usleep_range(DW9768_CTRL_DELAY_US,
> + DW9768_CTRL_DELAY_US + 100);
> + else
> + ret = i2c_smbus_write_byte_data(client, reg, value);
> + return ret;
> +}
Is there any reason to have this as a separate function and not just
implemented inside the function below?
> +
> +static int dw9768_write_array(struct dw9768 *dw9768, struct regval_list *vals,
> + u32 len)
> +{
> + unsigned int i;
> + int ret;
> +
> + for (i = 0; i < len; i++) {
> + ret = dw9768_write_smbus(dw9768, vals->reg_num, vals->value);
> + if (ret < 0)
> + return ret;
> + }
> + return 0;
> +}
> +
> +static int dw9768_set_position(struct dw9768 *dw9768, u16 val)
> +{
> + struct i2c_client *client = v4l2_get_subdevdata(&dw9768->sd);
> + u8 addr[2];
> +
> + addr[0] = (val >> DW9768_DAC_SHIFT) & DW9768_REG_MASK_MSB;
> + addr[1] = val & DW9768_REG_MASK_LSB;
> +
> + return i2c_smbus_write_block_data(client, DW9768_SET_POSITION_ADDR,
> + ARRAY_SIZE(addr), addr);
> +}
> +
> +static int dw9768_release(struct dw9768 *dw9768)
> +{
> + return dw9768_write_array(dw9768, dw9768_release_regs,
> + ARRAY_SIZE(dw9768_release_regs));
> +}
> +
> +static int dw9768_init(struct dw9768 *dw9768)
> +{
> + return dw9768_write_array(dw9768, dw9768_init_regs,
> + ARRAY_SIZE(dw9768_init_regs));
> +}
Given that the 2 functions above are just called from 1 place,
wouldn't it make sense to just call dw9768_write_array() directly from
there?
> +
> +/* Power handling */
> +static int dw9768_power_off(struct dw9768 *dw9768)
> +{
> + struct i2c_client *client = v4l2_get_subdevdata(&dw9768->sd);
> + int ret;
> +
> + ret = dw9768_release(dw9768);
> + if (ret)
> + dev_err(&client->dev, "dw9768 release failed!\n");
> +
> + ret = regulator_disable(dw9768->vin);
> + if (ret)
> + return ret;
> +
> + return regulator_disable(dw9768->vdd);
> +}
> +
> +static int dw9768_power_on(struct dw9768 *dw9768)
> +{
> + int ret;
> +
> + ret = regulator_enable(dw9768->vin);
> + if (ret < 0)
> + return ret;
> +
> + ret = regulator_enable(dw9768->vdd);
> + if (ret < 0)
> + return ret;
> +
> + ret = dw9768_init(dw9768);
> + if (ret < 0)
> + goto fail;
> +
> + return 0;
> +
> +fail:
> + regulator_disable(dw9768->vin);
> + regulator_disable(dw9768->vdd);
> +
> + return ret;
> +}
> +
> +static int dw9768_set_ctrl(struct v4l2_ctrl *ctrl)
> +{
> + struct dw9768 *dw9768 = to_dw9768_vcm(ctrl);
> +
> + if (ctrl->id == V4L2_CID_FOCUS_ABSOLUTE)
> + return dw9768_set_position(dw9768, ctrl->val);
> +
> + return 0;
> +}
> +
> +static const struct v4l2_ctrl_ops dw9768_vcm_ctrl_ops = {
> + .s_ctrl = dw9768_set_ctrl,
> +};
> +
> +static int dw9768_open(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh)
> +{
> + int ret;
> +
> + ret = pm_runtime_get_sync(sd->dev);
> + if (ret < 0) {
> + pm_runtime_put_noidle(sd->dev);
> + return ret;
> + }
> +
> + return 0;
> +}
> +
> +static int dw9768_close(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh)
> +{
> + pm_runtime_put(sd->dev);
> +
> + return 0;
> +}
> +
> +static const struct v4l2_subdev_internal_ops dw9768_int_ops = {
> + .open = dw9768_open,
> + .close = dw9768_close,
> +};
> +
> +static const struct v4l2_subdev_ops dw9768_ops = { };
> +
> +static void dw9768_subdev_cleanup(struct dw9768 *dw9768)
> +{
> + v4l2_async_unregister_subdev(&dw9768->sd);
> + v4l2_ctrl_handler_free(&dw9768->ctrls);
> + media_entity_cleanup(&dw9768->sd.entity);
> +}
> +
> +static int dw9768_init_controls(struct dw9768 *dw9768)
> +{
> + struct v4l2_ctrl_handler *hdl = &dw9768->ctrls;
> + const struct v4l2_ctrl_ops *ops = &dw9768_vcm_ctrl_ops;
> +
> + v4l2_ctrl_handler_init(hdl, 1);
> +
> + v4l2_ctrl_new_std(hdl, ops, V4L2_CID_FOCUS_ABSOLUTE,
> + 0, DW9768_MAX_FOCUS_POS, DW9768_FOCUS_STEPS, 0);
> +
> + if (hdl->error)
> + return hdl->error;
> +
> + dw9768->sd.ctrl_handler = hdl;
> +
> + return 0;
> +}
> +
> +static int dw9768_probe(struct i2c_client *client)
> +{
> + struct device *dev = &client->dev;
> + struct dw9768 *dw9768;
> + int ret;
> +
> + dw9768 = devm_kzalloc(dev, sizeof(*dw9768), GFP_KERNEL);
> + if (!dw9768)
> + return -ENOMEM;
> +
> + dw9768->vin = devm_regulator_get(dev, "vin");
> + if (IS_ERR(dw9768->vin)) {
> + ret = PTR_ERR(dw9768->vin);
> + if (ret != -EPROBE_DEFER)
> + dev_err(dev, "cannot get vin regulator\n");
> + return ret;
> + }
> +
> + dw9768->vdd = devm_regulator_get(dev, "vdd");
> + if (IS_ERR(dw9768->vdd)) {
> + ret = PTR_ERR(dw9768->vdd);
> + if (ret != -EPROBE_DEFER)
> + dev_err(dev, "cannot get vdd regulator\n");
> + return ret;
> + }
Any reason not to use the regulator bulk API, as already done in the
fixup patch I shared with you earlier [1]?
[1] https://chromium-review.googlesource.com/c/chromiumos/third_party/kernel/+/1757579
Best regards,
Tomasz
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [V2, 1/2] media: i2c: dw9768: Add DT support and MAINTAINERS entry
2019-09-05 7:21 ` [V2, 1/2] media: i2c: dw9768: Add DT support and MAINTAINERS entry dongchun.zhu
@ 2019-09-05 10:14 ` Andy Shevchenko
2019-09-05 10:48 ` Sakari Ailus
0 siblings, 1 reply; 20+ messages in thread
From: Andy Shevchenko @ 2019-09-05 10:14 UTC (permalink / raw)
To: dongchun.zhu
Cc: mark.rutland, devicetree, drinkcat, srv_heupstream, sam.hung,
shengnan.wang, tfiga, sj.huang, robh+dt, linux-mediatek,
sakari.ailus, matthias.bgg, bingbu.cao, mchehab,
linux-arm-kernel, linux-media
On Thu, Sep 05, 2019 at 03:21:41PM +0800, dongchun.zhu@mediatek.com wrote:
> From: Dongchun Zhu <dongchun.zhu@mediatek.com>
>
> This patch is to add the Devicetree binding documentation and
> MAINTAINERS entry for dw9768 actuator.
>
> Signed-off-by: Dongchun Zhu <dongchun.zhu@mediatek.com>
> ---
> Documentation/devicetree/bindings/media/i2c/dongwoon,dw9768.txt | 9 +++++++++
> MAINTAINERS | 7 +++++++
This should be:
1) two separate patches
2) binding in YAML
--
With Best Regards,
Andy Shevchenko
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [V2, 2/2] media: i2c: Add DW9768 VCM driver
2019-09-05 8:21 ` Sakari Ailus
@ 2019-09-05 10:19 ` Andy Shevchenko
2019-09-05 10:40 ` Sakari Ailus
0 siblings, 1 reply; 20+ messages in thread
From: Andy Shevchenko @ 2019-09-05 10:19 UTC (permalink / raw)
To: Sakari Ailus, Javier Martinez Canillas
Cc: mark.rutland, devicetree, drinkcat, srv_heupstream, sam.hung,
shengnan.wang, tfiga, sj.huang, robh+dt, linux-mediatek,
dongchun.zhu, matthias.bgg, bingbu.cao, mchehab,
linux-arm-kernel, linux-media
On Thu, Sep 05, 2019 at 11:21:34AM +0300, Sakari Ailus wrote:
> On Thu, Sep 05, 2019 at 03:21:42PM +0800, dongchun.zhu@mediatek.com wrote:
> > From: Dongchun Zhu <dongchun.zhu@mediatek.com>
> > +static const struct i2c_device_id dw9768_id_table[] = {
> > + { DW9768_NAME, 0 },
> > + { },
>
> Could you drop the I²C ID table?
But why?
It will allow you to instanciate the device from user space.
+Cc: Javier.
Javier, is it needed in new code?
--
With Best Regards,
Andy Shevchenko
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [V2, 2/2] media: i2c: Add DW9768 VCM driver
2019-09-05 7:21 ` [V2, 2/2] media: i2c: Add DW9768 VCM driver dongchun.zhu
2019-09-05 8:21 ` Sakari Ailus
2019-09-05 8:28 ` Tomasz Figa
@ 2019-09-05 10:26 ` Andy Shevchenko
[not found] ` <e8b59857e39744a6acfe5d862f3ac8d5@mtkmbs05n2.mediatek.inc>
2019-09-07 22:12 ` kbuild test robot
2019-10-09 4:40 ` Tomasz Figa
4 siblings, 1 reply; 20+ messages in thread
From: Andy Shevchenko @ 2019-09-05 10:26 UTC (permalink / raw)
To: dongchun.zhu
Cc: mark.rutland, devicetree, drinkcat, srv_heupstream, sam.hung,
shengnan.wang, tfiga, sj.huang, robh+dt, linux-mediatek,
sakari.ailus, matthias.bgg, bingbu.cao, mchehab,
linux-arm-kernel, linux-media
On Thu, Sep 05, 2019 at 03:21:42PM +0800, dongchun.zhu@mediatek.com wrote:
> From: Dongchun Zhu <dongchun.zhu@mediatek.com>
>
> 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.
> Signed-off-by: Dongchun Zhu <dongchun.zhu@mediatek.com>
> ---
> MAINTAINERS | 1 +
This should go to the same patch, where you introduce a record in the
MAINTAINERS database.
> +#define DW9768_SET_POSITION_ADDR 0x03
Indentation issue.
> +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;
> +
> + if (reg == DW9768_CMD_DELAY && value == DW9768_CMD_DELAY)
Indentation issue.
But see other's comments.
> + usleep_range(DW9768_CTRL_DELAY_US,
> + DW9768_CTRL_DELAY_US + 100);
> + else
This needs an explanation.
> + 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.
> +static int __maybe_unused dw9768_vcm_suspend(struct device *dev)
> +{
> + struct i2c_client *client = to_i2c_client(dev);
> + struct v4l2_subdev *sd = i2c_get_clientdata(client);
isn't is simple dev_get_drvdata() ?
> + struct dw9768 *dw9768 = sd_to_dw9768_vcm(sd);
> +
> + return dw9768_power_off(dw9768);
> +}
> +
> +static int __maybe_unused dw9768_vcm_resume(struct device *dev)
> +{
> + struct i2c_client *client = to_i2c_client(dev);
> + struct v4l2_subdev *sd = i2c_get_clientdata(client);
Ditto.
> + struct dw9768 *dw9768 = sd_to_dw9768_vcm(sd);
> +
> + return dw9768_power_on(dw9768);
> +}
> +static const struct i2c_device_id dw9768_id_table[] = {
> + { DW9768_NAME, 0 },
> + { },
No comma.
> +};
> +static const struct of_device_id dw9768_of_table[] = {
> + { .compatible = "dongwoon,dw9768" },
> + { },
Ditto.
> +};
--
With Best Regards,
Andy Shevchenko
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [V2, 2/2] media: i2c: Add DW9768 VCM driver
2019-09-05 10:19 ` Andy Shevchenko
@ 2019-09-05 10:40 ` Sakari Ailus
2019-09-05 10:57 ` Javier Martinez Canillas
0 siblings, 1 reply; 20+ messages in thread
From: Sakari Ailus @ 2019-09-05 10:40 UTC (permalink / raw)
To: Andy Shevchenko
Cc: mark.rutland, devicetree, drinkcat, srv_heupstream, sam.hung,
shengnan.wang, Javier Martinez Canillas, tfiga, sj.huang,
robh+dt, linux-mediatek, dongchun.zhu, matthias.bgg, bingbu.cao,
mchehab, linux-arm-kernel, linux-media
On Thu, Sep 05, 2019 at 01:19:08PM +0300, Andy Shevchenko wrote:
> On Thu, Sep 05, 2019 at 11:21:34AM +0300, Sakari Ailus wrote:
> > On Thu, Sep 05, 2019 at 03:21:42PM +0800, dongchun.zhu@mediatek.com wrote:
> > > From: Dongchun Zhu <dongchun.zhu@mediatek.com>
>
> > > +static const struct i2c_device_id dw9768_id_table[] = {
> > > + { DW9768_NAME, 0 },
> > > + { },
> >
> > Could you drop the I²C ID table?
>
> But why?
> It will allow you to instanciate the device from user space.
The device is supposed to be present in DT (or ACPI tables) already.
>
> +Cc: Javier.
>
> Javier, is it needed in new code?
--
Sakari Ailus
sakari.ailus@linux.intel.com
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [V2, 1/2] media: i2c: dw9768: Add DT support and MAINTAINERS entry
2019-09-05 10:14 ` Andy Shevchenko
@ 2019-09-05 10:48 ` Sakari Ailus
2019-09-05 11:35 ` Andy Shevchenko
0 siblings, 1 reply; 20+ messages in thread
From: Sakari Ailus @ 2019-09-05 10:48 UTC (permalink / raw)
To: Andy Shevchenko
Cc: mark.rutland, devicetree, drinkcat, srv_heupstream, sam.hung,
shengnan.wang, tfiga, sj.huang, robh+dt, linux-mediatek,
dongchun.zhu, matthias.bgg, bingbu.cao, mchehab,
linux-arm-kernel, linux-media
On Thu, Sep 05, 2019 at 01:14:06PM +0300, Andy Shevchenko wrote:
> On Thu, Sep 05, 2019 at 03:21:41PM +0800, dongchun.zhu@mediatek.com wrote:
> > From: Dongchun Zhu <dongchun.zhu@mediatek.com>
> >
> > This patch is to add the Devicetree binding documentation and
> > MAINTAINERS entry for dw9768 actuator.
> >
> > Signed-off-by: Dongchun Zhu <dongchun.zhu@mediatek.com>
> > ---
> > Documentation/devicetree/bindings/media/i2c/dongwoon,dw9768.txt | 9 +++++++++
> > MAINTAINERS | 7 +++++++
>
> This should be:
> 1) two separate patches
Why? The MAINTAINERS entry is usually added in the first patch needing it,
isn't it?
--
Sakari Ailus
sakari.ailus@linux.intel.com
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [V2, 2/2] media: i2c: Add DW9768 VCM driver
2019-09-05 10:40 ` Sakari Ailus
@ 2019-09-05 10:57 ` Javier Martinez Canillas
2019-09-05 11:36 ` Andy Shevchenko
0 siblings, 1 reply; 20+ messages in thread
From: Javier Martinez Canillas @ 2019-09-05 10:57 UTC (permalink / raw)
To: Sakari Ailus, Andy Shevchenko
Cc: mark.rutland, devicetree, drinkcat, srv_heupstream, sam.hung,
shengnan.wang, tfiga, sj.huang, robh+dt, linux-mediatek,
dongchun.zhu, matthias.bgg, bingbu.cao, mchehab,
linux-arm-kernel, linux-media
On 9/5/19 12:40 PM, Sakari Ailus wrote:
> On Thu, Sep 05, 2019 at 01:19:08PM +0300, Andy Shevchenko wrote:
>> On Thu, Sep 05, 2019 at 11:21:34AM +0300, Sakari Ailus wrote:
>>> On Thu, Sep 05, 2019 at 03:21:42PM +0800, dongchun.zhu@mediatek.com wrote:
>>>> From: Dongchun Zhu <dongchun.zhu@mediatek.com>
>>
>>>> +static const struct i2c_device_id dw9768_id_table[] = {
>>>> + { DW9768_NAME, 0 },
>>>> + { },
>>>
>>> Could you drop the I²C ID table?
>>
>> But why?
>> It will allow you to instanciate the device from user space.
Yes, the I2C device table is still needed if the device can be instantiated
from user-space using the sysfs interface, or otherwise the module won't be
automatically loaded.
Kieran posted a "[PATCH RFC] modpost: Support I2C Aliases from OF tables"
patch that adds a MODULE_DEVICE_TABLE(i2c_of, ..) macro so modpost could
add legacy I2C modalias using the information in the OF device ID tables:
https://patchwork.kernel.org/patch/11038861/
If that lands, then we could get rid of the I2C device tables altogether
for non-legacy I2C drivers.
>
> The device is supposed to be present in DT (or ACPI tables) already.
>
Agreed. Also by looking at the driver's probe function I see that the
device lookups a 'vin' and 'vdd' regulators supplies and it fails if
aren't defined, so it can't be instantiated from user-space anyways.
BTW, these two regulators supplies should be listed as 'vin-supply'
and 'vdd-supply' as required properties in the DT binding document.
Best regards,
--
Javier Martinez Canillas
Software Engineer - Desktop Hardware Enablement
Red Hat
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [V2, 1/2] media: i2c: dw9768: Add DT support and MAINTAINERS entry
2019-09-05 10:48 ` Sakari Ailus
@ 2019-09-05 11:35 ` Andy Shevchenko
2019-09-05 11:49 ` Javier Martinez Canillas
0 siblings, 1 reply; 20+ messages in thread
From: Andy Shevchenko @ 2019-09-05 11:35 UTC (permalink / raw)
To: Sakari Ailus
Cc: mark.rutland, devicetree, drinkcat, srv_heupstream, sam.hung,
shengnan.wang, tfiga, sj.huang, robh+dt, linux-mediatek,
dongchun.zhu, matthias.bgg, bingbu.cao, mchehab,
linux-arm-kernel, linux-media
On Thu, Sep 05, 2019 at 01:48:30PM +0300, Sakari Ailus wrote:
> On Thu, Sep 05, 2019 at 01:14:06PM +0300, Andy Shevchenko wrote:
> > On Thu, Sep 05, 2019 at 03:21:41PM +0800, dongchun.zhu@mediatek.com wrote:
> > > From: Dongchun Zhu <dongchun.zhu@mediatek.com>
> > >
> > > This patch is to add the Devicetree binding documentation and
> > > MAINTAINERS entry for dw9768 actuator.
> > >
> > > Signed-off-by: Dongchun Zhu <dongchun.zhu@mediatek.com>
> > > ---
> > > Documentation/devicetree/bindings/media/i2c/dongwoon,dw9768.txt | 9 +++++++++
> > > MAINTAINERS | 7 +++++++
> >
> > This should be:
> > 1) two separate patches
>
> Why? The MAINTAINERS entry is usually added in the first patch needing it,
> isn't it?
Bindings are required to be a separate patch.
Rob, is it still the case or am I mistaken?
--
With Best Regards,
Andy Shevchenko
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [V2, 2/2] media: i2c: Add DW9768 VCM driver
2019-09-05 10:57 ` Javier Martinez Canillas
@ 2019-09-05 11:36 ` Andy Shevchenko
0 siblings, 0 replies; 20+ messages in thread
From: Andy Shevchenko @ 2019-09-05 11:36 UTC (permalink / raw)
To: Javier Martinez Canillas
Cc: mark.rutland, devicetree, drinkcat, srv_heupstream, sam.hung,
shengnan.wang, tfiga, sj.huang, robh+dt, linux-mediatek,
dongchun.zhu, Sakari Ailus, matthias.bgg, bingbu.cao, mchehab,
linux-arm-kernel, linux-media
On Thu, Sep 05, 2019 at 12:57:34PM +0200, Javier Martinez Canillas wrote:
> On 9/5/19 12:40 PM, Sakari Ailus wrote:
> > On Thu, Sep 05, 2019 at 01:19:08PM +0300, Andy Shevchenko wrote:
> >> On Thu, Sep 05, 2019 at 11:21:34AM +0300, Sakari Ailus wrote:
> >>> On Thu, Sep 05, 2019 at 03:21:42PM +0800, dongchun.zhu@mediatek.com wrote:
> >>>> From: Dongchun Zhu <dongchun.zhu@mediatek.com>
> >>
> >>>> +static const struct i2c_device_id dw9768_id_table[] = {
> >>>> + { DW9768_NAME, 0 },
> >>>> + { },
> >>>
> >>> Could you drop the I²C ID table?
> >>
> >> But why?
> >> It will allow you to instanciate the device from user space.
>
> Yes, the I2C device table is still needed if the device can be instantiated
> from user-space using the sysfs interface, or otherwise the module won't be
> automatically loaded.
>
> Kieran posted a "[PATCH RFC] modpost: Support I2C Aliases from OF tables"
> patch that adds a MODULE_DEVICE_TABLE(i2c_of, ..) macro so modpost could
> add legacy I2C modalias using the information in the OF device ID tables:
>
> https://patchwork.kernel.org/patch/11038861/
>
> If that lands, then we could get rid of the I2C device tables altogether
> for non-legacy I2C drivers.
>
> >
> > The device is supposed to be present in DT (or ACPI tables) already.
> >
>
> Agreed. Also by looking at the driver's probe function I see that the
> device lookups a 'vin' and 'vdd' regulators supplies and it fails if
> aren't defined, so it can't be instantiated from user-space anyways.
Thank you for clarifications!
So, it can use ->probe_new() in that case.
>
> BTW, these two regulators supplies should be listed as 'vin-supply'
> and 'vdd-supply' as required properties in the DT binding document.
--
With Best Regards,
Andy Shevchenko
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [V2, 1/2] media: i2c: dw9768: Add DT support and MAINTAINERS entry
2019-09-05 11:35 ` Andy Shevchenko
@ 2019-09-05 11:49 ` Javier Martinez Canillas
2019-09-05 12:00 ` Sakari Ailus
0 siblings, 1 reply; 20+ messages in thread
From: Javier Martinez Canillas @ 2019-09-05 11:49 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Mark Rutland, devicetree, drinkcat, srv_heupstream, sam.hung,
shengnan.wang, Tomasz Figa, sj.huang, Rob Herring,
linux-mediatek, dongchun.zhu, Sakari Ailus, Matthias Brugger,
bingbu.cao, Mauro Carvalho Chehab, linux-arm-kernel,
Linux Media Mailing List
On Thu, Sep 5, 2019 at 1:35 PM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
>
> On Thu, Sep 05, 2019 at 01:48:30PM +0300, Sakari Ailus wrote:
> > On Thu, Sep 05, 2019 at 01:14:06PM +0300, Andy Shevchenko wrote:
> > > On Thu, Sep 05, 2019 at 03:21:41PM +0800, dongchun.zhu@mediatek.com wrote:
> > > > From: Dongchun Zhu <dongchun.zhu@mediatek.com>
> > > >
> > > > This patch is to add the Devicetree binding documentation and
> > > > MAINTAINERS entry for dw9768 actuator.
> > > >
> > > > Signed-off-by: Dongchun Zhu <dongchun.zhu@mediatek.com>
> > > > ---
> > > > Documentation/devicetree/bindings/media/i2c/dongwoon,dw9768.txt | 9 +++++++++
> > > > MAINTAINERS | 7 +++++++
> > >
> > > This should be:
> > > 1) two separate patches
> >
> > Why? The MAINTAINERS entry is usually added in the first patch needing it,
> > isn't it?
>
> Bindings are required to be a separate patch.
> Rob, is it still the case or am I mistaken?
>
According to the rule 0 in [1] it should be a separate patch indeed
and also use as subject "dt-bindings: <binding dir>: ..." which this
patch also doesn't follow.
So if I'm reading that document correctly, then I think the
maintainers entry should be added in patch 2/2 along with the driver.
[1]: https://www.kernel.org/doc/Documentation/devicetree/bindings/submitting-patches.txt
Best regards,
Javier
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [V2, 1/2] media: i2c: dw9768: Add DT support and MAINTAINERS entry
2019-09-05 11:49 ` Javier Martinez Canillas
@ 2019-09-05 12:00 ` Sakari Ailus
2019-09-05 12:24 ` Andy Shevchenko
0 siblings, 1 reply; 20+ messages in thread
From: Sakari Ailus @ 2019-09-05 12:00 UTC (permalink / raw)
To: Javier Martinez Canillas
Cc: Mark Rutland, devicetree, drinkcat, srv_heupstream, sam.hung,
shengnan.wang, Andy Shevchenko, Tomasz Figa, sj.huang,
Rob Herring, linux-mediatek, dongchun.zhu, Matthias Brugger,
bingbu.cao, Mauro Carvalho Chehab, linux-arm-kernel,
Linux Media Mailing List
On Thu, Sep 05, 2019 at 01:49:28PM +0200, Javier Martinez Canillas wrote:
> On Thu, Sep 5, 2019 at 1:35 PM Andy Shevchenko
> <andriy.shevchenko@linux.intel.com> wrote:
> >
> > On Thu, Sep 05, 2019 at 01:48:30PM +0300, Sakari Ailus wrote:
> > > On Thu, Sep 05, 2019 at 01:14:06PM +0300, Andy Shevchenko wrote:
> > > > On Thu, Sep 05, 2019 at 03:21:41PM +0800, dongchun.zhu@mediatek.com wrote:
> > > > > From: Dongchun Zhu <dongchun.zhu@mediatek.com>
> > > > >
> > > > > This patch is to add the Devicetree binding documentation and
> > > > > MAINTAINERS entry for dw9768 actuator.
> > > > >
> > > > > Signed-off-by: Dongchun Zhu <dongchun.zhu@mediatek.com>
> > > > > ---
> > > > > Documentation/devicetree/bindings/media/i2c/dongwoon,dw9768.txt | 9 +++++++++
> > > > > MAINTAINERS | 7 +++++++
> > > >
> > > > This should be:
> > > > 1) two separate patches
> > >
> > > Why? The MAINTAINERS entry is usually added in the first patch needing it,
> > > isn't it?
> >
> > Bindings are required to be a separate patch.
> > Rob, is it still the case or am I mistaken?
> >
>
> According to the rule 0 in [1] it should be a separate patch indeed
> and also use as subject "dt-bindings: <binding dir>: ..." which this
> patch also doesn't follow.
> So if I'm reading that document correctly, then I think the
> maintainers entry should be added in patch 2/2 along with the driver.
I understand [1] discussing the need for the bindings to be a "separate
patch" means a separate patch from the _driver_ for the device, not the
MAINTAINERS change.
Bindings come before the driver, and MAINTAINERS entry needs to be there no
later than the files. And I see no reason to add a separate patch just for
MAINTAINERS change.
>
> [1]: https://www.kernel.org/doc/Documentation/devicetree/bindings/submitting-patches.txt
--
Sakari Ailus
sakari.ailus@linux.intel.com
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [V2, 1/2] media: i2c: dw9768: Add DT support and MAINTAINERS entry
2019-09-05 12:00 ` Sakari Ailus
@ 2019-09-05 12:24 ` Andy Shevchenko
2019-09-17 20:47 ` Rob Herring
0 siblings, 1 reply; 20+ messages in thread
From: Andy Shevchenko @ 2019-09-05 12:24 UTC (permalink / raw)
To: Sakari Ailus
Cc: Mark Rutland, devicetree, drinkcat, srv_heupstream, sam.hung,
shengnan.wang, Tomasz Figa, sj.huang, Rob Herring,
linux-mediatek, dongchun.zhu, Matthias Brugger, bingbu.cao,
Javier Martinez Canillas, Mauro Carvalho Chehab,
linux-arm-kernel, Linux Media Mailing List
On Thu, Sep 05, 2019 at 03:00:12PM +0300, Sakari Ailus wrote:
> And I see no reason to add a separate patch just for
> MAINTAINERS change.
It's up to maintainers of the subsystem.
--
With Best Regards,
Andy Shevchenko
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [V2, 2/2] media: i2c: Add DW9768 VCM driver
2019-09-05 7:21 ` [V2, 2/2] media: i2c: Add DW9768 VCM driver dongchun.zhu
` (2 preceding siblings ...)
2019-09-05 10:26 ` Andy Shevchenko
@ 2019-09-07 22:12 ` kbuild test robot
2019-10-09 4:40 ` Tomasz Figa
4 siblings, 0 replies; 20+ messages in thread
From: kbuild test robot @ 2019-09-07 22:12 UTC (permalink / raw)
To: dongchun.zhu
Cc: mark.rutland, drinkcat, andriy.shevchenko, srv_heupstream,
devicetree, sam.hung, shengnan.wang, dongchun.zhu, tfiga,
sj.huang, robh+dt, linux-mediatek, kbuild-all, sakari.ailus,
matthias.bgg, bingbu.cao, mchehab, linux-arm-kernel, linux-media
[-- Attachment #1: Type: text/plain, Size: 1958 bytes --]
Hi,
I love your patch! Perhaps something to improve:
[auto build test WARNING on linuxtv-media/master]
[cannot apply to v5.3-rc7 next-20190904]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/dongchun-zhu-mediatek-com/media-i2c-dw9768-Add-DT-support-and-MAINTAINERS-entry/20190908-044622
base: git://linuxtv.org/media_tree.git master
config: sh-allmodconfig (attached as .config)
compiler: sh4-linux-gcc (GCC) 7.4.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
GCC_VERSION=7.4.0 make.cross ARCH=sh
If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@intel.com>
Note: it may well be a FALSE warning. FWIW you are at least aware of it now.
http://gcc.gnu.org/wiki/Better_Uninitialized_Warnings
All warnings (new ones prefixed by >>):
drivers/media/i2c/dw9768.c: In function 'dw9768_write_smbus':
>> drivers/media/i2c/dw9768.c:82:9: warning: 'ret' may be used uninitialized in this function [-Wmaybe-uninitialized]
return ret;
^~~
vim +/ret +82 drivers/media/i2c/dw9768.c
70
71 static int dw9768_write_smbus(struct dw9768 *dw9768, unsigned char reg,
72 unsigned char value)
73 {
74 struct i2c_client *client = v4l2_get_subdevdata(&dw9768->sd);
75 int ret;
76
77 if (reg == DW9768_CMD_DELAY && value == DW9768_CMD_DELAY)
78 usleep_range(DW9768_CTRL_DELAY_US,
79 DW9768_CTRL_DELAY_US + 100);
80 else
81 ret = i2c_smbus_write_byte_data(client, reg, value);
> 82 return ret;
83 }
84
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 51779 bytes --]
[-- Attachment #3: Type: text/plain, Size: 176 bytes --]
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [V2, 1/2] media: i2c: dw9768: Add DT support and MAINTAINERS entry
2019-09-05 12:24 ` Andy Shevchenko
@ 2019-09-17 20:47 ` Rob Herring
0 siblings, 0 replies; 20+ messages in thread
From: Rob Herring @ 2019-09-17 20:47 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Mark Rutland, devicetree, drinkcat, srv_heupstream, sam.hung,
shengnan.wang, Tomasz Figa, sj.huang, linux-mediatek,
dongchun.zhu, Sakari Ailus, Matthias Brugger, bingbu.cao,
Javier Martinez Canillas, Mauro Carvalho Chehab,
linux-arm-kernel, Linux Media Mailing List
On Thu, Sep 05, 2019 at 03:24:49PM +0300, Andy Shevchenko wrote:
> On Thu, Sep 05, 2019 at 03:00:12PM +0300, Sakari Ailus wrote:
>
> > And I see no reason to add a separate patch just for
> > MAINTAINERS change.
>
> It's up to maintainers of the subsystem.
Just update MAINTAINERS with the driver. It doesn't need to be so
complicated or per subsystem. There's enough of what each maintainer
wants already.
Rob
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [V2, 2/2] media: i2c: Add DW9768 VCM driver
2019-09-05 7:21 ` [V2, 2/2] media: i2c: Add DW9768 VCM driver dongchun.zhu
` (3 preceding siblings ...)
2019-09-07 22:12 ` kbuild test robot
@ 2019-10-09 4:40 ` Tomasz Figa
4 siblings, 0 replies; 20+ messages in thread
From: Tomasz Figa @ 2019-10-09 4:40 UTC (permalink / raw)
To: Dongchun Zhu
Cc: Mark Rutland, Nicolas Boichat, andriy.shevchenko, srv_heupstream,
devicetree, sam.hung, shengnan.wang, Sj Huang, Rob Herring,
moderated list:ARM/Mediatek SoC support, Sakari Ailus,
Matthias Brugger, Cao Bing Bu, Mauro Carvalho Chehab,
list@263.net:IOMMU DRIVERS
<iommu@lists.linux-foundation.org>,
Joerg Roedel <joro@8bytes.org>, ,
Linux Media Mailing List
Hi Dongchun,
On Thu, Sep 5, 2019 at 4:22 PM <dongchun.zhu@mediatek.com> wrote:
>
> From: Dongchun Zhu <dongchun.zhu@mediatek.com>
>
> 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.
>
> Signed-off-by: Dongchun Zhu <dongchun.zhu@mediatek.com>
> ---
> MAINTAINERS | 1 +
> drivers/media/i2c/Kconfig | 10 ++
> drivers/media/i2c/Makefile | 1 +
> drivers/media/i2c/dw9768.c | 349 +++++++++++++++++++++++++++++++++++++++++++++
> 4 files changed, 361 insertions(+)
> create mode 100644 drivers/media/i2c/dw9768.c
>
Please see my further comments inline.
[snip]
> +struct regval_list {
> + unsigned char reg_num;
> + unsigned char value;
nit: Since we have strictly sized values here, should we use u8 for
both fields instead?
> +};
> +
> +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)
Should we use u8 for the last two arguments here as well?
> +{
> + struct i2c_client *client = v4l2_get_subdevdata(&dw9768->sd);
> + int ret;
> +
> + if (reg == DW9768_CMD_DELAY && value == DW9768_CMD_DELAY)
> + usleep_range(DW9768_CTRL_DELAY_US,
> + DW9768_CTRL_DELAY_US + 100);
ret will be uninitialized if we go this path.
> + else
> + ret = i2c_smbus_write_byte_data(client, reg, value);
> + return ret;
> +}
> +
> +static int dw9768_write_array(struct dw9768 *dw9768, struct regval_list *vals,
> + u32 len)
Since len is an array size, should we use size_t instead?
> +{
> + unsigned int i;
size_t?
> + int ret;
> +
> + for (i = 0; i < len; i++) {
> + ret = dw9768_write_smbus(dw9768, vals->reg_num, vals->value);
This should refer to vals[i] instead.
> + if (ret < 0)
> + return ret;
> + }
> + return 0;
> +}
> +
> +static int dw9768_set_position(struct dw9768 *dw9768, u16 val)
> +{
> + struct i2c_client *client = v4l2_get_subdevdata(&dw9768->sd);
> + u8 addr[2];
> +
> + addr[0] = (val >> DW9768_DAC_SHIFT) & DW9768_REG_MASK_MSB;
> + addr[1] = val & DW9768_REG_MASK_LSB;
> +
> + return i2c_smbus_write_block_data(client, DW9768_SET_POSITION_ADDR,
> + ARRAY_SIZE(addr), addr);
As we discovered earlier, i2c_smbus_write_block_data() uses a
different protocol from what we expected. Please change to
i2c_smbus_write_word_data(), as per our downstream changes.
> +}
> +
> +static int dw9768_release(struct dw9768 *dw9768)
> +{
> + return dw9768_write_array(dw9768, dw9768_release_regs,
> + ARRAY_SIZE(dw9768_release_regs));
> +}
> +
> +static int dw9768_init(struct dw9768 *dw9768)
> +{
> + return dw9768_write_array(dw9768, dw9768_init_regs,
> + ARRAY_SIZE(dw9768_init_regs));
> +}
> +
> +/* Power handling */
> +static int dw9768_power_off(struct dw9768 *dw9768)
> +{
> + struct i2c_client *client = v4l2_get_subdevdata(&dw9768->sd);
> + int ret;
> +
> + ret = dw9768_release(dw9768);
> + if (ret)
> + dev_err(&client->dev, "dw9768 release failed!\n");
> +
> + ret = regulator_disable(dw9768->vin);
> + if (ret)
> + return ret;
> +
> + return regulator_disable(dw9768->vdd);
> +}
> +
> +static int dw9768_power_on(struct dw9768 *dw9768)
> +{
> + int ret;
> +
> + ret = regulator_enable(dw9768->vin);
> + if (ret < 0)
> + return ret;
> +
> + ret = regulator_enable(dw9768->vdd);
> + if (ret < 0)
> + return ret;
There is at least T_opr = 200 us of delay needed here. Would you be
able to add a comment and a corresponding usleep_range() call? I guess
the range of (300, 400) would be enough on the safe side.
Best regards,
Tomasz
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [V2, 2/2] media: i2c: Add DW9768 VCM driver
[not found] ` <e8b59857e39744a6acfe5d862f3ac8d5@mtkmbs05n2.mediatek.inc>
@ 2020-01-20 8:34 ` Dongchun Zhu
0 siblings, 0 replies; 20+ messages in thread
From: Dongchun Zhu @ 2020-01-20 8:34 UTC (permalink / raw)
To: andriy.shevchenko
Cc: mark.rutland, devicetree, srv_heupstream, shengnan.wang,
louis.kuo, sj.huang, robh+dt, linux-mediatek, sakari.ailus,
matthias.bgg, bingbu.cao, mchehab, linux-arm-kernel, linux-media
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:
> > From: Dongchun Zhu <dongchun.zhu@mediatek.com>
> >
> > 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.
>
> > Signed-off-by: Dongchun Zhu <dongchun.zhu@mediatek.com>
> > ---
> > MAINTAINERS | 1 +
>
> This should go to the same patch, where you introduce a record in the MAINTAINERS database.
>
> > +#define DW9768_SET_POSITION_ADDR 0x03
>
> Indentation issue.
>
Fixed in next release.
> > +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;
> > +
>
> > +if (reg == DW9768_CMD_DELAY && value == DW9768_CMD_DELAY)
>
> Indentation issue.
> But see other's comments.
>
> > +usleep_range(DW9768_CTRL_DELAY_US,
> > + DW9768_CTRL_DELAY_US + 100);
>
> > +else
>
> This needs an explanation.
>
Fixed in next release.
> > +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.
>
> > +static int __maybe_unused dw9768_vcm_suspend(struct device *dev) {
>
> > +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()?
> > +struct dw9768 *dw9768 = sd_to_dw9768_vcm(sd);
> > +
> > +return dw9768_power_off(dw9768);
> > +}
> > +
> > +static int __maybe_unused dw9768_vcm_resume(struct device *dev) {
>
> > +struct i2c_client *client = to_i2c_client(dev);
> > +struct v4l2_subdev *sd = i2c_get_clientdata(client);
>
> Ditto.
>
> > +struct dw9768 *dw9768 = sd_to_dw9768_vcm(sd);
> > +
> > +return dw9768_power_on(dw9768);
> > +}
>
> > +static const struct i2c_device_id dw9768_id_table[] = {
> > +{ DW9768_NAME, 0 },
>
> > +{ },
>
> No comma.
>
This struct would be removed in next release.
> > +};
>
> > +static const struct of_device_id dw9768_of_table[] = {
> > +{ .compatible = "dongwoon,dw9768" },
>
> > +{ },
>
> Ditto.
>
Fixed in next release.
> > +};
>
> --
> 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
^ permalink raw reply [flat|nested] 20+ messages in thread
end of thread, other threads:[~2020-01-20 8:35 UTC | newest]
Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-05 7:21 [V2, 0/2] media: i2c: add support for DW9768 VCM driver dongchun.zhu
2019-09-05 7:21 ` [V2, 1/2] media: i2c: dw9768: Add DT support and MAINTAINERS entry dongchun.zhu
2019-09-05 10:14 ` Andy Shevchenko
2019-09-05 10:48 ` Sakari Ailus
2019-09-05 11:35 ` Andy Shevchenko
2019-09-05 11:49 ` Javier Martinez Canillas
2019-09-05 12:00 ` Sakari Ailus
2019-09-05 12:24 ` Andy Shevchenko
2019-09-17 20:47 ` Rob Herring
2019-09-05 7:21 ` [V2, 2/2] media: i2c: Add DW9768 VCM driver dongchun.zhu
2019-09-05 8:21 ` Sakari Ailus
2019-09-05 10:19 ` Andy Shevchenko
2019-09-05 10:40 ` Sakari Ailus
2019-09-05 10:57 ` Javier Martinez Canillas
2019-09-05 11:36 ` Andy Shevchenko
2019-09-05 8:28 ` Tomasz Figa
2019-09-05 10:26 ` Andy Shevchenko
[not found] ` <e8b59857e39744a6acfe5d862f3ac8d5@mtkmbs05n2.mediatek.inc>
2020-01-20 8:34 ` Dongchun Zhu
2019-09-07 22:12 ` kbuild test robot
2019-10-09 4:40 ` Tomasz Figa
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).