gpio-fns.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. /* arch/arm/mach-s3c2410/include/mach/gpio-fns.h
  2. *
  3. * Copyright (c) 2003,2009 Simtec Electronics
  4. * Ben Dooks <ben@simtec.co.uk>
  5. *
  6. * S3C2410 - hardware
  7. *
  8. * This program is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License version 2 as
  10. * published by the Free Software Foundation.
  11. */
  12. /* These functions are in the to-be-removed category and it is strongly
  13. * encouraged not to use these in new code. They will be marked deprecated
  14. * very soon.
  15. *
  16. * Most of the functionality can be either replaced by the gpiocfg calls
  17. * for the s3c platform or by the generic GPIOlib API.
  18. */
  19. /* external functions for GPIO support
  20. *
  21. * These allow various different clients to access the same GPIO
  22. * registers without conflicting. If your driver only owns the entire
  23. * GPIO register, then it is safe to ioremap/__raw_{read|write} to it.
  24. */
  25. /* s3c2410_gpio_cfgpin
  26. *
  27. * set the configuration of the given pin to the value passed.
  28. *
  29. * eg:
  30. * s3c2410_gpio_cfgpin(S3C2410_GPA(0), S3C2410_GPA0_ADDR0);
  31. * s3c2410_gpio_cfgpin(S3C2410_GPE(8), S3C2410_GPE8_SDDAT1);
  32. */
  33. extern void s3c2410_gpio_cfgpin(unsigned int pin, unsigned int function);
  34. extern unsigned int s3c2410_gpio_getcfg(unsigned int pin);
  35. /* s3c2410_gpio_getirq
  36. *
  37. * turn the given pin number into the corresponding IRQ number
  38. *
  39. * returns:
  40. * < 0 = no interrupt for this pin
  41. * >=0 = interrupt number for the pin
  42. */
  43. extern int s3c2410_gpio_getirq(unsigned int pin);
  44. #ifdef CONFIG_CPU_S3C2400
  45. extern int s3c2400_gpio_getirq(unsigned int pin);
  46. #endif /* CONFIG_CPU_S3C2400 */
  47. /* s3c2410_gpio_irqfilter
  48. *
  49. * set the irq filtering on the given pin
  50. *
  51. * on = 0 => disable filtering
  52. * 1 => enable filtering
  53. *
  54. * config = S3C2410_EINTFLT_PCLK or S3C2410_EINTFLT_EXTCLK orred with
  55. * width of filter (0 through 63)
  56. *
  57. *
  58. */
  59. extern int s3c2410_gpio_irqfilter(unsigned int pin, unsigned int on,
  60. unsigned int config);
  61. /* s3c2410_gpio_pullup
  62. *
  63. * configure the pull-up control on the given pin
  64. *
  65. * to = 1 => disable the pull-up
  66. * 0 => enable the pull-up
  67. *
  68. * eg;
  69. *
  70. * s3c2410_gpio_pullup(S3C2410_GPB(0), 0);
  71. * s3c2410_gpio_pullup(S3C2410_GPE(8), 0);
  72. */
  73. extern void s3c2410_gpio_pullup(unsigned int pin, unsigned int to);
  74. /* s3c2410_gpio_getpull
  75. *
  76. * Read the state of the pull-up on a given pin
  77. *
  78. * return:
  79. * < 0 => error code
  80. * 0 => enabled
  81. * 1 => disabled
  82. */
  83. extern int s3c2410_gpio_getpull(unsigned int pin);
  84. extern void s3c2410_gpio_setpin(unsigned int pin, unsigned int to);
  85. extern unsigned int s3c2410_gpio_getpin(unsigned int pin);