Skip to contentSkip to conversation

mfd: rn5t618: Add RTC/ADC support

PATCH RESEND Superseded Andreas Kemnade 2 participants 11 messages Mar 13, 2020 – Mar 19, 2020

Subsystems (4)

v6 of 7 Superseded Latest is v7 →

lore
Share & tools
lore
#0 lore raw

v6 cover mfd: rn5t618: Add RTC/ADC support

In the variant RC5T619 the mfd has an RTC. This patchset adds support for it. To do so it adds the missing register defines in rn5t618.h and general irq handling for that.
It seems that the IRQ definitions are the same except missing RTC for the RN5T618 but due to missing ability to test that they are not added here.
It also adds support for the ADC, it is available in both the RN5T618 and RC5T619 but due to missing ability to test that, the subdevice is only added for the RN5T618.

It was tested on the Kobo Clara HD.

Changes in v6:
- put together with ADC series
- also added cleanup i2_device_id patch to avoid merge conflicts

Changes in v5:
- static rn5t618_irq_init
- PLATFORM_DEVID_NONE
- added some Acked-Bys

Changes in v4:
- use macros for IRQ definitions
- merge rn5t618-core.c and rn5t618-irq.c

Changes in v3:
- alignment cleanup
- output cleanup, remove useless toggling of alarm flag in rtc probe
- updated bindings description, so patch 1/5 becomes 2/6 and so on

Changes in v2:
- no dead code in irq code
- various improvements and cleanups in rtc driver itself

Andreas Kemnade (7):
dt-bindings: mfd: rn5t618: Document optional property interrupts
mfd: rn5t618: add IRQ support
mfd: rn5t618: add RTC related registers
mfd: rn5t618: add more subdevices
rtc: rc5t619: add Ricoh RC5T619 RTC driver
iio: adc: rn5t618: Add ADC driver for RN5T618/RC5T619
mfd: rn5t618: cleanup i2c_device_id

 .../devicetree/bindings/mfd/rn5t618.txt       |   4 +
 drivers/iio/adc/Kconfig                       |  10 +
 drivers/iio/adc/Makefile                      |   1 +
 drivers/iio/adc/rn5t618-adc.c                 | 256 ++++++++++
 drivers/mfd/Kconfig                           |   1 +
 drivers/mfd/rn5t618.c                         | 119 ++++-
 drivers/rtc/Kconfig                           |  10 +
 drivers/rtc/Makefile                          |   1 +
 drivers/rtc/rtc-rc5t619.c                     | 444 ++++++++++++++++++
 include/linux/mfd/rn5t618.h                   |  26 +
 10 files changed, 862 insertions(+), 10 deletions(-)
 create mode 100644 drivers/iio/adc/rn5t618-adc.c
 create mode 100644 drivers/rtc/rtc-rc5t619.c
Signature · 1 line
2.20.1
#1 lore raw

PATCH RESEND v6 1/7 dt-bindings: mfd: rn5t618: Document optional property interrupts

These chips use interrupts for various things like RTC alarm.

---
Changes in v4: add refernce to interrupt binding
documentation

 Documentation/devicetree/bindings/mfd/rn5t618.txt | 4 ++++
 1 file changed, 4 insertions(+)
Documentation/devicetree/bindings/mfd/rn5t618.txt +4 -0
index b74e5e94d1cb..16778ea00dbc 100644
@@ -15,6 +15,8 @@ Required properties:
  - reg: the I2C slave address of the device
 
 Optional properties:
+ - interrupts: interrupt mapping for IRQ
+   See Documentation/devicetree/bindings/interrupt-controller/interrupts.txt
  - system-power-controller:
    See Documentation/devicetree/bindings/power/power-controller.txt
 
