iio: adc: sc27xx: adjust structure and add PMIC's support
Subsystems (3)
v4 cover iio: adc: sc27xx: adjust structure and add PMIC's support
From: Cixi Geng <[email protected]>
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(-)
Signature · 1 line
2.25.1
PATCH v4 1/7 dt-bindings:iio:adc: add sprd,ump9620-adc dt-binding
From: Cixi Geng <[email protected]>
sprd,ump9620-adc is one variant of sc27xx series, add ump9620 description and sample in dt-bindings.
--- .../bindings/iio/adc/sprd,sc2720-adc.yaml | 59 +++++++++++++++++-- 1 file changed, 53 insertions(+), 6 deletions(-)
Documentation/devicetree/bindings/iio/adc/sprd,sc2720-adc.yaml +53 -6
@@ -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"; + }; + }; ...
Signature · 1 line
2.25.1
Re: [PATCH V4 1/7] dt-bindings:iio:adc: add sprd,ump9620-adc dt-binding
Documentation/devicetree/bindings/iio/adc/sprd,sc2720-adc.yaml properties:
Quoted 6 lines · Cixi Geng
Documentation/devicetree/bindings/iio/adc/sprd,sc2720-adc.yaml +2
-4- 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:
Documentation/devicetree/bindings/iio/adc/sprd,sc2720-adc.yaml properties: · line 44
Quoted 3 lines
Documentation/devicetree/bindings/iio/adc/sprd,sc2720-adc.yaml +3
-0+ not: + properties: + compatible:
Best regards,
Krzysztof
Jonathan Cameron
maintainerRe: [PATCH V4 1/7] dt-bindings:iio:adc: add sprd,ump9620-adc dt-binding
Quoted 8 lines · On Wed, 20 Apr 2022 09:01:51 +0200 Krzysztof Kozlowski…
Documentation/devicetree/bindings/iio/adc/sprd,sc2720-adc.yaml properties:
Quoted 6 lines · Cixi Geng
Documentation/devicetree/bindings/iio/adc/sprd,sc2720-adc.yaml +2
-4- nvmem-cell-names: - items: - - const: big_scale_calib - - const: small_scale_calib + nvmem-cell-names: true +> +if:
Quoted 4 lines
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 <[email protected]>
I added the allOf: whilst applying.
Thanks,
Jonathan
Quoted 9 lines
Documentation/devicetree/bindings/iio/adc/sprd,sc2720-adc.yaml properties: · line 44
Quoted 4 lines
Documentation/devicetree/bindings/iio/adc/sprd,sc2720-adc.yaml +3
-0+ not: + properties: + compatible:Best regards,
Krzysztof
PATCH v4 2/7 iio: adc: sc27xx: fix read big scale voltage not right
In reply to Cixi GengFrom: Cixi Geng <[email protected]>
Fix wrong configuration value of SC27XX_ADC_SCALE_MASK and SC27XX_ADC_SCALE_SHIFT by spec documetation.
--- drivers/iio/adc/sc27xx_adc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/iio/adc/sc27xx_adc.c +2 -2
@@ -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)
Signature · 1 line
2.25.1
Jonathan Cameron
maintainerRe: [PATCH V4 2/7] iio: adc: sc27xx: fix read big scale voltage not right
Quoted 5 lines · On Tue, 19 Apr 2022 22:24:53 +0800 Cixi Geng <[email protected]> wrote:
From: Cixi Geng <[email protected]>
Fix wrong configuration value of
SC27XX_ADC_SCALE_MASKandSC27XX_ADC_SCALE_SHIFTby 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
Quoted 22 lines
Signed-off-by Cixi Geng <[email protected]>Reviewed-by Baolin Wang <[email protected]>--- drivers/iio/adc/sc27xx_adc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/iio/adc/sc27xx_adc.c +2
-2@@ -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)
PATCH v4 3/7 iio: adc: Fine tune the scale calibration values
In reply to Cixi GengFrom: Cixi Geng <[email protected]>
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.
--- drivers/iio/adc/sc27xx_adc.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-)
drivers/iio/adc/sc27xx_adc.c +11 -8
@@ -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" ; }
Signature · 1 line
2.25.1
Jonathan Cameron
maintainerRe: [PATCH V4 3/7] iio: adc: Fine tune the scale calibration values
Quoted 7 lines · On Tue, 19 Apr 2022 22:24:54 +0800 Cixi Geng <[email protected]> wrote:
From: Cixi Geng <[email protected]>
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.
Quoted 11 lines
Signed-off-by Cixi Geng <[email protected]>--- drivers/iio/adc/sc27xx_adc.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-)drivers/iio/adc/sc27xx_adc.c +0
-0
drivers/iio/adc/sc27xx_adc.c static struct sc27xx_adc_linear_graph small_scale_graph = { · line 108
Quoted 9 lines
drivers/iio/adc/sc27xx_adc.c +3
-3@@ -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.
Quoted 28 lines
drivers/iio/adc/sc27xx_adc.c +8
-5+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" ; }
Jonathan Cameron
maintainerRe: [PATCH V4 3/7] iio: adc: Fine tune the scale calibration values
Quoted 34 lines · On Sun, 24 Apr 2022 18:01:47 +0100 Jonathan Cameron <[email protected]> wrote:
Quoted 7 lines · On Tue, 19 Apr 2022 22:24:54 +0800 Cixi Geng <[email protected]> wrote:
From: Cixi Geng <[email protected]>
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.
Quoted 11 lines
Signed-off-by Cixi Geng <[email protected]>--- drivers/iio/adc/sc27xx_adc.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-)drivers/iio/adc/sc27xx_adc.c +0
-0drivers/iio/adc/sc27xx_adc.c static struct sc27xx_adc_linear_graph small_scale_graph = { · line 108
Quoted 9 lines
drivers/iio/adc/sc27xx_adc.c +3
-3@@ -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?
Quoted 1 line
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.
Quoted 30 lines
Quoted 29 lines
drivers/iio/adc/sc27xx_adc.c +8
-5+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" ; }
PATCH v4 4/7 iio: adc: sc27xx: structure adjustment and optimization
In reply to Cixi GengFrom: Cixi Geng <[email protected]>
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.
--- drivers/iio/adc/sc27xx_adc.c | 91 ++++++++++++++++++++++++++++++------ 1 file changed, 76 insertions(+), 15 deletions(-)
drivers/iio/adc/sc27xx_adc.c +76 -15
@@ -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);
Signature · 1 line
2.25.1
PATCH v4 5/7 iio: adc: refactor some functions for support more PMiCs
In reply to Cixi GengFrom: Cixi Geng <[email protected]>
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
--- drivers/iio/adc/sc27xx_adc.c | 56 +++++++++++++++++++++++++----------- 1 file changed, 40 insertions(+), 16 deletions(-)
drivers/iio/adc/sc27xx_adc.c +30 -16
@@ -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;
}
Signature · 1 line
2.25.1
Jonathan Cameron
maintainerRe: [PATCH V4 5/7] iio: adc: refactor some functions for support more PMiCs
Quoted 1 line · On Tue, 19 Apr 2022 22:24:56 +0800 Cixi Geng <[email protected]> wrote:
From: Cixi Geng <[email protected]>
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
Quoted 110 lines
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 <[email protected]>--- drivers/iio/adc/sc27xx_adc.c | 56 +++++++++++++++++++++++++----------- 1 file changed, 40 insertions(+), 16 deletions(-)drivers/iio/adc/sc27xx_adc.c +40
-16@@ -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; }
PATCH v4 6/7 iio: adc: sc27xx: add support for PMIC sc2720 and sc2721
In reply to Cixi GengFrom: Cixi Geng <[email protected]>
sc2720 and sc2721 is the product of sc27xx series.
--- drivers/iio/adc/sc27xx_adc.c | 203 ++++++++++++++++++++++++++++++++++- 1 file changed, 201 insertions(+), 2 deletions(-)
drivers/iio/adc/sc27xx_adc.c +201 -2
@@ -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);
Signature · 1 line
2.25.1
PATCH v4 7/7 iio: adc: sc27xx: add support for PMIC sc2730
In reply to Cixi GengFrom: Cixi Geng <[email protected]>
sc2730 is the product of sc27xx series.
--- drivers/iio/adc/sc27xx_adc.c | 116 +++++++++++++++++++++++++++++++++++ 1 file changed, 116 insertions(+)
drivers/iio/adc/sc27xx_adc.c +116 -0
@@ -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}, { }
Signature · 1 line
2.25.1
Jonathan Cameron
maintainerQuoted 4 lines · On Tue, 19 Apr 2022 22:24:51 +0800 Cixi Geng <[email protected]> wrote:
From: Cixi Geng <[email protected]>
this patchset add a
sc27xx_adc_variant_datastructure 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
Quoted 38 lines
v2 changes:
fixdt_binding_checkerror
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 insc27xx_adc_readpull out the refactor code into a single patch delete the suspend and resume pm for ump9620v4 changes:
Add fix tag in the 2/7 patch.
Separate modification and refactoring 3/7(v3) to 2 pathes. remove thepmic_typestruct instead of a bootset_volrefto define the specific feathure.
use switch statement in allscale_initfunctions. 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(-)
Quoted 11 lines · Jonathan Cameron <[email protected]> 于2022年4月25日周一 01:26写道:
Quoted 4 lines · On Tue, 19 Apr 2022 22:24:51 +0800 Cixi Geng <[email protected]> wrote:
From: Cixi Geng <[email protected]>
this patchset add a
sc27xx_adc_variant_datastructure 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
Quoted 47 lines
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
Quoted 38 lines
v2 changes:
fixdt_binding_checkerror
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 insc27xx_adc_readpull out the refactor code into a single patch delete the suspend and resume pm for ump9620v4 changes:
Add fix tag in the 2/7 patch.
Separate modification and refactoring 3/7(v3) to 2 pathes. remove thepmic_typestruct instead of a bootset_volrefto define the specific feathure.
use switch statement in allscale_initfunctions. 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(-)