All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH V4 0/7] iio: adc: sc27xx: adjust structure and add PMIC's support
@ 2022-04-19 14:24 Cixi Geng
  2022-04-19 14:24 ` [PATCH V4 1/7] dt-bindings:iio:adc: add sprd,ump9620-adc dt-binding Cixi Geng
                   ` (7 more replies)
  0 siblings, 8 replies; 16+ messages in thread
From: Cixi Geng @ 2022-04-19 14:24 UTC (permalink / raw)
  To: jic23, lars, robh+dt, krzysztof.kozlowski+dt, orsonzhai,
	baolin.wang7, zhang.lyra, yuming.zhu1
  Cc: linux-iio, devicetree, linux-kernel

From: Cixi Geng <cixi.geng1@unisoc.com>

this patchset add a sc27xx_adc_variant_data structure
and add sc272*,sc273* and ump9620 PMIC support.

v2 changes:
  fix dt_binding_check error
  adjust some code-style issue
  optimize the copy-paste functions
  the smatch warnings found by lkp
  and  ohter comments by v1 patches.

v3 changes:
  fix nvmem-cells Items value and add ump9620 dt sample
  add the correct signature for each patch
  fix the unused warning in 3/7, add explain for set the scales
  remove duplicate code,add goto label in sc27xx_adc_read
  pull out the refactor code into a single patch
  delete the suspend and resume pm for ump9620

v4 changes:
  Add fix tag in the 2/7 patch.
  Separate modification and refactoring 3/7(v3) to 2 pathes.
  remove the pmic_type struct instead of a boot set_volref
  to define the specific feathure.
  use switch statement in all scale_init functions.
  remove ump9620 pmic support in this patchset, submit separately
  in the next patches.

Cixi Geng (7):
  dt-bindings:iio:adc: add sprd,ump9620-adc dt-binding
  iio: adc: sc27xx: fix read big scale voltage not right
  iio: adc: Fine tune the scale calibration values
  iio: adc: sc27xx: structure adjustment and optimization
  iio: adc: refactor some functions for support more PMiCs
  iio: adc: sc27xx: add support for PMIC sc2720 and sc2721
  iio: adc: sc27xx: add support for PMIC sc2730

 .../bindings/iio/adc/sprd,sc2720-adc.yaml     |  59 ++-
 drivers/iio/adc/sc27xx_adc.c                  | 473 ++++++++++++++++--
 2 files changed, 491 insertions(+), 41 deletions(-)

-- 
2.25.1


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

* [PATCH V4 1/7] dt-bindings:iio:adc: add sprd,ump9620-adc dt-binding
  2022-04-19 14:24 [PATCH V4 0/7] iio: adc: sc27xx: adjust structure and add PMIC's support Cixi Geng
@ 2022-04-19 14:24 ` Cixi Geng
  2022-04-20  7:01   ` Krzysztof Kozlowski
  2022-04-19 14:24 ` [PATCH V4 2/7] iio: adc: sc27xx: fix read big scale voltage not right Cixi Geng
                   ` (6 subsequent siblings)
  7 siblings, 1 reply; 16+ messages in thread
From: Cixi Geng @ 2022-04-19 14:24 UTC (permalink / raw)
  To: jic23, lars, robh+dt, krzysztof.kozlowski+dt, orsonzhai,
	baolin.wang7, zhang.lyra, yuming.zhu1
  Cc: linux-iio, devicetree, linux-kernel

From: Cixi Geng <cixi.geng1@unisoc.com>

sprd,ump9620-adc is one variant of sc27xx series, add ump9620
description and sample in dt-bindings.

Signed-off-by: Cixi Geng <cixi.geng1@unisoc.com>
---
 .../bindings/iio/adc/sprd,sc2720-adc.yaml     | 59 +++++++++++++++++--
 1 file changed, 53 insertions(+), 6 deletions(-)

diff --git a/Documentation/devicetree/bindings/iio/adc/sprd,sc2720-adc.yaml b/Documentation/devicetree/bindings/iio/adc/sprd,sc2720-adc.yaml
index caa3ee0b4b8c..c9fe45c1c0d8 100644
--- a/Documentation/devicetree/bindings/iio/adc/sprd,sc2720-adc.yaml
+++ b/Documentation/devicetree/bindings/iio/adc/sprd,sc2720-adc.yaml
@@ -20,6 +20,7 @@ properties:
       - sprd,sc2723-adc
       - sprd,sc2730-adc
       - sprd,sc2731-adc
+      - sprd,ump9620-adc
 
   reg:
     maxItems: 1
@@ -33,13 +34,38 @@ properties:
   hwlocks:
     maxItems: 1
 
-  nvmem-cells:
-    maxItems: 2
+  nvmem-cells: true
 
-  nvmem-cell-names:
-    items:
-      - const: big_scale_calib
-      - const: small_scale_calib
+  nvmem-cell-names: true
+
+if:
+  not:
+    properties:
+      compatible:
+        contains:
+          enum:
+            - sprd,ump9620-adc
+then:
+  properties:
+    nvmem-cells:
+      maxItems: 2
+    nvmem-cell-names:
+      items:
+        - const: big_scale_calib
+        - const: small_scale_calib
+
+else:
+  properties:
+    nvmem-cells:
+      maxItems: 6
+    nvmem-cell-names:
+      items:
+        - const: big_scale_calib1
+        - const: big_scale_calib2
+        - const: small_scale_calib1
+        - const: small_scale_calib2
+        - const: vbat_det_cal1
+        - const: vbat_det_cal2
 
 required:
   - compatible
@@ -69,4 +95,25 @@ examples:
             nvmem-cell-names = "big_scale_calib", "small_scale_calib";
         };
     };
+
+  - |
+    #include <dt-bindings/interrupt-controller/irq.h>
+    pmic {
+        #address-cells = <1>;
+        #size-cells = <0>;
+        adc@504 {
+            compatible = "sprd,ump9620-adc";
+            reg = <0x504>;
+            interrupt-parent = <&ump9620_pmic>;
+            interrupts = <0 IRQ_TYPE_LEVEL_HIGH>;
+            #io-channel-cells = <1>;
+            hwlocks = <&hwlock 4>;
+            nvmem-cells = <&adc_bcal1>, <&adc_bcal2>,
+                          <&adc_scal1>, <&adc_scal2>,
+                          <&vbat_det_cal1>, <&vbat_det_cal2>;
+            nvmem-cell-names = "big_scale_calib1", "big_scale_calib2",
+                               "small_scale_calib1", "small_scale_calib2",
+                               "vbat_det_cal1", "vbat_det_cal2";
+        };
+    };
 ...
-- 
2.25.1


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

