i8237.c 1.5 KB

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