diff mbox series

mfd: Fix RTS5227 (and others) powermanagement

Message ID 1516087969-24690-2-git-send-email-acelan.kao@canonical.com
State New
Headers show
Series mfd: Fix RTS5227 (and others) powermanagement | expand

Commit Message

AceLan Kao Jan. 16, 2018, 7:32 a.m. UTC
From: Hans de Goede <hdegoede@redhat.com>

BugLink: https://bugs.launchpad.net/bugs/1743516

Commit 8275b77a1513 ("mfd: rts5249: Add support for RTS5250S power
saving") adds powersaving support for device-ids 5249 524a and 525a.

But as a side effect it breaks ASPM support for all the other device-ids,
causing e.g. the Haswell CPU on a Lenovo T440s to not go into a higher
c-state then PC3, while previously it would go to PC7, causing the
machine to idle at 7.4W instead of 6.6W!

The problem here is the new option.dev_aspm_mode field, which only gets
explicitly initialized in the new code for the device-ids 5249 524a and
525a. Leaving the dev_aspm_mode 0 for the other device-ids.

The default dev_aspm_mode 0 is mapped to DEV_ASPM_DISABLE, but the
old behavior of calling rtsx_pci_enable_aspm() when idle and
rtsx_pci_disable_aspm() when busy happens when dev_aspm_mode ==
DEV_ASPM_DYNAMIC.

This commit changes the enum so that 0 = DEV_ASPM_DYNAMIC matching the
old default behavior, fixing the pm regression with the other device-ids.

Fixes: 8275b77a1513 ("mfd: rts5249: Add support for RTS5250S power saving")
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Rui Feng <rui_feng@realsil.com.cn>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
(backported from commit b860b419d970f286294fbfb2b21a4028fd8ee442)
Signed-off-by: AceLan Kao <acelan.kao@canonical.com>
---
 include/linux/rtsx_pci.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Anthony Wong Jan. 16, 2018, 9:33 a.m. UTC | #1
On Tue, Jan 16, 2018 at 03:32:49PM +0800, AceLan Kao wrote:
> From: Hans de Goede <hdegoede@redhat.com>
> 
> BugLink: https://bugs.launchpad.net/bugs/1743516
> 
> Commit 8275b77a1513 ("mfd: rts5249: Add support for RTS5250S power
> saving") adds powersaving support for device-ids 5249 524a and 525a.
> 
> But as a side effect it breaks ASPM support for all the other device-ids,
> causing e.g. the Haswell CPU on a Lenovo T440s to not go into a higher
> c-state then PC3, while previously it would go to PC7, causing the
> machine to idle at 7.4W instead of 6.6W!
> 
> The problem here is the new option.dev_aspm_mode field, which only gets
> explicitly initialized in the new code for the device-ids 5249 524a and
> 525a. Leaving the dev_aspm_mode 0 for the other device-ids.
> 
> The default dev_aspm_mode 0 is mapped to DEV_ASPM_DISABLE, but the
> old behavior of calling rtsx_pci_enable_aspm() when idle and
> rtsx_pci_disable_aspm() when busy happens when dev_aspm_mode ==
> DEV_ASPM_DYNAMIC.
> 
> This commit changes the enum so that 0 = DEV_ASPM_DYNAMIC matching the
> old default behavior, fixing the pm regression with the other device-ids.
> 
> Fixes: 8275b77a1513 ("mfd: rts5249: Add support for RTS5250S power saving")
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
> Acked-by: Rui Feng <rui_feng@realsil.com.cn>
> Signed-off-by: Lee Jones <lee.jones@linaro.org>
> (backported from commit b860b419d970f286294fbfb2b21a4028fd8ee442)
> Signed-off-by: AceLan Kao <acelan.kao@canonical.com>
> ---
>  include/linux/rtsx_pci.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/include/linux/rtsx_pci.h b/include/linux/rtsx_pci.h
> index a44670e..478acf6 100644
> --- a/include/linux/rtsx_pci.h
> +++ b/include/linux/rtsx_pci.h
> @@ -1121,10 +1121,10 @@ enum PDEV_STAT  {PDEV_STAT_IDLE, PDEV_STAT_RUN};
>  #define LTR_L1SS_PWR_GATE_CHECK_CARD_EN	BIT(6)
>  
>  enum dev_aspm_mode {
> -	DEV_ASPM_DISABLE = 0,
>  	DEV_ASPM_DYNAMIC,
>  	DEV_ASPM_BACKDOOR,
>  	DEV_ASPM_STATIC,
> +	DEV_ASPM_DISABLE,
>  };
>  
>  /*

The backport looks good.
Acked-by: Anthony Wong <anthony.wong@canonical.com>
Kleber Sacilotto de Souza Jan. 17, 2018, 1:49 p.m. UTC | #2
Applied to linux-oem/oem branch. Thanks!
diff mbox series

Patch

diff --git a/include/linux/rtsx_pci.h b/include/linux/rtsx_pci.h
index a44670e..478acf6 100644
--- a/include/linux/rtsx_pci.h
+++ b/include/linux/rtsx_pci.h
@@ -1121,10 +1121,10 @@  enum PDEV_STAT  {PDEV_STAT_IDLE, PDEV_STAT_RUN};
 #define LTR_L1SS_PWR_GATE_CHECK_CARD_EN	BIT(6)
 
 enum dev_aspm_mode {
-	DEV_ASPM_DISABLE = 0,
 	DEV_ASPM_DYNAMIC,
 	DEV_ASPM_BACKDOOR,
 	DEV_ASPM_STATIC,
+	DEV_ASPM_DISABLE,
 };
 
 /*