xref: /linux/drivers/mfd/stmpe.h (revision 03ab8e6297acd1bc0eedaa050e2a1635c576fd11)
11f67b599SThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-only */
227e34995SRabin Vincent /*
327e34995SRabin Vincent  * Copyright (C) ST-Ericsson SA 2010
427e34995SRabin Vincent  *
527e34995SRabin Vincent  * Author: Rabin Vincent <rabin.vincent@stericsson.com> for ST-Ericsson
627e34995SRabin Vincent  */
727e34995SRabin Vincent 
827e34995SRabin Vincent #ifndef __STMPE_H
927e34995SRabin Vincent #define __STMPE_H
1027e34995SRabin Vincent 
111a6e4b74SViresh Kumar #include <linux/device.h>
121a6e4b74SViresh Kumar #include <linux/mfd/core.h>
131a6e4b74SViresh Kumar #include <linux/mfd/stmpe.h>
141a6e4b74SViresh Kumar #include <linux/printk.h>
151a6e4b74SViresh Kumar #include <linux/types.h>
161a6e4b74SViresh Kumar 
171a6e4b74SViresh Kumar extern const struct dev_pm_ops stmpe_dev_pm_ops;
181a6e4b74SViresh Kumar 
1927e34995SRabin Vincent #ifdef STMPE_DUMP_BYTES
stmpe_dump_bytes(const char * str,const void * buf,size_t len)2027e34995SRabin Vincent static inline void stmpe_dump_bytes(const char *str, const void *buf,
2127e34995SRabin Vincent 				    size_t len)
2227e34995SRabin Vincent {
2327e34995SRabin Vincent 	print_hex_dump_bytes(str, DUMP_PREFIX_OFFSET, buf, len);
2427e34995SRabin Vincent }
2527e34995SRabin Vincent #else
stmpe_dump_bytes(const char * str,const void * buf,size_t len)2627e34995SRabin Vincent static inline void stmpe_dump_bytes(const char *str, const void *buf,
2727e34995SRabin Vincent 				    size_t len)
2827e34995SRabin Vincent {
2927e34995SRabin Vincent }
3027e34995SRabin Vincent #endif
3127e34995SRabin Vincent 
3227e34995SRabin Vincent /**
3327e34995SRabin Vincent  * struct stmpe_variant_block - information about block
3427e34995SRabin Vincent  * @cell:	base mfd cell
3527e34995SRabin Vincent  * @irq:	interrupt number to be added to each IORESOURCE_IRQ
3627e34995SRabin Vincent  *		in the cell
3727e34995SRabin Vincent  * @block:	block id; used for identification with platform data and for
3827e34995SRabin Vincent  *		enable and altfunc callbacks
3927e34995SRabin Vincent  */
4027e34995SRabin Vincent struct stmpe_variant_block {
416bbb3c4cSGeert Uytterhoeven 	const struct mfd_cell	*cell;
4227e34995SRabin Vincent 	int			irq;
4327e34995SRabin Vincent 	enum stmpe_block	block;
4427e34995SRabin Vincent };
4527e34995SRabin Vincent 
4627e34995SRabin Vincent /**
4727e34995SRabin Vincent  * struct stmpe_variant_info - variant-specific information
4827e34995SRabin Vincent  * @name:	part name
4927e34995SRabin Vincent  * @id_val:	content of CHIPID register
5027e34995SRabin Vincent  * @id_mask:	bits valid in CHIPID register for comparison with id_val
5127e34995SRabin Vincent  * @num_gpios:	number of GPIOS
5227e34995SRabin Vincent  * @af_bits:	number of bits used to specify the alternate function
534dcaa6b6SOm Prakash  * @regs: variant specific registers.
5427e34995SRabin Vincent  * @blocks:	list of blocks present on this device
5527e34995SRabin Vincent  * @num_blocks:	number of blocks present on this device
5627e34995SRabin Vincent  * @num_irqs:	number of internal IRQs available on this device
5727e34995SRabin Vincent  * @enable:	callback to enable the specified blocks.
5827e34995SRabin Vincent  *		Called with the I/O lock held.
5927e34995SRabin Vincent  * @get_altfunc: callback to get the alternate function number for the
6027e34995SRabin Vincent  *		 specific block
615981f4e6SSundar R Iyer  * @enable_autosleep: callback to configure autosleep with specified timeout
6227e34995SRabin Vincent  */
6327e34995SRabin Vincent struct stmpe_variant_info {
6427e34995SRabin Vincent 	const char *name;
6527e34995SRabin Vincent 	u16 id_val;
6627e34995SRabin Vincent 	u16 id_mask;
6727e34995SRabin Vincent 	int num_gpios;
6827e34995SRabin Vincent 	int af_bits;
6927e34995SRabin Vincent 	const u8 *regs;
7027e34995SRabin Vincent 	struct stmpe_variant_block *blocks;
7127e34995SRabin Vincent 	int num_blocks;
7227e34995SRabin Vincent 	int num_irqs;
7327e34995SRabin Vincent 	int (*enable)(struct stmpe *stmpe, unsigned int blocks, bool enable);
7427e34995SRabin Vincent 	int (*get_altfunc)(struct stmpe *stmpe, enum stmpe_block block);
755981f4e6SSundar R Iyer 	int (*enable_autosleep)(struct stmpe *stmpe, int autosleep_timeout);
7627e34995SRabin Vincent };
7727e34995SRabin Vincent 
781a6e4b74SViresh Kumar /**
791a6e4b74SViresh Kumar  * struct stmpe_client_info - i2c or spi specific routines/info
801a6e4b74SViresh Kumar  * @data: client specific data
811a6e4b74SViresh Kumar  * @read_byte: read single byte
821a6e4b74SViresh Kumar  * @write_byte: write single byte
831a6e4b74SViresh Kumar  * @read_block: read block or multiple bytes
841a6e4b74SViresh Kumar  * @write_block: write block or multiple bytes
851a6e4b74SViresh Kumar  * @init: client init routine, called during probe
861a6e4b74SViresh Kumar  */
871a6e4b74SViresh Kumar struct stmpe_client_info {
881a6e4b74SViresh Kumar 	void *data;
891a6e4b74SViresh Kumar 	int irq;
901a6e4b74SViresh Kumar 	void *client;
911a6e4b74SViresh Kumar 	struct device *dev;
921a6e4b74SViresh Kumar 	int (*read_byte)(struct stmpe *stmpe, u8 reg);
931a6e4b74SViresh Kumar 	int (*write_byte)(struct stmpe *stmpe, u8 reg, u8 val);
941a6e4b74SViresh Kumar 	int (*read_block)(struct stmpe *stmpe, u8 reg, u8 len, u8 *values);
951a6e4b74SViresh Kumar 	int (*write_block)(struct stmpe *stmpe, u8 reg, u8 len,
961a6e4b74SViresh Kumar 			const u8 *values);
971a6e4b74SViresh Kumar 	void (*init)(struct stmpe *stmpe);
981a6e4b74SViresh Kumar };
991a6e4b74SViresh Kumar 
100c00572bcSLee Jones int stmpe_probe(struct stmpe_client_info *ci, enum stmpe_partnum partnum);
101*356bbabaSUwe Kleine-König void stmpe_remove(struct stmpe *stmpe);
1021a6e4b74SViresh Kumar 
10327e34995SRabin Vincent #define STMPE_ICR_LSB_HIGH	(1 << 2)
10427e34995SRabin Vincent #define STMPE_ICR_LSB_EDGE	(1 << 1)
10527e34995SRabin Vincent #define STMPE_ICR_LSB_GIM	(1 << 0)
10627e34995SRabin Vincent 
107c4dd1ba3SPatrice Chotard #define STMPE_SYS_CTRL_RESET	(1 << 7)
108c16bee78SPatrice Chotard #define STMPE_SYS_CTRL_INT_EN	(1 << 2)
109c16bee78SPatrice Chotard #define STMPE_SYS_CTRL_INT_HI	(1 << 0)
110c4dd1ba3SPatrice Chotard 
11127e34995SRabin Vincent /*
1127f7f4ea1SViresh Kumar  * STMPE801
1137f7f4ea1SViresh Kumar  */
1147f7f4ea1SViresh Kumar #define STMPE801_ID			0x0108
1157f7f4ea1SViresh Kumar #define STMPE801_NR_INTERNAL_IRQS	1
1167f7f4ea1SViresh Kumar 
1177f7f4ea1SViresh Kumar #define STMPE801_REG_CHIP_ID		0x00
1187f7f4ea1SViresh Kumar #define STMPE801_REG_VERSION_ID		0x02
1197f7f4ea1SViresh Kumar #define STMPE801_REG_SYS_CTRL		0x04
1207f7f4ea1SViresh Kumar #define STMPE801_REG_GPIO_INT_EN	0x08
1217f7f4ea1SViresh Kumar #define STMPE801_REG_GPIO_INT_STA	0x09
1227f7f4ea1SViresh Kumar #define STMPE801_REG_GPIO_MP_STA	0x10
1237f7f4ea1SViresh Kumar #define STMPE801_REG_GPIO_SET_PIN	0x11
1247f7f4ea1SViresh Kumar #define STMPE801_REG_GPIO_DIR		0x12
1257f7f4ea1SViresh Kumar 
1267f7f4ea1SViresh Kumar /*
12727e34995SRabin Vincent  * STMPE811
12827e34995SRabin Vincent  */
129c4dd1ba3SPatrice Chotard #define STMPE811_ID			0x0811
13027e34995SRabin Vincent 
13127e34995SRabin Vincent #define STMPE811_IRQ_TOUCH_DET		0
13227e34995SRabin Vincent #define STMPE811_IRQ_FIFO_TH		1
13327e34995SRabin Vincent #define STMPE811_IRQ_FIFO_OFLOW		2
13427e34995SRabin Vincent #define STMPE811_IRQ_FIFO_FULL		3
13527e34995SRabin Vincent #define STMPE811_IRQ_FIFO_EMPTY		4
13627e34995SRabin Vincent #define STMPE811_IRQ_TEMP_SENS		5
13727e34995SRabin Vincent #define STMPE811_IRQ_ADC		6
13827e34995SRabin Vincent #define STMPE811_IRQ_GPIOC		7
13927e34995SRabin Vincent #define STMPE811_NR_INTERNAL_IRQS	8
14027e34995SRabin Vincent 
14127e34995SRabin Vincent #define STMPE811_REG_CHIP_ID		0x00
1420f4be8cfSPatrice Chotard #define STMPE811_REG_SYS_CTRL		0x03
14327e34995SRabin Vincent #define STMPE811_REG_SYS_CTRL2		0x04
144e789995dSViresh Kumar #define STMPE811_REG_SPI_CFG		0x08
14527e34995SRabin Vincent #define STMPE811_REG_INT_CTRL		0x09
14627e34995SRabin Vincent #define STMPE811_REG_INT_EN		0x0A
14727e34995SRabin Vincent #define STMPE811_REG_INT_STA		0x0B
14827e34995SRabin Vincent #define STMPE811_REG_GPIO_INT_EN	0x0C
14927e34995SRabin Vincent #define STMPE811_REG_GPIO_INT_STA	0x0D
15027e34995SRabin Vincent #define STMPE811_REG_GPIO_SET_PIN	0x10
15127e34995SRabin Vincent #define STMPE811_REG_GPIO_CLR_PIN	0x11
15227e34995SRabin Vincent #define STMPE811_REG_GPIO_MP_STA	0x12
15327e34995SRabin Vincent #define STMPE811_REG_GPIO_DIR		0x13
15427e34995SRabin Vincent #define STMPE811_REG_GPIO_ED		0x14
15527e34995SRabin Vincent #define STMPE811_REG_GPIO_RE		0x15
15627e34995SRabin Vincent #define STMPE811_REG_GPIO_FE		0x16
15727e34995SRabin Vincent #define STMPE811_REG_GPIO_AF		0x17
15827e34995SRabin Vincent 
159c4dd1ba3SPatrice Chotard #define STMPE811_SYS_CTRL_RESET		(1 << 1)
160c4dd1ba3SPatrice Chotard 
16127e34995SRabin Vincent #define STMPE811_SYS_CTRL2_ADC_OFF	(1 << 0)
16227e34995SRabin Vincent #define STMPE811_SYS_CTRL2_TSC_OFF	(1 << 1)
16327e34995SRabin Vincent #define STMPE811_SYS_CTRL2_GPIO_OFF	(1 << 2)
16427e34995SRabin Vincent #define STMPE811_SYS_CTRL2_TS_OFF	(1 << 3)
16527e34995SRabin Vincent 
16627e34995SRabin Vincent /*
1676bb9f0d9SPatrice Chotard  * STMPE1600
1686bb9f0d9SPatrice Chotard  */
1696bb9f0d9SPatrice Chotard #define STMPE1600_ID			0x0016
1706bb9f0d9SPatrice Chotard #define STMPE1600_NR_INTERNAL_IRQS	16
1716bb9f0d9SPatrice Chotard 
1726bb9f0d9SPatrice Chotard #define STMPE1600_REG_CHIP_ID		0x00
1736bb9f0d9SPatrice Chotard #define STMPE1600_REG_SYS_CTRL		0x03
1746bb9f0d9SPatrice Chotard #define STMPE1600_REG_IEGPIOR_LSB	0x08
1756bb9f0d9SPatrice Chotard #define STMPE1600_REG_IEGPIOR_MSB	0x09
1766bb9f0d9SPatrice Chotard #define STMPE1600_REG_ISGPIOR_LSB	0x0A
1776bb9f0d9SPatrice Chotard #define STMPE1600_REG_ISGPIOR_MSB	0x0B
1786bb9f0d9SPatrice Chotard #define STMPE1600_REG_GPMR_LSB		0x10
1796bb9f0d9SPatrice Chotard #define STMPE1600_REG_GPMR_MSB		0x11
1806bb9f0d9SPatrice Chotard #define STMPE1600_REG_GPSR_LSB		0x12
1816bb9f0d9SPatrice Chotard #define STMPE1600_REG_GPSR_MSB		0x13
1826bb9f0d9SPatrice Chotard #define STMPE1600_REG_GPDR_LSB		0x14
1836bb9f0d9SPatrice Chotard #define STMPE1600_REG_GPDR_MSB		0x15
1846bb9f0d9SPatrice Chotard #define STMPE1600_REG_GPPIR_LSB		0x16
1856bb9f0d9SPatrice Chotard #define STMPE1600_REG_GPPIR_MSB		0x17
1866bb9f0d9SPatrice Chotard 
1876bb9f0d9SPatrice Chotard /*
18827e34995SRabin Vincent  * STMPE1601
18927e34995SRabin Vincent  */
19027e34995SRabin Vincent 
19127e34995SRabin Vincent #define STMPE1601_IRQ_GPIOC		8
19227e34995SRabin Vincent #define STMPE1601_IRQ_PWM3		7
19327e34995SRabin Vincent #define STMPE1601_IRQ_PWM2		6
19427e34995SRabin Vincent #define STMPE1601_IRQ_PWM1		5
19527e34995SRabin Vincent #define STMPE1601_IRQ_PWM0		4
19627e34995SRabin Vincent #define STMPE1601_IRQ_KEYPAD_OVER	2
19727e34995SRabin Vincent #define STMPE1601_IRQ_KEYPAD		1
19827e34995SRabin Vincent #define STMPE1601_IRQ_WAKEUP		0
19927e34995SRabin Vincent #define STMPE1601_NR_INTERNAL_IRQS	9
20027e34995SRabin Vincent 
20127e34995SRabin Vincent #define STMPE1601_REG_SYS_CTRL			0x02
2025981f4e6SSundar R Iyer #define STMPE1601_REG_SYS_CTRL2			0x03
203897ac667SPatrice Chotard #define STMPE1601_REG_ICR_MSB			0x10
20427e34995SRabin Vincent #define STMPE1601_REG_ICR_LSB			0x11
205897ac667SPatrice Chotard #define STMPE1601_REG_IER_MSB			0x12
20627e34995SRabin Vincent #define STMPE1601_REG_IER_LSB			0x13
20727e34995SRabin Vincent #define STMPE1601_REG_ISR_MSB			0x14
208897ac667SPatrice Chotard #define STMPE1601_REG_ISR_LSB			0x15
209897ac667SPatrice Chotard #define STMPE1601_REG_INT_EN_GPIO_MASK_MSB	0x16
21027e34995SRabin Vincent #define STMPE1601_REG_INT_EN_GPIO_MASK_LSB	0x17
21127e34995SRabin Vincent #define STMPE1601_REG_INT_STA_GPIO_MSB		0x18
212897ac667SPatrice Chotard #define STMPE1601_REG_INT_STA_GPIO_LSB		0x19
213897ac667SPatrice Chotard #define STMPE1601_REG_CHIP_ID			0x80
214897ac667SPatrice Chotard #define STMPE1601_REG_GPIO_SET_MSB		0x82
21527e34995SRabin Vincent #define STMPE1601_REG_GPIO_SET_LSB		0x83
216897ac667SPatrice Chotard #define STMPE1601_REG_GPIO_CLR_MSB		0x84
21727e34995SRabin Vincent #define STMPE1601_REG_GPIO_CLR_LSB		0x85
218897ac667SPatrice Chotard #define STMPE1601_REG_GPIO_MP_MSB		0x86
219897ac667SPatrice Chotard #define STMPE1601_REG_GPIO_MP_LSB		0x87
220897ac667SPatrice Chotard #define STMPE1601_REG_GPIO_SET_DIR_MSB		0x88
22127e34995SRabin Vincent #define STMPE1601_REG_GPIO_SET_DIR_LSB		0x89
22227e34995SRabin Vincent #define STMPE1601_REG_GPIO_ED_MSB		0x8A
223897ac667SPatrice Chotard #define STMPE1601_REG_GPIO_ED_LSB		0x8B
224897ac667SPatrice Chotard #define STMPE1601_REG_GPIO_RE_MSB		0x8C
22527e34995SRabin Vincent #define STMPE1601_REG_GPIO_RE_LSB		0x8D
226897ac667SPatrice Chotard #define STMPE1601_REG_GPIO_FE_MSB		0x8E
22727e34995SRabin Vincent #define STMPE1601_REG_GPIO_FE_LSB		0x8F
228897ac667SPatrice Chotard #define STMPE1601_REG_GPIO_PU_MSB		0x90
22980e1dd82SLinus Walleij #define STMPE1601_REG_GPIO_PU_LSB		0x91
23027e34995SRabin Vincent #define STMPE1601_REG_GPIO_AF_U_MSB		0x92
23127e34995SRabin Vincent 
23227e34995SRabin Vincent #define STMPE1601_SYS_CTRL_ENABLE_GPIO		(1 << 3)
23327e34995SRabin Vincent #define STMPE1601_SYS_CTRL_ENABLE_KPC		(1 << 1)
234b69d2ad6SLinus Walleij #define STMPE1601_SYS_CTRL_ENABLE_SPWM		(1 << 0)
23527e34995SRabin Vincent 
2365981f4e6SSundar R Iyer /* The 1601/2403 share the same masks */
2375981f4e6SSundar R Iyer #define STMPE1601_AUTOSLEEP_TIMEOUT_MASK	(0x7)
2385981f4e6SSundar R Iyer #define STPME1601_AUTOSLEEP_ENABLE		(1 << 3)
2395981f4e6SSundar R Iyer 
24027e34995SRabin Vincent /*
241230f13a5SJean-Nicolas Graux  * STMPE1801
242230f13a5SJean-Nicolas Graux  */
243230f13a5SJean-Nicolas Graux #define STMPE1801_ID			0xc110
244230f13a5SJean-Nicolas Graux #define STMPE1801_NR_INTERNAL_IRQS	5
245230f13a5SJean-Nicolas Graux #define STMPE1801_IRQ_KEYPAD_COMBI	4
246230f13a5SJean-Nicolas Graux #define STMPE1801_IRQ_GPIOC		3
247230f13a5SJean-Nicolas Graux #define STMPE1801_IRQ_KEYPAD_OVER	2
248230f13a5SJean-Nicolas Graux #define STMPE1801_IRQ_KEYPAD		1
249230f13a5SJean-Nicolas Graux #define STMPE1801_IRQ_WAKEUP		0
250230f13a5SJean-Nicolas Graux 
251230f13a5SJean-Nicolas Graux #define STMPE1801_REG_CHIP_ID			0x00
252230f13a5SJean-Nicolas Graux #define STMPE1801_REG_SYS_CTRL			0x02
253230f13a5SJean-Nicolas Graux #define STMPE1801_REG_INT_CTRL_LOW		0x04
254230f13a5SJean-Nicolas Graux #define STMPE1801_REG_INT_EN_MASK_LOW		0x06
255230f13a5SJean-Nicolas Graux #define STMPE1801_REG_INT_STA_LOW		0x08
256230f13a5SJean-Nicolas Graux #define STMPE1801_REG_INT_EN_GPIO_MASK_LOW	0x0A
257230f13a5SJean-Nicolas Graux #define STMPE1801_REG_INT_EN_GPIO_MASK_MID	0x0B
258230f13a5SJean-Nicolas Graux #define STMPE1801_REG_INT_EN_GPIO_MASK_HIGH	0x0C
259230f13a5SJean-Nicolas Graux #define STMPE1801_REG_INT_STA_GPIO_LOW		0x0D
260230f13a5SJean-Nicolas Graux #define STMPE1801_REG_INT_STA_GPIO_MID		0x0E
261230f13a5SJean-Nicolas Graux #define STMPE1801_REG_INT_STA_GPIO_HIGH		0x0F
262230f13a5SJean-Nicolas Graux #define STMPE1801_REG_GPIO_SET_LOW		0x10
263230f13a5SJean-Nicolas Graux #define STMPE1801_REG_GPIO_SET_MID		0x11
264230f13a5SJean-Nicolas Graux #define STMPE1801_REG_GPIO_SET_HIGH		0x12
265230f13a5SJean-Nicolas Graux #define STMPE1801_REG_GPIO_CLR_LOW		0x13
266230f13a5SJean-Nicolas Graux #define STMPE1801_REG_GPIO_CLR_MID		0x14
267230f13a5SJean-Nicolas Graux #define STMPE1801_REG_GPIO_CLR_HIGH		0x15
268230f13a5SJean-Nicolas Graux #define STMPE1801_REG_GPIO_MP_LOW		0x16
269230f13a5SJean-Nicolas Graux #define STMPE1801_REG_GPIO_MP_MID		0x17
270230f13a5SJean-Nicolas Graux #define STMPE1801_REG_GPIO_MP_HIGH		0x18
271230f13a5SJean-Nicolas Graux #define STMPE1801_REG_GPIO_SET_DIR_LOW		0x19
272230f13a5SJean-Nicolas Graux #define STMPE1801_REG_GPIO_SET_DIR_MID		0x1A
273230f13a5SJean-Nicolas Graux #define STMPE1801_REG_GPIO_SET_DIR_HIGH		0x1B
274230f13a5SJean-Nicolas Graux #define STMPE1801_REG_GPIO_RE_LOW		0x1C
275230f13a5SJean-Nicolas Graux #define STMPE1801_REG_GPIO_RE_MID		0x1D
276230f13a5SJean-Nicolas Graux #define STMPE1801_REG_GPIO_RE_HIGH		0x1E
277230f13a5SJean-Nicolas Graux #define STMPE1801_REG_GPIO_FE_LOW		0x1F
278230f13a5SJean-Nicolas Graux #define STMPE1801_REG_GPIO_FE_MID		0x20
279230f13a5SJean-Nicolas Graux #define STMPE1801_REG_GPIO_FE_HIGH		0x21
280230f13a5SJean-Nicolas Graux #define STMPE1801_REG_GPIO_PULL_UP_LOW		0x22
281230f13a5SJean-Nicolas Graux #define STMPE1801_REG_GPIO_PULL_UP_MID		0x23
282230f13a5SJean-Nicolas Graux #define STMPE1801_REG_GPIO_PULL_UP_HIGH		0x24
283230f13a5SJean-Nicolas Graux 
284230f13a5SJean-Nicolas Graux #define STMPE1801_MSK_INT_EN_KPC		(1 << 1)
285230f13a5SJean-Nicolas Graux #define STMPE1801_MSK_INT_EN_GPIO		(1 << 3)
286230f13a5SJean-Nicolas Graux 
287230f13a5SJean-Nicolas Graux /*
28827e34995SRabin Vincent  * STMPE24xx
28927e34995SRabin Vincent  */
29027e34995SRabin Vincent 
29127e34995SRabin Vincent #define STMPE24XX_IRQ_GPIOC		8
29227e34995SRabin Vincent #define STMPE24XX_IRQ_PWM2		7
29327e34995SRabin Vincent #define STMPE24XX_IRQ_PWM1		6
29427e34995SRabin Vincent #define STMPE24XX_IRQ_PWM0		5
29527e34995SRabin Vincent #define STMPE24XX_IRQ_ROT_OVER		4
29627e34995SRabin Vincent #define STMPE24XX_IRQ_ROT		3
29727e34995SRabin Vincent #define STMPE24XX_IRQ_KEYPAD_OVER	2
29827e34995SRabin Vincent #define STMPE24XX_IRQ_KEYPAD		1
29927e34995SRabin Vincent #define STMPE24XX_IRQ_WAKEUP		0
30027e34995SRabin Vincent #define STMPE24XX_NR_INTERNAL_IRQS	9
30127e34995SRabin Vincent 
30227e34995SRabin Vincent #define STMPE24XX_REG_SYS_CTRL		0x02
3030f4be8cfSPatrice Chotard #define STMPE24XX_REG_SYS_CTRL2		0x03
304897ac667SPatrice Chotard #define STMPE24XX_REG_ICR_MSB		0x10
30527e34995SRabin Vincent #define STMPE24XX_REG_ICR_LSB		0x11
306897ac667SPatrice Chotard #define STMPE24XX_REG_IER_MSB		0x12
30727e34995SRabin Vincent #define STMPE24XX_REG_IER_LSB		0x13
30827e34995SRabin Vincent #define STMPE24XX_REG_ISR_MSB		0x14
309897ac667SPatrice Chotard #define STMPE24XX_REG_ISR_LSB		0x15
310897ac667SPatrice Chotard #define STMPE24XX_REG_IEGPIOR_MSB	0x16
311897ac667SPatrice Chotard #define STMPE24XX_REG_IEGPIOR_CSB	0x17
31227e34995SRabin Vincent #define STMPE24XX_REG_IEGPIOR_LSB	0x18
31327e34995SRabin Vincent #define STMPE24XX_REG_ISGPIOR_MSB	0x19
314897ac667SPatrice Chotard #define STMPE24XX_REG_ISGPIOR_CSB	0x1A
315897ac667SPatrice Chotard #define STMPE24XX_REG_ISGPIOR_LSB	0x1B
316897ac667SPatrice Chotard #define STMPE24XX_REG_CHIP_ID		0x80
317897ac667SPatrice Chotard #define STMPE24XX_REG_GPSR_MSB		0x83
318897ac667SPatrice Chotard #define STMPE24XX_REG_GPSR_CSB		0x84
31927e34995SRabin Vincent #define STMPE24XX_REG_GPSR_LSB		0x85
320897ac667SPatrice Chotard #define STMPE24XX_REG_GPCR_MSB		0x86
321897ac667SPatrice Chotard #define STMPE24XX_REG_GPCR_CSB		0x87
32227e34995SRabin Vincent #define STMPE24XX_REG_GPCR_LSB		0x88
323897ac667SPatrice Chotard #define STMPE24XX_REG_GPDR_MSB		0x89
324897ac667SPatrice Chotard #define STMPE24XX_REG_GPDR_CSB		0x8A
32527e34995SRabin Vincent #define STMPE24XX_REG_GPDR_LSB		0x8B
32627e34995SRabin Vincent #define STMPE24XX_REG_GPEDR_MSB		0x8C
327897ac667SPatrice Chotard #define STMPE24XX_REG_GPEDR_CSB		0x8D
328897ac667SPatrice Chotard #define STMPE24XX_REG_GPEDR_LSB		0x8E
329897ac667SPatrice Chotard #define STMPE24XX_REG_GPRER_MSB		0x8F
330897ac667SPatrice Chotard #define STMPE24XX_REG_GPRER_CSB		0x90
33127e34995SRabin Vincent #define STMPE24XX_REG_GPRER_LSB		0x91
332897ac667SPatrice Chotard #define STMPE24XX_REG_GPFER_MSB		0x92
333897ac667SPatrice Chotard #define STMPE24XX_REG_GPFER_CSB		0x93
33427e34995SRabin Vincent #define STMPE24XX_REG_GPFER_LSB		0x94
335897ac667SPatrice Chotard #define STMPE24XX_REG_GPPUR_MSB		0x95
336897ac667SPatrice Chotard #define STMPE24XX_REG_GPPUR_CSB		0x96
33780e1dd82SLinus Walleij #define STMPE24XX_REG_GPPUR_LSB		0x97
338897ac667SPatrice Chotard #define STMPE24XX_REG_GPPDR_MSB		0x98
339897ac667SPatrice Chotard #define STMPE24XX_REG_GPPDR_CSB		0x99
340897ac667SPatrice Chotard #define STMPE24XX_REG_GPPDR_LSB		0x9A
34127e34995SRabin Vincent #define STMPE24XX_REG_GPAFR_U_MSB	0x9B
342897ac667SPatrice Chotard #define STMPE24XX_REG_GPMR_MSB		0xA2
343897ac667SPatrice Chotard #define STMPE24XX_REG_GPMR_CSB		0xA3
344897ac667SPatrice Chotard #define STMPE24XX_REG_GPMR_LSB		0xA4
34527e34995SRabin Vincent #define STMPE24XX_SYS_CTRL_ENABLE_GPIO		(1 << 3)
34627e34995SRabin Vincent #define STMPE24XX_SYSCON_ENABLE_PWM		(1 << 2)
34727e34995SRabin Vincent #define STMPE24XX_SYS_CTRL_ENABLE_KPC		(1 << 1)
34827e34995SRabin Vincent #define STMPE24XX_SYSCON_ENABLE_ROT		(1 << 0)
34927e34995SRabin Vincent 
35027e34995SRabin Vincent #endif
351