linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mfd: max77705: rework interrupts
@ 2025-08-30 22:13 Dzmitry Sankouski
  2025-08-31  0:02 ` kernel test robot
  2025-08-31  8:29 ` Krzysztof Kozlowski
  0 siblings, 2 replies; 4+ messages in thread
From: Dzmitry Sankouski @ 2025-08-30 22:13 UTC (permalink / raw)
  To: Chanwoo Choi, Krzysztof Kozlowski, Lee Jones
  Cc: Krzysztof Kozlowski, linux-kernel, Dzmitry Sankouski

Current implementation describes only MFD's own topsys interrupts.
However, max77705 has a register which indicates interrupt source, i.e.
it acts as an interrupt controller. There's 4 interrupt sources in
max77705: topsys, charger, fuelgauge, usb type-c manager.

Setup max77705 MFD parent as an interrupt controller. Leave topsys
interrupts unregistered, because currently unused.

Fixes: c8d50f029748 ("mfd: Add new driver for MAX77705 PMIC")

Signed-off-by: Dzmitry Sankouski <dsankouski@gmail.com>
---
Max77705 has a register, which indicates, who is triggering irq. There
may be 4 irq sources in max77705: charger, fuelgauge, usb type-c
manager ic, and so-called 'topsys'. Hence, max77705 mfd parent device is
an interrupt controller. This series implements interrupt controller in
max77705 mfd.
---
 drivers/mfd/max77705.c | 26 ++++++++++++++++++--------
 1 file changed, 18 insertions(+), 8 deletions(-)

diff --git a/drivers/mfd/max77705.c b/drivers/mfd/max77705.c
index 6b263bacb8c2..076357cb77a9 100644
--- a/drivers/mfd/max77705.c
+++ b/drivers/mfd/max77705.c
@@ -61,6 +61,23 @@ static const struct regmap_config max77705_regmap_config = {
 	.max_register = MAX77705_PMIC_REG_USBC_RESET,
 };
 
