linux-samsung-soc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] power: supply: max17040: Correct IRQ wake handling
       [not found] <CGME20200110100620eucas1p12fff62b485570e93b283e23c7a9e5b57@eucas1p1.samsung.com>
@ 2020-01-10 10:05 ` Marek Szyprowski
  2020-01-13  8:34   ` Krzysztof Kozlowski
  2020-01-14  0:28   ` Sebastian Reichel
  0 siblings, 2 replies; 3+ messages in thread
From: Marek Szyprowski @ 2020-01-10 10:05 UTC (permalink / raw)
  To: linux-pm, linux-samsung-soc
  Cc: linux-kernel, Sebastian Reichel, Matheus Castello,
	Bartlomiej Zolnierkiewicz, Krzysztof Kozlowski, Marek Szyprowski

Don't disable IRQ wake feature without prior enabling it.

This fixes following warning observed on Exynos3250-based Rinato board:
------------[ cut here ]------------
WARNING: CPU: 0 PID: 1288 at kernel/irq/manage.c:724 irq_set_irq_wake+0xfc/0x134
Unbalanced IRQ 83 wake disable
Modules linked in:
CPU: 0 PID: 1288 Comm: rtcwake Not tainted 5.5.0-rc5-next-20200110-00031-g6289fffbb3f5 #7266
Hardware name: Samsung Exynos (Flattened Device Tree)
[<c0112e48>] (unwind_backtrace) from [<c010e090>] (show_stack+0x10/0x14)
[<c010e090>] (show_stack) from [<c0b25b28>] (dump_stack+0xa4/0xd0)
[<c0b25b28>] (dump_stack) from [<c0128088>] (__warn+0xf4/0x10c)
[<c0128088>] (__warn) from [<c0128114>] (warn_slowpath_fmt+0x74/0xb8)
[<c0128114>] (warn_slowpath_fmt) from [<c019e9a0>] (irq_set_irq_wake+0xfc/0x134)
[<c019e9a0>] (irq_set_irq_wake) from [<c0772708>] (max17040_suspend+0x50/0x58)
[<c0772708>] (max17040_suspend) from [<c05f55ac>] (dpm_run_callback+0xb4/0x400)
[<c05f55ac>] (dpm_run_callback) from [<c05f5e38>] (__device_suspend+0x140/0x814)
[<c05f5e38>] (__device_suspend) from [<c05f9548>] (dpm_suspend+0x16c/0x564)
[<c05f9548>] (dpm_suspend) from [<c05fa2e4>] (dpm_suspend_start+0x90/0x98)
[<c05fa2e4>] (dpm_suspend_start) from [<c01977f4>] (suspend_devices_and_enter+0xec/0xc0c)
[<c01977f4>] (suspend_devices_and_enter) from [<c019862c>] (pm_suspend+0x318/0x3e8)
[<c019862c>] (pm_suspend) from [<c01963cc>] (state_store+0x68/0xc8)
[<c01963cc>] (state_store) from [<c03531a4>] (kernfs_fop_write+0x10c/0x220)
[<c03531a4>] (kernfs_fop_write) from [<c02b44c4>] (__vfs_write+0x2c/0x1c4)
[<c02b44c4>] (__vfs_write) from [<c02b7288>] (vfs_write+0xa4/0x180)
[<c02b7288>] (vfs_write) from [<c02b74d0>] (ksys_write+0x58/0xcc)
[<c02b74d0>] (ksys_write) from [<c0101000>] (ret_fast_syscall+0x0/0x28)
Exception stack(0xd6e83fa8 to 0xd6e83ff0)
...
irq event stamp: 18028
hardirqs last  enabled at (18027): [<c014b99c>] cancel_delayed_work+0x84/0xf8
hardirqs last disabled at (18028): [<c0b49b1c>] _raw_spin_lock_irqsave+0x1c/0x58
softirqs last  enabled at (17876): [<c01026d8>] __do_softirq+0x4f0/0x5e4
softirqs last disabled at (17869): [<c0130d34>] irq_exit+0x16c/0x170
---[ end trace 0728005730004e60 ]---

Fixes: 2e17ed94de68 ("power: supply: max17040: Add IRQ handler for low SOC alert")
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
---
 drivers/power/supply/max17040_battery.c | 16 ++++------------
 1 file changed, 4 insertions(+), 12 deletions(-)

diff --git a/drivers/power/supply/max17040_battery.c b/drivers/power/supply/max17040_battery.c
index c1188e94cf54..8a1f0ee493aa 100644
--- a/drivers/power/supply/max17040_battery.c
+++ b/drivers/power/supply/max17040_battery.c
@@ -351,12 +351,8 @@ static int max17040_suspend(struct device *dev)
 
 	cancel_delayed_work(&chip->work);
 
-	if (client->irq) {
-		if (device_may_wakeup(dev))
-			enable_irq_wake(client->irq);
-		else
-			disable_irq_wake(client->irq);
-	}
+	if (client->irq && device_may_wakeup(dev))
+		enable_irq_wake(client->irq);
 
 	return 0;
 }
@@ -369,12 +365,8 @@ static int max17040_resume(struct device *dev)
 	queue_delayed_work(system_power_efficient_wq, &chip->work,
 			   MAX17040_DELAY);
 
-	if (client->irq) {
-		if (device_may_wakeup(dev))
-			disable_irq_wake(client->irq);
-		else
-			enable_irq_wake(client->irq);
-	}
+	if (client->irq && device_may_wakeup(dev))
+		disable_irq_wake(client->irq);
 
 	return 0;
 }
-- 
2.17.1


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

* Re: [PATCH] power: supply: max17040: Correct IRQ wake handling
  2020-01-10 10:05 ` [PATCH] power: supply: max17040: Correct IRQ wake handling Marek Szyprowski
