diff options
Diffstat (limited to 'drivers/video/i810')
-rw-r--r-- | drivers/video/i810/i810_main.c | 56 |
1 files changed, 28 insertions, 28 deletions
diff --git a/drivers/video/i810/i810_main.c b/drivers/video/i810/i810_main.c index 692337dc5a40..d27cd19b7f70 100644 --- a/drivers/video/i810/i810_main.c +++ b/drivers/video/i810/i810_main.c | |||
@@ -42,6 +42,7 @@ | |||
42 | #include <linux/pci_ids.h> | 42 | #include <linux/pci_ids.h> |
43 | #include <linux/resource.h> | 43 | #include <linux/resource.h> |
44 | #include <linux/unistd.h> | 44 | #include <linux/unistd.h> |
45 | #include <linux/console.h> | ||
45 | 46 | ||
46 | #include <asm/io.h> | 47 | #include <asm/io.h> |
47 | #include <asm/div64.h> | 48 | #include <asm/div64.h> |
@@ -1517,35 +1518,28 @@ static int i810fb_suspend(struct pci_dev *dev, pm_message_t state) | |||
1517 | { | 1518 | { |
1518 | struct fb_info *info = pci_get_drvdata(dev); | 1519 | struct fb_info *info = pci_get_drvdata(dev); |
1519 | struct i810fb_par *par = info->par; | 1520 | struct i810fb_par *par = info->par; |
1520 | int blank = 0, prev_state = par->cur_state; | ||
1521 | |||
1522 | if (state.event == prev_state) | ||
1523 | return 0; | ||
1524 | 1521 | ||
1525 | par->cur_state = state.event; | 1522 | par->cur_state = state.event; |
1526 | 1523 | ||
1527 | switch (state.event) { | 1524 | if (state.event == PM_EVENT_FREEZE) { |
1528 | case 1: | 1525 | dev->dev.power.power_state = state; |
1529 | blank = VESA_VSYNC_SUSPEND; | 1526 | return 0; |
1530 | break; | ||
1531 | case 2: | ||
1532 | blank = VESA_HSYNC_SUSPEND; | ||
1533 | break; | ||
1534 | case 3: | ||
1535 | blank = VESA_POWERDOWN; | ||
1536 | break; | ||
1537 | default: | ||
1538 | return -EINVAL; | ||
1539 | } | 1527 | } |
1540 | info->fbops->fb_blank(blank, info); | ||
1541 | 1528 | ||
1542 | if (!prev_state) { | 1529 | acquire_console_sem(); |
1543 | agp_unbind_memory(par->i810_gtt.i810_fb_memory); | 1530 | fb_set_suspend(info, 1); |
1544 | agp_unbind_memory(par->i810_gtt.i810_cursor_memory); | 1531 | |
1545 | pci_disable_device(dev); | 1532 | if (info->fbops->fb_sync) |
1546 | } | 1533 | info->fbops->fb_sync(info); |
1534 | |||
1535 | i810fb_blank(FB_BLANK_POWERDOWN, info); | ||
1536 | agp_unbind_memory(par->i810_gtt.i810_fb_memory); | ||
1537 | agp_unbind_memory(par->i810_gtt.i810_cursor_memory); | ||
1538 | |||
1547 | pci_save_state(dev); | 1539 | pci_save_state(dev); |
1540 | pci_disable_device(dev); | ||
1548 | pci_set_power_state(dev, pci_choose_state(dev, state)); | 1541 | pci_set_power_state(dev, pci_choose_state(dev, state)); |
1542 | release_console_sem(); | ||
1549 | 1543 | ||
1550 | return 0; | 1544 | return 0; |
1551 | } | 1545 | } |
@@ -1554,22 +1548,28 @@ static int i810fb_resume(struct pci_dev *dev) | |||
1554 | { | 1548 | { |
1555 | struct fb_info *info = pci_get_drvdata(dev); | 1549 | struct fb_info *info = pci_get_drvdata(dev); |
1556 | struct i810fb_par *par = info->par; | 1550 | struct i810fb_par *par = info->par; |
1551 | int cur_state = par->cur_state; | ||
1552 | |||
1553 | par->cur_state = PM_EVENT_ON; | ||
1557 | 1554 | ||
1558 | if (par->cur_state == 0) | 1555 | if (cur_state == PM_EVENT_FREEZE) { |
1556 | pci_set_power_state(dev, PCI_D0); | ||
1559 | return 0; | 1557 | return 0; |
1558 | } | ||
1560 | 1559 | ||
1561 | pci_restore_state(dev); | 1560 | acquire_console_sem(); |
1562 | pci_set_power_state(dev, PCI_D0); | 1561 | pci_set_power_state(dev, PCI_D0); |
1562 | pci_restore_state(dev); | ||
1563 | pci_enable_device(dev); | 1563 | pci_enable_device(dev); |
1564 | pci_set_master(dev); | ||
1564 | agp_bind_memory(par->i810_gtt.i810_fb_memory, | 1565 | agp_bind_memory(par->i810_gtt.i810_fb_memory, |
1565 | par->fb.offset); | 1566 | par->fb.offset); |
1566 | agp_bind_memory(par->i810_gtt.i810_cursor_memory, | 1567 | agp_bind_memory(par->i810_gtt.i810_cursor_memory, |
1567 | par->cursor_heap.offset); | 1568 | par->cursor_heap.offset); |
1568 | 1569 | i810fb_set_par(info); | |
1570 | fb_set_suspend (info, 0); | ||
1569 | info->fbops->fb_blank(VESA_NO_BLANKING, info); | 1571 | info->fbops->fb_blank(VESA_NO_BLANKING, info); |
1570 | 1572 | release_console_sem(); | |
1571 | par->cur_state = 0; | ||
1572 | |||
1573 | return 0; | 1573 | return 0; |
1574 | } | 1574 | } |
1575 | /*********************************************************************** | 1575 | /*********************************************************************** |