All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1 0/2] media: i2c: Add support for GT97xx VCM
@ 2024-04-20  1:18 ` Zhi Mao
  0 siblings, 0 replies; 20+ messages in thread
From: Zhi Mao @ 2024-04-20  1:18 UTC (permalink / raw)
  To: Mauro Carvalho Chehab, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley
  Cc: Matthias Brugger, AngeloGioacchino Del Regno, Zhi Mao,
	Philipp Zabel, Laurent Pinchart, Heiko Stuebner, Sakari Ailus,
	Hans Verkuil, Hans de Goede, Tomi Valkeinen, Alain Volmat,
	Paul Elder, Mehdi Djait, Andy Shevchenko, Bingbu Cao, linux-media,
	devicetree, linux-kernel, linux-arm-kernel, linux-mediatek,
	shengnan.wang, yaya.chang, yunkec, 10572168

This series add YAML DT binding and V4L2 sub-device driver for Giantec's GT9768&GT9769.
GT9768&GT9769 is a 10-bit DAC with 100mA output current sink capability, designed
for voice coil motor(VCM) with I2C control bus.

This driver supports:
 - support pm runtime function for suspend/resume
 - support camera lens focus position by V4L2_CID_FOCUS_ABSOLUTE CMD
 - used in camera features on ChromeOS application

Previous versions of this patch-set can be found here:
v0: https://lore.kernel.org/all/20240410104002.1197-1-zhi.mao@mediatek.com/

This series is based on linux-next, tag: next-20240419
Changes in v1:
- dts-binding files:
-- remove "aac-mode/aac-timing/clock-presc" control information
-- remove words:"drivers" in commit message, as bindings are for hardware
-- use compatible filename for YAML
-- remove some uselss comments, as they are clear from the compatibles
-- use "camera-lens" as node-name

- gt97xx vcm driver:
-- use BIT(x) method to define some MACROs
-- remove "aac-mode/aac-timing/clock-presc" control and use the default settings
-- fix duplicate "return" case in function:power_on()/power_off()
-- use API:device_get_match_data() and dev_err_probe() in function:probe()
-- fix some coding style of comments

Thanks

Zhi Mao (2):
  media: dt-bindings: i2c: add Giantec GT97xx VCM driver
  media: i2c: Add GT97xx VCM driver

 .../bindings/media/i2c/giantec,gt9769.yaml    |  56 +++
 drivers/media/i2c/Kconfig                     |  13 +
 drivers/media/i2c/Makefile                    |   1 +
 drivers/media/i2c/gt97xx.c                    | 436 ++++++++++++++++++
 4 files changed, 506 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/media/i2c/giantec,gt9769.yaml
 create mode 100644 drivers/media/i2c/gt97xx.c

-- 
2.25.1




^ permalink raw reply	[flat|nested] 20+ messages in thread

* [PATCH v1 0/2] media: i2c: Add support for GT97xx VCM
@ 2024-04-20  1:18 ` Zhi Mao
  0 siblings, 0 replies; 20+ messages in thread
From: Zhi Mao @ 2024-04-20  1:18 UTC (permalink / raw)
  To: Mauro Carvalho Chehab, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley
  Cc: Matthias Brugger, AngeloGioacchino Del Regno, Zhi Mao,
	Philipp Zabel, Laurent Pinchart, Heiko Stuebner, Sakari Ailus,
	Hans Verkuil, Hans de Goede, Tomi Valkeinen, Alain Volmat,
	Paul Elder, Mehdi Djait, Andy Shevchenko, Bingbu Cao, linux-media,
	devicetree, linux-kernel, linux-arm-kernel, linux-mediatek,
	shengnan.wang, yaya.chang, yunkec, 10572168

This series add YAML DT binding and V4L2 sub-device driver for Giantec's GT9768&GT9769.
GT9768&GT9769 is a 10-bit DAC with 100mA output current sink capability, designed
for voice coil motor(VCM) with I2C control bus.

This driver supports:
 - support pm runtime function for suspend/resume
 - support camera lens focus position by V4L2_CID_FOCUS_ABSOLUTE CMD
 - used in camera features on ChromeOS application

Previous versions of this patch-set can be found here:
v0: https://lore.kernel.org/all/20240410104002.1197-1-zhi.mao@mediatek.com/

This series is based on linux-next, tag: next-20240419
Changes in v1:
- dts-binding files:
-- remove "aac-mode/aac-timing/clock-presc" control information
-- remove words:"drivers" in commit message, as bindings are for hardware
-- use compatible filename for YAML
-- remove some uselss comments, as they are clear from the compatibles
-- use "camera-lens" as node-name

- gt97xx vcm driver:
-- use BIT(x) method to define some MACROs
-- remove "aac-mode/aac-timing/clock-presc" control and use the default settings
-- fix duplicate "return" case in function:power_on()/power_off()
-- use API:device_get_match_data() and dev_err_probe() in function:probe()
-- fix some coding style of comments

Thanks

Zhi Mao (2):
  media: dt-bindings: i2c: add Giantec GT97xx VCM driver
  media: i2c: Add GT97xx VCM driver

 .../bindings/media/i2c/giantec,gt9769.yaml    |  56 +++
 drivers/media/i2c/Kconfig                     |  13 +
 drivers/media/i2c/Makefile                    |   1 +
 drivers/media/i2c/gt97xx.c                    | 436 ++++++++++++++++++
 4 files changed, 506 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/media/i2c/giantec,gt9769.yaml
 create mode 100644 drivers/media/i2c/gt97xx.c

-- 
2.25.1




_______________________________________________
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

* [PATCH v1 1/2] media: dt-bindings: i2c: add Giantec GT97xx VCM
  2024-04-20  1:18 ` Zhi Mao
@ 2024-04-20  1:18   ` Zhi Mao
  -1 siblings, 0 replies; 20+ messages in thread
From: Zhi Mao @ 2024-04-20  1:18 UTC (permalink / raw)
  To: Mauro Carvalho Chehab, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley
  Cc: Matthias Brugger, AngeloGioacchino Del Regno, Zhi Mao,
	Philipp Zabel, Laurent Pinchart, Heiko Stuebner, Sakari Ailus,
	Hans Verkuil, Hans de Goede, Tomi Valkeinen, Alain Volmat,
	Paul Elder, Mehdi Djait, Andy Shevchenko, Bingbu Cao, linux-media,
	devicetree, linux-kernel, linux-arm-kernel, linux-mediatek,
	shengnan.wang, yaya.chang, yunkec, 10572168

Add YAML device tree binding for GT9768 & GT8769 VCM,
and the relevant MAINTAINERS entries.

Signed-off-by: Zhi Mao <zhi.mao@mediatek.com>
---
 .../bindings/media/i2c/giantec,gt9769.yaml    | 56 +++++++++++++++++++
 1 file changed, 56 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/media/i2c/giantec,gt9769.yaml

diff --git a/Documentation/devicetree/bindings/media/i2c/giantec,gt9769.yaml b/Documentation/devicetree/bindings/media/i2c/giantec,gt9769.yaml
new file mode 100644
index 000000000000..6a9f49539b35
--- /dev/null
+++ b/Documentation/devicetree/bindings/media/i2c/giantec,gt9769.yaml
@@ -0,0 +1,56 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+# Copyright (c) 2020 MediaTek Inc.
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/media/i2c/giantec,gt9769.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Giantec Semiconductor, Crop. GT9768 & GT9769 Voice Coil Motor (VCM)
+
+maintainers:
+  - Zhi Mao <zhi.mao@mediatek.com>
+
+description: |-
+  The Giantec GT9768 & GT9768 is a 10-bit DAC with current sink capability.
+  The DAC is controlled via I2C bus that operates at clock rates up to 1MHz.
+  This chip integrates Advanced Actuator Control (AAC) technology
+  and is intended for driving voice coil lens in camera modules.
+
+properties:
+  compatible:
+    enum:
+      - giantec,gt9768
+      - giantec,gt9769
+
+  reg:
+    maxItems: 1
+
+  vin-supply: true
+
+  vdd-supply: true
+
+required:
+  - compatible
+  - reg
+  - vin-supply
+  - vdd-supply
+
+additionalProperties: false
+
+examples:
+  - |
+
+    i2c {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        camera-lens@c {
+            compatible = "giantec,gt9769";
+            reg = <0x0c>;
+
+            vin-supply = <&gt97xx_vin>;
+            vdd-supply = <&gt97xx_vdd>;
+        };
+    };
+
+...
-- 
2.25.1



^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH v1 1/2] media: dt-bindings: i2c: add Giantec GT97xx VCM
@ 2024-04-20  1:18   ` Zhi Mao
  0 siblings, 0 replies; 20+ messages in thread
From: Zhi Mao @ 2024-04-20  1:18 UTC (permalink / raw)
  To: Mauro Carvalho Chehab, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley
  Cc: Matthias Brugger, AngeloGioacchino Del Regno, Zhi Mao,
	Philipp Zabel, Laurent Pinchart, Heiko Stuebner, Sakari Ailus,
	Hans Verkuil, Hans de Goede, Tomi Valkeinen, Alain Volmat,
	Paul Elder, Mehdi Djait, Andy Shevchenko, Bingbu Cao, linux-media,
	devicetree, linux-kernel, linux-arm-kernel, linux-mediatek,
	shengnan.wang, yaya.chang, yunkec, 10572168

Add YAML device tree binding for GT9768 & GT8769 VCM,
and the relevant MAINTAINERS entries.

Signed-off-by: Zhi Mao <zhi.mao@mediatek.com>
---
 .../bindings/media/i2c/giantec,gt9769.yaml    | 56 +++++++++++++++++++
 1 file changed, 56 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/media/i2c/giantec,gt9769.yaml

diff --git a/Documentation/devicetree/bindings/media/i2c/giantec,gt9769.yaml b/Documentation/devicetree/bindings/media/i2c/giantec,gt9769.yaml
new file mode 100644
index 000000000000..6a9f49539b35
--- /dev/null
+++ b/Documentation/devicetree/bindings/media/i2c/giantec,gt9769.yaml
@@ -0,0 +1,56 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+# Copyright (c) 2020 MediaTek Inc.
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/media/i2c/giantec,gt9769.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Giantec Semiconductor, Crop. GT9768 & GT9769 Voice Coil Motor (VCM)
+
+maintainers:
+  - Zhi Mao <zhi.mao@mediatek.com>
+
+description: |-
+  The Giantec GT9768 & GT9768 is a 10-bit DAC with current sink capability.
+  The DAC is controlled via I2C bus that operates at clock rates up to 1MHz.
+  This chip integrates Advanced Actuator Control (AAC) technology
+  and is intended for driving voice coil lens in camera modules.
+
+properties:
+  compatible:
+    enum:
+      - giantec,gt9768
+      - giantec,gt9769
+
+  reg:
+    maxItems: 1
+
+  vin-supply: true
+
+  vdd-supply: true
+
+required:
+  - compatible
+  - reg
+  - vin-supply
+  - vdd-supply
+
+additionalProperties: false
+
+examples:
+  - |
+
+    i2c {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        camera-lens@c {
+            compatible = "giantec,gt9769";
+            reg = <0x0c>;
+
+            vin-supply = <&gt97xx_vin>;
+            vdd-supply = <&gt97xx_vdd>;
+        };
+    };
+
+...
-- 
2.25.1


_______________________________________________
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

* [PATCH v1 2/2] media: i2c: Add GT97xx VCM driver
  2024-04-20  1:18 ` Zhi Mao
