Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
stmpe.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) ST-Ericsson SA 2010
3  *
4  * License Terms: GNU General Public License, version 2
5  * Author: Rabin Vincent <[email protected]> for ST-Ericsson
6  */
7 
8 #ifndef __LINUX_MFD_STMPE_H
9 #define __LINUX_MFD_STMPE_H
10 
11 #include <linux/mutex.h>
12 
13 struct device;
14 
16  STMPE_BLOCK_GPIO = 1 << 0,
19  STMPE_BLOCK_ADC = 1 << 3,
20  STMPE_BLOCK_PWM = 1 << 4,
22 };
23 
32 };
33 
34 /*
35  * For registers whose locations differ on variants, the correct address is
36  * obtained by indexing stmpe->regs with one of the following.
37  */
38 enum {
54 };
55 
56 
57 struct stmpe_variant_info;
58 struct stmpe_client_info;
59 
78 struct stmpe {
79  struct mutex lock;
80  struct mutex irq_lock;
81  struct device *dev;
82  void *client;
86  const u8 *regs;
87 
88  int irq;
89  int irq_base;
90  int num_gpios;
91  u8 ier[2];
92  u8 oldier[2];
94 };
95 
96 extern int stmpe_reg_write(struct stmpe *stmpe, u8 reg, u8 data);
97 extern int stmpe_reg_read(struct stmpe *stmpe, u8 reg);
98 extern int stmpe_block_read(struct stmpe *stmpe, u8 reg, u8 length,
99  u8 *values);
100 extern int stmpe_block_write(struct stmpe *stmpe, u8 reg, u8 length,
101  const u8 *values);
102 extern int stmpe_set_bits(struct stmpe *stmpe, u8 reg, u8 mask, u8 val);
103 extern int stmpe_set_altfunc(struct stmpe *stmpe, u32 pins,
104  enum stmpe_block block);
105 extern int stmpe_enable(struct stmpe *stmpe, unsigned int blocks);
106 extern int stmpe_disable(struct stmpe *stmpe, unsigned int blocks);
107 
108 struct matrix_keymap_data;
109 
121  unsigned int debounce_ms;
122  unsigned int scan_count;
124 };
125 
126 #define STMPE_GPIO_NOREQ_811_TOUCH (0xf0)
127 
140  unsigned norequest_mask;
141  void (*setup)(struct stmpe *stmpe, unsigned gpio_base);
142  void (*remove)(struct stmpe *stmpe, unsigned gpio_base);
143 };
144 
184 };
185 
204  int id;
205  unsigned int blocks;
206  int irq_base;
207  unsigned int irq_trigger;
209  bool autosleep;
211  int irq_gpio;
213 
217 };
218 
219 #define STMPE_NR_INTERNAL_IRQS 9
220 #define STMPE_INT_GPIO(x) (STMPE_NR_INTERNAL_IRQS + (x))
221 
222 #define STMPE_NR_GPIOS 24
223 #define STMPE_NR_IRQS STMPE_INT_GPIO(STMPE_NR_GPIOS)
224 
225 #endif