RK3588 ADC support
Subsystems (3)
v3 cover RK3588 ADC support
This patch series adds ADC support for RK3588 and updates the DT bindings for the same.
To test ADC support on Rock 5B board, a voltage divider circuit was created using the gpio pin 22 ( SARADC_IN4 ) and few more tests were ran for testing the buffer and trigger support using the iio_generic_buffer tool.
Changes in v3
- Add bitfield.h header file in patch 2.
- Add a Reviewed-by tag in patch 2.
- Do not remove clock enabling and disabling from the suspend and resume functions respectively in patch 3
Changes in v2
- Add from address in patches 1 and 2.
- Create separate patches for adding new device support and changes to the old device code.
- Make use of FIELD_PREP in patch 2.
- Move the enablement of clocks at it's original position in patch 3
- Add Reviewed-by tag in patches 4 and 5.
- Add an Acked-by tag in patch 8.
Shreeya Patel (8):
iio: adc: rockchip_saradc: Add callback functions
iio: adc: rockchip_saradc: Add support for RK3588
iio: adc: rockchip_saradc: Make use of devm_clk_get_enabled
iio: adc: rockchip_saradc: Use of_device_get_match_data
iio: adc: rockchip_saradc: Match alignment with open parenthesis
iio: adc: rockchip_saradc: Use dev_err_probe
arm64: dts: rockchip: Add DT node for ADC support in RK3588
dt-bindings: iio: adc: Add rockchip,rk3588-saradc string
.../bindings/iio/adc/rockchip-saradc.yaml | 1 + arch/arm64/boot/dts/rockchip/rk3588s.dtsi | 12 + drivers/iio/adc/rockchip_saradc.c | 246 +++++++++++------- 3 files changed, 168 insertions(+), 91 deletions(-)
Signature · 1 line
2.30.2
PATCH v3 1/8 iio: adc: rockchip_saradc: Add callback functions
From: Simon Xue <[email protected]>
Add start, read and power_down callback functions, which will help in adding new rockchip device support cleanly.
---
Changes in v3
- no change
Changes in v2
- Add a from address.
- Create a separate patch for changes done in the code for old devices.
drivers/iio/adc/rockchip_saradc.c | 64 +++++++++++++++++++++++++------ 1 file changed, 52 insertions(+), 12 deletions(-)
drivers/iio/adc/rockchip_saradc.c +52 -12
@@ -38,10 +38,15 @@#define SARADC_TIMEOUT msecs_to_jiffies(100)#define SARADC_MAX_CHANNELS 8 +struct rockchip_saradc ; +struct rockchip_saradc_data {const struct iio_chan_spec *channels;int num_channels;unsigned long clk_rate; +void (*start)(struct rockchip_saradc *info,int chn); +int (*read)(struct rockchip_saradc *info); +void (*power_down)(struct rockchip_saradc *info); };struct rockchip_saradc {
@@ -60,27 +65,50 @@ struct rockchip_saradc {struct notifier_block nb; }; -static void rockchip_saradc_power_down (struct rockchip_saradc *info) +static void rockchip_saradc_reset_controller (struct reset_control *reset); + +static void rockchip_saradc_start_v1 (struct rockchip_saradc *info,int chn) +{ +/* 8 clock periods as delay between power up and start cmd */ +writel_relaxed (8 , info->regs +SARADC_DLY_PU_SOC ); +/* Select the channel to be used and trigger conversion */ +writel (SARADC_CTRL_POWER_CTRL | (chn &SARADC_CTRL_CHN_MASK ) | +SARADC_CTRL_IRQ_ENABLE , info->regs +SARADC_CTRL ); +} + +static void rockchip_saradc_start (struct rockchip_saradc *info,int chn) +{ + info->data->start (info, chn); +} + +static int rockchip_saradc_read_v1 (struct rockchip_saradc *info) +{ +return readl_relaxed (info->regs +SARADC_DATA ); +} + +static int rockchip_saradc_read (struct rockchip_saradc *info) +{ +return info->data->read (info); +} + +static void rockchip_saradc_power_down_v1 (struct rockchip_saradc *info) { -/* Clear irq & power down adc */ writel_relaxed (0 , info->regs +SARADC_CTRL ); } +static void rockchip_saradc_power_down (struct rockchip_saradc *info) +{ +if (info->data->power_down) + info->data->power_down (info); +} +static int rockchip_saradc_conversion (struct rockchip_saradc *info,struct iio_chan_spec const *chan) {reinit_completion (&info->completion); -/* 8 clock periods as delay between power up and start cmd */ -writel_relaxed (8 , info->regs +SARADC_DLY_PU_SOC ); - info->last_chan = chan; - -/* Select the channel to be used and trigger conversion */ -writel (SARADC_CTRL_POWER_CTRL - | (chan->channel &SARADC_CTRL_CHN_MASK ) - |SARADC_CTRL_IRQ_ENABLE , - info->regs +SARADC_CTRL ); +rockchip_saradc_start (info, chan->channel);if (!wait_for_completion_timeout (&info->completion,SARADC_TIMEOUT ))return -ETIMEDOUT ;
@@ -123,7 +151,7 @@ static irqreturn_t rockchip_saradc_isr(int irq, void *dev_id)struct rockchip_saradc *info = dev_id;/* Read value */ - info->last_val =readl_relaxed (info->regs +SARADC_DATA ); + info->last_val =rockchip_saradc_read (info); info->last_val &=GENMASK (info->last_chan->scan_type.realbits -1 ,0 );rockchip_saradc_power_down (info);
@@ -163,6 +191,9 @@ static const struct rockchip_saradc_data saradc_data = { .channels = rockchip_saradc_iio_channels, .num_channels = ARRAY_SIZE(rockchip_saradc_iio_channels), .clk_rate = 1000000, + .start = rockchip_saradc_start_v1, + .read = rockchip_saradc_read_v1, + .power_down = rockchip_saradc_power_down_v1, };static const struct iio_chan_spec rockchip_rk3066_tsadc_iio_channels[] = {
@@ -174,6 +205,9 @@ static const struct rockchip_saradc_data rk3066_tsadc_data = { .channels = rockchip_rk3066_tsadc_iio_channels, .num_channels = ARRAY_SIZE(rockchip_rk3066_tsadc_iio_channels), .clk_rate = 50000, + .start = rockchip_saradc_start_v1, + .read = rockchip_saradc_read_v1, + .power_down = rockchip_saradc_power_down_v1, };static const struct iio_chan_spec rockchip_rk3399_saradc_iio_channels[] = {
@@ -189,6 +223,9 @@ static const struct rockchip_saradc_data rk3399_saradc_data = { .channels = rockchip_rk3399_saradc_iio_channels, .num_channels = ARRAY_SIZE(rockchip_rk3399_saradc_iio_channels), .clk_rate = 1000000, + .start = rockchip_saradc_start_v1, + .read = rockchip_saradc_read_v1, + .power_down = rockchip_saradc_power_down_v1, };static const struct iio_chan_spec rockchip_rk3568_saradc_iio_channels[] = {
@@ -206,6 +243,9 @@ static const struct rockchip_saradc_data rk3568_saradc_data = { .channels = rockchip_rk3568_saradc_iio_channels, .num_channels = ARRAY_SIZE(rockchip_rk3568_saradc_iio_channels), .clk_rate = 1000000, + .start = rockchip_saradc_start_v1, + .read = rockchip_saradc_read_v1, + .power_down = rockchip_saradc_power_down_v1, };static const struct of_device_id rockchip_saradc_match[] = {
Signature · 1 line
2.30.2
PATCH v3 2/8 iio: adc: rockchip_saradc: Add support for RK3588
In reply to Shreeya PatelFrom: Simon Xue <[email protected]>
Add new start and read functions to support rk3588 device. Also, add a device compatible string for the same.
---
Changes in v3
- Add bitfield.h header file.
- Add a Reviewed-by tag.
Changes in v2
- Add a from address.
- Create separate patches for adding new device support and changes to the old device code.
- Make use of FIELD_PREP.
drivers/iio/adc/rockchip_saradc.c | 70 +++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+)
drivers/iio/adc/rockchip_saradc.c +70 -0
@@ -4,6 +4,7 @@* Copyright (C) 2014 ROCKCHIP, Inc. */ +#include <linux/bitfield.h> #include <linux/module.h> #include <linux/mutex.h> #include <linux/platform_device.h>
@@ -38,6 +39,22 @@#define SARADC_TIMEOUT msecs_to_jiffies(100)#define SARADC_MAX_CHANNELS 8 +/* v2 registers */ +#define SARADC2_CONV_CON 0x0 +#define SARADC_T_PD_SOC 0x4 +#define SARADC_T_DAS_SOC 0xc +#define SARADC2_END_INT_EN 0x104 +#define SARADC2_ST_CON 0x108 +#define SARADC2_STATUS 0x10c +#define SARADC2_END_INT_ST 0x110 +#define SARADC2_DATA_BASE 0x120 + +#define SARADC2_EN_END_INT BIT(0) +#define SARADC2_START BIT(4) +#define SARADC2_SINGLE_MODE BIT(5) + +#define SARADC2_CONV_CHANNELS GENMASK(15, 0) +struct rockchip_saradc ;struct rockchip_saradc_data {
@@ -76,6 +93,25 @@ static void rockchip_saradc_start_v1(struct rockchip_saradc *info, int chn) SARADC_CTRL_IRQ_ENABLE, info->regs + SARADC_CTRL); } +static void rockchip_saradc_start_v2 (struct rockchip_saradc *info,int chn) +{ +int val; + +if (info->reset) +rockchip_saradc_reset_controller (info->reset); + +writel_relaxed (0xc , info->regs +SARADC_T_DAS_SOC ); +writel_relaxed (0x20 , info->regs +SARADC_T_PD_SOC ); + val =FIELD_PREP (SARADC2_EN_END_INT ,1 ); + val |= val <<16 ; +writel_relaxed (val, info->regs +SARADC2_END_INT_EN ); + val =FIELD_PREP (SARADC2_START ,1 ) | +FIELD_PREP (SARADC2_SINGLE_MODE ,1 ) | +FIELD_PREP (SARADC2_CONV_CHANNELS , chn); + val |= val <<16 ; +writel (val, info->regs +SARADC2_CONV_CON ); +} +static void rockchip_saradc_start (struct rockchip_saradc *info,int chn) { info->data->start (info, chn);
@@ -86,6 +122,18 @@ static int rockchip_saradc_read_v1(struct rockchip_saradc *info)return readl_relaxed (info->regs +SARADC_DATA ); } +static int rockchip_saradc_read_v2 (struct rockchip_saradc *info) +{ +int offset; + +/* Clear irq */ +writel_relaxed (0x1 , info->regs +SARADC2_END_INT_ST ); + + offset =SARADC2_DATA_BASE + info->last_chan->channel *0x4 ; + +return readl_relaxed (info->regs + offset); +} +static int rockchip_saradc_read (struct rockchip_saradc *info) {return info->data->read (info);
@@ -248,6 +296,25 @@ static const struct rockchip_saradc_data rk3568_saradc_data = { .power_down = rockchip_saradc_power_down_v1, }; +static const struct iio_chan_spec rockchip_rk3588_saradc_iio_channels[] = { +SARADC_CHANNEL (0 ,"adc0" ,12 ), +SARADC_CHANNEL (1 ,"adc1" ,12 ), +SARADC_CHANNEL (2 ,"adc2" ,12 ), +SARADC_CHANNEL (3 ,"adc3" ,12 ), +SARADC_CHANNEL (4 ,"adc4" ,12 ), +SARADC_CHANNEL (5 ,"adc5" ,12 ), +SARADC_CHANNEL (6 ,"adc6" ,12 ), +SARADC_CHANNEL (7 ,"adc7" ,12 ), +}; + +static const struct rockchip_saradc_data rk3588_saradc_data = { + .channels = rockchip_rk3588_saradc_iio_channels, + .num_channels =ARRAY_SIZE (rockchip_rk3588_saradc_iio_channels), + .clk_rate =1000000 , + .start = rockchip_saradc_start_v2, + .read = rockchip_saradc_read_v2, +}; +static const struct of_device_id rockchip_saradc_match[] = { { .compatible ="rockchip,saradc" ,
@@ -261,6 +328,9 @@ static const struct of_device_id rockchip_saradc_match[] = { }, { .compatible = "rockchip,rk3568-saradc", .data = &rk3568_saradc_data, + }, { + .compatible = "rockchip,rk3588-saradc", + .data = &rk3588_saradc_data, }, {}, };
Signature · 1 line
2.30.2
Re: [PATCH v3 2/8] iio: adc: rockchip_saradc: Add support for RK3588
Sun, Jun 04, 2023 at 12:23:34AM +0530, Shreeya Patel kirjoitti:
Quoted 4 lines
From: Simon Xue <[email protected]>
Add new start and read functions to support rk3588 device. Also, add a device compatible string for the same.
...
drivers/iio/adc/rockchip_saradc.c line 45
Quoted 4 lines
drivers/iio/adc/rockchip_saradc.c +4
-0+/* v2 registers */ +#define SARADC2_CONV_CON 0x0 +#define SARADC_T_PD_SOC 0x4 +#define SARADC_T_DAS_SOC 0xc
Can you use fixed-width values for all registers?
0x000 0x004 0x00c
Quoted 5 lines
drivers/iio/adc/rockchip_saradc.c +5
-0+#define SARADC2_END_INT_EN 0x104 +#define SARADC2_ST_CON 0x108 +#define SARADC2_STATUS 0x10c +#define SARADC2_END_INT_ST 0x110 +#define SARADC2_DATA_BASE 0x120
Signature · 2 lines
With Best Regards, Andy Shevchenko
Jonathan Cameron
maintainerRe: [PATCH v3 2/8] iio: adc: rockchip_saradc: Add support for RK3588
Quoted 19 lines · On Sat, 3 Jun 2023 23:48:00 +0300 [email protected] wrote:
Sun, Jun 04, 2023 at 12:23:34AM +0530, Shreeya Patel kirjoitti:
Quoted 4 lines
From: Simon Xue <[email protected]>
Add new start and read functions to support rk3588 device. Also, add a device compatible string for the same.
...
drivers/iio/adc/rockchip_saradc.c line 45
Quoted 4 lines
drivers/iio/adc/rockchip_saradc.c +4
-0+/* v2 registers */ +#define SARADC2_CONV_CON 0x0 +#define SARADC_T_PD_SOC 0x4 +#define SARADC_T_DAS_SOC 0xcCan you use fixed-width values for all registers?
0x000 0x004 0x00c
Quoted 6 lines
drivers/iio/adc/rockchip_saradc.c line 50
Quoted 5 lines
drivers/iio/adc/rockchip_saradc.c +5
-0+#define SARADC2_END_INT_EN 0x104 +#define SARADC2_ST_CON 0x108 +#define SARADC2_STATUS 0x10c +#define SARADC2_END_INT_ST 0x110 +#define SARADC2_DATA_BASE 0x120
I tidied this up whilst applying.
Jonathan
Re: [PATCH v3 2/8] iio: adc: rockchip_saradc: Add support for RK3588
Quoted 20 lines · Jonathan Cameron
Quoted 17 lines · On Sat, 3 Jun 2023 23:48:00 +0300 [email protected] wrote:
Sun, Jun 04, 2023 at 12:23:34AM +0530, Shreeya Patel kirjoitti:
Quoted 4 lines
From: Simon Xue <[email protected]>
Add new start and read functions to support rk3588 device. Also, add a device compatible string for the same.
...
drivers/iio/adc/rockchip_saradc.c line 45
Quoted 4 lines
drivers/iio/adc/rockchip_saradc.c +4
-0+/* v2 registers */ +#define SARADC2_CONV_CON 0x0 +#define SARADC_T_PD_SOC 0x4 +#define SARADC_T_DAS_SOC 0xcCan you use fixed-width values for all registers?
0x000 0x004 0x00c
Quoted 6 lines
Quoted 5 lines
drivers/iio/adc/rockchip_saradc.c line 50
Quoted 5 lines
drivers/iio/adc/rockchip_saradc.c +5
-0+#define SARADC2_END_INT_EN 0x104 +#define SARADC2_ST_CON 0x108 +#define SARADC2_STATUS 0x10c +#define SARADC2_END_INT_ST 0x110 +#define SARADC2_DATA_BASE 0x120I tidied this up whilst applying.
Ah, I was just about to send a v4 with the change. Thank you for making the changes.
Regards,
Shreeya Patel
Quoted 1 line
Jonathan
PATCH v3 3/8 iio: adc: rockchip_saradc: Make use of devm_clk_get_enabled
In reply to Shreeya PatelUse devm_clk_get_enabled() to avoid manually disabling the clock.
---
Changes in v3
- Do not remove clock enabling and disabling from the suspend and resume functions respectively.
Changes in v2
- No need to enable the clocks earlier than the original code. Move the enablement of clocks at it's original position.
drivers/iio/adc/rockchip_saradc.c | 56 +++++-------------------------- 1 file changed, 8 insertions(+), 48 deletions(-)
drivers/iio/adc/rockchip_saradc.c +8 -48
@@ -346,20 +346,6 @@ static void rockchip_saradc_reset_controller(struct reset_control *reset)reset_control_deassert (reset); } -static void rockchip_saradc_clk_disable (void *data) -{ -struct rockchip_saradc *info = data; - -clk_disable_unprepare (info->clk); -} - -static void rockchip_saradc_pclk_disable (void *data) -{ -struct rockchip_saradc *info = data; - -clk_disable_unprepare (info->pclk); -} -static void rockchip_saradc_regulator_disable (void *data) {struct rockchip_saradc *info = data;
@@ -493,16 +479,6 @@ static int rockchip_saradc_probe(struct platform_device *pdev)return ret; } - info->pclk =devm_clk_get (&pdev->dev,"apb_pclk" ); -if (IS_ERR (info->pclk)) -return dev_err_probe (&pdev->dev,PTR_ERR (info->pclk), -"failed to get pclk\n" ); - - info->clk =devm_clk_get (&pdev->dev,"saradc" ); -if (IS_ERR (info->clk)) -return dev_err_probe (&pdev->dev,PTR_ERR (info->clk), -"failed to get adc clock\n" ); - info->vref =devm_regulator_get (&pdev->dev,"vref" );if (IS_ERR (info->vref)) return dev_err_probe(&pdev->dev, PTR_ERR(info->vref),
@@ -540,31 +516,15 @@ static int rockchip_saradc_probe(struct platform_device *pdev) info->uv_vref = ret; - ret =clk_prepare_enable (info->pclk); -if (ret <0 ) { -dev_err (&pdev->dev,"failed to enable pclk\n" ); -return ret; - } - ret =devm_add_action_or_reset (&pdev->dev, - rockchip_saradc_pclk_disable, info); -if (ret) { -dev_err (&pdev->dev,"failed to register devm action, %d\n" , - ret); -return ret; - } + info->pclk =devm_clk_get_enabled (&pdev->dev,"apb_pclk" ); +if (IS_ERR (info->pclk)) +return dev_err_probe (&pdev->dev,PTR_ERR (info->pclk), +"failed to get pclk\n" ); - ret =clk_prepare_enable (info->clk); -if (ret <0 ) { -dev_err (&pdev->dev,"failed to enable converter clock\n" ); -return ret; - } - ret =devm_add_action_or_reset (&pdev->dev, - rockchip_saradc_clk_disable, info); -if (ret) { -dev_err (&pdev->dev,"failed to register devm action, %d\n" , - ret); -return ret; - } + info->clk =devm_clk_get_enabled (&pdev->dev,"saradc" ); +if (IS_ERR (info->clk)) +return dev_err_probe (&pdev->dev,PTR_ERR (info->clk), +"failed to get adc clock\n" );platform_set_drvdata (pdev, indio_dev);
Signature · 1 line
2.30.2
PATCH v3 4/8 iio: adc: rockchip_saradc: Use of_device_get_match_data
In reply to Shreeya PatelUse of_device_get_match_data() to simplify the code.
---
Changes in v3
- No change
Changes in v2
- Add a Reviewed-by tag.
drivers/iio/adc/rockchip_saradc.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/iio/adc/rockchip_saradc.c +4 -4
@@ -415,10 +415,10 @@ static void rockchip_saradc_regulator_unreg_notifier(void *data)static int rockchip_saradc_probe (struct platform_device *pdev) { +const struct rockchip_saradc_data *match_data;struct rockchip_saradc *info =NULL ;struct device_node *np = pdev->dev.of_node;struct iio_dev *indio_dev =NULL ; -const struct of_device_id *match;int ret;int irq;
@@ -432,13 +432,13 @@ static int rockchip_saradc_probe(struct platform_device *pdev) } info =iio_priv (indio_dev); - match =of_match_device (rockchip_saradc_match, &pdev->dev); -if (!match) { + match_data =of_device_get_match_data (&pdev->dev); +if (!match_data) {dev_err (&pdev->dev,"failed to match device\n" );return -ENODEV ; } - info->data = match->data; + info->data = match_data;/* Sanity check for possible later IP variants with more channels */ if (info->data->num_channels >SARADC_MAX_CHANNELS ) {
Signature · 7 lines
2.30.2 _______________________________________________ Linux-rockchip mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-rockchip
PATCH v3 5/8 iio: adc: rockchip_saradc: Match alignment with open parenthesis
In reply to Shreeya PatelMatch alignment with open parenthesis for improving the code readability.
---
Changes in v3
- No change
Changes in v2
- Add a Reviewed-by tag.
drivers/iio/adc/rockchip_saradc.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/iio/adc/rockchip_saradc.c +2 -3
@@ -151,7 +151,7 @@ static void rockchip_saradc_power_down(struct rockchip_saradc *info) }static int rockchip_saradc_conversion (struct rockchip_saradc *info, -struct iio_chan_spec const *chan) +struct iio_chan_spec const *chan) {reinit_completion (&info->completion);
@@ -394,8 +394,7 @@ static irqreturn_t rockchip_saradc_trigger_handler(int irq, void *p) }static int rockchip_saradc_volt_notify (struct notifier_block *nb, -unsigned long event, -void *data) +unsigned long event,void *data) {struct rockchip_saradc *info = container_of(nb, struct rockchip_saradc, nb);
Signature · 7 lines
2.30.2 _______________________________________________ Linux-rockchip mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-rockchip
PATCH v3 6/8 iio: adc: rockchip_saradc: Use dev_err_probe
In reply to Shreeya PatelUse dev_err_probe instead of dev_err in probe function, which simplifies code a little bit and prints the error code.
---
Changes in v3
- No change
Changes in v2
- No change
drivers/iio/adc/rockchip_saradc.c | 45 ++++++++++++++----------------- 1 file changed, 20 insertions(+), 25 deletions(-)
drivers/iio/adc/rockchip_saradc.c +20 -25
@@ -425,25 +425,23 @@ static int rockchip_saradc_probe(struct platform_device *pdev)return -ENODEV ; indio_dev =devm_iio_device_alloc (&pdev->dev,sizeof (*info)); -if (!indio_dev) { -dev_err (&pdev->dev,"failed allocating iio device\n" ); -return -ENOMEM ; - } +if (!indio_dev) +return dev_err_probe (&pdev->dev, -ENOMEM , +"failed allocating iio device\n" ); + info =iio_priv (indio_dev); match_data =of_device_get_match_data (&pdev->dev); -if (!match_data) { -dev_err (&pdev->dev,"failed to match device\n" ); -return -ENODEV ; - } +if (!match_data) +return dev_err_probe (&pdev->dev, -ENODEV , +"failed to match device\n" ); info->data = match_data;/* Sanity check for possible later IP variants with more channels */ -if (info->data->num_channels >SARADC_MAX_CHANNELS ) { -dev_err (&pdev->dev,"max channels exceeded" ); -return -EINVAL ; - } +if (info->data->num_channels >SARADC_MAX_CHANNELS ) +return dev_err_probe (&pdev->dev, -EINVAL , +"max channels exceeded" ); info->regs =devm_platform_ioremap_resource (pdev,0 );if (IS_ERR (info->regs))
@@ -491,23 +489,20 @@ static int rockchip_saradc_probe(struct platform_device *pdev)* This may become user-configurable in the future. */ ret =clk_set_rate (info->clk, info->data->clk_rate); -if (ret <0 ) { -dev_err (&pdev->dev,"failed to set adc clk rate, %d\n" , ret); -return ret; - } +if (ret <0 ) +return dev_err_probe (&pdev->dev, ret, +"failed to set adc clk rate\n" ); ret =regulator_enable (info->vref); -if (ret <0 ) { -dev_err (&pdev->dev,"failed to enable vref regulator\n" ); -return ret; - } +if (ret <0 ) +return dev_err_probe (&pdev->dev, ret, +"failed to enable vref regulator\n" ); + ret =devm_add_action_or_reset (&pdev->dev, rockchip_saradc_regulator_disable, info); -if (ret) { -dev_err (&pdev->dev,"failed to register devm action, %d\n" , - ret); -return ret; - } +if (ret) +return dev_err_probe (&pdev->dev, ret, +"failed to register devm action\n" ); ret =regulator_get_voltage (info->vref);if (ret <0 )
Signature · 7 lines
2.30.2 _______________________________________________ Linux-rockchip mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-rockchip
PATCH v3 7/8 arm64: dts: rockchip: Add DT node for ADC support in RK3588
In reply to Shreeya PatelAdd DT node for ADC support in RK3588.
---
Changes in v3
- No change
Changes in v2
- No change
arch/arm64/boot/dts/rockchip/rk3588s.dtsi | 12 ++++++++++++ 1 file changed, 12 insertions(+)
arch/arm64/boot/dts/rockchip/rk3588s.dtsi +12 -0
@@ -1913,6 +1913,18 @@ dmac2: dma-controller@fed10000 { #dma-cells = <1>; }; + saradc: saradc@fec10000 { + compatible = "rockchip,rk3588-saradc"; + reg = <0x0 0xfec10000 0x0 0x10000>; + interrupts = <GIC_SPI 398 IRQ_TYPE_LEVEL_HIGH 0>; + #io-channel-cells = <1>; + clocks = <&cru CLK_SARADC>, <&cru PCLK_SARADC>; + clock-names = "saradc", "apb_pclk"; + resets = <&cru SRST_P_SARADC>; + reset-names = "saradc-apb"; + status = "disabled"; + }; + system_sram2: sram@ff001000 { compatible = "mmio-sram"; reg = <0x0 0xff001000 0x0 0xef000>;
Signature · 7 lines
2.30.2 _______________________________________________ Linux-rockchip mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-rockchip
PATCH v3 8/8 dt-bindings: iio: adc: Add rockchip,rk3588-saradc string
In reply to Shreeya PatelAdd rockchip,rk3588-saradc compatible string.
---
Changes in v3
- No change
Changes in v2
- Add an Acked-by tag.
Documentation/devicetree/bindings/iio/adc/rockchip-saradc.yaml | 1 + 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/iio/adc/rockchip-saradc.yaml +1 -0
@@ -21,6 +21,7 @@ properties: - rockchip,rk3308-saradc - rockchip,rk3328-saradc - rockchip,rk3568-saradc + - rockchip,rk3588-saradc - rockchip,rv1108-saradc - rockchip,rv1126-saradc - const: rockchip,rk3399-saradc
Signature · 7 lines
2.30.2 _______________________________________________ Linux-rockchip mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-rockchip
Sun, Jun 04, 2023 at 12:23:32AM +0530, Shreeya Patel kirjoitti:
Quoted 7 lines
This patch series adds ADC support for RK3588 and updates the DT bindings for the same.
To test ADC support on Rock 5B board, a voltage divider circuit was created using the gpio pin 22 (
SARADC_IN4) and few more tests were ran for testing the buffer and trigger support using theiio_generic_buffertool.
Well done!
For patches 1-6
(with one nit-pick to be addressed)
Quoted 33 lines
Changes in v3
- Addbitfield.hheader file in patch 2.
- Add a Reviewed-by tag in patch 2.
- Do not remove clock enabling and disabling from the suspend and resume functions respectively in patch 3Changes in v2
- Add from address in patches 1 and 2.
- Create separate patches for adding new device support and changes to the old device code.
- Make use ofFIELD_PREPin patch 2.
- Move the enablement of clocks at it's original position in patch 3
- Add Reviewed-by tag in patches 4 and 5.
- Add an Acked-by tag in patch 8.Shreeya Patel (8):
iio: adc:rockchip_saradc: Add callback functions
iio: adc:rockchip_saradc: Add support for RK3588
iio: adc:rockchip_saradc: Make use ofdevm_clk_get_enabled
iio: adc:rockchip_saradc: Useof_device_get_match_data
iio: adc:rockchip_saradc: Match alignment with open parenthesis
iio: adc:rockchip_saradc: Usedev_err_probe
arm64: dts: rockchip: Add DT node for ADC support in RK3588
dt-bindings: iio: adc: Add rockchip,rk3588-saradc string.../bindings/iio/adc/rockchip-saradc.yaml | 1 + arch/arm64/boot/dts/rockchip/rk3588s.dtsi | 12 + drivers/iio/adc/rockchip_saradc.c | 246 +++++++++++------- 3 files changed, 168 insertions(+), 91 deletions(-)Signature · 1 line
2.30.2
Signature · 2 lines
With Best Regards, Andy Shevchenko
Jonathan Cameron
maintainerQuoted 9 lines · On Sat, 3 Jun 2023 23:50:09 +0300 [email protected] wrote:
Sun, Jun 04, 2023 at 12:23:32AM +0530, Shreeya Patel kirjoitti:
Quoted 7 lines
This patch series adds ADC support for RK3588 and updates the DT bindings for the same.
To test ADC support on Rock 5B board, a voltage divider circuit was created using the gpio pin 22 (
SARADC_IN4) and few more tests were ran for testing the buffer and trigger support using theiio_generic_buffertool.
Quoted 5 lines
Well done!
For patches 1-6
Reviewed-by Andy Shevchenko <[email protected]>(with one nit-pick to be addressed)
Addressed the nit whilst applying and picked up 1-6,8. Applied them to the togreg branch of iio.git, but initially I'll just push that out as testing for 0-day to take a look and see what we missed.
As normal 7 should go via appropriate SoC tree
Quoted 35 lines
Quoted 34 lines
Changes in v3
- Addbitfield.hheader file in patch 2.
- Add a Reviewed-by tag in patch 2.
- Do not remove clock enabling and disabling from the suspend and resume functions respectively in patch 3Changes in v2
- Add from address in patches 1 and 2.
- Create separate patches for adding new device support and changes to the old device code.
- Make use ofFIELD_PREPin patch 2.
- Move the enablement of clocks at it's original position in patch 3
- Add Reviewed-by tag in patches 4 and 5.
- Add an Acked-by tag in patch 8.Shreeya Patel (8):
iio: adc:rockchip_saradc: Add callback functions
iio: adc:rockchip_saradc: Add support for RK3588
iio: adc:rockchip_saradc: Make use ofdevm_clk_get_enabled
iio: adc:rockchip_saradc: Useof_device_get_match_data
iio: adc:rockchip_saradc: Match alignment with open parenthesis
iio: adc:rockchip_saradc: Usedev_err_probe
arm64: dts: rockchip: Add DT node for ADC support in RK3588
dt-bindings: iio: adc: Add rockchip,rk3588-saradc string.../bindings/iio/adc/rockchip-saradc.yaml | 1 + arch/arm64/boot/dts/rockchip/rk3588s.dtsi | 12 + drivers/iio/adc/rockchip_saradc.c | 246 +++++++++++------- 3 files changed, 168 insertions(+), 91 deletions(-)Signature · 1 line
2.30.2
Re: (subset) [PATCH v3 0/8] RK3588 ADC support
In reply to Shreeya PatelQuoted 9 lines · Shreeya Patel
This patch series adds ADC support for RK3588 and updates the DT bindings for the same.
To test ADC support on Rock 5B board, a voltage divider circuit was created using the gpio pin 22 (
SARADC_IN4) and few more tests were ran for testing the buffer and trigger support using theiio_generic_buffertool.[...]
Applied, thanks!
[7/8] arm64: dts: rockchip: Add DT node for ADC support in RK3588
commit: ec084cbddbbe3a778ee06ccc0c59cee23b5cbaf4
I've moved the node to its correct position (by @address) and also renamed the node to a more generic adc@...
Best regards,
Signature · 6 lines
Heiko Stuebner <[email protected]> _______________________________________________ Linux-rockchip mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-rockchip