ep7211-sir.c 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. /*
  2. * IR port driver for the Cirrus Logic CLPS711X processors
  3. *
  4. * Copyright 2001, Blue Mug Inc. All rights reserved.
  5. * Copyright 2007, Samuel Ortiz <samuel@sortiz.org>
  6. */
  7. #include <linux/module.h>
  8. #include <linux/platform_device.h>
  9. #include <mach/hardware.h>
  10. #include "sir-dev.h"
  11. static int clps711x_dongle_open(struct sir_dev *dev)
  12. {
  13. unsigned int syscon;
  14. /* Turn on the SIR encoder. */
  15. syscon = clps_readl(SYSCON1);
  16. syscon |= SYSCON1_SIREN;
  17. clps_writel(syscon, SYSCON1);
  18. return 0;
  19. }
  20. static int clps711x_dongle_close(struct sir_dev *dev)
  21. {
  22. unsigned int syscon;
  23. /* Turn off the SIR encoder. */
  24. syscon = clps_readl(SYSCON1);
  25. syscon &= ~SYSCON1_SIREN;
  26. clps_writel(syscon, SYSCON1);
  27. return 0;
  28. }
  29. static struct dongle_driver clps711x_dongle = {
  30. .owner = THIS_MODULE,
  31. .driver_name = "EP7211 IR driver",
  32. .type = IRDA_EP7211_DONGLE,
  33. .open = clps711x_dongle_open,
  34. .close = clps711x_dongle_close,
  35. };
  36. static int clps711x_sir_probe(struct platform_device *pdev)
  37. {
  38. return irda_register_dongle(&clps711x_dongle);
  39. }
  40. static int clps711x_sir_remove(struct platform_device *pdev)
  41. {
  42. return irda_unregister_dongle(&clps711x_dongle);
  43. }
  44. static struct platform_driver clps711x_sir_driver = {
  45. .driver = {
  46. .name = "sir-clps711x",
  47. .owner = THIS_MODULE,
  48. },
  49. .probe = clps711x_sir_probe,
  50. .remove = clps711x_sir_remove,
  51. };
  52. module_platform_driver(clps711x_sir_driver);
  53. MODULE_AUTHOR("Samuel Ortiz <samuel@sortiz.org>");
  54. MODULE_DESCRIPTION("EP7211 IR dongle driver");
  55. MODULE_LICENSE("GPL");
  56. MODULE_ALIAS("irda-dongle-13"); /* IRDA_EP7211_DONGLE */