@ 2024-04-20  1:18   ` Zhi Mao
  -1 siblings, 0 replies; 20+ messages in thread
From: Zhi Mao @ 2024-04-20  1:18 UTC (permalink / raw)
  To: Mauro Carvalho Chehab, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley
  Cc: Matthias Brugger, AngeloGioacchino Del Regno, Zhi Mao,
	Philipp Zabel, Laurent Pinchart, Heiko Stuebner, Sakari Ailus,
	Hans Verkuil, Hans de Goede, Tomi Valkeinen, Alain Volmat,
	Paul Elder, Mehdi Djait, Andy Shevchenko, Bingbu Cao, linux-media,
	devicetree, linux-kernel, linux-arm-kernel, linux-mediatek,
	shengnan.wang, yaya.chang, yunkec, 10572168

Add a V4L2 sub-device driver for Giantec GT97xx VCM.

Signed-off-by: Zhi Mao <zhi.mao@mediatek.com>
---
 drivers/media/i2c/Kconfig  |  13 ++
 drivers/media/i2c/Makefile |   1 +
 drivers/media/i2c/gt97xx.c | 436 +++++++++++++++++++++++++++++++++++++
 3 files changed, 450 insertions(+)
 create mode 100644 drivers/media/i2c/gt97xx.c

diff --git a/drivers/media/i2c/Kconfig b/drivers/media/i2c/Kconfig
index 56f276b920ab..fcb330cebfe0 100644
--- a/drivers/media/i2c/Kconfig
+++ b/drivers/media/i2c/Kconfig
@@ -759,6 +759,19 @@ config VIDEO_DW9807_VCM
 	  capability. This is designed for linear control of
 	  voice coil motors, controlled via I2C serial interface.
 
+config VIDEO_GT97XX
+	tristate "GT97xx lens voice coil support"
+	depends on I2C && VIDEO_DEV
+	select MEDIA_CONTROLLER
+	select VIDEO_V4L2_SUBDEV_API
+	select V4L2_FWNODE
+	select V4L2_CCI_I2C
+	help
+	  This is a driver for the GT97xx camera lens voice coil.
+	  GT97xx is a 10 bit DAC with 100mA output current sink
+	  capability. It is designed for linear control of
+	  voice coil motors, controlled via I2C serial interface.
+
 endmenu
 
 menu "Flash devices"
diff --git a/drivers/media/i2c/Makefile b/drivers/media/i2c/Makefile
index dfbe6448b549..af36a7aa3d12 100644
--- a/drivers/media/i2c/Makefile
+++ b/drivers/media/i2c/Makefile
@@ -39,6 +39,7 @@ obj-$(CONFIG_VIDEO_DW9807_VCM) += dw9807-vcm.o
 obj-$(CONFIG_VIDEO_ET8EK8) += et8ek8/
 obj-$(CONFIG_VIDEO_GC0308) += gc0308.o
 obj-$(CONFIG_VIDEO_GC2145) += gc2145.o
+obj-$(CONFIG_VIDEO_GT97XX) += gt97xx.o
 obj-$(CONFIG_VIDEO_HI556) += hi556.o
 obj-$(CONFIG_VIDEO_HI846) += hi846.o
 obj-$(CONFIG_VIDEO_HI847) += hi847.o
diff --git a/drivers/media/i2c/gt97xx.c b/drivers/media/i2c/gt97xx.c
new file mode 100644
index 000000000000..ccae190ffba6
--- /dev/null
+++ b/drivers/media/i2c/gt97xx.c
@@ -0,0 +1,436 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Driver for Giantec gt97xx VCM lens device
+ *
+ * Copyright 2024 MediaTek
+ *
+ * Zhi Mao <zhi.mao@mediatek.com>
+ */
+#include <linux/array_size.h>
+#include <linux/bits.h>
+#include <linux/clk.h>
+#include <linux/container_of.h>
+#include <linux/delay.h>
+#include <linux/device.h>
+#include <linux/err.h>
+#include <linux/gpio/consumer.h>
+#include <linux/mod_devicetable.h>
+#include <linux/pm_runtime.h>
+#include <linux/property.h>
+#include <linux/regulator/consumer.h>
+#include <linux/types.h>
+#include <linux/units.h>
+
+#include <media/v4l2-cci.h>
+#include <media/v4l2-ctrls.h>
+#include <media/v4l2-event.h>
+#include <media/v4l2-fwnode.h>
+#include <media/v4l2-subdev.h>
+
+/* gt97xx chip info register and name */
+#define GT97XX_IC_INFO_REG CCI_REG8(0x00)
+#define GT9768_ID 0xE9
+#define GT9769_ID 0xE1
+#define GT97XX_NAME "gt97xx"
+
+/*
+ * Ring control and Power control register
+ * Bit[1] RING_EN
+ * 0: Direct mode
+ * 1: AAC mode (ringing control mode)
+ * Bit[0] PD
+ * 0: Normal operation mode
+ * 1: Power down mode
+ * requires waiting time after PD reset takes place.
+ */
+#define GT97XX_RING_PD_CONTROL_REG CCI_REG8(0x02)
+#define GT97XX_PD_MODE_OFF 0x00
+#define GT97XX_PD_MODE_EN BIT(0)
+#define GT97XX_AAC_MODE_EN BIT(1)
+
+/*
+ * DAC is a 10bit address to control the VCM position.
+ * DAC_MSB: D[9:8] (ADD: 0x03)
+ * DAC_LSB: D[7:0] (ADD: 0x04)
+ */
+#define GT97XX_DAC_ADDR_REG CCI_REG16(0x03)
+
+#define GT97XX_MOVE_STEPS 16
+#define GT97XX_MAX_FOCUS_POS (BIT(10) - 1)
+
+#define GT97XX_SLEEP_US (1 * USEC_PER_MSEC)
+
+enum vcm_giantec_reg_desc {
+	GT_IC_INFO_REG,
+	GT_RING_PD_CONTROL_REG,
+	GT_DAC_ADDR_REG,
+	GT_MAX_REG
+};
+
+struct vcm_giantec_of_data {
+	unsigned int id;
+	unsigned int regs[GT_MAX_REG];
+};
+
+static const char *const gt97xx_supply_names[] = {
+	"vin",
+	"vdd",
+};
+
+/* gt97xx device structure */
+struct gt97xx {
+	struct v4l2_subdev sd;
+
+	struct regulator_bulk_data supplies[ARRAY_SIZE(gt97xx_supply_names)];
+
+	struct v4l2_ctrl_handler ctrls;
+	struct v4l2_ctrl *focus;
+
+	struct regmap *regmap;
+
+	const struct vcm_giantec_of_data *chip;
+};
+
+static inline struct gt97xx *sd_to_gt97xx(struct v4l2_subdev *subdev)
+{
+	return container_of(subdev, struct gt97xx, sd);
+}
+
+struct regval_list {
+	u8 reg_num;
+	u8 value;
+};
+
+static int gt97xx_set_dac(struct gt97xx *gt97xx, u16 val)
+{
+	/* Write VCM position to registers */
+	return cci_write(gt97xx->regmap,
+			 gt97xx->chip->regs[GT_DAC_ADDR_REG], val, NULL);
+}
+
+static int gt97xx_identify_module(struct gt97xx *gt97xx)
+{
+	int ret;
+	u64 ic_id;
+	struct i2c_client *client = v4l2_get_subdevdata(&gt97xx->sd);
+
+	ret = cci_read(gt97xx->regmap, gt97xx->chip->regs[GT_IC_INFO_REG],
+		       &ic_id, NULL);
+	if (ret < 0)
+		return ret;
+
+	if (ic_id != gt97xx->chip->id) {
+		dev_err(&client->dev, "chip id mismatch: 0x%x!=0x%llx",
+			gt97xx->chip->id, ic_id);
+		return -1;
+	}
+
+	return 0;
+}
+
+static int gt97xx_init(struct gt97xx *gt97xx)
+{
+	int ret, val;
+
+	ret = gt97xx_identify_module(gt97xx);
+	if (ret < 0)
+		return ret;
+
+	/* Reset PD_CONTROL */
+	ret = cci_write(gt97xx->regmap,
+			gt97xx->chip->regs[GT_RING_PD_CONTROL_REG],
+			GT97XX_PD_MODE_OFF, NULL);
+	if (ret < 0)
+		return ret;
+
+	/* Need waiting delay time after PD reset */
+	fsleep(GT97XX_SLEEP_US);
+
+	/* Enable ACC mode */
+	ret = cci_write(gt97xx->regmap,
+			gt97xx->chip->regs[GT_RING_PD_CONTROL_REG],
+			GT97XX_AAC_MODE_EN, NULL);
+	if (ret < 0)
+		return ret;
+
+	for (val = gt97xx->focus->val % GT97XX_MOVE_STEPS;
+	     val <= gt97xx->focus->val; val += GT97XX_MOVE_STEPS) {
+		ret = gt97xx_set_dac(gt97xx, val);
+		if (ret)
+			return ret;
+
+		fsleep(GT97XX_SLEEP_US);
+	}
+
+	return 0;
+}
+
+static int gt97xx_release(struct gt97xx *gt97xx)
+{
+	int ret, val;
+
+	val = round_down(gt97xx->focus->val, GT97XX_MOVE_STEPS);
+	for (; val >= 0; val -= GT97XX_MOVE_STEPS) {
+		ret = gt97xx_set_dac(gt97xx, val);
+		if (ret)
+			return ret;
+
+		fsleep(GT97XX_SLEEP_US);
+	}
+
+	return 0;
+}
+
+static int gt97xx_power_on(struct device *dev)
+{
+	struct v4l2_subdev *sd = dev_get_drvdata(dev);
+	struct gt97xx *gt97xx = sd_to_gt97xx(sd);
+	int ret;
+
+	ret = regulator_bulk_enable(ARRAY_SIZE(gt97xx_supply_names),
+				    gt97xx->supplies);
+	if (ret < 0)
+		dev_err(dev, "failed to enable regulators\n");
+
+	return ret;
+}
+
+static int gt97xx_power_off(struct device *dev)
+{
+	struct v4l2_subdev *sd = dev_get_drvdata(dev);
+	struct gt97xx *gt97xx = sd_to_gt97xx(sd);
+	int ret;
+
+	ret = regulator_bulk_disable(ARRAY_SIZE(gt97xx_supply_names),
+				     gt97xx->supplies);
+	if (ret < 0)
+		dev_err(dev, "failed to disable regulators\n");
+
+	return ret;
+}
+
+static int gt97xx_runtime_suspend(struct device *dev)
+{
+	struct v4l2_subdev *sd = dev_get_drvdata(dev);
+	struct gt97xx *gt97xx = sd_to_gt97xx(sd);
+
+	gt97xx_release(gt97xx);
+	gt97xx_power_off(dev);
+
+	return 0;
+}
+
+static int gt97xx_runtime_resume(struct device *dev)
+{
+	struct v4l2_subdev *sd = dev_get_drvdata(dev);
+	struct gt97xx *gt97xx = sd_to_gt97xx(sd);
+	int ret;
+
+	ret = gt97xx_power_on(dev);
+	if (ret < 0) {
+		dev_err(dev, "failed to power_on\n");
+		return ret;
+	}
+
+	/* Need waited before sending I2C commands after power-up */
+	fsleep(GT97XX_SLEEP_US);
+
+	ret = gt97xx_init(gt97xx);
+	if (ret < 0)
+		goto disable_power;
+
+	return 0;
+
+disable_power:
+	gt97xx_power_off(dev);
+
+	return ret;
+}
+
+static int gt97xx_set_ctrl(struct v4l2_ctrl *ctrl)
+{
+	struct gt97xx *gt97xx =
+		container_of(ctrl->handler, struct gt97xx, ctrls);
+
+	if (ctrl->id == V4L2_CID_FOCUS_ABSOLUTE)
+		return gt97xx_set_dac(gt97xx, ctrl->val);
+
+	return 0;
+}
+
+static const struct v4l2_ctrl_ops gt97xx_ctrl_ops = {
+	.s_ctrl = gt97xx_set_ctrl,
+};
+
+static int gt97xx_open(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh)
+{
+	return pm_runtime_resume_and_get(sd->dev);
+}
+
+static int gt97xx_close(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh)
+{
+	return pm_runtime_put(sd->dev);
+}
+
+static const struct v4l2_subdev_internal_ops gt97xx_int_ops = {
+	.open = gt97xx_open,
+	.close = gt97xx_close,
+};
+
+static const struct v4l2_subdev_core_ops gt97xx_core_ops = {
+	.subscribe_event = v4l2_ctrl_subdev_subscribe_event,
+	.unsubscribe_event = v4l2_event_subdev_unsubscribe,
+};
+
+static const struct v4l2_subdev_ops gt97xx_ops = {
+	.core = &gt97xx_core_ops,
+};
+
+static int gt97xx_init_controls(struct gt97xx *gt97xx)
+{
+	struct v4l2_ctrl_handler *hdl = &gt97xx->ctrls;
+	const struct v4l2_ctrl_ops *ops = &gt97xx_ctrl_ops;
+
+	v4l2_ctrl_handler_init(hdl, 1);
+
+	gt97xx->focus = v4l2_ctrl_new_std(hdl, ops, V4L2_CID_FOCUS_ABSOLUTE, 0,
+					  GT97XX_MAX_FOCUS_POS,
+					  1, 0);
+
+	if (hdl->error)
+		return hdl->error;
+
+	gt97xx->sd.ctrl_handler = hdl;
+
+	return 0;
+}
+
+static int gt97xx_probe(struct i2c_client *client)
+{
+	struct device *dev = &client->dev;
+	struct gt97xx *gt97xx;
+	unsigned int i;
+	int ret;
+
+	gt97xx = devm_kzalloc(dev, sizeof(*gt97xx), GFP_KERNEL);
+	if (!gt97xx)
+		return -ENOMEM;
+
+	gt97xx->regmap = devm_cci_regmap_init_i2c(client, 8);
+	if (IS_ERR(gt97xx->regmap))
+		return dev_err_probe(dev, PTR_ERR(gt97xx->regmap),
+				     "failed to init CCI\n");
+
+	/* Initialize subdev */
+	v4l2_i2c_subdev_init(&gt97xx->sd, client, &gt97xx_ops);
+
+	gt97xx->chip = device_get_match_data(dev);
+
+	for (i = 0; i < ARRAY_SIZE(gt97xx_supply_names); i++)
+		gt97xx->supplies[i].supply = gt97xx_supply_names[i];
+
+	ret = devm_regulator_bulk_get(dev, ARRAY_SIZE(gt97xx_supply_names),
+				      gt97xx->supplies);
+	if (ret < 0)
+		return dev_err_probe(dev, ret,
+				     "failed to get regulators\n");
+
+	/* Initialize controls */
+	ret = gt97xx_init_controls(gt97xx);
+	if (ret)
+		goto err_free_handler;
+
+	/* Initialize subdev */
+	gt97xx->sd.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
+	gt97xx->sd.internal_ops = &gt97xx_int_ops;
+	gt97xx->sd.entity.function = MEDIA_ENT_F_LENS;
+
+	ret = media_entity_pads_init(&gt97xx->sd.entity, 0, NULL);
+	if (ret < 0)
+		goto err_free_handler;
+
+	/* Power on and initialize hardware */
+	ret = gt97xx_runtime_resume(dev);
+	if (ret < 0) {
+		dev_err_probe(dev, ret, "failed to power on\n");
+		goto err_clean_entity;
+	}
+
+	pm_runtime_set_active(dev);
+	pm_runtime_enable(dev);
+	pm_runtime_set_autosuspend_delay(dev, 1000);
+	pm_runtime_use_autosuspend(dev);
+	pm_runtime_idle(dev);
+
+	ret = v4l2_async_register_subdev(&gt97xx->sd);
+	if (ret < 0) {
+		dev_err_probe(dev, ret, "failed to register V4L2 subdev\n");
+		goto err_power_off;
+	}
+
+	return 0;
+
+err_power_off:
+	pm_runtime_disable(dev);
+err_clean_entity:
+	media_entity_cleanup(&gt97xx->sd.entity);
+err_free_handler:
+	v4l2_ctrl_handler_free(&gt97xx->ctrls);
+
+	return ret;
+}
+
+static void gt97xx_remove(struct i2c_client *client)
+{
+	struct v4l2_subdev *sd = i2c_get_clientdata(client);
+	struct gt97xx *gt97xx = sd_to_gt97xx(sd);
+
+	v4l2_async_unregister_subdev(&gt97xx->sd);
+	v4l2_ctrl_handler_free(&gt97xx->ctrls);
+	media_entity_cleanup(&gt97xx->sd.entity);
+	pm_runtime_disable(&client->dev);
+	if (!pm_runtime_status_suspended(&client->dev))
+		gt97xx_runtime_suspend(&client->dev);
+	pm_runtime_set_suspended(&client->dev);
+}
+
+static DEFINE_RUNTIME_DEV_PM_OPS(gt97xx_pm_ops,
+				 gt97xx_runtime_suspend,
+				 gt97xx_runtime_resume,
+				 NULL);
+
+static const struct vcm_giantec_of_data gt9768_data = {
+	.id = GT9768_ID,
+	.regs[GT_IC_INFO_REG] = GT97XX_IC_INFO_REG,
+	.regs[GT_RING_PD_CONTROL_REG] = GT97XX_RING_PD_CONTROL_REG,
+	.regs[GT_DAC_ADDR_REG] = GT97XX_DAC_ADDR_REG,
+};
+
+static const struct vcm_giantec_of_data gt9769_data = {
+	.id = GT9769_ID,
+	.regs[GT_IC_INFO_REG] = GT97XX_IC_INFO_REG,
+	.regs[GT_RING_PD_CONTROL_REG] = GT97XX_RING_PD_CONTROL_REG,
+	.regs[GT_DAC_ADDR_REG] = GT97XX_DAC_ADDR_REG,
+};
+
+static const struct of_device_id gt97xx_of_table[] = {
+	{ .compatible = "giantec,gt9768", .data = &gt9768_data },
+	{ .compatible = "giantec,gt9769", .data = &gt9769_data },
+	{}
+};
+MODULE_DEVICE_TABLE(of, gt97xx_of_table);
+
+static struct i2c_driver gt97xx_i2c_driver = {
+	.driver = {
+		.name = GT97XX_NAME,
+		.pm = pm_ptr(&gt97xx_pm_ops),
+		.of_match_table = gt97xx_of_table,
+	},
+	.probe = gt97xx_probe,
+	.remove = gt97xx_remove,
+};
+module_i2c_driver(gt97xx_i2c_driver);
+
+MODULE_AUTHOR("Zhi Mao <zhi.mao@mediatek.com>");
+MODULE_DESCRIPTION("GT97xx VCM driver");
+MODULE_LICENSE("GPL");
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH v1 2/2] media: i2c: Add GT97xx VCM driver
@ 2024-04-20  1:18   ` Zhi Mao
  0 siblings, 0 replies; 20+ messages in thread
