diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/mfd/rtl8411.c | 7 | ||||
-rw-r--r-- | drivers/mfd/rts5209.c | 6 | ||||
-rw-r--r-- | drivers/mfd/rts5227.c | 11 | ||||
-rw-r--r-- | drivers/mfd/rts5229.c | 6 | ||||
-rw-r--r-- | drivers/mfd/rts5249.c | 11 | ||||
-rw-r--r-- | drivers/mfd/rtsx_pcr.c | 43 |
6 files changed, 74 insertions, 10 deletions
diff --git a/drivers/mfd/rtl8411.c b/drivers/mfd/rtl8411.c index 5a68c9bdeddf..56cc248392b5 100644 --- a/drivers/mfd/rtl8411.c +++ b/drivers/mfd/rtl8411.c | |||
@@ -86,6 +86,11 @@ 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) | ||
90 | { | ||
91 | rtsx_pci_write_register(pcr, FPDCTL, 0x07, 0x07); | ||
92 | } | ||
93 | |||
89 | static int rtl8411_extra_init_hw(struct rtsx_pcr *pcr) | 94 | static int rtl8411_extra_init_hw(struct rtsx_pcr *pcr) |
90 | { | 95 | { |
91 | rtsx_pci_init_cmd(pcr); | 96 | rtsx_pci_init_cmd(pcr); |
@@ -285,6 +290,7 @@ static const struct pcr_ops rtl8411_pcr_ops = { | |||
285 | .switch_output_voltage = rtl8411_switch_output_voltage, | 290 | .switch_output_voltage = rtl8411_switch_output_voltage, |
286 | .cd_deglitch = rtl8411_cd_deglitch, | 291 | .cd_deglitch = rtl8411_cd_deglitch, |
287 | .conv_clk_and_div_n = rtl8411_conv_clk_and_div_n, | 292 | .conv_clk_and_div_n = rtl8411_conv_clk_and_div_n, |
293 | .force_power_down = rtl8411_force_power_down, | ||
288 | }; | 294 | }; |
289 | 295 | ||
290 | static const struct pcr_ops rtl8411b_pcr_ops = { | 296 | static const struct pcr_ops rtl8411b_pcr_ops = { |
@@ -300,6 +306,7 @@ static const struct pcr_ops rtl8411b_pcr_ops = { | |||
300 | .switch_output_voltage = rtl8411_switch_output_voltage, | 306 | .switch_output_voltage = rtl8411_switch_output_voltage, |
301 | .cd_deglitch = rtl8411_cd_deglitch, | 307 | .cd_deglitch = rtl8411_cd_deglitch, |
302 | .conv_clk_and_div_n = rtl8411_conv_clk_and_div_n, | 308 | .conv_clk_and_div_n = rtl8411_conv_clk_and_div_n, |
309 | .force_power_down = rtl8411_force_power_down, | ||
303 | }; | 310 | }; |
304 | 311 | ||
305 | /* SD Pull Control Enable: | 312 | /* SD Pull Control Enable: |
diff --git a/drivers/mfd/rts5209.c b/drivers/mfd/rts5209.c index 2170449bd7e5..c67935efd4f5 100644 --- a/drivers/mfd/rts5209.c +++ b/drivers/mfd/rts5209.c | |||
@@ -59,6 +59,11 @@ 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) | ||
63 | { | ||
64 | rtsx_pci_write_register(pcr, FPDCTL, 0x07, 0x07); | ||
65 | } | ||
66 | |||
62 | static int rts5209_extra_init_hw(struct rtsx_pcr *pcr) | 67 | static int rts5209_extra_init_hw(struct rtsx_pcr *pcr) |
63 | { | 68 | { |
64 | rtsx_pci_init_cmd(pcr); | 69 | rtsx_pci_init_cmd(pcr); |
@@ -197,6 +202,7 @@ static const struct pcr_ops rts5209_pcr_ops = { | |||
197 | .switch_output_voltage = rts5209_switch_output_voltage, | 202 | .switch_output_voltage = rts5209_switch_output_voltage, |
198 | .cd_deglitch = NULL, | 203 | .cd_deglitch = NULL, |
199 | .conv_clk_and_div_n = NULL, | 204 | .conv_clk_and_div_n = NULL, |
205 | .force_power_down = rts5209_force_power_down, | ||
200 | }; | 206 | }; |
201 | 207 | ||
202 | /* SD Pull Control Enable: | 208 | /* SD Pull Control Enable: |
diff --git a/drivers/mfd/rts5227.c b/drivers/mfd/rts5227.c index c3181d71fedd..42ebf5c050c1 100644 --- a/drivers/mfd/rts5227.c +++ b/drivers/mfd/rts5227.c | |||
@@ -83,6 +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) | ||
87 | { | ||
88 | /* Set relink_time to 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); | ||
91 | rtsx_pci_write_register(pcr, AUTOLOAD_CFG_BASE + 3, 0x01, 0); | ||
92 | |||
93 | rtsx_pci_write_register(pcr, FPDCTL, 0x03, 0x03); | ||
94 | } | ||
95 | |||
86 | static int rts5227_extra_init_hw(struct rtsx_pcr *pcr) | 96 | static int rts5227_extra_init_hw(struct rtsx_pcr *pcr) |
87 | { | 97 | { |
88 | u16 cap; | 98 | u16 cap; |
@@ -218,6 +228,7 @@ static const struct pcr_ops rts5227_pcr_ops = { | |||
218 | .switch_output_voltage = rts5227_switch_output_voltage, | 228 | .switch_output_voltage = rts5227_switch_output_voltage, |
219 | .cd_deglitch = NULL, | 229 | .cd_deglitch = NULL, |
220 | .conv_clk_and_div_n = NULL, | 230 | .conv_clk_and_div_n = NULL, |
231 | .force_power_down = rts5227_force_power_down, | ||
221 | }; | 232 | }; |
222 | 233 | ||
223 | /* SD Pull Control Enable: | 234 | /* SD Pull Control Enable: |
diff --git a/drivers/mfd/rts5229.c b/drivers/mfd/rts5229.c index 7a1ad6dd2917..a0b695af8561 100644 --- a/drivers/mfd/rts5229.c +++ b/drivers/mfd/rts5229.c | |||
@@ -56,6 +56,11 @@ 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) | ||
60 | { | ||
61 | rtsx_pci_write_register(pcr, FPDCTL, 0x03, 0x03); | ||
62 | } | ||
63 | |||
59 | static int rts5229_extra_init_hw(struct rtsx_pcr *pcr) | 64 | static int rts5229_extra_init_hw(struct rtsx_pcr *pcr) |
60 | { | 65 | { |
61 | rtsx_pci_init_cmd(pcr); | 66 | rtsx_pci_init_cmd(pcr); |
@@ -179,6 +184,7 @@ static const struct pcr_ops rts5229_pcr_ops = { | |||
179 | .switch_output_voltage = rts5229_switch_output_voltage, | 184 | .switch_output_voltage = rts5229_switch_output_voltage, |
180 | .cd_deglitch = NULL, | 185 | .cd_deglitch = NULL, |
181 | .conv_clk_and_div_n = NULL, | 186 | .conv_clk_and_div_n = NULL, |
187 | .force_power_down = rts5229_force_power_down, | ||
182 | }; | 188 | }; |
183 | 189 | ||
184 | /* SD Pull Control Enable: | 190 | /* SD Pull Control Enable: |
diff --git a/drivers/mfd/rts5249.c b/drivers/mfd/rts5249.c index d5db182f35db..79ff212c3e7b 100644 --- a/drivers/mfd/rts5249.c +++ b/drivers/mfd/rts5249.c | |||
@@ -88,6 +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) | ||
92 | { | ||
93 | /* Set relink_time to 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); | ||
96 | rtsx_pci_write_register(pcr, AUTOLOAD_CFG_BASE + 3, 0x01, 0); | ||
97 | |||
98 | rtsx_pci_write_register(pcr, FPDCTL, 0x03, 0x03); | ||
99 | } | ||
100 | |||
91 | static int rts5249_extra_init_hw(struct rtsx_pcr *pcr) | 101 | static int rts5249_extra_init_hw(struct rtsx_pcr *pcr) |
92 | { | 102 | { |
93 | rtsx_pci_init_cmd(pcr); | 103 | rtsx_pci_init_cmd(pcr); |
@@ -217,6 +227,7 @@ static const struct pcr_ops rts5249_pcr_ops = { | |||
217 | .card_power_on = rts5249_card_power_on, | 227 | .card_power_on = rts5249_card_power_on, |
218 | .card_power_off = rts5249_card_power_off, | 228 | .card_power_off = rts5249_card_power_off, |
219 | .switch_output_voltage = rts5249_switch_output_voltage, | 229 | .switch_output_voltage = rts5249_switch_output_voltage, |
230 | .force_power_down = rts5249_force_power_down, | ||
220 | }; | 231 | }; |
221 | 232 | ||
222 | /* SD Pull Control Enable: | 233 | /* SD Pull Control Enable: |
diff --git a/drivers/mfd/rtsx_pcr.c b/drivers/mfd/rtsx_pcr.c index e06d6b0d55f6..97526f1acf96 100644 --- a/drivers/mfd/rtsx_pcr.c +++ b/drivers/mfd/rtsx_pcr.c | |||
@@ -927,6 +927,21 @@ static void rtsx_pci_idle_work(struct work_struct *work) | |||
927 | mutex_unlock(&pcr->pcr_mutex); | 927 | mutex_unlock(&pcr->pcr_mutex); |
928 | } | 928 | } |
929 | 929 | ||
930 | static void rtsx_pci_power_off(struct rtsx_pcr *pcr, u8 pm_state) | ||
931 | { | ||
932 | if (pcr->ops->turn_off_led) | ||
933 | pcr->ops->turn_off_led(pcr); | ||
934 | |||
935 | rtsx_pci_writel(pcr, RTSX_BIER, 0); | ||
936 | pcr->bier = 0; | ||
937 | |||
938 | rtsx_pci_write_register(pcr, PETXCFG, 0x08, 0x08); | ||
939 | rtsx_pci_write_register(pcr, HOST_SLEEP_STATE, 0x03, pm_state); | ||
940 | |||
941 | if (pcr->ops->force_power_down) | ||
942 | pcr->ops->force_power_down(pcr); | ||
943 | } | ||
944 | |||
930 | static int rtsx_pci_init_hw(struct rtsx_pcr *pcr) | 945 | static int rtsx_pci_init_hw(struct rtsx_pcr *pcr) |
931 | { | 946 | { |
932 | int err; | 947 | int err; |
@@ -1255,7 +1270,6 @@ static int rtsx_pci_suspend(struct pci_dev *pcidev, pm_message_t state) | |||
1255 | { | 1270 | { |
1256 | struct pcr_handle *handle; | 1271 | struct pcr_handle *handle; |
1257 | struct rtsx_pcr *pcr; | 1272 | struct rtsx_pcr *pcr; |
1258 | int ret = 0; | ||
1259 | 1273 | ||
1260 | dev_dbg(&(pcidev->dev), "--> %s\n", __func__); | 1274 | dev_dbg(&(pcidev->dev), "--> %s\n", __func__); |
1261 | 1275 | ||
@@ -1267,14 +1281,7 @@ static int rtsx_pci_suspend(struct pci_dev *pcidev, pm_message_t state) | |||
1267 | 1281 | ||
1268 | mutex_lock(&pcr->pcr_mutex); | 1282 | mutex_lock(&pcr->pcr_mutex); |
1269 | 1283 | ||
1270 | if (pcr->ops->turn_off_led) | 1284 | rtsx_pci_power_off(pcr, HOST_ENTER_S3); |
1271 | pcr->ops->turn_off_led(pcr); | ||
1272 | |||
1273 | rtsx_pci_writel(pcr, RTSX_BIER, 0); | ||
1274 | pcr->bier = 0; | ||
1275 | |||
1276 | rtsx_pci_write_register(pcr, PETXCFG, 0x08, 0x08); | ||
1277 | rtsx_pci_write_register(pcr, HOST_SLEEP_STATE, 0x03, 0x02); | ||
1278 | 1285 | ||
1279 | pci_save_state(pcidev); | 1286 | pci_save_state(pcidev); |
1280 | pci_enable_wake(pcidev, pci_choose_state(pcidev, state), 0); | 1287 | pci_enable_wake(pcidev, pci_choose_state(pcidev, state), 0); |
@@ -1282,7 +1289,7 @@ static int rtsx_pci_suspend(struct pci_dev *pcidev, pm_message_t state) | |||
1282 | pci_set_power_state(pcidev, pci_choose_state(pcidev, state)); | 1289 | pci_set_power_state(pcidev, pci_choose_state(pcidev, state)); |
1283 | 1290 | ||
1284 | mutex_unlock(&pcr->pcr_mutex); | 1291 | mutex_unlock(&pcr->pcr_mutex); |
1285 | return ret; | 1292 | return 0; |
1286 | } | 1293 | } |
1287 | 1294 | ||
1288 | static int rtsx_pci_resume(struct pci_dev *pcidev) | 1295 | static int rtsx_pci_resume(struct pci_dev *pcidev) |
@@ -1320,10 +1327,25 @@ out: | |||
1320 | return ret; | 1327 | return ret; |
1321 | } | 1328 | } |
1322 | 1329 | ||
1330 | static void rtsx_pci_shutdown(struct pci_dev *pcidev) | ||
1331 | { | ||
1332 | struct pcr_handle *handle; | ||
1333 | struct rtsx_pcr *pcr; | ||
1334 | |||
1335 | dev_dbg(&(pcidev->dev), "--> %s\n", __func__); | ||
1336 | |||
1337 | handle = pci_get_drvdata(pcidev); | ||
1338 | pcr = handle->pcr; | ||
1339 | rtsx_pci_power_off(pcr, HOST_ENTER_S1); | ||
1340 | |||
1341 | pci_disable_device(pcidev); | ||
1342 | } | ||
1343 | |||
1323 | #else /* CONFIG_PM */ | 1344 | #else /* CONFIG_PM */ |
1324 | 1345 | ||
1325 | #define rtsx_pci_suspend NULL | 1346 | #define rtsx_pci_suspend NULL |
1326 | #define rtsx_pci_resume NULL | 1347 | #define rtsx_pci_resume NULL |
1348 | #define rtsx_pci_shutdown NULL | ||
1327 | 1349 | ||
1328 | #endif /* CONFIG_PM */ | 1350 | #endif /* CONFIG_PM */ |
1329 | 1351 | ||
@@ -1334,6 +1356,7 @@ static struct pci_driver rtsx_pci_driver = { | |||
1334 | .remove = rtsx_pci_remove, | 1356 | .remove = rtsx_pci_remove, |
1335 | .suspend = rtsx_pci_suspend, | 1357 | .suspend = rtsx_pci_suspend, |
1336 | .resume = rtsx_pci_resume, | 1358 | .resume = rtsx_pci_resume, |
1359 | .shutdown = rtsx_pci_shutdown, | ||
1337 | }; | 1360 | }; |
1338 | module_pci_driver(rtsx_pci_driver); | 1361 | module_pci_driver(rtsx_pci_driver); |
1339 | 1362 | ||