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(-)
--
2.30.2
Use of_device_get_match_data() to simplify the code.
Signed-off-by: Shreeya Patel <[email protected]>
Reviewed-by: AngeloGioacchino Del Regno <[email protected]>
---
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(-)
diff --git a/drivers/iio/adc/rockchip_saradc.c b/drivers/iio/adc/rockchip_saradc.c
index ac424ea50787..cbe347fe8df7 100644
--- a/drivers/iio/adc/rockchip_saradc.c
+++ b/drivers/iio/adc/rockchip_saradc.c
@@ -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) {
--
2.30.2
Add rockchip,rk3588-saradc compatible string.
Signed-off-by: Shreeya Patel <[email protected]>
Acked-by: Krzysztof Kozlowski <[email protected]>
---
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(+)
diff --git a/Documentation/devicetree/bindings/iio/adc/rockchip-saradc.yaml b/Documentation/devicetree/bindings/iio/adc/rockchip-saradc.yaml
index da50b529c157..11c27ea451c8 100644
--- a/Documentation/devicetree/bindings/iio/adc/rockchip-saradc.yaml
+++ b/Documentation/devicetree/bindings/iio/adc/rockchip-saradc.yaml
@@ -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
--
2.30.2
Sun, Jun 04, 2023 at 12:23:32AM +0530, Shreeya Patel kirjoitti:
> 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.
Well done!
For patches 1-6
Reviewed-by: Andy Shevchenko <[email protected]>
(with one nit-pick to be addressed)
> 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(-)
>
> --
> 2.30.2
>
--
With Best Regards,
Andy Shevchenko
On Sat, 3 Jun 2023 23:50:09 +0300
[email protected] wrote:
> Sun, Jun 04, 2023 at 12:23:32AM +0530, Shreeya Patel kirjoitti:
> > 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.
>
> 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
>
> > 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(-)
> >
> > --
> > 2.30.2
> >
>
On Sun, 4 Jun 2023 00:23:32 +0530, Shreeya Patel wrote:
> 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.
>
> [...]
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,
--
Heiko Stuebner <[email protected]>