* [PATCH V4 2/7] iio: adc: sc27xx: fix read big scale voltage not right
  2022-04-19 14:24 [PATCH V4 0/7] iio: adc: sc27xx: adjust structure and add PMIC's support Cixi Geng
  2022-04-19 14:24 ` [PATCH V4 1/7] dt-bindings:iio:adc: add sprd,ump9620-adc dt-binding Cixi Geng
@ 2022-04-19 14:24 ` Cixi Geng
  2022-04-24 17:00   ` Jonathan Cameron
  2022-04-19 14:24 ` [PATCH V4 3/7] iio: adc: Fine tune the scale calibration values Cixi Geng
                   ` (5 subsequent siblings)
  7 siblings, 1 reply; 16+ messages in thread
From: Cixi Geng @ 2022-04-19 14:24 UTC (permalink / raw)
  To: jic23, lars, robh+dt, krzysztof.kozlowski+dt, orsonzhai,
	baolin.wang7, zhang.lyra, yuming.zhu1
  Cc: linux-iio, devicetree, linux-kernel

From: Cixi Geng <cixi.geng1@unisoc.com>

Fix wrong configuration value of SC27XX_ADC_SCALE_MASK and
SC27XX_ADC_SCALE_SHIFT by spec documetation.
Fixes: 5df362a6cf49c (iio: adc: Add Spreadtrum SC27XX PMICs ADC support)

Signed-off-by: Cixi Geng <cixi.geng1@unisoc.com>
Reviewed-by: Baolin Wang <baolin.wang7@gmail.com>
---
 drivers/iio/adc/sc27xx_adc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/iio/adc/sc27xx_adc.c b/drivers/iio/adc/sc27xx_adc.c
index 00098caf6d9e..aee076c8e2b1 100644
--- a/drivers/iio/adc/sc27xx_adc.c
+++ b/drivers/iio/adc/sc27xx_adc.c
@@ -36,8 +36,8 @@
 
 /* Bits and mask definition for SC27XX_ADC_CH_CFG register */
 #define SC27XX_ADC_CHN_ID_MASK		GENMASK(4, 0)
-#define SC27XX_ADC_SCALE_MASK		GENMASK(10, 8)
-#define SC27XX_ADC_SCALE_SHIFT		8
+#define SC27XX_ADC_SCALE_MASK		GENMASK(10, 9)
+#define SC27XX_ADC_SCALE_SHIFT		9
 
 /* Bits definitions for SC27XX_ADC_INT_EN registers */
 #define SC27XX_ADC_IRQ_EN		BIT(0)
-- 
2.25.1


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

* [PATCH V4 3/7] iio: adc: Fine tune the scale calibration values
  2022-04-19 14:24 [PATCH V4 0/7] iio: adc: sc27xx: adjust structure and add PMIC's support Cixi Geng
  2022-04-19 14:24 ` [PATCH V4 1/7] dt-bindings:iio:adc: add sprd,ump9620-adc dt-binding Cixi Geng
  2022-04-19 14:24 ` [PATCH V4 2/7] iio: adc: sc27xx: fix read big scale voltage not right Cixi Geng
@ 2022-04-19 14:24 ` Cixi Geng
  2022-04-24 17:01   ` Jonathan Cameron
  2022-04-19 14:24 ` [PATCH V4 4/7] iio: adc: sc27xx: structure adjustment and optimization Cixi Geng
                   ` (4 subsequent siblings)
  7 siblings, 1 reply; 16+ messages in thread
From: Cixi Geng @ 2022-04-19 14:24 UTC (permalink / raw)
  To: jic23, lars, robh+dt, krzysztof.kozlowski+dt, orsonzhai,
	baolin.wang7, zhang.lyra, yuming.zhu1
  Cc: linux-iio, devicetree, linux-kernel

From: Cixi Geng <cixi.geng1@unisoc.com>

Small adjustment the scale calibration value for the sc2731,
use new name sc2731_[big|small]_scale_graph_calib, and remove
the origin [big|small]_scale_graph_calib struct for unused.

Fixes: 8ba0dbfd07a35 (iio: adc: sc27xx: Add ADC scale calibration)

Signed-off-by: Cixi Geng <cixi.geng1@unisoc.com>
---
 drivers/iio/adc/sc27xx_adc.c | 19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)

diff --git a/drivers/iio/adc/sc27xx_adc.c b/drivers/iio/adc/sc27xx_adc.c
index aee076c8e2b1..24211d2a71b1 100644
--- a/drivers/iio/adc/sc27xx_adc.c
+++ b/drivers/iio/adc/sc27xx_adc.c
@@ -103,14 +103,17 @@ static struct sc27xx_adc_linear_graph small_scale_graph = {
 	100, 341,
 };
 
-static const struct sc27xx_adc_linear_graph big_scale_graph_calib = {
-	4200, 856,
-	3600, 733,
+/*
+ * Add the sc2731_[big|small]_scale_graph_calib for sc2731 pmic.
+ */
+static const struct sc27xx_adc_linear_graph sc2731_big_scale_graph_calib = {
+	4200, 850,
+	3600, 728,
 };
 
-static const struct sc27xx_adc_linear_graph small_scale_graph_calib = {
-	1000, 833,
-	100, 80,
+static const struct sc27xx_adc_linear_graph sc2731_small_scale_graph_calib = {
+	1000, 838,
+	100, 84,
 };
 
 static int sc27xx_adc_get_calib_data(u32 calib_data, int calib_adc)
@@ -130,11 +133,11 @@ static int sc27xx_adc_scale_calibration(struct sc27xx_adc_data *data,
 	size_t len;
 
 	if (big_scale) {
-		calib_graph = &big_scale_graph_calib;
+		calib_graph = &sc2731_big_scale_graph_calib;
 		graph = &big_scale_graph;
 		cell_name = "big_scale_calib";
 	} else {
-		calib_graph = &small_scale_graph_calib;
+		calib_graph = &sc2731_small_scale_graph_calib;
 		graph = &small_scale_graph;
 		cell_name = "small_scale_calib";
 	}
-- 
2.25.1


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

* [PATCH V4 4/7] iio: adc: sc27xx: structure adjustment and optimization
  2022-04-19 14:24 [PATCH V4 0/7] iio: adc: sc27xx: adjust structure and add PMIC's support Cixi Geng
                   ` (2 preceding siblings ...)
  2022-04-19 14:24 ` [PATCH V4 3/7] iio: adc: Fine tune the scale calibration values Cixi Geng
@ 2022-04-19 14:24 ` Cixi Geng
  2022-04-19 14:24 ` [PATCH V4 5/7] iio: adc: refactor some functions for support more PMiCs Cixi Geng
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 16+ messages in thread
From: Cixi Geng @ 2022-04-19 14:24 UTC (permalink / raw)
  To: jic23, lars, robh+dt, krzysztof.kozlowski+dt, orsonzhai,
	baolin.wang7, zhang.lyra, yuming.zhu1
  Cc: linux-iio, devicetree, linux-kernel

From: Cixi Geng <cixi.geng1@unisoc.com>

Introduce one variant device data structure to be compatible
with SC2731 PMIC since it has different scale and ratio calculation
and so on. also rename the SC27xx to SC2731 for some definition
and function.

Co-developed-by: Yuming Zhu <yuming.zhu1@unisoc.com>
Signed-off-by: Yuming Zhu <yuming.zhu1@unisoc.com>
Signed-off-by: Cixi Geng <cixi.geng1@unisoc.com>
---
 drivers/iio/adc/sc27xx_adc.c | 91 ++++++++++++++++++++++++++++++------
 1 file changed, 76 insertions(+), 15 deletions(-)

diff --git a/drivers/iio/adc/sc27xx_adc.c b/drivers/iio/adc/sc27xx_adc.c
index 24211d2a71b1..a8906ffd85bf 100644
--- a/drivers/iio/adc/sc27xx_adc.c
+++ b/drivers/iio/adc/sc27xx_adc.c
@@ -12,9 +12,9 @@
 #include <linux/slab.h>
 
 /* PMIC global registers definition */
-#define SC27XX_MODULE_EN		0xc08
+#define SC2731_MODULE_EN		0xc08
 #define SC27XX_MODULE_ADC_EN		BIT(5)
-#define SC27XX_ARM_CLK_EN		0xc10
+#define SC2731_ARM_CLK_EN		0xc10
 #define SC27XX_CLK_ADC_EN		BIT(5)
 #define SC27XX_CLK_ADC_CLK_EN		BIT(6)
 
@@ -78,6 +78,23 @@ struct sc27xx_adc_data {
 	int channel_scale[SC27XX_ADC_CHANNEL_MAX];
 	u32 base;
 	int irq;
+	const struct sc27xx_adc_variant_data *var_data;
+};
+
+/*
+ * Since different PMICs of SC27xx series can have different
+ * address and ratio, we should save ratio config and base
+ * in the device data structure.
+ */
+struct sc27xx_adc_variant_data {
+	u32 module_en;
+	u32 clk_en;
+	u32 scale_shift;
+	u32 scale_mask;
+	const struct sc27xx_adc_linear_graph *bscale_cal;
+	const struct sc27xx_adc_linear_graph *sscale_cal;
+	void (*init_scale)(struct sc27xx_adc_data *data);
+	int (*get_ratio)(int channel, int scale);
 };
 
 struct sc27xx_adc_linear_graph {
@@ -133,11 +150,11 @@ static int sc27xx_adc_scale_calibration(struct sc27xx_adc_data *data,
 	size_t len;
 
 	if (big_scale) {
-		calib_graph = &sc2731_big_scale_graph_calib;
+		calib_graph = data->var_data->bscale_cal;
 		graph = &big_scale_graph;
 		cell_name = "big_scale_calib";
 	} else {
-		calib_graph = &sc2731_small_scale_graph_calib;
+		calib_graph = data->var_data->sscale_cal;
 		graph = &small_scale_graph;
 		cell_name = "small_scale_calib";
 	}
@@ -163,7 +180,7 @@ static int sc27xx_adc_scale_calibration(struct sc27xx_adc_data *data,
 	return 0;
 }
 
-static int sc27xx_adc_get_ratio(int channel, int scale)
+static int sc2731_adc_get_ratio(int channel, int scale)
 {
 	switch (channel) {
 	case 1:
@@ -188,6 +205,28 @@ static int sc27xx_adc_get_ratio(int channel, int scale)
 	return SC27XX_VOLT_RATIO(1, 1);
 }
 
+/*
+ * According to the datasheet set specific value on some channel.
+ */
+static void sc2731_adc_scale_init(struct sc27xx_adc_data *data)
+{
+	int i;
+	/*
+	 * In the current software design, SC2731 support 2 scales,
+	 * channels 5 uses big scale, others use smale.
+	 */
+	for (i = 0; i < SC27XX_ADC_CHANNEL_MAX; i++) {
+		switch (i) {
+		case 5:
+			data->channel_scale[i] = 1;
+			break;
+		default:
+			data->channel_scale[i] = 0;
+			break;
+		}
+	}
+}
+
 static int sc27xx_adc_read(struct sc27xx_adc_data *data, int channel,
 			   int scale, int *val)
 {
@@ -211,10 +250,11 @@ static int sc27xx_adc_read(struct sc27xx_adc_data *data, int channel,
 		goto disable_adc;
 
 	/* Configure the channel id and scale */
-	tmp = (scale << SC27XX_ADC_SCALE_SHIFT) & SC27XX_ADC_SCALE_MASK;
+	tmp = (scale << data->var_data->scale_shift) & data->var_data->scale_mask;
 	tmp |= channel & SC27XX_ADC_CHN_ID_MASK;
 	ret = regmap_update_bits(data->regmap, data->base + SC27XX_ADC_CH_CFG,
-				 SC27XX_ADC_CHN_ID_MASK | SC27XX_ADC_SCALE_MASK,
+				 SC27XX_ADC_CHN_ID_MASK |
+				 data->var_data->scale_mask,
 				 tmp);
 	if (ret)
 		goto disable_adc;
@@ -265,8 +305,9 @@ static void sc27xx_adc_volt_ratio(struct sc27xx_adc_data *data,
 				  int channel, int scale,
 				  u32 *div_numerator, u32 *div_denominator)
 {
-	u32 ratio = sc27xx_adc_get_ratio(channel, scale);
+	u32 ratio;
 
+	ratio = data->var_data->get_ratio(channel, scale);
 	*div_numerator = ratio >> SC27XX_RATIO_NUMERATOR_OFFSET;
 	*div_denominator = ratio & SC27XX_RATIO_DENOMINATOR_MASK;
 }
@@ -435,13 +476,13 @@ static int sc27xx_adc_enable(struct sc27xx_adc_data *data)
 {
 	int ret;
 
-	ret = regmap_update_bits(data->regmap, SC27XX_MODULE_EN,
+	ret = regmap_update_bits(data->regmap, data->var_data->module_en,
 				 SC27XX_MODULE_ADC_EN, SC27XX_MODULE_ADC_EN);
 	if (ret)
 		return ret;
 
 	/* Enable ADC work clock and controller clock */
-	ret = regmap_update_bits(data->regmap, SC27XX_ARM_CLK_EN,
+	ret = regmap_update_bits(data->regmap, data->var_data->clk_en,
 				 SC27XX_CLK_ADC_EN | SC27XX_CLK_ADC_CLK_EN,
 				 SC27XX_CLK_ADC_EN | SC27XX_CLK_ADC_CLK_EN);
 	if (ret)
@@ -459,10 +500,10 @@ static int sc27xx_adc_enable(struct sc27xx_adc_data *data)
 	return 0;
 
 disable_clk:
-	regmap_update_bits(data->regmap, SC27XX_ARM_CLK_EN,
+	regmap_update_bits(data->regmap, data->var_data->clk_en,
 			   SC27XX_CLK_ADC_EN | SC27XX_CLK_ADC_CLK_EN, 0);
 disable_adc:
-	regmap_update_bits(data->regmap, SC27XX_MODULE_EN,
+	regmap_update_bits(data->regmap, data->var_data->module_en,
 			   SC27XX_MODULE_ADC_EN, 0);
 
 	return ret;
@@ -473,21 +514,39 @@ static void sc27xx_adc_disable(void *_data)
 	struct sc27xx_adc_data *data = _data;
 
 	/* Disable ADC work clock and controller clock */
-	regmap_update_bits(data->regmap, SC27XX_ARM_CLK_EN,
+	regmap_update_bits(data->regmap, data->var_data->clk_en,
 			   SC27XX_CLK_ADC_EN | SC27XX_CLK_ADC_CLK_EN, 0);
 
-	regmap_update_bits(data->regmap, SC27XX_MODULE_EN,
+	regmap_update_bits(data->regmap, data->var_data->module_en,
 			   SC27XX_MODULE_ADC_EN, 0);
 }
 
+static const struct sc27xx_adc_variant_data sc2731_data = {
+	.module_en = SC2731_MODULE_EN,
+	.clk_en = SC2731_ARM_CLK_EN,
+	.scale_shift = SC27XX_ADC_SCALE_SHIFT,
+	.scale_mask = SC27XX_ADC_SCALE_MASK,
+	.bscale_cal = &sc2731_big_scale_graph_calib,
+	.sscale_cal = &sc2731_small_scale_graph_calib,
+	.init_scale = sc2731_adc_scale_init,
+	.get_ratio = sc2731_adc_get_ratio,
+};
+
 static int sc27xx_adc_probe(struct platform_device *pdev)
 {
 	struct device *dev = &pdev->dev;
 	struct device_node *np = dev->of_node;
 	struct sc27xx_adc_data *sc27xx_data;
+	const struct sc27xx_adc_variant_data *pdata;
 	struct iio_dev *indio_dev;
 	int ret;
 
+	pdata = of_device_get_match_data(dev);
+	if (!pdata) {
+		dev_err(dev, "No matching driver data found\n");
+		return -EINVAL;
+	}
+
 	indio_dev = devm_iio_device_alloc(dev, sizeof(*sc27xx_data));
 	if (!indio_dev)
 		return -ENOMEM;
@@ -523,6 +582,8 @@ static int sc27xx_adc_probe(struct platform_device *pdev)
 	}
 
 	sc27xx_data->dev = dev;
+	sc27xx_data->var_data = pdata;
+	sc27xx_data->var_data->init_scale(sc27xx_data);
 
 	ret = sc27xx_adc_enable(sc27xx_data);
 	if (ret) {
@@ -549,7 +610,7 @@ static int sc27xx_adc_probe(struct platform_device *pdev)
 }
 
 static const struct of_device_id sc27xx_adc_of_match[] = {
-	{ .compatible = "sprd,sc2731-adc", },
+	{ .compatible = "sprd,sc2731-adc", .data = &sc2731_data},
 	{ }
 };
 MODULE_DEVICE_TABLE(of, sc27xx_adc_of_match);
-- 
2.25.1


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

* [PATCH V4 5/7] iio: adc: refactor some functions for support more PMiCs
  2022-04-19 14:24 [PATCH V4 0/7] iio: adc: sc27xx: adjust structure and add PMIC's support Cixi Geng
                   ` (3 preceding siblings ...)
  2022-04-19 14:24 ` [PATCH V4 4/7] iio: adc: sc27xx: structure adjustment and optimization Cixi Geng
@ 2022-04-19 14:24 ` Cixi Geng
  2022-04-24 17:30   ` Jonathan Cameron
  2022-04-19 14:24 ` [PATCH V4 6/7] iio: adc: sc27xx: add support for PMIC sc2720 and sc2721 Cixi Geng
                   ` (2 subsequent siblings)
  7 siblings, 1 reply; 16+ messages in thread
From: Cixi Geng @ 2022-04-19 14:24 UTC (permalink / raw)
  To: jic23, lars, robh+dt, krzysztof.kozlowski+dt, orsonzhai,
	baolin.wang7, zhang.lyra, yuming.zhu1
  Cc: linux-iio, devicetree, linux-kernel

From: Cixi Geng <cixi.geng1@unisoc.com>

Refactor the common adc_nvmem_cell_calib_data,adc_to_volt and call
these in the origin sc27xx_adc_scale_calibration,sc27xx_adc_to_volt

Signed-off-by: Cixi Geng <cixi.geng1@unisoc.com>
---
 drivers/iio/adc/sc27xx_adc.c | 56 +++++++++++++++++++++++++-----------
 1 file changed, 40 insertions(+), 16 deletions(-)

diff --git a/drivers/iio/adc/sc27xx_adc.c b/drivers/iio/adc/sc27xx_adc.c
index a8906ffd85bf..27fab579a281 100644
--- a/drivers/iio/adc/sc27xx_adc.c
+++ b/drivers/iio/adc/sc27xx_adc.c
@@ -138,16 +138,41 @@ static int sc27xx_adc_get_calib_data(u32 calib_data, int calib_adc)
 	return ((calib_data & 0xff) + calib_adc - 128) * 4;
 }
 
+/* get the adc nvmem cell calibration data */
+static int adc_nvmem_cell_calib_data(struct sc27xx_adc_data *data, const char *cell_name)
+{
+	struct nvmem_cell *cell;
+	void *buf;
+	u32 origin_calib_data = 0;
+	size_t len;
+
+	if (!data)
+		return -EINVAL;
+
+	cell = nvmem_cell_get(data->dev, cell_name);
+	if (IS_ERR(cell))
+		return PTR_ERR(cell);
+
+	buf = nvmem_cell_read(cell, &len);
+	if (IS_ERR(buf)) {
+		nvmem_cell_put(cell);
+		return PTR_ERR(buf);
+	}
+
+	memcpy(&origin_calib_data, buf, min(len, sizeof(u32)));
+
+	kfree(buf);
+	nvmem_cell_put(cell);
+	return origin_calib_data;
+}
+
 static int sc27xx_adc_scale_calibration(struct sc27xx_adc_data *data,
 					bool big_scale)
 {
 	const struct sc27xx_adc_linear_graph *calib_graph;
 	struct sc27xx_adc_linear_graph *graph;
-	struct nvmem_cell *cell;
 	const char *cell_name;
 	u32 calib_data = 0;
-	void *buf;
-	size_t len;
 
 	if (big_scale) {
 		calib_graph = data->var_data->bscale_cal;
@@ -159,24 +184,13 @@ static int sc27xx_adc_scale_calibration(struct sc27xx_adc_data *data,
 		cell_name = "small_scale_calib";
 	}
 
-	cell = nvmem_cell_get(data->dev, cell_name);
-	if (IS_ERR(cell))
-		return PTR_ERR(cell);
-
-	buf = nvmem_cell_read(cell, &len);
-	nvmem_cell_put(cell);
-
-	if (IS_ERR(buf))
-		return PTR_ERR(buf);
-
-	memcpy(&calib_data, buf, min(len, sizeof(u32)));
+	calib_data = adc_nvmem_cell_calib_data(data, cell_name);
 
 	/* Only need to calibrate the adc values in the linear graph. */
 	graph->adc0 = sc27xx_adc_get_calib_data(calib_data, calib_graph->adc0);
 	graph->adc1 = sc27xx_adc_get_calib_data(calib_data >> 8,
 						calib_graph->adc1);
 
-	kfree(buf);
 	return 0;
 }
 
@@ -312,7 +326,7 @@ static void sc27xx_adc_volt_ratio(struct sc27xx_adc_data *data,
 	*div_denominator = ratio & SC27XX_RATIO_DENOMINATOR_MASK;
 }
 
-static int sc27xx_adc_to_volt(struct sc27xx_adc_linear_graph *graph,
+static int adc_to_volt(struct sc27xx_adc_linear_graph *graph,
 			      int raw_adc)
 {
	int tmp;
@@ -321,6 +335,16 @@ static int sc27xx_adc_to_volt(struct sc27xx_adc_linear_graph *graph,
 	tmp /= (graph->adc0 - graph->adc1);
 	tmp += graph->volt1;
 
+	return tmp;
+}
+
+static int sc27xx_adc_to_volt(struct sc27xx_adc_linear_graph *graph,
+			      int raw_adc)
+{
+	int tmp;
+
+	tmp = adc_to_volt(graph, raw_adc);
+
 	return tmp < 0 ? 0 : tmp;
 }
 
-- 
2.25.1


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

* [PATCH V4 6/7] iio: adc: sc27xx: add support for PMIC sc2720 and sc2721
  2022-04-19 14:24 [PATCH V4 0/7] iio: adc: sc27xx: adjust structure and add PMIC's support Cixi Geng
                   ` (4 preceding siblings ...)
  2022-04-19 14:24 ` [PATCH V4 5/7] iio: adc: refactor some functions for support more PMiCs Cixi Geng
@ 2022-04-19 14:24 ` Cixi Geng
  2022-04-19 14:24 ` [PATCH V4 7/7] iio: adc: sc27xx: add support for PMIC sc2730 Cixi Geng
  2022-04-24 17:34 ` [PATCH V4 0/7] iio: adc: sc27xx: adjust structure and add PMIC's support Jonathan Cameron
  7 siblings, 0 replies; 16+ messages in thread
