Linux Audio

Check our new training course

Loading...
v6.2
  1/* SPDX-License-Identifier: GPL-2.0-only */
  2/*
  3 * Header file for:
  4 * Cypress TrueTouch(TM) Standard Product (TTSP) touchscreen drivers.
  5 * For use with Cypress Txx3xx parts.
  6 * Supported parts include:
  7 * CY8CTST341
  8 * CY8CTMA340
  9 *
 10 * Copyright (C) 2009, 2010, 2011 Cypress Semiconductor, Inc.
 11 * Copyright (C) 2012 Javier Martinez Canillas <javier@dowhile0.org>
 12 *
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 13 * Contact Cypress Semiconductor at www.cypress.com <kev@cypress.com>
 
 14 */
 15
 16
 17#ifndef __CYTTSP_CORE_H__
 18#define __CYTTSP_CORE_H__
 19
 20#include <linux/kernel.h>
 21#include <linux/err.h>
 22#include <linux/module.h>
 23#include <linux/types.h>
 24#include <linux/device.h>
 25#include <linux/regulator/consumer.h>
 26
 27#define CY_NUM_RETRY		16 /* max number of retries for read ops */
 28
 29struct cyttsp_tch {
 30	__be16 x, y;
 31	u8 z;
 32} __packed;
 33
 34/* TrueTouch Standard Product Gen3 interface definition */
 35struct cyttsp_xydata {
 36	u8 hst_mode;
 37	u8 tt_mode;
 38	u8 tt_stat;
 39	struct cyttsp_tch tch1;
 40	u8 touch12_id;
 41	struct cyttsp_tch tch2;
 42	u8 gest_cnt;
 43	u8 gest_id;
 44	struct cyttsp_tch tch3;
 45	u8 touch34_id;
 46	struct cyttsp_tch tch4;
 47	u8 tt_undef[3];
 48	u8 act_dist;
 49	u8 tt_reserved;
 50} __packed;
 51
 52
 53/* TTSP System Information interface definition */
 54struct cyttsp_sysinfo_data {
 55	u8 hst_mode;
 56	u8 mfg_stat;
 57	u8 mfg_cmd;
 
 58	u8 cid[3];
 59	u8 tt_undef1;
 60	u8 uid[8];
 61	u8 bl_verh;
 62	u8 bl_verl;
 63	u8 tts_verh;
 64	u8 tts_verl;
 65	u8 app_idh;
 66	u8 app_idl;
 67	u8 app_verh;
 68	u8 app_verl;
 69	u8 tt_undef[5];
 70	u8 scn_typ;
 71	u8 act_intrvl;
 72	u8 tch_tmout;
 73	u8 lp_intrvl;
 74};
 75
 76/* TTSP Bootloader Register Map interface definition */
 77#define CY_BL_CHKSUM_OK 0x01
 78struct cyttsp_bootloader_data {
 79	u8 bl_file;
 80	u8 bl_status;
 81	u8 bl_error;
 82	u8 blver_hi;
 83	u8 blver_lo;
 84	u8 bld_blver_hi;
 85	u8 bld_blver_lo;
 86	u8 ttspver_hi;
 87	u8 ttspver_lo;
 88	u8 appid_hi;
 89	u8 appid_lo;
 90	u8 appver_hi;
 91	u8 appver_lo;
 92	u8 cid_0;
 93	u8 cid_1;
 94	u8 cid_2;
 95};
 96
 97struct cyttsp;
 98
 99struct cyttsp_bus_ops {
100	u16 bustype;
101	int (*write)(struct device *dev, u8 *xfer_buf, u16 addr, u8 length,
102			const void *values);
103	int (*read)(struct device *dev, u8 *xfer_buf, u16 addr, u8 length,
104			void *values);
105};
106
107enum cyttsp_state {
108	CY_IDLE_STATE,
109	CY_ACTIVE_STATE,
110	CY_BL_STATE,
111};
112
113struct cyttsp {
114	struct device *dev;
115	int irq;
116	struct input_dev *input;
 
 
117	const struct cyttsp_bus_ops *bus_ops;
118	struct cyttsp_bootloader_data bl_data;
119	struct cyttsp_sysinfo_data sysinfo_data;
120	struct cyttsp_xydata xy_data;
121	struct completion bl_ready;
122	enum cyttsp_state state;
123	bool suspended;
124
125	struct regulator_bulk_data regulators[2];
126	struct gpio_desc *reset_gpio;
127	bool use_hndshk;
128	u8 act_dist;
129	u8 act_intrvl;
130	u8 tch_tmout;
131	u8 lp_intrvl;
132	u8 *bl_keys;
133
134	u8 xfer_buf[] ____cacheline_aligned;
135};
136
137struct cyttsp *cyttsp_probe(const struct cyttsp_bus_ops *bus_ops,
138			    struct device *dev, int irq, size_t xfer_buf_size);
 
