tc35892.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. /*
  2. * Copyright (C) ST-Ericsson SA 2010
  3. *
  4. * License Terms: GNU General Public License, version 2
  5. */
  6. #ifndef __LINUX_MFD_TC35892_H
  7. #define __LINUX_MFD_TC35892_H
  8. #include <linux/device.h>
  9. #define TC35892_RSTCTRL_IRQRST (1 << 4)
  10. #define TC35892_RSTCTRL_TIMRST (1 << 3)
  11. #define TC35892_RSTCTRL_ROTRST (1 << 2)
  12. #define TC35892_RSTCTRL_KBDRST (1 << 1)
  13. #define TC35892_RSTCTRL_GPIRST (1 << 0)
  14. #define TC35892_IRQST 0x91
  15. #define TC35892_MANFCODE_MAGIC 0x03
  16. #define TC35892_MANFCODE 0x80
  17. #define TC35892_VERSION 0x81
  18. #define TC35892_IOCFG 0xA7
  19. #define TC35892_CLKMODE 0x88
  20. #define TC35892_CLKCFG 0x89
  21. #define TC35892_CLKEN 0x8A
  22. #define TC35892_RSTCTRL 0x82
  23. #define TC35892_EXTRSTN 0x83
  24. #define TC35892_RSTINTCLR 0x84
  25. #define TC35892_GPIOIS0 0xC9
  26. #define TC35892_GPIOIS1 0xCA
  27. #define TC35892_GPIOIS2 0xCB
  28. #define TC35892_GPIOIBE0 0xCC
  29. #define TC35892_GPIOIBE1 0xCD
  30. #define TC35892_GPIOIBE2 0xCE
  31. #define TC35892_GPIOIEV0 0xCF
  32. #define TC35892_GPIOIEV1 0xD0
  33. #define TC35892_GPIOIEV2 0xD1
  34. #define TC35892_GPIOIE0 0xD2
  35. #define TC35892_GPIOIE1 0xD3
  36. #define TC35892_GPIOIE2 0xD4
  37. #define TC35892_GPIORIS0 0xD6
  38. #define TC35892_GPIORIS1 0xD7
  39. #define TC35892_GPIORIS2 0xD8
  40. #define TC35892_GPIOMIS0 0xD9
  41. #define TC35892_GPIOMIS1 0xDA
  42. #define TC35892_GPIOMIS2 0xDB
  43. #define TC35892_GPIOIC0 0xDC
  44. #define TC35892_GPIOIC1 0xDD
  45. #define TC35892_GPIOIC2 0xDE
  46. #define TC35892_GPIODATA0 0xC0
  47. #define TC35892_GPIOMASK0 0xc1
  48. #define TC35892_GPIODATA1 0xC2
  49. #define TC35892_GPIOMASK1 0xc3
  50. #define TC35892_GPIODATA2 0xC4
  51. #define TC35892_GPIOMASK2 0xC5
  52. #define TC35892_GPIODIR0 0xC6
  53. #define TC35892_GPIODIR1 0xC7
  54. #define TC35892_GPIODIR2 0xC8
  55. #define TC35892_GPIOSYNC0 0xE6
  56. #define TC35892_GPIOSYNC1 0xE7
  57. #define TC35892_GPIOSYNC2 0xE8
  58. #define TC35892_GPIOWAKE0 0xE9
  59. #define TC35892_GPIOWAKE1 0xEA
  60. #define TC35892_GPIOWAKE2 0xEB
  61. #define TC35892_GPIOODM0 0xE0
  62. #define TC35892_GPIOODE0 0xE1
  63. #define TC35892_GPIOODM1 0xE2
  64. #define TC35892_GPIOODE1 0xE3
  65. #define TC35892_GPIOODM2 0xE4
  66. #define TC35892_GPIOODE2 0xE5
  67. #define TC35892_INT_GPIIRQ 0
  68. #define TC35892_INT_TI0IRQ 1
  69. #define TC35892_INT_TI1IRQ 2
  70. #define TC35892_INT_TI2IRQ 3
  71. #define TC35892_INT_ROTIRQ 5
  72. #define TC35892_INT_KBDIRQ 6
  73. #define TC35892_INT_PORIRQ 7
  74. #define TC35892_NR_INTERNAL_IRQS 8
  75. #define TC35892_INT_GPIO(x) (TC35892_NR_INTERNAL_IRQS + (x))
  76. struct tc35892 {
  77. struct mutex lock;
  78. struct device *dev;
  79. struct i2c_client *i2c;
  80. int irq_base;
  81. int num_gpio;
  82. struct tc35892_platform_data *pdata;
  83. };
  84. extern int tc35892_reg_write(struct tc35892 *tc35892, u8 reg, u8 data);
  85. extern int tc35892_reg_read(struct tc35892 *tc35892, u8 reg);
  86. extern int tc35892_block_read(struct tc35892 *tc35892, u8 reg, u8 length,
  87. u8 *values);
  88. extern int tc35892_block_write(struct tc35892 *tc35892, u8 reg, u8 length,
  89. const u8 *values);
  90. extern int tc35892_set_bits(struct tc35892 *tc35892, u8 reg, u8 mask, u8 val);
  91. /**
  92. * struct tc35892_gpio_platform_data - TC35892 GPIO platform data
  93. * @gpio_base: first gpio number assigned to TC35892. A maximum of
  94. * %TC35892_NR_GPIOS GPIOs will be allocated.
  95. */
  96. struct tc35892_gpio_platform_data {
  97. int gpio_base;
  98. };
  99. /**
  100. * struct tc35892_platform_data - TC35892 platform data
  101. * @irq_base: base IRQ number. %TC35892_NR_IRQS irqs will be used.
  102. * @gpio: GPIO-specific platform data
  103. */
  104. struct tc35892_platform_data {
  105. int irq_base;
  106. struct tc35892_gpio_platform_data *gpio;
  107. };
  108. #define TC35892_NR_GPIOS 24
  109. #define TC35892_NR_IRQS TC35892_INT_GPIO(TC35892_NR_GPIOS)
  110. #endif