Skip to contentSkip to conversation

add support for Rockchip SARADC

PATCH Applied Michael Riesch 2 participants 4 messages Jun 24, 2021 – Jun 28, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

v3 cover add support for Rockchip SARADC

Michael Riesch (2):
aiodev: add driver for Rockchip SARADC
arm: rk3568-evb1: add support for Rockchip SARADC

 arch/arm/dts/rk3568-evb1-v10.dts |   6 +-
 arch/arm/dts/rk3568.dtsi         |  12 ++
 drivers/aiodev/Kconfig           |   8 ++
 drivers/aiodev/Makefile          |   1 +
 drivers/aiodev/rockchip_saradc.c | 197 +++++++++++++++++++++++++++++++
 5 files changed, 223 insertions(+), 1 deletion(-)
 create mode 100644 drivers/aiodev/rockchip_saradc.c

--
2.20.1

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

#1 lore raw

PATCH v3 1/2 aiodev: add driver for Rockchip SARADC

This commit adds support for the Successive Approximation Register (SAR) ADCs that can be found in Rockchip SoCs, such as the RK3568.

---
v3:
- fix dependencies in Kconfig
- beautify timeout macro
- drop superfluous pointer checks
- switch to %pe in dev_err calls

v2:
- fix timeout loop
- remove spurious debug output
- revise reference voltage handling
- add handling of clocks

 drivers/aiodev/Kconfig           |   8 ++
 drivers/aiodev/Makefile          |   1 +
 drivers/aiodev/rockchip_saradc.c | 197 +++++++++++++++++++++++++++++++
 3 files changed, 206 insertions(+)
 create mode 100644 drivers/aiodev/rockchip_saradc.c
drivers/aiodev/Kconfig +8 -0
index 88d013aad..03c688ae6 100644
@@ -50,4 +50,12 @@ config STM32_ADC
 	  Support for ADC on STM32.  Supports simple one-shot readings
 	  rather than continuous sampling with DMA, etc.  ADC channels should be
 	  configured via device tree, using the kernel bindings.
+
+config ROCKCHIP_SARADC
+	tristate "Rockchip SARADC driver"
+	depends on ARCH_RK3568 || COMPILE_TEST
+	depends on OFDEVICE
+	help
+	  Support for Successive Approximation Register (SAR) ADC in Rockchip
+	  SoCs.
 endif
drivers/aiodev/Makefile +1 -0
index 52652f67b..1b480f6fa 100644
@@ -6,3 +6,4 @@ obj-$(CONFIG_MC13XXX_ADC) += mc13xxx_adc.o
 obj-$(CONFIG_QORIQ_THERMAL) += qoriq_thermal.o
 obj-$(CONFIG_AM335X_ADC) += am335x_adc.o
 obj-$(CONFIG_STM32_ADC) += stm32-adc.o stm32-adc-core.o
+obj-$(CONFIG_ROCKCHIP_SARADC) += rockchip_saradc.o
drivers/aiodev/rockchip_saradc.c new file +197 -0

197 lines not on this page · raw message

--
2.20.1

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

#2 lore raw

PATCH v3 2/2 arm: rk3568-evb1: add support for Rockchip SARADC

In reply to Michael Riesch

---
v3:
- no changes

v2:
- add initial version

 arch/arm/dts/rk3568-evb1-v10.dts |  6 +++++-
 arch/arm/dts/rk3568.dtsi         | 12 ++++++++++++
 2 files changed, 17 insertions(+), 1 deletion(-)
arch/arm/dts/rk3568-evb1-v10.dts +5 -1
index 91e234419..c22692116 100644
@@ -456,6 +456,11 @@
 	};
 };
 
+&saradc {
+	vref-supply = <&vcca_1v8>;
+	status = "okay";
+};
+
 &sdhci {
 	bus-width = <8>;
 	max-frequency = <200000000>;
@@ -579,4 +584,3 @@
 &combphy1_usq {
 	status = "okay";
 };
-
arch/arm/dts/rk3568.dtsi +12 -0
index 3baaec3a8..0f19d3f0c 100644
@@ -1030,6 +1030,18 @@
 		status = "disabled";
 	};
 
+	saradc: saradc@fe720000 {
+		compatible = "rockchip,rk3568-saradc";
+		reg = <0x0 0xfe720000 0x0 0x100>;
+		interrupts = <GIC_SPI 93 IRQ_TYPE_LEVEL_HIGH>;
+		clocks = <&cru CLK_SARADC>, <&cru PCLK_SARADC>;
+		clock-names = "saradc", "apb_pclk";
+		resets = <&cru SRST_P_SARADC>;
+		reset-names = "saradc-apb";
+		#io-channel-cells = <1>;
+		status = "disabled";
+	};
+
 	pinctrl: pinctrl {
 		compatible = "rockchip,rk3568-pinctrl";
 		rockchip,grf = <&grf>;

--
2.20.1

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

Applied
#3 lore raw
In reply to Michael Riesch
Quoted 11 lines · Michael Riesch

Michael Riesch (2):
aiodev: add driver for Rockchip SARADC
arm: rk3568-evb1: add support for Rockchip SARADC

 arch/arm/dts/rk3568-evb1-v10.dts |   6 +-
 arch/arm/dts/rk3568.dtsi         |  12 ++
 drivers/aiodev/Kconfig           |   8 ++
 drivers/aiodev/Makefile          |   1 +
 drivers/aiodev/rockchip_saradc.c | 197 +++++++++++++++++++++++++++++++
 5 files changed, 223 insertions(+), 1 deletion(-)
 create mode 100644 drivers/aiodev/rockchip_saradc.c

Applied, thanks

Sascha

Signature · 9 lines
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox