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 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 (3):
iio: adc: rn5t618: Add ADC driver for RN5T618/RC5T619
mfd: rn5t618: add IRQ definitions for RN5T618
mfd: rn5t618: add ADC subdevice for RN5T618
drivers/iio/adc/Kconfig | 10 ++
drivers/iio/adc/Makefile | 1 +
drivers/iio/adc/rn5t618-adc.c | 253 ++++++++++++++++++++++++++++++++++++++++++
drivers/mfd/rn5t618.c | 47 +++++++-
4 files changed, 309 insertions(+), 2 deletions(-)
create mode 100644 drivers/iio/adc/rn5t618-adc.c
--
2.11.0
RN5T618 has an ADC but RN5T567 has not, so
we need separate subdevice lists for both.
Signed-off-by: Andreas Kemnade <[email protected]>
---
Untested, IMHO only acceptable with a Tested-By
drivers/mfd/rn5t618.c | 26 ++++++++++++++++++++++++--
1 file changed, 24 insertions(+), 2 deletions(-)
diff --git a/drivers/mfd/rn5t618.c b/drivers/mfd/rn5t618.c
index 6828fd40b0a1..d37d7a31cf26 100644
--- a/drivers/mfd/rn5t618.c
+++ b/drivers/mfd/rn5t618.c
@@ -21,6 +21,7 @@
static const struct mfd_cell rn5t618_cells[] = {
{ .name = "rn5t618-regulator" },
{ .name = "rn5t618-wdt" },
+ { .name = "rn5t618-adc" },
};
static const struct mfd_cell rc5t619_cells[] = {
@@ -30,6 +31,11 @@ static const struct mfd_cell rc5t619_cells[] = {
{ .name = "rn5t618-wdt" },
};
+static const struct mfd_cell rn5t567_cells[] = {
+ { .name = "rn5t618-regulator" },
+ { .name = "rn5t618-wdt" },
+};
+
static bool rn5t618_volatile_reg(struct device *dev, unsigned int reg)
{
switch (reg) {
@@ -203,16 +209,32 @@ static int rn5t618_i2c_probe(struct i2c_client *i2c,
return ret;
}
- if (priv->variant == RC5T619)
+ switch (priv->variant) {
+ case RC5T619:
ret = devm_mfd_add_devices(&i2c->dev, PLATFORM_DEVID_NONE,
rc5t619_cells,
ARRAY_SIZE(rc5t619_cells),
NULL, 0, NULL);
- else
+ break;
+ case RN5T618:
ret = devm_mfd_add_devices(&i2c->dev, PLATFORM_DEVID_NONE,
rn5t618_cells,
ARRAY_SIZE(rn5t618_cells),
NULL, 0, NULL);
+ break;
+ case RN5T567:
+ ret = devm_mfd_add_devices(&i2c->dev, PLATFORM_DEVID_NONE,
+ rn5t567_cells,
+ ARRAY_SIZE(rn5t567_cells),
+ NULL, 0, NULL);
+ break;
+ /*
+ * Should not happen because we come here only with a valid device
+ * tree match, so variant contains any of the above.
+ */
+ default:
+ return -ENOENT;
+ }
if (ret) {
dev_err(&i2c->dev, "failed to add sub-devices: %d\n", ret);
return ret;
--
2.11.0