@@ -32,6 +34,8 @@ Example:
 	pmic@32 {
 		compatible = "ricoh,rn5t618";
 		reg = <0x32>;
+		interrupt-parent = <&gpio5>;
+		interrupts = <11 IRQ_TYPE_EDGE_FALLING>;
 		system-power-controller;
 
 		regulators {
Signature · 1 line
2.20.1
#2 lore raw

PATCH RESEND v6 2/7 mfd: rn5t618: add IRQ support

In reply to Andreas Kemnade

This adds support for IRQ handling in the RC5T619 which is required for properly implementing subdevices like RTC.
For now only definitions for the variant RC5T619 are included.

---
Changes in v5:
rn5t618_irq_init static

Changes in v4:
merge rn5t618-irq.c into rn5t618.c
use macros for IRQ table

Changes in v3:
alignment cleanup

Changes in v2:
- no dead code, did some more testing and thinking for that
- remove extra empty lines

 drivers/mfd/Kconfig         |  1 +
 drivers/mfd/rn5t618.c       | 88 +++++++++++++++++++++++++++++++++++++
 include/linux/mfd/rn5t618.h | 15 +++++++
 3 files changed, 104 insertions(+)
drivers/mfd/Kconfig +1 -0
index 2b203290e7b9..a7067888a41e 100644
@@ -1058,6 +1058,7 @@ config MFD_RN5T618
 	depends on OF
 	select MFD_CORE
 	select REGMAP_I2C
+	select REGMAP_IRQ
 	help
 	  Say yes here to add support for the Ricoh RN5T567,
 	  RN5T618, RC5T619 PMIC.
drivers/mfd/rn5t618.c +88 -0

130 lines not on this page · raw message

include/linux/mfd/rn5t618.h +15 -0
index d62ef48060b5..739571656f2b 100644
@@ -242,9 +242,24 @@ enum {
 	RC5T619,
 };
 
+/* RN5T618 IRQ definitions */
+enum {
+	RN5T618_IRQ_SYS = 0,
+	RN5T618_IRQ_DCDC,
+	RN5T618_IRQ_RTC,
+	RN5T618_IRQ_ADC,
+	RN5T618_IRQ_GPIO,
+	RN5T618_IRQ_CHG,
+	RN5T618_NR_IRQS,
+};
+
 struct rn5t618 {
 	struct regmap *regmap;
+	struct device *dev;
 	long variant;
+
+	int irq;
+	struct regmap_irq_chip_data *irq_data;
 };
 
 #endif /* __LINUX_MFD_RN5T618_H */
Signature · 1 line
2.20.1
#3 lore raw

Re: [PATCH RESEND v6 2/7] mfd: rn5t618: add IRQ support

Quoted 79 lines · Andreas Kemnade

This adds support for IRQ handling in the RC5T619 which is required for properly implementing subdevices like RTC.
For now only definitions for the variant RC5T619 are included.

---
Changes in v5:
rn5t618_irq_init static

Changes in v4:
merge rn5t618-irq.c into rn5t618.c
use macros for IRQ table

Changes in v3:
alignment cleanup

Changes in v2:
- no dead code, did some more testing and thinking for that
- remove extra empty lines

 drivers/mfd/Kconfig         |  1 +
 drivers/mfd/rn5t618.c       | 88 +++++++++++++++++++++++++++++++++++++
 include/linux/mfd/rn5t618.h | 15 +++++++
 3 files changed, 104 insertions(+)
drivers/mfd/Kconfig +1 -0
index 2b203290e7b9..a7067888a41e 100644
@@ -1058,6 +1058,7 @@ config MFD_RN5T618
 	depends on OF
 	select MFD_CORE
 	select REGMAP_I2C
+	select REGMAP_IRQ
 	help
 	  Say yes here to add support for the Ricoh RN5T567,
 	  RN5T618, RC5T619 PMIC.
drivers/mfd/rn5t618.c +25 -0
index ead2e79036a9..849a33d64860 100644
@@ -8,6 +8,8 @@
 
 #include <linux/delay.h>
 #include <linux/i2c.h>
+#include <linux/interrupt.h>
+#include <linux/irq.h>
 #include <linux/mfd/core.h>
 #include <linux/mfd/rn5t618.h>
 #include <linux/module.h>
@@ -46,9 +48,63 @@ static const struct regmap_config rn5t618_regmap_config = {
 	.cache_type	= REGCACHE_RBTREE,
 };
 
+static const struct regmap_irq rc5t619_irqs[] = {
+	REGMAP_IRQ_REG(RN5T618_IRQ_SYS, 0, BIT(0)),
+	REGMAP_IRQ_REG(RN5T618_IRQ_DCDC, 0, BIT(1)),
+	REGMAP_IRQ_REG(RN5T618_IRQ_RTC, 0, BIT(2)),
+	REGMAP_IRQ_REG(RN5T618_IRQ_ADC, 0, BIT(3)),
+	REGMAP_IRQ_REG(RN5T618_IRQ_GPIO, 0, BIT(4)),
+	REGMAP_IRQ_REG(RN5T618_IRQ_CHG, 0, BIT(6)),
+};
+
+static const struct regmap_irq_chip rc5t619_irq_chip = {
+	.name = "rc5t619",
+	.irqs = rc5t619_irqs,
+	.num_irqs = ARRAY_SIZE(rc5t619_irqs),
+	.num_regs = 1,
+	.status_base = RN5T618_INTMON,
+	.mask_base = RN5T618_INTEN,
+	.mask_invert = true,
+};
+
 static struct rn5t618 *rn5t618_pm_power_off;
 static struct notifier_block rn5t618_restart_handler;
 
+static int rn5t618_irq_init(struct rn5t618 *rn5t618)
+{
+	const struct regmap_irq_chip *irq_chip;
+	int ret;

drivers/mfd/rn5t618.c static const struct regmap_config rn5t618_regmap_config = { · line 86

Quoted 10 lines
drivers/mfd/rn5t618.c +10 -0
+
+	if (!rn5t618->irq)
+		return 0;
+
+	switch (rn5t618->variant) {
+	case RC5T619:
+		irq_chip = &rc5t619_irq_chip;
+		break;
+	default:
+		irq_chip = NULL;

If you initialised this at the top, you can rid this line.

Don't you want to put a message in here about an unsupported device?

drivers/mfd/rn5t618.c static const struct regmap_config rn5t618_regmap_config = { · line 94

Quoted 8 lines
drivers/mfd/rn5t618.c +8 -0
+		break;
+	}
+
+	if (!irq_chip) {
+		dev_err(rn5t618->dev, "Currently no IRQ support for variant %d\n",
+			(int)rn5t618->variant);
+		return -ENOENT;
+	}

Ah yes. Put this in 'default' instead.

drivers/mfd/rn5t618.c static const struct regmap_config rn5t618_regmap_config = { · line 102

Quoted 7 lines
drivers/mfd/rn5t618.c +7 -0
+	ret = devm_regmap_add_irq_chip(rn5t618->dev, rn5t618->regmap,
+				       rn5t618->irq,
+				       IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
+				       0, irq_chip, &rn5t618->irq_data);
+	if (ret) {
+		dev_err(rn5t618->dev, "Failed to register IRQ chip\n");
+		return ret;

Make this a one line if.

drivers/mfd/rn5t618.c static const struct regmap_config rn5t618_regmap_config = { · line 105

Quoted 3 lines
drivers/mfd/rn5t618.c +3 -0
+	}
+
+	return 0;

... and return ret.

Quoted 15 lines
drivers/mfd/rn5t618.c +4 -0
+}
+
 static void rn5t618_trigger_poweroff_sequence(bool repower)
 {
 	/* disable automatic repower-on */
@@ -106,6 +162,8 @@ static int rn5t618_i2c_probe(struct i2c_client *i2c,
 
 	i2c_set_clientdata(i2c, priv);
 	priv->variant = (long)of_id->data;
+	priv->irq = i2c->irq;
+	priv->dev = &i2c->dev;
 
 	priv->regmap = devm_regmap_init_i2c(i2c, &rn5t618_regmap_config);
 	if (IS_ERR(priv->regmap)) {

drivers/mfd/rn5t618.c static int rn5t618_i2c_probe(struct i2c_client *i2c, · line 199

Quoted 4 lines
drivers/mfd/rn5t618.c +1 -0
@@ -138,6 +196,11 @@ static int rn5t618_i2c_probe(struct i2c_client *i2c,
 		return ret;
 	}
 
+	if (priv->irq > 0) {

There are already have checks in rn5t618_irq_init().

Just call it regardless.

drivers/mfd/rn5t618.c static int rn5t618_i2c_probe(struct i2c_client *i2c, · line 200

Quoted 1 line
drivers/mfd/rn5t618.c +1 -0
+		if (rn5t618_irq_init(priv))

If this returns an error, you should return that error from .probe().

Quoted 76 lines
drivers/mfd/rn5t618.c +28 -0
+			priv->irq = 0;
+	}
+
 	return 0;
 }
 
@@ -155,15 +218,40 @@ static int rn5t618_i2c_remove(struct i2c_client *i2c)
 	return 0;
 }
 
+static int __maybe_unused rn5t618_i2c_suspend(struct device *dev)
+{
+	struct rn5t618 *priv = dev_get_drvdata(dev);
+
+	if (priv->irq)
+		disable_irq(priv->irq);
+
+	return 0;
+}
+
+static int __maybe_unused rn5t618_i2c_resume(struct device *dev)
+{
+	struct rn5t618 *priv = dev_get_drvdata(dev);
+
+	if (priv->irq)
+		enable_irq(priv->irq);
+
+	return 0;
+}
+
 static const struct i2c_device_id rn5t618_i2c_id[] = {
 	{ }
 };
 MODULE_DEVICE_TABLE(i2c, rn5t618_i2c_id);
 
+static SIMPLE_DEV_PM_OPS(rn5t618_i2c_dev_pm_ops,
+			rn5t618_i2c_suspend,
+			rn5t618_i2c_resume);
+
 static struct i2c_driver rn5t618_i2c_driver = {
 	.driver = {
 		.name = "rn5t618",
 		.of_match_table = of_match_ptr(rn5t618_of_match),
+		.pm = &rn5t618_i2c_dev_pm_ops,
 	},
 	.probe = rn5t618_i2c_probe,
 	.remove = rn5t618_i2c_remove,
include/linux/mfd/rn5t618.h +15 -0
index d62ef48060b5..739571656f2b 100644
@@ -242,9 +242,24 @@ enum {
 	RC5T619,
 };
 
+/* RN5T618 IRQ definitions */
+enum {
+	RN5T618_IRQ_SYS = 0,
+	RN5T618_IRQ_DCDC,
+	RN5T618_IRQ_RTC,
+	RN5T618_IRQ_ADC,
+	RN5T618_IRQ_GPIO,
+	RN5T618_IRQ_CHG,
+	RN5T618_NR_IRQS,
+};
+
 struct rn5t618 {
 	struct regmap *regmap;
+	struct device *dev;
 	long variant;
+
+	int irq;
+	struct regmap_irq_chip_data *irq_data;
 };
 
 #endif /* __LINUX_MFD_RN5T618_H */
Signature · 4 lines
Lee Jones [李琼斯]
Linaro Services Technical Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
#4 lore raw

Re: [PATCH RESEND v6 2/7] mfd: rn5t618: add IRQ support

Quoted 1 line · On Thu, 19 Mar 2020 16:11:49 +0000 Lee Jones <[email protected]> wrote:

On Fri, 13 Mar 2020, Andreas Kemnade wrote:

[...]
I agree to the other comments.

Quoted 10 lines

drivers/mfd/rn5t618.c static int rn5t618_i2c_probe(struct i2c_client *i2c, · line 199

Quoted 1 line
drivers/mfd/rn5t618.c +1 -0
+	if (priv->irq > 0) {  

There are already have checks in rn5t618_irq_init().

Just call it regardless.

drivers/mfd/rn5t618.c static int rn5t618_i2c_probe(struct i2c_client *i2c, · line 200

Quoted 1 line
drivers/mfd/rn5t618.c +1 -0
+		if (rn5t618_irq_init(priv))  

If this returns an error, you should return that error from .probe().

Hmm, that would be a regression. Current users do not specify an interrupt in the devicetree yet, so the MFD driver would stop working on these devices completely.
Therefore I think we should keep the existing functionality if there is no IRQ specified in the devicetree and ignore the error. The new subdevices are checking the IRQ availability and give error messages and have reduced functionality.

Regards,
Andreas

#5 lore raw

Re: [PATCH RESEND v6 2/7] mfd: rn5t618: add IRQ support

In reply to Lee Jones

On Thu, 19 Mar 2020 16:11:49 +0000
Lee Jones <[email protected]> wrote:

[...]

Quoted 5 lines

drivers/mfd/rn5t618.c static int rn5t618_i2c_probe(struct i2c_client *i2c, · line 200

Quoted 2 lines
drivers/mfd/rn5t618.c +1 -0
+		if (rn5t618_irq_init(priv))  

If this returns an error, you should return that error from .probe().

Ah, ok, I am returning 0 if there is no irq, so
forget my previous comment about regressions.

Regards,
Andreas

#6 lore raw

PATCH RESEND v6 3/7 mfd: rn5t618: add RTC related registers

In reply to Andreas Kemnade

Defines for some RTC related registers were missing, also they were not included in the volatile register list

---

 drivers/mfd/rn5t618.c       |  2 ++
 include/linux/mfd/rn5t618.h | 11 +++++++++++
 2 files changed, 13 insertions(+)
drivers/mfd/rn5t618.c +2 -0
index 849a33d64860..30fed9ab3d04 100644
@@ -34,6 +34,8 @@ static bool rn5t618_volatile_reg(struct device *dev, unsigned int reg)
 	case RN5T618_IR_GPF:
 	case RN5T618_MON_IOIN:
 	case RN5T618_INTMON:
+	case RN5T618_RTC_CTRL1 ... RN5T618_RTC_CTRL2:
+	case RN5T618_RTC_SECONDS ... RN5T618_RTC_YEAR:
 		return true;
 	default:
 		return false;
include/linux/mfd/rn5t618.h +11 -0
index 739571656f2b..fba0df13d9a8 100644
@@ -139,6 +139,17 @@
 #define RN5T618_INTPOL			0x9c
 #define RN5T618_INTEN			0x9d
 #define RN5T618_INTMON			0x9e
+
+#define RN5T618_RTC_SECONDS     0xA0
+#define RN5T618_RTC_MDAY        0xA4
+#define RN5T618_RTC_MONTH       0xA5
+#define RN5T618_RTC_YEAR        0xA6
+#define RN5T618_RTC_ADJUST      0xA7
+#define RN5T618_RTC_ALARM_Y_SEC 0xA8
+#define RN5T618_RTC_DAL_MONTH   0xAC
+#define RN5T618_RTC_CTRL1       0xAE
+#define RN5T618_RTC_CTRL2       0xAF
+
 #define RN5T618_PREVINDAC		0xb0
 #define RN5T618_BATDAC			0xb1
 #define RN5T618_CHGCTL1			0xb3
Signature · 1 line
2.20.1
#7 lore raw

PATCH RESEND v6 4/7 mfd: rn5t618: add more subdevices

In reply to Andreas Kemnade

Since the RC5T619 has a RTC, use a separate subdevice list for that. The ADC should be the same as in the RN5T618, according to drivers in the wild, but since it is not tested, the ADC is only added for the RC5T619.

---
Changes in v6:
- squashed with patch from former ADC patchset

Changes in v3:
- alignment cleanup

 drivers/mfd/rn5t618.c | 20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)
drivers/mfd/rn5t618.c +18 -2
index 30fed9ab3d04..321836f78120 100644
@@ -14,6 +14,7 @@
 #include <linux/mfd/rn5t618.h>
 #include <linux/module.h>
 #include <linux/of_device.h>
+#include <linux/platform_device.h>
 #include <linux/reboot.h>
 #include <linux/regmap.h>
 
@@ -22,6 +23,13 @@ static const struct mfd_cell rn5t618_cells[] = {
 	{ .name = "rn5t618-wdt" },
 };
 
+static const struct mfd_cell rc5t619_cells[] = {
+	{ .name = "rn5t618-adc" },
+	{ .name = "rn5t618-regulator" },
+	{ .name = "rc5t619-rtc" },
+	{ .name = "rn5t618-wdt" },
+};
+
 static bool rn5t618_volatile_reg(struct device *dev, unsigned int reg)
 {
 	switch (reg) {
@@ -174,8 +182,16 @@ static int rn5t618_i2c_probe(struct i2c_client *i2c,
 		return ret;
 	}
 
-	ret = devm_mfd_add_devices(&i2c->dev, -1, rn5t618_cells,
-				   ARRAY_SIZE(rn5t618_cells), NULL, 0, NULL);
+	if (priv->variant == RC5T619)
+		ret = devm_mfd_add_devices(&i2c->dev, PLATFORM_DEVID_NONE,
+					   rc5t619_cells,
+					   ARRAY_SIZE(rc5t619_cells),
+					   NULL, 0, NULL);
+	else
+		ret = devm_mfd_add_devices(&i2c->dev, PLATFORM_DEVID_NONE,
+					   rn5t618_cells,
+					   ARRAY_SIZE(rn5t618_cells),
+					   NULL, 0, NULL);
 	if (ret) {
 		dev_err(&i2c->dev, "failed to add sub-devices: %d\n", ret);
 		return ret;
Signature · 1 line
2.20.1
#8 lore raw

PATCH RESEND v6 5/7 rtc: rc5t619: add Ricoh RC5T619 RTC driver

In reply to Andreas Kemnade

Add an RTC driver for the RTC device on Ricoh MFD RC5T619, which is implemented as a variant of RN5T618.

rtc-range output:
Testing 2000-02-28 23:59:59.
OK

Testing 2038-01-19 03:14:07.
OK

Testing 2069-12-31 23:59:59.
OK

Testing 2099-12-31 23:59:59.
KO RTC_RD_TIME returned 22 (line 138)

Testing 2100-02-28 23:59:59.
KO RTC_SET_TIME returned 34 (line 122)

Testing 2106-02-07 06:28:15.
KO RTC_SET_TIME returned 34 (line 122)

Testing 2262-04-11 23:47:16.
KO RTC_SET_TIME returned 34 (line 122)

---
Changes in v3:
- further output cleanup
- remove useless toggling of alarm flag in rtc probe
- alignment cleanup

Changes in v2:
- correct subject line
- reset pon flag not at probe but later
- initialize things only on pon
- 12h handling
- ranges
- style cleanup
- less magic values

 drivers/rtc/Kconfig       |  10 +
 drivers/rtc/Makefile      |   1 +
 drivers/rtc/rtc-rc5t619.c | 444 ++++++++++++++++++++++++++++++++++++++
 3 files changed, 455 insertions(+)
 create mode 100644 drivers/rtc/rtc-rc5t619.c
drivers/rtc/Kconfig +10 -0
index 34c8b6c7e095..72fed8dc55e8 100644
@@ -591,6 +591,16 @@ config RTC_DRV_RC5T583
 	  This driver can also be built as a module. If so, the module
 	  will be called rtc-rc5t583.
 
+config RTC_DRV_RC5T619
+	tristate "RICOH RC5T619 RTC driver"
+	depends on MFD_RN5T618
+	help
+	  If you say yes here you get support for the RTC on the
+	  RICOH RC5T619 chips.
+
+	  This driver can also be built as a module. If so, the module
+	  will be called rtc-rc5t619.
+
 config RTC_DRV_S35390A
 	tristate "Seiko Instruments S-35390A"
 	select BITREVERSE
drivers/rtc/Makefile +1 -0
index 4ac8f19fb631..7612912cdf00 100644
@@ -137,6 +137,7 @@ obj-$(CONFIG_RTC_DRV_PXA)	+= rtc-pxa.o
 obj-$(CONFIG_RTC_DRV_R7301)	+= rtc-r7301.o
 obj-$(CONFIG_RTC_DRV_R9701)	+= rtc-r9701.o
 obj-$(CONFIG_RTC_DRV_RC5T583)	+= rtc-rc5t583.o
+obj-$(CONFIG_RTC_DRV_RC5T619)	+= rtc-rc5t619.o
 obj-$(CONFIG_RTC_DRV_RK808)	+= rtc-rk808.o
 obj-$(CONFIG_RTC_DRV_RP5C01)	+= rtc-rp5c01.o
 obj-$(CONFIG_RTC_DRV_RS5C313)	+= rtc-rs5c313.o
drivers/rtc/rtc-rc5t619.c new file +444 -0

444 lines not on this page · raw message

Signature · 1 line
2.20.1
#9 lore raw

PATCH RESEND v6 6/7 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.

---
- was in a separate patchset

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 82e33082958c..300904b93656 100644
@@ -783,6 +783,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 919228900df9..b182d234f45a 100644
@@ -74,6 +74,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
#10 lore raw

PATCH RESEND v6 7/7 mfd: rn5t618: cleanup i2c_device_id

In reply to Andreas Kemnade

That list was just empty, so it can be removed if .probe_new instead of .probe is used

---
Functional independent from the other patches, but since they are touching similar areas, commit/merge conflicts would occur.

 drivers/mfd/rn5t618.c | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)
drivers/mfd/rn5t618.c +2 -9
index 321836f78120..b8033e2d650f 100644
@@ -153,8 +153,7 @@ static const struct of_device_id rn5t618_of_match[] = {
 };
 MODULE_DEVICE_TABLE(of, rn5t618_of_match);
 
-static int rn5t618_i2c_probe(struct i2c_client *i2c,
-			     const struct i2c_device_id *id)
+static int rn5t618_i2c_probe(struct i2c_client *i2c)
 {
 	const struct of_device_id *of_id;
 	struct rn5t618 *priv;
@@ -256,11 +255,6 @@ static int __maybe_unused rn5t618_i2c_resume(struct device *dev)
 	return 0;
 }
 
-static const struct i2c_device_id rn5t618_i2c_id[] = {
-	{ }
-};
-MODULE_DEVICE_TABLE(i2c, rn5t618_i2c_id);
-
 static SIMPLE_DEV_PM_OPS(rn5t618_i2c_dev_pm_ops,
 			rn5t618_i2c_suspend,
 			rn5t618_i2c_resume);
@@ -271,9 +265,8 @@ static struct i2c_driver rn5t618_i2c_driver = {
 		.of_match_table = of_match_ptr(rn5t618_of_match),
 		.pm = &rn5t618_i2c_dev_pm_ops,
 	},
-	.probe = rn5t618_i2c_probe,
+	.probe_new = rn5t618_i2c_probe,
 	.remove = rn5t618_i2c_remove,
-	.id_table = rn5t618_i2c_id,
 };
 
 module_i2c_driver(rn5t618_i2c_driver);
Signature · 1 line
2.20.1