diff options
Diffstat (limited to 'drivers/input')
| -rw-r--r-- | drivers/input/keyboard/Kconfig | 10 | ||||
| -rw-r--r-- | drivers/input/keyboard/Makefile | 1 | ||||
| -rw-r--r-- | drivers/input/keyboard/stmpe-keypad.c | 386 | ||||
| -rw-r--r-- | drivers/input/misc/ati_remote2.c | 26 | ||||
| -rw-r--r-- | drivers/input/misc/sparcspkr.c | 10 | ||||
| -rw-r--r-- | drivers/input/mouse/psmouse-base.c | 14 | ||||
| -rw-r--r-- | drivers/input/serio/i8042-sparcio.h | 8 | ||||
| -rw-r--r-- | drivers/input/serio/i8042.c | 25 | ||||
| -rw-r--r-- | drivers/input/serio/xilinx_ps2.c | 4 | ||||
| -rw-r--r-- | drivers/input/touchscreen/Kconfig | 10 | ||||
| -rw-r--r-- | drivers/input/touchscreen/Makefile | 1 | ||||
| -rw-r--r-- | drivers/input/touchscreen/stmpe-ts.c | 397 |
12 files changed, 846 insertions, 46 deletions
diff --git a/drivers/input/keyboard/Kconfig b/drivers/input/keyboard/Kconfig index b171f63fe4d7..9cc488d21490 100644 --- a/drivers/input/keyboard/Kconfig +++ b/drivers/input/keyboard/Kconfig | |||
| @@ -395,6 +395,16 @@ config KEYBOARD_SH_KEYSC | |||
| 395 | To compile this driver as a module, choose M here: the | 395 | To compile this driver as a module, choose M here: the |
| 396 | module will be called sh_keysc. | 396 | module will be called sh_keysc. |
| 397 | 397 | ||
| 398 | config KEYBOARD_STMPE | ||
| 399 | tristate "STMPE keypad support" | ||
| 400 | depends on MFD_STMPE | ||
| 401 | help | ||
| 402 | Say Y here if you want to use the keypad controller on STMPE I/O | ||
| 403 | expanders. | ||
| 404 | |||
| 405 | To compile this driver as a module, choose M here: the module will be | ||
| 406 | called stmpe-keypad. | ||
| 407 | |||
| 398 | config KEYBOARD_DAVINCI | 408 | config KEYBOARD_DAVINCI |
| 399 | tristate "TI DaVinci Key Scan" | 409 | tristate "TI DaVinci Key Scan" |
| 400 | depends on ARCH_DAVINCI_DM365 | 410 | depends on ARCH_DAVINCI_DM365 |
diff --git a/drivers/input/keyboard/Makefile b/drivers/input/keyboard/Makefile index 1a66d5f1ca8b..504b591be0cd 100644 --- a/drivers/input/keyboard/Makefile +++ b/drivers/input/keyboard/Makefile | |||
| @@ -35,6 +35,7 @@ obj-$(CONFIG_KEYBOARD_PXA930_ROTARY) += pxa930_rotary.o | |||
| 35 | obj-$(CONFIG_KEYBOARD_QT2160) += qt2160.o | 35 | obj-$(CONFIG_KEYBOARD_QT2160) += qt2160.o |
| 36 | obj-$(CONFIG_KEYBOARD_SAMSUNG) += samsung-keypad.o | 36 | obj-$(CONFIG_KEYBOARD_SAMSUNG) += samsung-keypad.o |
| 37 | obj-$(CONFIG_KEYBOARD_SH_KEYSC) += sh_keysc.o | 37 | obj-$(CONFIG_KEYBOARD_SH_KEYSC) += sh_keysc.o |
| 38 | obj-$(CONFIG_KEYBOARD_STMPE) += stmpe-keypad.o | ||
| 38 | obj-$(CONFIG_KEYBOARD_STOWAWAY) += stowaway.o | 39 | obj-$(CONFIG_KEYBOARD_STOWAWAY) += stowaway.o |
| 39 | obj-$(CONFIG_KEYBOARD_SUNKBD) += sunkbd.o | 40 | obj-$(CONFIG_KEYBOARD_SUNKBD) += sunkbd.o |
| 40 | obj-$(CONFIG_KEYBOARD_TWL4030) += twl4030_keypad.o | 41 | obj-$(CONFIG_KEYBOARD_TWL4030) += twl4030_keypad.o |
diff --git a/drivers/input/keyboard/stmpe-keypad.c b/drivers/input/keyboard/stmpe-keypad.c new file mode 100644 index 000000000000..ab7610ca10eb --- /dev/null +++ b/drivers/input/keyboard/stmpe-keypad.c | |||
| @@ -0,0 +1,386 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (C) ST-Ericsson SA 2010 | ||
| 3 | * | ||
| 4 | * License Terms: GNU General Public License, version 2 | ||
| 5 | * Author: Rabin Vincent <rabin.vincent@stericsson.com> for ST-Ericsson | ||
| 6 | */ | ||
| 7 | |||
| 8 | #include <linux/module.h> | ||
| 9 | #include <linux/init.h> | ||
| 10 | #include <linux/slab.h> | ||
| 11 | #include <linux/input.h> | ||
| 12 | #include <linux/interrupt.h> | ||
| 13 | #include <linux/platform_device.h> | ||
| 14 | #include <linux/input/matrix_keypad.h> | ||
| 15 | #include <linux/mfd/stmpe.h> | ||
| 16 | |||
| 17 | /* These are at the same addresses in all STMPE variants */ | ||
| 18 | #define STMPE_KPC_COL 0x60 | ||
| 19 | #define STMPE_KPC_ROW_MSB 0x61 | ||
| 20 | #define STMPE_KPC_ROW_LSB 0x62 | ||
| 21 | #define STMPE_KPC_CTRL_MSB 0x63 | ||
| 22 | #define STMPE_KPC_CTRL_LSB 0x64 | ||
| 23 | #define STMPE_KPC_COMBI_KEY_0 0x65 | ||
| 24 | #define STMPE_KPC_COMBI_KEY_1 0x66 | ||
| 25 | #define STMPE_KPC_COMBI_KEY_2 0x67 | ||
| 26 | #define STMPE_KPC_DATA_BYTE0 0x68 | ||
| 27 | #define STMPE_KPC_DATA_BYTE1 0x69 | ||
| 28 | #define STMPE_KPC_DATA_BYTE2 0x6a | ||
| 29 | #define STMPE_KPC_DATA_BYTE3 0x6b | ||
| 30 | #define STMPE_KPC_DATA_BYTE4 0x6c | ||
| 31 | |||
| 32 | #define STMPE_KPC_CTRL_LSB_SCAN (0x1 << 0) | ||
| 33 | #define STMPE_KPC_CTRL_LSB_DEBOUNCE (0x7f << 1) | ||
| 34 | #define STMPE_KPC_CTRL_MSB_SCAN_COUNT (0xf << 4) | ||
| 35 | |||
| 36 | #define STMPE_KPC_ROW_MSB_ROWS 0xff | ||
| 37 | |||
| 38 | #define STMPE_KPC_DATA_UP (0x1 << 7) | ||
| 39 | #define STMPE_KPC_DATA_ROW (0xf << 3) | ||
| 40 | #define STMPE_KPC_DATA_COL (0x7 << 0) | ||
| 41 | #define STMPE_KPC_DATA_NOKEY_MASK 0x78 | ||
| 42 | |||
| 43 | #define STMPE_KEYPAD_MAX_DEBOUNCE 127 | ||
| 44 | #define STMPE_KEYPAD_MAX_SCAN_COUNT 15 | ||
| 45 | |||
| 46 | #define STMPE_KEYPAD_MAX_ROWS 8 | ||
| 47 | #define STMPE_KEYPAD_MAX_COLS 8 | ||
| 48 | #define STMPE_KEYPAD_ROW_SHIFT 3 | ||
| 49 | #define STMPE_KEYPAD_KEYMAP_SIZE \ | ||
| 50 | (STMPE_KEYPAD_MAX_ROWS * STMPE_KEYPAD_MAX_COLS) | ||
| 51 | |||
| 52 | /** | ||
| 53 | * struct stmpe_keypad_variant - model-specific attributes | ||
| 54 | * @auto_increment: whether the KPC_DATA_BYTE register address | ||
| 55 | * auto-increments on multiple read | ||
| 56 | * @num_data: number of data bytes | ||
| 57 | * @num_normal_data: number of normal keys' data bytes | ||
| 58 | * @max_cols: maximum number of columns supported | ||
| 59 | * @max_rows: maximum number of rows supported | ||
| 60 | * @col_gpios: bitmask of gpios which can be used for columns | ||
| 61 | * @row_gpios: bitmask of gpios which can be used for rows | ||
| 62 | */ | ||
| 63 | struct stmpe_keypad_variant { | ||
| 64 | bool auto_increment; | ||
| 65 | int num_data; | ||
| 66 | int num_normal_data; | ||
| 67 | int max_cols; | ||
| 68 | int max_rows; | ||
| 69 | unsigned int col_gpios; | ||
| 70 | unsigned int row_gpios; | ||
| 71 | }; | ||
| 72 | |||
| 73 | static const struct stmpe_keypad_variant stmpe_keypad_variants[] = { | ||
| 74 | [STMPE1601] = { | ||
| 75 | .auto_increment = true, | ||
| 76 | .num_data = 5, | ||
| 77 | .num_normal_data = 3, | ||
| 78 | .max_cols = 8, | ||
| 79 | .max_rows = 8, | ||
| 80 | .col_gpios = 0x000ff, /* GPIO 0 - 7 */ | ||
| 81 | .row_gpios = 0x0ff00, /* GPIO 8 - 15 */ | ||
| 82 | }, | ||
| 83 | [STMPE2401] = { | ||
| 84 | .auto_increment = false, | ||
| 85 | .num_data = 3, | ||
| 86 | .num_normal_data = 2, | ||
| 87 | .max_cols = 8, | ||
| 88 | .max_rows = 12, | ||
| 89 | .col_gpios = 0x0000ff, /* GPIO 0 - 7*/ | ||
| 90 | .row_gpios = 0x1fef00, /* GPIO 8-14, 16-20 */ | ||
| 91 | }, | ||
| 92 | [STMPE2403] = { | ||
| 93 | .auto_increment = true, | ||
| 94 | .num_data = 5, | ||
| 95 | .num_normal_data = 3, | ||
| 96 | .max_cols = 8, | ||
| 97 | .max_rows = 12, | ||
| 98 | .col_gpios = 0x0000ff, /* GPIO 0 - 7*/ | ||
| 99 | .row_gpios = 0x1fef00, /* GPIO 8-14, 16-20 */ | ||
| 100 | }, | ||
| 101 | }; | ||
| 102 | |||
| 103 | struct stmpe_keypad { | ||
| 104 | struct stmpe *stmpe; | ||
| 105 | struct input_dev *input; | ||
| 106 | const struct stmpe_keypad_variant *variant; | ||
| 107 | const struct stmpe_keypad_platform_data *plat; | ||
| 108 | |||
| 109 | unsigned int rows; | ||
| 110 | unsigned int cols; | ||
| 111 | |||
| 112 | unsigned short keymap[STMPE_KEYPAD_KEYMAP_SIZE]; | ||
| 113 | }; | ||
| 114 | |||
| 115 | static int stmpe_keypad_read_data(struct stmpe_keypad *keypad, u8 *data) | ||
| 116 | { | ||
| 117 | const struct stmpe_keypad_variant *variant = keypad->variant; | ||
| 118 | struct stmpe *stmpe = keypad->stmpe; | ||
| 119 | int ret; | ||
| 120 | int i; | ||
| 121 | |||
| 122 | if (variant->auto_increment) | ||
| 123 | return stmpe_block_read(stmpe, STMPE_KPC_DATA_BYTE0, | ||
| 124 | variant->num_data, data); | ||
| 125 | |||
| 126 | for (i = 0; i < variant->num_data; i++) { | ||
| 127 | ret = stmpe_reg_read(stmpe, STMPE_KPC_DATA_BYTE0 + i); | ||
| 128 | if (ret < 0) | ||
| 129 | return ret; | ||
| 130 | |||
| 131 | data[i] = ret; | ||
| 132 | } | ||
| 133 | |||
| 134 | return 0; | ||
| 135 | } | ||
| 136 | |||
| 137 | static irqreturn_t stmpe_keypad_irq(int irq, void *dev) | ||
| 138 | { | ||
| 139 | struct stmpe_keypad *keypad = dev; | ||
| 140 | struct input_dev *input = keypad->input; | ||
| 141 | const struct stmpe_keypad_variant *variant = keypad->variant; | ||
| 142 | u8 fifo[variant->num_data]; | ||
| 143 | int ret; | ||
| 144 | int i; | ||
| 145 | |||
| 146 | ret = stmpe_keypad_read_data(keypad, fifo); | ||
| 147 | if (ret < 0) | ||
| 148 | return IRQ_NONE; | ||
| 149 | |||
| 150 | for (i = 0; i < variant->num_normal_data; i++) { | ||
| 151 | u8 data = fifo[i]; | ||
| 152 | int row = (data & STMPE_KPC_DATA_ROW) >> 3; | ||
| 153 | int col = data & STMPE_KPC_DATA_COL; | ||
| 154 | int code = MATRIX_SCAN_CODE(row, col, STMPE_KEYPAD_ROW_SHIFT); | ||
| 155 | bool up = data & STMPE_KPC_DATA_UP; | ||
| 156 | |||
| 157 | if ((data & STMPE_KPC_DATA_NOKEY_MASK) | ||
| 158 | == STMPE_KPC_DATA_NOKEY_MASK) | ||
| 159 | continue; | ||
| 160 | |||
| 161 | input_event(input, EV_MSC, MSC_SCAN, code); | ||
| 162 | input_report_key(input, keypad->keymap[code], !up); | ||
| 163 | input_sync(input); | ||
| 164 | } | ||
| 165 | |||
| 166 | return IRQ_HANDLED; | ||
| 167 | } | ||
| 168 | |||
| 169 | static int __devinit stmpe_keypad_altfunc_init(struct stmpe_keypad *keypad) | ||
| 170 | { | ||
| 171 | const struct stmpe_keypad_variant *variant = keypad->variant; | ||
| 172 | unsigned int col_gpios = variant->col_gpios; | ||
| 173 | unsigned int row_gpios = variant->row_gpios; | ||
| 174 | struct stmpe *stmpe = keypad->stmpe; | ||
| 175 | unsigned int pins = 0; | ||
| 176 | int i; | ||
| 177 | |||
| 178 | /* | ||
| 179 | * Figure out which pins need to be set to the keypad alternate | ||
| 180 | * function. | ||
| 181 | * | ||
| 182 | * {cols,rows}_gpios are bitmasks of which pins on the chip can be used | ||
| 183 | * for the keypad. | ||
| 184 | * | ||
| 185 | * keypad->{cols,rows} are a bitmask of which pins (of the ones useable | ||
| 186 | * for the keypad) are used on the board. | ||
| 187 | */ | ||
| 188 | |||
| 189 | for (i = 0; i < variant->max_cols; i++) { | ||
| 190 | int num = __ffs(col_gpios); | ||
| 191 | |||
| 192 | if (keypad->cols & (1 << i)) | ||
| 193 | pins |= 1 << num; | ||
| 194 | |||
| 195 | col_gpios &= ~(1 << num); | ||
| 196 | } | ||
| 197 | |||
| 198 | for (i = 0; i < variant->max_rows; i++) { | ||
| 199 | int num = __ffs(row_gpios); | ||
| 200 | |||
| 201 | if (keypad->rows & (1 << i)) | ||
| 202 | pins |= 1 << num; | ||
| 203 | |||
| 204 | row_gpios &= ~(1 << num); | ||
| 205 | } | ||
| 206 | |||
| 207 | return stmpe_set_altfunc(stmpe, pins, STMPE_BLOCK_KEYPAD); | ||
| 208 | } | ||
| 209 | |||
| 210 | static int __devinit stmpe_keypad_chip_init(struct stmpe_keypad *keypad) | ||
| 211 | { | ||
| 212 | const struct stmpe_keypad_platform_data *plat = keypad->plat; | ||
| 213 | const struct stmpe_keypad_variant *variant = keypad->variant; | ||
| 214 | struct stmpe *stmpe = keypad->stmpe; | ||
| 215 | int ret; | ||
| 216 | |||
| 217 | if (plat->debounce_ms > STMPE_KEYPAD_MAX_DEBOUNCE) | ||
| 218 | return -EINVAL; | ||
| 219 | |||
| 220 | if (plat->scan_count > STMPE_KEYPAD_MAX_SCAN_COUNT) | ||
| 221 | return -EINVAL; | ||
| 222 | |||
| 223 | ret = stmpe_enable(stmpe, STMPE_BLOCK_KEYPAD); | ||
| 224 | if (ret < 0) | ||
| 225 | return ret; | ||
| 226 | |||
| 227 | ret = stmpe_keypad_altfunc_init(keypad); | ||
| 228 | if (ret < 0) | ||
| 229 | return ret; | ||
| 230 | |||
| 231 | ret = stmpe_reg_write(stmpe, STMPE_KPC_COL, keypad->cols); | ||
| 232 | if (ret < 0) | ||
| 233 | return ret; | ||
| 234 | |||
| 235 | ret = stmpe_reg_write(stmpe, STMPE_KPC_ROW_LSB, keypad->rows); | ||
| 236 | if (ret < 0) | ||
| 237 | return ret; | ||
| 238 | |||
| 239 | if (variant->max_rows > 8) { | ||
| 240 | ret = stmpe_set_bits(stmpe, STMPE_KPC_ROW_MSB, | ||
| 241 | STMPE_KPC_ROW_MSB_ROWS, | ||
| 242 | keypad->rows >> 8); | ||
| 243 | if (ret < 0) | ||
| 244 | return ret; | ||
| 245 | } | ||
| 246 | |||
| 247 | ret = stmpe_set_bits(stmpe, STMPE_KPC_CTRL_MSB, | ||
| 248 | STMPE_KPC_CTRL_MSB_SCAN_COUNT, | ||
| 249 | plat->scan_count << 4); | ||
| 250 | if (ret < 0) | ||
| 251 | return ret; | ||
| 252 | |||
| 253 | return stmpe_set_bits(stmpe, STMPE_KPC_CTRL_LSB, | ||
| 254 | STMPE_KPC_CTRL_LSB_SCAN | | ||
| 255 | STMPE_KPC_CTRL_LSB_DEBOUNCE, | ||
| 256 | STMPE_KPC_CTRL_LSB_SCAN | | ||
| 257 | (plat->debounce_ms << 1)); | ||
| 258 | } | ||
| 259 | |||
| 260 | static int __devinit stmpe_keypad_probe(struct platform_device *pdev) | ||
| 261 | { | ||
| 262 | struct stmpe *stmpe = dev_get_drvdata(pdev->dev.parent); | ||
| 263 | struct stmpe_keypad_platform_data *plat; | ||
| 264 | struct stmpe_keypad *keypad; | ||
| 265 | struct input_dev *input; | ||
| 266 | int ret; | ||
| 267 | int irq; | ||
| 268 | int i; | ||
| 269 | |||
| 270 | plat = stmpe->pdata->keypad; | ||
| 271 | if (!plat) | ||
| 272 | return -ENODEV; | ||
| 273 | |||
| 274 | irq = platform_get_irq(pdev, 0); | ||
| 275 | if (irq < 0) | ||
| 276 | return irq; | ||
| 277 | |||
| 278 | keypad = kzalloc(sizeof(struct stmpe_keypad), GFP_KERNEL); | ||
| 279 | if (!keypad) | ||
| 280 | return -ENOMEM; | ||
| 281 | |||
| 282 | input = input_allocate_device(); | ||
| 283 | if (!input) { | ||
| 284 | ret = -ENOMEM; | ||
| 285 | goto out_freekeypad; | ||
| 286 | } | ||
| 287 | |||
| 288 | input->name = "STMPE keypad"; | ||
| 289 | input->id.bustype = BUS_I2C; | ||
| 290 | input->dev.parent = &pdev->dev; | ||
| 291 | |||
| 292 | input_set_capability(input, EV_MSC, MSC_SCAN); | ||
| 293 | |||
| 294 | __set_bit(EV_KEY, input->evbit); | ||
| 295 | if (!plat->no_autorepeat) | ||
| 296 | __set_bit(EV_REP, input->evbit); | ||
| 297 | |||
| 298 | input->keycode = keypad->keymap; | ||
| 299 | input->keycodesize = sizeof(keypad->keymap[0]); | ||
| 300 | input->keycodemax = ARRAY_SIZE(keypad->keymap); | ||
| 301 | |||
| 302 | matrix_keypad_build_keymap(plat->keymap_data, STMPE_KEYPAD_ROW_SHIFT, | ||
| 303 | input->keycode, input->keybit); | ||
| 304 | |||
| 305 | for (i = 0; i < plat->keymap_data->keymap_size; i++) { | ||
| 306 | unsigned int key = plat->keymap_data->keymap[i]; | ||
| 307 | |||
| 308 | keypad->cols |= 1 << KEY_COL(key); | ||
| 309 | keypad->rows |= 1 << KEY_ROW(key); | ||
| 310 | } | ||
| 311 | |||
| 312 | keypad->stmpe = stmpe; | ||
| 313 | keypad->plat = plat; | ||
| 314 | keypad->input = input; | ||
| 315 | keypad->variant = &stmpe_keypad_variants[stmpe->partnum]; | ||
| 316 | |||
| 317 | ret = stmpe_keypad_chip_init(keypad); | ||
| 318 | if (ret < 0) | ||
| 319 | goto out_freeinput; | ||
| 320 | |||
| 321 | ret = input_register_device(input); | ||
| 322 | if (ret) { | ||
| 323 | dev_err(&pdev->dev, | ||
| 324 | "unable to register input device: %d\n", ret); | ||
| 325 | goto out_freeinput; | ||
| 326 | } | ||
| 327 | |||
| 328 | ret = request_threaded_irq(irq, NULL, stmpe_keypad_irq, IRQF_ONESHOT, | ||
| 329 | "stmpe-keypad", keypad); | ||
| 330 | if (ret) { | ||
| 331 | dev_err(&pdev->dev, "unable to get irq: %d\n", ret); | ||
| 332 | goto out_unregisterinput; | ||
| 333 | } | ||
| 334 | |||
| 335 | platform_set_drvdata(pdev, keypad); | ||
| 336 | |||
| 337 | return 0; | ||
| 338 | |||
| 339 | out_unregisterinput: | ||
| 340 | input_unregister_device(input); | ||
| 341 | input = NULL; | ||
| 342 | out_freeinput: | ||
| 343 | input_free_device(input); | ||
| 344 | out_freekeypad: | ||
| 345 | kfree(keypad); | ||
| 346 | return ret; | ||
| 347 | } | ||
| 348 | |||
| 349 | static int __devexit stmpe_keypad_remove(struct platform_device *pdev) | ||
| 350 | { | ||
| 351 | struct stmpe_keypad *keypad = platform_get_drvdata(pdev); | ||
| 352 | struct stmpe *stmpe = keypad->stmpe; | ||
| 353 | int irq = platform_get_irq(pdev, 0); | ||
| 354 | |||
| 355 | stmpe_disable(stmpe, STMPE_BLOCK_KEYPAD); | ||
| 356 | |||
| 357 | free_irq(irq, keypad); | ||
| 358 | input_unregister_device(keypad->input); | ||
| 359 | platform_set_drvdata(pdev, NULL); | ||
| 360 | kfree(keypad); | ||
| 361 | |||
| 362 | return 0; | ||
| 363 | } | ||
| 364 | |||
| 365 | static struct platform_driver stmpe_keypad_driver = { | ||
| 366 | .driver.name = "stmpe-keypad", | ||
| 367 | .driver.owner = THIS_MODULE, | ||
| 368 | .probe = stmpe_keypad_probe, | ||
| 369 | .remove = __devexit_p(stmpe_keypad_remove), | ||
| 370 | }; | ||
| 371 | |||
| 372 | static int __init stmpe_keypad_init(void) | ||
| 373 | { | ||
| 374 | return platform_driver_register(&stmpe_keypad_driver); | ||
| 375 | } | ||
| 376 | module_init(stmpe_keypad_init); | ||
| 377 | |||
| 378 | static void __exit stmpe_keypad_exit(void) | ||
| 379 | { | ||
| 380 | platform_driver_unregister(&stmpe_keypad_driver); | ||
| 381 | } | ||
| 382 | module_exit(stmpe_keypad_exit); | ||
| 383 | |||
| 384 | MODULE_LICENSE("GPL v2"); | ||
| 385 | MODULE_DESCRIPTION("STMPExxxx keypad driver"); | ||
| 386 | MODULE_AUTHOR("Rabin Vincent <rabin.vincent@stericsson.com>"); | ||
diff --git a/drivers/input/misc/ati_remote2.c b/drivers/input/misc/ati_remote2.c index e148749b5851..23257652b8e8 100644 --- a/drivers/input/misc/ati_remote2.c +++ b/drivers/input/misc/ati_remote2.c | |||
| @@ -38,7 +38,8 @@ enum { | |||
| 38 | }; | 38 | }; |
| 39 | 39 | ||
| 40 | static int ati_remote2_set_mask(const char *val, | 40 | static int ati_remote2_set_mask(const char *val, |
| 41 | struct kernel_param *kp, unsigned int max) | 41 | const struct kernel_param *kp, |
| 42 | unsigned int max) | ||
| 42 | { | 43 | { |
| 43 | unsigned long mask; | 44 | unsigned long mask; |
| 44 | int ret; | 45 | int ret; |
| @@ -59,28 +60,31 @@ static int ati_remote2_set_mask(const char *val, | |||
| 59 | } | 60 | } |
| 60 | 61 | ||
| 61 | static int ati_remote2_set_channel_mask(const char *val, | 62 | static int ati_remote2_set_channel_mask(const char *val, |
| 62 | struct kernel_param *kp) | 63 | const struct kernel_param *kp) |
| 63 | { | 64 | { |
| 64 | pr_debug("%s()\n", __func__); | 65 | pr_debug("%s()\n", __func__); |
| 65 | 66 | ||
| 66 | return ati_remote2_set_mask(val, kp, ATI_REMOTE2_MAX_CHANNEL_MASK); | 67 | return ati_remote2_set_mask(val, kp, ATI_REMOTE2_MAX_CHANNEL_MASK); |
| 67 | } | 68 | } |
| 68 | 69 | ||
| 69 | static int ati_remote2_get_channel_mask(char *buffer, struct kernel_param *kp) | 70 | static int ati_remote2_get_channel_mask(char *buffer, |
| 71 | const struct kernel_param *kp) | ||
| 70 | { | 72 | { |
| 71 | pr_debug("%s()\n", __func__); | 73 | pr_debug("%s()\n", __func__); |
| 72 | 74 | ||
| 73 | return sprintf(buffer, "0x%04x", *(unsigned int *)kp->arg); | 75 | return sprintf(buffer, "0x%04x", *(unsigned int *)kp->arg); |
| 74 | } | 76 | } |
| 75 | 77 | ||
| 76 | static int ati_remote2_set_mode_mask(const char *val, struct kernel_param *kp) | 78 | static int ati_remote2_set_mode_mask(const char *val, |
| 79 | const struct kernel_param *kp) | ||
| 77 | { | 80 | { |
| 78 | pr_debug("%s()\n", __func__); | 81 | pr_debug("%s()\n", __func__); |
| 79 | 82 | ||
| 80 | return ati_remote2_set_mask(val, kp, ATI_REMOTE2_MAX_MODE_MASK); | 83 | return ati_remote2_set_mask(val, kp, ATI_REMOTE2_MAX_MODE_MASK); |
| 81 | } | 84 | } |
| 82 | 85 | ||
| 83 | static int ati_remote2_get_mode_mask(char *buffer, struct kernel_param *kp) | 86 | static int ati_remote2_get_mode_mask(char *buffer, |
| 87 | const struct kernel_param *kp) | ||
| 84 | { | 88 | { |
| 85 | pr_debug("%s()\n", __func__); | 89 | pr_debug("%s()\n", __func__); |
| 86 | 90 | ||
| @@ -89,15 +93,19 @@ static int ati_remote2_get_mode_mask(char *buffer, struct kernel_param *kp) | |||
| 89 | 93 | ||
| 90 | static unsigned int channel_mask = ATI_REMOTE2_MAX_CHANNEL_MASK; | 94 | static unsigned int channel_mask = ATI_REMOTE2_MAX_CHANNEL_MASK; |
| 91 | #define param_check_channel_mask(name, p) __param_check(name, p, unsigned int) | 95 | #define param_check_channel_mask(name, p) __param_check(name, p, unsigned int) |
| 92 | #define param_set_channel_mask ati_remote2_set_channel_mask | 96 | static struct kernel_param_ops param_ops_channel_mask = { |
| 93 | #define param_get_channel_mask ati_remote2_get_channel_mask | 97 | .set = ati_remote2_set_channel_mask, |
| 98 | .get = ati_remote2_get_channel_mask, | ||
| 99 | }; | ||
| 94 | module_param(channel_mask, channel_mask, 0644); | 100 | module_param(channel_mask, channel_mask, 0644); |
| 95 | MODULE_PARM_DESC(channel_mask, "Bitmask of channels to accept <15:Channel16>...<1:Channel2><0:Channel1>"); | 101 | MODULE_PARM_DESC(channel_mask, "Bitmask of channels to accept <15:Channel16>...<1:Channel2><0:Channel1>"); |
| 96 | 102 | ||
| 97 | static unsigned int mode_mask = ATI_REMOTE2_MAX_MODE_MASK; | 103 | static unsigned int mode_mask = ATI_REMOTE2_MAX_MODE_MASK; |
| 98 | #define param_check_mode_mask(name, p) __param_check(name, p, unsigned int) | 104 | #define param_check_mode_mask(name, p) __param_check(name, p, unsigned int) |
| 99 | #define param_set_mode_mask ati_remote2_set_mode_mask | 105 | static struct kernel_param_ops param_ops_mode_mask = { |
| 100 | #define param_get_mode_mask ati_remote2_get_mode_mask | 106 | .set = ati_remote2_set_mode_mask, |
| 107 | .get = ati_remote2_get_mode_mask, | ||
| 108 | }; | ||
| 101 | module_param(mode_mask, mode_mask, 0644); | 109 | module_param(mode_mask, mode_mask, 0644); |
| 102 | MODULE_PARM_DESC(mode_mask, "Bitmask of modes to accept <4:PC><3:AUX4><2:AUX3><1:AUX2><0:AUX1>"); | 110 | MODULE_PARM_DESC(mode_mask, "Bitmask of modes to accept <4:PC><3:AUX4><2:AUX3><1:AUX2><0:AUX1>"); |
| 103 | 111 | ||
diff --git a/drivers/input/misc/sparcspkr.c b/drivers/input/misc/sparcspkr.c index f3bb92e9755f..8e130bf7d32b 100644 --- a/drivers/input/misc/sparcspkr.c +++ b/drivers/input/misc/sparcspkr.c | |||
| @@ -173,7 +173,7 @@ static int __devinit sparcspkr_probe(struct device *dev) | |||
| 173 | return 0; | 173 | return 0; |
| 174 | } | 174 | } |
| 175 | 175 | ||
| 176 | static int sparcspkr_shutdown(struct of_device *dev) | 176 | static int sparcspkr_shutdown(struct platform_device *dev) |
| 177 | { | 177 | { |
| 178 | struct sparcspkr_state *state = dev_get_drvdata(&dev->dev); | 178 | struct sparcspkr_state *state = dev_get_drvdata(&dev->dev); |
| 179 | struct input_dev *input_dev = state->input_dev; | 179 | struct input_dev *input_dev = state->input_dev; |
| @@ -184,7 +184,7 @@ static int sparcspkr_shutdown(struct of_device *dev) | |||
| 184 | return 0; | 184 | return 0; |
| 185 | } | 185 | } |
| 186 | 186 | ||
| 187 | static int __devinit bbc_beep_probe(struct of_device *op, const struct of_device_id *match) | 187 | static int __devinit bbc_beep_probe(struct platform_device *op, const struct of_device_id *match) |
| 188 | { | 188 | { |
| 189 | struct sparcspkr_state *state; | 189 | struct sparcspkr_state *state; |
| 190 | struct bbc_beep_info *info; | 190 | struct bbc_beep_info *info; |
| @@ -231,7 +231,7 @@ out_err: | |||
| 231 | return err; | 231 | return err; |
| 232 | } | 232 | } |
| 233 | 233 | ||
| 234 | static int __devexit bbc_remove(struct of_device *op) | 234 | static int __devexit bbc_remove(struct platform_device *op) |
| 235 | { | 235 | { |
| 236 | struct sparcspkr_state *state = dev_get_drvdata(&op->dev); | 236 | struct sparcspkr_state *state = dev_get_drvdata(&op->dev); |
| 237 | struct input_dev *input_dev = state->input_dev; | 237 | struct input_dev *input_dev = state->input_dev; |
| @@ -269,7 +269,7 @@ static struct of_platform_driver bbc_beep_driver = { | |||
| 269 | .shutdown = sparcspkr_shutdown, | 269 | .shutdown = sparcspkr_shutdown, |
| 270 | }; | 270 | }; |
| 271 | 271 | ||
| 272 | static int __devinit grover_beep_probe(struct of_device *op, const struct of_device_id *match) | 272 | static int __devinit grover_beep_probe(struct platform_device *op, const struct of_device_id *match) |
| 273 | { | 273 | { |
| 274 | struct sparcspkr_state *state; | 274 | struct sparcspkr_state *state; |
| 275 | struct grover_beep_info *info; | 275 | struct grover_beep_info *info; |
| @@ -312,7 +312,7 @@ out_err: | |||
| 312 | return err; | 312 | return err; |
| 313 | } | 313 | } |
| 314 | 314 | ||
| 315 | static int __devexit grover_remove(struct of_device *op) | 315 | static int __devexit grover_remove(struct platform_device *op) |
| 316 | { | 316 | { |
| 317 | struct sparcspkr_state *state = dev_get_drvdata(&op->dev); | 317 | struct sparcspkr_state *state = dev_get_drvdata(&op->dev); |
| 318 | struct grover_beep_info *info = &state->u.grover; | 318 | struct grover_beep_info *info = &state->u.grover; |
diff --git a/drivers/input/mouse/psmouse-base.c b/drivers/input/mouse/psmouse-base.c index 979c50215282..73a7af2542a8 100644 --- a/drivers/input/mouse/psmouse-base.c +++ b/drivers/input/mouse/psmouse-base.c | |||
| @@ -39,11 +39,13 @@ MODULE_DESCRIPTION(DRIVER_DESC); | |||
| 39 | MODULE_LICENSE("GPL"); | 39 | MODULE_LICENSE("GPL"); |
| 40 | 40 | ||
| 41 | static unsigned int psmouse_max_proto = PSMOUSE_AUTO; | 41 | static unsigned int psmouse_max_proto = PSMOUSE_AUTO; |
| 42 | static int psmouse_set_maxproto(const char *val, struct kernel_param *kp); | 42 | static int psmouse_set_maxproto(const char *val, const struct kernel_param *); |
| 43 | static int psmouse_get_maxproto(char *buffer, struct kernel_param *kp); | 43 | static int psmouse_get_maxproto(char *buffer, const struct kernel_param *kp); |
| 44 | static struct kernel_param_ops param_ops_proto_abbrev = { | ||
| 45 | .set = psmouse_set_maxproto, | ||
| 46 | .get = psmouse_get_maxproto, | ||
| 47 | }; | ||
| 44 | #define param_check_proto_abbrev(name, p) __param_check(name, p, unsigned int) | 48 | #define param_check_proto_abbrev(name, p) __param_check(name, p, unsigned int) |
| 45 | #define param_set_proto_abbrev psmouse_set_maxproto | ||
| 46 | #define param_get_proto_abbrev psmouse_get_maxproto | ||
| 47 | module_param_named(proto, psmouse_max_proto, proto_abbrev, 0644); | 49 | module_param_named(proto, psmouse_max_proto, proto_abbrev, 0644); |
| 48 | MODULE_PARM_DESC(proto, "Highest protocol extension to probe (bare, imps, exps, any). Useful for KVM switches."); | 50 | MODULE_PARM_DESC(proto, "Highest protocol extension to probe (bare, imps, exps, any). Useful for KVM switches."); |
| 49 | 51 | ||
| @@ -1679,7 +1681,7 @@ static ssize_t psmouse_attr_set_resolution(struct psmouse *psmouse, void *data, | |||
| 1679 | } | 1681 | } |
| 1680 | 1682 | ||
| 1681 | 1683 | ||
| 1682 | static int psmouse_set_maxproto(const char *val, struct kernel_param *kp) | 1684 | static int psmouse_set_maxproto(const char *val, const struct kernel_param *kp) |
| 1683 | { | 1685 | { |
| 1684 | const struct psmouse_protocol *proto; | 1686 | const struct psmouse_protocol *proto; |
| 1685 | 1687 | ||
| @@ -1696,7 +1698,7 @@ static int psmouse_set_maxproto(const char *val, struct kernel_param *kp) | |||
| 1696 | return 0; | 1698 | return 0; |
| 1697 | } | 1699 | } |
| 1698 | 1700 | ||
| 1699 | static int psmouse_get_maxproto(char *buffer, struct kernel_param *kp) | 1701 | static int psmouse_get_maxproto(char *buffer, const struct kernel_param *kp) |
| 1700 | { | 1702 | { |
| 1701 | int type = *((unsigned int *)kp->arg); | 1703 | int type = *((unsigned int *)kp->arg); |
| 1702 | 1704 | ||
diff --git a/drivers/input/serio/i8042-sparcio.h b/drivers/input/serio/i8042-sparcio.h index cb2a24b94746..c5cc4508d6df 100644 --- a/drivers/input/serio/i8042-sparcio.h +++ b/drivers/input/serio/i8042-sparcio.h | |||
| @@ -49,7 +49,7 @@ static inline void i8042_write_command(int val) | |||
| 49 | #define OBP_PS2MS_NAME1 "kdmouse" | 49 | #define OBP_PS2MS_NAME1 "kdmouse" |
| 50 | #define OBP_PS2MS_NAME2 "mouse" | 50 | #define OBP_PS2MS_NAME2 "mouse" |
| 51 | 51 | ||
| 52 | static int __devinit sparc_i8042_probe(struct of_device *op, const struct of_device_id *match) | 52 | static int __devinit sparc_i8042_probe(struct platform_device *op, const struct of_device_id *match) |
| 53 | { | 53 | { |
| 54 | struct device_node *dp = op->dev.of_node; | 54 | struct device_node *dp = op->dev.of_node; |
| 55 | 55 | ||
| @@ -57,7 +57,7 @@ static int __devinit sparc_i8042_probe(struct of_device *op, const struct of_dev | |||
| 57 | while (dp) { | 57 | while (dp) { |
| 58 | if (!strcmp(dp->name, OBP_PS2KBD_NAME1) || | 58 | if (!strcmp(dp->name, OBP_PS2KBD_NAME1) || |
| 59 | !strcmp(dp->name, OBP_PS2KBD_NAME2)) { | 59 | !strcmp(dp->name, OBP_PS2KBD_NAME2)) { |
| 60 | struct of_device *kbd = of_find_device_by_node(dp); | 60 | struct platform_device *kbd = of_find_device_by_node(dp); |
| 61 | unsigned int irq = kbd->archdata.irqs[0]; | 61 | unsigned int irq = kbd->archdata.irqs[0]; |
| 62 | if (irq == 0xffffffff) | 62 | if (irq == 0xffffffff) |
| 63 | irq = op->archdata.irqs[0]; | 63 | irq = op->archdata.irqs[0]; |
| @@ -67,7 +67,7 @@ static int __devinit sparc_i8042_probe(struct of_device *op, const struct of_dev | |||
| 67 | kbd_res = &kbd->resource[0]; | 67 | kbd_res = &kbd->resource[0]; |
| 68 | } else if (!strcmp(dp->name, OBP_PS2MS_NAME1) || | 68 | } else if (!strcmp(dp->name, OBP_PS2MS_NAME1) || |
| 69 | !strcmp(dp->name, OBP_PS2MS_NAME2)) { | 69 | !strcmp(dp->name, OBP_PS2MS_NAME2)) { |
| 70 | struct of_device *ms = of_find_device_by_node(dp); | 70 | struct platform_device *ms = of_find_device_by_node(dp); |
| 71 | unsigned int irq = ms->archdata.irqs[0]; | 71 | unsigned int irq = ms->archdata.irqs[0]; |
| 72 | if (irq == 0xffffffff) | 72 | if (irq == 0xffffffff) |
| 73 | irq = op->archdata.irqs[0]; | 73 | irq = op->archdata.irqs[0]; |
| @@ -80,7 +80,7 @@ static int __devinit sparc_i8042_probe(struct of_device *op, const struct of_dev | |||
| 80 | return 0; | 80 | return 0; |
| 81 | } | 81 | } |
| 82 | 82 | ||
| 83 | static int __devexit sparc_i8042_remove(struct of_device *op) | 83 | static int __devexit sparc_i8042_remove(struct platform_device *op) |
| 84 | { | 84 | { |
| 85 | of_iounmap(kbd_res, kbd_iobase, 8); | 85 | of_iounmap(kbd_res, kbd_iobase, 8); |
| 86 | 86 | ||
diff --git a/drivers/input/serio/i8042.c b/drivers/input/serio/i8042.c index 258b98b9d7c2..46e4ba0b9246 100644 --- a/drivers/input/serio/i8042.c +++ b/drivers/input/serio/i8042.c | |||
| @@ -61,10 +61,6 @@ static bool i8042_noloop; | |||
| 61 | module_param_named(noloop, i8042_noloop, bool, 0); | 61 | module_param_named(noloop, i8042_noloop, bool, 0); |
| 62 | MODULE_PARM_DESC(noloop, "Disable the AUX Loopback command while probing for the AUX port"); | 62 | MODULE_PARM_DESC(noloop, "Disable the AUX Loopback command while probing for the AUX port"); |
| 63 | 63 | ||
| 64 | static unsigned int i8042_blink_frequency = 500; | ||
| 65 | module_param_named(panicblink, i8042_blink_frequency, uint, 0600); | ||
| 66 | MODULE_PARM_DESC(panicblink, "Frequency with which keyboard LEDs should blink when kernel panics"); | ||
| 67 | |||
| 68 | #ifdef CONFIG_X86 | 64 | #ifdef CONFIG_X86 |
| 69 | static bool i8042_dritek; | 65 | static bool i8042_dritek; |
| 70 | module_param_named(dritek, i8042_dritek, bool, 0); | 66 | module_param_named(dritek, i8042_dritek, bool, 0); |
| @@ -1030,8 +1026,8 @@ static void i8042_controller_reset(void) | |||
| 1030 | 1026 | ||
| 1031 | 1027 | ||
| 1032 | /* | 1028 | /* |
| 1033 | * i8042_panic_blink() will flash the keyboard LEDs and is called when | 1029 | * i8042_panic_blink() will turn the keyboard LEDs on or off and is called |
| 1034 | * kernel panics. Flashing LEDs is useful for users running X who may | 1030 | * when kernel panics. Flashing LEDs is useful for users running X who may |
| 1035 | * not see the console and will help distingushing panics from "real" | 1031 | * not see the console and will help distingushing panics from "real" |
| 1036 | * lockups. | 1032 | * lockups. |
| 1037 | * | 1033 | * |
| @@ -1041,22 +1037,12 @@ static void i8042_controller_reset(void) | |||
| 1041 | 1037 | ||
| 1042 | #define DELAY do { mdelay(1); if (++delay > 10) return delay; } while(0) | 1038 | #define DELAY do { mdelay(1); if (++delay > 10) return delay; } while(0) |
| 1043 | 1039 | ||
| 1044 | static long i8042_panic_blink(long count) | 1040 | static long i8042_panic_blink(int state) |
| 1045 | { | 1041 | { |
| 1046 | long delay = 0; | 1042 | long delay = 0; |
| 1047 | static long last_blink; | 1043 | char led; |
| 1048 | static char led; | ||
| 1049 | |||
| 1050 | /* | ||
| 1051 | * We expect frequency to be about 1/2s. KDB uses about 1s. | ||
| 1052 | * Make sure they are different. | ||
| 1053 | */ | ||
| 1054 | if (!i8042_blink_frequency) | ||
| 1055 | return 0; | ||
| 1056 | if (count - last_blink < i8042_blink_frequency) | ||
| 1057 | return 0; | ||
| 1058 | 1044 | ||
| 1059 | led ^= 0x01 | 0x04; | 1045 | led = (state) ? 0x01 | 0x04 : 0; |
| 1060 | while (i8042_read_status() & I8042_STR_IBF) | 1046 | while (i8042_read_status() & I8042_STR_IBF) |
| 1061 | DELAY; | 1047 | DELAY; |
| 1062 | dbg("%02x -> i8042 (panic blink)", 0xed); | 1048 | dbg("%02x -> i8042 (panic blink)", 0xed); |
| @@ -1069,7 +1055,6 @@ static long i8042_panic_blink(long count) | |||
| 1069 | dbg("%02x -> i8042 (panic blink)", led); | 1055 | dbg("%02x -> i8042 (panic blink)", led); |
| 1070 | i8042_write_data(led); | 1056 | i8042_write_data(led); |
| 1071 | DELAY; | 1057 | DELAY; |
| 1072 | last_blink = count; | ||
| 1073 | return delay; | 1058 | return delay; |
| 1074 | } | 1059 | } |
| 1075 | 1060 | ||
diff --git a/drivers/input/serio/xilinx_ps2.c b/drivers/input/serio/xilinx_ps2.c index e2c028d2638f..bb14449fb022 100644 --- a/drivers/input/serio/xilinx_ps2.c +++ b/drivers/input/serio/xilinx_ps2.c | |||
| @@ -232,7 +232,7 @@ static void sxps2_close(struct serio *pserio) | |||
| 232 | * It returns 0, if the driver is bound to the PS/2 device, or a negative | 232 | * It returns 0, if the driver is bound to the PS/2 device, or a negative |
| 233 | * value if there is an error. | 233 | * value if there is an error. |
| 234 | */ | 234 | */ |
| 235 | static int __devinit xps2_of_probe(struct of_device *ofdev, | 235 | static int __devinit xps2_of_probe(struct platform_device *ofdev, |
| 236 | const struct of_device_id *match) | 236 | const struct of_device_id *match) |
| 237 | { | 237 | { |
| 238 | struct resource r_irq; /* Interrupt resources */ | 238 | struct resource r_irq; /* Interrupt resources */ |
| @@ -332,7 +332,7 @@ failed1: | |||
| 332 | * if the driver module is being unloaded. It frees any resources allocated to | 332 | * if the driver module is being unloaded. It frees any resources allocated to |
| 333 | * the device. | 333 | * the device. |
| 334 | */ | 334 | */ |
| 335 | static int __devexit xps2_of_remove(struct of_device *of_dev) | 335 | static int __devexit xps2_of_remove(struct platform_device *of_dev) |
| 336 | { | 336 | { |
| 337 | struct device *dev = &of_dev->dev; | 337 | struct device *dev = &of_dev->dev; |
| 338 | struct xps2data *drvdata = dev_get_drvdata(dev); | 338 | struct xps2data *drvdata = dev_get_drvdata(dev); |
diff --git a/drivers/input/touchscreen/Kconfig b/drivers/input/touchscreen/Kconfig index 61f35184f76c..0069d9703fda 100644 --- a/drivers/input/touchscreen/Kconfig +++ b/drivers/input/touchscreen/Kconfig | |||
| @@ -628,4 +628,14 @@ config TOUCHSCREEN_TPS6507X | |||
| 628 | To compile this driver as a module, choose M here: the | 628 | To compile this driver as a module, choose M here: the |
| 629 | module will be called tps6507x_ts. | 629 | module will be called tps6507x_ts. |
| 630 | 630 | ||
| 631 | config TOUCHSCREEN_STMPE | ||
| 632 | tristate "STMicroelectronics STMPE touchscreens" | ||
| 633 | depends on MFD_STMPE | ||
| 634 | help | ||
| 635 | Say Y here if you want support for STMicroelectronics | ||
| 636 | STMPE touchscreen controllers. | ||
| 637 | |||
| 638 | To compile this driver as a module, choose M here: the | ||
| 639 | module will be called stmpe-ts. | ||
| 640 | |||
| 631 | endif | 641 | endif |
diff --git a/drivers/input/touchscreen/Makefile b/drivers/input/touchscreen/Makefile index bd6f30b4ff70..28217e1dcafd 100644 --- a/drivers/input/touchscreen/Makefile +++ b/drivers/input/touchscreen/Makefile | |||
| @@ -36,6 +36,7 @@ obj-$(CONFIG_TOUCHSCREEN_PCAP) += pcap_ts.o | |||
| 36 | obj-$(CONFIG_TOUCHSCREEN_PENMOUNT) += penmount.o | 36 | obj-$(CONFIG_TOUCHSCREEN_PENMOUNT) += penmount.o |
| 37 | obj-$(CONFIG_TOUCHSCREEN_QT602240) += qt602240_ts.o | 37 | obj-$(CONFIG_TOUCHSCREEN_QT602240) += qt602240_ts.o |
| 38 | obj-$(CONFIG_TOUCHSCREEN_S3C2410) += s3c2410_ts.o | 38 | obj-$(CONFIG_TOUCHSCREEN_S3C2410) += s3c2410_ts.o |
| 39 | obj-$(CONFIG_TOUCHSCREEN_STMPE) += stmpe-ts.o | ||
| 39 | obj-$(CONFIG_TOUCHSCREEN_TOUCHIT213) += touchit213.o | 40 | obj-$(CONFIG_TOUCHSCREEN_TOUCHIT213) += touchit213.o |
| 40 | obj-$(CONFIG_TOUCHSCREEN_TOUCHRIGHT) += touchright.o | 41 | obj-$(CONFIG_TOUCHSCREEN_TOUCHRIGHT) += touchright.o |
| 41 | obj-$(CONFIG_TOUCHSCREEN_TOUCHWIN) += touchwin.o | 42 | obj-$(CONFIG_TOUCHSCREEN_TOUCHWIN) += touchwin.o |
diff --git a/drivers/input/touchscreen/stmpe-ts.c b/drivers/input/touchscreen/stmpe-ts.c new file mode 100644 index 000000000000..656148ec0027 --- /dev/null +++ b/drivers/input/touchscreen/stmpe-ts.c | |||
| @@ -0,0 +1,397 @@ | |||
| 1 | /* STMicroelectronics STMPE811 Touchscreen Driver | ||
| 2 | * | ||
| 3 | * (C) 2010 Luotao Fu <l.fu@pengutronix.de> | ||
| 4 | * All rights reserved. | ||
| 5 | * | ||
| 6 | * This program is free software; you can redistribute it and/or modify it | ||
| 7 | * under the terms of the GNU General Public License as published by the | ||
| 8 | * Free Software Foundation; either version 2 of the License, or (at your | ||
| 9 | * option) any later version. | ||
| 10 | * | ||
| 11 | */ | ||
| 12 | |||
| 13 | #include <linux/kernel.h> | ||
| 14 | #include <linux/module.h> | ||
| 15 | #include <linux/sched.h> | ||
| 16 | #include <linux/interrupt.h> | ||
| 17 | #include <linux/init.h> | ||
| 18 | #include <linux/device.h> | ||
| 19 | #include <linux/platform_device.h> | ||
| 20 | #include <linux/input.h> | ||
| 21 | #include <linux/slab.h> | ||
| 22 | #include <linux/delay.h> | ||
| 23 | #include <linux/i2c.h> | ||
| 24 | #include <linux/workqueue.h> | ||
| 25 | |||
| 26 | #include <linux/mfd/stmpe.h> | ||
| 27 | |||
| 28 | /* Register layouts and functionalities are identical on all stmpexxx variants | ||
| 29 | * with touchscreen controller | ||
| 30 | */ | ||
| 31 | #define STMPE_REG_INT_STA 0x0B | ||
| 32 | #define STMPE_REG_ADC_CTRL1 0x20 | ||
| 33 | #define STMPE_REG_ADC_CTRL2 0x21 | ||
| 34 | #define STMPE_REG_TSC_CTRL 0x40 | ||
| 35 | #define STMPE_REG_TSC_CFG 0x41 | ||
| 36 | #define STMPE_REG_FIFO_TH 0x4A | ||
| 37 | #define STMPE_REG_FIFO_STA 0x4B | ||
| 38 | #define STMPE_REG_FIFO_SIZE 0x4C | ||
| 39 | #define STMPE_REG_TSC_DATA_XYZ 0x52 | ||
| 40 | #define STMPE_REG_TSC_FRACTION_Z 0x56 | ||
| 41 | #define STMPE_REG_TSC_I_DRIVE 0x58 | ||
| 42 | |||
| 43 | #define OP_MOD_XYZ 0 | ||
| 44 | |||
| 45 | #define STMPE_TSC_CTRL_TSC_EN (1<<0) | ||
| 46 | |||
| 47 | #define STMPE_FIFO_STA_RESET (1<<0) | ||
| 48 | |||
| 49 | #define STMPE_IRQ_TOUCH_DET 0 | ||
| 50 | |||
| 51 | #define SAMPLE_TIME(x) ((x & 0xf) << 4) | ||
| 52 | #define MOD_12B(x) ((x & 0x1) << 3) | ||
| 53 | #define REF_SEL(x) ((x & 0x1) << 1) | ||
| 54 | #define ADC_FREQ(x) (x & 0x3) | ||
| 55 | #define AVE_CTRL(x) ((x & 0x3) << 6) | ||
| 56 | #define DET_DELAY(x) ((x & 0x7) << 3) | ||
| 57 | #define SETTLING(x) (x & 0x7) | ||
| 58 | #define FRACTION_Z(x) (x & 0x7) | ||
| 59 | #define I_DRIVE(x) (x & 0x1) | ||
| 60 | #define OP_MODE(x) ((x & 0x7) << 1) | ||
| 61 | |||
| 62 | #define STMPE_TS_NAME "stmpe-ts" | ||
| 63 | #define XY_MASK 0xfff | ||
| 64 | |||
| 65 | struct stmpe_touch { | ||
| 66 | struct stmpe *stmpe; | ||
| 67 | struct input_dev *idev; | ||
| 68 | struct delayed_work work; | ||
| 69 | struct device *dev; | ||
| 70 | u8 sample_time; | ||
| 71 | u8 mod_12b; | ||
| 72 | u8 ref_sel; | ||
| 73 | u8 adc_freq; | ||
| 74 | u8 ave_ctrl; | ||
| 75 | u8 touch_det_delay; | ||
| 76 | u8 settling; | ||
| 77 | u8 fraction_z; | ||
| 78 | u8 i_drive; | ||
| 79 | }; | ||
| 80 | |||
| 81 | static int __stmpe_reset_fifo(struct stmpe *stmpe) | ||
| 82 | { | ||
| 83 | int ret; | ||
| 84 | |||
| 85 | ret = stmpe_set_bits(stmpe, STMPE_REG_FIFO_STA, | ||
| 86 | STMPE_FIFO_STA_RESET, STMPE_FIFO_STA_RESET); | ||
| 87 | if (ret) | ||
| 88 | return ret; | ||
| 89 | |||
| 90 | return stmpe_set_bits(stmpe, STMPE_REG_FIFO_STA, | ||
| 91 | STMPE_FIFO_STA_RESET, 0); | ||
| 92 | } | ||
| 93 | |||
| 94 | static void stmpe_work(struct work_struct *work) | ||
| 95 | { | ||
| 96 | int int_sta; | ||
| 97 | u32 timeout = 40; | ||
| 98 | |||
| 99 | struct stmpe_touch *ts = | ||
| 100 | container_of(work, struct stmpe_touch, work.work); | ||
| 101 | |||
| 102 | int_sta = stmpe_reg_read(ts->stmpe, STMPE_REG_INT_STA); | ||
| 103 | |||
| 104 | /* | ||
| 105 | * touch_det sometimes get desasserted or just get stuck. This appears | ||
| 106 | * to be a silicon bug, We still have to clearify this with the | ||
| 107 | * manufacture. As a workaround We release the key anyway if the | ||
| 108 | * touch_det keeps coming in after 4ms, while the FIFO contains no value | ||
| 109 | * during the whole time. | ||
| 110 | */ | ||
| 111 | while ((int_sta & (1 << STMPE_IRQ_TOUCH_DET)) && (timeout > 0)) { | ||
| 112 | timeout--; | ||
| 113 | int_sta = stmpe_reg_read(ts->stmpe, STMPE_REG_INT_STA); | ||
| 114 | udelay(100); | ||
| 115 | } | ||
| 116 | |||
| 117 | /* reset the FIFO before we report release event */ | ||
| 118 | __stmpe_reset_fifo(ts->stmpe); | ||
| 119 | |||
| 120 | input_report_abs(ts->idev, ABS_PRESSURE, 0); | ||
| 121 | input_sync(ts->idev); | ||
| 122 | } | ||
| 123 | |||
| 124 | static irqreturn_t stmpe_ts_handler(int irq, void *data) | ||
| 125 | { | ||
| 126 | u8 data_set[4]; | ||
| 127 | int x, y, z; | ||
| 128 | struct stmpe_touch *ts = data; | ||
| 129 | |||
| 130 | /* | ||
| 131 | * Cancel scheduled polling for release if we have new value | ||
| 132 | * available. Wait if the polling is already running. | ||
| 133 | */ | ||
| 134 | cancel_delayed_work_sync(&ts->work); | ||
| 135 | |||
| 136 | /* | ||
| 137 | * The FIFO sometimes just crashes and stops generating interrupts. This | ||
| 138 | * appears to be a silicon bug. We still have to clearify this with | ||
| 139 | * the manufacture. As a workaround we disable the TSC while we are | ||
| 140 | * collecting data and flush the FIFO after reading | ||
| 141 | */ | ||
| 142 | stmpe_set_bits(ts->stmpe, STMPE_REG_TSC_CTRL, | ||
| 143 | STMPE_TSC_CTRL_TSC_EN, 0); | ||
| 144 | |||
| 145 | stmpe_block_read(ts->stmpe, STMPE_REG_TSC_DATA_XYZ, 4, data_set); | ||
| 146 | |||
| 147 | x = (data_set[0] << 4) | (data_set[1] >> 4); | ||
| 148 | y = ((data_set[1] & 0xf) << 8) | data_set[2]; | ||
| 149 | z = data_set[3]; | ||
| 150 | |||
| 151 | input_report_abs(ts->idev, ABS_X, x); | ||
| 152 | input_report_abs(ts->idev, ABS_Y, y); | ||
| 153 | input_report_abs(ts->idev, ABS_PRESSURE, z); | ||
| 154 | input_sync(ts->idev); | ||
| 155 | |||
| 156 | /* flush the FIFO after we have read out our values. */ | ||
| 157 | __stmpe_reset_fifo(ts->stmpe); | ||
| 158 | |||
| 159 | /* reenable the tsc */ | ||
| 160 | stmpe_set_bits(ts->stmpe, STMPE_REG_TSC_CTRL, | ||
| 161 | STMPE_TSC_CTRL_TSC_EN, STMPE_TSC_CTRL_TSC_EN); | ||
| 162 | |||
| 163 | /* start polling for touch_det to detect release */ | ||
| 164 | schedule_delayed_work(&ts->work, HZ / 50); | ||
| 165 | |||
| 166 | return IRQ_HANDLED; | ||
| 167 | } | ||
| 168 | |||
| 169 | static int __devinit stmpe_init_hw(struct stmpe_touch *ts) | ||
| 170 | { | ||
| 171 | int ret; | ||
| 172 | u8 adc_ctrl1, adc_ctrl1_mask, tsc_cfg, tsc_cfg_mask; | ||
| 173 | struct stmpe *stmpe = ts->stmpe; | ||
| 174 | struct device *dev = ts->dev; | ||
| 175 | |||
| 176 | ret = stmpe_enable(stmpe, STMPE_BLOCK_TOUCHSCREEN | STMPE_BLOCK_ADC); | ||
| 177 | if (ret) { | ||
| 178 | dev_err(dev, "Could not enable clock for ADC and TS\n"); | ||
| 179 | return ret; | ||
| 180 | } | ||
| 181 | |||
| 182 | adc_ctrl1 = SAMPLE_TIME(ts->sample_time) | MOD_12B(ts->mod_12b) | | ||
| 183 | REF_SEL(ts->ref_sel); | ||
| 184 | adc_ctrl1_mask = SAMPLE_TIME(0xff) | MOD_12B(0xff) | REF_SEL(0xff); | ||
| 185 | |||
| 186 | ret = stmpe_set_bits(stmpe, STMPE_REG_ADC_CTRL1, | ||
| 187 | adc_ctrl1_mask, adc_ctrl1); | ||
| 188 | if (ret) { | ||
| 189 | dev_err(dev, "Could not setup ADC\n"); | ||
| 190 | return ret; | ||
| 191 | } | ||
| 192 | |||
| 193 | ret = stmpe_set_bits(stmpe, STMPE_REG_ADC_CTRL2, | ||
| 194 | ADC_FREQ(0xff), ADC_FREQ(ts->adc_freq)); | ||
| 195 | if (ret) { | ||
| 196 | dev_err(dev, "Could not setup ADC\n"); | ||
| 197 | return ret; | ||
| 198 | } | ||
| 199 | |||
| 200 | tsc_cfg = AVE_CTRL(ts->ave_ctrl) | DET_DELAY(ts->touch_det_delay) | | ||
| 201 | SETTLING(ts->settling); | ||
| 202 | tsc_cfg_mask = AVE_CTRL(0xff) | DET_DELAY(0xff) | SETTLING(0xff); | ||
| 203 | |||
| 204 | ret = stmpe_set_bits(stmpe, STMPE_REG_TSC_CFG, tsc_cfg_mask, tsc_cfg); | ||
| 205 | if (ret) { | ||
| 206 | dev_err(dev, "Could not config touch\n"); | ||
| 207 | return ret; | ||
| 208 | } | ||
| 209 | |||
| 210 | ret = stmpe_set_bits(stmpe, STMPE_REG_TSC_FRACTION_Z, | ||
| 211 | FRACTION_Z(0xff), FRACTION_Z(ts->fraction_z)); | ||
| 212 | if (ret) { | ||
| 213 | dev_err(dev, "Could not config touch\n"); | ||
| 214 | return ret; | ||
| 215 | } | ||
| 216 | |||
| 217 | ret = stmpe_set_bits(stmpe, STMPE_REG_TSC_I_DRIVE, | ||
| 218 | I_DRIVE(0xff), I_DRIVE(ts->i_drive)); | ||
| 219 | if (ret) { | ||
| 220 | dev_err(dev, "Could not config touch\n"); | ||
| 221 | return ret; | ||
| 222 | } | ||
| 223 | |||
| 224 | /* set FIFO to 1 for single point reading */ | ||
| 225 | ret = stmpe_reg_write(stmpe, STMPE_REG_FIFO_TH, 1); | ||
| 226 | if (ret) { | ||
| 227 | dev_err(dev, "Could not set FIFO\n"); | ||
| 228 | return ret; | ||
| 229 | } | ||
| 230 | |||
| 231 | ret = stmpe_set_bits(stmpe, STMPE_REG_TSC_CTRL, | ||
| 232 | OP_MODE(0xff), OP_MODE(OP_MOD_XYZ)); | ||
| 233 | if (ret) { | ||
| 234 | dev_err(dev, "Could not set mode\n"); | ||
| 235 | return ret; | ||
| 236 | } | ||
| 237 | |||
| 238 | return 0; | ||
| 239 | } | ||
| 240 | |||
| 241 | static int stmpe_ts_open(struct input_dev *dev) | ||
| 242 | { | ||
| 243 | struct stmpe_touch *ts = input_get_drvdata(dev); | ||
| 244 | int ret = 0; | ||
| 245 | |||
| 246 | ret = __stmpe_reset_fifo(ts->stmpe); | ||
| 247 | if (ret) | ||
| 248 | return ret; | ||
| 249 | |||
| 250 | return stmpe_set_bits(ts->stmpe, STMPE_REG_TSC_CTRL, | ||
| 251 | STMPE_TSC_CTRL_TSC_EN, STMPE_TSC_CTRL_TSC_EN); | ||
| 252 | } | ||
| 253 | |||
| 254 | static void stmpe_ts_close(struct input_dev *dev) | ||
| 255 | { | ||
| 256 | struct stmpe_touch *ts = input_get_drvdata(dev); | ||
| 257 | |||
| 258 | cancel_delayed_work_sync(&ts->work); | ||
| 259 | |||
| 260 | stmpe_set_bits(ts->stmpe, STMPE_REG_TSC_CTRL, | ||
| 261 | STMPE_TSC_CTRL_TSC_EN, 0); | ||
| 262 | } | ||
| 263 | |||
| 264 | static int __devinit stmpe_input_probe(struct platform_device *pdev) | ||
| 265 | { | ||
| 266 | struct stmpe *stmpe = dev_get_drvdata(pdev->dev.parent); | ||
| 267 | struct stmpe_platform_data *pdata = stmpe->pdata; | ||
| 268 | struct stmpe_touch *ts; | ||
| 269 | struct input_dev *idev; | ||
| 270 | struct stmpe_ts_platform_data *ts_pdata = NULL; | ||
| 271 | int ret = 0; | ||
| 272 | int ts_irq; | ||
| 273 | |||
| 274 | ts_irq = platform_get_irq_byname(pdev, "FIFO_TH"); | ||
| 275 | if (ts_irq < 0) | ||
| 276 | return ts_irq; | ||
| 277 | |||
| 278 | ts = kzalloc(sizeof(*ts), GFP_KERNEL); | ||
| 279 | if (!ts) | ||
| 280 | goto err_out; | ||
| 281 | |||
| 282 | idev = input_allocate_device(); | ||
| 283 | if (!idev) | ||
| 284 | goto err_free_ts; | ||
| 285 | |||
| 286 | platform_set_drvdata(pdev, ts); | ||
| 287 | ts->stmpe = stmpe; | ||
| 288 | ts->idev = idev; | ||
| 289 | ts->dev = &pdev->dev; | ||
| 290 | |||
| 291 | if (pdata) | ||
| 292 | ts_pdata = pdata->ts; | ||
| 293 | |||
| 294 | if (ts_pdata) { | ||
| 295 | ts->sample_time = ts_pdata->sample_time; | ||
| 296 | ts->mod_12b = ts_pdata->mod_12b; | ||
| 297 | ts->ref_sel = ts_pdata->ref_sel; | ||
| 298 | ts->adc_freq = ts_pdata->adc_freq; | ||
| 299 | ts->ave_ctrl = ts_pdata->ave_ctrl; | ||
| 300 | ts->touch_det_delay = ts_pdata->touch_det_delay; | ||
| 301 | ts->settling = ts_pdata->settling; | ||
| 302 | ts->fraction_z = ts_pdata->fraction_z; | ||
| 303 | ts->i_drive = ts_pdata->i_drive; | ||
| 304 | } | ||
| 305 | |||
| 306 | INIT_DELAYED_WORK(&ts->work, stmpe_work); | ||
| 307 | |||
| 308 | ret = request_threaded_irq(ts_irq, NULL, stmpe_ts_handler, | ||
| 309 | IRQF_ONESHOT, STMPE_TS_NAME, ts); | ||
| 310 | if (ret) { | ||
| 311 | dev_err(&pdev->dev, "Failed to request IRQ %d\n", ts_irq); | ||
| 312 | goto err_free_input; | ||
| 313 | } | ||
| 314 | |||
| 315 | ret = stmpe_init_hw(ts); | ||
| 316 | if (ret) | ||
| 317 | goto err_free_irq; | ||
| 318 | |||
| 319 | idev->name = STMPE_TS_NAME; | ||
| 320 | idev->id.bustype = BUS_I2C; | ||
| 321 | idev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS); | ||
| 322 | idev->keybit[BIT_WORD(BTN_TOUCH)] = BIT_MASK(BTN_TOUCH); | ||
| 323 | |||
| 324 | idev->open = stmpe_ts_open; | ||
| 325 | idev->close = stmpe_ts_close; | ||
| 326 | |||
| 327 | input_set_drvdata(idev, ts); | ||
| 328 | |||
| 329 | input_set_abs_params(idev, ABS_X, 0, XY_MASK, 0, 0); | ||
| 330 | input_set_abs_params(idev, ABS_Y, 0, XY_MASK, 0, 0); | ||
| 331 | input_set_abs_params(idev, ABS_PRESSURE, 0x0, 0xff, 0, 0); | ||
| 332 | |||
| 333 | ret = input_register_device(idev); | ||
| 334 | if (ret) { | ||
| 335 | dev_err(&pdev->dev, "Could not register input device\n"); | ||
| 336 | goto err_free_irq; | ||
| 337 | } | ||
| 338 | |||
| 339 | return ret; | ||
| 340 | |||
| 341 | err_free_irq: | ||
| 342 | free_irq(ts_irq, ts); | ||
| 343 | err_free_input: | ||
| 344 | input_free_device(idev); | ||
| 345 | platform_set_drvdata(pdev, NULL); | ||
| 346 | err_free_ts: | ||
| 347 | kfree(ts); | ||
| 348 | err_out: | ||
| 349 | return ret; | ||
| 350 | } | ||
| 351 | |||
| 352 | static int __devexit stmpe_ts_remove(struct platform_device *pdev) | ||
| 353 | { | ||
| 354 | struct stmpe_touch *ts = platform_get_drvdata(pdev); | ||
| 355 | unsigned int ts_irq = platform_get_irq_byname(pdev, "FIFO_TH"); | ||
| 356 | |||
| 357 | stmpe_disable(ts->stmpe, STMPE_BLOCK_TOUCHSCREEN); | ||
| 358 | |||
| 359 | free_irq(ts_irq, ts); | ||
| 360 | |||
| 361 | platform_set_drvdata(pdev, NULL); | ||
| 362 | |||
| 363 | input_unregister_device(ts->idev); | ||
| 364 | input_free_device(ts->idev); | ||
| 365 | |||
| 366 | kfree(ts); | ||
| 367 | |||
| 368 | return 0; | ||
| 369 | } | ||
| 370 | |||
| 371 | static struct platform_driver stmpe_ts_driver = { | ||
| 372 | .driver = { | ||
| 373 | .name = STMPE_TS_NAME, | ||
| 374 | .owner = THIS_MODULE, | ||
| 375 | }, | ||
| 376 | .probe = stmpe_input_probe, | ||
| 377 | .remove = __devexit_p(stmpe_ts_remove), | ||
| 378 | }; | ||
| 379 | |||
| 380 | static int __init stmpe_ts_init(void) | ||
| 381 | { | ||
| 382 | return platform_driver_register(&stmpe_ts_driver); | ||
| 383 | } | ||
| 384 | |||
| 385 | module_init(stmpe_ts_init); | ||
| 386 | |||
| 387 | static void __exit stmpe_ts_exit(void) | ||
| 388 | { | ||
| 389 | platform_driver_unregister(&stmpe_ts_driver); | ||
| 390 | } | ||
| 391 | |||
| 392 | module_exit(stmpe_ts_exit); | ||
| 393 | |||
| 394 | MODULE_AUTHOR("Luotao Fu <l.fu@pengutronix.de>"); | ||
| 395 | MODULE_DESCRIPTION("STMPEXXX touchscreen driver"); | ||
| 396 | MODULE_LICENSE("GPL"); | ||
| 397 | MODULE_ALIAS("platform:" STMPE_TS_NAME); | ||