From: Zhi Mao @ 2024-04-20  1:18 UTC (permalink / raw)
  To: Mauro Carvalho Chehab, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley
  Cc: Matthias Brugger, AngeloGioacchino Del Regno, Zhi Mao,
	Philipp Zabel, Laurent Pinchart, Heiko Stuebner, Sakari Ailus,
	Hans Verkuil, Hans de Goede, Tomi Valkeinen, Alain Volmat,
	Paul Elder, Mehdi Djait, Andy Shevchenko, Bingbu Cao, linux-media,
	devicetree, linux-kernel, linux-arm-kernel, linux-mediatek,
	shengnan.wang, yaya.chang, yunkec, 10572168

Add a V4L2 sub-device driver for Giantec GT97xx VCM.

Signed-off-by: Zhi Mao <zhi.mao@mediatek.com>
---
 drivers/media/i2c/Kconfig  |  13 ++
 drivers/media/i2c/Makefile |   1 +
 drivers/media/i2c/gt97xx.c | 436 +++++++++++++++++++++++++++++++++++++
 3 files changed, 450 insertions(+)
 create mode 100644 drivers/media/i2c/gt97xx.c

diff --git a/drivers/media/i2c/Kconfig b/drivers/media/i2c/Kconfig
index 56f276b920ab..fcb330cebfe0 100644
--- a/drivers/media/i2c/Kconfig
+++ b/drivers/media/i2c/Kconfig
@@ -759,6 +759,19 @@ config VIDEO_DW9807_VCM
 	  capability. This is designed for linear control of
 	  voice coil motors, controlled via I2C serial interface.
 
