2022-11-12 15:41:42

by Aidan MacDonald

[permalink] [raw]
Subject: [PATCH 00/18] mfd: Clean up deprecated regmap-irq functionality

Hi Lee,

Here are some trivial updates to replace old, deprecated regmap-irq APIs
with the new equivalents. There should be no functional changes, but none
of the patches have been tested (besides compile testing).

One issue with WCD934x - after applying the patch, a bug in regmap-irq
will cause a null pointer deref when setting the IRQ type, but a fix is
already in the regmap tree.

Link: https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap.git/commit/?id=84498d1fb35de6ab71bdfdb6270a464fb4a0951b

Aidan MacDonald (18):
mfd: 88pm800: Replace irqchip mask_invert with unmask_base
mfd: atc260x: Replace irqchip mask_invert with unmask_base
mfd: axp20x: Replace irqchip mask_invert with unmask_base
mfd: gateworks-gsc: Replace irqchip mask_invert with unmask_base
mfd: max14577: Replace irqchip mask_invert with unmask_base
mfd: max77650: Remove useless type_invert flag
mfd: max77693: Replace irqchip mask_invert with unmask_base
mfd: max77843: Drop useless mask_invert flag on irqchip
mfd: rn5t618: Replace irqchip mask_invert with unmask_base
mfd: rohm-bd71828: Replace irqchip mask_invert with unmask_base
mfd: rohm-bd718x7: Drop useless mask_invert flag on irqchip
mfd: rt5033: Replace irqchip mask_invert with unmask_base
mfd: rt5120: Replace irqchip mask_invert with unmask_base
mfd: sprd-sc27xx-spi: Replace irqchip mask_invert with unmask_base
mfd: stpmic1: Fix swapped mask/unmask in irq chip
mfd: sun4i-gpadc: Replace irqchip mask_invert with unmask_base
mfd: tps65090: Replace irqchip mask_invert with unmask_base
mfd: wcd934x: Convert irq chip to config regs

drivers/mfd/88pm800.c | 3 +--
drivers/mfd/atc260x-core.c | 6 ++----
drivers/mfd/axp20x.c | 21 +++++++--------------
drivers/mfd/gateworks-gsc.c | 3 +--
drivers/mfd/max14577.c | 7 ++-----
drivers/mfd/max77650.c | 1 -
drivers/mfd/max77693.c | 6 +-----
drivers/mfd/max77843.c | 1 -
drivers/mfd/rn5t618.c | 3 +--
drivers/mfd/rohm-bd71828.c | 6 ++----
drivers/mfd/rohm-bd718x7.c | 1 -
drivers/mfd/rt5033.c | 3 +--
drivers/mfd/rt5120.c | 3 +--
drivers/mfd/sprd-sc27xx-spi.c | 3 +--
drivers/mfd/stpmic1.c | 5 +++--
drivers/mfd/sun4i-gpadc.c | 3 +--
drivers/mfd/tps65090.c | 3 +--
drivers/mfd/wcd934x.c | 11 ++++++++---
18 files changed, 33 insertions(+), 56 deletions(-)

--
2.38.1



2022-11-12 15:42:37

by Aidan MacDonald

[permalink] [raw]
Subject: [PATCH 08/18] mfd: max77843: Drop useless mask_invert flag on irqchip

Setting mask_invert to false is pointless because that's the
default. The flag is also deprecated, so drop it.

Signed-off-by: Aidan MacDonald <[email protected]>
---
drivers/mfd/max77843.c | 1 -
1 file changed, 1 deletion(-)

diff --git a/drivers/mfd/max77843.c b/drivers/mfd/max77843.c
index 209ee24d9ce1..4da58eab1603 100644
--- a/drivers/mfd/max77843.c
+++ b/drivers/mfd/max77843.c
@@ -59,7 +59,6 @@ static const struct regmap_irq_chip max77843_irq_chip = {
.name = "max77843",
.status_base = MAX77843_SYS_REG_SYSINTSRC,
.mask_base = MAX77843_SYS_REG_SYSINTMASK,
- .mask_invert = false,
.num_regs = 1,
.irqs = max77843_irqs,
.num_irqs = ARRAY_SIZE(max77843_irqs),
--
2.38.1


2022-11-12 15:43:11

by Aidan MacDonald

[permalink] [raw]
Subject: [PATCH 16/18] mfd: sun4i-gpadc: Replace irqchip mask_invert with unmask_base

Remove use of the deprecated mask_invert flag. Inverted mask
registers (where a '1' bit enables an IRQ) can be described more
directly as an unmask register.

Signed-off-by: Aidan MacDonald <[email protected]>
---
drivers/mfd/sun4i-gpadc.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/mfd/sun4i-gpadc.c b/drivers/mfd/sun4i-gpadc.c
index cfe14d9bf6dc..edc180d83a4b 100644
--- a/drivers/mfd/sun4i-gpadc.c
+++ b/drivers/mfd/sun4i-gpadc.c
@@ -34,9 +34,8 @@ static const struct regmap_irq_chip sun4i_gpadc_regmap_irq_chip = {
.name = "sun4i_gpadc_irq_chip",
.status_base = SUN4I_GPADC_INT_FIFOS,
.ack_base = SUN4I_GPADC_INT_FIFOS,
- .mask_base = SUN4I_GPADC_INT_FIFOC,
+ .unmask_base = SUN4I_GPADC_INT_FIFOC,
.init_ack_masked = true,
- .mask_invert = true,
.irqs = sun4i_gpadc_regmap_irq,
.num_irqs = ARRAY_SIZE(sun4i_gpadc_regmap_irq),
.num_regs = 1,
--
2.38.1


2022-11-12 15:43:41

by Aidan MacDonald

[permalink] [raw]
Subject: [PATCH 18/18] mfd: wcd934x: Convert irq chip to config regs

Type registers are deprecated and will eventually be removed from
regmap-irq. The same functionality can be replicated with config
registers.

Signed-off-by: Aidan MacDonald <[email protected]>
---
drivers/mfd/wcd934x.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/drivers/mfd/wcd934x.c b/drivers/mfd/wcd934x.c
index 68e2fa2fda99..07e884087f2c 100644
--- a/drivers/mfd/wcd934x.c
+++ b/drivers/mfd/wcd934x.c
@@ -55,17 +55,22 @@ static const struct regmap_irq wcd934x_irqs[] = {
WCD934X_REGMAP_IRQ_REG(WCD934X_IRQ_SOUNDWIRE, 2, BIT(4)),
};

+static const unsigned int wcd934x_config_regs[] = {
+ WCD934X_INTR_LEVEL0,
+};
+
static const struct regmap_irq_chip wcd934x_regmap_irq_chip = {
.name = "wcd934x_irq",
.status_base = WCD934X_INTR_PIN1_STATUS0,
.mask_base = WCD934X_INTR_PIN1_MASK0,
.ack_base = WCD934X_INTR_PIN1_CLEAR0,
- .type_base = WCD934X_INTR_LEVEL0,
- .num_type_reg = 4,
- .type_in_mask = false,
.num_regs = 4,
.irqs = wcd934x_irqs,
.num_irqs = ARRAY_SIZE(wcd934x_irqs),
+ .config_base = wcd934x_config_regs,
+ .num_config_bases = ARRAY_SIZE(wcd934x_config_regs),
+ .num_config_regs = 4,
+ .set_type_config = regmap_irq_set_type_config_simple,
};

static bool wcd934x_is_volatile_register(struct device *dev, unsigned int reg)
--
2.38.1


2022-11-12 15:43:41

by Aidan MacDonald

[permalink] [raw]
Subject: [PATCH 07/18] mfd: max77693: Replace irqchip mask_invert with unmask_base

Remove use of the deprecated mask_invert flag. Inverted mask
registers (where a '1' bit enables an IRQ) can be described more
directly as an unmask register.

Signed-off-by: Aidan MacDonald <[email protected]>
---
drivers/mfd/max77693.c | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/drivers/mfd/max77693.c b/drivers/mfd/max77693.c
index 7088cb6f9174..7486acc84499 100644
--- a/drivers/mfd/max77693.c
+++ b/drivers/mfd/max77693.c
@@ -66,7 +66,6 @@ static const struct regmap_irq_chip max77693_led_irq_chip = {
.name = "max77693-led",
.status_base = MAX77693_LED_REG_FLASH_INT,
.mask_base = MAX77693_LED_REG_FLASH_INT_MASK,
- .mask_invert = false,
.num_regs = 1,
.irqs = max77693_led_irqs,
.num_irqs = ARRAY_SIZE(max77693_led_irqs),
@@ -82,7 +81,6 @@ static const struct regmap_irq_chip max77693_topsys_irq_chip = {
.name = "max77693-topsys",
.status_base = MAX77693_PMIC_REG_TOPSYS_INT,
.mask_base = MAX77693_PMIC_REG_TOPSYS_INT_MASK,
- .mask_invert = false,
.num_regs = 1,
.irqs = max77693_topsys_irqs,
.num_irqs = ARRAY_SIZE(max77693_topsys_irqs),
@@ -100,7 +98,6 @@ static const struct regmap_irq_chip max77693_charger_irq_chip = {
.name = "max77693-charger",
.status_base = MAX77693_CHG_REG_CHG_INT,
.mask_base = MAX77693_CHG_REG_CHG_INT_MASK,
- .mask_invert = false,
.num_regs = 1,
.irqs = max77693_charger_irqs,
.num_irqs = ARRAY_SIZE(max77693_charger_irqs),
@@ -136,8 +133,7 @@ static const struct regmap_irq max77693_muic_irqs[] = {
static const struct regmap_irq_chip max77693_muic_irq_chip = {
.name = "max77693-muic",
.status_base = MAX77693_MUIC_REG_INT1,
- .mask_base = MAX77693_MUIC_REG_INTMASK1,
- .mask_invert = true,
+ .unmask_base = MAX77693_MUIC_REG_INTMASK1,
.num_regs = 3,
.irqs = max77693_muic_irqs,
.num_irqs = ARRAY_SIZE(max77693_muic_irqs),
--
2.38.1


2022-11-12 15:43:49

by Aidan MacDonald

[permalink] [raw]
Subject: [PATCH 06/18] mfd: max77650: Remove useless type_invert flag

The type_invert flag does nothing when type_in_mask is set, and
it's part of deprecated functionality in regmap-irq. Remove it.

Signed-off-by: Aidan MacDonald <[email protected]>
---
drivers/mfd/max77650.c | 1 -
1 file changed, 1 deletion(-)

diff --git a/drivers/mfd/max77650.c b/drivers/mfd/max77650.c
index 777485a33bc0..3c07fcdd9d07 100644
--- a/drivers/mfd/max77650.c
+++ b/drivers/mfd/max77650.c
@@ -138,7 +138,6 @@ static const struct regmap_irq_chip max77650_irq_chip = {
.status_base = MAX77650_REG_INT_GLBL,
.mask_base = MAX77650_REG_INTM_GLBL,
.type_in_mask = true,
- .type_invert = true,
.init_ack_masked = true,
.clear_on_unmask = true,
};
--
2.38.1


2022-11-12 15:44:03

by Aidan MacDonald

[permalink] [raw]
Subject: [PATCH 10/18] mfd: rohm-bd71828: Replace irqchip mask_invert with unmask_base

Remove use of the deprecated mask_invert flag. Inverted mask
registers (where a '1' bit enables an IRQ) can be described more
directly as an unmask register.

Signed-off-by: Aidan MacDonald <[email protected]>
---
drivers/mfd/rohm-bd71828.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/mfd/rohm-bd71828.c b/drivers/mfd/rohm-bd71828.c
index 714d9fcbf07b..3c5c6c393650 100644
--- a/drivers/mfd/rohm-bd71828.c
+++ b/drivers/mfd/rohm-bd71828.c
@@ -413,9 +413,8 @@ static struct regmap_irq_chip bd71828_irq_chip = {
.irqs = &bd71828_irqs[0],
.num_irqs = ARRAY_SIZE(bd71828_irqs),
.status_base = BD71828_REG_INT_BUCK,
- .mask_base = BD71828_REG_INT_MASK_BUCK,
+ .unmask_base = BD71828_REG_INT_MASK_BUCK,
.ack_base = BD71828_REG_INT_BUCK,
- .mask_invert = true,
.init_ack_masked = true,
.num_regs = 12,
.num_main_regs = 1,
@@ -430,9 +429,8 @@ static struct regmap_irq_chip bd71815_irq_chip = {
.irqs = &bd71815_irqs[0],
.num_irqs = ARRAY_SIZE(bd71815_irqs),
.status_base = BD71815_REG_INT_STAT_01,
- .mask_base = BD71815_REG_INT_EN_01,
+ .unmask_base = BD71815_REG_INT_EN_01,
.ack_base = BD71815_REG_INT_STAT_01,
- .mask_invert = true,
.init_ack_masked = true,
.num_regs = 12,
.num_main_regs = 1,
--
2.38.1


2022-11-12 15:46:04

by Aidan MacDonald

[permalink] [raw]
Subject: Re: [PATCH 18/18] mfd: wcd934x: Convert irq chip to config regs


> Type registers are deprecated and will eventually be removed from
> regmap-irq. The same functionality can be replicated with config
> registers.
>
> Signed-off-by: Aidan MacDonald <[email protected]>
> ---
> drivers/mfd/wcd934x.c | 11 ++++++++---
> 1 file changed, 8 insertions(+), 3 deletions(-)

Forgot to include this here:--

One issue with WCD934x - after applying the patch, a bug in regmap-irq
will cause a null pointer deref when setting the IRQ type, but a fix is
already in the regmap tree.

Link: https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap.git/commit/?id=84498d1fb35de6ab71bdfdb6270a464fb4a0951b

> diff --git a/drivers/mfd/wcd934x.c b/drivers/mfd/wcd934x.c
> index 68e2fa2fda99..07e884087f2c 100644
> --- a/drivers/mfd/wcd934x.c
> +++ b/drivers/mfd/wcd934x.c
> @@ -55,17 +55,22 @@ static const struct regmap_irq wcd934x_irqs[] = {
> WCD934X_REGMAP_IRQ_REG(WCD934X_IRQ_SOUNDWIRE, 2, BIT(4)),
> };
>
> +static const unsigned int wcd934x_config_regs[] = {
> + WCD934X_INTR_LEVEL0,
> +};
> +
> static const struct regmap_irq_chip wcd934x_regmap_irq_chip = {
> .name = "wcd934x_irq",
> .status_base = WCD934X_INTR_PIN1_STATUS0,
> .mask_base = WCD934X_INTR_PIN1_MASK0,
> .ack_base = WCD934X_INTR_PIN1_CLEAR0,
> - .type_base = WCD934X_INTR_LEVEL0,
> - .num_type_reg = 4,
> - .type_in_mask = false,
> .num_regs = 4,
> .irqs = wcd934x_irqs,
> .num_irqs = ARRAY_SIZE(wcd934x_irqs),
> + .config_base = wcd934x_config_regs,
> + .num_config_bases = ARRAY_SIZE(wcd934x_config_regs),
> + .num_config_regs = 4,
> + .set_type_config = regmap_irq_set_type_config_simple,
> };
>
> static bool wcd934x_is_volatile_register(struct device *dev, unsigned int reg)

2022-11-12 16:00:26

by Aidan MacDonald

[permalink] [raw]
Subject: [PATCH 17/18] mfd: tps65090: Replace irqchip mask_invert with unmask_base

Remove use of the deprecated mask_invert flag. Inverted mask
registers (where a '1' bit enables an IRQ) can be described more
directly as an unmask register.

Signed-off-by: Aidan MacDonald <[email protected]>
---
drivers/mfd/tps65090.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/mfd/tps65090.c b/drivers/mfd/tps65090.c
index bd6235308c6b..e474e1ca253a 100644
--- a/drivers/mfd/tps65090.c
+++ b/drivers/mfd/tps65090.c
@@ -127,8 +127,7 @@ static struct regmap_irq_chip tps65090_irq_chip = {
.num_irqs = ARRAY_SIZE(tps65090_irqs),
.num_regs = NUM_INT_REG,
.status_base = TPS65090_REG_INTR_STS,
- .mask_base = TPS65090_REG_INTR_MASK,
- .mask_invert = true,
+ .unmask_base = TPS65090_REG_INTR_MASK,
};

static bool is_volatile_reg(struct device *dev, unsigned int reg)
--
2.38.1


2022-11-12 16:05:39

by Aidan MacDonald

[permalink] [raw]
Subject: [PATCH 04/18] mfd: gateworks-gsc: Replace irqchip mask_invert with unmask_base

Remove use of the deprecated mask_invert flag. Inverted mask
registers (where a '1' bit enables an IRQ) can be described more
directly as an unmask register.

Signed-off-by: Aidan MacDonald <[email protected]>
---
drivers/mfd/gateworks-gsc.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/mfd/gateworks-gsc.c b/drivers/mfd/gateworks-gsc.c
index 9d7d870c44a8..c954ed265de8 100644
--- a/drivers/mfd/gateworks-gsc.c
+++ b/drivers/mfd/gateworks-gsc.c
@@ -189,8 +189,7 @@ static const struct regmap_irq_chip gsc_irq_chip = {
.num_irqs = ARRAY_SIZE(gsc_irqs),
.num_regs = 1,
.status_base = GSC_IRQ_STATUS,
- .mask_base = GSC_IRQ_ENABLE,
- .mask_invert = true,
+ .unmask_base = GSC_IRQ_ENABLE,
.ack_base = GSC_IRQ_STATUS,
.ack_invert = true,
};
--
2.38.1


2022-11-12 16:06:07

by Aidan MacDonald

[permalink] [raw]
Subject: [PATCH 15/18] mfd: stpmic1: Fix swapped mask/unmask in irq chip

The usual behavior of mask registers is writing a '1' bit to
disable (mask) an interrupt; similarly, writing a '1' bit to
an unmask register enables (unmasks) an interrupt.

Due to a longstanding issue in regmap-irq, mask and unmask
registers were inverted when both kinds of registers were
present on the same chip, ie. regmap-irq actually wrote '1's
to the mask register to enable an IRQ and '1's to the unmask
register to disable an IRQ.

This was fixed by commit e8ffb12e7f06 ("regmap-irq: Fix
inverted handling of unmask registers") but the fix is opt-in
via mask_unmask_non_inverted = true because it requires manual
changes for each affected driver. The new behavior will become
the default once all drivers have been updated.

The STPMIC1 has a normal mask register with separate set and
clear registers. The driver intends to use the set & clear
registers with regmap-irq and has compensated for regmap-irq's
inverted behavior, and should currently be working properly.
Thus, swap mask_base and unmask_base, and opt in to the new
non-inverted behavior.

Signed-off-by: Aidan MacDonald <[email protected]>
---
drivers/mfd/stpmic1.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/mfd/stpmic1.c b/drivers/mfd/stpmic1.c
index eb3da558c3fb..ee0469d5d435 100644
--- a/drivers/mfd/stpmic1.c
+++ b/drivers/mfd/stpmic1.c
@@ -108,8 +108,9 @@ static const struct regmap_irq stpmic1_irqs[] = {
static const struct regmap_irq_chip stpmic1_regmap_irq_chip = {
.name = "pmic_irq",
.status_base = INT_PENDING_R1,
- .mask_base = INT_CLEAR_MASK_R1,
- .unmask_base = INT_SET_MASK_R1,
+ .mask_base = INT_SET_MASK_R1,
+ .unmask_base = INT_CLEAR_MASK_R1,
+ .mask_unmask_non_inverted = true,
.ack_base = INT_CLEAR_R1,
.num_regs = STPMIC1_PMIC_NUM_IRQ_REGS,
.irqs = stpmic1_irqs,
--
2.38.1


2022-11-12 16:07:36

by Aidan MacDonald

[permalink] [raw]
Subject: [PATCH 12/18] mfd: rt5033: Replace irqchip mask_invert with unmask_base

Remove use of the deprecated mask_invert flag. Inverted mask
registers (where a '1' bit enables an IRQ) can be described more
directly as an unmask register.

Signed-off-by: Aidan MacDonald <[email protected]>
---
drivers/mfd/rt5033.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/mfd/rt5033.c b/drivers/mfd/rt5033.c
index f1236a9acf30..dc9bf4057a09 100644
--- a/drivers/mfd/rt5033.c
+++ b/drivers/mfd/rt5033.c
@@ -29,8 +29,7 @@ static const struct regmap_irq rt5033_irqs[] = {
static const struct regmap_irq_chip rt5033_irq_chip = {
.name = "rt5033",
.status_base = RT5033_REG_PMIC_IRQ_STAT,
- .mask_base = RT5033_REG_PMIC_IRQ_CTRL,
- .mask_invert = true,
+ .unmask_base = RT5033_REG_PMIC_IRQ_CTRL,
.num_regs = 1,
.irqs = rt5033_irqs,
.num_irqs = ARRAY_SIZE(rt5033_irqs),
--
2.38.1


2022-11-12 16:18:25

by Aidan MacDonald

[permalink] [raw]
Subject: [PATCH 13/18] mfd: rt5120: Replace irqchip mask_invert with unmask_base

Remove use of the deprecated mask_invert flag. Inverted mask
registers (where a '1' bit enables an IRQ) can be described more
directly as an unmask register.

Signed-off-by: Aidan MacDonald <[email protected]>
---
drivers/mfd/rt5120.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/mfd/rt5120.c b/drivers/mfd/rt5120.c
index 8046e383bc92..829b7a0a0781 100644
--- a/drivers/mfd/rt5120.c
+++ b/drivers/mfd/rt5120.c
@@ -59,9 +59,8 @@ static const struct regmap_irq rt5120_irqs[] = {
static const struct regmap_irq_chip rt5120_irq_chip = {
.name = "rt5120-pmic",
.status_base = RT5120_REG_INTSTAT,
- .mask_base = RT5120_REG_INTENABLE,
+ .unmask_base = RT5120_REG_INTENABLE,
.ack_base = RT5120_REG_INTSTAT,
- .mask_invert = true,
.use_ack = true,
.num_regs = 1,
.irqs = rt5120_irqs,
--
2.38.1


2022-11-13 19:02:14

by Samuel Holland

[permalink] [raw]
Subject: Re: [PATCH 16/18] mfd: sun4i-gpadc: Replace irqchip mask_invert with unmask_base

On 11/12/22 09:18, Aidan MacDonald wrote:
> Remove use of the deprecated mask_invert flag. Inverted mask
> registers (where a '1' bit enables an IRQ) can be described more
> directly as an unmask register.
>
> Signed-off-by: Aidan MacDonald <[email protected]>

Reviewed-by: Samuel Holland <[email protected]>


2022-11-14 06:44:31

by Matti Vaittinen

[permalink] [raw]
Subject: Re: [PATCH 10/18] mfd: rohm-bd71828: Replace irqchip mask_invert with unmask_base

On 11/12/22 17:18, Aidan MacDonald wrote:
> Remove use of the deprecated mask_invert flag. Inverted mask
> registers (where a '1' bit enables an IRQ) can be described more
> directly as an unmask register.
>
> Signed-off-by: Aidan MacDonald <[email protected]>
Reviewed-by: Matti Vaittinen <[email protected]>

> ---
> drivers/mfd/rohm-bd71828.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/mfd/rohm-bd71828.c b/drivers/mfd/rohm-bd71828.c
> index 714d9fcbf07b..3c5c6c393650 100644
> --- a/drivers/mfd/rohm-bd71828.c
> +++ b/drivers/mfd/rohm-bd71828.c
> @@ -413,9 +413,8 @@ static struct regmap_irq_chip bd71828_irq_chip = {
> .irqs = &bd71828_irqs[0],
> .num_irqs = ARRAY_SIZE(bd71828_irqs),
> .status_base = BD71828_REG_INT_BUCK,
> - .mask_base = BD71828_REG_INT_MASK_BUCK,
> + .unmask_base = BD71828_REG_INT_MASK_BUCK,
> .ack_base = BD71828_REG_INT_BUCK,
> - .mask_invert = true,
> .init_ack_masked = true,
> .num_regs = 12,
> .num_main_regs = 1,
> @@ -430,9 +429,8 @@ static struct regmap_irq_chip bd71815_irq_chip = {
> .irqs = &bd71815_irqs[0],
> .num_irqs = ARRAY_SIZE(bd71815_irqs),
> .status_base = BD71815_REG_INT_STAT_01,
> - .mask_base = BD71815_REG_INT_EN_01,
> + .unmask_base = BD71815_REG_INT_EN_01,
> .ack_base = BD71815_REG_INT_STAT_01,
> - .mask_invert = true,
> .init_ack_masked = true,
> .num_regs = 12,
> .num_main_regs = 1,

--
Matti Vaittinen
Linux kernel developer at ROHM Semiconductors
Oulu Finland

~~ When things go utterly wrong vim users can always type :help! ~~


2022-11-14 10:35:42

by Krzysztof Kozlowski

[permalink] [raw]
Subject: Re: [PATCH 07/18] mfd: max77693: Replace irqchip mask_invert with unmask_base

On 12/11/2022 16:18, Aidan MacDonald wrote:
> Remove use of the deprecated mask_invert flag. Inverted mask
> registers (where a '1' bit enables an IRQ) can be described more
> directly as an unmask register.
>
> Signed-off-by: Aidan MacDonald <[email protected]>
> ---

Acked-by: Krzysztof Kozlowski <[email protected]>

Best regards,
Krzysztof


2022-11-14 10:36:37

by Krzysztof Kozlowski

[permalink] [raw]
Subject: Re: [PATCH 08/18] mfd: max77843: Drop useless mask_invert flag on irqchip

On 12/11/2022 16:18, Aidan MacDonald wrote:
> Setting mask_invert to false is pointless because that's the
> default. The flag is also deprecated, so drop it.
>
> Signed-off-by: Aidan MacDonald <[email protected]>
> ---

Acked-by: Krzysztof Kozlowski <[email protected]>

Best regards,
Krzysztof


2022-11-14 13:21:23

by Bartosz Golaszewski

[permalink] [raw]
Subject: Re: [PATCH 06/18] mfd: max77650: Remove useless type_invert flag

On Sat, Nov 12, 2022 at 4:19 PM Aidan MacDonald
<[email protected]> wrote:
>
> The type_invert flag does nothing when type_in_mask is set, and
> it's part of deprecated functionality in regmap-irq. Remove it.
>
> Signed-off-by: Aidan MacDonald <[email protected]>
> ---
> drivers/mfd/max77650.c | 1 -
> 1 file changed, 1 deletion(-)
>
> diff --git a/drivers/mfd/max77650.c b/drivers/mfd/max77650.c
> index 777485a33bc0..3c07fcdd9d07 100644
> --- a/drivers/mfd/max77650.c
> +++ b/drivers/mfd/max77650.c
> @@ -138,7 +138,6 @@ static const struct regmap_irq_chip max77650_irq_chip = {
> .status_base = MAX77650_REG_INT_GLBL,
> .mask_base = MAX77650_REG_INTM_GLBL,
> .type_in_mask = true,
> - .type_invert = true,
> .init_ack_masked = true,
> .clear_on_unmask = true,
> };
> --
> 2.38.1
>

Acked-by: Bartosz Golaszewski <[email protected]>

2022-11-15 10:32:55

by Matti Vaittinen

[permalink] [raw]
Subject: Re: [PATCH 00/18] mfd: Clean up deprecated regmap-irq functionality

Hi Aidan,

la 12. marrask. 2022 klo 17.19 Aidan MacDonald
([email protected]) kirjoitti:

> Here are some trivial updates to replace old, deprecated regmap-irq APIs
> with the new equivalents. There should be no functional changes, but none
> of the patches have been tested (besides compile testing).

> Link: https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap.git/commit/?id=84498d1fb35de6ab71bdfdb6270a464fb4a0951b
>
> Aidan MacDonald (18):

Just a small suggestion. Would it work if the CC-list was generated
separately for each of the patches for a large series targeted to
various individual drivers like this one? I think that many of the
recipients are not interested in more than one or two of the patches +
cover-letter in this 19-mail series...

I know it can be a pain to hassle with the recipient lists and
message-IDs - so I am glad if anyone can find some help from my
personal playground - or even better, share their versions with us :)
So, to open the window for any work-flow improvement suggestions...
...I've personally started generating patches using the following
shell-script (which is inefficient and lazily written but seems to
mostly work for me):
https://github.com/M-Vaittinen/linux/commit/9045670f8d3d4638b9032d96cff955704a6d438e

It can be freely used as a source of inspiration (or perspiration - no
guarantees it works as intended or is feasible for anything) when
generating the next series ;)

Yours
-- Matti

--

Matti Vaittinen
Linux kernel developer at ROHM Semiconductors
Oulu Finland

~~ When things go utterly wrong vim users can always type :help! ~~

Discuss - Estimate - Plan - Report and finally accomplish this:
void do_work(int time) __attribute__ ((const));

2022-11-16 18:11:25

by Lee Jones

[permalink] [raw]
Subject: Re: [PATCH 15/18] mfd: stpmic1: Fix swapped mask/unmask in irq chip

On Sat, 12 Nov 2022, Aidan MacDonald wrote:

> The usual behavior of mask registers is writing a '1' bit to
> disable (mask) an interrupt; similarly, writing a '1' bit to
> an unmask register enables (unmasks) an interrupt.
>
> Due to a longstanding issue in regmap-irq, mask and unmask
> registers were inverted when both kinds of registers were
> present on the same chip, ie. regmap-irq actually wrote '1's
> to the mask register to enable an IRQ and '1's to the unmask
> register to disable an IRQ.
>
> This was fixed by commit e8ffb12e7f06 ("regmap-irq: Fix
> inverted handling of unmask registers") but the fix is opt-in
> via mask_unmask_non_inverted = true because it requires manual
> changes for each affected driver. The new behavior will become
> the default once all drivers have been updated.
>
> The STPMIC1 has a normal mask register with separate set and
> clear registers. The driver intends to use the set & clear
> registers with regmap-irq and has compensated for regmap-irq's
> inverted behavior, and should currently be working properly.
> Thus, swap mask_base and unmask_base, and opt in to the new
> non-inverted behavior.
>
> Signed-off-by: Aidan MacDonald <[email protected]>
> ---
> drivers/mfd/stpmic1.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)

Applied, thanks.

--
Lee Jones [李琼斯]

2022-11-16 18:12:59

by Lee Jones

[permalink] [raw]
Subject: Re: [PATCH 18/18] mfd: wcd934x: Convert irq chip to config regs

On Sat, 12 Nov 2022, Aidan MacDonald wrote:

> Type registers are deprecated and will eventually be removed from
> regmap-irq. The same functionality can be replicated with config
> registers.
>
> Signed-off-by: Aidan MacDonald <[email protected]>
> ---
> drivers/mfd/wcd934x.c | 11 ++++++++---
> 1 file changed, 8 insertions(+), 3 deletions(-)

Applied, thanks.

--
Lee Jones [李琼斯]

2022-11-16 18:14:12

by Lee Jones

[permalink] [raw]
Subject: Re: [PATCH 17/18] mfd: tps65090: Replace irqchip mask_invert with unmask_base

On Sat, 12 Nov 2022, Aidan MacDonald wrote:

> Remove use of the deprecated mask_invert flag. Inverted mask
> registers (where a '1' bit enables an IRQ) can be described more
> directly as an unmask register.
>
> Signed-off-by: Aidan MacDonald <[email protected]>
> ---
> drivers/mfd/tps65090.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)

Applied, thanks.

--
Lee Jones [李琼斯]

2022-11-16 18:14:14

by Lee Jones

[permalink] [raw]
Subject: Re: [PATCH 16/18] mfd: sun4i-gpadc: Replace irqchip mask_invert with unmask_base

On Sat, 12 Nov 2022, Aidan MacDonald wrote:

> Remove use of the deprecated mask_invert flag. Inverted mask
> registers (where a '1' bit enables an IRQ) can be described more
> directly as an unmask register.
>
> Signed-off-by: Aidan MacDonald <[email protected]>
> ---
> drivers/mfd/sun4i-gpadc.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)

Applied, thanks.

--
Lee Jones [李琼斯]

2022-11-16 18:43:48

by Lee Jones

[permalink] [raw]
Subject: Re: [PATCH 07/18] mfd: max77693: Replace irqchip mask_invert with unmask_base

On Sat, 12 Nov 2022, Aidan MacDonald wrote:

> Remove use of the deprecated mask_invert flag. Inverted mask
> registers (where a '1' bit enables an IRQ) can be described more
> directly as an unmask register.
>
> Signed-off-by: Aidan MacDonald <[email protected]>
> ---
> drivers/mfd/max77693.c | 6 +-----
> 1 file changed, 1 insertion(+), 5 deletions(-)

Applied, thanks.

--
Lee Jones [李琼斯]

2022-11-16 18:47:35

by Lee Jones

[permalink] [raw]
Subject: Re: [PATCH 04/18] mfd: gateworks-gsc: Replace irqchip mask_invert with unmask_base

On Sat, 12 Nov 2022, Aidan MacDonald wrote:

> Remove use of the deprecated mask_invert flag. Inverted mask
> registers (where a '1' bit enables an IRQ) can be described more
> directly as an unmask register.
>
> Signed-off-by: Aidan MacDonald <[email protected]>
> ---
> drivers/mfd/gateworks-gsc.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)

Applied, thanks.

--
Lee Jones [李琼斯]

2022-11-16 18:48:24

by Lee Jones

[permalink] [raw]
Subject: Re: [PATCH 08/18] mfd: max77843: Drop useless mask_invert flag on irqchip

On Sat, 12 Nov 2022, Aidan MacDonald wrote:

> Setting mask_invert to false is pointless because that's the
> default. The flag is also deprecated, so drop it.
>
> Signed-off-by: Aidan MacDonald <[email protected]>
> ---
> drivers/mfd/max77843.c | 1 -
> 1 file changed, 1 deletion(-)

Applied, thanks.

--
Lee Jones [李琼斯]

2022-11-16 19:07:53

by Lee Jones

[permalink] [raw]
Subject: Re: [PATCH 13/18] mfd: rt5120: Replace irqchip mask_invert with unmask_base

On Sat, 12 Nov 2022, Aidan MacDonald wrote:

> Remove use of the deprecated mask_invert flag. Inverted mask
> registers (where a '1' bit enables an IRQ) can be described more
> directly as an unmask register.
>
> Signed-off-by: Aidan MacDonald <[email protected]>
> ---
> drivers/mfd/rt5120.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)

Applied, thanks.

--
Lee Jones [李琼斯]

2022-11-16 19:15:31

by Lee Jones

[permalink] [raw]
Subject: Re: [PATCH 06/18] mfd: max77650: Remove useless type_invert flag

On Sat, 12 Nov 2022, Aidan MacDonald wrote:

> The type_invert flag does nothing when type_in_mask is set, and
> it's part of deprecated functionality in regmap-irq. Remove it.
>
> Signed-off-by: Aidan MacDonald <[email protected]>
> ---
> drivers/mfd/max77650.c | 1 -
> 1 file changed, 1 deletion(-)

Applied, thanks.

--
Lee Jones [李琼斯]

2022-11-16 19:37:21

by Lee Jones

[permalink] [raw]
Subject: Re: [PATCH 12/18] mfd: rt5033: Replace irqchip mask_invert with unmask_base

On Sat, 12 Nov 2022, Aidan MacDonald wrote:

> Remove use of the deprecated mask_invert flag. Inverted mask
> registers (where a '1' bit enables an IRQ) can be described more
> directly as an unmask register.
>
> Signed-off-by: Aidan MacDonald <[email protected]>
> ---
> drivers/mfd/rt5033.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)

Applied, thanks.

--
Lee Jones [李琼斯]

2022-11-16 19:41:22

by Lee Jones

[permalink] [raw]
Subject: Re: [PATCH 10/18] mfd: rohm-bd71828: Replace irqchip mask_invert with unmask_base

On Sat, 12 Nov 2022, Aidan MacDonald wrote:

> Remove use of the deprecated mask_invert flag. Inverted mask
> registers (where a '1' bit enables an IRQ) can be described more
> directly as an unmask register.
>
> Signed-off-by: Aidan MacDonald <[email protected]>
> ---
> drivers/mfd/rohm-bd71828.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)

Applied, thanks.

--
Lee Jones [李琼斯]