+static const struct regmap_irq max77705_irqs[] = {
+	{ .mask = MAX77705_SRC_IRQ_CHG, },
+	{ .mask = MAX77705_SRC_IRQ_TOP, },
+	{ .mask = MAX77705_SRC_IRQ_FG, },
+	{ .mask = MAX77705_SRC_IRQ_USBC, },
+};
+
+static const struct regmap_irq_chip max77705_irq_chip = {
+	.name		= "max77705",
+	.status_base	= MAX77705_PMIC_REG_INTSRC,
+	.ack_base	= MAX77705_PMIC_REG_INTSRC,
+	.mask_base	= MAX77705_PMIC_REG_INTSRC_MASK,
+	.num_regs	= 1,
+	.irqs		= max77705_irqs,
+	.num_irqs	= ARRAY_SIZE(max77705_irqs),
+};
+
 static const struct regmap_irq max77705_topsys_irqs[] = {
 	{ .mask = MAX77705_SYSTEM_IRQ_BSTEN_INT, },
 	{ .mask = MAX77705_SYSTEM_IRQ_SYSUVLO_INT, },
@@ -111,18 +128,11 @@ static int max77705_i2c_probe(struct i2c_client *i2c)
 	ret = devm_regmap_add_irq_chip(dev, max77705->regmap,
 					i2c->irq,
 					IRQF_ONESHOT | IRQF_SHARED, 0,
-					&max77705_topsys_irq_chip,
+					&max77705_irq_chip,
 					&irq_data);
 	if (ret)
 		return dev_err_probe(dev, ret, "Failed to add IRQ chip\n");
 
-	/* Unmask interrupts from all blocks in interrupt source register */
-	ret = regmap_update_bits(max77705->regmap,
-				 MAX77705_PMIC_REG_INTSRC_MASK,
-				 MAX77705_SRC_IRQ_ALL, (unsigned int)~MAX77705_SRC_IRQ_ALL);
-	if (ret < 0)
-		return dev_err_probe(dev, ret, "Could not unmask interrupts in INTSRC\n");
-
 	domain = regmap_irq_get_domain(irq_data);
 
 	ret = devm_mfd_add_devices(dev, PLATFORM_DEVID_NONE,

---
base-commit: 3cace99d63192a7250461b058279a42d91075d0c
change-id: 20250831-max77705-fix_interrupt_handling-0889cee6936d

Best regards,
-- 
Dzmitry Sankouski <dsankouski@gmail.com>


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] mfd: max77705: rework interrupts
  2025-08-30 22:13 [PATCH] mfd: max77705: rework interrupts Dzmitry Sankouski
@ 2025-08-31  0:02 ` kernel test robot
  2025-08-31  8:29 ` Krzysztof Kozlowski
  1 sibling, 0 replies; 4+ messages in thread
From: kernel test robot @ 2025-08-31  0:02 UTC (permalink / raw)
  To: Dzmitry Sankouski, Chanwoo Choi, Krzysztof Kozlowski, Lee Jones
  Cc: llvm, oe-kbuild-all, linux-kernel, Dzmitry Sankouski

Hi Dzmitry,

kernel test robot noticed the following build warnings:

[auto build test WARNING on 3cace99d63192a7250461b058279a42d91075d0c]

url:    https://github.com/intel-lab-lkp/linux/commits/Dzmitry-Sankouski/mfd-max77705-rework-interrupts/20250831-061657
base:   3cace99d63192a7250461b058279a42d91075d0c
patch link:    https://lore.kernel.org/r/20250831-max77705-fix_interrupt_handling-v1-1-73e078012e51%40gmail.com
patch subject: [PATCH] mfd: max77705: rework interrupts
config: hexagon-randconfig-002-20250831 (https://download.01.org/0day-ci/archive/20250831/202508310735.f7Evkqz7-lkp@intel.com/config)
compiler: clang version 17.0.6 (https://github.com/llvm/llvm-project 6009708b4367171ccdbf4b5905cb6a803753fe18)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250831/202508310735.f7Evkqz7-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202508310735.f7Evkqz7-lkp@intel.com/

All warnings (new ones prefixed by >>):

>> drivers/mfd/max77705.c:89:37: warning: unused variable 'max77705_topsys_irq_chip' [-Wunused-const-variable]
      89 | static const struct regmap_irq_chip max77705_topsys_irq_chip = {
         |                                     ^~~~~~~~~~~~~~~~~~~~~~~~
   1 warning generated.


vim +/max77705_topsys_irq_chip +89 drivers/mfd/max77705.c

c8d50f029748b7 Dzmitry Sankouski 2025-01-23  88  
c8d50f029748b7 Dzmitry Sankouski 2025-01-23 @89  static const struct regmap_irq_chip max77705_topsys_irq_chip = {
c8d50f029748b7 Dzmitry Sankouski 2025-01-23  90  	.name		= "max77705-topsys",
c8d50f029748b7 Dzmitry Sankouski 2025-01-23  91  	.status_base	= MAX77705_PMIC_REG_SYSTEM_INT,
c8d50f029748b7 Dzmitry Sankouski 2025-01-23  92  	.mask_base	= MAX77705_PMIC_REG_SYSTEM_INT_MASK,
c8d50f029748b7 Dzmitry Sankouski 2025-01-23  93  	.num_regs	= 1,
c8d50f029748b7 Dzmitry Sankouski 2025-01-23  94  	.irqs		= max77705_topsys_irqs,
c8d50f029748b7 Dzmitry Sankouski 2025-01-23  95  	.num_irqs	= ARRAY_SIZE(max77705_topsys_irqs),
c8d50f029748b7 Dzmitry Sankouski 2025-01-23  96  };
c8d50f029748b7 Dzmitry Sankouski 2025-01-23  97  

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] mfd: max77705: rework interrupts
  2025-08-30 22:13 [PATCH] mfd: max77705: rework interrupts Dzmitry Sankouski
  2025-08-31  0:02 ` kernel test robot
@ 2025-08-31  8:29 ` Krzysztof Kozlowski
  2025-09-03 12:38   ` Lee Jones
  1 sibling, 1 reply; 4+ messages in thread
From: Krzysztof Kozlowski @ 2025-08-31  8:29 UTC (permalink / raw)
  To: Dzmitry Sankouski, Chanwoo Choi, Lee Jones
  Cc: Krzysztof Kozlowski, linux-kernel

On 31/08/2025 00:13, Dzmitry Sankouski wrote:
> Current implementation describes only MFD's own topsys interrupts.
> However, max77705 has a register which indicates interrupt source, i.e.
> it acts as an interrupt controller. There's 4 interrupt sources in
> max77705: topsys, charger, fuelgauge, usb type-c manager.
> 
> Setup max77705 MFD parent as an interrupt controller. Leave topsys
> interrupts unregistered, because currently unused.

Then you should remove them from the driver.
> 
> Fixes: c8d50f029748 ("mfd: Add new driver for MAX77705 PMIC")
> 

No blank lines between the tags.


> Signed-off-by: Dzmitry Sankouski <dsankouski@gmail.com>
> ---
> Max77705 has a register, which indicates, who is triggering irq. There
> may be 4 irq sources in max77705: charger, fuelgauge, usb type-c
> manager ic, and so-called 'topsys'. Hence, max77705 mfd parent device is
> an interrupt controller. This series implements interrupt controller in
> max77705 mfd.



Best regards,
Krzysztof

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] mfd: max77705: rework interrupts
  2025-08-31  8:29 ` Krzysztof Kozlowski
@ 2025-09-03 12:38   ` Lee Jones
  0 siblings, 0 replies; 4+ messages in thread
From: Lee Jones @ 2025-09-03 12:38 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Dzmitry Sankouski, Chanwoo Choi, Krzysztof Kozlowski,
	linux-kernel

On Sun, 31 Aug 2025, Krzysztof Kozlowski wrote:

> On 31/08/2025 00:13, Dzmitry Sankouski wrote:
> > Current implementation describes only MFD's own topsys interrupts.
> > However, max77705 has a register which indicates interrupt source, i.e.
> > it acts as an interrupt controller. There's 4 interrupt sources in
> > max77705: topsys, charger, fuelgauge, usb type-c manager.
> > 
> > Setup max77705 MFD parent as an interrupt controller. Leave topsys
> > interrupts unregistered, because currently unused.
> 
> Then you should remove them from the driver.

Right.

>> drivers/mfd/max77705.c:89:37: warning: unused variable 'max77705_topsys_irq_chip' [-Wunused-const-variable]

-- 
Lee Jones [李琼斯]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-09-03 12:38 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-30 22:13 [PATCH] mfd: max77705: rework interrupts Dzmitry Sankouski
2025-08-31  0:02 ` kernel test robot
2025-08-31  8:29 ` Krzysztof Kozlowski
2025-09-03 12:38   ` Lee Jones

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).