From: Cixi Geng @ 2022-04-19 14:24 UTC (permalink / raw)
  To: jic23, lars, robh+dt, krzysztof.kozlowski+dt, orsonzhai,
	baolin.wang7, zhang.lyra, yuming.zhu1
  Cc: linux-iio, devicetree, linux-kernel

From: Cixi Geng <cixi.geng1@unisoc.com>

sc2720 and sc2721 is the product of sc27xx series.

Co-developed-by: Yuming Zhu <yuming.zhu1@unisoc.com>
Signed-off-by: Yuming Zhu <yuming.zhu1@unisoc.com>
Signed-off-by: Cixi Geng <cixi.geng1@unisoc.com>
---
 drivers/iio/adc/sc27xx_adc.c | 203 ++++++++++++++++++++++++++++++++++-
 1 file changed, 201 insertions(+), 2 deletions(-)

diff --git a/drivers/iio/adc/sc27xx_adc.c b/drivers/iio/adc/sc27xx_adc.c
index 27fab579a281..40686ee60c01 100644
--- a/drivers/iio/adc/sc27xx_adc.c
+++ b/drivers/iio/adc/sc27xx_adc.c
@@ -9,11 +9,13 @@
 #include <linux/of_device.h>
 #include <linux/platform_device.h>
 #include <linux/regmap.h>
