On Wed, 11 Dec 2019, Andreas Kemnade wrote: > 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. > > Signed-off-by: Andreas Kemnade <andreas@xxxxxxxxxxxx> > --- > 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(+) > > diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig > index ae24d3ea68ea..522e068d0082 100644 > --- a/drivers/mfd/Kconfig > +++ b/drivers/mfd/Kconfig > @@ -1057,6 +1057,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. > diff --git a/drivers/mfd/rn5t618.c b/drivers/mfd/rn5t618.c > index da5cd9c92a59..76d997c0cfe4 100644 > --- a/drivers/mfd/rn5t618.c > +++ b/drivers/mfd/rn5t618.c > @@ -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> > @@ -45,9 +47,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; > > +int rn5t618_irq_init(struct rn5t618 *rn5t618) Static? -- Lee Jones [李琼斯] Linaro Services Technical Lead Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog