Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 218766
b: refs/heads/master
c: 3fd9b6c
h: refs/heads/master
v: v3
  • Loading branch information
Deepak Saxena authored and Florian Tobias Schandinat committed Oct 24, 2010
1 parent d77ead2 commit d422af6
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: efd4f6398dc92b5bf392670df862f42a19f34cf2
refs/heads/master: 3fd9b6cc38028ea64e9a39c6af9d5ad928594be6
4 changes: 4 additions & 0 deletions trunk/drivers/video/via/via-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -644,6 +644,10 @@ static struct pci_driver via_driver = {
.id_table = via_pci_table,
.probe = via_pci_probe,
.remove = __devexit_p(via_pci_remove),
#ifdef CONFIG_PM
.suspend = viafb_suspend,
.resume = viafb_resume,
#endif
};

static int __init via_core_init(void)
Expand Down
46 changes: 46 additions & 0 deletions trunk/drivers/video/via/viafbdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -1669,6 +1669,52 @@ static int parse_mode(const char *str, u32 *xres, u32 *yres)
}


#ifdef CONFIG_PM
int viafb_suspend(struct pci_dev *pdev, pm_message_t state)
{
if (state.event == PM_EVENT_SUSPEND) {
acquire_console_sem();

memcpy_fromio(viaparinfo->shared->saved_regs,
viaparinfo->shared->vdev->engine_mmio + 0x100,
0xff * sizeof(u32));

fb_set_suspend(viafbinfo, 1);

viafb_sync(viafbinfo);

pci_save_state(pdev);
pci_disable_device(pdev);
pci_set_power_state(pdev, pci_choose_state(pdev, state));
release_console_sem();
}

return 0;
}

int viafb_resume(struct pci_dev *pdev)
{
acquire_console_sem();
pci_set_power_state(pdev, PCI_D0);
pci_restore_state(pdev);
if (pci_enable_device(pdev))
goto fail;
pci_set_master(pdev);

memcpy_toio(viaparinfo->shared->vdev->engine_mmio + 0x100,
viaparinfo->shared->saved_regs,
0x100 * sizeof(u32));

fb_set_suspend(viafbinfo, 0);

fail:
release_console_sem();
return 0;
}

#endif


int __devinit via_fb_pci_probe(struct viafb_dev *vdev)
{
u32 default_xres, default_yres;
Expand Down
5 changes: 5 additions & 0 deletions trunk/drivers/video/via/viafbdev.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ struct viafb_shared {
u8 dst_bpp, u32 dst_addr, u32 dst_pitch, u32 dst_x, u32 dst_y,
u32 *src_mem, u32 src_addr, u32 src_pitch, u32 src_x, u32 src_y,
u32 fg_color, u32 bg_color, u8 fill_rop);

/* For suspend/resume */
u32 saved_regs[0x100];
};

struct viafb_par {
Expand Down Expand Up @@ -108,4 +111,6 @@ void via_fb_pci_remove(struct pci_dev *pdev);
/* Temporary */
int viafb_init(void);
void viafb_exit(void);
int viafb_suspend(struct pci_dev *pdev, pm_message_t state);
int viafb_resume(struct pci_dev *pdev);
#endif /* __VIAFBDEV_H__ */

0 comments on commit d422af6

Please sign in to comment.