+#include <linux/regulator/consumer.h>
 #include <linux/slab.h>
 
 /* PMIC global registers definition */
 #define SC2731_MODULE_EN		0xc08
 #define SC27XX_MODULE_ADC_EN		BIT(5)
+#define SC2721_ARM_CLK_EN		0xc0c
 #define SC2731_ARM_CLK_EN		0xc10
 #define SC27XX_CLK_ADC_EN		BIT(5)
 #define SC27XX_CLK_ADC_CLK_EN		BIT(6)
@@ -37,7 +39,9 @@
 /* Bits and mask definition for SC27XX_ADC_CH_CFG register */
 #define SC27XX_ADC_CHN_ID_MASK		GENMASK(4, 0)
 #define SC27XX_ADC_SCALE_MASK		GENMASK(10, 9)
+#define SC2721_ADC_SCALE_MASK		BIT(5)
 #define SC27XX_ADC_SCALE_SHIFT		9
+#define SC2721_ADC_SCALE_SHIFT		5
 
 /* Bits definitions for SC27XX_ADC_INT_EN registers */
 #define SC27XX_ADC_IRQ_EN		BIT(0)
@@ -67,8 +71,15 @@
 #define SC27XX_RATIO_NUMERATOR_OFFSET	16
 #define SC27XX_RATIO_DENOMINATOR_MASK	GENMASK(15, 0)
 