+config VIDEO_GT97XX
+	tristate "GT97xx lens voice coil support"
+	depends on I2C && VIDEO_DEV
+	select MEDIA_CONTROLLER
+	select VIDEO_V4L2_SUBDEV_API
+	select V4L2_FWNODE
+	select V4L2_CCI_I2C
+	help
+	  This is a driver for the GT97xx camera lens voice coil.
+	  GT97xx is a 10 bit DAC with 100mA output current sink
+	  capability. It is designed for linear control of
+	  voice coil motors, controlled via I2C serial interface.
+
 endmenu
 
 menu "Flash devices"
diff --git a/drivers/media/i2c/Makefile b/drivers/media/i2c/Makefile
index dfbe6448b549..af36a7aa3d12 100644
--- a/drivers/media/i2c/Makefile
+++ b/drivers/media/i2c/Makefile
@@ -39,6 +39,7 @@ obj-$(CONFIG_VIDEO_DW9807_VCM) += dw9807-vcm.o
 obj-$(CONFIG_VIDEO_ET8EK8) += et8ek8/
 obj-$(CONFIG_VIDEO_GC0308) += gc0308.o
 obj-$(CONFIG_VIDEO_GC2145) += gc2145.o
+obj-$(CONFIG_VIDEO_GT97XX) += gt97xx.o
 obj-$(CONFIG_VIDEO_HI556) += hi556.o
 obj-$(CONFIG_VIDEO_HI846) += hi846.o
 obj-$(CONFIG_VIDEO_HI847) += hi847.o
