i8237.c 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. /*
  2. * i8237.c: 8237A DMA controller suspend functions.
  3. *
  4. * Written by Pierre Ossman, 2005.
  5. */
  6. #include <linux/init.h>
  7. #include <linux/sysdev.h>
  8. #include <asm/dma.h>
  9. /*
  10. * This module just handles suspend/resume issues with the
  11. * 8237A DMA controller (used for ISA and LPC).
  12. * Allocation is handled in kernel/dma.c and normal usage is
  13. * in asm/dma.h.
  14. */
  15. static int i8237A_resume(struct sys_device *dev)
  16. {
  17. unsigned long flags;
  18. int i;
  19. flags = claim_dma_lock();
  20. dma_outb(DMA1_RESET_REG, 0);
  21. dma_outb(DMA2_RESET_REG, 0);
  22. for (i = 0;i < 8;i++) {
  23. set_dma_addr(i, 0x000000);
  24. /* DMA count is a bit weird so this is not 0 */
  25. set_dma_count(i, 1);
  26. }
  27. /* Enable cascade DMA or channel 0-3 won't work */
  28. enable_dma(4);
  29. release_dma_lock(flags);
  30. return 0;
  31. }
  32. static int i8237A_suspend(struct sys_device *dev, pm_message_t state)
  33. {
  34. return 0;
  35. }
  36. static struct sysdev_class i8237_sysdev_class = {
  37. set_kset_name("i8237"),
  38. .suspend = i8237A_suspend,
  39. .resume = i8237A_resume,
  40. };
  41. static struct sys_device device_i8237A = {
  42. .id = 0,
  43. .cls = &i8237_sysdev_class,
  44. };
  45. static int __init i8237A_init_sysfs(void)
  46. {
  47. int error = sysdev_class_register(&i8237_sysdev_class);
  48. if (!error)
  49. error = sysdev_register(&device_i8237A);
  50. return error;
  51. }
  52. device_initcall(i8237A_init_sysfs);