+/* ADC specific channel reference voltage 3.5V */
+#define SC27XX_ADC_REFVOL_VDD35		3500000
+
+/* ADC default channel reference voltage is 2.8V */
+#define SC27XX_ADC_REFVOL_VDD28		2800000
+
 struct sc27xx_adc_data {
 	struct device *dev;
+	struct regulator *volref;
 	struct regmap *regmap;
 	/*
 	 * One hardware spinlock to synchronize between the multiple
@@ -95,6 +106,7 @@ struct sc27xx_adc_variant_data {
 	const struct sc27xx_adc_linear_graph *sscale_cal;
 	void (*init_scale)(struct sc27xx_adc_data *data);
 	int (*get_ratio)(int channel, int scale);
+	bool set_volref;
 };
 
 struct sc27xx_adc_linear_graph {
@@ -133,6 +145,16 @@ static const struct sc27xx_adc_linear_graph sc2731_small_scale_graph_calib = {
 	100, 84,
 };
 
+static const struct sc27xx_adc_linear_graph big_scale_graph_calib = {
+	4200, 856,
+	3600, 733,
+};
+
+static const struct sc27xx_adc_linear_graph small_scale_graph_calib = {
+	1000, 833,
+	100, 80,
+};
+
 static int sc27xx_adc_get_calib_data(u32 calib_data, int calib_adc)
 {
 	return ((calib_data & 0xff) + calib_adc - 128) * 4;
@@ -194,6 +216,94 @@ static int sc27xx_adc_scale_calibration(struct sc27xx_adc_data *data,
 	return 0;
 }
 
+static int sc2720_adc_get_ratio(int channel, int scale)
+{
+	switch (channel) {
+	case 14:
+		switch (scale) {
+		case 0:
+			return SC27XX_VOLT_RATIO(68, 900);
+		case 1:
+			return SC27XX_VOLT_RATIO(68, 1760);
+		case 2:
+			return SC27XX_VOLT_RATIO(68, 2327);
+		case 3:
+			return SC27XX_VOLT_RATIO(68, 3654);
+		default:
+			return SC27XX_VOLT_RATIO(1, 1);
+		}
+	case 16:
+		switch (scale) {
+		case 0:
+			return SC27XX_VOLT_RATIO(48, 100);
+		case 1:
+			return SC27XX_VOLT_RATIO(480, 1955);
+		case 2:
+			return SC27XX_VOLT_RATIO(480, 2586);
+		case 3:
+			return SC27XX_VOLT_RATIO(48, 406);
+		default:
+			return SC27XX_VOLT_RATIO(1, 1);
+		}
+	case 21:
+	case 22:
+	case 23:
+		switch (scale) {
+		case 0:
+			return SC27XX_VOLT_RATIO(3, 8);
+		case 1:
+			return SC27XX_VOLT_RATIO(375, 1955);
+		case 2:
+			return SC27XX_VOLT_RATIO(375, 2586);
+		case 3:
+			return SC27XX_VOLT_RATIO(300, 3248);
+		default:
+			return SC27XX_VOLT_RATIO(1, 1);
+		}
+	default:
+		switch (scale) {
+		case 0:
+			return SC27XX_VOLT_RATIO(1, 1);
+		case 1:
+			return SC27XX_VOLT_RATIO(1000, 1955);
+		case 2:
+			return SC27XX_VOLT_RATIO(1000, 2586);
+		case 3:
+			return SC27XX_VOLT_RATIO(100, 406);
+		default:
+			return SC27XX_VOLT_RATIO(1, 1);
+		}
+	}
+	return SC27XX_VOLT_RATIO(1, 1);
+}
+
+static int sc2721_adc_get_ratio(int channel, int scale)
+{
+	switch (channel) {
+	case 1:
+	case 2:
+	case 3:
+	case 4:
+		return scale ? SC27XX_VOLT_RATIO(400, 1025) :
+			SC27XX_VOLT_RATIO(1, 1);
+	case 5:
+		return SC27XX_VOLT_RATIO(7, 29);
+	case 7:
+	case 9:
+		return scale ? SC27XX_VOLT_RATIO(100, 125) :
+			SC27XX_VOLT_RATIO(1, 1);
+	case 14:
+		return SC27XX_VOLT_RATIO(68, 900);
+	case 16:
+		return SC27XX_VOLT_RATIO(48, 100);
+	case 19:
+		return SC27XX_VOLT_RATIO(1, 3);
+	default:
+		return SC27XX_VOLT_RATIO(1, 1);
+	}
+	return SC27XX_VOLT_RATIO(1, 1);
+}
+
 static int sc2731_adc_get_ratio(int channel, int scale)
 {
 	switch (channel) {
@@ -222,6 +332,34 @@ static int sc2731_adc_get_ratio(int channel, int scale)
 /*
  * According to the datasheet set specific value on some channel.
  */
+static void sc2720_adc_scale_init(struct sc27xx_adc_data *data)
+{
+	int i;
+
+	for (i = 0; i < SC27XX_ADC_CHANNEL_MAX; i++) {
+		switch (i) {
+		case 5:
+			data->channel_scale[i] = 3;
+			break;
+		case 7:
+		case 9:
+			data->channel_scale[i] = 2;
+			break;
+		case 13:
+			data->channel_scale[i] = 1;
+			break;
+		case 19:
+		case 30:
+		case 31:
+			data->channel_scale[i] = 3;
+			break;
+		default:
+			data->channel_scale[i] = 0;
+			break;
+		}
+	}
+}
+
 static void sc2731_adc_scale_init(struct sc27xx_adc_data *data)
 {
 	int i;
@@ -244,7 +382,7 @@ static void sc2731_adc_scale_init(struct sc27xx_adc_data *data)
 static int sc27xx_adc_read(struct sc27xx_adc_data *data, int channel,
 			   int scale, int *val)
 {
-	int ret;
+	int ret, ret_volref;
 	u32 tmp, value, status;
 
 	ret = hwspin_lock_timeout_raw(data->hwlock, SC27XX_ADC_HWLOCK_TIMEOUT);
@@ -253,10 +391,25 @@ static int sc27xx_adc_read(struct sc27xx_adc_data *data, int channel,
 		return ret;
 	}
 
+	/*
+	 * According to the sc2721 chip data sheet, the reference voltage of
+	 * specific channel 30 and channel 31 in ADC module needs to be set from
+	 * the default 2.8v to 3.5v.
+	 */
+	if ((data->var_data->set_volref) && (channel == 30 || channel == 31)) {
+		ret = regulator_set_voltage(data->volref,
+					SC27XX_ADC_REFVOL_VDD35,
+					SC27XX_ADC_REFVOL_VDD35);
+		if (ret) {
+			dev_err(data->dev, "failed to set the volref 3.5v\n");
+			goto unlock_adc;
+		}
+	}
+
 	ret = regmap_update_bits(data->regmap, data->base + SC27XX_ADC_CTL,
 				 SC27XX_ADC_EN, SC27XX_ADC_EN);
 	if (ret)
-		goto unlock_adc;
+		goto regulator_restore;
 
 	ret = regmap_update_bits(data->regmap, data->base + SC27XX_ADC_INT_CLR,
 				 SC27XX_ADC_IRQ_CLR, SC27XX_ADC_IRQ_CLR);
@@ -306,6 +459,17 @@ static int sc27xx_adc_read(struct sc27xx_adc_data *data, int channel,
 disable_adc:
 	regmap_update_bits(data->regmap, data->base + SC27XX_ADC_CTL,
 			   SC27XX_ADC_EN, 0);
+regulator_restore:
+	if ((data->var_data->set_volref) && (channel == 30 || channel == 31)) {
+		ret_volref = regulator_set_voltage(data->volref,
+					    SC27XX_ADC_REFVOL_VDD28,
+					    SC27XX_ADC_REFVOL_VDD28);
+		if (ret_volref) {
+			dev_err(data->dev, "failed to set the volref 2.8v,ret_volref = 0x%x\n",
+					 ret_volref);
+			ret = ret || ret_volref;
+		}
+	}
 unlock_adc:
 	hwspin_unlock_raw(data->hwlock);
 
@@ -554,6 +718,31 @@ static const struct sc27xx_adc_variant_data sc2731_data = {
 	.sscale_cal = &sc2731_small_scale_graph_calib,
 	.init_scale = sc2731_adc_scale_init,
 	.get_ratio = sc2731_adc_get_ratio,
+	.set_volref = false,
+};
+
+static const struct sc27xx_adc_variant_data sc2721_data = {
+	.module_en = SC2731_MODULE_EN,
+	.clk_en = SC2721_ARM_CLK_EN,
+	.scale_shift = SC2721_ADC_SCALE_SHIFT,
+	.scale_mask = SC2721_ADC_SCALE_MASK,
+	.bscale_cal = &sc2731_big_scale_graph_calib,
+	.sscale_cal = &sc2731_small_scale_graph_calib,
+	.init_scale = sc2731_adc_scale_init,
+	.get_ratio = sc2721_adc_get_ratio,
+	.set_volref = true,
+};
+
+static const struct sc27xx_adc_variant_data sc2720_data = {
+	.module_en = SC2731_MODULE_EN,
+	.clk_en = SC2721_ARM_CLK_EN,
+	.scale_shift = SC27XX_ADC_SCALE_SHIFT,
+	.scale_mask = SC27XX_ADC_SCALE_MASK,
+	.bscale_cal = &big_scale_graph_calib,
+	.sscale_cal = &small_scale_graph_calib,
+	.init_scale = sc2720_adc_scale_init,
+	.get_ratio = sc2720_adc_get_ratio,
+	.set_volref = false,
 };
 
 static int sc27xx_adc_probe(struct platform_device *pdev)
@@ -606,6 +795,14 @@ static int sc27xx_adc_probe(struct platform_device *pdev)
 	}
 
 	sc27xx_data->dev = dev;
+	if (pdata->set_volref) {
+		sc27xx_data->volref = devm_regulator_get(dev, "vref");
+		if (IS_ERR(sc27xx_data->volref)) {
+			ret = PTR_ERR(sc27xx_data->volref);
+			return dev_err_probe(dev, ret, "failed to get ADC volref\n");
+		}
+	}
+
 	sc27xx_data->var_data = pdata;
 	sc27xx_data->var_data->init_scale(sc27xx_data);
 
@@ -635,6 +832,8 @@ static int sc27xx_adc_probe(struct platform_device *pdev)
 
 static const struct of_device_id sc27xx_adc_of_match[] = {
 	{ .compatible = "sprd,sc2731-adc", .data = &sc2731_data},
+	{ .compatible = "sprd,sc2721-adc", .data = &sc2721_data},
+	{ .compatible = "sprd,sc2720-adc", .data = &sc2720_data},
 	{ }
 };
 MODULE_DEVICE_TABLE(of, sc27xx_adc_of_match);
-- 
2.25.1


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

* [PATCH V4 7/7] iio: adc: sc27xx: add support for PMIC sc2730
  2022-04-19 14:24 [PATCH V4 0/7] iio: adc: sc27xx: adjust structure and add PMIC's support Cixi Geng
                   ` (5 preceding siblings ...)
  2022-04-19 14:24 ` [PATCH V4 6/7] iio: adc: sc27xx: add support for PMIC sc2720 and sc2721 Cixi Geng
@ 2022-04-19 14:24 ` Cixi Geng
  2022-04-24 17:34 ` [PATCH V4 0/7] iio: adc: sc27xx: adjust structure and add PMIC's support Jonathan Cameron
  7 siblings, 0 replies; 16+ messages in thread
From: Cixi Geng @ 2022-04-19 14:24 UTC (permalink / raw)
  To: jic23, lars, robh+dt, krzysztof.kozlowski+dt, orsonzhai,
	baolin.wang7, zhang.lyra, yuming.zhu1
  Cc: linux-iio, devicetree, linux-kernel

From: Cixi Geng <cixi.geng1@unisoc.com>

sc2730 is the product of sc27xx series.

Co-developed-by: Yuming Zhu <yuming.zhu1@unisoc.com>
Signed-off-by: Yuming Zhu <yuming.zhu1@unisoc.com>
Signed-off-by: Cixi Geng <cixi.geng1@unisoc.com>
---
 drivers/iio/adc/sc27xx_adc.c | 116 +++++++++++++++++++++++++++++++++++
 1 file changed, 116 insertions(+)

diff --git a/drivers/iio/adc/sc27xx_adc.c b/drivers/iio/adc/sc27xx_adc.c
index 40686ee60c01..a12f7090311d 100644
--- a/drivers/iio/adc/sc27xx_adc.c
+++ b/drivers/iio/adc/sc27xx_adc.c
@@ -13,9 +13,11 @@
 #include <linux/slab.h>
 
 /* PMIC global registers definition */
+#define SC2730_MODULE_EN		0x1808
 #define SC2731_MODULE_EN		0xc08
 #define SC27XX_MODULE_ADC_EN		BIT(5)
 #define SC2721_ARM_CLK_EN		0xc0c
+#define SC2730_ARM_CLK_EN		0x180c
 #define SC2731_ARM_CLK_EN		0xc10
 #define SC27XX_CLK_ADC_EN		BIT(5)
 #define SC27XX_CLK_ADC_CLK_EN		BIT(6)
@@ -304,6 +306,80 @@ static int sc2721_adc_get_ratio(int channel, int scale)
 	return SC27XX_VOLT_RATIO(1, 1);
 }
 
+static int sc2730_adc_get_ratio(int channel, int scale)
+{
+	switch (channel) {
+	case 14:
+		switch (scale) {
+		case 0:
+			return SC27XX_VOLT_RATIO(68, 900);
+		case 1:
+			return SC27XX_VOLT_RATIO(68, 1760);
+		case 2:
+			return SC27XX_VOLT_RATIO(68, 2327);
+		case 3:
+			return SC27XX_VOLT_RATIO(68, 3654);
+		default:
+			return SC27XX_VOLT_RATIO(1, 1);
+		}
+	case 15:
+		switch (scale) {
+		case 0:
+			return SC27XX_VOLT_RATIO(1, 3);
+		case 1:
+			return SC27XX_VOLT_RATIO(1000, 5865);
+		case 2:
+			return SC27XX_VOLT_RATIO(500, 3879);
+		case 3:
+			return SC27XX_VOLT_RATIO(500, 6090);
+		default:
+			return SC27XX_VOLT_RATIO(1, 1);
+		}
+	case 16:
+		switch (scale) {
+		case 0:
+			return SC27XX_VOLT_RATIO(48, 100);
+		case 1:
+			return SC27XX_VOLT_RATIO(480, 1955);
+		case 2:
+			return SC27XX_VOLT_RATIO(480, 2586);
+		case 3:
+			return SC27XX_VOLT_RATIO(48, 406);
+		default:
+			return SC27XX_VOLT_RATIO(1, 1);
+		}
+	case 21:
+	case 22:
+	case 23:
+		switch (scale) {
+		case 0:
+			return SC27XX_VOLT_RATIO(3, 8);
+		case 1:
+			return SC27XX_VOLT_RATIO(375, 1955);
+		case 2:
+			return SC27XX_VOLT_RATIO(375, 2586);
+		case 3:
+			return SC27XX_VOLT_RATIO(300, 3248);
+		default:
+			return SC27XX_VOLT_RATIO(1, 1);
+		}
+	default:
+		switch (scale) {
+		case 0:
+			return SC27XX_VOLT_RATIO(1, 1);
+		case 1:
+			return SC27XX_VOLT_RATIO(1000, 1955);
+		case 2:
+			return SC27XX_VOLT_RATIO(1000, 2586);
+		case 3:
+			return SC27XX_VOLT_RATIO(1000, 4060);
+		default:
+			return SC27XX_VOLT_RATIO(1, 1);
+		}
+	}
+	return SC27XX_VOLT_RATIO(1, 1);
+}
+
 static int sc2731_adc_get_ratio(int channel, int scale)
 {
 	switch (channel) {
@@ -360,6 +436,33 @@ static void sc2720_adc_scale_init(struct sc27xx_adc_data *data)
 	}
 }
 
+static void sc2730_adc_scale_init(struct sc27xx_adc_data *data)
+{
+	int i;
+
+	for (i = 0; i < SC27XX_ADC_CHANNEL_MAX; i++) {
+		switch (i) {
+		case 5:
+		case 10:
+		case 19:
+		case 30:
+		case 31:
+			data->channel_scale[i] = 3;
+			break;
+		case 7:
+		case 9:
+			data->channel_scale[i] = 2;
+			break;
+		case 13:
+			data->channel_scale[i] = 1;
+			break;
+		default:
+			data->channel_scale[i] = 0;
+			break;
+		}
+	}
+}
+
 static void sc2731_adc_scale_init(struct sc27xx_adc_data *data)
 {
 	int i;
@@ -721,6 +824,18 @@ static const struct sc27xx_adc_variant_data sc2731_data = {
 	.set_volref = false,
 };
 
+static const struct sc27xx_adc_variant_data sc2730_data = {
+	.module_en = SC2730_MODULE_EN,
+	.clk_en = SC2730_ARM_CLK_EN,
+	.scale_shift = SC27XX_ADC_SCALE_SHIFT,
+	.scale_mask = SC27XX_ADC_SCALE_MASK,
+	.bscale_cal = &big_scale_graph_calib,
+	.sscale_cal = &small_scale_graph_calib,
+	.init_scale = sc2730_adc_scale_init,
+	.get_ratio = sc2730_adc_get_ratio,
+	.set_volref = false,
+};
+
 static const struct sc27xx_adc_variant_data sc2721_data = {
 	.module_en = SC2731_MODULE_EN,
 	.clk_en = SC2721_ARM_CLK_EN,
@@ -832,6 +947,7 @@ static int sc27xx_adc_probe(struct platform_device *pdev)
 
 static const struct of_device_id sc27xx_adc_of_match[] = {
 	{ .compatible = "sprd,sc2731-adc", .data = &sc2731_data},
+	{ .compatible = "sprd,sc2730-adc", .data = &sc2730_data},
 	{ .compatible = "sprd,sc2721-adc", .data = &sc2721_data},
 	{ .compatible = "sprd,sc2720-adc", .data = &sc2720_data},
 	{ }
-- 
2.25.1


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

* Re: [PATCH V4 1/7] dt-bindings:iio:adc: add sprd,ump9620-adc dt-binding
  2022-04-19 14:24 ` [PATCH V4 1/7] dt-bindings:iio:adc: add sprd,ump9620-adc dt-binding Cixi Geng
@ 2022-04-20  7:01   ` Krzysztof Kozlowski
  2022-04-24 17:21     ` Jonathan Cameron
  0 siblings, 1 reply; 16+ messages in thread
From: Krzysztof Kozlowski @ 2022-04-20  7:01 UTC (permalink / raw)
  To: Cixi Geng, jic23, lars, robh+dt, krzysztof.kozlowski+dt,
	orsonzhai, baolin.wang7, zhang.lyra, yuming.zhu1
  Cc: linux-iio, devicetree, linux-kernel

On 19/04/2022 16:24, Cixi Geng wrote:
> -  nvmem-cell-names:
> -    items:
> -      - const: big_scale_calib
> -      - const: small_scale_calib
> +  nvmem-cell-names: true
> +> +if:

Better to include it under "allOf:" so next time you need more of such
if-then, you do not need to change indentation. But anyway looks good:

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

> +  not:
> +    properties:
> +      compatible:



Best regards,
Krzysztof

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

* Re: [PATCH V4 2/7] iio: adc: sc27xx: fix read big scale voltage not right
  2022-04-19 14:24 ` [PATCH V4 2/7] iio: adc: sc27xx: fix read big scale voltage not right Cixi Geng
@ 2022-04-24 17:00   ` Jonathan Cameron
  0 siblings, 0 replies; 16+ messages in thread
From: Jonathan Cameron @ 2022-04-24 17:00 UTC (permalink / raw)
  To: Cixi Geng
  Cc: lars, robh+dt, krzysztof.kozlowski+dt, orsonzhai, baolin.wang7,
	zhang.lyra, yuming.zhu1, linux-iio, devicetree, linux-kernel

On Tue, 19 Apr 2022 22:24:53 +0800
Cixi Geng <gengcixi@gmail.com> wrote:

> From: Cixi Geng <cixi.geng1@unisoc.com>
> 
> Fix wrong configuration value of SC27XX_ADC_SCALE_MASK and
> SC27XX_ADC_SCALE_SHIFT by spec documetation.
> Fixes: 5df362a6cf49c (iio: adc: Add Spreadtrum SC27XX PMICs ADC support)
No blank line here.  Fixes tag is part of the main tag block and
some of the automation people use doesn't cope with blank lines
in that block.

If nothing else comes up in reviewing the rest of the series I'll
tidy that up whilst applying.

Thanks,

Jonathan

> 
> Signed-off-by: Cixi Geng <cixi.geng1@unisoc.com>
> Reviewed-by: Baolin Wang <baolin.wang7@gmail.com>
> ---
>  drivers/iio/adc/sc27xx_adc.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/iio/adc/sc27xx_adc.c b/drivers/iio/adc/sc27xx_adc.c
> index 00098caf6d9e..aee076c8e2b1 100644
> --- a/drivers/iio/adc/sc27xx_adc.c
> +++ b/drivers/iio/adc/sc27xx_adc.c
> @@ -36,8 +36,8 @@
>  
>  /* Bits and mask definition for SC27XX_ADC_CH_CFG register */
>  #define SC27XX_ADC_CHN_ID_MASK		GENMASK(4, 0)
> -#define SC27XX_ADC_SCALE_MASK		GENMASK(10, 8)
> -#define SC27XX_ADC_SCALE_SHIFT		8
> +#define SC27XX_ADC_SCALE_MASK		GENMASK(10, 9)
> +#define SC27XX_ADC_SCALE_SHIFT		9
>  
>  /* Bits definitions for SC27XX_ADC_INT_EN registers */
>  #define SC27XX_ADC_IRQ_EN		BIT(0)


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

* Re: [PATCH V4 3/7] iio: adc: Fine tune the scale calibration values
  2022-04-19 14:24 ` [PATCH V4 3/7] iio: adc: Fine tune the scale calibration values Cixi Geng
@ 2022-04-24 17:01   ` Jonathan Cameron
  2022-04-24 17:28     ` Jonathan Cameron
  0 siblings, 1 reply; 16+ messages in thread
From: Jonathan Cameron @ 2022-04-24 17:01 UTC (permalink / raw)
  To: Cixi Geng
  Cc: lars, robh+dt, krzysztof.kozlowski+dt, orsonzhai, baolin.wang7,
	zhang.lyra, yuming.zhu1, linux-iio, devicetree, linux-kernel

On Tue, 19 Apr 2022 22:24:54 +0800
Cixi Geng <gengcixi@gmail.com> wrote:

> From: Cixi Geng <cixi.geng1@unisoc.com>
> 
> Small adjustment the scale calibration value for the sc2731,
> use new name sc2731_[big|small]_scale_graph_calib, and remove
> the origin [big|small]_scale_graph_calib struct for unused.
> 
> Fixes: 8ba0dbfd07a35 (iio: adc: sc27xx: Add ADC scale calibration)
No blank line here.
> 
> Signed-off-by: Cixi Geng <cixi.geng1@unisoc.com>
> ---
>  drivers/iio/adc/sc27xx_adc.c | 19 +++++++++++--------
>  1 file changed, 11 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/iio/adc/sc27xx_adc.c b/drivers/iio/adc/sc27xx_adc.c
> index aee076c8e2b1..24211d2a71b1 100644
> --- a/drivers/iio/adc/sc27xx_adc.c
> +++ b/drivers/iio/adc/sc27xx_adc.c
> @@ -103,14 +103,17 @@ static struct sc27xx_adc_linear_graph small_scale_graph = {
>  	100, 341,
>  };
>  
> -static const struct sc27xx_adc_linear_graph big_scale_graph_calib = {
> -	4200, 856,
> -	3600, 733,
> +/*
> + * Add the sc2731_[big|small]_scale_graph_calib for sc2731 pmic.
> + */

Why Add?

Given the variable naming conveys this anyway, I would drop the comment entirely.

> +static const struct sc27xx_adc_linear_graph sc2731_big_scale_graph_calib = {
> +	4200, 850,
> +	3600, 728,
>  };
>  
> -static const struct sc27xx_adc_linear_graph small_scale_graph_calib = {
> -	1000, 833,
> -	100, 80,
> +static const struct sc27xx_adc_linear_graph sc2731_small_scale_graph_calib = {
> +	1000, 838,
> +	100, 84,
>  };
>  
>  static int sc27xx_adc_get_calib_data(u32 calib_data, int calib_adc)
> @@ -130,11 +133,11 @@ static int sc27xx_adc_scale_calibration(struct sc27xx_adc_data *data,
>  	size_t len;
>  
>  	if (big_scale) {
> -		calib_graph = &big_scale_graph_calib;
> +		calib_graph = &sc2731_big_scale_graph_calib;
>  		graph = &big_scale_graph;
>  		cell_name = "big_scale_calib";
>  	} else {
> -		calib_graph = &small_scale_graph_calib;
> +		calib_graph = &sc2731_small_scale_graph_calib;
>  		graph = &small_scale_graph;
>  		cell_name = "small_scale_calib";
>  	}


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

* Re: [PATCH V4 1/7] dt-bindings:iio:adc: add sprd,ump9620-adc dt-binding
  2022-04-20  7:01   ` Krzysztof Kozlowski
@ 2022-04-24 17:21     ` Jonathan Cameron
  0 siblings, 0 replies; 16+ messages in thread
From: Jonathan Cameron @ 2022-04-24 17:21 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Cixi Geng, lars, robh+dt, krzysztof.kozlowski+dt, orsonzhai,
	baolin.wang7, zhang.lyra, yuming.zhu1, linux-iio, devicetree,
	linux-kernel

On Wed, 20 Apr 2022 09:01:51 +0200
Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> wrote:

> On 19/04/2022 16:24, Cixi Geng wrote:
> > -  nvmem-cell-names:
> > -    items:
> > -      - const: big_scale_calib
> > -      - const: small_scale_calib
> > +  nvmem-cell-names: true  
> > +> +if:  
> 
> Better to include it under "allOf:" so next time you need more of such
> if-then, you do not need to change indentation. But anyway looks good:
> 
> Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>

I added the allOf: whilst applying.

Thanks,

Jonathan

> 
> > +  not:
> > +    properties:
> > +      compatible:  
> 
> 
> 
> Best regards,
> Krzysztof


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

* Re: [PATCH V4 3/7] iio: adc: Fine tune the scale calibration values
  2022-04-24 17:01   ` Jonathan Cameron
@ 2022-04-24 17:28     ` Jonathan Cameron
  0 siblings, 0 replies; 16+ messages in thread
From: Jonathan Cameron @ 2022-04-24 17:28 UTC (permalink / raw)
  To: Cixi Geng
  Cc: lars, robh+dt, krzysztof.kozlowski+dt, orsonzhai, baolin.wang7,
	zhang.lyra, yuming.zhu1, linux-iio, devicetree, linux-kernel

On Sun, 24 Apr 2022 18:01:47 +0100
Jonathan Cameron <jic23@kernel.org> wrote:

> On Tue, 19 Apr 2022 22:24:54 +0800
> Cixi Geng <gengcixi@gmail.com> wrote:
> 
> > From: Cixi Geng <cixi.geng1@unisoc.com>
> > 
> > Small adjustment the scale calibration value for the sc2731,
> > use new name sc2731_[big|small]_scale_graph_calib, and remove
> > the origin [big|small]_scale_graph_calib struct for unused.
> > 
> > Fixes: 8ba0dbfd07a35 (iio: adc: sc27xx: Add ADC scale calibration)  
> No blank line here.
> > 
> > Signed-off-by: Cixi Geng <cixi.geng1@unisoc.com>
> > ---
> >  drivers/iio/adc/sc27xx_adc.c | 19 +++++++++++--------
> >  1 file changed, 11 insertions(+), 8 deletions(-)
> > 
> > diff --git a/drivers/iio/adc/sc27xx_adc.c b/drivers/iio/adc/sc27xx_adc.c
> > index aee076c8e2b1..24211d2a71b1 100644
> > --- a/drivers/iio/adc/sc27xx_adc.c
> > +++ b/drivers/iio/adc/sc27xx_adc.c
> > @@ -103,14 +103,17 @@ static struct sc27xx_adc_linear_graph small_scale_graph = {
> >  	100, 341,
> >  };
> >  
> > -static const struct sc27xx_adc_linear_graph big_scale_graph_calib = {
> > -	4200, 856,
> > -	3600, 733,
> > +/*
> > + * Add the sc2731_[big|small]_scale_graph_calib for sc2731 pmic.
> > + */  
> 
> Why Add?
> 
> Given the variable naming conveys this anyway, I would drop the comment entirely.

I dropped the comment whilst applying and added sc27xx to the patch title prefix.
> 
> > +static const struct sc27xx_adc_linear_graph sc2731_big_scale_graph_calib = {
> > +	4200, 850,
> > +	3600, 728,
> >  };
> >  
> > -static const struct sc27xx_adc_linear_graph small_scale_graph_calib = {
> > -	1000, 833,
> > -	100, 80,
> > +static const struct sc27xx_adc_linear_graph sc2731_small_scale_graph_calib = {
> > +	1000, 838,
> > +	100, 84,
> >  };
> >  
> >  static int sc27xx_adc_get_calib_data(u32 calib_data, int calib_adc)
> > @@ -130,11 +133,11 @@ static int sc27xx_adc_scale_calibration(struct sc27xx_adc_data *data,
> >  	size_t len;
> >  
> >  	if (big_scale) {
> > -		calib_graph = &big_scale_graph_calib;
> > +		calib_graph = &sc2731_big_scale_graph_calib;
> >  		graph = &big_scale_graph;
> >  		cell_name = "big_scale_calib";
> >  	} else {
> > -		calib_graph = &small_scale_graph_calib;
> > +		calib_graph = &sc2731_small_scale_graph_calib;
> >  		graph = &small_scale_graph;
> >  		cell_name = "small_scale_calib";
> >  	}  
> 


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

* Re: [PATCH V4 5/7] iio: adc: refactor some functions for support more PMiCs
  2022-04-19 14:24 ` [PATCH V4 5/7] iio: adc: refactor some functions for support more PMiCs Cixi Geng
@ 2022-04-24 17:30   ` Jonathan Cameron
  0 siblings, 0 replies; 16+ messages in thread
From: Jonathan Cameron @ 2022-04-24 17:30 UTC (permalink / raw)
  To: Cixi Geng
  Cc: lars, robh+dt, krzysztof.kozlowski+dt, orsonzhai, baolin.wang7,
	zhang.lyra, yuming.zhu1, linux-iio, devicetree, linux-kernel

On Tue, 19 Apr 2022 22:24:56 +0800
Cixi Geng <gengcixi@gmail.com> wrote:

> From: Cixi Geng <cixi.geng1@unisoc.com>
Added sc27xx to patch title whilst applying.

Also a small amount of 'fuzz' as a result of the edit I made to the earlier
patch to drop the comment but I think it all went in cleanly.

Thanks,

Jonathan

> 
> Refactor the common adc_nvmem_cell_calib_data,adc_to_volt and call
> these in the origin sc27xx_adc_scale_calibration,sc27xx_adc_to_volt
> 
> Signed-off-by: Cixi Geng <cixi.geng1@unisoc.com>
> ---
>  drivers/iio/adc/sc27xx_adc.c | 56 +++++++++++++++++++++++++-----------
>  1 file changed, 40 insertions(+), 16 deletions(-)
> 
> diff --git a/drivers/iio/adc/sc27xx_adc.c b/drivers/iio/adc/sc27xx_adc.c
> index a8906ffd85bf..27fab579a281 100644
> --- a/drivers/iio/adc/sc27xx_adc.c
> +++ b/drivers/iio/adc/sc27xx_adc.c
> @@ -138,16 +138,41 @@ static int sc27xx_adc_get_calib_data(u32 calib_data, int calib_adc)
>  	return ((calib_data & 0xff) + calib_adc - 128) * 4;
>  }
>  
> +/* get the adc nvmem cell calibration data */
> +static int adc_nvmem_cell_calib_data(struct sc27xx_adc_data *data, const char *cell_name)
> +{
> +	struct nvmem_cell *cell;
> +	void *buf;
> +	u32 origin_calib_data = 0;
> +	size_t len;
> +
> +	if (!data)
> +		return -EINVAL;
> +
> +	cell = nvmem_cell_get(data->dev, cell_name);
> +	if (IS_ERR(cell))
> +		return PTR_ERR(cell);
> +
> +	buf = nvmem_cell_read(cell, &len);
> +	if (IS_ERR(buf)) {
> +		nvmem_cell_put(cell);
> +		return PTR_ERR(buf);
> +	}
> +
> +	memcpy(&origin_calib_data, buf, min(len, sizeof(u32)));
> +
> +	kfree(buf);
> +	nvmem_cell_put(cell);
> +	return origin_calib_data;
> +}
> +
>  static int sc27xx_adc_scale_calibration(struct sc27xx_adc_data *data,
>  					bool big_scale)
>  {
>  	const struct sc27xx_adc_linear_graph *calib_graph;
>  	struct sc27xx_adc_linear_graph *graph;
> -	struct nvmem_cell *cell;
>  	const char *cell_name;
>  	u32 calib_data = 0;
> -	void *buf;
> -	size_t len;
>  
>  	if (big_scale) {
>  		calib_graph = data->var_data->bscale_cal;
> @@ -159,24 +184,13 @@ static int sc27xx_adc_scale_calibration(struct sc27xx_adc_data *data,
>  		cell_name = "small_scale_calib";
>  	}
>  
> -	cell = nvmem_cell_get(data->dev, cell_name);
> -	if (IS_ERR(cell))
> -		return PTR_ERR(cell);
> -
> -	buf = nvmem_cell_read(cell, &len);
> -	nvmem_cell_put(cell);
> -
> -	if (IS_ERR(buf))
> -		return PTR_ERR(buf);
> -
> -	memcpy(&calib_data, buf, min(len, sizeof(u32)));
> +	calib_data = adc_nvmem_cell_calib_data(data, cell_name);
>  
>  	/* Only need to calibrate the adc values in the linear graph. */
>  	graph->adc0 = sc27xx_adc_get_calib_data(calib_data, calib_graph->adc0);
>  	graph->adc1 = sc27xx_adc_get_calib_data(calib_data >> 8,
>  						calib_graph->adc1);
>  
> -	kfree(buf);
>  	return 0;
>  }
>  
> @@ -312,7 +326,7 @@ static void sc27xx_adc_volt_ratio(struct sc27xx_adc_data *data,
>  	*div_denominator = ratio & SC27XX_RATIO_DENOMINATOR_MASK;
>  }
>  
> -static int sc27xx_adc_to_volt(struct sc27xx_adc_linear_graph *graph,
> +static int adc_to_volt(struct sc27xx_adc_linear_graph *graph,
>  			      int raw_adc)
>  {
> 	int tmp;
> @@ -321,6 +335,16 @@ static int sc27xx_adc_to_volt(struct sc27xx_adc_linear_graph *graph,
>  	tmp /= (graph->adc0 - graph->adc1);
>  	tmp += graph->volt1;
>  
> +	return tmp;
> +}
> +
> +static int sc27xx_adc_to_volt(struct sc27xx_adc_linear_graph *graph,
> +			      int raw_adc)
> +{
> +	int tmp;
> +
> +	tmp = adc_to_volt(graph, raw_adc);
> +
>  	return tmp < 0 ? 0 : tmp;
>  }
>  


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

* Re: [PATCH V4 0/7] iio: adc: sc27xx: adjust structure and add PMIC's support
  2022-04-19 14:24 [PATCH V4 0/7] iio: adc: sc27xx: adjust structure and add PMIC's support Cixi Geng
                   ` (6 preceding siblings ...)
  2022-04-19 14:24 ` [PATCH V4 7/7] iio: adc: sc27xx: add support for PMIC sc2730 Cixi Geng
@ 2022-04-24 17:34 ` Jonathan Cameron
  2022-04-29  4:25   ` Cixi Geng
  7 siblings, 1 reply; 16+ messages in thread
From: Jonathan Cameron @ 2022-04-24 17:34 UTC (permalink / raw)
  To: Cixi Geng
  Cc: lars, robh+dt, krzysztof.kozlowski+dt, orsonzhai, baolin.wang7,
	zhang.lyra, yuming.zhu1, linux-iio, devicetree, linux-kernel

On Tue, 19 Apr 2022 22:24:51 +0800
Cixi Geng <gengcixi@gmail.com> wrote:

> From: Cixi Geng <cixi.geng1@unisoc.com>
> 
> this patchset add a sc27xx_adc_variant_data structure
> and add sc272*,sc273* and ump9620 PMIC support.

Series applied with the minor tweaks I've called out in replies
to individual patches.

Applied to the togreg branch of iio.git and pushed out as testing
for 0-day to see if it can find anything we missed.

Thanks,

Jonathan

> 
> v2 changes:
>   fix dt_binding_check error
>   adjust some code-style issue
>   optimize the copy-paste functions
>   the smatch warnings found by lkp
>   and  ohter comments by v1 patches.
> 
> v3 changes:
>   fix nvmem-cells Items value and add ump9620 dt sample
>   add the correct signature for each patch
>   fix the unused warning in 3/7, add explain for set the scales
>   remove duplicate code,add goto label in sc27xx_adc_read
>   pull out the refactor code into a single patch
>   delete the suspend and resume pm for ump9620
> 
> v4 changes:
>   Add fix tag in the 2/7 patch.
>   Separate modification and refactoring 3/7(v3) to 2 pathes.
>   remove the pmic_type struct instead of a boot set_volref
>   to define the specific feathure.
>   use switch statement in all scale_init functions.
>   remove ump9620 pmic support in this patchset, submit separately
>   in the next patches.
> 
> Cixi Geng (7):
>   dt-bindings:iio:adc: add sprd,ump9620-adc dt-binding
>   iio: adc: sc27xx: fix read big scale voltage not right
>   iio: adc: Fine tune the scale calibration values
>   iio: adc: sc27xx: structure adjustment and optimization
>   iio: adc: refactor some functions for support more PMiCs
>   iio: adc: sc27xx: add support for PMIC sc2720 and sc2721
>   iio: adc: sc27xx: add support for PMIC sc2730
> 
>  .../bindings/iio/adc/sprd,sc2720-adc.yaml     |  59 ++-
>  drivers/iio/adc/sc27xx_adc.c                  | 473 ++++++++++++++++--
>  2 files changed, 491 insertions(+), 41 deletions(-)
> 


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

* Re: [PATCH V4 0/7] iio: adc: sc27xx: adjust structure and add PMIC's support
  2022-04-24 17:34 ` [PATCH V4 0/7] iio: adc: sc27xx: adjust structure and add PMIC's support Jonathan Cameron
@ 2022-04-29  4:25   ` Cixi Geng
  0 siblings, 0 replies; 16+ messages in thread
From: Cixi Geng @ 2022-04-29  4:25 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: Lars-Peter Clausen, Rob Herring, krzysztof.kozlowski+dt,
	Orson Zhai, baolin.wang7, Chunyan Zhang,
	朱玉明 (Yuming Zhu/11457),
	linux-iio, Devicetree List, linux-kernel

Jonathan Cameron <jic23@kernel.org> 于2022年4月25日周一 01:26写道:
>
> On Tue, 19 Apr 2022 22:24:51 +0800
> Cixi Geng <gengcixi@gmail.com> wrote:
>
> > From: Cixi Geng <cixi.geng1@unisoc.com>
> >
> > this patchset add a sc27xx_adc_variant_data structure
> > and add sc272*,sc273* and ump9620 PMIC support.
>
> Series applied with the minor tweaks I've called out in replies
> to individual patches.
Thank you very much,I am very appreciated for your patience and sugestion
>
> Applied to the togreg branch of iio.git and pushed out as testing
> for 0-day to see if it can find anything we missed.
>
> Thanks,
>
> Jonathan
>
> >
> > v2 changes:
> >   fix dt_binding_check error
> >   adjust some code-style issue
> >   optimize the copy-paste functions
> >   the smatch warnings found by lkp
> >   and  ohter comments by v1 patches.
> >
> > v3 changes:
> >   fix nvmem-cells Items value and add ump9620 dt sample
> >   add the correct signature for each patch
> >   fix the unused warning in 3/7, add explain for set the scales
> >   remove duplicate code,add goto label in sc27xx_adc_read
> >   pull out the refactor code into a single patch
> >   delete the suspend and resume pm for ump9620
> >
> > v4 changes:
> >   Add fix tag in the 2/7 patch.
> >   Separate modification and refactoring 3/7(v3) to 2 pathes.
> >   remove the pmic_type struct instead of a boot set_volref
> >   to define the specific feathure.
> >   use switch statement in all scale_init functions.
> >   remove ump9620 pmic support in this patchset, submit separately
> >   in the next patches.
> >
> > Cixi Geng (7):
> >   dt-bindings:iio:adc: add sprd,ump9620-adc dt-binding
> >   iio: adc: sc27xx: fix read big scale voltage not right
> >   iio: adc: Fine tune the scale calibration values
> >   iio: adc: sc27xx: structure adjustment and optimization
> >   iio: adc: refactor some functions for support more PMiCs
> >   iio: adc: sc27xx: add support for PMIC sc2720 and sc2721
> >   iio: adc: sc27xx: add support for PMIC sc2730
> >
> >  .../bindings/iio/adc/sprd,sc2720-adc.yaml     |  59 ++-
> >  drivers/iio/adc/sc27xx_adc.c                  | 473 ++++++++++++++++--
> >  2 files changed, 491 insertions(+), 41 deletions(-)
> >
>

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

end of thread, other threads:[~2022-04-29  4:26 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-19 14:24 [PATCH V4 0/7] iio: adc: sc27xx: adjust structure and add PMIC's support Cixi Geng
2022-04-19 14:24 ` [PATCH V4 1/7] dt-bindings:iio:adc: add sprd,ump9620-adc dt-binding Cixi Geng
2022-04-20  7:01   ` Krzysztof Kozlowski
2022-04-24 17:21     ` Jonathan Cameron
2022-04-19 14:24 ` [PATCH V4 2/7] iio: adc: sc27xx: fix read big scale voltage not right Cixi Geng
2022-04-24 17:00   ` Jonathan Cameron
2022-04-19 14:24 ` [PATCH V4 3/7] iio: adc: Fine tune the scale calibration values Cixi Geng
2022-04-24 17:01   ` Jonathan Cameron
2022-04-24 17:28     ` Jonathan Cameron
2022-04-19 14:24 ` [PATCH V4 4/7] iio: adc: sc27xx: structure adjustment and optimization Cixi Geng
2022-04-19 14:24 ` [PATCH V4 5/7] iio: adc: refactor some functions for support more PMiCs Cixi Geng
2022-04-24 17:30   ` Jonathan Cameron
2022-04-19 14:24 ` [PATCH V4 6/7] iio: adc: sc27xx: add support for PMIC sc2720 and sc2721 Cixi Geng
2022-04-19 14:24 ` [PATCH V4 7/7] iio: adc: sc27xx: add support for PMIC sc2730 Cixi Geng
2022-04-24 17:34 ` [PATCH V4 0/7] iio: adc: sc27xx: adjust structure and add PMIC's support Jonathan Cameron
2022-04-29  4:25   ` Cixi Geng

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.