Skip to contentSkip to conversation

mfd: rn5t618: add ADC support

PATCH Superseded Andreas Kemnade 1 participant 3 messages Feb 22, 2020

Subsystems (2)

v4 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

v4 cover mfd: rn5t618: add ADC support

This series adds support for the ADC in the RN5T618/RC5T619. It depends on the IRQ support added in the RTC support series here:
https://lore.kernel.org/lkml/[email protected]/

I tested the driver only with the RC5T619 but it should work with the with the RN5T618 as well based on these facts:
- The corresponding register definitions originally went into the kernel for the RN5T618
- Public datasheet sections about the ADC look same.
- Out-of-tree code for these chips look same regarding to ADC

But due to missing hardware I cannot test the patches 2/3 and 3/3 which add support for the RN5T618 ADC.
I marked these untested patches as RFC, and IMHO they require a Tested-By. Feel free to ignore them if the whole series would be delayed just because of missing Tested-By for those.

Changes in v4:
- drop RFC patches, seems nobody finds time to test now
- added trivial change and Reviewed-By

Changes in v3:
- re-included former 2/5 of these patches, since it was not applied

Changes in v2:
- got an "Applied, thanks" message for the first two, so I do not include them anymore
- some cleanups for the ADC driver itself

Andreas Kemnade (2):
mfd: rn5t618: add ADC subdevice for RC5T619
iio: adc: rn5t618: Add ADC driver for RN5T618/RC5T619

 drivers/iio/adc/Kconfig       |  10 ++
 drivers/iio/adc/Makefile      |   1 +
 drivers/iio/adc/rn5t618-adc.c | 256 ++++++++++++++++++++++++++++++++++
 drivers/mfd/rn5t618.c         |   1 +
 4 files changed, 268 insertions(+)
 create mode 100644 drivers/iio/adc/rn5t618-adc.c
Signature · 1 line
2.20.1
#1 lore raw

PATCH v4 1/2 mfd: rn5t618: add ADC subdevice for RC5T619

This adds a subdevice for tde ADC in the RC5T619

---
depends on:
https://lore.kernel.org/lkml/[email protected]/

Changes in v3:
re-added it to the series because of
"Oh, it looks like there was a conflict. Could you collect any Acks (including mine) rebase and resend please?"

 drivers/mfd/rn5t618.c | 1 +
 1 file changed, 1 insertion(+)
drivers/mfd/rn5t618.c +1 -0
index 073de8e0e78b..321836f78120 100644
@@ -24,6 +24,7 @@ static const struct mfd_cell rn5t618_cells[] = {
 };
 
 static const struct mfd_cell rc5t619_cells[] = {
+	{ .name = "rn5t618-adc" },
 	{ .name = "rn5t618-regulator" },
 	{ .name = "rc5t619-rtc" },
 	{ .name = "rn5t618-wdt" },
Signature · 1 line
2.20.1
#2 lore raw

PATCH v4 2/2 iio: adc: rn5t618: Add ADC driver for RN5T618/RC5T619

In reply to Andreas Kemnade

Both chips have an A/D converter capable of measuring things like VBAT, VUSB and analog inputs.

---
depends on (build and runtime):
https://lore.kernel.org/lkml/[email protected]/

Changes in v4:
- merged ret = and return into one line
- added Reviewed-by:

Changes in v3:
- output scale instead of processed
- prefixed symbols with RN5T618

Changes in v2:
- enum for channels
- bulk read instead of single byte read for conversion result
- fix get_virq error handling
- use devm for registering device and requesting IRQ

 drivers/iio/adc/Kconfig       |  10 ++
 drivers/iio/adc/Makefile      |   1 +
 drivers/iio/adc/rn5t618-adc.c | 256 ++++++++++++++++++++++++++++++++++
 3 files changed, 267 insertions(+)
 create mode 100644 drivers/iio/adc/rn5t618-adc.c
drivers/iio/adc/Kconfig +10 -0
index 5d8540b7b427..e7e74e775336 100644
@@ -766,6 +766,16 @@ config RCAR_GYRO_ADC
 	  To compile this driver as a module, choose M here: the
 	  module will be called rcar-gyroadc.
 
+config RN5T618_ADC
+	tristate "ADC for the RN5T618/RC5T619 family of chips"
+	depends on MFD_RN5T618
+	help
+	  Say yes here to build support for the integrated ADC inside the
+	  RN5T618/619 series PMICs:
+
+	  This driver can also be built as a module. If so, the module
+	  will be called rn5t618-adc.
+
 config ROCKCHIP_SARADC
 	tristate "Rockchip SARADC driver"
 	depends on ARCH_ROCKCHIP || (ARM && COMPILE_TEST)
drivers/iio/adc/Makefile +1 -0
index a1f1fbec0f87..ea95f89c91cd 100644
@@ -72,6 +72,7 @@ obj-$(CONFIG_QCOM_VADC_COMMON) += qcom-vadc-common.o
 obj-$(CONFIG_QCOM_SPMI_VADC) += qcom-spmi-vadc.o
 obj-$(CONFIG_QCOM_PM8XXX_XOADC) += qcom-pm8xxx-xoadc.o
 obj-$(CONFIG_RCAR_GYRO_ADC) += rcar-gyroadc.o
+obj-$(CONFIG_RN5T618_ADC) += rn5t618-adc.o
 obj-$(CONFIG_ROCKCHIP_SARADC) += rockchip_saradc.o
 obj-$(CONFIG_SC27XX_ADC) += sc27xx_adc.o
 obj-$(CONFIG_SPEAR_ADC) += spear_adc.o
drivers/iio/adc/rn5t618-adc.c new file +256 -0

256 lines not on this page · raw message

Signature · 1 line
2.20.1