diff --git a/drivers/media/i2c/gt97xx.c b/drivers/media/i2c/gt97xx.c
new file mode 100644
index 000000000000..ccae190ffba6
--- /dev/null
+++ b/drivers/media/i2c/gt97xx.c
@@ -0,0 +1,436 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Driver for Giantec gt97xx VCM lens device
+ *
+ * Copyright 2024 MediaTek
+ *
+ * Zhi Mao <zhi.mao@mediatek.com>
+ */
+#include <linux/array_size.h>
+#include <linux/bits.h>
+#include <linux/clk.h>
+#include <linux/container_of.h>
+#include <linux/delay.h>
+#include <linux/device.h>
+#include <linux/err.h>
+#include <linux/gpio/consumer.h>
+#include <linux/mod_devicetable.h>
+#include <linux/pm_runtime.h>
+#include <linux/property.h>
+#include <linux/regulator/consumer.h>
+#include <linux/types.h>
+#include <linux/units.h>
+
+#include <media/v4l2-cci.h>
+#include <media/v4l2-ctrls.h>
+#include <media/v4l2-event.h>
+#include <media/v4l2-fwnode.h>
+#include <media/v4l2-subdev.h>
+
+/* gt97xx chip info register and name */
+#define GT97XX_IC_INFO_REG CCI_REG8(0x00)
+#define GT9768_ID 0xE9
+#define GT9769_ID 0xE1
+#define GT97XX_NAME "gt97xx"
+
+/*
+ * Ring control and Power control register
+ * Bit[1] RING_EN
+ * 0: Direct mode
+ * 1: AAC mode (ringing control mode)
+ * Bit[0] PD
+ * 0: Normal operation mode
+ * 1: Power down mode
+ * requires waiting time after PD reset takes place.
+ */
+#define GT97XX_RING_PD_CONTROL_REG CCI_REG8(0x02)
+#define GT97XX_PD_MODE_OFF 0x00
+#define GT97XX_PD_MODE_EN BIT(0)
+#define GT97XX_AAC_MODE_EN BIT(1)
+
+/*
+ * DAC is a 10bit address to control the VCM position.
+ * DAC_MSB: D[9:8] (ADD: 0x03)
+ * DAC_LSB: D[7:0] (ADD: 0x04)
+ */
+#define GT97XX_DAC_ADDR_REG CCI_REG16(0x03)
+
+#define GT97XX_MOVE_STEPS 16
+#define GT97XX_MAX_FOCUS_POS (BIT(10) - 1)
+
+#define GT97XX_SLEEP_US (1 * USEC_PER_MSEC)
+
+enum vcm_giantec_reg_desc {
+	GT_IC_INFO_REG,
+	GT_RING_PD_CONTROL_REG,
+	GT_DAC_ADDR_REG,
+	GT_MAX_REG
+};
+
+struct vcm_giantec_of_data {
+	unsigned int id;
+	unsigned int regs[GT_MAX_REG];
+};
+
+static const char *const gt97xx_supply_names[] = {
+	"vin",
+	"vdd",
+};
+
+/* gt97xx device structure */
+struct gt97xx {
+	struct v4l2_subdev sd;
+
+	struct regulator_bulk_data supplies[ARRAY_SIZE(gt97xx_supply_names)];
+
+	struct v4l2_ctrl_handler ctrls;
+	struct v4l2_ctrl *focus;
+
+	struct regmap *regmap;
+
+	const struct vcm_giantec_of_data *chip;
+};
+
+static inline struct gt97xx *sd_to_gt97xx(struct v4l2_subdev *subdev)
+{
+	return container_of(subdev, struct gt97xx, sd);
+}
+
+struct regval_list {
+	u8 reg_num;
+	u8 value;
+};
+
+static int gt97xx_set_dac(struct gt97xx *gt97xx, u16 val)
+{
+	/* Write VCM position to registers */
+	return cci_write(gt97xx->regmap,
+			 gt97xx->chip->regs[GT_DAC_ADDR_REG], val, NULL);
+}
+
+static int gt97xx_identify_module(struct gt97xx *gt97xx)
+{
+	int ret;
+	u64 ic_id;
+	struct i2c_client *client = v4l2_get_subdevdata(&gt97xx->sd);
+
+	ret = cci_read(gt97xx->regmap, gt97xx->chip->regs[GT_IC_INFO_REG],
+		       &ic_id, NULL);
+	if (ret < 0)
+		return ret;
+
+	if (ic_id != gt97xx->chip->id) {
+		dev_err(&client->dev, "chip id mismatch: 0x%x!=0x%llx",
+			gt97xx->chip->id, ic_id);
+		return -1;
+	}
+
+	return 0;
+}
+
+static int gt97xx_init(struct gt97xx *gt97xx)
+{
+	int ret, val;
+
+	ret = gt97xx_identify_module(gt97xx);
+	if (ret < 0)
+		return ret;
+
+	/* Reset PD_CONTROL */
+	ret = cci_write(gt97xx->regmap,
+			gt97xx->chip->regs[GT_RING_PD_CONTROL_REG],
+			GT97XX_PD_MODE_OFF, NULL);
+	if (ret < 0)
+		return ret;
+
+	/* Need waiting delay time after PD reset */
+	fsleep(GT97XX_SLEEP_US);
+
+	/* Enable ACC mode */
+	ret = cci_write(gt97xx->regmap,
+			gt97xx->chip->regs[GT_RING_PD_CONTROL_REG],
+			GT97XX_AAC_MODE_EN, NULL);
+	if (ret < 0)
+		return ret;
+
+	for (val = gt97xx->focus->val % GT97XX_MOVE_STEPS;
+	     val <= gt97xx->focus->val; val += GT97XX_MOVE_STEPS) {
+		ret = gt97xx_set_dac(gt97xx, val);
+		if (ret)
+			return ret;
+
+		fsleep(GT97XX_SLEEP_US);
+	}
+
+	return 0;
+}
+
+static int gt97xx_release(struct gt97xx *gt97xx)
+{
+	int ret, val;
+
+	val = round_down(gt97xx->focus->val, GT97XX_MOVE_STEPS);
+	for (; val >= 0; val -= GT97XX_MOVE_STEPS) {
+		ret = gt97xx_set_dac(gt97xx, val);
+		if (ret)
+			return ret;
+
+		fsleep(GT97XX_SLEEP_US);
+	}
+
+	return 0;
+}
+
+static int gt97xx_power_on(struct device *dev)
+{
+	struct v4l2_subdev *sd = dev_get_drvdata(dev);
+	struct gt97xx *gt97xx = sd_to_gt97xx(sd);
+	int ret;
+
+	ret = regulator_bulk_enable(ARRAY_SIZE(gt97xx_supply_names),
+				    gt97xx->supplies);
+	if (ret < 0)
+		dev_err(dev, "failed to enable regulators\n");
+
+	return ret;
+}
+
+static int gt97xx_power_off(struct device *dev)
+{
+	struct v4l2_subdev *sd = dev_get_drvdata(dev);
+	struct gt97xx *gt97xx = sd_to_gt97xx(sd);
+	int ret;
+
+	ret = regulator_bulk_disable(ARRAY_SIZE(gt97xx_supply_names),
+				     gt97xx->supplies);
+	if (ret < 0)
+		dev_err(dev, "failed to disable regulators\n");
+
+	return ret;
+}
+
+static int gt97xx_runtime_suspend(struct device *dev)
+{
+	struct v4l2_subdev *sd = dev_get_drvdata(dev);
+	struct gt97xx *gt97xx = sd_to_gt97xx(sd);
+
+	gt97xx_release(gt97xx);
+	gt97xx_power_off(dev);
+
+	return 0;
+}
+
+static int gt97xx_runtime_resume(struct device *dev)
+{
+	struct v4l2_subdev *sd = dev_get_drvdata(dev);
+	struct gt97xx *gt97xx = sd_to_gt97xx(sd);
+	int ret;
+
+	ret = gt97xx_power_on(dev);
+	if (ret < 0) {
+		dev_err(dev, "failed to power_on\n");
+		return ret;
+	}
+
+	/* Need waited before sending I2C commands after power-up */
+	fsleep(GT97XX_SLEEP_US);
+
+	ret = gt97xx_init(gt97xx);
+	if (ret < 0)
+		goto disable_power;
+
+	return 0;
+
+disable_power:
+	gt97xx_power_off(dev);
+
+	return ret;
+}
+
+static int gt97xx_set_ctrl(struct v4l2_ctrl *ctrl)
+{
+	struct gt97xx *gt97xx =
+		container_of(ctrl->handler, struct gt97xx, ctrls);
+
+	if (ctrl->id == V4L2_CID_FOCUS_ABSOLUTE)
+		return gt97xx_set_dac(gt97xx, ctrl->val);
+
+	return 0;
+}
+
+static const struct v4l2_ctrl_ops gt97xx_ctrl_ops = {
+	.s_ctrl = gt97xx_set_ctrl,
+};
+
+static int gt97xx_open(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh)
+{
+	return pm_runtime_resume_and_get(sd->dev);
+}
+
+static int gt97xx_close(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh)
+{
+	return pm_runtime_put(sd->dev);
+}
+
+static const struct v4l2_subdev_internal_ops gt97xx_int_ops = {
+	.open = gt97xx_open,
+	.close = gt97xx_close,
+};
+
+static const struct v4l2_subdev_core_ops gt97xx_core_ops = {
+	.subscribe_event = v4l2_ctrl_subdev_subscribe_event,
+	.unsubscribe_event = v4l2_event_subdev_unsubscribe,
+};
+
+static const struct v4l2_subdev_ops gt97xx_ops = {
+	.core = &gt97xx_core_ops,
+};
+
+static int gt97xx_init_controls(struct gt97xx *gt97xx)
+{
+	struct v4l2_ctrl_handler *hdl = &gt97xx->ctrls;
+	const struct v4l2_ctrl_ops *ops = &gt97xx_ctrl_ops;
+
+	v4l2_ctrl_handler_init(hdl, 1);
+
+	gt97xx->focus = v4l2_ctrl_new_std(hdl, ops, V4L2_CID_FOCUS_ABSOLUTE, 0,
+					  GT97XX_MAX_FOCUS_POS,
+					  1, 0);
+
+	if (hdl->error)
+		return hdl->error;
+
+	gt97xx->sd.ctrl_handler = hdl;
+
+	return 0;
+}
+
+static int gt97xx_probe(struct i2c_client *client)
+{
+	struct device *dev = &client->dev;
+	struct gt97xx *gt97xx;
+	unsigned int i;
+	int ret;
+
+	gt97xx = devm_kzalloc(dev, sizeof(*gt97xx), GFP_KERNEL);
+	if (!gt97xx)
+		return -ENOMEM;
+
+	gt97xx->regmap = devm_cci_regmap_init_i2c(client, 8);
+	if (IS_ERR(gt97xx->regmap))
+		return dev_err_probe(dev, PTR_ERR(gt97xx->regmap),
+				     "failed to init CCI\n");
+
+	/* Initialize subdev */
+	v4l2_i2c_subdev_init(&gt97xx->sd, client, &gt97xx_ops);
+
+	gt97xx->chip = device_get_match_data(dev);
+
+	for (i = 0; i < ARRAY_SIZE(gt97xx_supply_names); i++)
+		gt97xx->supplies[i].supply = gt97xx_supply_names[i];
+
+	ret = devm_regulator_bulk_get(dev, ARRAY_SIZE(gt97xx_supply_names),
+				      gt97xx->supplies);
+	if (ret < 0)
+		return dev_err_probe(dev, ret,
+				     "failed to get regulators\n");
+
+	/* Initialize controls */
+	ret = gt97xx_init_controls(gt97xx);
+	if (ret)
+		goto err_free_handler;
+
+	/* Initialize subdev */
+	gt97xx->sd.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
+	gt97xx->sd.internal_ops = &gt97xx_int_ops;
+	gt97xx->sd.entity.function = MEDIA_ENT_F_LENS;
+
+	ret = media_entity_pads_init(&gt97xx->sd.entity, 0, NULL);
+	if (ret < 0)
+		goto err_free_handler;
+
+	/* Power on and initialize hardware */
+	ret = gt97xx_runtime_resume(dev);
+	if (ret < 0) {
+		dev_err_probe(dev, ret, "failed to power on\n");
+		goto err_clean_entity;
+	}
+
+	pm_runtime_set_active(dev);
+	pm_runtime_enable(dev);
+	pm_runtime_set_autosuspend_delay(dev, 1000);
+	pm_runtime_use_autosuspend(dev);
+	pm_runtime_idle(dev);
+
+	ret = v4l2_async_register_subdev(&gt97xx->sd);
+	if (ret < 0) {
+		dev_err_probe(dev, ret, "failed to register V4L2 subdev\n");
+		goto err_power_off;
+	}
+
+	return 0;
+
+err_power_off:
+	pm_runtime_disable(dev);
+err_clean_entity:
+	media_entity_cleanup(&gt97xx->sd.entity);
+err_free_handler:
+	v4l2_ctrl_handler_free(&gt97xx->ctrls);
+
+	return ret;
+}
+
+static void gt97xx_remove(struct i2c_client *client)
+{
+	struct v4l2_subdev *sd = i2c_get_clientdata(client);
+	struct gt97xx *gt97xx = sd_to_gt97xx(sd);
+
+	v4l2_async_unregister_subdev(&gt97xx->sd);
+	v4l2_ctrl_handler_free(&gt97xx->ctrls);
+	media_entity_cleanup(&gt97xx->sd.entity);
+	pm_runtime_disable(&client->dev);
+	if (!pm_runtime_status_suspended(&client->dev))
+		gt97xx_runtime_suspend(&client->dev);
+	pm_runtime_set_suspended(&client->dev);
+}
+
+static DEFINE_RUNTIME_DEV_PM_OPS(gt97xx_pm_ops,
+				 gt97xx_runtime_suspend,
+				 gt97xx_runtime_resume,
+				 NULL);
+
+static const struct vcm_giantec_of_data gt9768_data = {
+	.id = GT9768_ID,
+	.regs[GT_IC_INFO_REG] = GT97XX_IC_INFO_REG,
+	.regs[GT_RING_PD_CONTROL_REG] = GT97XX_RING_PD_CONTROL_REG,
+	.regs[GT_DAC_ADDR_REG] = GT97XX_DAC_ADDR_REG,
+};
+
+static const struct vcm_giantec_of_data gt9769_data = {
+	.id = GT9769_ID,
+	.regs[GT_IC_INFO_REG] = GT97XX_IC_INFO_REG,
+	.regs[GT_RING_PD_CONTROL_REG] = GT97XX_RING_PD_CONTROL_REG,
+	.regs[GT_DAC_ADDR_REG] = GT97XX_DAC_ADDR_REG,
+};
+
+static const struct of_device_id gt97xx_of_table[] = {
+	{ .compatible = "giantec,gt9768", .data = &gt9768_data },
+	{ .compatible = "giantec,gt9769", .data = &gt9769_data },
+	{}
+};
+MODULE_DEVICE_TABLE(of, gt97xx_of_table);
+
+static struct i2c_driver gt97xx_i2c_driver = {
+	.driver = {
+		.name = GT97XX_NAME,
+		.pm = pm_ptr(&gt97xx_pm_ops),
+		.of_match_table = gt97xx_of_table,
+	},
+	.probe = gt97xx_probe,
+	.remove = gt97xx_remove,
+};
+module_i2c_driver(gt97xx_i2c_driver);
+
+MODULE_AUTHOR("Zhi Mao <zhi.mao@mediatek.com>");
+MODULE_DESCRIPTION("GT97xx VCM driver");
+MODULE_LICENSE("GPL");
-- 
2.25.1


_______________________________________________
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: [PATCH v1 1/2] media: dt-bindings: i2c: add Giantec GT97xx VCM
  2024-04-20  1:18   ` Zhi Mao
@ 2024-04-20 11:21     ` Krzysztof Kozlowski
  -1 siblings, 0 replies; 20+ messages in thread
From: Krzysztof Kozlowski @ 2024-04-20 11:21 UTC (permalink / raw)
  To: Zhi Mao, Mauro Carvalho Chehab, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley
  Cc: Matthias Brugger, AngeloGioacchino Del Regno, Philipp Zabel,
	Laurent Pinchart, Heiko Stuebner, Sakari Ailus, Hans Verkuil,
	Hans de Goede, Tomi Valkeinen, Alain Volmat, Paul Elder,
	Mehdi Djait, Andy Shevchenko, Bingbu Cao, linux-media, devicetree,
	linux-kernel, linux-arm-kernel, linux-mediatek, shengnan.wang,
	yaya.chang, yunkec, 10572168

