cypress_touchkey.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. /*
  2. * cypress_touchkey.h - Platform data for cypress touchkey driver
  3. *
  4. * Copyright (C) 2011 Samsung Electronics
  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 version 2 as
  8. * published by the Free Software Foundation.
  9. *
  10. */
  11. #ifndef __LINUX_CYPRESS_TOUCHKEY_H
  12. #define __LINUX_CYPRESS_TOUCHKEY_H
  13. extern struct class *sec_class;
  14. /* extern int ISSP_main(void); */
  15. /* DVFS feature : TOUCH BOOSTER */
  16. #define TSP_BOOSTER
  17. #ifdef TSP_BOOSTER
  18. #include <linux/cpufreq.h>
  19. #define TOUCH_BOOSTER_OFF_TIME 300
  20. #define TOUCH_BOOSTER_CHG_TIME 200
  21. #endif
  22. #ifdef CONFIG_LEDS_CLASS
  23. #include <linux/leds.h>
  24. #endif
  25. #include <linux/input.h>
  26. #include <linux/earlysuspend.h>
  27. #include <linux/mutex.h>
  28. #define CONFIG_GLOVE_TOUCH
  29. #if defined(CONFIG_GLOVE_TOUCH)
  30. #define TK_BIT_GLOVE 0x40
  31. #endif
  32. #ifdef CONFIG_FB
  33. #include <linux/notifier.h>
  34. #endif
  35. //#define AUTOCAL_WORKQUEUE
  36. /*#define TK_HOME_ENABLE*/
  37. /* Flip cover*/
  38. #define TKEY_FLIP_MODE
  39. #ifdef TKEY_FLIP_MODE
  40. #define TK_BIT_FLIP 0x08
  41. #endif
  42. #define TK_INFORM_CHARGER
  43. #define TK_BIT_TA_ON 0x10
  44. #define CYPRESS_55_IC_MASK 0x20
  45. #define CYPRESS_65_IC_MASK 0x04
  46. #define CYPRESS_DETECTION_FLAG 0x1B
  47. #define TK_CMD_INTERRUPT_SET_REG 0x18
  48. #define TK_CMD_DUAL_DETECTION 0x01
  49. #define TK_BIT_DETECTION_CONFIRM 0xEE
  50. #define NUM_OF_KEY 4
  51. #define TK_KEYPAD_ENABLE
  52. #ifdef TK_INFORM_CHARGER
  53. struct touchkey_callbacks {
  54. void (*inform_charger)(struct touchkey_callbacks *, bool);
  55. };
  56. #endif
  57. struct cypress_touchkey_platform_data {
  58. unsigned gpio_led_en;
  59. u32 touchkey_keycode[4];
  60. int keycodes_size;
  61. void (*power_onoff) (int);
  62. bool skip_fw_update;
  63. bool touchkey_order;
  64. void (*register_cb)(void *);
  65. bool i2c_pull_up;
  66. int gpio_int;
  67. u32 irq_gpio_flags;
  68. int gpio_sda;
  69. u32 sda_gpio_flags;
  70. int gpio_scl;
  71. u32 scl_gpio_flags;
  72. int vdd_led;
  73. };
  74. struct cypress_touchkey_info {
  75. struct i2c_client *client;
  76. struct cypress_touchkey_platform_data *pdata;
  77. struct input_dev *input_dev;
  78. struct early_suspend early_suspend;
  79. char phys[32];
  80. unsigned char keycode[NUM_OF_KEY];
  81. u8 sensitivity[NUM_OF_KEY];
  82. int irq;
  83. u8 fw_ver;
  84. void (*power_onoff)(int);
  85. int touchkey_update_status;
  86. u8 ic_vendor;
  87. struct regulator *vcc_en;
  88. struct regulator *vdd_led;
  89. #ifdef CONFIG_LEDS_CLASS
  90. struct led_classdev leds;
  91. enum led_brightness brightness;
  92. struct mutex touchkey_mutex;
  93. struct mutex fw_lock;
  94. struct workqueue_struct *led_wq;
  95. struct work_struct led_work;
  96. #endif
  97. #if defined(CONFIG_GLOVE_TOUCH)
  98. struct workqueue_struct *glove_wq;
  99. struct work_struct glove_work;
  100. #endif
  101. bool is_powering_on;
  102. bool enabled;
  103. bool done_ta_setting;
  104. #ifdef TKEY_FLIP_MODE
  105. bool enabled_flip;
  106. #endif
  107. #ifdef TSP_BOOSTER
  108. struct delayed_work work_dvfs_off;
  109. struct delayed_work work_dvfs_chg;
  110. bool dvfs_lock_status;
  111. struct mutex dvfs_lock;
  112. #endif
  113. #ifdef TK_INFORM_CHARGER
  114. struct touchkey_callbacks callbacks;
  115. bool charging_mode;
  116. #endif
  117. u32 fw_id;
  118. #if defined(CONFIG_GLOVE_TOUCH)
  119. int glove_value;
  120. #endif
  121. #ifdef TK_KEYPAD_ENABLE
  122. atomic_t keypad_enable;
  123. #endif
  124. #if defined(CONFIG_FB) && defined(CONFIG_KEYBOARD_CYPRESS_TOUCHKEY_KS01)
  125. struct notifier_block fb_notif;
  126. #endif
  127. };
  128. void touchkey_charger_infom(bool en);
  129. #define PM8921_IRQ_BASE (NR_MSM_IRQS + NR_GPIO_IRQS)
  130. #define IRQ_TOUCHKEY_INT PM8921_GPIO_IRQ(PMIC8058_IRQ_BASE, (PM8058_GPIO(31)))
  131. #define GPIO_TOUCHKEY_SDA 83
  132. #define GPIO_TOUCHKEY_SCL 84
  133. #define GPIO_TOUCHKEY_SDA_2 95
  134. #define GPIO_TOUCHKEY_SCL_2 96
  135. #define PMIC_GPIO_TKEY_INT 79
  136. #define PMIC_GPIO_TKEY_EN 32
  137. #endif /* __LINUX_CYPRESS_TOUCHKEY_H */