@ 2020-01-13  8:34   ` Krzysztof Kozlowski
  2020-01-14  0:28   ` Sebastian Reichel
  1 sibling, 0 replies; 3+ messages in thread
From: Krzysztof Kozlowski @ 2020-01-13  8:34 UTC (permalink / raw)
  To: Marek Szyprowski
  Cc: linux-pm, linux-samsung-soc, linux-kernel, Sebastian Reichel,
	Matheus Castello, Bartlomiej Zolnierkiewicz

On Fri, Jan 10, 2020 at 11:05:40AM +0100, Marek Szyprowski wrote:
> Don't disable IRQ wake feature without prior enabling it.
> 
> This fixes following warning observed on Exynos3250-based Rinato board:
> ------------[ cut here ]------------
> WARNING: CPU: 0 PID: 1288 at kernel/irq/manage.c:724 irq_set_irq_wake+0xfc/0x134
> Unbalanced IRQ 83 wake disable
> Modules linked in:
> CPU: 0 PID: 1288 Comm: rtcwake Not tainted 5.5.0-rc5-next-20200110-00031-g6289fffbb3f5 #7266
> Hardware name: Samsung Exynos (Flattened Device Tree)
> [<c0112e48>] (unwind_backtrace) from [<c010e090>] (show_stack+0x10/0x14)
> [<c010e090>] (show_stack) from [<c0b25b28>] (dump_stack+0xa4/0xd0)
> [<c0b25b28>] (dump_stack) from [<c0128088>] (__warn+0xf4/0x10c)
> [<c0128088>] (__warn) from [<c0128114>] (warn_slowpath_fmt+0x74/0xb8)
> [<c0128114>] (warn_slowpath_fmt) from [<c019e9a0>] (irq_set_irq_wake+0xfc/0x134)
> [<c019e9a0>] (irq_set_irq_wake) from [<c0772708>] (max17040_suspend+0x50/0x58)
> [<c0772708>] (max17040_suspend) from [<c05f55ac>] (dpm_run_callback+0xb4/0x400)
> [<c05f55ac>] (dpm_run_callback) from [<c05f5e38>] (__device_suspend+0x140/0x814)
> [<c05f5e38>] (__device_suspend) from [<c05f9548>] (dpm_suspend+0x16c/0x564)
> [<c05f9548>] (dpm_suspend) from [<c05fa2e4>] (dpm_suspend_start+0x90/0x98)
> [<c05fa2e4>] (dpm_suspend_start) from [<c01977f4>] (suspend_devices_and_enter+0xec/0xc0c)
> [<c01977f4>] (suspend_devices_and_enter) from [<c019862c>] (pm_suspend+0x318/0x3e8)
> [<c019862c>] (pm_suspend) from [<c01963cc>] (state_store+0x68/0xc8)
> [<c01963cc>] (state_store) from [<c03531a4>] (kernfs_fop_write+0x10c/0x220)
> [<c03531a4>] (kernfs_fop_write) from [<c02b44c4>] (__vfs_write+0x2c/0x1c4)
> [<c02b44c4>] (__vfs_write) from [<c02b7288>] (vfs_write+0xa4/0x180)
> [<c02b7288>] (vfs_write) from [<c02b74d0>] (ksys_write+0x58/0xcc)
> [<c02b74d0>] (ksys_write) from [<c0101000>] (ret_fast_syscall+0x0/0x28)
> Exception stack(0xd6e83fa8 to 0xd6e83ff0)
> ...
> irq event stamp: 18028
> hardirqs last  enabled at (18027): [<c014b99c>] cancel_delayed_work+0x84/0xf8
> hardirqs last disabled at (18028): [<c0b49b1c>] _raw_spin_lock_irqsave+0x1c/0x58
> softirqs last  enabled at (17876): [<c01026d8>] __do_softirq+0x4f0/0x5e4
> softirqs last disabled at (17869): [<c0130d34>] irq_exit+0x16c/0x170
> ---[ end trace 0728005730004e60 ]---
> 
> Fixes: 2e17ed94de68 ("power: supply: max17040: Add IRQ handler for low SOC alert")
> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
> ---
>  drivers/power/supply/max17040_battery.c | 16 ++++------------
>  1 file changed, 4 insertions(+), 12 deletions(-)

