cyttsp4_regs.h 30 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121
  1. /*
  2. * cyttsp4_regs.h
  3. * Cypress TrueTouch(TM) Standard Product V4 registers.
  4. * For use with Cypress Txx4xx parts.
  5. * Supported parts include:
  6. * TMA4XX
  7. * TMA1036
  8. *
  9. * Copyright (C) 2012 Cypress Semiconductor
  10. * Copyright (C) 2011 Sony Ericsson Mobile Communications AB.
  11. *
  12. * Author: Aleksej Makarov <aleksej.makarov@sonyericsson.com>
  13. * Modified by: Cypress Semiconductor to add test modes and commands
  14. *
  15. * This program is free software; you can redistribute it and/or
  16. * modify it under the terms of the GNU General Public License
  17. * version 2, and only version 2, as published by the
  18. * Free Software Foundation.
  19. *
  20. * This program is distributed in the hope that it will be useful,
  21. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  22. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  23. * GNU General Public License for more details.
  24. *
  25. * Contact Cypress Semiconductor at www.cypress.com <ttdrivers@cypress.com>
  26. *
  27. */
  28. #ifndef _CYTTSP4_REGS_H
  29. #define _CYTTSP4_REGS_H
  30. #include <asm/unaligned.h>
  31. #include <linux/delay.h>
  32. #include <linux/device.h>
  33. #ifdef CONFIG_HAS_EARLYSUSPEND
  34. #include <linux/earlysuspend.h>
  35. #endif
  36. #include <linux/gpio.h>
  37. #include <linux/input.h>
  38. #include <linux/interrupt.h>
  39. #include <linux/limits.h>
  40. #include <linux/module.h>
  41. #include <linux/mutex.h>
  42. #include <linux/of_device.h>
  43. #include <linux/pm_runtime.h>
  44. #include <linux/sched.h>
  45. #include <linux/slab.h>
  46. #include <linux/types.h>
  47. #include <linux/workqueue.h>
  48. #define SAMSUNG_TSP_INFO
  49. #define SAMSUNG_SYSFS
  50. #include <linux/cyttsp4_core.h>
  51. /* Timeout in ms. */
  52. #define CY_COMMAND_COMPLETE_TIMEOUT 500
  53. #define CY_CALIBRATE_COMPLETE_TIMEOUT 5000
  54. #define CY_WATCHDOG_TIMEOUT 1000
  55. #define CY_CORE_REQUEST_EXCLUSIVE_TIMEOUT 500
  56. #define CY_PROXIMITY_REQUEST_EXCLUSIVE_TIMEOUT 1000
  57. #define CY_DA_REQUEST_EXCLUSIVE_TIMEOUT 500
  58. #define CY_LDR_REQUEST_EXCLUSIVE_TIMEOUT 5000
  59. #define CY_CORE_SLEEP_REQUEST_EXCLUSIVE_TIMEOUT 5000
  60. #define CY_CORE_WAIT_SYSINFO_MODE_TIMEOUT 2000
  61. #define CY_CORE_MODE_CHANGE_TIMEOUT 1000
  62. #define CY_CORE_RESET_AND_WAIT_TIMEOUT 500
  63. #define CY_CORE_WAKEUP_TIMEOUT 50
  64. #define CY_LDR_CMD_TIMEOUT 500
  65. #define CY_LDR_CMD_INIT_TIMEOUT 10000
  66. /* helpers */
  67. #define GET_NUM_TOUCH_RECORDS(x) ((x) & 0x1F)
  68. #define IS_LARGE_AREA(x) ((x) & 0x20)
  69. #define IS_BAD_PKT(x) ((x) & 0x20)
  70. #define IS_TTSP_VER_GE(p, maj, min) \
  71. ((p)->si_ptrs.cydata == NULL ? \
  72. 0 : \
  73. ((p)->si_ptrs.cydata->ttsp_ver_major < (maj) ? \
  74. 0 : \
  75. ((p)->si_ptrs.cydata->ttsp_ver_minor < (min) ? \
  76. 0 : \
  77. 1)))
  78. #define IS_BOOTLOADER(hst_mode, reset_detect) \
  79. ((hst_mode) & 0x01 || (reset_detect) != 0)
  80. #define IS_BOOTLOADER_IDLE(hst_mode, reset_detect) \
  81. ((hst_mode) & 0x01 && (reset_detect) & 0x01)
  82. #define GET_HSTMODE(reg) ((reg & 0x70) >> 4)
  83. #define GET_TOGGLE(reg) ((reg & 0x80) >> 7)
  84. #define IS_LITTLEENDIAN(reg) ((reg & 0x01) == 1)
  85. #define GET_PANELID(reg) (reg & 0x07)
  86. #define HI_BYTE(x) (u8)(((x) >> 8) & 0xFF)
  87. #define LO_BYTE(x) (u8)((x) & 0xFF)
  88. #define IS_DEEP_SLEEP_CONFIGURED(x) ((x) == 0 || (x) == 0xFF)
  89. #define IS_TMO(t) ((t) == 0)
  90. #define PUT_FIELD16(si, val, addr) \
  91. do { \
  92. if (IS_LITTLEENDIAN((si)->si_ptrs.cydata->device_info)) \
  93. put_unaligned_le16(val, addr); \
  94. else \
  95. put_unaligned_be16(val, addr); \
  96. } while (0)
  97. #define GET_FIELD16(si, addr) \
  98. ({ \
  99. u16 __val; \
  100. if (IS_LITTLEENDIAN((si)->si_ptrs.cydata->device_info)) \
  101. __val = get_unaligned_le16(addr); \
  102. else \
  103. __val = get_unaligned_be16(addr); \
  104. __val; \
  105. })
  106. #define RETRY_OR_EXIT(retry_cnt, retry_label, exit_label) \
  107. do { \
  108. if (retry_cnt) \
  109. goto retry_label; \
  110. goto exit_label; \
  111. } while (0)
  112. /* DEVICE REGISTERS */
  113. /* OP MODE REGISTERS */
  114. #define CY_REG_BASE 0x00
  115. enum cyttsp4_hst_mode_bits {
  116. CY_HST_TOGGLE = (1 << 7),
  117. CY_HST_MODE_CHANGE = (1 << 3),
  118. CY_HST_DEVICE_MODE = (7 << 4),
  119. CY_HST_OPERATE = (0 << 4),
  120. CY_HST_SYSINFO = (1 << 4),
  121. CY_HST_CAT = (2 << 4),
  122. CY_HST_LOWPOW = (1 << 2),
  123. CY_HST_SLEEP = (1 << 1),
  124. CY_HST_RESET = (1 << 0),
  125. };
  126. /* Touch record registers */
  127. enum cyttsp4_object_id {
  128. CY_OBJ_STANDARD_FINGER = 0,
  129. CY_OBJ_PROXIMITY = (1 << 0),
  130. CY_OBJ_STYLUS = (1 << 1),
  131. CY_OBJ_GLOVE = (1 << 2),
  132. };
  133. enum cyttsp4_event_id {
  134. CY_EV_NO_EVENT,
  135. CY_EV_TOUCHDOWN,
  136. CY_EV_MOVE, /* significant displacement (> act dist) */
  137. CY_EV_LIFTOFF, /* record reports last position */
  138. };
  139. /* Touch id */
  140. #define CY_TMA1036_MAX_TCH 0x0E
  141. #define CY_TMA4XX_MAX_TCH 0x1E
  142. /* CAT MODE REGISTERS */
  143. #define CY_REG_CAT_CMD 2
  144. #define CY_CMD_COMPLETE_MASK (1 << 6)
  145. #define CY_CMD_MASK 0x3F
  146. enum cyttsp_cmd_bits {
  147. CY_CMD_COMPLETE = (1 << 6),
  148. };
  149. /* SYSINFO REGISTERS */
  150. #define CY_NUM_REVCTRL 8
  151. #define CY_POST_CODEL_WDG_RST 0x01
  152. #define CY_POST_CODEL_CFG_DATA_CRC_FAIL 0x02
  153. #define CY_POST_CODEL_PANEL_TEST_FAIL 0x04
  154. /* touch record system information offset masks and shifts */
  155. #define CY_BYTE_OFS_MASK 0x1F
  156. #define CY_BOFS_MASK 0xE0
  157. #define CY_BOFS_SHIFT 5
  158. /* x-axis resolution of panel in pixels */
  159. #define CY_PCFG_RESOLUTION_X_MASK 0x7F
  160. /* y-axis resolution of panel in pixels */
  161. #define CY_PCFG_RESOLUTION_Y_MASK 0x7F
  162. /* x-axis, 0:origin is on left side of panel, 1: right */
  163. #define CY_PCFG_ORIGIN_X_MASK 0x80
  164. /* y-axis, 0:origin is on top side of panel, 1: bottom */
  165. #define CY_PCFG_ORIGIN_Y_MASK 0x80
  166. #define CY_NORMAL_ORIGIN 0 /* upper, left corner */
  167. #define CY_INVERT_ORIGIN 1 /* lower, right corner */
  168. /* TTSP System Information interface definitions */
  169. struct cyttsp4_cydata {
  170. u8 ttpidh;
  171. u8 ttpidl;
  172. u8 fw_ver_major;
  173. u8 fw_ver_minor;
  174. u8 revctrl[CY_NUM_REVCTRL];
  175. u8 blver_major;
  176. u8 blver_minor;
  177. u8 jtag_si_id3;
  178. u8 jtag_si_id2;
  179. u8 jtag_si_id1;
  180. u8 jtag_si_id0;
  181. u8 mfgid_sz;
  182. u8 cyito_idh;
  183. u8 cyito_idl;
  184. u8 cyito_verh;
  185. u8 cyito_verl;
  186. u8 ttsp_ver_major;
  187. u8 ttsp_ver_minor;
  188. u8 device_info;
  189. u8 mfg_id[];
  190. } __packed;
  191. struct cyttsp4_test {
  192. u8 post_codeh;
  193. u8 post_codel;
  194. } __packed;
  195. struct cyttsp4_pcfg {
  196. u8 electrodes_x;
  197. u8 electrodes_y;
  198. u8 len_xh;
  199. u8 len_xl;
  200. u8 len_yh;
  201. u8 len_yl;
  202. u8 res_xh;
  203. u8 res_xl;
  204. u8 res_yh;
  205. u8 res_yl;
  206. u8 max_zh;
  207. u8 max_zl;
  208. u8 panel_info0;
  209. } __packed;
  210. #define CY_NUM_TCH_FIELDS 7
  211. #define CY_NUM_EXT_TCH_FIELDS 3
  212. struct cyttsp4_tch_rec_params {
  213. u8 loc;
  214. u8 size;
  215. } __packed;
  216. struct cyttsp4_opcfg {
  217. u8 cmd_ofs;
  218. u8 rep_ofs;
  219. u8 rep_szh;
  220. u8 rep_szl;
  221. u8 num_btns;
  222. u8 tt_stat_ofs;
  223. u8 obj_cfg0;
  224. u8 max_tchs;
  225. u8 tch_rec_size;
  226. struct cyttsp4_tch_rec_params tch_rec_old[CY_NUM_TCH_FIELDS];
  227. u8 btn_rec_size;/* btn record size (in bytes) */
  228. u8 btn_diff_ofs;/* btn data loc ,diff counts, (Op-Mode byte ofs) */
  229. u8 btn_diff_size;/* btn size of diff counts (in bits) */
  230. struct cyttsp4_tch_rec_params tch_rec_new[CY_NUM_EXT_TCH_FIELDS];
  231. u8 noise_data_ofs;
  232. u8 noise_data_sz;
  233. } __packed;
  234. struct cyttsp4_sysinfo_data {
  235. u8 hst_mode;
  236. u8 reserved;
  237. u8 map_szh;
  238. u8 map_szl;
  239. u8 cydata_ofsh;
  240. u8 cydata_ofsl;
  241. u8 test_ofsh;
  242. u8 test_ofsl;
  243. u8 pcfg_ofsh;
  244. u8 pcfg_ofsl;
  245. u8 opcfg_ofsh;
  246. u8 opcfg_ofsl;
  247. u8 ddata_ofsh;
  248. u8 ddata_ofsl;
  249. u8 mdata_ofsh;
  250. u8 mdata_ofsl;
  251. } __packed;
  252. /* FLASH BLOCKS */
  253. enum cyttsp4_ic_ebid {
  254. CY_TCH_PARM_EBID,
  255. CY_MDATA_EBID,
  256. CY_DDATA_EBID,
  257. CY_EBID_NUM,
  258. };
  259. /* ttconfig block */
  260. #define CY_TTCONFIG_VERSION_OFFSET 8
  261. #define CY_TTCONFIG_VERSION_SIZE 2
  262. #define CY_TTCONFIG_VERSION_ROW 0
  263. #define CY_CONFIG_LENGTH_INFO_OFFSET 0
  264. #define CY_CONFIG_LENGTH_INFO_SIZE 4
  265. #define CY_CONFIG_LENGTH_OFFSET 0
  266. #define CY_CONFIG_LENGTH_SIZE 2
  267. #define CY_CONFIG_MAXLENGTH_OFFSET 2
  268. #define CY_CONFIG_MAXLENGTH_SIZE 2
  269. /* DEBUG */
  270. /* drv_debug commands */
  271. #define CY_DBG_SUSPEND 4
  272. #define CY_DBG_RESUME 5
  273. #define CY_DBG_SOFT_RESET 97
  274. #define CY_DBG_RESET 98
  275. /* Debug buffer */
  276. #define CY_MAX_PRBUF_SIZE PIPE_BUF
  277. #define CY_PR_TRUNCATED " truncated..."
  278. /* CMD */
  279. enum cyttsp4_cmd_cat {
  280. CY_CMD_CAT_NULL,
  281. CY_CMD_CAT_RESERVED_1,
  282. CY_CMD_CAT_GET_CFG_ROW_SZ,
  283. CY_CMD_CAT_READ_CFG_BLK,
  284. CY_CMD_CAT_WRITE_CFG_BLK,
  285. CY_CMD_CAT_RESERVED_2,
  286. CY_CMD_CAT_LOAD_SELF_TEST_DATA,
  287. CY_CMD_CAT_RUN_SELF_TEST,
  288. CY_CMD_CAT_GET_SELF_TEST_RESULT,
  289. CY_CMD_CAT_CALIBRATE_IDACS,
  290. CY_CMD_CAT_INIT_BASELINES,
  291. CY_CMD_CAT_EXEC_PANEL_SCAN,
  292. CY_CMD_CAT_RETRIEVE_PANEL_SCAN,
  293. CY_CMD_CAT_START_SENSOR_DATA_MODE,
  294. CY_CMD_CAT_STOP_SENSOR_DATA_MODE,
  295. CY_CMD_CAT_INT_PIN_MODE,
  296. CY_CMD_CAT_RETRIEVE_DATA_STRUCTURE,
  297. CY_CMD_CAT_VERIFY_CFG_BLK_CRC,
  298. CY_CMD_CAT_RESERVED_N,
  299. };
  300. enum cyttsp4_cmd_op {
  301. CY_CMD_OP_NULL,
  302. CY_CMD_OP_RESERVED_1,
  303. CY_CMD_OP_GET_PARAM,
  304. CY_CMD_OP_SET_PARAM,
  305. CY_CMD_OP_RESERVED_2,
  306. CY_CMD_OP_GET_CRC,
  307. CY_CMD_OP_WAIT_FOR_EVENT,
  308. };
  309. enum cyttsp4_cmd_status {
  310. CY_CMD_STATUS_SUCCESS,
  311. CY_CMD_STATUS_FAILURE,
  312. };
  313. /* Operational Mode Command Sizes */
  314. /* NULL Command */
  315. #define CY_CMD_OP_NULL_CMD_SZ 1
  316. #define CY_CMD_OP_NULL_RET_SZ 0
  317. /* Get Parameter */
  318. #define CY_CMD_OP_GET_PARAM_CMD_SZ 2
  319. #define CY_CMD_OP_GET_PARAM_RET_SZ 6
  320. /* Set Parameter */
  321. #define CY_CMD_OP_SET_PARAM_CMD_SZ 7
  322. #define CY_CMD_OP_SET_PARAM_RET_SZ 2
  323. /* Get Config Block CRC */
  324. #define CY_CMD_OP_GET_CFG_BLK_CRC_CMD_SZ 2
  325. #define CY_CMD_OP_GET_CFG_BLK_CRC_RET_SZ 3
  326. /* Wait For Event */
  327. #define CY_CMD_OP_WAIT_FOR_EVENT_CMD_SZ 2
  328. /* CaT Mode Command Sizes */
  329. /* NULL Command */
  330. #define CY_CMD_CAT_NULL_CMD_SZ 1
  331. #define CY_CMD_CAT_NULL_RET_SZ 0
  332. /* Get Config Row Size */
  333. #define CY_CMD_CAT_GET_CFG_ROW_SIZE_CMD_SZ 1
  334. #define CY_CMD_CAT_GET_CFG_ROW_SIZE_RET_SZ 2
  335. /* Read Config Block */
  336. #define CY_CMD_CAT_READ_CFG_BLK_CMD_SZ 6
  337. #define CY_CMD_CAT_READ_CFG_BLK_RET_SZ 7 /* + Data */
  338. #define CY_CMD_CAT_READ_CFG_BLK_RET_HDR_SZ 5
  339. /* Write Config Block */
  340. #define CY_CMD_CAT_WRITE_CFG_BLK_CMD_SZ 8 /* + Data + Security Key */
  341. #define CY_CMD_CAT_WRITE_CFG_BLK_RET_SZ 5
  342. #define CY_CMD_CAT_WRITE_CFG_BLK_CMD_HDR_SZ 6
  343. /* Load Self-Test Data */
  344. #define CY_CMD_CAT_LOAD_SELFTEST_DATA_CMD_SZ 6
  345. #define CY_CMD_CAT_LOAD_SELFTEST_DATA_RET_SZ 5 /* + Data */
  346. /* Run Self-Test */
  347. #define CY_CMD_CAT_RUN_SELFTEST_CMD_SZ 2
  348. #define CY_CMD_CAT_RUN_SELFTEST_RET_SZ 3
  349. /* Calibrate IDACs */
  350. #define CY_CMD_CAT_CALIBRATE_IDAC_CMD_SZ 2
  351. #define CY_CMD_CAT_CALIBRATE_IDAC_RET_SZ 1
  352. /* Get Self-Test Results */
  353. #define CY_CMD_CAT_GET_SELFTEST_RES_CMD_SZ 6
  354. #define CY_CMD_CAT_GET_SELFTEST_RES_RET_SZ 5 /* + Data */
  355. /* Initialize Baselines */
  356. #define CY_CMD_CAT_INIT_BASELINE_CMD_SZ 2
  357. #define CY_CMD_CAT_INIT_BASELINE_RET_SZ 1
  358. /* Execute Panel Scan */
  359. #define CY_CMD_CAT_EXECUTE_PANEL_SCAN_CMD_SZ 1
  360. #define CY_CMD_CAT_EXECUTE_PANEL_SCAN_RET_SZ 1
  361. /* Retrieve Panel Scan */
  362. #define CY_CMD_CAT_RETRIEVE_PANEL_SCAN_CMD_SZ 6
  363. #define CY_CMD_CAT_RETRIEVE_PANEL_SCAN_RET_SZ 5 /* + Data */
  364. /* Start Sensor Data Mode */
  365. #define CY_CMD_CAT_START_SENSOR_MODE_CMD_SZ 1 /* + Data */
  366. #define CY_CMD_CAT_START_SENSOR_MODE_RET_SZ 0 /* + Data */
  367. /* Stop Sensor Data Mode */
  368. #define CY_CMD_CAT_STOP_SENSOR_MODE_CMD_SZ 1
  369. #define CY_CMD_CAT_STOP_SENSOR_MODE_RET_SZ 0
  370. /* Interrupt Pin Override */
  371. #define CY_CMD_CAT_INT_PIN_OVERRIDE_CMD_SZ 2
  372. #define CY_CMD_CAT_INT_PIN_OVERRIDE_RET_SZ 1
  373. /* Retrieve Data Structure */
  374. #define CY_CMD_CAT_RETRIEVE_DATA_STRUCT_CMD_SZ 6
  375. #define CY_CMD_CAT_RETRIEVE_DATA_STRUCT_RET_SZ 5 /* + Data */
  376. /* Verify Config Block CRC */
  377. #define CY_CMD_CAT_VERIFY_CFG_BLK_CRC_CMD_SZ 2
  378. #define CY_CMD_CAT_VERIFY_CFG_BLK_CRC_RET_SZ 5
  379. /* RAM ID */
  380. #define CY_RAM_ID_ACTIVE_DISTANCE 0x4A
  381. #define CY_RAM_ID_SCAN_TYPE 0x4B
  382. #define CY_RAM_ID_LOW_POWER_INTERVAL 0x4C
  383. #define CY_RAM_ID_REFRESH_INTERVAL 0x4D
  384. #define CY_RAM_ID_ACTIVE_MODE_TIMEOUT 0x4E
  385. #define CY_RAM_ID_ACTIVE_LFT_INTERVAL 0x4F
  386. #define CY_RAM_ID_ACTIVE_DISTANCE2 0x50
  387. #define CY_RAM_ID_CHARGER_STATUS 0x51
  388. #define CY_RAM_ID_IMO_TRIM_VALUE 0x52
  389. #define CY_RAM_ID_FINGER_THRESHOLH 0x93
  390. #define CY_RAM_ID_DETECT_AREA_MARGIN_X 0x58
  391. #define CY_RAM_ID_DETECT_AREA_MARGIN_Y 0x59
  392. #define CY_RAM_ID_GRIP_XEDGE_A 0x70
  393. #define CY_RAM_ID_GRIP_XEDGE_B 0x71
  394. #define CY_RAM_ID_GRIP_XEXC_A 0x72
  395. #define CY_RAM_ID_GRIP_XEXC_B 0x73
  396. #define CY_RAM_ID_GRIP_YEDGE_A 0x74
  397. #define CY_RAM_ID_GRIP_YEDGE_B 0x75
  398. #define CY_RAM_ID_GRIP_YEXC_A 0x76
  399. #define CY_RAM_ID_GRIP_YEXC_B 0x77
  400. #define CY_RAM_ID_GRIP_FIRST_EXC 0x78
  401. #define CY_RAM_ID_GRIP_EXC_EDGE_ORIGIN 0x79
  402. #define CY_RAM_ID_PROX_ACTIVE_DIST_Z_VALUE 0x9B
  403. #define CY_RAM_ID_BTN_THRSH_MUT 0xA0
  404. #define CY_RAM_ID_TOUCHMODE_ENABLED 0xD0 /* Enable proximity */
  405. #ifdef CONFIG_SEC_DVFS
  406. #define TSP_BOOSTER
  407. #else
  408. #undef TSP_BOOSTER
  409. #endif
  410. /* TOUCH PARSE */
  411. /* abs signal capabilities offsets in the frameworks array */
  412. enum cyttsp4_sig_caps {
  413. CY_SIGNAL_OST,
  414. CY_MIN_OST,
  415. CY_MAX_OST,
  416. CY_FUZZ_OST,
  417. CY_FLAT_OST,
  418. CY_NUM_ABS_SET /* number of signal capability fields */
  419. };
  420. /* abs axis signal offsets in the framworks array */
  421. enum cyttsp4_sig_ost {
  422. CY_ABS_X_OST,
  423. CY_ABS_Y_OST,
  424. CY_ABS_P_OST,
  425. CY_ABS_W_OST,
  426. CY_ABS_ID_OST,
  427. CY_ABS_MAJ_OST,
  428. CY_ABS_MIN_OST,
  429. CY_ABS_OR_OST,
  430. CY_NUM_ABS_OST /* number of abs signals */
  431. };
  432. enum cyttsp4_tch_abs { /* for ordering within the extracted touch data array */
  433. CY_TCH_X, /* X */
  434. CY_TCH_Y, /* Y */
  435. CY_TCH_P, /* P (Z) */
  436. CY_TCH_T, /* TOUCH ID */
  437. CY_TCH_E, /* EVENT ID */
  438. CY_TCH_O, /* OBJECT ID */
  439. CY_TCH_W, /* SIZE */
  440. CY_TCH_MAJ, /* TOUCH_MAJOR */
  441. CY_TCH_MIN, /* TOUCH_MINOR */
  442. CY_TCH_OR, /* ORIENTATION */
  443. CY_TCH_NUM_ABS
  444. };
  445. static const char * const cyttsp4_tch_abs_string[] = {
  446. [CY_TCH_X] = "X",
  447. [CY_TCH_Y] = "Y",
  448. [CY_TCH_P] = "P",
  449. [CY_TCH_T] = "T",
  450. [CY_TCH_E] = "E",
  451. [CY_TCH_O] = "O",
  452. [CY_TCH_W] = "W",
  453. [CY_TCH_MAJ] = "MAJ",
  454. [CY_TCH_MIN] = "MIN",
  455. [CY_TCH_OR] = "OR",
  456. [CY_TCH_NUM_ABS] = "INVALID"
  457. };
  458. /* scan_type ram id, scan values */
  459. #define CY_SCAN_TYPE_GLOVE 0x8
  460. #define CY_SCAN_TYPE_STYLUS 0x10
  461. #define CY_SCAN_TYPE_PROXIMITY 0x40
  462. #define CY_SCAN_TYPE_APA_MC 0x80
  463. enum cyttsp4_scan_type {
  464. CY_ST_APA_MC,
  465. CY_ST_GLOVE,
  466. CY_ST_STYLUS,
  467. CY_ST_PROXIMITY,
  468. };
  469. /* DRIVER STATES */
  470. enum cyttsp4_mode {
  471. CY_MODE_UNKNOWN = 0,
  472. CY_MODE_BOOTLOADER = (1 << 0),
  473. CY_MODE_OPERATIONAL = (1 << 1),
  474. CY_MODE_SYSINFO = (1 << 2),
  475. CY_MODE_CAT = (1 << 3),
  476. CY_MODE_STARTUP = (1 << 4),
  477. CY_MODE_LOADER = (1 << 5),
  478. CY_MODE_CHANGE_MODE = (1 << 6),
  479. CY_MODE_CHANGED = (1 << 7),
  480. CY_MODE_CMD_COMPLETE = (1 << 8),
  481. };
  482. enum cyttsp4_int_state {
  483. CY_INT_NONE,
  484. CY_INT_IGNORE = (1 << 0),
  485. CY_INT_MODE_CHANGE = (1 << 1),
  486. CY_INT_EXEC_CMD = (1 << 2),
  487. CY_INT_AWAKE = (1 << 3),
  488. };
  489. enum cyttsp4_sleep_state {
  490. SS_SLEEP_OFF,
  491. SS_SLEEP_ON,
  492. SS_SLEEPING,
  493. SS_WAKING,
  494. };
  495. enum cyttsp4_startup_state {
  496. STARTUP_NONE,
  497. STARTUP_QUEUED,
  498. STARTUP_RUNNING,
  499. };
  500. enum cyttsp4_atten_type {
  501. CY_ATTEN_IRQ,
  502. CY_ATTEN_STARTUP,
  503. CY_ATTEN_EXCLUSIVE,
  504. CY_ATTEN_WAKE,
  505. CY_ATTEN_LOADER,
  506. CY_ATTEN_NUM_ATTEN,
  507. };
  508. enum cyttsp4_module_id {
  509. CY_MODULE_MT,
  510. CY_MODULE_BTN,
  511. CY_MODULE_PROX,
  512. CY_MODULE_DEBUG,
  513. CY_MODULE_LOADER,
  514. CY_MODULE_DEVICE_ACCESS,
  515. CY_MODULE_LAST,
  516. };
  517. struct cyttsp4_sysinfo_ptr {
  518. struct cyttsp4_cydata *cydata;
  519. struct cyttsp4_test *test;
  520. struct cyttsp4_pcfg *pcfg;
  521. struct cyttsp4_opcfg *opcfg;
  522. struct cyttsp4_ddata *ddata;
  523. struct cyttsp4_mdata *mdata;
  524. };
  525. struct cyttsp4_touch {
  526. int abs[CY_TCH_NUM_ABS];
  527. };
  528. struct cyttsp4_tch_abs_params {
  529. size_t ofs; /* abs byte offset */
  530. size_t size; /* size in bits */
  531. size_t max; /* max value */
  532. size_t bofs; /* bit offset */
  533. };
  534. struct cyttsp4_sysinfo_ofs {
  535. size_t chip_type;
  536. size_t cmd_ofs;
  537. size_t rep_ofs;
  538. size_t rep_sz;
  539. size_t num_btns;
  540. size_t num_btn_regs; /* ceil(num_btns/4) */
  541. size_t tt_stat_ofs;
  542. size_t tch_rec_size;
  543. size_t obj_cfg0;
  544. size_t max_tchs;
  545. size_t mode_size;
  546. size_t data_size;
  547. size_t rep_hdr_size;
  548. size_t map_sz;
  549. size_t max_x;
  550. size_t x_origin; /* left or right corner */
  551. size_t max_y;
  552. size_t y_origin; /* upper or lower corner */
  553. size_t max_p;
  554. size_t cydata_ofs;
  555. size_t test_ofs;
  556. size_t pcfg_ofs;
  557. size_t opcfg_ofs;
  558. size_t ddata_ofs;
  559. size_t mdata_ofs;
  560. size_t cydata_size;
  561. size_t test_size;
  562. size_t pcfg_size;
  563. size_t opcfg_size;
  564. size_t ddata_size;
  565. size_t mdata_size;
  566. size_t btn_keys_size;
  567. struct cyttsp4_tch_abs_params tch_abs[CY_TCH_NUM_ABS];
  568. size_t btn_rec_size; /* btn record size (in bytes) */
  569. size_t btn_diff_ofs;/* btn data loc ,diff counts, (Op-Mode byte ofs) */
  570. size_t btn_diff_size;/* btn size of diff counts (in bits) */
  571. size_t noise_data_ofs;
  572. size_t noise_data_sz;
  573. };
  574. /* button to keycode support */
  575. #define CY_NUM_BTN_PER_REG 4
  576. #define CY_BITS_PER_BTN 2
  577. enum cyttsp4_btn_state {
  578. CY_BTN_RELEASED,
  579. CY_BTN_PRESSED,
  580. CY_BTN_NUM_STATE
  581. };
  582. struct cyttsp4_btn {
  583. bool enabled;
  584. int state; /* CY_BTN_PRESSED, CY_BTN_RELEASED */
  585. int key_code;
  586. };
  587. struct cyttsp4_ttconfig {
  588. u16 version;
  589. u16 length;
  590. u16 max_length;
  591. u16 crc;
  592. };
  593. #ifdef SAMSUNG_TSP_INFO
  594. struct cyttsp4_samsung_tsp_info {
  595. u8 ic_vendorh;
  596. u8 ic_vendorl;
  597. u8 module_vendorh;
  598. u8 module_vendorl;
  599. u8 hw_version;
  600. u8 fw_versionh;
  601. u8 fw_versionl;
  602. u8 config_version;
  603. u8 ic_series;
  604. u8 num_sensor_x;
  605. u8 num_sensor_y;
  606. u8 resolution_xh;
  607. u8 resolution_xl;
  608. u8 resolution_yh;
  609. u8 resolution_yl;
  610. u8 button_info;
  611. u8 set_comb_info;
  612. } __packed;
  613. #endif//SAMSUNG_TSP_INFO
  614. struct cyttsp4_sysinfo {
  615. bool ready;
  616. struct cyttsp4_sysinfo_data si_data;
  617. struct cyttsp4_sysinfo_ptr si_ptrs;
  618. struct cyttsp4_sysinfo_ofs si_ofs;
  619. struct cyttsp4_ttconfig ttconfig;
  620. struct cyttsp4_btn *btn; /* button states */
  621. u8 *btn_rec_data; /* button diff count data */
  622. u8 *xy_mode; /* operational mode and status regs */
  623. u8 *xy_data; /* operational touch regs */
  624. #ifdef SAMSUNG_TSP_INFO
  625. struct cyttsp4_samsung_tsp_info *sti;
  626. #endif
  627. };
  628. /* device_access */
  629. enum cyttsp4_ic_grpnum {
  630. CY_IC_GRPNUM_RESERVED,
  631. CY_IC_GRPNUM_CMD_REGS,
  632. CY_IC_GRPNUM_TCH_REP,
  633. CY_IC_GRPNUM_DATA_REC,
  634. CY_IC_GRPNUM_TEST_REC,
  635. CY_IC_GRPNUM_PCFG_REC,
  636. CY_IC_GRPNUM_TCH_PARM_VAL,
  637. CY_IC_GRPNUM_TCH_PARM_SIZE,
  638. CY_IC_GRPNUM_RESERVED1,
  639. CY_IC_GRPNUM_RESERVED2,
  640. CY_IC_GRPNUM_OPCFG_REC,
  641. CY_IC_GRPNUM_DDATA_REC,
  642. CY_IC_GRPNUM_MDATA_REC,
  643. CY_IC_GRPNUM_TEST_REGS,
  644. CY_IC_GRPNUM_BTN_KEYS,
  645. CY_IC_GRPNUM_TTHE_REGS,
  646. CY_IC_GRPNUM_NUM
  647. };
  648. /* test mode NULL command driver codes */
  649. enum cyttsp4_null_test_cmd_code {
  650. CY_NULL_CMD_NULL,
  651. CY_NULL_CMD_MODE,
  652. CY_NULL_CMD_STATUS_SIZE,
  653. CY_NULL_CMD_HANDSHAKE,
  654. CY_NULL_CMD_LOW_POWER,
  655. };
  656. enum cyttsp4_test_mode {
  657. CY_TEST_MODE_NORMAL_OP, /* Send touch data to OS; normal op */
  658. CY_TEST_MODE_CAT, /* Configuration and Test */
  659. CY_TEST_MODE_SYSINFO, /* System information mode */
  660. CY_TEST_MODE_CLOSED_UNIT, /* Send scan data to sysfs */
  661. };
  662. struct cyttsp4_test_mode_params {
  663. int cur_mode;
  664. int cur_cmd;
  665. size_t cur_status_size;
  666. };
  667. /* FW file name */
  668. #define CY_FW_FILE_NAME "cyttsp4_fw.bin"
  669. /* Communication bus values */
  670. #define CY_DEFAULT_ADAP_MAX_XFER 256
  671. #define CY_ADAP_MIN_XFER 140
  672. /* Core module */
  673. #define CY_DEFAULT_CORE_ID "cyttsp4_core0"
  674. #define CY_MAX_NUM_CORE_DEVS 5
  675. struct cyttsp4_mt_data;
  676. struct cyttsp4_mt_function {
  677. int (*mt_release)(struct device *dev);
  678. int (*mt_probe)(struct device *dev, struct cyttsp4_mt_data *md);
  679. void (*report_slot_liftoff)(struct cyttsp4_mt_data *md, int max_slots);
  680. void (*input_sync)(struct input_dev *input);
  681. void (*input_report)(struct input_dev *input, int sig, int t, int type);
  682. void (*final_sync)(struct input_dev *input, int max_slots,
  683. int mt_sync_count, unsigned long *ids);
  684. int (*input_register_device)(struct input_dev *input, int max_slots);
  685. };
  686. struct cyttsp4_mt_data {
  687. struct device *dev;
  688. struct cyttsp4_mt_platform_data *pdata;
  689. struct cyttsp4_sysinfo *si;
  690. struct input_dev *input;
  691. struct cyttsp4_mt_function mt_function;
  692. struct mutex mt_lock;
  693. #if defined(TSP_BOOSTER)
  694. u8 touch_pressed_num;
  695. struct delayed_work work_dvfs_off;
  696. struct delayed_work work_dvfs_chg;
  697. bool dvfs_lock_status;
  698. struct mutex dvfs_lock;
  699. int dvfs_old_status;
  700. unsigned char boost_level;
  701. int dvfs_freq;
  702. #endif
  703. bool input_device_registered;
  704. char phys[NAME_MAX];
  705. int num_prv_rec; /* Number of previous touch records */
  706. int prv_tch_type;
  707. };
  708. struct cyttsp4_btn_data {
  709. struct device *dev;
  710. struct cyttsp4_btn_platform_data *pdata;
  711. struct cyttsp4_sysinfo *si;
  712. struct input_dev *input;
  713. struct mutex btn_lock;
  714. bool is_suspended;
  715. bool input_device_registered;
  716. char phys[NAME_MAX];
  717. };
  718. struct cyttsp4_proximity_data {
  719. struct device *dev;
  720. struct cyttsp4_proximity_platform_data *pdata;
  721. struct cyttsp4_sysinfo *si;
  722. struct input_dev *input;
  723. struct mutex prox_lock;
  724. struct mutex sysfs_lock;
  725. int enable_count;
  726. bool input_device_registered;
  727. char phys[NAME_MAX];
  728. };
  729. typedef int (*cyttsp4_atten_func) (struct device *);
  730. struct cyttsp4_core_commands {
  731. int (*subscribe_attention)(struct device *dev,
  732. enum cyttsp4_atten_type type, char id, cyttsp4_atten_func func,
  733. int flags);
  734. int (*unsubscribe_attention)(struct device *dev,
  735. enum cyttsp4_atten_type type, char id, cyttsp4_atten_func func,
  736. int flags);
  737. int (*request_exclusive)(struct device *dev, int timeout_ms);
  738. int (*release_exclusive)(struct device *dev);
  739. int (*request_reset)(struct device *dev);
  740. int (*request_restart)(struct device *dev, bool wait);
  741. int (*request_set_mode)(struct device *dev, int mode);
  742. struct cyttsp4_sysinfo * (*request_sysinfo)(struct device *dev);
  743. struct cyttsp4_loader_platform_data
  744. *(*request_loader_pdata)(struct device *dev);
  745. int (*request_handshake)(struct device *dev, u8 mode);
  746. int (*request_exec_cmd)(struct device *dev, u8 mode, u8 *cmd_buf,
  747. size_t cmd_size, u8 *return_buf, size_t return_buf_size,
  748. int timeout_ms);
  749. int (*request_stop_wd)(struct device *dev);
  750. int (*request_toggle_lowpower)(struct device *dev, u8 mode);
  751. int (*request_config_row_size)(struct device *dev,
  752. u16 *config_row_size);
  753. int (*request_write_config)(struct device *dev, u8 ebid, u16 offset,
  754. u8 *data, u16 length);
  755. int (*request_enable_scan_type)(struct device *dev, u8 scan_type);
  756. int (*request_disable_scan_type)(struct device *dev, u8 scan_type);
  757. const u8 * (*get_security_key)(struct device *dev, int *size);
  758. void (*get_touch_record)(struct device *dev, int rec_no, int *rec_abs);
  759. int (*write)(struct device *dev, int mode, u16 addr, const void *buf,
  760. int size);
  761. int (*read)(struct device *dev, int mode, u16 addr, void *buf,
  762. int size);
  763. struct cyttsp4_sysinfo * (*update_sysinfo)(struct device *dev);
  764. int (*exec_panel_scan)(struct device *dev);
  765. int (*retrieve_panel_scan)(struct device *dev, int read_offset,
  766. int num_element, u8 data_type, u8 *return_buf);
  767. int (*scan_and_retrieve)(struct device *dev, bool switch_to_cat, bool scan_start, int read_offset,
  768. int num_element, u8 data_type, u8 *big_buf, int *r_read_element_offset, u8 *element_size);
  769. int (*retrieve_data_structure)(struct device *dev, int read_offset,
  770. int num_element, u8 data_id, u8 *big_buf);
  771. };
  772. #define CY_CMD_IN_DATA_OFFSET_VALUE 0
  773. #define CY_CMD_OUT_STATUS_OFFSET 0
  774. #define CY_CMD_RET_PNL_OUT_ELMNT_SZ_OFFS_H 2
  775. #define CY_CMD_RET_PNL_OUT_ELMNT_SZ_OFFS_L 3
  776. #define CY_CMD_RET_PNL_OUT_DATA_FORMAT_OFFS 4
  777. #define CY_CMD_RET_PNL_OUT_DATA_OFFS 8
  778. #define CY_CMD_RET_PANEL_ELMNT_SZ_MASK 0x07
  779. enum cyttsp4_scan_data_type {
  780. CY_SDT_MUT_RAW = 0x00,
  781. CY_SDT_MUT_BASE,
  782. CY_SDT_MUT_DIFF,
  783. CY_SDT_SELF_RAW,
  784. CY_SDT_SELF_BASE,
  785. CY_SDT_SELF_DIFF,
  786. CY_SDT_BTN = 0x09
  787. };
  788. #ifdef SAMSUNG_SYSFS
  789. #define FACTORY_CMD_STR_LEN 32
  790. #define FACTORY_CMD_RESULT_STR_LEN 128
  791. #define FACTORY_CMD_PARAM_NUM 8
  792. struct cyttsp4_samsung_sysfs_data {
  793. struct device *dev;
  794. struct device *dev_factory;
  795. struct device *dev_screen;
  796. struct device *dev_key;
  797. struct cyttsp4_core_commands* corecmd;
  798. struct cyttsp4_sysinfo *si;
  799. struct list_head factory_cmd_list_head;
  800. struct mutex factory_cmd_lock;
  801. int factory_cmd_state;
  802. int factory_cmd_param[FACTORY_CMD_PARAM_NUM];
  803. char factory_cmd[FACTORY_CMD_STR_LEN];
  804. char factory_cmd_result[FACTORY_CMD_RESULT_STR_LEN];
  805. bool factory_cmd_is_running;
  806. bool sysfs_nodes_created;
  807. u8 *screen_buf;// raw, diff, global, local
  808. u8 *btn_buf;// raw, diff, global, local
  809. u8 raw_diff_element_size;
  810. int num_all_nodes;
  811. int num_btns;
  812. };
  813. #endif//SAMSUNG_SYSFS
  814. struct cyttsp4_core_data {
  815. struct list_head node;
  816. char core_id[20];
  817. struct device *dev;
  818. struct list_head atten_list[CY_ATTEN_NUM_ATTEN];
  819. struct mutex system_lock;
  820. struct mutex adap_lock;
  821. enum cyttsp4_mode mode;
  822. enum cyttsp4_sleep_state sleep_state;
  823. enum cyttsp4_startup_state startup_state;
  824. int int_status;
  825. int cmd_toggle;
  826. spinlock_t spinlock;
  827. struct cyttsp4_mt_data md;
  828. struct cyttsp4_btn_data bd;
  829. struct cyttsp4_proximity_data pd;
  830. #ifdef SAMSUNG_SYSFS
  831. struct cyttsp4_samsung_sysfs_data ssd;
  832. #endif
  833. int phys_num;
  834. int number_of_open_input_device;
  835. int pm_runtime_usage_count;
  836. void *cyttsp4_dynamic_data[CY_MODULE_LAST];
  837. struct cyttsp4_platform_data *pdata;
  838. struct cyttsp4_core_platform_data *cpdata;
  839. const struct cyttsp4_bus_ops *bus_ops;
  840. wait_queue_head_t wait_q;
  841. int irq;
  842. struct work_struct startup_work;
  843. struct cyttsp4_sysinfo sysinfo;
  844. void *exclusive_dev;
  845. int exclusive_waits;
  846. atomic_t ignore_irq;
  847. bool irq_enabled;
  848. bool irq_wake;
  849. bool irq_disabled;
  850. bool wake_initiated_by_device;
  851. bool bl_fast_exit;
  852. bool invalid_touch_app;
  853. int max_xfer;
  854. int apa_mc_en;
  855. int glove_en;
  856. int stylus_en;
  857. int proximity_en;
  858. u8 default_scantype;
  859. u8 easy_wakeup_gesture;
  860. unsigned int active_refresh_cycle_ms;
  861. u8 heartbeat_count;
  862. struct work_struct watchdog_work;
  863. struct timer_list watchdog_timer;
  864. u8 wr_buf[CY_DEFAULT_ADAP_MAX_XFER];
  865. #ifdef CONFIG_HAS_EARLYSUSPEND
  866. struct early_suspend es;
  867. #endif
  868. #ifdef VERBOSE_DEBUG
  869. u8 pr_buf[CY_MAX_PRBUF_SIZE];
  870. #endif
  871. };
  872. struct cyttsp4_bus_ops {
  873. int (*write)(struct device *dev, u16 addr, u8 *wr_buf,
  874. const void *buf, int size, int max_xfer);
  875. int (*read)(struct device *dev, u16 addr, void *buf,
  876. int size, int max_xfer);
  877. };
  878. static inline void *cyttsp4_get_dynamic_data(struct device *dev, int id)
  879. {
  880. struct cyttsp4_core_data *cd = dev_get_drvdata(dev);
  881. return cd->cyttsp4_dynamic_data[id];
  882. }
  883. void cyttsp4_get_touch_record_(struct device *dev, int rec_no, int *rec_abs);
  884. int cyttsp4_read_(struct device *dev, int mode, u16 addr, void *buf, int size);
  885. int cyttsp4_write_(struct device *dev, int mode, u16 addr, const void *buf,
  886. int size);
  887. int request_exclusive(struct cyttsp4_core_data *cd, void *ownptr,
  888. int timeout_ms);
  889. int release_exclusive(struct cyttsp4_core_data *cd, void *ownptr);
  890. static inline void cyttsp4_get_touch_record(struct device *dev, int rec_no,
  891. int *rec_abs)
  892. {
  893. cyttsp4_get_touch_record_(dev, rec_no, rec_abs);
  894. }
  895. static inline int cyttsp4_read(struct device *dev, int mode, u16 addr,
  896. void *buf, int size)
  897. {
  898. return cyttsp4_read_(dev, mode, addr, buf, size);
  899. }
  900. static inline int cyttsp4_write(struct device *dev, int mode, u16 addr,
  901. const void *buf, int size)
  902. {
  903. return cyttsp4_write_(dev, mode, addr, buf, size);
  904. }
  905. static inline int cyttsp4_request_exclusive(struct device *dev, int timeout_ms)
  906. {
  907. struct cyttsp4_core_data *cd = dev_get_drvdata(dev);
  908. return request_exclusive(cd, dev, timeout_ms);
  909. }
  910. static inline int cyttsp4_release_exclusive(struct device *dev)
  911. {
  912. struct cyttsp4_core_data *cd = dev_get_drvdata(dev);
  913. return release_exclusive(cd, dev);
  914. }
  915. #ifdef VERBOSE_DEBUG
  916. extern void cyttsp4_pr_buf(struct device *dev, u8 *pr_buf, u8 *dptr, int size,
  917. const char *data_name);
  918. #else
  919. #define cyttsp4_pr_buf(a, b, c, d, e) do { } while (0)
  920. #endif
  921. #ifdef CONFIG_TOUCHSCREEN_CYPRESS_CYTTSP4_DEVICETREE_SUPPORT
  922. int cyttsp4_devtree_create_and_get_pdata(struct device *adap_dev);
  923. int cyttsp4_devtree_clean_pdata(struct device *adap_dev);
  924. #else
  925. static inline int cyttsp4_devtree_create_and_get_pdata(struct device *adap_dev)
  926. {
  927. return 0;
  928. }
  929. static inline int cyttsp4_devtree_clean_pdata(struct device *adap_dev)
  930. {
  931. return 0;
  932. }
  933. #endif
  934. int cyttsp4_probe(const struct cyttsp4_bus_ops *ops, struct device *dev,
  935. u16 irq, size_t xfer_buf_size);
  936. int cyttsp4_release(struct cyttsp4_core_data *cd);
  937. struct cyttsp4_core_commands *cyttsp4_get_commands(void);
  938. struct cyttsp4_core_data *cyttsp4_get_core_data(char *id);
  939. int cyttsp4_mt_probe(struct device *dev);
  940. int cyttsp4_mt_release(struct device *dev);
  941. #ifdef CONFIG_TOUCHSCREEN_CYPRESS_CYTTSP4_BUTTON
  942. int cyttsp4_btn_probe(struct device *dev);
  943. int cyttsp4_btn_release(struct device *dev);
  944. #else
  945. static inline int cyttsp4_btn_probe(struct device *dev) { return 0; }
  946. static inline int cyttsp4_btn_release(struct device *dev) { return 0; }
  947. #endif
  948. #ifdef CONFIG_TOUCHSCREEN_CYPRESS_CYTTSP4_PROXIMITY
  949. int cyttsp4_proximity_probe(struct device *dev);
  950. int cyttsp4_proximity_release(struct device *dev);
  951. #else
  952. static inline int cyttsp4_proximity_probe(struct device *dev) { return 0; }
  953. static inline int cyttsp4_proximity_release(struct device *dev) { return 0; }
  954. #endif
  955. #ifdef CONFIG_TOUCHSCREEN_CYPRESS_CYTTSP4_DEBUG
  956. int cyttsp4_debug_probe(struct device *dev);
  957. int cyttsp4_debug_release(struct device *dev);
  958. #else
  959. static inline int cyttsp4_debug_probe(struct device *dev) { return 0; }
  960. static inline int cyttsp4_debug_release(struct device *dev) { return 0; }
  961. #endif
  962. #ifdef CONFIG_TOUCHSCREEN_CYPRESS_CYTTSP4_DEVICE_ACCESS
  963. int cyttsp4_device_access_probe(struct device *dev);
  964. int cyttsp4_device_access_release(struct device *dev);
  965. #else
  966. static inline int cyttsp4_device_access_probe(struct device *dev) { return 0; }
  967. static inline int cyttsp4_device_access_release(struct device *dev) { return 0; }
  968. #endif
  969. #ifdef CONFIG_TOUCHSCREEN_CYPRESS_CYTTSP4_LOADER
  970. int cyttsp4_loader_probe(struct device *dev);
  971. int cyttsp4_loader_release(struct device *dev);
  972. #else
  973. static inline int cyttsp4_loader_probe(struct device *dev) { return 0; }
  974. static inline int cyttsp4_loader_release(struct device *dev) { return 0; }
  975. #endif
  976. #ifdef SAMSUNG_SYSFS
  977. int cyttsp4_samsung_sysfs_probe(struct device *dev);
  978. int cyttsp4_samsung_sysfs_release(struct device *dev);
  979. #else
  980. static inline int cyttsp4_samsung_sysfs_probe(struct device *dev) { return 0; }
  981. static inline int cyttsp4_samsung_sysfs_release(struct device *dev) { return 0; }
  982. #endif
  983. void cyttsp4_init_function_ptrs(struct cyttsp4_mt_data *md);
  984. int _cyttsp4_subscribe_attention(struct device *dev,
  985. enum cyttsp4_atten_type type, char id, int (*func)(struct device *),
  986. int mode);
  987. int _cyttsp4_unsubscribe_attention(struct device *dev,
  988. enum cyttsp4_atten_type type, char id, int (*func)(struct device *),
  989. int mode);
  990. struct cyttsp4_sysinfo *cyttsp4_request_sysinfo_(struct device *dev);
  991. int cyttsp4_request_disable_scan_type_(struct device *dev, u8 scan_type);
  992. int cyttsp4_request_enable_scan_type_(struct device *dev, u8 scan_type);
  993. extern const struct dev_pm_ops cyttsp4_pm_ops;
  994. int cyttsp4_core_suspend(struct device *dev);
  995. int cyttsp4_core_resume(struct device *dev);
  996. int upgrade_firmware_from_platform(struct device *dev, bool forced);
  997. int upgrade_firmware_from_sdcard(struct device *dev);
  998. #endif /* _CYTTSP4_REGS_H */