build/patch/kernel/archive/sunxi-6.1/patches.megous/iio-adc-sun4i-gpadc-iio-Allow-to-use-sun5i-a13-gpadc-iio-from-D.patch

63 lines
2.1 KiB
Diff

From 5c3ab3fceffda21cb5d506ffe466884b41bc2451 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ond=C5=99ej=20Jirman?= <megi@xff.cz>
Date: Mon, 7 Oct 2019 02:12:34 +0200
Subject: [PATCH 058/389] 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 <megi@xff.cz>
---
arch/arm/boot/dts/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/sun5i.dtsi b/arch/arm/boot/dts/sun5i.dtsi
index 250d6b87ab4d..7afe476f9a0d 100644
--- a/arch/arm/boot/dts/sun5i.dtsi
+++ b/arch/arm/boot/dts/sun5i.dtsi
@@ -648,6 +648,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 a6ade70dedf8..60584a6ab805 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 cfe14d9bf6dc..693004e6c6a8 100644
--- a/drivers/mfd/sun4i-gpadc.c
+++ b/drivers/mfd/sun4i-gpadc.c
@@ -54,6 +54,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.35.3