@@ -119,6 +119,56 @@ int sdhci_pci_resume_host(struct sdhci_pci_chip *chip)
119
119
}
120
120
#endif
121
121
122
+ #ifdef CONFIG_PM
123
+ static int sdhci_pci_runtime_suspend_host (struct sdhci_pci_chip * chip )
124
+ {
125
+ struct sdhci_pci_slot * slot ;
126
+ struct sdhci_host * host ;
127
+ int i , ret ;
128
+
129
+ for (i = 0 ; i < chip -> num_slots ; i ++ ) {
130
+ slot = chip -> slots [i ];
131
+ if (!slot )
132
+ continue ;
133
+
134
+ host = slot -> host ;
135
+
136
+ ret = sdhci_runtime_suspend_host (host );
137
+ if (ret )
138
+ goto err_pci_runtime_suspend ;
139
+
140
+ if (chip -> rpm_retune &&
141
+ host -> tuning_mode != SDHCI_TUNING_MODE_3 )
142
+ mmc_retune_needed (host -> mmc );
143
+ }
144
+
145
+ return 0 ;
146
+
147
+ err_pci_runtime_suspend :
148
+ while (-- i >= 0 )
149
+ sdhci_runtime_resume_host (chip -> slots [i ]-> host );
150
+ return ret ;
151
+ }
152
+
153
+ static int sdhci_pci_runtime_resume_host (struct sdhci_pci_chip * chip )
154
+ {
155
+ struct sdhci_pci_slot * slot ;
156
+ int i , ret ;
157
+
158
+ for (i = 0 ; i < chip -> num_slots ; i ++ ) {
159
+ slot = chip -> slots [i ];
160
+ if (!slot )
161
+ continue ;
162
+
163
+ ret = sdhci_runtime_resume_host (slot -> host );
164
+ if (ret )
165
+ return ret ;
166
+ }
167
+
168
+ return 0 ;
169
+ }
170
+ #endif
171
+
122
172
/*****************************************************************************\
123
173
* *
124
174
* Hardware specific quirk handling *
@@ -1796,61 +1846,29 @@ static int sdhci_pci_resume(struct device *dev)
1796
1846
static int sdhci_pci_runtime_suspend (struct device * dev )
1797
1847
{
1798
1848
struct pci_dev * pdev = to_pci_dev (dev );
1799
- struct sdhci_pci_chip * chip ;
1800
- struct sdhci_pci_slot * slot ;
1801
- struct sdhci_host * host ;
1802
- int i , ret ;
1849
+ struct sdhci_pci_chip * chip = pci_get_drvdata (pdev );
1803
1850
1804
- chip = pci_get_drvdata (pdev );
1805
1851
if (!chip )
1806
1852
return 0 ;
1807
1853
1808
- for (i = 0 ; i < chip -> num_slots ; i ++ ) {
1809
- slot = chip -> slots [i ];
1810
- if (!slot )
1811
- continue ;
1812
-
1813
- host = slot -> host ;
1814
-
1815
- ret = sdhci_runtime_suspend_host (host );
1816
- if (ret )
1817
- goto err_pci_runtime_suspend ;
1818
-
1819
- if (chip -> rpm_retune &&
1820
- host -> tuning_mode != SDHCI_TUNING_MODE_3 )
1821
- mmc_retune_needed (host -> mmc );
1822
- }
1823
-
1824
- return 0 ;
1854
+ if (chip -> fixes && chip -> fixes -> runtime_suspend )
1855
+ return chip -> fixes -> runtime_suspend (chip );
1825
1856
1826
- err_pci_runtime_suspend :
1827
- while (-- i >= 0 )
1828
- sdhci_runtime_resume_host (chip -> slots [i ]-> host );
1829
- return ret ;
1857
+ return sdhci_pci_runtime_suspend_host (chip );
1830
1858
}
1831
1859
1832
1860
static int sdhci_pci_runtime_resume (struct device * dev )
1833
1861
{
1834
1862
struct pci_dev * pdev = to_pci_dev (dev );
1835
- struct sdhci_pci_chip * chip ;
1836
- struct sdhci_pci_slot * slot ;
1837
- int i , ret ;
1863
+ struct sdhci_pci_chip * chip = pci_get_drvdata (pdev );
1838
1864
1839
- chip = pci_get_drvdata (pdev );
1840
1865
if (!chip )
1841
1866
return 0 ;
1842
1867
1843
- for (i = 0 ; i < chip -> num_slots ; i ++ ) {
1844
- slot = chip -> slots [i ];
1845
- if (!slot )
1846
- continue ;
1868
+ if (chip -> fixes && chip -> fixes -> runtime_resume )
1869
+ return chip -> fixes -> runtime_resume (chip );
1847
1870
1848
- ret = sdhci_runtime_resume_host (slot -> host );
1849
- if (ret )
1850
- return ret ;
1851
- }
1852
-
1853
- return 0 ;
1871
+ return sdhci_pci_runtime_resume_host (chip );
1854
1872
}
1855
1873
#endif
1856
1874
0 commit comments