139
140int cyttsp_i2c_write_block_data(struct device *dev, u8 *xfer_buf, u16 addr,
141		u8 length, const void *values);
142int cyttsp_i2c_read_block_data(struct device *dev, u8 *xfer_buf, u16 addr,
143		u8 length, void *values);
144extern const struct dev_pm_ops cyttsp_pm_ops;
145
146#endif /* __CYTTSP_CORE_H__ */
v3.5.6
 
  1/*
  2 * Header file for:
  3 * Cypress TrueTouch(TM) Standard Product (TTSP) touchscreen drivers.
  4 * For use with Cypress Txx3xx parts.
  5 * Supported parts include:
  6 * CY8CTST341
  7 * CY8CTMA340
  8 *
  9 * Copyright (C) 2009, 2010, 2011 Cypress Semiconductor, Inc.
 10 * Copyright (C) 2012 Javier Martinez Canillas <javier@dowhile0.org>
 11 *
 12 * This program is free software; you can redistribute it and/or
 13 * modify it under the terms of the GNU General Public License
 14 * version 2, and only version 2, as published by the
 15 * Free Software Foundation.
 16 *
 17 * This program is distributed in the hope that it will be useful,
 18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 20 * GNU General Public License for more details.
 21 *
 22 * You should have received a copy of the GNU General Public License along
 23 * with this program; if not, write to the Free Software Foundation, Inc.,
 24 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 25 *
 26 * Contact Cypress Semiconductor at www.cypress.com <kev@cypress.com>
 27 *
 28 */
 29
 30
 31#ifndef __CYTTSP_CORE_H__
 32#define __CYTTSP_CORE_H__
 33
 34#include <linux/kernel.h>
 35#include <linux/err.h>
 36#include <linux/module.h>
 37#include <linux/types.h>
 38#include <linux/device.h>
 39#include <linux/input/cyttsp.h>
 40
 41#define CY_NUM_RETRY		16 /* max number of retries for read ops */
 42
 43struct cyttsp_tch {
 44	__be16 x, y;
 45	u8 z;
 46} __packed;
 47
 48/* TrueTouch Standard Product Gen3 interface definition */
 49struct cyttsp_xydata {
 50	u8 hst_mode;
 51	u8 tt_mode;
 52	u8 tt_stat;
 53	struct cyttsp_tch tch1;
 54	u8 touch12_id;
 55	struct cyttsp_tch tch2;
 56	u8 gest_cnt;
 57	u8 gest_id;
 58	struct cyttsp_tch tch3;
 59	u8 touch34_id;
 60	struct cyttsp_tch tch4;
 61	u8 tt_undef[3];
 62	u8 act_dist;
 63	u8 tt_reserved;
 64} __packed;
 65
 66
 67/* TTSP System Information interface definition */
 68struct cyttsp_sysinfo_data {
 69	u8 hst_mode;
 
 70	u8 mfg_cmd;
 71	u8 mfg_stat;
 72	u8 cid[3];
 73	u8 tt_undef1;
 74	u8 uid[8];
 75	u8 bl_verh;
 76	u8 bl_verl;
 77	u8 tts_verh;
 78	u8 tts_verl;
 79	u8 app_idh;
 80	u8 app_idl;
 81	u8 app_verh;
 82	u8 app_verl;
 83	u8 tt_undef[5];
 84	u8 scn_typ;
 85	u8 act_intrvl;
 86	u8 tch_tmout;
 87	u8 lp_intrvl;
 88};
 89
 90/* TTSP Bootloader Register Map interface definition */
 91#define CY_BL_CHKSUM_OK 0x01
 92struct cyttsp_bootloader_data {
 93	u8 bl_file;
 94	u8 bl_status;
 95	u8 bl_error;
 96	u8 blver_hi;
 97	u8 blver_lo;
 98	u8 bld_blver_hi;
 99	u8 bld_blver_lo;
100	u8 ttspver_hi;
101	u8 ttspver_lo;
102	u8 appid_hi;
103	u8 appid_lo;
104	u8 appver_hi;
105	u8 appver_lo;
106	u8 cid_0;
107	u8 cid_1;
108	u8 cid_2;
109};
110
111struct cyttsp;
112
113struct cyttsp_bus_ops {
114	u16 bustype;
115	int (*write)(struct cyttsp *ts,
116		     u8 addr, u8 length, const void *values);
117	int (*read)(struct cyttsp *ts, u8 addr, u8 length, void *values);
 
118};
119
120enum cyttsp_state {
121	CY_IDLE_STATE,
122	CY_ACTIVE_STATE,
123	CY_BL_STATE,
124};
125
126struct cyttsp {
127	struct device *dev;
128	int irq;
129	struct input_dev *input;
130	char phys[32];
131	const struct cyttsp_platform_data *pdata;
132	const struct cyttsp_bus_ops *bus_ops;
133	struct cyttsp_bootloader_data bl_data;
134	struct cyttsp_sysinfo_data sysinfo_data;
135	struct cyttsp_xydata xy_data;
136	struct completion bl_ready;
137	enum cyttsp_state state;
138	bool suspended;
139
 
 
 
 
 
 
 
 
 
140	u8 xfer_buf[] ____cacheline_aligned;
141};
142
143struct cyttsp *cyttsp_probe(const struct cyttsp_bus_ops *bus_ops,
144			    struct device *dev, int irq, size_t xfer_buf_size);
145void cyttsp_remove(struct cyttsp *ts);
146
 
 
 
 
147extern const struct dev_pm_ops cyttsp_pm_ops;
148
149#endif /* __CYTTSP_CORE_H__ */