[PATCH v2 2/3] iio: adc: sun20i-gpadc: add A523 gpadc support
Jonathan Cameron
jic23 at kernel.org
Wed May 13 09:16:38 PDT 2026
On Wed, 13 May 2026 13:53:49 +0200
Andre Przywara <andre.przywara at arm.com> wrote:
> Hi Sanjay,
>
> thanks for having a look!
>
> On 5/13/26 13:44, Sanjay Chitroda wrote:
> >
> >
> > On 13 May 2026 10:29:43 am IST, Michal Piekos <michal.piekos at mmpsystems.pl> wrote:
> >> A523 differs from existing sun20i-gpadc-iio by having two clocks; bus
> >> clock and module clock.
> >>
> >> Change driver to enable all clocks.
> >>
> >> Signed-off-by: Michal Piekos <michal.piekos at mmpsystems.pl>
> >> ---
> >> drivers/iio/adc/sun20i-gpadc-iio.c | 11 +++++++----
> >> 1 file changed, 7 insertions(+), 4 deletions(-)
> >>
> >> diff --git a/drivers/iio/adc/sun20i-gpadc-iio.c b/drivers/iio/adc/sun20i-gpadc-iio.c
> >> index 861c14da75ad..3f1f07b3a385 100644
> >> --- a/drivers/iio/adc/sun20i-gpadc-iio.c
> >> +++ b/drivers/iio/adc/sun20i-gpadc-iio.c
> >> @@ -180,7 +180,7 @@ static int sun20i_gpadc_probe(struct platform_device *pdev)
> >> struct iio_dev *indio_dev;
> >> struct sun20i_gpadc_iio *info;
> >> struct reset_control *rst;
> >> - struct clk *clk;
> >> + struct clk_bulk_data *clks;
> >> int irq;
> >> int ret;
> >>
> >> @@ -205,9 +205,11 @@ static int sun20i_gpadc_probe(struct platform_device *pdev)
> >> if (IS_ERR(info->regs))
> >> return PTR_ERR(info->regs);
> >>
> >> - clk = devm_clk_get_enabled(dev, NULL);
> >> - if (IS_ERR(clk))
> >> - return dev_err_probe(dev, PTR_ERR(clk), "failed to enable bus clock\n");
> >> + ret = devm_clk_bulk_get_all_enabled(dev, &clks);
> >> + if (ret <= 0)
> >
> > Thank you Michal for the change.
> >
> > Have you validated the changes ?
> > It looks while success ret would be 0 and it would give return error.
>
> But devm_clk_bulk_get_all_enabled() returns the number of clocks found
> and enabled. And since we need at least one, I think this is correct,
> and the error message below reflects that.
True but passing 0 to dev_err_probe() isn't going to do the right thing.
Though from this function, 0 is an error you need to return an error code
not 0 which to the caller looks like a success.
>
> To me that change looks good:
>
> Reviewed-by: Andre Przywara <andre.przywara at arm.com>
>
> Cheers,
> Andre
>
>
> >
> > Thanks, Sanjay
> >
> >
> >> + return dev_err_probe(
> >> + dev, ret,
> >> + "failed to enable clocks or no clocks defined\n");
> >>
> >> rst = devm_reset_control_get_exclusive(dev, NULL);
> >> if (IS_ERR(rst))
> >> @@ -243,6 +245,7 @@ static int sun20i_gpadc_probe(struct platform_device *pdev)
> >>
> >> static const struct of_device_id sun20i_gpadc_of_id[] = {
> >> { .compatible = "allwinner,sun20i-d1-gpadc" },
> >> + { .compatible = "allwinner,sun55i-a523-gpadc" },
> >> { }
> >> };
> >> MODULE_DEVICE_TABLE(of, sun20i_gpadc_of_id);
> >>
> >
>
More information about the linux-arm-kernel
mailing list