diff options
| author | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2014-12-18 13:02:39 -0500 |
|---|---|---|
| committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2014-12-18 13:02:39 -0500 |
| commit | 6d32af019a45654b6eb3ae2ff17d51ba1f045bb4 (patch) | |
| tree | 17d232cb65248c68b86aaec475f576b5134079e2 | |
| parent | f20c86cd75f1c8c728dafd0218645ff3c5e8545d (diff) | |
| parent | 27a560ba1d4f0a07a36e1de2cae839abe776e8f3 (diff) | |
Merge branch 'next' into for-linus
Second round of input updates for 3.19.
| -rw-r--r-- | Documentation/devicetree/bindings/input/gpio-keys.txt | 10 | ||||
| -rw-r--r-- | Documentation/devicetree/bindings/input/stmpe-keypad.txt | 2 | ||||
| -rw-r--r-- | drivers/input/evdev.c | 60 | ||||
| -rw-r--r-- | drivers/input/input.c | 22 | ||||
| -rw-r--r-- | drivers/input/keyboard/Kconfig | 1 | ||||
| -rw-r--r-- | drivers/input/keyboard/gpio_keys.c | 114 | ||||
| -rw-r--r-- | drivers/input/keyboard/stmpe-keypad.c | 141 | ||||
| -rw-r--r-- | drivers/input/mouse/alps.c | 84 | ||||
| -rw-r--r-- | drivers/input/mouse/trackpoint.c | 4 | ||||
| -rw-r--r-- | drivers/input/mouse/trackpoint.h | 5 | ||||
| -rw-r--r-- | drivers/input/touchscreen/edt-ft5x06.c | 4 | ||||
| -rw-r--r-- | drivers/mfd/stmpe.c | 4 | ||||
| -rw-r--r-- | drivers/mfd/stmpe.h | 3 | ||||
| -rw-r--r-- | include/linux/mfd/stmpe.h | 22 |
14 files changed, 299 insertions, 177 deletions
diff --git a/Documentation/devicetree/bindings/input/gpio-keys.txt b/Documentation/devicetree/bindings/input/gpio-keys.txt index a4a38fcf2ed6..44b705767aca 100644 --- a/Documentation/devicetree/bindings/input/gpio-keys.txt +++ b/Documentation/devicetree/bindings/input/gpio-keys.txt | |||
| @@ -10,12 +10,13 @@ Optional properties: | |||
| 10 | Each button (key) is represented as a sub-node of "gpio-keys": | 10 | Each button (key) is represented as a sub-node of "gpio-keys": |
| 11 | Subnode properties: | 11 | Subnode properties: |
| 12 | 12 | ||
| 13 | - gpios: OF device-tree gpio specification. | ||
| 14 | - interrupts: the interrupt line for that input. | ||
| 13 | - label: Descriptive name of the key. | 15 | - label: Descriptive name of the key. |
| 14 | - linux,code: Keycode to emit. | 16 | - linux,code: Keycode to emit. |
| 15 | 17 | ||
| 16 | Required mutual exclusive subnode-properties: | 18 | Note that either "interrupts" or "gpios" properties can be omitted, but not |
| 17 | - gpios: OF device-tree gpio specification. | 19 | both at the same time. Specifying both properties is allowed. |
| 18 | - interrupts: the interrupt line for that input | ||
| 19 | 20 | ||
| 20 | Optional subnode-properties: | 21 | Optional subnode-properties: |
| 21 | - linux,input-type: Specify event type this button/key generates. | 22 | - linux,input-type: Specify event type this button/key generates. |
| @@ -23,6 +24,9 @@ Optional subnode-properties: | |||
| 23 | - debounce-interval: Debouncing interval time in milliseconds. | 24 | - debounce-interval: Debouncing interval time in milliseconds. |
| 24 | If not specified defaults to 5. | 25 | If not specified defaults to 5. |
| 25 | - gpio-key,wakeup: Boolean, button can wake-up the system. | 26 | - gpio-key,wakeup: Boolean, button can wake-up the system. |
| 27 | - linux,can-disable: Boolean, indicates that button is connected | ||
| 28 | to dedicated (not shared) interrupt which can be disabled to | ||
| 29 | suppress events from the button. | ||
| 26 | 30 | ||
| 27 | Example nodes: | 31 | Example nodes: |
| 28 | 32 | ||
diff --git a/Documentation/devicetree/bindings/input/stmpe-keypad.txt b/Documentation/devicetree/bindings/input/stmpe-keypad.txt index 1b97222e8a0b..12bb771d66d4 100644 --- a/Documentation/devicetree/bindings/input/stmpe-keypad.txt +++ b/Documentation/devicetree/bindings/input/stmpe-keypad.txt | |||
| @@ -8,6 +8,8 @@ Optional properties: | |||
| 8 | - debounce-interval : Debouncing interval time in milliseconds | 8 | - debounce-interval : Debouncing interval time in milliseconds |
| 9 | - st,scan-count : Scanning cycles elapsed before key data is updated | 9 | - st,scan-count : Scanning cycles elapsed before key data is updated |
| 10 | - st,no-autorepeat : If specified device will not autorepeat | 10 | - st,no-autorepeat : If specified device will not autorepeat |
| 11 | - keypad,num-rows : See ./matrix-keymap.txt | ||
| 12 | - keypad,num-columns : See ./matrix-keymap.txt | ||
| 11 | 13 | ||
| 12 | Example: | 14 | Example: |
| 13 | 15 | ||
diff --git a/drivers/input/evdev.c b/drivers/input/evdev.c index bc203485716d..b1a52abc58df 100644 --- a/drivers/input/evdev.c +++ b/drivers/input/evdev.c | |||
| @@ -28,6 +28,13 @@ | |||
| 28 | #include <linux/cdev.h> | 28 | #include <linux/cdev.h> |
| 29 | #include "input-compat.h" | 29 | #include "input-compat.h" |
| 30 | 30 | ||
| 31 | enum evdev_clock_type { | ||
| 32 | EV_CLK_REAL = 0, | ||
| 33 | EV_CLK_MONO, | ||
| 34 | EV_CLK_BOOT, | ||
| 35 | EV_CLK_MAX | ||
| 36 | }; | ||
| 37 | |||
| 31 | struct evdev { | 38 | struct evdev { |
| 32 | int open; | 39 | int open; |
| 33 | struct input_handle handle; | 40 | struct input_handle handle; |
| @@ -49,12 +56,32 @@ struct evdev_client { | |||
| 49 | struct fasync_struct *fasync; | 56 | struct fasync_struct *fasync; |
| 50 | struct evdev *evdev; | 57 | struct evdev *evdev; |
| 51 | struct list_head node; | 58 | struct list_head node; |
| 52 | int clkid; | 59 | int clk_type; |
| 53 | bool revoked; | 60 | bool revoked; |
| 54 | unsigned int bufsize; | 61 | unsigned int bufsize; |
| 55 | struct input_event buffer[]; | 62 | struct input_event buffer[]; |
| 56 | }; | 63 | }; |
| 57 | 64 | ||
| 65 | static int evdev_set_clk_type(struct evdev_client *client, unsigned int clkid) | ||
| 66 | { | ||
| 67 | switch (clkid) { | ||
| 68 | |||
| 69 | case CLOCK_REALTIME: | ||
| 70 | client->clk_type = EV_CLK_REAL; | ||
| 71 | break; | ||
| 72 | case CLOCK_MONOTONIC: | ||
| 73 | client->clk_type = EV_CLK_MONO; | ||
| 74 | break; | ||
| 75 | case CLOCK_BOOTTIME: | ||
| 76 | client->clk_type = EV_CLK_BOOT; | ||
| 77 | break; | ||
| 78 | default: | ||
| 79 | return -EINVAL; | ||
| 80 | } | ||
| 81 | |||
| 82 | return 0; | ||
| 83 | } | ||
| 84 | |||
| 58 | /* flush queued events of type @type, caller must hold client->buffer_lock */ | 85 | /* flush queued events of type @type, caller must hold client->buffer_lock */ |
| 59 | static void __evdev_flush_queue(struct evdev_client *client, unsigned int type) | 86 | static void __evdev_flush_queue(struct evdev_client *client, unsigned int type) |
| 60 | { | 87 | { |
| @@ -108,8 +135,11 @@ static void evdev_queue_syn_dropped(struct evdev_client *client) | |||
| 108 | struct input_event ev; | 135 | struct input_event ev; |
| 109 | ktime_t time; | 136 | ktime_t time; |
| 110 | 137 | ||
| 111 | time = (client->clkid == CLOCK_MONOTONIC) ? | 138 | time = client->clk_type == EV_CLK_REAL ? |
| 112 | ktime_get() : ktime_get_real(); | 139 | ktime_get_real() : |
| 140 | client->clk_type == EV_CLK_MONO ? | ||
| 141 | ktime_get() : | ||
| 142 | ktime_get_boottime(); | ||
| 113 | 143 | ||
| 114 | ev.time = ktime_to_timeval(time); | 144 | ev.time = ktime_to_timeval(time); |
| 115 | ev.type = EV_SYN; | 145 | ev.type = EV_SYN; |
| @@ -159,7 +189,7 @@ static void __pass_event(struct evdev_client *client, | |||
| 159 | 189 | ||
| 160 | static void evdev_pass_values(struct evdev_client *client, | 190 | static void evdev_pass_values(struct evdev_client *client, |
| 161 | const struct input_value *vals, unsigned int count, | 191 | const struct input_value *vals, unsigned int count, |
| 162 | ktime_t mono, ktime_t real) | 192 | ktime_t *ev_time) |
| 163 | { | 193 | { |
| 164 | struct evdev *evdev = client->evdev; | 194 | struct evdev *evdev = client->evdev; |
| 165 | const struct input_value *v; | 195 | const struct input_value *v; |
| @@ -169,8 +199,7 @@ static void evdev_pass_values(struct evdev_client *client, | |||
| 169 | if (client->revoked) | 199 | if (client->revoked) |
| 170 | return; | 200 | return; |
| 171 | 201 | ||
| 172 | event.time = ktime_to_timeval(client->clkid == CLOCK_MONOTONIC ? | 202 | event.time = ktime_to_timeval(ev_time[client->clk_type]); |
| 173 | mono : real); | ||
| 174 | 203 | ||
| 175 | /* Interrupts are disabled, just acquire the lock. */ | 204 | /* Interrupts are disabled, just acquire the lock. */ |
| 176 | spin_lock(&client->buffer_lock); | 205 | spin_lock(&client->buffer_lock); |
| @@ -198,21 +227,22 @@ static void evdev_events(struct input_handle *handle, | |||
| 198 | { | 227 | { |
| 199 | struct evdev *evdev = handle->private; | 228 | struct evdev *evdev = handle->private; |
| 200 | struct evdev_client *client; | 229 | struct evdev_client *client; |
| 201 | ktime_t time_mono, time_real; | 230 | ktime_t ev_time[EV_CLK_MAX]; |
| 202 | 231 | ||
| 203 | time_mono = ktime_get(); | 232 | ev_time[EV_CLK_MONO] = ktime_get(); |
| 204 | time_real = ktime_mono_to_real(time_mono); | 233 | ev_time[EV_CLK_REAL] = ktime_mono_to_real(ev_time[EV_CLK_MONO]); |
| 234 | ev_time[EV_CLK_BOOT] = ktime_mono_to_any(ev_time[EV_CLK_MONO], | ||
| 235 | TK_OFFS_BOOT); | ||
| 205 | 236 | ||
| 206 | rcu_read_lock(); | 237 | rcu_read_lock(); |
| 207 | 238 | ||
| 208 | client = rcu_dereference(evdev->grab); | 239 | client = rcu_dereference(evdev->grab); |
| 209 | 240 | ||
| 210 | if (client) | 241 | if (client) |
| 211 | evdev_pass_values(client, vals, count, time_mono, time_real); | 242 | evdev_pass_values(client, vals, count, ev_time); |
| 212 | else | 243 | else |
| 213 | list_for_each_entry_rcu(client, &evdev->client_list, node) | 244 | list_for_each_entry_rcu(client, &evdev->client_list, node) |
| 214 | evdev_pass_values(client, vals, count, | 245 | evdev_pass_values(client, vals, count, ev_time); |
| 215 | time_mono, time_real); | ||
| 216 | 246 | ||
| 217 | rcu_read_unlock(); | 247 | rcu_read_unlock(); |
| 218 | } | 248 | } |
| @@ -877,10 +907,8 @@ static long evdev_do_ioctl(struct file *file, unsigned int cmd, | |||
| 877 | case EVIOCSCLOCKID: | 907 | case EVIOCSCLOCKID: |
| 878 | if (copy_from_user(&i, p, sizeof(unsigned int))) | 908 | if (copy_from_user(&i, p, sizeof(unsigned int))) |
| 879 | return -EFAULT; | 909 | return -EFAULT; |
| 880 | if (i != CLOCK_MONOTONIC && i != CLOCK_REALTIME) | 910 | |
| 881 | return -EINVAL; | 911 | return evdev_set_clk_type(client, i); |
| 882 | client->clkid = i; | ||
| 883 | return 0; | ||
| 884 | 912 | ||
| 885 | case EVIOCGKEYCODE: | 913 | case EVIOCGKEYCODE: |
| 886 | return evdev_handle_get_keycode(dev, p); | 914 | return evdev_handle_get_keycode(dev, p); |
diff --git a/drivers/input/input.c b/drivers/input/input.c index 04217c2e345c..213e3a1903ee 100644 --- a/drivers/input/input.c +++ b/drivers/input/input.c | |||
| @@ -1974,18 +1974,22 @@ static unsigned int input_estimate_events_per_packet(struct input_dev *dev) | |||
| 1974 | 1974 | ||
| 1975 | events = mt_slots + 1; /* count SYN_MT_REPORT and SYN_REPORT */ | 1975 | events = mt_slots + 1; /* count SYN_MT_REPORT and SYN_REPORT */ |
| 1976 | 1976 | ||
| 1977 | for (i = 0; i < ABS_CNT; i++) { | 1977 | if (test_bit(EV_ABS, dev->evbit)) { |
| 1978 | if (test_bit(i, dev->absbit)) { | 1978 | for (i = 0; i < ABS_CNT; i++) { |
| 1979 | if (input_is_mt_axis(i)) | 1979 | if (test_bit(i, dev->absbit)) { |
| 1980 | events += mt_slots; | 1980 | if (input_is_mt_axis(i)) |
| 1981 | else | 1981 | events += mt_slots; |
| 1982 | events++; | 1982 | else |
| 1983 | events++; | ||
| 1984 | } | ||
| 1983 | } | 1985 | } |
| 1984 | } | 1986 | } |
| 1985 | 1987 | ||
| 1986 | for (i = 0; i < REL_CNT; i++) | 1988 | if (test_bit(EV_REL, dev->evbit)) { |
| 1987 | if (test_bit(i, dev->relbit)) | 1989 | for (i = 0; i < REL_CNT; i++) |
| 1988 | events++; | 1990 | if (test_bit(i, dev->relbit)) |
| 1991 | events++; | ||
| 1992 | } | ||
| 1989 | 1993 | ||
| 1990 | /* Make room for KEY and MSC events */ | 1994 | /* Make room for KEY and MSC events */ |
| 1991 | events += 7; | 1995 | events += 7; |
diff --git a/drivers/input/keyboard/Kconfig b/drivers/input/keyboard/Kconfig index 96ee26c555e0..a5d9b3f3c871 100644 --- a/drivers/input/keyboard/Kconfig +++ b/drivers/input/keyboard/Kconfig | |||
| @@ -559,6 +559,7 @@ config KEYBOARD_SH_KEYSC | |||
| 559 | config KEYBOARD_STMPE | 559 | config KEYBOARD_STMPE |
| 560 | tristate "STMPE keypad support" | 560 | tristate "STMPE keypad support" |
| 561 | depends on MFD_STMPE | 561 | depends on MFD_STMPE |
| 562 | depends on OF | ||
| 562 | select INPUT_MATRIXKMAP | 563 | select INPUT_MATRIXKMAP |
| 563 | help | 564 | help |
| 564 | Say Y here if you want to use the keypad controller on STMPE I/O | 565 | Say Y here if you want to use the keypad controller on STMPE I/O |
diff --git a/drivers/input/keyboard/gpio_keys.c b/drivers/input/keyboard/gpio_keys.c index f44f05b70ee0..eefd976ab4eb 100644 --- a/drivers/input/keyboard/gpio_keys.c +++ b/drivers/input/keyboard/gpio_keys.c | |||
| @@ -35,9 +35,13 @@ | |||
| 35 | struct gpio_button_data { | 35 | struct gpio_button_data { |
| 36 | const struct gpio_keys_button *button; | 36 | const struct gpio_keys_button *button; |
| 37 | struct input_dev *input; | 37 | struct input_dev *input; |
| 38 | struct timer_list timer; | 38 | |
| 39 | struct work_struct work; | 39 | struct timer_list release_timer; |
| 40 | unsigned int timer_debounce; /* in msecs */ | 40 | unsigned int release_delay; /* in msecs, for IRQ-only buttons */ |
| 41 | |||
| 42 | struct delayed_work work; | ||
| 43 | unsigned int software_debounce; /* in msecs, for GPIO-driven buttons */ | ||
| 44 | |||
| 41 | unsigned int irq; | 45 | unsigned int irq; |
| 42 | spinlock_t lock; | 46 | spinlock_t lock; |
| 43 | bool disabled; | 47 | bool disabled; |
| @@ -116,11 +120,14 @@ static void gpio_keys_disable_button(struct gpio_button_data *bdata) | |||
| 116 | { | 120 | { |
| 117 | if (!bdata->disabled) { | 121 | if (!bdata->disabled) { |
| 118 | /* | 122 | /* |
| 119 | * Disable IRQ and possible debouncing timer. | 123 | * Disable IRQ and associated timer/work structure. |
| 120 | */ | 124 | */ |
| 121 | disable_irq(bdata->irq); | 125 | disable_irq(bdata->irq); |
| 122 | if (bdata->timer_debounce) | 126 | |
| 123 | del_timer_sync(&bdata->timer); | 127 | if (gpio_is_valid(bdata->button->gpio)) |
| 128 | cancel_delayed_work_sync(&bdata->work); | ||
| 129 | else | ||
| 130 | del_timer_sync(&bdata->release_timer); | ||
| 124 | 131 | ||
| 125 | bdata->disabled = true; | 132 | bdata->disabled = true; |
| 126 | } | 133 | } |
| @@ -343,7 +350,7 @@ static void gpio_keys_gpio_report_event(struct gpio_button_data *bdata) | |||
| 343 | static void gpio_keys_gpio_work_func(struct work_struct *work) | 350 | static void gpio_keys_gpio_work_func(struct work_struct *work) |
| 344 | { | 351 | { |
| 345 | struct gpio_button_data *bdata = | 352 | struct gpio_button_data *bdata = |
| 346 | container_of(work, struct gpio_button_data, work); | 353 | container_of(work, struct gpio_button_data, work.work); |
| 347 | 354 | ||
| 348 | gpio_keys_gpio_report_event(bdata); | 355 | gpio_keys_gpio_report_event(bdata); |
| 349 | 356 | ||
| @@ -351,13 +358,6 @@ static void gpio_keys_gpio_work_func(struct work_struct *work) | |||
| 351 | pm_relax(bdata->input->dev.parent); | 358 | pm_relax(bdata->input->dev.parent); |
| 352 | } | 359 | } |
| 353 | 360 | ||
| 354 | static void gpio_keys_gpio_timer(unsigned long _data) | ||
| 355 | { | ||
| 356 | struct gpio_button_data *bdata = (struct gpio_button_data *)_data; | ||
| 357 | |||
| 358 | schedule_work(&bdata->work); | ||
| 359 | } | ||
| 360 | |||
| 361 | static irqreturn_t gpio_keys_gpio_isr(int irq, void *dev_id) | 361 | static irqreturn_t gpio_keys_gpio_isr(int irq, void *dev_id) |
| 362 | { | 362 | { |
| 363 | struct gpio_button_data *bdata = dev_id; | 363 | struct gpio_button_data *bdata = dev_id; |
| @@ -366,11 +366,10 @@ static irqreturn_t gpio_keys_gpio_isr(int irq, void *dev_id) | |||
| 366 | 366 | ||
| 367 | if (bdata->button->wakeup) | 367 | if (bdata->button->wakeup) |
| 368 | pm_stay_awake(bdata->input->dev.parent); | 368 | pm_stay_awake(bdata->input->dev.parent); |
| 369 | if (bdata->timer_debounce) | 369 | |
| 370 | mod_timer(&bdata->timer, | 370 | mod_delayed_work(system_wq, |
| 371 | jiffies + msecs_to_jiffies(bdata->timer_debounce)); | 371 | &bdata->work, |
| 372 | else | 372 | msecs_to_jiffies(bdata->software_debounce)); |
| 373 | schedule_work(&bdata->work); | ||
| 374 | 373 | ||
| 375 | return IRQ_HANDLED; | 374 | return IRQ_HANDLED; |
| 376 | } | 375 | } |
| @@ -408,7 +407,7 @@ static irqreturn_t gpio_keys_irq_isr(int irq, void *dev_id) | |||
| 408 | input_event(input, EV_KEY, button->code, 1); | 407 | input_event(input, EV_KEY, button->code, 1); |
| 409 | input_sync(input); | 408 | input_sync(input); |
| 410 | 409 | ||
| 411 | if (!bdata->timer_debounce) { | 410 | if (!bdata->release_delay) { |
| 412 | input_event(input, EV_KEY, button->code, 0); | 411 | input_event(input, EV_KEY, button->code, 0); |
| 413 | input_sync(input); | 412 | input_sync(input); |
| 414 | goto out; | 413 | goto out; |
| @@ -417,9 +416,9 @@ static irqreturn_t gpio_keys_irq_isr(int irq, void *dev_id) | |||
| 417 | bdata->key_pressed = true; | 416 | bdata->key_pressed = true; |
| 418 | } | 417 | } |
| 419 | 418 | ||
| 420 | if (bdata->timer_debounce) | 419 | if (bdata->release_delay) |
| 421 | mod_timer(&bdata->timer, | 420 | mod_timer(&bdata->release_timer, |
| 422 | jiffies + msecs_to_jiffies(bdata->timer_debounce)); | 421 | jiffies + msecs_to_jiffies(bdata->release_delay)); |
| 423 | out: | 422 | out: |
| 424 | spin_unlock_irqrestore(&bdata->lock, flags); | 423 | spin_unlock_irqrestore(&bdata->lock, flags); |
| 425 | return IRQ_HANDLED; | 424 | return IRQ_HANDLED; |
| @@ -429,10 +428,10 @@ static void gpio_keys_quiesce_key(void *data) | |||
| 429 | { | 428 | { |
| 430 | struct gpio_button_data *bdata = data; | 429 | struct gpio_button_data *bdata = data; |
| 431 | 430 | ||
| 432 | if (bdata->timer_debounce) | 431 | if (gpio_is_valid(bdata->button->gpio)) |
| 433 | del_timer_sync(&bdata->timer); | 432 | cancel_delayed_work_sync(&bdata->work); |
| 434 | 433 | else | |
| 435 | cancel_work_sync(&bdata->work); | 434 | del_timer_sync(&bdata->release_timer); |
| 436 | } | 435 | } |
| 437 | 436 | ||
| 438 | static int gpio_keys_setup_key(struct platform_device *pdev, | 437 | static int gpio_keys_setup_key(struct platform_device *pdev, |
| @@ -466,23 +465,25 @@ static int gpio_keys_setup_key(struct platform_device *pdev, | |||
| 466 | button->debounce_interval * 1000); | 465 | button->debounce_interval * 1000); |
| 467 | /* use timer if gpiolib doesn't provide debounce */ | 466 | /* use timer if gpiolib doesn't provide debounce */ |
| 468 | if (error < 0) | 467 | if (error < 0) |
| 469 | bdata->timer_debounce = | 468 | bdata->software_debounce = |
| 470 | button->debounce_interval; | 469 | button->debounce_interval; |
| 471 | } | 470 | } |
| 472 | 471 | ||
| 473 | irq = gpio_to_irq(button->gpio); | 472 | if (button->irq) { |
| 474 | if (irq < 0) { | 473 | bdata->irq = button->irq; |
| 475 | error = irq; | 474 | } else { |
| 476 | dev_err(dev, | 475 | irq = gpio_to_irq(button->gpio); |
| 477 | "Unable to get irq number for GPIO %d, error %d\n", | 476 | if (irq < 0) { |
| 478 | button->gpio, error); | 477 | error = irq; |
| 479 | return error; | 478 | dev_err(dev, |
| 479 | "Unable to get irq number for GPIO %d, error %d\n", | ||
| 480 | button->gpio, error); | ||
| 481 | return error; | ||
| 482 | } | ||
| 483 | bdata->irq = irq; | ||
| 480 | } | 484 | } |
| 481 | bdata->irq = irq; | ||
| 482 | 485 | ||
| 483 | INIT_WORK(&bdata->work, gpio_keys_gpio_work_func); | 486 | INIT_DELAYED_WORK(&bdata->work, gpio_keys_gpio_work_func); |
| 484 | setup_timer(&bdata->timer, | ||
| 485 | gpio_keys_gpio_timer, (unsigned long)bdata); | ||
| 486 | 487 | ||
| 487 | isr = gpio_keys_gpio_isr; | 488 | isr = gpio_keys_gpio_isr; |
| 488 | irqflags = IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING; | 489 | irqflags = IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING; |
| @@ -499,8 +500,8 @@ static int gpio_keys_setup_key(struct platform_device *pdev, | |||
| 499 | return -EINVAL; | 500 | return -EINVAL; |
| 500 | } | 501 | } |
| 501 | 502 | ||
| 502 | bdata->timer_debounce = button->debounce_interval; | 503 | bdata->release_delay = button->debounce_interval; |
| 503 | setup_timer(&bdata->timer, | 504 | setup_timer(&bdata->release_timer, |
| 504 | gpio_keys_irq_timer, (unsigned long)bdata); | 505 | gpio_keys_irq_timer, (unsigned long)bdata); |
| 505 | 506 | ||
| 506 | isr = gpio_keys_irq_isr; | 507 | isr = gpio_keys_irq_isr; |
| @@ -510,7 +511,7 @@ static int gpio_keys_setup_key(struct platform_device *pdev, | |||
| 510 | input_set_capability(input, button->type ?: EV_KEY, button->code); | 511 | input_set_capability(input, button->type ?: EV_KEY, button->code); |
| 511 | 512 | ||
| 512 | /* | 513 | /* |
| 513 | * Install custom action to cancel debounce timer and | 514 | * Install custom action to cancel release timer and |
| 514 | * workqueue item. | 515 | * workqueue item. |
| 515 | */ | 516 | */ |
| 516 | error = devm_add_action(&pdev->dev, gpio_keys_quiesce_key, bdata); | 517 | error = devm_add_action(&pdev->dev, gpio_keys_quiesce_key, bdata); |
| @@ -618,33 +619,30 @@ gpio_keys_get_devtree_pdata(struct device *dev) | |||
| 618 | 619 | ||
| 619 | i = 0; | 620 | i = 0; |
| 620 | for_each_child_of_node(node, pp) { | 621 | for_each_child_of_node(node, pp) { |
| 621 | int gpio = -1; | ||
| 622 | enum of_gpio_flags flags; | 622 | enum of_gpio_flags flags; |
| 623 | 623 | ||
| 624 | button = &pdata->buttons[i++]; | 624 | button = &pdata->buttons[i++]; |
| 625 | 625 | ||
| 626 | if (!of_find_property(pp, "gpios", NULL)) { | 626 | button->gpio = of_get_gpio_flags(pp, 0, &flags); |
| 627 | button->irq = irq_of_parse_and_map(pp, 0); | 627 | if (button->gpio < 0) { |
| 628 | if (button->irq == 0) { | 628 | error = button->gpio; |
| 629 | i--; | 629 | if (error != -ENOENT) { |
| 630 | pdata->nbuttons--; | ||
| 631 | dev_warn(dev, "Found button without gpios or irqs\n"); | ||
| 632 | continue; | ||
| 633 | } | ||
| 634 | } else { | ||
| 635 | gpio = of_get_gpio_flags(pp, 0, &flags); | ||
| 636 | if (gpio < 0) { | ||
| 637 | error = gpio; | ||
| 638 | if (error != -EPROBE_DEFER) | 630 | if (error != -EPROBE_DEFER) |
| 639 | dev_err(dev, | 631 | dev_err(dev, |
| 640 | "Failed to get gpio flags, error: %d\n", | 632 | "Failed to get gpio flags, error: %d\n", |
| 641 | error); | 633 | error); |
| 642 | return ERR_PTR(error); | 634 | return ERR_PTR(error); |
| 643 | } | 635 | } |
| 636 | } else { | ||
| 637 | button->active_low = flags & OF_GPIO_ACTIVE_LOW; | ||
| 644 | } | 638 | } |
| 645 | 639 | ||
| 646 | button->gpio = gpio; | 640 | button->irq = irq_of_parse_and_map(pp, 0); |
| 647 | button->active_low = flags & OF_GPIO_ACTIVE_LOW; | 641 | |
| 642 | if (!gpio_is_valid(button->gpio) && !button->irq) { | ||
| 643 | dev_err(dev, "Found button without gpios or irqs\n"); | ||
| 644 | return ERR_PTR(-EINVAL); | ||
| 645 | } | ||
| 648 | 646 | ||
| 649 | if (of_property_read_u32(pp, "linux,code", &button->code)) { | 647 | if (of_property_read_u32(pp, "linux,code", &button->code)) { |
| 650 | dev_err(dev, "Button without keycode: 0x%x\n", | 648 | dev_err(dev, "Button without keycode: 0x%x\n", |
| @@ -659,6 +657,8 @@ gpio_keys_get_devtree_pdata(struct device *dev) | |||
| 659 | 657 | ||
| 660 | button->wakeup = !!of_get_property(pp, "gpio-key,wakeup", NULL); | 658 | button->wakeup = !!of_get_property(pp, "gpio-key,wakeup", NULL); |
| 661 | 659 | ||
| 660 | button->can_disable = !!of_get_property(pp, "linux,can-disable", NULL); | ||
| 661 | |||
| 662 | if (of_property_read_u32(pp, "debounce-interval", | 662 | if (of_property_read_u32(pp, "debounce-interval", |
| 663 | &button->debounce_interval)) | 663 | &button->debounce_interval)) |
| 664 | button->debounce_interval = 5; | 664 | button->debounce_interval = 5; |
diff --git a/drivers/input/keyboard/stmpe-keypad.c b/drivers/input/keyboard/stmpe-keypad.c index ef5e67fb567e..fe6e3f22eed7 100644 --- a/drivers/input/keyboard/stmpe-keypad.c +++ b/drivers/input/keyboard/stmpe-keypad.c | |||
| @@ -45,13 +45,14 @@ | |||
| 45 | #define STMPE_KEYPAD_MAX_ROWS 8 | 45 | #define STMPE_KEYPAD_MAX_ROWS 8 |
| 46 | #define STMPE_KEYPAD_MAX_COLS 8 | 46 | #define STMPE_KEYPAD_MAX_COLS 8 |
| 47 | #define STMPE_KEYPAD_ROW_SHIFT 3 | 47 | #define STMPE_KEYPAD_ROW_SHIFT 3 |
| 48 | #define STMPE_KEYPAD_KEYMAP_SIZE \ | 48 | #define STMPE_KEYPAD_KEYMAP_MAX_SIZE \ |
| 49 | (STMPE_KEYPAD_MAX_ROWS * STMPE_KEYPAD_MAX_COLS) | 49 | (STMPE_KEYPAD_MAX_ROWS * STMPE_KEYPAD_MAX_COLS) |
| 50 | 50 | ||
| 51 | /** | 51 | /** |
| 52 | * struct stmpe_keypad_variant - model-specific attributes | 52 | * struct stmpe_keypad_variant - model-specific attributes |
| 53 | * @auto_increment: whether the KPC_DATA_BYTE register address | 53 | * @auto_increment: whether the KPC_DATA_BYTE register address |
| 54 | * auto-increments on multiple read | 54 | * auto-increments on multiple read |
| 55 | * @set_pullup: whether the pins need to have their pull-ups set | ||
| 55 | * @num_data: number of data bytes | 56 | * @num_data: number of data bytes |
| 56 | * @num_normal_data: number of normal keys' data bytes | 57 | * @num_normal_data: number of normal keys' data bytes |
| 57 | * @max_cols: maximum number of columns supported | 58 | * @max_cols: maximum number of columns supported |
| @@ -61,6 +62,7 @@ | |||
| 61 | */ | 62 | */ |
| 62 | struct stmpe_keypad_variant { | 63 | struct stmpe_keypad_variant { |
| 63 | bool auto_increment; | 64 | bool auto_increment; |
| 65 | bool set_pullup; | ||
| 64 | int num_data; | 66 | int num_data; |
| 65 | int num_normal_data; | 67 | int num_normal_data; |
| 66 | int max_cols; | 68 | int max_cols; |
| @@ -81,6 +83,7 @@ static const struct stmpe_keypad_variant stmpe_keypad_variants[] = { | |||
| 81 | }, | 83 | }, |
| 82 | [STMPE2401] = { | 84 | [STMPE2401] = { |
| 83 | .auto_increment = false, | 85 | .auto_increment = false, |
| 86 | .set_pullup = true, | ||
| 84 | .num_data = 3, | 87 | .num_data = 3, |
| 85 | .num_normal_data = 2, | 88 | .num_normal_data = 2, |
| 86 | .max_cols = 8, | 89 | .max_cols = 8, |
| @@ -90,6 +93,7 @@ static const struct stmpe_keypad_variant stmpe_keypad_variants[] = { | |||
| 90 | }, | 93 | }, |
| 91 | [STMPE2403] = { | 94 | [STMPE2403] = { |
| 92 | .auto_increment = true, | 95 | .auto_increment = true, |
| 96 | .set_pullup = true, | ||
| 93 | .num_data = 5, | 97 | .num_data = 5, |
| 94 | .num_normal_data = 3, | 98 | .num_normal_data = 3, |
| 95 | .max_cols = 8, | 99 | .max_cols = 8, |
| @@ -99,16 +103,30 @@ static const struct stmpe_keypad_variant stmpe_keypad_variants[] = { | |||
| 99 | }, | 103 | }, |
| 100 | }; | 104 | }; |
| 101 | 105 | ||
| 106 | /** | ||
| 107 | * struct stmpe_keypad - STMPE keypad state container | ||
| 108 | * @stmpe: pointer to parent STMPE device | ||
| 109 | * @input: spawned input device | ||
| 110 | * @variant: STMPE variant | ||
| 111 | * @debounce_ms: debounce interval, in ms. Maximum is | ||
| 112 | * %STMPE_KEYPAD_MAX_DEBOUNCE. | ||
| 113 | * @scan_count: number of key scanning cycles to confirm key data. | ||
| 114 | * Maximum is %STMPE_KEYPAD_MAX_SCAN_COUNT. | ||
| 115 | * @no_autorepeat: disable key autorepeat | ||
| 116 | * @rows: bitmask for the rows | ||
| 117 | * @cols: bitmask for the columns | ||
| 118 | * @keymap: the keymap | ||
| 119 | */ | ||
| 102 | struct stmpe_keypad { | 120 | struct stmpe_keypad { |
| 103 | struct stmpe *stmpe; | 121 | struct stmpe *stmpe; |
| 104 | struct input_dev *input; | 122 | struct input_dev *input; |
| 105 | const struct stmpe_keypad_variant *variant; | 123 | const struct stmpe_keypad_variant *variant; |
| 106 | const struct stmpe_keypad_platform_data *plat; | 124 | unsigned int debounce_ms; |
| 107 | 125 | unsigned int scan_count; | |
| 126 | bool no_autorepeat; | ||
| 108 | unsigned int rows; | 127 | unsigned int rows; |
| 109 | unsigned int cols; | 128 | unsigned int cols; |
| 110 | 129 | unsigned short keymap[STMPE_KEYPAD_KEYMAP_MAX_SIZE]; | |
| 111 | unsigned short keymap[STMPE_KEYPAD_KEYMAP_SIZE]; | ||
| 112 | }; | 130 | }; |
| 113 | 131 | ||
| 114 | static int stmpe_keypad_read_data(struct stmpe_keypad *keypad, u8 *data) | 132 | static int stmpe_keypad_read_data(struct stmpe_keypad *keypad, u8 *data) |
| @@ -171,7 +189,10 @@ static int stmpe_keypad_altfunc_init(struct stmpe_keypad *keypad) | |||
| 171 | unsigned int col_gpios = variant->col_gpios; | 189 | unsigned int col_gpios = variant->col_gpios; |
| 172 | unsigned int row_gpios = variant->row_gpios; | 190 | unsigned int row_gpios = variant->row_gpios; |
| 173 | struct stmpe *stmpe = keypad->stmpe; | 191 | struct stmpe *stmpe = keypad->stmpe; |
| 192 | u8 pureg = stmpe->regs[STMPE_IDX_GPPUR_LSB]; | ||
| 174 | unsigned int pins = 0; | 193 | unsigned int pins = 0; |
| 194 | unsigned int pu_pins = 0; | ||
| 195 | int ret; | ||
| 175 | int i; | 196 | int i; |
| 176 | 197 | ||
| 177 | /* | 198 | /* |
| @@ -188,8 +209,10 @@ static int stmpe_keypad_altfunc_init(struct stmpe_keypad *keypad) | |||
| 188 | for (i = 0; i < variant->max_cols; i++) { | 209 | for (i = 0; i < variant->max_cols; i++) { |
| 189 | int num = __ffs(col_gpios); | 210 | int num = __ffs(col_gpios); |
| 190 | 211 | ||
| 191 | if (keypad->cols & (1 << i)) | 212 | if (keypad->cols & (1 << i)) { |
| 192 | pins |= 1 << num; | 213 | pins |= 1 << num; |
| 214 | pu_pins |= 1 << num; | ||
| 215 | } | ||
| 193 | 216 | ||
| 194 | col_gpios &= ~(1 << num); | 217 | col_gpios &= ~(1 << num); |
| 195 | } | 218 | } |
| @@ -203,20 +226,43 @@ static int stmpe_keypad_altfunc_init(struct stmpe_keypad *keypad) | |||
| 203 | row_gpios &= ~(1 << num); | 226 | row_gpios &= ~(1 << num); |
| 204 | } | 227 | } |
| 205 | 228 | ||
| 206 | return stmpe_set_altfunc(stmpe, pins, STMPE_BLOCK_KEYPAD); | 229 | ret = stmpe_set_altfunc(stmpe, pins, STMPE_BLOCK_KEYPAD); |
| 230 | if (ret) | ||
| 231 | return ret; | ||
| 232 | |||
| 233 | /* | ||
| 234 | * On STMPE24xx, set pin bias to pull-up on all keypad input | ||
| 235 | * pins (columns), this incidentally happen to be maximum 8 pins | ||
| 236 | * and placed at GPIO0-7 so only the LSB of the pull up register | ||
| 237 | * ever needs to be written. | ||
| 238 | */ | ||
| 239 | if (variant->set_pullup) { | ||
| 240 | u8 val; | ||
| 241 | |||
| 242 | ret = stmpe_reg_read(stmpe, pureg); | ||
| 243 | if (ret) | ||
| 244 | return ret; | ||
| 245 | |||
| 246 | /* Do not touch unused pins, may be used for GPIO */ | ||
| 247 | val = ret & ~pu_pins; | ||
| 248 | val |= pu_pins; | ||
| 249 | |||
| 250 | ret = stmpe_reg_write(stmpe, pureg, val); | ||
| 251 | } | ||
| 252 | |||
| 253 | return 0; | ||
| 207 | } | 254 | } |
| 208 | 255 | ||
| 209 | static int stmpe_keypad_chip_init(struct stmpe_keypad *keypad) | 256 | static int stmpe_keypad_chip_init(struct stmpe_keypad *keypad) |
| 210 | { | 257 | { |
| 211 | const struct stmpe_keypad_platform_data *plat = keypad->plat; | ||
| 212 | const struct stmpe_keypad_variant *variant = keypad->variant; | 258 | const struct stmpe_keypad_variant *variant = keypad->variant; |
| 213 | struct stmpe *stmpe = keypad->stmpe; | 259 | struct stmpe *stmpe = keypad->stmpe; |
| 214 | int ret; | 260 | int ret; |
| 215 | 261 | ||
| 216 | if (plat->debounce_ms > STMPE_KEYPAD_MAX_DEBOUNCE) | 262 | if (keypad->debounce_ms > STMPE_KEYPAD_MAX_DEBOUNCE) |
| 217 | return -EINVAL; | 263 | return -EINVAL; |
| 218 | 264 | ||
| 219 | if (plat->scan_count > STMPE_KEYPAD_MAX_SCAN_COUNT) | 265 | if (keypad->scan_count > STMPE_KEYPAD_MAX_SCAN_COUNT) |
| 220 | return -EINVAL; | 266 | return -EINVAL; |
| 221 | 267 | ||
| 222 | ret = stmpe_enable(stmpe, STMPE_BLOCK_KEYPAD); | 268 | ret = stmpe_enable(stmpe, STMPE_BLOCK_KEYPAD); |
| @@ -245,7 +291,7 @@ static int stmpe_keypad_chip_init(struct stmpe_keypad *keypad) | |||
| 245 | 291 | ||
| 246 | ret = stmpe_set_bits(stmpe, STMPE_KPC_CTRL_MSB, | 292 | ret = stmpe_set_bits(stmpe, STMPE_KPC_CTRL_MSB, |
| 247 | STMPE_KPC_CTRL_MSB_SCAN_COUNT, | 293 | STMPE_KPC_CTRL_MSB_SCAN_COUNT, |
| 248 | plat->scan_count << 4); | 294 | keypad->scan_count << 4); |
| 249 | if (ret < 0) | 295 | if (ret < 0) |
| 250 | return ret; | 296 | return ret; |
| 251 | 297 | ||
| @@ -253,17 +299,18 @@ static int stmpe_keypad_chip_init(struct stmpe_keypad *keypad) | |||
| 253 | STMPE_KPC_CTRL_LSB_SCAN | | 299 | STMPE_KPC_CTRL_LSB_SCAN | |
| 254 | STMPE_KPC_CTRL_LSB_DEBOUNCE, | 300 | STMPE_KPC_CTRL_LSB_DEBOUNCE, |
| 255 | STMPE_KPC_CTRL_LSB_SCAN | | 301 | STMPE_KPC_CTRL_LSB_SCAN | |
| 256 | (plat->debounce_ms << 1)); | 302 | (keypad->debounce_ms << 1)); |
| 257 | } | 303 | } |
| 258 | 304 | ||
| 259 | static void stmpe_keypad_fill_used_pins(struct stmpe_keypad *keypad) | 305 | static void stmpe_keypad_fill_used_pins(struct stmpe_keypad *keypad, |
| 306 | u32 used_rows, u32 used_cols) | ||
| 260 | { | 307 | { |
| 261 | int row, col; | 308 | int row, col; |
| 262 | 309 | ||
| 263 | for (row = 0; row < STMPE_KEYPAD_MAX_ROWS; row++) { | 310 | for (row = 0; row < used_rows; row++) { |
| 264 | for (col = 0; col < STMPE_KEYPAD_MAX_COLS; col++) { | 311 | for (col = 0; col < used_cols; col++) { |
| 265 | int code = MATRIX_SCAN_CODE(row, col, | 312 | int code = MATRIX_SCAN_CODE(row, col, |
| 266 | STMPE_KEYPAD_ROW_SHIFT); | 313 | STMPE_KEYPAD_ROW_SHIFT); |
| 267 | if (keypad->keymap[code] != KEY_RESERVED) { | 314 | if (keypad->keymap[code] != KEY_RESERVED) { |
| 268 | keypad->rows |= 1 << row; | 315 | keypad->rows |= 1 << row; |
| 269 | keypad->cols |= 1 << col; | 316 | keypad->cols |= 1 << col; |
| @@ -272,51 +319,17 @@ static void stmpe_keypad_fill_used_pins(struct stmpe_keypad *keypad) | |||
| 272 | } | 319 | } |
| 273 | } | 320 | } |
| 274 | 321 | ||
| 275 | #ifdef CONFIG_OF | ||
| 276 | static const struct stmpe_keypad_platform_data * | ||
| 277 | stmpe_keypad_of_probe(struct device *dev) | ||
| 278 | { | ||
| 279 | struct device_node *np = dev->of_node; | ||
| 280 | struct stmpe_keypad_platform_data *plat; | ||
| 281 | |||
| 282 | if (!np) | ||
| 283 | return ERR_PTR(-ENODEV); | ||
| 284 | |||
| 285 | plat = devm_kzalloc(dev, sizeof(*plat), GFP_KERNEL); | ||
| 286 | if (!plat) | ||
| 287 | return ERR_PTR(-ENOMEM); | ||
| 288 | |||
| 289 | of_property_read_u32(np, "debounce-interval", &plat->debounce_ms); | ||
| 290 | of_property_read_u32(np, "st,scan-count", &plat->scan_count); | ||
| 291 | |||
| 292 | plat->no_autorepeat = of_property_read_bool(np, "st,no-autorepeat"); | ||
| 293 | |||
| 294 | return plat; | ||
| 295 | } | ||
| 296 | #else | ||
| 297 | static inline const struct stmpe_keypad_platform_data * | ||
| 298 | stmpe_keypad_of_probe(struct device *dev) | ||
| 299 | { | ||
| 300 | return ERR_PTR(-EINVAL); | ||
| 301 | } | ||
| 302 | #endif | ||
| 303 | |||
| 304 | static int stmpe_keypad_probe(struct platform_device *pdev) | 322 | static int stmpe_keypad_probe(struct platform_device *pdev) |
| 305 | { | 323 | { |
| 306 | struct stmpe *stmpe = dev_get_drvdata(pdev->dev.parent); | 324 | struct stmpe *stmpe = dev_get_drvdata(pdev->dev.parent); |
| 307 | const struct stmpe_keypad_platform_data *plat; | 325 | struct device_node *np = pdev->dev.of_node; |
| 308 | struct stmpe_keypad *keypad; | 326 | struct stmpe_keypad *keypad; |
| 309 | struct input_dev *input; | 327 | struct input_dev *input; |
| 328 | u32 rows; | ||
| 329 | u32 cols; | ||
| 310 | int error; | 330 | int error; |
| 311 | int irq; | 331 | int irq; |
| 312 | 332 | ||
| 313 | plat = stmpe->pdata->keypad; | ||
| 314 | if (!plat) { | ||
| 315 | plat = stmpe_keypad_of_probe(&pdev->dev); | ||
| 316 | if (IS_ERR(plat)) | ||
| 317 | return PTR_ERR(plat); | ||
| 318 | } | ||
| 319 | |||
| 320 | irq = platform_get_irq(pdev, 0); | 333 | irq = platform_get_irq(pdev, 0); |
| 321 | if (irq < 0) | 334 | if (irq < 0) |
| 322 | return irq; | 335 | return irq; |
| @@ -326,6 +339,13 @@ static int stmpe_keypad_probe(struct platform_device *pdev) | |||
| 326 | if (!keypad) | 339 | if (!keypad) |
| 327 | return -ENOMEM; | 340 | return -ENOMEM; |
| 328 | 341 | ||
| 342 | keypad->stmpe = stmpe; | ||
| 343 | keypad->variant = &stmpe_keypad_variants[stmpe->partnum]; | ||
| 344 | |||
| 345 | of_property_read_u32(np, "debounce-interval", &keypad->debounce_ms); | ||
| 346 | of_property_read_u32(np, "st,scan-count", &keypad->scan_count); | ||
| 347 | keypad->no_autorepeat = of_property_read_bool(np, "st,no-autorepeat"); | ||
| 348 | |||
| 329 | input = devm_input_allocate_device(&pdev->dev); | 349 | input = devm_input_allocate_device(&pdev->dev); |
| 330 | if (!input) | 350 | if (!input) |
| 331 | return -ENOMEM; | 351 | return -ENOMEM; |
| @@ -334,23 +354,22 @@ static int stmpe_keypad_probe(struct platform_device *pdev) | |||
| 334 | input->id.bustype = BUS_I2C; | 354 | input->id.bustype = BUS_I2C; |
| 335 | input->dev.parent = &pdev->dev; | 355 | input->dev.parent = &pdev->dev; |
| 336 | 356 | ||
| 337 | error = matrix_keypad_build_keymap(plat->keymap_data, NULL, | 357 | error = matrix_keypad_parse_of_params(&pdev->dev, &rows, &cols); |
| 338 | STMPE_KEYPAD_MAX_ROWS, | 358 | if (error) |
| 339 | STMPE_KEYPAD_MAX_COLS, | 359 | return error; |
| 360 | |||
| 361 | error = matrix_keypad_build_keymap(NULL, NULL, rows, cols, | ||
| 340 | keypad->keymap, input); | 362 | keypad->keymap, input); |
| 341 | if (error) | 363 | if (error) |
| 342 | return error; | 364 | return error; |
| 343 | 365 | ||
| 344 | input_set_capability(input, EV_MSC, MSC_SCAN); | 366 | input_set_capability(input, EV_MSC, MSC_SCAN); |
| 345 | if (!plat->no_autorepeat) | 367 | if (!keypad->no_autorepeat) |
| 346 | __set_bit(EV_REP, input->evbit); | 368 | __set_bit(EV_REP, input->evbit); |
| 347 | 369 | ||
| 348 | stmpe_keypad_fill_used_pins(keypad); | 370 | stmpe_keypad_fill_used_pins(keypad, rows, cols); |
| 349 | 371 | ||
| 350 | keypad->stmpe = stmpe; | ||
| 351 | keypad->plat = plat; | ||
| 352 | keypad->input = input; | 372 | keypad->input = input; |
| 353 | keypad->variant = &stmpe_keypad_variants[stmpe->partnum]; | ||
| 354 | 373 | ||
| 355 | error = stmpe_keypad_chip_init(keypad); | 374 | error = stmpe_keypad_chip_init(keypad); |
| 356 | if (error < 0) | 375 | if (error < 0) |
diff --git a/drivers/input/mouse/alps.c b/drivers/input/mouse/alps.c index d125a019383f..d88d73d83552 100644 --- a/drivers/input/mouse/alps.c +++ b/drivers/input/mouse/alps.c | |||
| @@ -881,6 +881,34 @@ static void alps_get_finger_coordinate_v7(struct input_mt_pos *mt, | |||
| 881 | unsigned char *pkt, | 881 | unsigned char *pkt, |
| 882 | unsigned char pkt_id) | 882 | unsigned char pkt_id) |
| 883 | { | 883 | { |
| 884 | /* | ||
| 885 | * packet-fmt b7 b6 b5 b4 b3 b2 b1 b0 | ||
| 886 | * Byte0 TWO & MULTI L 1 R M 1 Y0-2 Y0-1 Y0-0 | ||
| 887 | * Byte0 NEW L 1 X1-5 1 1 Y0-2 Y0-1 Y0-0 | ||
| 888 | * Byte1 Y0-10 Y0-9 Y0-8 Y0-7 Y0-6 Y0-5 Y0-4 Y0-3 | ||
| 889 | * Byte2 X0-11 1 X0-10 X0-9 X0-8 X0-7 X0-6 X0-5 | ||
| 890 | * Byte3 X1-11 1 X0-4 X0-3 1 X0-2 X0-1 X0-0 | ||
| 891 | * Byte4 TWO X1-10 TWO X1-9 X1-8 X1-7 X1-6 X1-5 X1-4 | ||
| 892 | * Byte4 MULTI X1-10 TWO X1-9 X1-8 X1-7 X1-6 Y1-5 1 | ||
| 893 | * Byte4 NEW X1-10 TWO X1-9 X1-8 X1-7 X1-6 0 0 | ||
| 894 | * Byte5 TWO & NEW Y1-10 0 Y1-9 Y1-8 Y1-7 Y1-6 Y1-5 Y1-4 | ||
| 895 | * Byte5 MULTI Y1-10 0 Y1-9 Y1-8 Y1-7 Y1-6 F-1 F-0 | ||
| 896 | * L: Left button | ||
| 897 | * R / M: Non-clickpads: Right / Middle button | ||
| 898 | * Clickpads: When > 2 fingers are down, and some fingers | ||
| 899 | * are in the button area, then the 2 coordinates reported | ||
| 900 | * are for fingers outside the button area and these report | ||
| 901 | * extra fingers being present in the right / left button | ||
| 902 | * area. Note these fingers are not added to the F field! | ||
| 903 | * so if a TWO packet is received and R = 1 then there are | ||
| 904 | * 3 fingers down, etc. | ||
| 905 | * TWO: 1: Two touches present, byte 0/4/5 are in TWO fmt | ||
| 906 | * 0: If byte 4 bit 0 is 1, then byte 0/4/5 are in MULTI fmt | ||
| 907 | * otherwise byte 0 bit 4 must be set and byte 0/4/5 are | ||
| 908 | * in NEW fmt | ||
| 909 | * F: Number of fingers - 3, 0 means 3 fingers, 1 means 4 ... | ||
| 910 | */ | ||
| 911 | |||
| 884 | mt[0].x = ((pkt[2] & 0x80) << 4); | 912 | mt[0].x = ((pkt[2] & 0x80) << 4); |
| 885 | mt[0].x |= ((pkt[2] & 0x3F) << 5); | 913 | mt[0].x |= ((pkt[2] & 0x3F) << 5); |
| 886 | mt[0].x |= ((pkt[3] & 0x30) >> 1); | 914 | mt[0].x |= ((pkt[3] & 0x30) >> 1); |
| @@ -919,18 +947,21 @@ static void alps_get_finger_coordinate_v7(struct input_mt_pos *mt, | |||
| 919 | 947 | ||
| 920 | static int alps_get_mt_count(struct input_mt_pos *mt) | 948 | static int alps_get_mt_count(struct input_mt_pos *mt) |
| 921 | { | 949 | { |
| 922 | int i; | 950 | int i, fingers = 0; |
| 923 | 951 | ||
| 924 | for (i = 0; i < MAX_TOUCHES && mt[i].x != 0 && mt[i].y != 0; i++) | 952 | for (i = 0; i < MAX_TOUCHES; i++) { |
| 925 | /* empty */; | 953 | if (mt[i].x != 0 || mt[i].y != 0) |
| 954 | fingers++; | ||
| 955 | } | ||
| 926 | 956 | ||
| 927 | return i; | 957 | return fingers; |
| 928 | } | 958 | } |
| 929 | 959 | ||
| 930 | static int alps_decode_packet_v7(struct alps_fields *f, | 960 | static int alps_decode_packet_v7(struct alps_fields *f, |
| 931 | unsigned char *p, | 961 | unsigned char *p, |
| 932 | struct psmouse *psmouse) | 962 | struct psmouse *psmouse) |
| 933 | { | 963 | { |
| 964 | struct alps_data *priv = psmouse->private; | ||
| 934 | unsigned char pkt_id; | 965 | unsigned char pkt_id; |
| 935 | 966 | ||
| 936 | pkt_id = alps_get_packet_id_v7(p); | 967 | pkt_id = alps_get_packet_id_v7(p); |
| @@ -938,19 +969,52 @@ static int alps_decode_packet_v7(struct alps_fields *f, | |||
| 938 | return 0; | 969 | return 0; |
| 939 | if (pkt_id == V7_PACKET_ID_UNKNOWN) | 970 | if (pkt_id == V7_PACKET_ID_UNKNOWN) |
| 940 | return -1; | 971 | return -1; |
| 972 | /* | ||
| 973 | * NEW packets are send to indicate a discontinuity in the finger | ||
| 974 | * coordinate reporting. Specifically a finger may have moved from | ||
| 975 | * slot 0 to 1 or vice versa. INPUT_MT_TRACK takes care of this for | ||
| 976 | * us. | ||
| 977 | * | ||
| 978 | * NEW packets have 3 problems: | ||
| 979 | * 1) They do not contain middle / right button info (on non clickpads) | ||
| 980 | * this can be worked around by preserving the old button state | ||
| 981 | * 2) They do not contain an accurate fingercount, and they are | ||
| 982 | * typically send when the number of fingers changes. We cannot use | ||
| 983 | * the old finger count as that may mismatch with the amount of | ||
| 984 | * touch coordinates we've available in the NEW packet | ||
| 985 | * 3) Their x data for the second touch is inaccurate leading to | ||
| 986 | * a possible jump of the x coordinate by 16 units when the first | ||
| 987 | * non NEW packet comes in | ||
| 988 | * Since problems 2 & 3 cannot be worked around, just ignore them. | ||
| 989 | */ | ||
| 990 | if (pkt_id == V7_PACKET_ID_NEW) | ||
| 991 | return 1; | ||
| 941 | 992 | ||
| 942 | alps_get_finger_coordinate_v7(f->mt, p, pkt_id); | 993 | alps_get_finger_coordinate_v7(f->mt, p, pkt_id); |
| 943 | 994 | ||
| 944 | if (pkt_id == V7_PACKET_ID_TWO || pkt_id == V7_PACKET_ID_MULTI) { | 995 | if (pkt_id == V7_PACKET_ID_TWO) |
| 945 | f->left = (p[0] & 0x80) >> 7; | 996 | f->fingers = alps_get_mt_count(f->mt); |
| 997 | else /* pkt_id == V7_PACKET_ID_MULTI */ | ||
| 998 | f->fingers = 3 + (p[5] & 0x03); | ||
| 999 | |||
| 1000 | f->left = (p[0] & 0x80) >> 7; | ||
| 1001 | if (priv->flags & ALPS_BUTTONPAD) { | ||
| 1002 | if (p[0] & 0x20) | ||
| 1003 | f->fingers++; | ||
| 1004 | if (p[0] & 0x10) | ||
| 1005 | f->fingers++; | ||
| 1006 | } else { | ||
| 946 | f->right = (p[0] & 0x20) >> 5; | 1007 | f->right = (p[0] & 0x20) >> 5; |
| 947 | f->middle = (p[0] & 0x10) >> 4; | 1008 | f->middle = (p[0] & 0x10) >> 4; |
| 948 | } | 1009 | } |
| 949 | 1010 | ||
| 950 | if (pkt_id == V7_PACKET_ID_TWO) | 1011 | /* Sometimes a single touch is reported in mt[1] rather then mt[0] */ |
| 951 | f->fingers = alps_get_mt_count(f->mt); | 1012 | if (f->fingers == 1 && f->mt[0].x == 0 && f->mt[0].y == 0) { |
| 952 | else if (pkt_id == V7_PACKET_ID_MULTI) | 1013 | f->mt[0].x = f->mt[1].x; |
| 953 | f->fingers = 3 + (p[5] & 0x03); | 1014 | f->mt[0].y = f->mt[1].y; |
| 1015 | f->mt[1].x = 0; | ||
| 1016 | f->mt[1].y = 0; | ||
| 1017 | } | ||
| 954 | 1018 | ||
| 955 | return 0; | 1019 | return 0; |
| 956 | } | 1020 | } |
diff --git a/drivers/input/mouse/trackpoint.c b/drivers/input/mouse/trackpoint.c index 30c8b6998808..354d47ecd66a 100644 --- a/drivers/input/mouse/trackpoint.c +++ b/drivers/input/mouse/trackpoint.c | |||
| @@ -227,6 +227,7 @@ TRACKPOINT_INT_ATTR(thresh, TP_THRESH, TP_DEF_THRESH); | |||
| 227 | TRACKPOINT_INT_ATTR(upthresh, TP_UP_THRESH, TP_DEF_UP_THRESH); | 227 | TRACKPOINT_INT_ATTR(upthresh, TP_UP_THRESH, TP_DEF_UP_THRESH); |
| 228 | TRACKPOINT_INT_ATTR(ztime, TP_Z_TIME, TP_DEF_Z_TIME); | 228 | TRACKPOINT_INT_ATTR(ztime, TP_Z_TIME, TP_DEF_Z_TIME); |
| 229 | TRACKPOINT_INT_ATTR(jenks, TP_JENKS_CURV, TP_DEF_JENKS_CURV); | 229 | TRACKPOINT_INT_ATTR(jenks, TP_JENKS_CURV, TP_DEF_JENKS_CURV); |
| 230 | TRACKPOINT_INT_ATTR(drift_time, TP_DRIFT_TIME, TP_DEF_DRIFT_TIME); | ||
| 230 | 231 | ||
| 231 | TRACKPOINT_BIT_ATTR(press_to_select, TP_TOGGLE_PTSON, TP_MASK_PTSON, 0, | 232 | TRACKPOINT_BIT_ATTR(press_to_select, TP_TOGGLE_PTSON, TP_MASK_PTSON, 0, |
| 232 | TP_DEF_PTSON); | 233 | TP_DEF_PTSON); |
| @@ -246,6 +247,7 @@ static struct attribute *trackpoint_attrs[] = { | |||
| 246 | &psmouse_attr_upthresh.dattr.attr, | 247 | &psmouse_attr_upthresh.dattr.attr, |
| 247 | &psmouse_attr_ztime.dattr.attr, | 248 | &psmouse_attr_ztime.dattr.attr, |
| 248 | &psmouse_attr_jenks.dattr.attr, | 249 | &psmouse_attr_jenks.dattr.attr, |
| 250 | &psmouse_attr_drift_time.dattr.attr, | ||
| 249 | &psmouse_attr_press_to_select.dattr.attr, | 251 | &psmouse_attr_press_to_select.dattr.attr, |
| 250 | &psmouse_attr_skipback.dattr.attr, | 252 | &psmouse_attr_skipback.dattr.attr, |
| 251 | &psmouse_attr_ext_dev.dattr.attr, | 253 | &psmouse_attr_ext_dev.dattr.attr, |
| @@ -312,6 +314,7 @@ static int trackpoint_sync(struct psmouse *psmouse, bool in_power_on_state) | |||
| 312 | TRACKPOINT_UPDATE(in_power_on_state, psmouse, tp, upthresh); | 314 | TRACKPOINT_UPDATE(in_power_on_state, psmouse, tp, upthresh); |
| 313 | TRACKPOINT_UPDATE(in_power_on_state, psmouse, tp, ztime); | 315 | TRACKPOINT_UPDATE(in_power_on_state, psmouse, tp, ztime); |
| 314 | TRACKPOINT_UPDATE(in_power_on_state, psmouse, tp, jenks); | 316 | TRACKPOINT_UPDATE(in_power_on_state, psmouse, tp, jenks); |
| 317 | TRACKPOINT_UPDATE(in_power_on_state, psmouse, tp, drift_time); | ||
| 315 | 318 | ||
| 316 | /* toggles */ | 319 | /* toggles */ |
| 317 | TRACKPOINT_UPDATE(in_power_on_state, psmouse, tp, press_to_select); | 320 | TRACKPOINT_UPDATE(in_power_on_state, psmouse, tp, press_to_select); |
| @@ -332,6 +335,7 @@ static void trackpoint_defaults(struct trackpoint_data *tp) | |||
| 332 | TRACKPOINT_SET_POWER_ON_DEFAULT(tp, upthresh); | 335 | TRACKPOINT_SET_POWER_ON_DEFAULT(tp, upthresh); |
| 333 | TRACKPOINT_SET_POWER_ON_DEFAULT(tp, ztime); | 336 | TRACKPOINT_SET_POWER_ON_DEFAULT(tp, ztime); |
| 334 | TRACKPOINT_SET_POWER_ON_DEFAULT(tp, jenks); | 337 | TRACKPOINT_SET_POWER_ON_DEFAULT(tp, jenks); |
| 338 | TRACKPOINT_SET_POWER_ON_DEFAULT(tp, drift_time); | ||
| 335 | TRACKPOINT_SET_POWER_ON_DEFAULT(tp, inertia); | 339 | TRACKPOINT_SET_POWER_ON_DEFAULT(tp, inertia); |
| 336 | 340 | ||
| 337 | /* toggles */ | 341 | /* toggles */ |
diff --git a/drivers/input/mouse/trackpoint.h b/drivers/input/mouse/trackpoint.h index ecd0547964a5..5617ed3a7d7a 100644 --- a/drivers/input/mouse/trackpoint.h +++ b/drivers/input/mouse/trackpoint.h | |||
| @@ -70,6 +70,9 @@ | |||
| 70 | #define TP_UP_THRESH 0x5A /* Used to generate a 'click' on Z-axis */ | 70 | #define TP_UP_THRESH 0x5A /* Used to generate a 'click' on Z-axis */ |
| 71 | #define TP_Z_TIME 0x5E /* How sharp of a press */ | 71 | #define TP_Z_TIME 0x5E /* How sharp of a press */ |
| 72 | #define TP_JENKS_CURV 0x5D /* Minimum curvature for double click */ | 72 | #define TP_JENKS_CURV 0x5D /* Minimum curvature for double click */ |
| 73 | #define TP_DRIFT_TIME 0x5F /* How long a 'hands off' condition */ | ||
| 74 | /* must last (x*107ms) for drift */ | ||
| 75 | /* correction to occur */ | ||
| 73 | 76 | ||
| 74 | /* | 77 | /* |
| 75 | * Toggling Flag bits | 78 | * Toggling Flag bits |
| @@ -120,6 +123,7 @@ | |||
| 120 | #define TP_DEF_UP_THRESH 0xFF | 123 | #define TP_DEF_UP_THRESH 0xFF |
| 121 | #define TP_DEF_Z_TIME 0x26 | 124 | #define TP_DEF_Z_TIME 0x26 |
| 122 | #define TP_DEF_JENKS_CURV 0x87 | 125 | #define TP_DEF_JENKS_CURV 0x87 |
| 126 | #define TP_DEF_DRIFT_TIME 0x05 | ||
| 123 | 127 | ||
| 124 | /* Toggles */ | 128 | /* Toggles */ |
| 125 | #define TP_DEF_MB 0x00 | 129 | #define TP_DEF_MB 0x00 |
| @@ -137,6 +141,7 @@ struct trackpoint_data | |||
| 137 | unsigned char draghys, mindrag; | 141 | unsigned char draghys, mindrag; |
| 138 | unsigned char thresh, upthresh; | 142 | unsigned char thresh, upthresh; |
| 139 | unsigned char ztime, jenks; | 143 | unsigned char ztime, jenks; |
| 144 | unsigned char drift_time; | ||
| 140 | 145 | ||
| 141 | /* toggles */ | 146 | /* toggles */ |
| 142 | unsigned char press_to_select; | 147 | unsigned char press_to_select; |
diff --git a/drivers/input/touchscreen/edt-ft5x06.c b/drivers/input/touchscreen/edt-ft5x06.c index 2e4d90919f4b..dcc68efd0d7f 100644 --- a/drivers/input/touchscreen/edt-ft5x06.c +++ b/drivers/input/touchscreen/edt-ft5x06.c | |||
| @@ -850,9 +850,11 @@ static int edt_ft5x06_ts_identify(struct i2c_client *client, | |||
| 850 | } | 850 | } |
| 851 | 851 | ||
| 852 | #define EDT_ATTR_CHECKSET(name, reg) \ | 852 | #define EDT_ATTR_CHECKSET(name, reg) \ |
| 853 | do { \ | ||
| 853 | if (pdata->name >= edt_ft5x06_attr_##name.limit_low && \ | 854 | if (pdata->name >= edt_ft5x06_attr_##name.limit_low && \ |
| 854 | pdata->name <= edt_ft5x06_attr_##name.limit_high) \ | 855 | pdata->name <= edt_ft5x06_attr_##name.limit_high) \ |
| 855 | edt_ft5x06_register_write(tsdata, reg, pdata->name) | 856 | edt_ft5x06_register_write(tsdata, reg, pdata->name); \ |
| 857 | } while (0) | ||
| 856 | 858 | ||
| 857 | #define EDT_GET_PROP(name, reg) { \ | 859 | #define EDT_GET_PROP(name, reg) { \ |
| 858 | u32 val; \ | 860 | u32 val; \ |
diff --git a/drivers/mfd/stmpe.c b/drivers/mfd/stmpe.c index 02a17c388e87..2d29d17518c4 100644 --- a/drivers/mfd/stmpe.c +++ b/drivers/mfd/stmpe.c | |||
| @@ -519,6 +519,7 @@ static const u8 stmpe1601_regs[] = { | |||
| 519 | [STMPE_IDX_GPDR_LSB] = STMPE1601_REG_GPIO_SET_DIR_LSB, | 519 | [STMPE_IDX_GPDR_LSB] = STMPE1601_REG_GPIO_SET_DIR_LSB, |
| 520 | [STMPE_IDX_GPRER_LSB] = STMPE1601_REG_GPIO_RE_LSB, | 520 | [STMPE_IDX_GPRER_LSB] = STMPE1601_REG_GPIO_RE_LSB, |
| 521 | [STMPE_IDX_GPFER_LSB] = STMPE1601_REG_GPIO_FE_LSB, | 521 | [STMPE_IDX_GPFER_LSB] = STMPE1601_REG_GPIO_FE_LSB, |
| 522 | [STMPE_IDX_GPPUR_LSB] = STMPE1601_REG_GPIO_PU_LSB, | ||
| 522 | [STMPE_IDX_GPAFR_U_MSB] = STMPE1601_REG_GPIO_AF_U_MSB, | 523 | [STMPE_IDX_GPAFR_U_MSB] = STMPE1601_REG_GPIO_AF_U_MSB, |
| 523 | [STMPE_IDX_IEGPIOR_LSB] = STMPE1601_REG_INT_EN_GPIO_MASK_LSB, | 524 | [STMPE_IDX_IEGPIOR_LSB] = STMPE1601_REG_INT_EN_GPIO_MASK_LSB, |
| 524 | [STMPE_IDX_ISGPIOR_MSB] = STMPE1601_REG_INT_STA_GPIO_MSB, | 525 | [STMPE_IDX_ISGPIOR_MSB] = STMPE1601_REG_INT_STA_GPIO_MSB, |
| @@ -667,6 +668,7 @@ static const u8 stmpe1801_regs[] = { | |||
| 667 | [STMPE_IDX_GPDR_LSB] = STMPE1801_REG_GPIO_SET_DIR_LOW, | 668 | [STMPE_IDX_GPDR_LSB] = STMPE1801_REG_GPIO_SET_DIR_LOW, |
| 668 | [STMPE_IDX_GPRER_LSB] = STMPE1801_REG_GPIO_RE_LOW, | 669 | [STMPE_IDX_GPRER_LSB] = STMPE1801_REG_GPIO_RE_LOW, |
| 669 | [STMPE_IDX_GPFER_LSB] = STMPE1801_REG_GPIO_FE_LOW, | 670 | [STMPE_IDX_GPFER_LSB] = STMPE1801_REG_GPIO_FE_LOW, |
| 671 | [STMPE_IDX_GPPUR_LSB] = STMPE1801_REG_GPIO_PULL_UP_LOW, | ||
| 670 | [STMPE_IDX_IEGPIOR_LSB] = STMPE1801_REG_INT_EN_GPIO_MASK_LOW, | 672 | [STMPE_IDX_IEGPIOR_LSB] = STMPE1801_REG_INT_EN_GPIO_MASK_LOW, |
| 671 | [STMPE_IDX_ISGPIOR_LSB] = STMPE1801_REG_INT_STA_GPIO_LOW, | 673 | [STMPE_IDX_ISGPIOR_LSB] = STMPE1801_REG_INT_STA_GPIO_LOW, |
| 672 | }; | 674 | }; |
| @@ -750,6 +752,8 @@ static const u8 stmpe24xx_regs[] = { | |||
| 750 | [STMPE_IDX_GPDR_LSB] = STMPE24XX_REG_GPDR_LSB, | 752 | [STMPE_IDX_GPDR_LSB] = STMPE24XX_REG_GPDR_LSB, |
| 751 | [STMPE_IDX_GPRER_LSB] = STMPE24XX_REG_GPRER_LSB, | 753 | [STMPE_IDX_GPRER_LSB] = STMPE24XX_REG_GPRER_LSB, |
| 752 | [STMPE_IDX_GPFER_LSB] = STMPE24XX_REG_GPFER_LSB, | 754 | [STMPE_IDX_GPFER_LSB] = STMPE24XX_REG_GPFER_LSB, |
| 755 | [STMPE_IDX_GPPUR_LSB] = STMPE24XX_REG_GPPUR_LSB, | ||
| 756 | [STMPE_IDX_GPPDR_LSB] = STMPE24XX_REG_GPPDR_LSB, | ||
| 753 | [STMPE_IDX_GPAFR_U_MSB] = STMPE24XX_REG_GPAFR_U_MSB, | 757 | [STMPE_IDX_GPAFR_U_MSB] = STMPE24XX_REG_GPAFR_U_MSB, |
| 754 | [STMPE_IDX_IEGPIOR_LSB] = STMPE24XX_REG_IEGPIOR_LSB, | 758 | [STMPE_IDX_IEGPIOR_LSB] = STMPE24XX_REG_IEGPIOR_LSB, |
| 755 | [STMPE_IDX_ISGPIOR_MSB] = STMPE24XX_REG_ISGPIOR_MSB, | 759 | [STMPE_IDX_ISGPIOR_MSB] = STMPE24XX_REG_ISGPIOR_MSB, |
diff --git a/drivers/mfd/stmpe.h b/drivers/mfd/stmpe.h index 2d045f26f193..e00710b63932 100644 --- a/drivers/mfd/stmpe.h +++ b/drivers/mfd/stmpe.h | |||
| @@ -188,6 +188,7 @@ int stmpe_remove(struct stmpe *stmpe); | |||
| 188 | #define STMPE1601_REG_GPIO_ED_MSB 0x8A | 188 | #define STMPE1601_REG_GPIO_ED_MSB 0x8A |
| 189 | #define STMPE1601_REG_GPIO_RE_LSB 0x8D | 189 | #define STMPE1601_REG_GPIO_RE_LSB 0x8D |
| 190 | #define STMPE1601_REG_GPIO_FE_LSB 0x8F | 190 | #define STMPE1601_REG_GPIO_FE_LSB 0x8F |
| 191 | #define STMPE1601_REG_GPIO_PU_LSB 0x91 | ||
| 191 | #define STMPE1601_REG_GPIO_AF_U_MSB 0x92 | 192 | #define STMPE1601_REG_GPIO_AF_U_MSB 0x92 |
| 192 | 193 | ||
| 193 | #define STMPE1601_SYS_CTRL_ENABLE_GPIO (1 << 3) | 194 | #define STMPE1601_SYS_CTRL_ENABLE_GPIO (1 << 3) |
| @@ -276,6 +277,8 @@ int stmpe_remove(struct stmpe *stmpe); | |||
| 276 | #define STMPE24XX_REG_GPEDR_MSB 0x8C | 277 | #define STMPE24XX_REG_GPEDR_MSB 0x8C |
| 277 | #define STMPE24XX_REG_GPRER_LSB 0x91 | 278 | #define STMPE24XX_REG_GPRER_LSB 0x91 |
| 278 | #define STMPE24XX_REG_GPFER_LSB 0x94 | 279 | #define STMPE24XX_REG_GPFER_LSB 0x94 |
| 280 | #define STMPE24XX_REG_GPPUR_LSB 0x97 | ||
| 281 | #define STMPE24XX_REG_GPPDR_LSB 0x9a | ||
| 279 | #define STMPE24XX_REG_GPAFR_U_MSB 0x9B | 282 | #define STMPE24XX_REG_GPAFR_U_MSB 0x9B |
| 280 | 283 | ||
| 281 | #define STMPE24XX_SYS_CTRL_ENABLE_GPIO (1 << 3) | 284 | #define STMPE24XX_SYS_CTRL_ENABLE_GPIO (1 << 3) |
diff --git a/include/linux/mfd/stmpe.h b/include/linux/mfd/stmpe.h index 575a86c7fcbd..f742b6717d52 100644 --- a/include/linux/mfd/stmpe.h +++ b/include/linux/mfd/stmpe.h | |||
| @@ -50,6 +50,8 @@ enum { | |||
| 50 | STMPE_IDX_GPEDR_MSB, | 50 | STMPE_IDX_GPEDR_MSB, |
| 51 | STMPE_IDX_GPRER_LSB, | 51 | STMPE_IDX_GPRER_LSB, |
| 52 | STMPE_IDX_GPFER_LSB, | 52 | STMPE_IDX_GPFER_LSB, |
| 53 | STMPE_IDX_GPPUR_LSB, | ||
| 54 | STMPE_IDX_GPPDR_LSB, | ||
| 53 | STMPE_IDX_GPAFR_U_MSB, | 55 | STMPE_IDX_GPAFR_U_MSB, |
| 54 | STMPE_IDX_IEGPIOR_LSB, | 56 | STMPE_IDX_IEGPIOR_LSB, |
| 55 | STMPE_IDX_ISGPIOR_LSB, | 57 | STMPE_IDX_ISGPIOR_LSB, |
| @@ -113,24 +115,6 @@ extern int stmpe_set_altfunc(struct stmpe *stmpe, u32 pins, | |||
| 113 | extern int stmpe_enable(struct stmpe *stmpe, unsigned int blocks); | 115 | extern int stmpe_enable(struct stmpe *stmpe, unsigned int blocks); |
| 114 | extern int stmpe_disable(struct stmpe *stmpe, unsigned int blocks); | 116 | extern int stmpe_disable(struct stmpe *stmpe, unsigned int blocks); |
| 115 | 117 | ||
| 116 | struct matrix_keymap_data; | ||
| 117 | |||
| 118 | /** | ||
| 119 | * struct stmpe_keypad_platform_data - STMPE keypad platform data | ||
| 120 | * @keymap_data: key map table and size | ||
| 121 | * @debounce_ms: debounce interval, in ms. Maximum is | ||
| 122 | * %STMPE_KEYPAD_MAX_DEBOUNCE. | ||
| 123 | * @scan_count: number of key scanning cycles to confirm key data. | ||
| 124 | * Maximum is %STMPE_KEYPAD_MAX_SCAN_COUNT. | ||
| 125 | * @no_autorepeat: disable key autorepeat | ||
| 126 | */ | ||
| 127 | struct stmpe_keypad_platform_data { | ||
| 128 | const struct matrix_keymap_data *keymap_data; | ||
| 129 | unsigned int debounce_ms; | ||
| 130 | unsigned int scan_count; | ||
| 131 | bool no_autorepeat; | ||
| 132 | }; | ||
| 133 | |||
| 134 | #define STMPE_GPIO_NOREQ_811_TOUCH (0xf0) | 118 | #define STMPE_GPIO_NOREQ_811_TOUCH (0xf0) |
| 135 | 119 | ||
| 136 | /** | 120 | /** |
| @@ -199,7 +183,6 @@ struct stmpe_ts_platform_data { | |||
| 199 | * @irq_gpio: gpio number over which irq will be requested (significant only if | 183 | * @irq_gpio: gpio number over which irq will be requested (significant only if |
| 200 | * irq_over_gpio is true) | 184 | * irq_over_gpio is true) |
| 201 | * @gpio: GPIO-specific platform data | 185 | * @gpio: GPIO-specific platform data |
| 202 | * @keypad: keypad-specific platform data | ||
| 203 | * @ts: touchscreen-specific platform data | 186 | * @ts: touchscreen-specific platform data |
| 204 | */ | 187 | */ |
| 205 | struct stmpe_platform_data { | 188 | struct stmpe_platform_data { |
| @@ -212,7 +195,6 @@ struct stmpe_platform_data { | |||
| 212 | int autosleep_timeout; | 195 | int autosleep_timeout; |
| 213 | 196 | ||
| 214 | struct stmpe_gpio_platform_data *gpio; | 197 | struct stmpe_gpio_platform_data *gpio; |
| 215 | struct stmpe_keypad_platform_data *keypad; | ||
| 216 | struct stmpe_ts_platform_data *ts; | 198 | struct stmpe_ts_platform_data *ts; |
| 217 | }; | 199 | }; |
| 218 | 200 | ||
