mfd: rtsx: Configure to enter a deeper power-saving mode in S3
authorWei WANG <wei_wang@realsil.com.cn>
Tue, 20 Aug 2013 06:18:55 +0000 (14:18 +0800)
committerSamuel Ortiz <sameo@linux.intel.com>
Tue, 20 Aug 2013 08:22:01 +0000 (10:22 +0200)
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>
drivers/mfd/rtl8411.c
drivers/mfd/rts5209.c
drivers/mfd/rts5227.c
drivers/mfd/rts5229.c
drivers/mfd/rts5249.c
drivers/mfd/rtsx_pcr.c
include/linux/mfd/rtsx_pci.h

index d183fa0023383c8d7db3efb7831091c38fb5138d..37367fb1c11b97d5165ca2150488a59f3cecfb75 100644 (file)
@@ -86,7 +86,7 @@ static void rtl8411b_fetch_vendor_settings(struct rtsx_pcr *pcr)
                map_sd_drive(rtl8411b_reg_to_sd30_drive_sel_3v3(reg));
 }
 
-static void rtl8411_force_power_down(struct rtsx_pcr *pcr)
+static void rtl8411_force_power_down(struct rtsx_pcr *pcr, u8 pm_state)
 {
        rtsx_pci_write_register(pcr, FPDCTL, 0x07, 0x07);
 }
index 03a15f779ebb3621d4df66c77ed19d60ccb9c857..ef6a59fe37a425ff8cf678af41912d8d3c0ccbd3 100644 (file)
@@ -59,7 +59,7 @@ static void rts5209_fetch_vendor_settings(struct rtsx_pcr *pcr)
        }
 }
 
-static void rts5209_force_power_down(struct rtsx_pcr *pcr)
+static void rts5209_force_power_down(struct rtsx_pcr *pcr, u8 pm_state)
 {
        rtsx_pci_write_register(pcr, FPDCTL, 0x07, 0x07);
 }
index 724ce4c54523e0babe5c3b0e50cf14b9ec279906..c72abd6b9c812ac971c5e4d9be9c8bfcdbd76995 100644 (file)
@@ -83,13 +83,16 @@ static void rts5227_fetch_vendor_settings(struct rtsx_pcr *pcr)
                pcr->flags |= PCR_REVERSE_SOCKET;
 }
 
-static void rts5227_force_power_down(struct rtsx_pcr *pcr)
+static void rts5227_force_power_down(struct rtsx_pcr *pcr, u8 pm_state)
 {
        /* Set relink_time to 0 */
        rtsx_pci_write_register(pcr, AUTOLOAD_CFG_BASE + 1, 0xFF, 0);
        rtsx_pci_write_register(pcr, AUTOLOAD_CFG_BASE + 2, 0xFF, 0);
        rtsx_pci_write_register(pcr, AUTOLOAD_CFG_BASE + 3, 0x01, 0);
 
+       if (pm_state == HOST_ENTER_S3)
+               rtsx_pci_write_register(pcr, PM_CTRL3, 0x10, 0x10);
+
        rtsx_pci_write_register(pcr, FPDCTL, 0x03, 0x03);
 }
 
@@ -123,6 +126,7 @@ static int rts5227_extra_init_hw(struct rtsx_pcr *pcr)
        else
                rtsx_pci_add_cmd(pcr, WRITE_REG_CMD,
                                AUTOLOAD_CFG_BASE + 3, 0xB8, 0x88);
+       rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, PM_CTRL3, 0x10, 0x00);
 
        return rtsx_pci_send_cmd(pcr, 100);
 }
index e8261d7436a8b868790c71cdba17619781822f11..afb0f24bac71e3c7729dc5bfe969fb05d974e6ca 100644 (file)
@@ -56,7 +56,7 @@ static void rts5229_fetch_vendor_settings(struct rtsx_pcr *pcr)
                map_sd_drive(rtsx_reg_to_sd30_drive_sel_3v3(reg));
 }
 
-static void rts5229_force_power_down(struct rtsx_pcr *pcr)
+static void rts5229_force_power_down(struct rtsx_pcr *pcr, u8 pm_state)
 {
        rtsx_pci_write_register(pcr, FPDCTL, 0x03, 0x03);
 }
index c5e54d7cf528fdf57925ec7ddf5fead418bf5942..384b30b432bd69a9f1a10b56760443972675f928 100644 (file)
@@ -88,13 +88,16 @@ static void rts5249_fetch_vendor_settings(struct rtsx_pcr *pcr)
                pcr->flags |= PCR_REVERSE_SOCKET;
 }
 
-static void rts5249_force_power_down(struct rtsx_pcr *pcr)
+static void rts5249_force_power_down(struct rtsx_pcr *pcr, u8 pm_state)
 {
        /* Set relink_time to 0 */
        rtsx_pci_write_register(pcr, AUTOLOAD_CFG_BASE + 1, 0xFF, 0);
        rtsx_pci_write_register(pcr, AUTOLOAD_CFG_BASE + 2, 0xFF, 0);
        rtsx_pci_write_register(pcr, AUTOLOAD_CFG_BASE + 3, 0x01, 0);
 
+       if (pm_state == HOST_ENTER_S3)
+               rtsx_pci_write_register(pcr, PM_CTRL3, 0x10, 0x10);
+
        rtsx_pci_write_register(pcr, FPDCTL, 0x03, 0x03);
 }
 
@@ -119,6 +122,7 @@ static int rts5249_extra_init_hw(struct rtsx_pcr *pcr)
        else
                rtsx_pci_add_cmd(pcr, WRITE_REG_CMD,
                                AUTOLOAD_CFG_BASE + 3, 0xB0, 0x80);
+       rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, PM_CTRL3, 0x10, 0x00);
 
        return rtsx_pci_send_cmd(pcr, 100);
 }
index ffd393c06d344e37920b956a3d88c32b7917f09d..29932a019fdf94c86248e60109c04e5cabef3b2c 100644 (file)
@@ -939,7 +939,7 @@ static void rtsx_pci_power_off(struct rtsx_pcr *pcr, u8 pm_state)
        rtsx_pci_write_register(pcr, HOST_SLEEP_STATE, 0x03, pm_state);
 
        if (pcr->ops->force_power_down)
-               pcr->ops->force_power_down(pcr);
+               pcr->ops->force_power_down(pcr, pm_state);
 }
 
 static int rtsx_pci_init_hw(struct rtsx_pcr *pcr)
index 9a16276bc080762bad6618629585b8096bd10c02..dd0bd5806adc9961bc4260f8a68e72c2311eb631 100644 (file)
@@ -779,7 +779,7 @@ struct pcr_ops {
        unsigned int    (*cd_deglitch)(struct rtsx_pcr *pcr);
        int             (*conv_clk_and_div_n)(int clk, int dir);
        void            (*fetch_vendor_settings)(struct rtsx_pcr *pcr);
-       void            (*force_power_down)(struct rtsx_pcr *pcr);
+       void            (*force_power_down)(struct rtsx_pcr *pcr, u8 pm_state);
 };
 
 enum PDEV_STAT  {PDEV_STAT_IDLE, PDEV_STAT_RUN};
This page took 0.033719 seconds and 5 git commands to generate.