aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/macintosh/via-pmu.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/macintosh/via-pmu.c')
-rw-r--r--drivers/macintosh/via-pmu.c42
1 files changed, 1 insertions, 41 deletions
diff --git a/drivers/macintosh/via-pmu.c b/drivers/macintosh/via-pmu.c
index 6886814b1e65..35e1f22089d6 100644
--- a/drivers/macintosh/via-pmu.c
+++ b/drivers/macintosh/via-pmu.c
@@ -64,9 +64,7 @@
64#include "via-pmu-event.h" 64#include "via-pmu-event.h"
65 65
66/* Some compile options */ 66/* Some compile options */
67#undef SUSPEND_USES_PMU
68#define DEBUG_SLEEP 67#define DEBUG_SLEEP
69#undef HACKED_PCI_SAVE
70 68
71/* Misc minor number allocated for /dev/pmu */ 69/* Misc minor number allocated for /dev/pmu */
72#define PMU_MINOR 154 70#define PMU_MINOR 154
@@ -1255,9 +1253,7 @@ void
1255pmu_suspend(void) 1253pmu_suspend(void)
1256{ 1254{
1257 unsigned long flags; 1255 unsigned long flags;
1258#ifdef SUSPEND_USES_PMU 1256
1259 struct adb_request *req;
1260#endif
1261 if (!via) 1257 if (!via)
1262 return; 1258 return;
1263 1259
@@ -1275,17 +1271,10 @@ pmu_suspend(void)
1275 via_pmu_interrupt(0, NULL); 1271 via_pmu_interrupt(0, NULL);
1276 spin_lock_irqsave(&pmu_lock, flags); 1272 spin_lock_irqsave(&pmu_lock, flags);
1277 if (!adb_int_pending && pmu_state == idle && !req_awaiting_reply) { 1273 if (!adb_int_pending && pmu_state == idle && !req_awaiting_reply) {
1278#ifdef SUSPEND_USES_PMU
1279 pmu_request(&req, NULL, 2, PMU_SET_INTR_MASK, 0);
1280 spin_unlock_irqrestore(&pmu_lock, flags);
1281 while(!req.complete)
1282 pmu_poll();
1283#else /* SUSPEND_USES_PMU */
1284 if (gpio_irq >= 0) 1274 if (gpio_irq >= 0)
1285 disable_irq_nosync(gpio_irq); 1275 disable_irq_nosync(gpio_irq);
1286 out_8(&via[IER], CB1_INT | IER_CLR); 1276 out_8(&via[IER], CB1_INT | IER_CLR);
1287 spin_unlock_irqrestore(&pmu_lock, flags); 1277 spin_unlock_irqrestore(&pmu_lock, flags);
1288#endif /* SUSPEND_USES_PMU */
1289 break; 1278 break;
1290 } 1279 }
1291 } while (1); 1280 } while (1);
@@ -1306,18 +1295,11 @@ pmu_resume(void)
1306 return; 1295 return;
1307 } 1296 }
1308 adb_int_pending = 1; 1297 adb_int_pending = 1;
1309#ifdef SUSPEND_USES_PMU
1310 pmu_request(&req, NULL, 2, PMU_SET_INTR_MASK, pmu_intr_mask);
1311 spin_unlock_irqrestore(&pmu_lock, flags);
1312 while(!req.complete)
1313 pmu_poll();
1314#else /* SUSPEND_USES_PMU */
1315 if (gpio_irq >= 0) 1298 if (gpio_irq >= 0)
1316 enable_irq(gpio_irq); 1299 enable_irq(gpio_irq);
1317 out_8(&via[IER], CB1_INT | IER_SET); 1300 out_8(&via[IER], CB1_INT | IER_SET);
1318 spin_unlock_irqrestore(&pmu_lock, flags); 1301 spin_unlock_irqrestore(&pmu_lock, flags);
1319 pmu_poll(); 1302 pmu_poll();
1320#endif /* SUSPEND_USES_PMU */
1321} 1303}
1322 1304
1323/* Interrupt data could be the result data from an ADB cmd */ 1305/* Interrupt data could be the result data from an ADB cmd */
@@ -1803,14 +1785,10 @@ static void broadcast_wake(void)
1803 * PCI devices which may get powered off when we sleep. 1785 * PCI devices which may get powered off when we sleep.
1804 */ 1786 */
1805static struct pci_save { 1787static struct pci_save {
1806#ifndef HACKED_PCI_SAVE
1807 u16 command; 1788 u16 command;
1808 u16 cache_lat; 1789 u16 cache_lat;
1809 u16 intr; 1790 u16 intr;
1810 u32 rom_address; 1791 u32 rom_address;
1811#else
1812 u32 config[16];
1813#endif
1814} *pbook_pci_saves; 1792} *pbook_pci_saves;
1815static int pbook_npci_saves; 1793static int pbook_npci_saves;
1816 1794
@@ -1856,16 +1834,10 @@ pbook_pci_save(void)
1856 pci_dev_put(pd); 1834 pci_dev_put(pd);
1857 return; 1835 return;
1858 } 1836 }
1859#ifndef HACKED_PCI_SAVE
1860 pci_read_config_word(pd, PCI_COMMAND, &ps->command); 1837 pci_read_config_word(pd, PCI_COMMAND, &ps->command);
1861 pci_read_config_word(pd, PCI_CACHE_LINE_SIZE, &ps->cache_lat); 1838 pci_read_config_word(pd, PCI_CACHE_LINE_SIZE, &ps->cache_lat);
1862 pci_read_config_word(pd, PCI_INTERRUPT_LINE, &ps->intr); 1839 pci_read_config_word(pd, PCI_INTERRUPT_LINE, &ps->intr);
1863 pci_read_config_dword(pd, PCI_ROM_ADDRESS, &ps->rom_address); 1840 pci_read_config_dword(pd, PCI_ROM_ADDRESS, &ps->rom_address);
1864#else
1865 int i;
1866 for (i=1;i<16;i++)
1867 pci_read_config_dword(pd, i<<4, &ps->config[i]);
1868#endif
1869 ++ps; 1841 ++ps;
1870 } 1842 }
1871} 1843}
@@ -1884,17 +1856,6 @@ pbook_pci_restore(void)
1884 int j; 1856 int j;
1885 1857
1886 while ((pd = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, pd)) != NULL) { 1858 while ((pd = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, pd)) != NULL) {
1887#ifdef HACKED_PCI_SAVE
1888 int i;
1889 if (npci-- == 0) {
1890 pci_dev_put(pd);
1891 return;
1892 }
1893 ps++;
1894 for (i=2;i<16;i++)
1895 pci_write_config_dword(pd, i<<4, ps->config[i]);
1896 pci_write_config_dword(pd, 4, ps->config[1]);
1897#else
1898 if (npci-- == 0) 1859 if (npci-- == 0)
1899 return; 1860 return;
1900 ps++; 1861 ps++;
@@ -1918,7 +1879,6 @@ pbook_pci_restore(void)
1918 pci_write_config_word(pd, PCI_COMMAND, ps->command); 1879 pci_write_config_word(pd, PCI_COMMAND, ps->command);
1919 break; 1880 break;
1920 } 1881 }
1921#endif
1922 } 1882 }
1923} 1883}
1924 1884