On 20/04/2024 03:18, Zhi Mao wrote:
> Add YAML device tree binding for GT9768 & GT8769 VCM,
> and the relevant MAINTAINERS entries.
> 
> Signed-off-by: Zhi Mao <zhi.mao@mediatek.com>
> ---

Sorry, there was v1. Please do not send same versions twice. BTW, use
patman or b4 for your submissions if versioning is tricky.

Best regards,
Krzysztof


^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH v1 1/2] media: dt-bindings: i2c: add Giantec GT97xx VCM
@ 2024-04-20 11:21     ` Krzysztof Kozlowski
  0 siblings, 0 replies; 20+ messages in thread
From: Krzysztof Kozlowski @ 2024-04-20 11:21 UTC (permalink / raw)
  To: Zhi Mao, Mauro Carvalho Chehab, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley
  Cc: Matthias Brugger, AngeloGioacchino Del Regno, Philipp Zabel,
	Laurent Pinchart, Heiko Stuebner, Sakari Ailus, Hans Verkuil,
	Hans de Goede, Tomi Valkeinen, Alain Volmat, Paul Elder,
	Mehdi Djait, Andy Shevchenko, Bingbu Cao, linux-media, devicetree,
	linux-kernel, linux-arm-kernel, linux-mediatek, shengnan.wang,
	yaya.chang, yunkec, 10572168

On 20/04/2024 03:18, Zhi Mao wrote:
> Add YAML device tree binding for GT9768 & GT8769 VCM,
> and the relevant MAINTAINERS entries.
> 
> Signed-off-by: Zhi Mao <zhi.mao@mediatek.com>
> ---

Sorry, there was v1. Please do not send same versions twice. BTW, use
patman or b4 for your submissions if versioning is tricky.

Best regards,
Krzysztof


_______________________________________________
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: [PATCH v1 1/2] media: dt-bindings: i2c: add Giantec GT97xx VCM
  2024-04-20 11:21     ` Krzysztof Kozlowski
@ 2024-04-20 12:53       ` Kieran Bingham
  -1 siblings, 0 replies; 20+ messages in thread
From: Kieran Bingham @ 2024-04-20 12:53 UTC (permalink / raw)
  To: Conor Dooley, Krzysztof Kozlowski, Krzysztof Kozlowski,
	Mauro Carvalho Chehab, Rob Herring, Zhi Mao
  Cc: Matthias Brugger, AngeloGioacchino Del Regno, Philipp Zabel,
	Laurent Pinchart, Heiko Stuebner, Sakari Ailus, Hans Verkuil,
	Hans de Goede, Tomi Valkeinen, Alain Volmat, Paul Elder,
	Mehdi Djait, Andy Shevchenko, Bingbu Cao, linux-media, devicetree,
	linux-kernel, linux-arm-kernel, linux-mediatek, shengnan.wang,
	yaya.chang, yunkec, 10572168

Quoting Krzysztof Kozlowski (2024-04-20 12:21:46)
> On 20/04/2024 03:18, Zhi Mao wrote:
> > Add YAML device tree binding for GT9768 & GT8769 VCM,
> > and the relevant MAINTAINERS entries.
> > 
> > Signed-off-by: Zhi Mao <zhi.mao@mediatek.com>
> > ---
> 
> Sorry, there was v1. Please do not send same versions twice. BTW, use
> patman or b4 for your submissions if versioning is tricky.
> 

Whats Patman? google returns false positives for me.
--
Kieran

> Best regards,
> Krzysztof
>

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH v1 1/2] media: dt-bindings: i2c: add Giantec GT97xx VCM
@ 2024-04-20 12:53       ` Kieran Bingham
  0 siblings, 0 replies; 20+ messages in thread
From: Kieran Bingham @ 2024-04-20 12:53 UTC (permalink / raw)
  To: Conor Dooley, Krzysztof Kozlowski, Krzysztof Kozlowski,
	Mauro Carvalho Chehab, Rob Herring, Zhi Mao
  Cc: Matthias Brugger, AngeloGioacchino Del Regno, Philipp Zabel,
	Laurent Pinchart, Heiko Stuebner, Sakari Ailus, Hans Verkuil,
	Hans de Goede, Tomi Valkeinen, Alain Volmat, Paul Elder,
	Mehdi Djait, Andy Shevchenko, Bingbu Cao, linux-media, devicetree,
	linux-kernel, linux-arm-kernel, linux-mediatek, shengnan.wang,
	yaya.chang, yunkec, 10572168

Quoting Krzysztof Kozlowski (2024-04-20 12:21:46)
> On 20/04/2024 03:18, Zhi Mao wrote:
> > Add YAML device tree binding for GT9768 & GT8769 VCM,
> > and the relevant MAINTAINERS entries.
> > 
> > Signed-off-by: Zhi Mao <zhi.mao@mediatek.com>
> > ---
> 
> Sorry, there was v1. Please do not send same versions twice. BTW, use
> patman or b4 for your submissions if versioning is tricky.
> 

Whats Patman? google returns false positives for me.
--
Kieran

> Best regards,
> Krzysztof
>

_______________________________________________
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: [PATCH v1 1/2] media: dt-bindings: i2c: add Giantec GT97xx VCM
  2024-04-20 12:53       ` Kieran Bingham
@ 2024-04-21 11:35         ` Kieran Bingham
  -1 siblings, 0 replies; 20+ messages in thread
From: Kieran Bingham @ 2024-04-21 11:35 UTC (permalink / raw)
  To: Conor Dooley, Krzysztof Kozlowski, Krzysztof Kozlowski,
	Mauro Carvalho Chehab, Rob Herring, Zhi Mao
  Cc: Matthias Brugger, AngeloGioacchino Del Regno, Philipp Zabel,
	Laurent Pinchart, Heiko Stuebner, Sakari Ailus, Hans Verkuil,
	Hans de Goede, Tomi Valkeinen, Alain Volmat, Paul Elder,
	Mehdi Djait, Andy Shevchenko, Bingbu Cao, linux-media, devicetree,
	linux-kernel, linux-arm-kernel, linux-mediatek, shengnan.wang,
	yaya.chang, yunkec, 10572168

Quoting Kieran Bingham (2024-04-20 13:53:01)
> Quoting Krzysztof Kozlowski (2024-04-20 12:21:46)
> > On 20/04/2024 03:18, Zhi Mao wrote:
> > > Add YAML device tree binding for GT9768 & GT8769 VCM,
> > > and the relevant MAINTAINERS entries.
> > > 
> > > Signed-off-by: Zhi Mao <zhi.mao@mediatek.com>
> > > ---
> > 
> > Sorry, there was v1. Please do not send same versions twice. BTW, use
> > patman or b4 for your submissions if versioning is tricky.
> > 
> 
> Whats Patman? google returns false positives for me.

Digging deeper, I've discovered patman comes from the u-boot project,
and is known as 'patch manager', and can work along side patchwork.

 - https://docs.u-boot.org/en/latest/develop/patman.html


For completeness, b4 (which I've already used myself) is more closely
associated with public inbox.

 - https://github.com/mricon/b4


> --
> Kieran
> 
> > Best regards,
> > Krzysztof
> >

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH v1 1/2] media: dt-bindings: i2c: add Giantec GT97xx VCM
@ 2024-04-21 11:35         ` Kieran Bingham
  0 siblings, 0 replies; 20+ messages in thread
From: Kieran Bingham @ 2024-04-21 11:35 UTC (permalink / raw)
  To: Conor Dooley, Krzysztof Kozlowski, Krzysztof Kozlowski,
	Mauro Carvalho Chehab, Rob Herring, Zhi Mao
  Cc: Matthias Brugger, AngeloGioacchino Del Regno, Philipp Zabel,
	Laurent Pinchart, Heiko Stuebner, Sakari Ailus, Hans Verkuil,
	Hans de Goede, Tomi Valkeinen, Alain Volmat, Paul Elder,
	Mehdi Djait, Andy Shevchenko, Bingbu Cao, linux-media, devicetree,
	linux-kernel, linux-arm-kernel, linux-mediatek, shengnan.wang,
	yaya.chang, yunkec, 10572168

Quoting Kieran Bingham (2024-04-20 13:53:01)
> Quoting Krzysztof Kozlowski (2024-04-20 12:21:46)
> > On 20/04/2024 03:18, Zhi Mao wrote:
> > > Add YAML device tree binding for GT9768 & GT8769 VCM,
> > > and the relevant MAINTAINERS entries.
> > > 
> > > Signed-off-by: Zhi Mao <zhi.mao@mediatek.com>
> > > ---
> > 
> > Sorry, there was v1. Please do not send same versions twice. BTW, use
> > patman or b4 for your submissions if versioning is tricky.
> > 
> 
> Whats Patman? google returns false positives for me.

Digging deeper, I've discovered patman comes from the u-boot project,
and is known as 'patch manager', and can work along side patchwork.

 - https://docs.u-boot.org/en/latest/develop/patman.html


For completeness, b4 (which I've already used myself) is more closely
associated with public inbox.

 - https://github.com/mricon/b4


> --
> Kieran
> 
> > Best regards,
> > Krzysztof
> >

_______________________________________________
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: [PATCH v1 1/2] media: dt-bindings: i2c: add Giantec GT97xx VCM
  2024-04-21 11:35         ` Kieran Bingham
