diff options
author | Wei WANG <wei_wang@realsil.com.cn> | 2013-08-20 02:18:55 -0400 |
---|---|---|
committer | Samuel Ortiz <sameo@linux.intel.com> | 2013-08-20 04:22:01 -0400 |
commit | eb891c65c9c87e55f728d95bcc514dea337aed12 (patch) | |
tree | 691325f4eb2d39ab93db3490e6d15d37840ab405 | |
parent | 0ccc0065c90284f283314e52a96e76ae8a8dce0a (diff) |
mfd: rtsx: Configure to enter a deeper power-saving mode in S3
Set a bit to enable rts5227 and rts5249 to enter a deeper internal
power-saving mode in S3, and recover it after resuming.
Signed-off-by: Wei WANG <wei_wang@realsil.com.cn>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
-rw-r--r-- | drivers/mfd/rtl8411.c | 2 | ||||
-rw-r--r-- | drivers/mfd/rts5209.c | 2 | ||||
-rw-r--r-- | drivers/mfd/rts5227.c | 6 | ||||
-rw-r--r-- | drivers/mfd/rts5229.c | 2 | ||||
-rw-r--r-- | drivers/mfd/rts5249.c | 6 | ||||
-rw-r--r-- | drivers/mfd/rtsx_pcr.c | 2 | ||||
-rw-r--r-- | include/linux/mfd/rtsx_pci.h | 2 |
7 files changed, 15 insertions, 7 deletions
diff --git a/drivers/mfd/rtl8411.c b/drivers/mfd/rtl8411.c index d183fa002338..37367fb1c11b 100644 --- a/drivers/mfd/rtl8411.c +++ b/drivers/mfd/rtl8411.c | |||
@@ -86,7 +86,7 @@ static void rtl8411b_fetch_vendor_settings(struct rtsx_pcr *pcr) | |||
86 | map_sd_drive(rtl8411b_reg_to_sd30_drive_sel_3v3(reg)); | 86 | map_sd_drive(rtl8411b_reg_to_sd30_drive_sel_3v3(reg)); |
87 | } | 87 | } |
88 | 88 | ||
89 | static void rtl8411_force_power_down(struct rtsx_pcr *pcr) | 89 | static void rtl8411_force_power_down(struct rtsx_pcr *pcr, u8 pm_state) |
90 | { | 90 | { |
91 | rtsx_pci_write_register(pcr, FPDCTL, 0x07, 0x07); | 91 | rtsx_pci_write_register(pcr, FPDCTL, 0x07, 0x07); |
92 | } | 92 | } |
diff --git a/drivers/mfd/rts5209.c b/drivers/mfd/rts5209.c index 03a15f779ebb..ef6a59fe37a4 100644 --- a/drivers/mfd/rts5209.c +++ b/drivers/mfd/rts5209.c | |||
@@ -59,7 +59,7 @@ static void rts5209_fetch_vendor_settings(struct rtsx_pcr *pcr) | |||
59 | } | 59 | } |
60 | } | 60 | } |
61 | 61 | ||
62 | static void rts5209_force_power_down(struct rtsx_pcr *pcr) | 62 | static void rts5209_force_power_down(struct rtsx_pcr *pcr, u8 pm_state) |
63 | { | 63 | { |
64 | rtsx_pci_write_register(pcr, FPDCTL, 0x07, 0x07); | 64 | rtsx_pci_write_register(pcr, FPDCTL, 0x07, 0x07); |
65 | } | 65 | } |
diff --git a/drivers/mfd/rts5227.c b/drivers/mfd/rts5227.c index 724ce4c54523..c72abd6b9c81 100644 --- a/drivers/mfd/rts5227.c +++ b/drivers/mfd/rts5227.c | |||
@@ -83,13 +83,16 @@ static void rts5227_fetch_vendor_settings(struct rtsx_pcr *pcr) | |||
83 | pcr->flags |= PCR_REVERSE_SOCKET; | 83 | pcr->flags |= PCR_REVERSE_SOCKET; |
84 | } | 84 | } |
85 | 85 | ||
86 | static void rts5227_force_power_down(struct rtsx_pcr *pcr) | 86 | static void rts5227_force_power_down(struct rtsx_pcr *pcr, u8 pm_state) |
87 | { | 87 | { |
88 | /* Set relink_time to 0 */ | 88 | /* Set relink_time to 0 */ |
89 | rtsx_pci_write_register(pcr, AUTOLOAD_CFG_BASE + 1, 0xFF, 0); | 89 | rtsx_pci_write_register(pcr, AUTOLOAD_CFG_BASE + 1, 0xFF, 0); |
90 | rtsx_pci_write_register(pcr, AUTOLOAD_CFG_BASE + 2, 0xFF, 0); | 90 | rtsx_pci_write_register(pcr, AUTOLOAD_CFG_BASE + 2, 0xFF, 0); |
91 | rtsx_pci_write_register(pcr, AUTOLOAD_CFG_BASE + 3, 0x01, 0); | 91 | rtsx_pci_write_register(pcr, AUTOLOAD_CFG_BASE + 3, 0x01, 0); |
92 | 92 | ||
93 | if (pm_state == HOST_ENTER_S3) | ||
94 | rtsx_pci_write_register(pcr, PM_CTRL3, 0x10, 0x10); | ||
95 | |||
93 | rtsx_pci_write_register(pcr, FPDCTL, 0x03, 0x03); | 96 | rtsx_pci_write_register(pcr, FPDCTL, 0x03, 0x03); |
94 | } | 97 | } |
95 | 98 | ||
@@ -123,6 +126,7 @@ static int rts5227_extra_init_hw(struct rtsx_pcr *pcr) | |||
123 | else | 126 | else |
124 | rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, | 127 | rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, |
125 | AUTOLOAD_CFG_BASE + 3, 0xB8, 0x88); | 128 | AUTOLOAD_CFG_BASE + 3, 0xB8, 0x88); |
129 | rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, PM_CTRL3, 0x10, 0x00); | ||
126 | 130 | ||
127 | return rtsx_pci_send_cmd(pcr, 100); | 131 | return rtsx_pci_send_cmd(pcr, 100); |
128 | } | 132 | } |
diff --git a/drivers/mfd/rts5229.c b/drivers/mfd/rts5229.c index e8261d7436a8..afb0f24bac71 100644 --- a/drivers/mfd/rts5229.c +++ b/drivers/mfd/rts5229.c | |||
@@ -56,7 +56,7 @@ static void rts5229_fetch_vendor_settings(struct rtsx_pcr *pcr) | |||
56 | map_sd_drive(rtsx_reg_to_sd30_drive_sel_3v3(reg)); | 56 | map_sd_drive(rtsx_reg_to_sd30_drive_sel_3v3(reg)); |
57 | } | 57 | } |
58 | 58 | ||
59 | static void rts5229_force_power_down(struct rtsx_pcr *pcr) | 59 | static void rts5229_force_power_down(struct rtsx_pcr *pcr, u8 pm_state) |
60 | { | 60 | { |
61 | rtsx_pci_write_register(pcr, FPDCTL, 0x03, 0x03); | 61 | rtsx_pci_write_register(pcr, FPDCTL, 0x03, 0x03); |
62 | } | 62 | } |
diff --git a/drivers/mfd/rts5249.c b/drivers/mfd/rts5249.c index c5e54d7cf528..384b30b432bd 100644 --- a/drivers/mfd/rts5249.c +++ b/drivers/mfd/rts5249.c | |||
@@ -88,13 +88,16 @@ static void rts5249_fetch_vendor_settings(struct rtsx_pcr *pcr) | |||
88 | pcr->flags |= PCR_REVERSE_SOCKET; | 88 | pcr->flags |= PCR_REVERSE_SOCKET; |
89 | } | 89 | } |
90 | 90 | ||
91 | static void rts5249_force_power_down(struct rtsx_pcr *pcr) | 91 | static void rts5249_force_power_down(struct rtsx_pcr *pcr, u8 pm_state) |
92 | { | 92 | { |
93 | /* Set relink_time to 0 */ | 93 | /* Set relink_time to 0 */ |
94 | rtsx_pci_write_register(pcr, AUTOLOAD_CFG_BASE + 1, 0xFF, 0); | 94 | rtsx_pci_write_register(pcr, AUTOLOAD_CFG_BASE + 1, 0xFF, 0); |
95 | rtsx_pci_write_register(pcr, AUTOLOAD_CFG_BASE + 2, 0xFF, 0); | 95 | rtsx_pci_write_register(pcr, AUTOLOAD_CFG_BASE + 2, 0xFF, 0); |
96 | rtsx_pci_write_register(pcr, AUTOLOAD_CFG_BASE + 3, 0x01, 0); | 96 | rtsx_pci_write_register(pcr, AUTOLOAD_CFG_BASE + 3, 0x01, 0); |
97 | 97 | ||
98 | if (pm_state == HOST_ENTER_S3) | ||
99 | rtsx_pci_write_register(pcr, PM_CTRL3, 0x10, 0x10); | ||
100 | |||
98 | rtsx_pci_write_register(pcr, FPDCTL, 0x03, 0x03); | 101 | rtsx_pci_write_register(pcr, FPDCTL, 0x03, 0x03); |
99 | } | 102 | } |
100 | 103 | ||
@@ -119,6 +122,7 @@ static int rts5249_extra_init_hw(struct rtsx_pcr *pcr) | |||
119 | else | 122 | else |
120 | rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, | 123 | rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, |
121 | AUTOLOAD_CFG_BASE + 3, 0xB0, 0x80); | 124 | AUTOLOAD_CFG_BASE + 3, 0xB0, 0x80); |
125 | rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, PM_CTRL3, 0x10, 0x00); | ||
122 | 126 | ||
123 | return rtsx_pci_send_cmd(pcr, 100); | 127 | return rtsx_pci_send_cmd(pcr, 100); |
124 | } | 128 | } |
diff --git a/drivers/mfd/rtsx_pcr.c b/drivers/mfd/rtsx_pcr.c index ffd393c06d34..29932a019fdf 100644 --- a/drivers/mfd/rtsx_pcr.c +++ b/drivers/mfd/rtsx_pcr.c | |||
@@ -939,7 +939,7 @@ static void rtsx_pci_power_off(struct rtsx_pcr *pcr, u8 pm_state) | |||
939 | rtsx_pci_write_register(pcr, HOST_SLEEP_STATE, 0x03, pm_state); | 939 | rtsx_pci_write_register(pcr, HOST_SLEEP_STATE, 0x03, pm_state); |
940 | 940 | ||
941 | if (pcr->ops->force_power_down) | 941 | if (pcr->ops->force_power_down) |
942 | pcr->ops->force_power_down(pcr); | 942 | pcr->ops->force_power_down(pcr, pm_state); |
943 | } | 943 | } |
944 | 944 | ||
945 | static int rtsx_pci_init_hw(struct rtsx_pcr *pcr) | 945 | static int rtsx_pci_init_hw(struct rtsx_pcr *pcr) |
diff --git a/include/linux/mfd/rtsx_pci.h b/include/linux/mfd/rtsx_pci.h index 9a16276bc080..dd0bd5806adc 100644 --- a/include/linux/mfd/rtsx_pci.h +++ b/include/linux/mfd/rtsx_pci.h | |||
@@ -779,7 +779,7 @@ struct pcr_ops { | |||
779 | unsigned int (*cd_deglitch)(struct rtsx_pcr *pcr); | 779 | unsigned int (*cd_deglitch)(struct rtsx_pcr *pcr); |
780 | int (*conv_clk_and_div_n)(int clk, int dir); | 780 | int (*conv_clk_and_div_n)(int clk, int dir); |
781 | void (*fetch_vendor_settings)(struct rtsx_pcr *pcr); | 781 | void (*fetch_vendor_settings)(struct rtsx_pcr *pcr); |
782 | void (*force_power_down)(struct rtsx_pcr *pcr); | 782 | void (*force_power_down)(struct rtsx_pcr *pcr, u8 pm_state); |
783 | }; | 783 | }; |
784 | 784 | ||
785 | enum PDEV_STAT {PDEV_STAT_IDLE, PDEV_STAT_RUN}; | 785 | enum PDEV_STAT {PDEV_STAT_IDLE, PDEV_STAT_RUN}; |