From cc73af5c3e8b28d0b0eb1ccb407f76885a93e1f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Jirman?= Date: Mon, 7 Oct 2019 02:12:34 +0200 Subject: [PATCH 060/464] iio: adc: sun4i-gpadc-iio: Allow to use sun5i-a13-gpadc-iio from DT We can now use allwinner,sun5i-a13-gpadc-iio to create a sub-node of allwinner,sun5i-a13-ts, that can be referenced by other drivers via IIO framework. Signed-off-by: Ondrej Jirman --- arch/arm/boot/dts/allwinner/sun5i.dtsi | 5 +++++ drivers/iio/adc/sun4i-gpadc-iio.c | 3 ++- drivers/mfd/sun4i-gpadc.c | 1 + 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/arch/arm/boot/dts/allwinner/sun5i.dtsi b/arch/arm/boot/dts/allwinner/sun5i.dtsi index d7c7b454a11a..e6836fd4b8dc 100644 --- a/arch/arm/boot/dts/allwinner/sun5i.dtsi +++ b/arch/arm/boot/dts/allwinner/sun5i.dtsi @@ -657,6 +657,11 @@ rtp: rtp@1c25000 { reg = <0x01c25000 0x100>; interrupts = <29>; #thermal-sensor-cells = <0>; + + rtp_adc: adc { + compatible = "allwinner,sun5i-a13-gpadc-iio"; + #io-channel-cells = <1>; + }; }; uart0: serial@1c28000 { diff --git a/drivers/iio/adc/sun4i-gpadc-iio.c b/drivers/iio/adc/sun4i-gpadc-iio.c index a5322550c422..e7707ae6151d 100644 --- a/drivers/iio/adc/sun4i-gpadc-iio.c +++ b/drivers/iio/adc/sun4i-gpadc-iio.c @@ -622,7 +622,8 @@ static int sun4i_gpadc_probe(struct platform_device *pdev) indio_dev->info = &sun4i_gpadc_iio_info; indio_dev->modes = INDIO_DIRECT_MODE; - if (pdev->dev.of_node) + if (pdev->dev.of_node && of_match_node(sun4i_gpadc_of_id, + pdev->dev.of_node)) ret = sun4i_gpadc_probe_dt(pdev, indio_dev); else ret = sun4i_gpadc_probe_mfd(pdev, indio_dev); diff --git a/drivers/mfd/sun4i-gpadc.c b/drivers/mfd/sun4i-gpadc.c index d1cbea27b136..7d2114e847e4 100644 --- a/drivers/mfd/sun4i-gpadc.c +++ b/drivers/mfd/sun4i-gpadc.c @@ -53,6 +53,7 @@ static struct mfd_cell sun4i_gpadc_cells[] = { static struct mfd_cell sun5i_gpadc_cells[] = { { .name = "sun5i-a13-gpadc-iio", + .of_compatible = "allwinner,sun5i-a13-gpadc-iio", .resources = adc_resources, .num_resources = ARRAY_SIZE(adc_resources), }, -- 2.34.1