Reviewed-by: Krzysztof Kozlowski <krzk@kernel.org>

Best regards,
Krzysztof


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

* Re: [PATCH] power: supply: max17040: Correct IRQ wake handling
  2020-01-10 10:05 ` [PATCH] power: supply: max17040: Correct IRQ wake handling Marek Szyprowski
  2020-01-13  8:34   ` Krzysztof Kozlowski
@ 2020-01-14  0:28   ` Sebastian Reichel
  1 sibling, 0 replies; 3+ messages in thread
From: Sebastian Reichel @ 2020-01-14  0:28 UTC (permalink / raw)
  To: Marek Szyprowski
  Cc: linux-pm, linux-samsung-soc, linux-kernel, Matheus Castello,
	Bartlomiej Zolnierkiewicz, Krzysztof Kozlowski

[-- Attachment #1: Type: text/plain, Size: 3801 bytes --]

Hi,

On Fri, Jan 10, 2020 at 11:05:40AM +0100, Marek Szyprowski wrote:
> Don't disable IRQ wake feature without prior enabling it.

Thanks, queued to power-supply's for-next branch.

-- Sebastian

> 
> This fixes following warning observed on Exynos3250-based Rinato board:
> ------------[ cut here ]------------
> WARNING: CPU: 0 PID: 1288 at kernel/irq/manage.c:724 irq_set_irq_wake+0xfc/0x134
> Unbalanced IRQ 83 wake disable
> Modules linked in:
> CPU: 0 PID: 1288 Comm: rtcwake Not tainted 5.5.0-rc5-next-20200110-00031-g6289fffbb3f5 #7266
> Hardware name: Samsung Exynos (Flattened Device Tree)
> [<c0112e48>] (unwind_backtrace) from [<c010e090>] (show_stack+0x10/0x14)
> [<c010e090>] (show_stack) from [<c0b25b28>] (dump_stack+0xa4/0xd0)
> [<c0b25b28>] (dump_stack) from [<c0128088>] (__warn+0xf4/0x10c)
> [<c0128088>] (__warn) from [<c0128114>] (warn_slowpath_fmt+0x74/0xb8)
> [<c0128114>] (warn_slowpath_fmt) from [<c019e9a0>] (irq_set_irq_wake+0xfc/0x134)
> [<c019e9a0>] (irq_set_irq_wake) from [<c0772708>] (max17040_suspend+0x50/0x58)
> [<c0772708>] (max17040_suspend) from [<c05f55ac>] (dpm_run_callback+0xb4/0x400)
> [<c05f55ac>] (dpm_run_callback) from [<c05f5e38>] (__device_suspend+0x140/0x814)
> [<c05f5e38>] (__device_suspend) from [<c05f9548>] (dpm_suspend+0x16c/0x564)
> [<c05f9548>] (dpm_suspend) from [<c05fa2e4>] (dpm_suspend_start+0x90/0x98)
> [<c05fa2e4>] (dpm_suspend_start) from [<c01977f4>] (suspend_devices_and_enter+0xec/0xc0c)
> [<c01977f4>] (suspend_devices_and_enter) from [<c019862c>] (pm_suspend+0x318/0x3e8)
> [<c019862c>] (pm_suspend) from [<c01963cc>] (state_store+0x68/0xc8)
> [<c01963cc>] (state_store) from [<c03531a4>] (kernfs_fop_write+0x10c/0x220)
> [<c03531a4>] (kernfs_fop_write) from [<c02b44c4>] (__vfs_write+0x2c/0x1c4)
> [<c02b44c4>] (__vfs_write) from [<c02b7288>] (vfs_write+0xa4/0x180)
> [<c02b7288>] (vfs_write) from [<c02b74d0>] (ksys_write+0x58/0xcc)
> [<c02b74d0>] (ksys_write) from [<c0101000>] (ret_fast_syscall+0x0/0x28)
> Exception stack(0xd6e83fa8 to 0xd6e83ff0)
> ...
> irq event stamp: 18028
> hardirqs last  enabled at (18027): [<c014b99c>] cancel_delayed_work+0x84/0xf8
> hardirqs last disabled at (18028): [<c0b49b1c>] _raw_spin_lock_irqsave+0x1c/0x58
> softirqs last  enabled at (17876): [<c01026d8>] __do_softirq+0x4f0/0x5e4
> softirqs last disabled at (17869): [<c0130d34>] irq_exit+0x16c/0x170
> ---[ end trace 0728005730004e60 ]---
> 
> Fixes: 2e17ed94de68 ("power: supply: max17040: Add IRQ handler for low SOC alert")
> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
> ---
>  drivers/power/supply/max17040_battery.c | 16 ++++------------
>  1 file changed, 4 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/power/supply/max17040_battery.c b/drivers/power/supply/max17040_battery.c
> index c1188e94cf54..8a1f0ee493aa 100644
> --- a/drivers/power/supply/max17040_battery.c
> +++ b/drivers/power/supply/max17040_battery.c
> @@ -351,12 +351,8 @@ static int max17040_suspend(struct device *dev)
>  
>  	cancel_delayed_work(&chip->work);
>  
> -	if (client->irq) {
> -		if (device_may_wakeup(dev))
> -			enable_irq_wake(client->irq);
> -		else
> -			disable_irq_wake(client->irq);
> -	}
> +	if (client->irq && device_may_wakeup(dev))
> +		enable_irq_wake(client->irq);
>  
>  	return 0;
>  }
> @@ -369,12 +365,8 @@ static int max17040_resume(struct device *dev)
>  	queue_delayed_work(system_power_efficient_wq, &chip->work,
>  			   MAX17040_DELAY);
>  
> -	if (client->irq) {
> -		if (device_may_wakeup(dev))
> -			disable_irq_wake(client->irq);
> -		else
> -			enable_irq_wake(client->irq);
> -	}
> +	if (client->irq && device_may_wakeup(dev))
> +		disable_irq_wake(client->irq);
>  
>  	return 0;
>  }
> -- 
> 2.17.1
> 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

end of thread, other threads:[~2020-01-14  0:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CGME20200110100620eucas1p12fff62b485570e93b283e23c7a9e5b57@eucas1p1.samsung.com>
2020-01-10 10:05 ` [PATCH] power: supply: max17040: Correct IRQ wake handling Marek Szyprowski
2020-01-13  8:34   ` Krzysztof Kozlowski
2020-01-14  0:28   ` Sebastian Reichel

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).