@ 2024-04-21 14:00           ` Krzysztof Kozlowski
  -1 siblings, 0 replies; 20+ messages in thread
From: Krzysztof Kozlowski @ 2024-04-21 14:00 UTC (permalink / raw)
  To: Kieran Bingham, Conor Dooley, Krzysztof Kozlowski,
	Mauro Carvalho Chehab, Rob Herring, Zhi Mao
  Cc: Matthias Brugger, AngeloGioacchino Del Regno, Philipp Zabel,
	Laurent Pinchart, Heiko Stuebner, Sakari Ailus, Hans Verkuil,
	Hans de Goede, Tomi Valkeinen, Alain Volmat, Paul Elder,
	Mehdi Djait, Andy Shevchenko, Bingbu Cao, linux-media, devicetree,
	linux-kernel, linux-arm-kernel, linux-mediatek, shengnan.wang,
	yaya.chang, yunkec, 10572168

On 21/04/2024 13:35, Kieran Bingham wrote:
> Quoting Kieran Bingham (2024-04-20 13:53:01)
>> Quoting Krzysztof Kozlowski (2024-04-20 12:21:46)
>>> On 20/04/2024 03:18, Zhi Mao wrote:
>>>> Add YAML device tree binding for GT9768 & GT8769 VCM,
>>>> and the relevant MAINTAINERS entries.
>>>>
>>>> Signed-off-by: Zhi Mao <zhi.mao@mediatek.com>
>>>> ---
>>>
>>> Sorry, there was v1. Please do not send same versions twice. BTW, use
>>> patman or b4 for your submissions if versioning is tricky.
>>>
>>
>> Whats Patman? google returns false positives for me.
> 
> Digging deeper, I've discovered patman comes from the u-boot project,
> and is known as 'patch manager', and can work along side patchwork.
> 
>  - https://docs.u-boot.org/en/latest/develop/patman.html

Patman is the tool brought for U-boot and used a lot within some of
Chromebook folks, quite powerful. Now most of the community uses b4, but
for completeness I proposed patman (which has few nice features not
present in b4). See Doug's talk from this EOSS.

Best regards,
Krzysztof


^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH v1 1/2] media: dt-bindings: i2c: add Giantec GT97xx VCM
@ 2024-04-21 14:00           ` Krzysztof Kozlowski
  0 siblings, 0 replies; 20+ messages in thread
From: Krzysztof Kozlowski @ 2024-04-21 14:00 UTC (permalink / raw)
  To: Kieran Bingham, Conor Dooley, Krzysztof Kozlowski,
	Mauro Carvalho Chehab, Rob Herring, Zhi Mao
  Cc: Matthias Brugger, AngeloGioacchino Del Regno, Philipp Zabel,
	Laurent Pinchart, Heiko Stuebner, Sakari Ailus, Hans Verkuil,
	Hans de Goede, Tomi Valkeinen, Alain Volmat, Paul Elder,
	Mehdi Djait, Andy Shevchenko, Bingbu Cao, linux-media, devicetree,
	linux-kernel, linux-arm-kernel, linux-mediatek, shengnan.wang,
	yaya.chang, yunkec, 10572168

On 21/04/2024 13:35, Kieran Bingham wrote:
> Quoting Kieran Bingham (2024-04-20 13:53:01)
>> Quoting Krzysztof Kozlowski (2024-04-20 12:21:46)
>>> On 20/04/2024 03:18, Zhi Mao wrote:
>>>> Add YAML device tree binding for GT9768 & GT8769 VCM,
>>>> and the relevant MAINTAINERS entries.
>>>>
>>>> Signed-off-by: Zhi Mao <zhi.mao@mediatek.com>
>>>> ---
>>>
>>> Sorry, there was v1. Please do not send same versions twice. BTW, use
>>> patman or b4 for your submissions if versioning is tricky.
>>>
>>
>> Whats Patman? google returns false positives for me.
> 
> Digging deeper, I've discovered patman comes from the u-boot project,
> and is known as 'patch manager', and can work along side patchwork.
> 
>  - https://docs.u-boot.org/en/latest/develop/patman.html

Patman is the tool brought for U-boot and used a lot within some of
Chromebook folks, quite powerful. Now most of the community uses b4, but
for completeness I proposed patman (which has few nice features not
present in b4). See Doug's talk from this EOSS.

Best regards,
Krzysztof


_______________________________________________
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: [PATCH v1 1/2] media: dt-bindings: i2c: add Giantec GT97xx VCM
  2024-04-20 11:21     ` Krzysztof Kozlowski
@ 2024-04-22  1:49       ` Zhi Mao (毛智)
  -1 siblings, 0 replies; 20+ messages in thread
From: Zhi Mao (毛智) @ 2024-04-22  1:49 UTC (permalink / raw)
  To: robh@kernel.org, mchehab@kernel.org, krzk+dt@kernel.org,
	conor+dt@kernel.org, krzk@kernel.org
  Cc: heiko@sntech.de, linux-kernel@vger.kernel.org,
	laurent.pinchart+renesas@ideasonboard.com, yunkec@chromium.org,
	linux-mediatek@lists.infradead.org, linux-media@vger.kernel.org,
	hdegoede@redhat.com, bingbu.cao@intel.com,
	paul.elder@ideasonboard.com, devicetree@vger.kernel.org,
	andy.shevchenko@gmail.com, Yaya Chang (張雅清),
	Shengnan Wang (王圣男), p.zabel@pengutronix.de,
	alain.volmat@foss.st.com, sakari.ailus@linux.intel.com,
	tomi.valkeinen@ideasonboard.com, 10572168@qq.com,
	hverkuil-cisco@xs4all.nl, linux-arm-kernel@lists.infradead.org,
	matthias.bgg@gmail.com, mehdi.djait@bootlin.com,
	angelogioacchino.delregno@collabora.com

Hi, Krzysztof

Thanks for your feedback.

On Sat, 2024-04-20 at 13:21 +0200, Krzysztof Kozlowski wrote:
>  	 
> External email : Please do not click links or open attachments until
> you have verified the sender or the content.
>  On 20/04/2024 03:18, Zhi Mao wrote:
> > Add YAML device tree binding for GT9768 & GT8769 VCM,
> > and the relevant MAINTAINERS entries.
> > 
> > Signed-off-by: Zhi Mao <zhi.mao@mediatek.com>
> > ---
> 
> Sorry, there was v1. Please do not send same versions twice. BTW, use
> patman or b4 for your submissions if versioning is tricky.
> 
Sorry, it make you confused.
As we create the version number from "0" base, they are supposed as
v0/v1/...
So, the previouse version is:
v0: 
https://lore.kernel.org/all/20240410104002.1197-1-zhi.mao@mediatek.com/

If necessary, I can send a new v2 patch.
Do we need do it?

> Best regards,
> Krzysztof
> 

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH v1 1/2] media: dt-bindings: i2c: add Giantec GT97xx VCM
@ 2024-04-22  1:49       ` Zhi Mao (毛智)
  0 siblings, 0 replies; 20+ messages in thread
From: Zhi Mao (毛智) @ 2024-04-22  1:49 UTC (permalink / raw)
  To: robh@kernel.org, mchehab@kernel.org, krzk+dt@kernel.org,
	conor+dt@kernel.org, krzk@kernel.org
  Cc: heiko@sntech.de, linux-kernel@vger.kernel.org,
	laurent.pinchart+renesas@ideasonboard.com, yunkec@chromium.org,
	linux-mediatek@lists.infradead.org, linux-media@vger.kernel.org,
	hdegoede@redhat.com, bingbu.cao@intel.com,
	paul.elder@ideasonboard.com, devicetree@vger.kernel.org,
	andy.shevchenko@gmail.com, Yaya Chang (張雅清),
	Shengnan Wang (王圣男), p.zabel@pengutronix.de,
	alain.volmat@foss.st.com, sakari.ailus@linux.intel.com,
	tomi.valkeinen@ideasonboard.com, 10572168@qq.com,
	hverkuil-cisco@xs4all.nl, linux-arm-kernel@lists.infradead.org,
	matthias.bgg@gmail.com, mehdi.djait@bootlin.com,
	angelogioacchino.delregno@collabora.com

Hi, Krzysztof

Thanks for your feedback.

On Sat, 2024-04-20 at 13:21 +0200, Krzysztof Kozlowski wrote:
>  	 
> External email : Please do not click links or open attachments until
> you have verified the sender or the content.
>  On 20/04/2024 03:18, Zhi Mao wrote:
> > Add YAML device tree binding for GT9768 & GT8769 VCM,
> > and the relevant MAINTAINERS entries.
> > 
> > Signed-off-by: Zhi Mao <zhi.mao@mediatek.com>
> > ---
> 
> Sorry, there was v1. Please do not send same versions twice. BTW, use
> patman or b4 for your submissions if versioning is tricky.
> 
Sorry, it make you confused.
As we create the version number from "0" base, they are supposed as
v0/v1/...
So, the previouse version is:
v0: 
https://lore.kernel.org/all/20240410104002.1197-1-zhi.mao@mediatek.com/

If necessary, I can send a new v2 patch.
Do we need do it?

> Best regards,
> Krzysztof
> 
_______________________________________________
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: [PATCH v1 1/2] media: dt-bindings: i2c: add Giantec GT97xx VCM
  2024-04-22  1:49       ` Zhi Mao (毛智)
@ 2024-04-22  3:18         ` Krzysztof Kozlowski
  -1 siblings, 0 replies; 20+ messages in thread
From: Krzysztof Kozlowski @ 2024-04-22  3:18 UTC (permalink / raw)
  To: Zhi Mao (毛智), robh@kernel.org, mchehab@kernel.org,
	krzk+dt@kernel.org, conor+dt@kernel.org
  Cc: heiko@sntech.de, linux-kernel@vger.kernel.org,
	laurent.pinchart+renesas@ideasonboard.com, yunkec@chromium.org,
	linux-mediatek@lists.infradead.org, linux-media@vger.kernel.org,
	hdegoede@redhat.com, bingbu.cao@intel.com,
	paul.elder@ideasonboard.com, devicetree@vger.kernel.org,
	andy.shevchenko@gmail.com, Yaya Chang (張雅清),
	Shengnan Wang (王圣男), p.zabel@pengutronix.de,
	alain.volmat@foss.st.com, sakari.ailus@linux.intel.com,
	tomi.valkeinen@ideasonboard.com, 10572168@qq.com,
	hverkuil-cisco@xs4all.nl, linux-arm-kernel@lists.infradead.org,
	matthias.bgg@gmail.com, mehdi.djait@bootlin.com,
	angelogioacchino.delregno@collabora.com

On 22/04/2024 03:49, Zhi Mao (毛智) wrote:
> Hi, Krzysztof
> 
> Thanks for your feedback.
> 
> On Sat, 2024-04-20 at 13:21 +0200, Krzysztof Kozlowski wrote:
>>  	 
>> External email : Please do not click links or open attachments until
>> you have verified the sender or the content.
>>  On 20/04/2024 03:18, Zhi Mao wrote:
>>> Add YAML device tree binding for GT9768 & GT8769 VCM,
>>> and the relevant MAINTAINERS entries.
>>>
>>> Signed-off-by: Zhi Mao <zhi.mao@mediatek.com>
>>> ---
>>
>> Sorry, there was v1. Please do not send same versions twice. BTW, use
>> patman or b4 for your submissions if versioning is tricky.
>>
> Sorry, it make you confused.
> As we create the version number from "0" base, they are supposed as

No, we don't. Use the tools if you cannot get it right.

> v0/v1/...
> So, the previouse version is:
> v0: 
> https://lore.kernel.org/all/20240410104002.1197-1-zhi.mao@mediatek.com/
> 
> If necessary, I can send a new v2 patch.
> Do we need do it?

When you look through the window outside and you see cars passing by, do
you count them from 0? Car drivers, I see 0 car. Next car drivers, I see
1 (first) car?

Please use b4 to version this properly.

No need for v2. I will get to review this.

Best regards,
Krzysztof


^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH v1 1/2] media: dt-bindings: i2c: add Giantec GT97xx VCM
@ 2024-04-22  3:18         ` Krzysztof Kozlowski
  0 siblings, 0 replies; 20+ messages in thread
