Skip to content

Commit 8114f44

Browse files
michalpiekosjic23
authored andcommitted
iio: adc: sun20i-gpadc: add A523 gpadc support
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@mmpsystems.pl> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
1 parent 24245b9 commit 8114f44

1 file changed

Lines changed: 8 additions & 5 deletions

File tree

drivers/iio/adc/sun20i-gpadc-iio.c

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -177,10 +177,10 @@ static int sun20i_gpadc_alloc_channels(struct iio_dev *indio_dev,
177177
static int sun20i_gpadc_probe(struct platform_device *pdev)
178178
{
179179
struct device *dev = &pdev->dev;
180-
struct iio_dev *indio_dev;
181180
struct sun20i_gpadc_iio *info;
181+
struct clk_bulk_data *clks;
182182
struct reset_control *rst;
183-
struct clk *clk;
183+
struct iio_dev *indio_dev;
184184
int irq;
185185
int ret;
186186

@@ -205,9 +205,11 @@ static int sun20i_gpadc_probe(struct platform_device *pdev)
205205
if (IS_ERR(info->regs))
206206
return PTR_ERR(info->regs);
207207

208-
clk = devm_clk_get_enabled(dev, NULL);
209-
if (IS_ERR(clk))
210-
return dev_err_probe(dev, PTR_ERR(clk), "failed to enable bus clock\n");
208+
ret = devm_clk_bulk_get_all_enabled(dev, &clks);
209+
if (ret < 0)
210+
return dev_err_probe(dev, ret, "failed to enable clocks\n");
211+
if (ret == 0)
212+
return dev_err_probe(dev, -ENODEV, "needs at least one clocks\n");
211213

212214
rst = devm_reset_control_get_exclusive(dev, NULL);
213215
if (IS_ERR(rst))
@@ -243,6 +245,7 @@ static int sun20i_gpadc_probe(struct platform_device *pdev)
243245

244246
static const struct of_device_id sun20i_gpadc_of_id[] = {
245247
{ .compatible = "allwinner,sun20i-d1-gpadc" },
248+
{ .compatible = "allwinner,sun55i-a523-gpadc" },
246249
{ }
247250
};
248251
MODULE_DEVICE_TABLE(of, sun20i_gpadc_of_id);

0 commit comments

Comments
 (0)