From: Krzysztof Kozlowski @ 2024-04-22  3:18 UTC (permalink / raw)
  To: Zhi Mao (毛智), robh@kernel.org, mchehab@kernel.org,
	krzk+dt@kernel.org, conor+dt@kernel.org
  Cc: heiko@sntech.de, linux-kernel@vger.kernel.org,
	laurent.pinchart+renesas@ideasonboard.com, yunkec@chromium.org,
	linux-mediatek@lists.infradead.org, linux-media@vger.kernel.org,
	hdegoede@redhat.com, bingbu.cao@intel.com,
	paul.elder@ideasonboard.com, devicetree@vger.kernel.org,
	andy.shevchenko@gmail.com, Yaya Chang (張雅清),
	Shengnan Wang (王圣男), p.zabel@pengutronix.de,
	alain.volmat@foss.st.com, sakari.ailus@linux.intel.com,
	tomi.valkeinen@ideasonboard.com, 10572168@qq.com,
	hverkuil-cisco@xs4all.nl, linux-arm-kernel@lists.infradead.org,
	matthias.bgg@gmail.com, mehdi.djait@bootlin.com,
	angelogioacchino.delregno@collabora.com

On 22/04/2024 03:49, Zhi Mao (毛智) wrote:
> Hi, Krzysztof
> 
> Thanks for your feedback.
> 
> On Sat, 2024-04-20 at 13:21 +0200, Krzysztof Kozlowski wrote:
>>  	 
>> External email : Please do not click links or open attachments until
>> you have verified the sender or the content.
>>  On 20/04/2024 03:18, Zhi Mao wrote:
>>> Add YAML device tree binding for GT9768 & GT8769 VCM,
>>> and the relevant MAINTAINERS entries.
>>>
>>> Signed-off-by: Zhi Mao <zhi.mao@mediatek.com>
>>> ---
>>
>> Sorry, there was v1. Please do not send same versions twice. BTW, use
>> patman or b4 for your submissions if versioning is tricky.
>>
> Sorry, it make you confused.
> As we create the version number from "0" base, they are supposed as

No, we don't. Use the tools if you cannot get it right.

> v0/v1/...
> So, the previouse version is:
> v0: 
> https://lore.kernel.org/all/20240410104002.1197-1-zhi.mao@mediatek.com/
> 
> If necessary, I can send a new v2 patch.
> Do we need do it?

When you look through the window outside and you see cars passing by, do
you count them from 0? Car drivers, I see 0 car. Next car drivers, I see
1 (first) car?

Please use b4 to version this properly.

No need for v2. I will get to review this.

Best regards,
Krzysztof


_______________________________________________
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: [PATCH v1 1/2] media: dt-bindings: i2c: add Giantec GT97xx VCM
  2024-04-20  1:18   ` Zhi Mao
@ 2024-04-22  3:26     ` Krzysztof Kozlowski
  -1 siblings, 0 replies; 20+ messages in thread
From: Krzysztof Kozlowski @ 2024-04-22  3:26 UTC (permalink / raw)
  To: Zhi Mao, Mauro Carvalho Chehab, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley
  Cc: Matthias Brugger, AngeloGioacchino Del Regno, Philipp Zabel,
	Laurent Pinchart, Heiko Stuebner, Sakari Ailus, Hans Verkuil,
	Hans de Goede, Tomi Valkeinen, Alain Volmat, Paul Elder,
	Mehdi Djait, Andy Shevchenko, Bingbu Cao, linux-media, devicetree,
	linux-kernel, linux-arm-kernel, linux-mediatek, shengnan.wang,
	yaya.chang, yunkec, 10572168

On 20/04/2024 03:18, Zhi Mao wrote:
> Add YAML device tree binding for GT9768 & GT8769 VCM,
> and the relevant MAINTAINERS entries.
> 
> Signed-off-by: Zhi Mao <zhi.mao@mediatek.com>
> ---


Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>

If there is going to be any new version, then:

>  .../bindings/media/i2c/giantec,gt9769.yaml    | 56 +++++++++++++++++++
>  1 file changed, 56 insertions(+)

> +title: Giantec Semiconductor, Crop. GT9768 & GT9769 Voice Coil Motor (VCM)
> +
> +maintainers:
> +  - Zhi Mao <zhi.mao@mediatek.com>
> +
> +description: |-

Drop |-

> +  The Giantec GT9768 & GT9768 is a 10-bit DAC with current sink capability.
> +  The DAC is controlled via I2C bus that operates at clock rates up to 1MHz.
> +  This chip integrates Advanced Actuator Control (AAC) technology
> +  and is intended for driving voice coil lens in camera modules.
> +
> +properties:
> +  compatible:
> +    enum:
> +      - giantec,gt9768
> +      - giantec,gt9769
> +
> +  reg:
> +    maxItems: 1
> +
> +  vin-supply: true
> +
> +  vdd-supply: true
> +
> +required:
> +  - compatible
> +  - reg
> +  - vin-supply
> +  - vdd-supply
> +
> +additionalProperties: false
> +
> +examples:
> +  - |
> +

Drop blank line

> +    i2c {



Best regards,
Krzysztof


^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH v1 1/2] media: dt-bindings: i2c: add Giantec GT97xx VCM
@ 2024-04-22  3:26     ` Krzysztof Kozlowski
  0 siblings, 0 replies; 20+ messages in thread
From: Krzysztof Kozlowski @ 2024-04-22  3:26 UTC (permalink / raw)
  To: Zhi Mao, Mauro Carvalho Chehab, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley
  Cc: Matthias Brugger, AngeloGioacchino Del Regno, Philipp Zabel,
	Laurent Pinchart, Heiko Stuebner, Sakari Ailus, Hans Verkuil,
	Hans de Goede, Tomi Valkeinen, Alain Volmat, Paul Elder,
	Mehdi Djait, Andy Shevchenko, Bingbu Cao, linux-media, devicetree,
	linux-kernel, linux-arm-kernel, linux-mediatek, shengnan.wang,
	yaya.chang, yunkec, 10572168

On 20/04/2024 03:18, Zhi Mao wrote:
> Add YAML device tree binding for GT9768 & GT8769 VCM,
> and the relevant MAINTAINERS entries.
> 
> Signed-off-by: Zhi Mao <zhi.mao@mediatek.com>
> ---


Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>

If there is going to be any new version, then:

>  .../bindings/media/i2c/giantec,gt9769.yaml    | 56 +++++++++++++++++++
>  1 file changed, 56 insertions(+)

> +title: Giantec Semiconductor, Crop. GT9768 & GT9769 Voice Coil Motor (VCM)
> +
> +maintainers:
> +  - Zhi Mao <zhi.mao@mediatek.com>
> +
> +description: |-

Drop |-

> +  The Giantec GT9768 & GT9768 is a 10-bit DAC with current sink capability.
> +  The DAC is controlled via I2C bus that operates at clock rates up to 1MHz.
> +  This chip integrates Advanced Actuator Control (AAC) technology
> +  and is intended for driving voice coil lens in camera modules.
> +
> +properties:
> +  compatible:
> +    enum:
> +      - giantec,gt9768
> +      - giantec,gt9769
> +
> +  reg:
> +    maxItems: 1
> +
> +  vin-supply: true
> +
> +  vdd-supply: true
> +
> +required:
> +  - compatible
> +  - reg
> +  - vin-supply
> +  - vdd-supply
> +
> +additionalProperties: false
> +
> +examples:
> +  - |
> +

Drop blank line

> +    i2c {



Best regards,
Krzysztof


_______________________________________________
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:[~2024-04-22  3:26 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-20  1:18 [PATCH v1 0/2] media: i2c: Add support for GT97xx VCM Zhi Mao
2024-04-20  1:18 ` Zhi Mao
2024-04-20  1:18 ` [PATCH v1 1/2] media: dt-bindings: i2c: add Giantec " Zhi Mao
2024-04-20  1:18   ` Zhi Mao
2024-04-20 11:21   ` Krzysztof Kozlowski
2024-04-20 11:21     ` Krzysztof Kozlowski
2024-04-20 12:53     ` Kieran Bingham
2024-04-20 12:53       ` Kieran Bingham
2024-04-21 11:35       ` Kieran Bingham
2024-04-21 11:35         ` Kieran Bingham
2024-04-21 14:00         ` Krzysztof Kozlowski
2024-04-21 14:00           ` Krzysztof Kozlowski
2024-04-22  1:49     ` Zhi Mao (毛智)
2024-04-22  1:49       ` Zhi Mao (毛智)
2024-04-22  3:18       ` Krzysztof Kozlowski
2024-04-22  3:18         ` Krzysztof Kozlowski
2024-04-22  3:26   ` Krzysztof Kozlowski
2024-04-22  3:26     ` Krzysztof Kozlowski
2024-04-20  1:18 ` [PATCH v1 2/2] media: i2c: Add GT97xx VCM driver Zhi Mao
2024-04-20  1:18   ` Zhi Mao

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.