Commit 1acd2de5 authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input

Pull more input updates from Dmitry Torokhov:
 "The second round of updates for the input subsystem.

  Updates to ALPS an bfin_roraty drivers and a couple oother fixups"

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input:
  Input: psmouse - use IS_ENABLED instead of homegrown code
  Input: bfin_rotary - introduce open and close methods
  Input: bfin_rotary - convert to use managed resources
  Input: bfin_rotary - use generic IO functions
  Input: bfin_rotary - move pin lists into into platform data
  Input: bfin_rotary - move platform header to linux/platform_data
  Input: bfin_rotary - mark suspend and resume code as __maybe_unused
  Input: bfin_rotary - fix potential oops in interrupt handler
  Input: ALPS - move v7 packet info to Documentation and v6 packet info
  Input: ALPS - fix confusing comment in protocol data
  Input: ALPS - do not mix trackstick and external PS/2 mouse data
  Input: ALPS - fix trackstick detection on some Dell Latitudes
  Input: ALPS - consolidate setting protocol parameters
  Input: ALPS - split protocol data from model info
  Input: ALPS - make Rushmore a separate protocol
  Input: ALPS - renumber protocol numbers
  Input: adi - remove an unnecessary check
  Input: pxa27x_keypad - remove an unneeded NULL check
  Input: soc_button_array - use "Windows" key for "Home"
parents b5ccb078 4c971aa7
...@@ -3,8 +3,8 @@ ALPS Touchpad Protocol ...@@ -3,8 +3,8 @@ ALPS Touchpad Protocol
Introduction Introduction
------------ ------------
Currently the ALPS touchpad driver supports five protocol versions in use by Currently the ALPS touchpad driver supports seven protocol versions in use by
ALPS touchpads, called versions 1, 2, 3, 4 and 5. ALPS touchpads, called versions 1, 2, 3, 4, 5, 6 and 7.
Since roughly mid-2010 several new ALPS touchpads have been released and Since roughly mid-2010 several new ALPS touchpads have been released and
integrated into a variety of laptops and netbooks. These new touchpads integrated into a variety of laptops and netbooks. These new touchpads
...@@ -240,3 +240,67 @@ For mt, the format is: ...@@ -240,3 +240,67 @@ For mt, the format is:
byte 3: 0 x23 x22 x21 x20 x19 x18 x17 byte 3: 0 x23 x22 x21 x20 x19 x18 x17
byte 4: 0 x9 x8 x7 x6 x5 x4 x3 byte 4: 0 x9 x8 x7 x6 x5 x4 x3
byte 5: 0 x16 x15 x14 x13 x12 x11 x10 byte 5: 0 x16 x15 x14 x13 x12 x11 x10
ALPS Absolute Mode - Protocol Version 6
---------------------------------------
For trackstick packet, the format is:
byte 0: 1 1 1 1 1 1 1 1
byte 1: 0 X6 X5 X4 X3 X2 X1 X0
byte 2: 0 Y6 Y5 Y4 Y3 Y2 Y1 Y0
byte 3: ? Y7 X7 ? ? M R L
byte 4: Z7 Z6 Z5 Z4 Z3 Z2 Z1 Z0
byte 5: 0 1 1 1 1 1 1 1
For touchpad packet, the format is:
byte 0: 1 1 1 1 1 1 1 1
byte 1: 0 0 0 0 x3 x2 x1 x0
byte 2: 0 0 0 0 y3 y2 y1 y0
byte 3: ? x7 x6 x5 x4 ? r l
byte 4: ? y7 y6 y5 y4 ? ? ?
byte 5: z7 z6 z5 z4 z3 z2 z1 z0
(v6 touchpad does not have middle button)
ALPS Absolute Mode - Protocol Version 7
---------------------------------------
For trackstick packet, the format is:
byte 0: 0 1 0 0 1 0 0 0
byte 1: 1 1 * * 1 M R L
byte 2: X7 1 X5 X4 X3 X2 X1 X0
byte 3: Z6 1 Y6 X6 1 Y2 Y1 Y0
byte 4: Y7 0 Y5 Y4 Y3 1 1 0
byte 5: T&P 0 Z5 Z4 Z3 Z2 Z1 Z0
For touchpad packet, the format is:
packet-fmt b7 b6 b5 b4 b3 b2 b1 b0
byte 0: TWO & MULTI L 1 R M 1 Y0-2 Y0-1 Y0-0
byte 0: NEW L 1 X1-5 1 1 Y0-2 Y0-1 Y0-0
byte 1: Y0-10 Y0-9 Y0-8 Y0-7 Y0-6 Y0-5 Y0-4 Y0-3
byte 2: X0-11 1 X0-10 X0-9 X0-8 X0-7 X0-6 X0-5
byte 3: X1-11 1 X0-4 X0-3 1 X0-2 X0-1 X0-0
byte 4: TWO X1-10 TWO X1-9 X1-8 X1-7 X1-6 X1-5 X1-4
byte 4: MULTI X1-10 TWO X1-9 X1-8 X1-7 X1-6 Y1-5 1
byte 4: NEW X1-10 TWO X1-9 X1-8 X1-7 X1-6 0 0
byte 5: TWO & NEW Y1-10 0 Y1-9 Y1-8 Y1-7 Y1-6 Y1-5 Y1-4
byte 5: MULTI Y1-10 0 Y1-9 Y1-8 Y1-7 Y1-6 F-1 F-0
L: Left button
R / M: Non-clickpads: Right / Middle button
Clickpads: When > 2 fingers are down, and some fingers
are in the button area, then the 2 coordinates reported
are for fingers outside the button area and these report
extra fingers being present in the right / left button
area. Note these fingers are not added to the F field!
so if a TWO packet is received and R = 1 then there are
3 fingers down, etc.
TWO: 1: Two touches present, byte 0/4/5 are in TWO fmt
0: If byte 4 bit 0 is 1, then byte 0/4/5 are in MULTI fmt
otherwise byte 0 bit 4 must be set and byte 0/4/5 are
in NEW fmt
F: Number of fingers - 3, 0 means 3 fingers, 1 means 4 ...
...@@ -666,7 +666,14 @@ static struct platform_device bfin_sport1_uart_device = { ...@@ -666,7 +666,14 @@ static struct platform_device bfin_sport1_uart_device = {
#endif #endif
#if IS_ENABLED(CONFIG_INPUT_BFIN_ROTARY) #if IS_ENABLED(CONFIG_INPUT_BFIN_ROTARY)
#include <asm/bfin_rotary.h> #include <linux/platform_data/bfin_rotary.h>
static const u16 per_cnt[] = {
P_CNT_CUD,
P_CNT_CDG,
P_CNT_CZM,
0
};
static struct bfin_rotary_platform_data bfin_rotary_data = { static struct bfin_rotary_platform_data bfin_rotary_data = {
/*.rotary_up_key = KEY_UP,*/ /*.rotary_up_key = KEY_UP,*/
...@@ -676,9 +683,15 @@ static struct bfin_rotary_platform_data bfin_rotary_data = { ...@@ -676,9 +683,15 @@ static struct bfin_rotary_platform_data bfin_rotary_data = {
.debounce = 10, /* 0..17 */ .debounce = 10, /* 0..17 */
.mode = ROT_QUAD_ENC | ROT_DEBE, .mode = ROT_QUAD_ENC | ROT_DEBE,
.pm_wakeup = 1, .pm_wakeup = 1,
.pin_list = per_cnt,
}; };
static struct resource bfin_rotary_resources[] = { static struct resource bfin_rotary_resources[] = {
{
.start = CNT_CONFIG,
.end = CNT_CONFIG + 0xff,
.flags = IORESOURCE_MEM,
},
{ {
.start = IRQ_CNT, .start = IRQ_CNT,
.end = IRQ_CNT, .end = IRQ_CNT,
......
...@@ -1092,7 +1092,14 @@ static struct platform_device bfin_device_gpiokeys = { ...@@ -1092,7 +1092,14 @@ static struct platform_device bfin_device_gpiokeys = {
#endif #endif
#if IS_ENABLED(CONFIG_INPUT_BFIN_ROTARY) #if IS_ENABLED(CONFIG_INPUT_BFIN_ROTARY)
#include <asm/bfin_rotary.h> #include <linux/platform_data/bfin_rotary.h>
static const u16 per_cnt[] = {
P_CNT_CUD,
P_CNT_CDG,
P_CNT_CZM,
0
};
static struct bfin_rotary_platform_data bfin_rotary_data = { static struct bfin_rotary_platform_data bfin_rotary_data = {
/*.rotary_up_key = KEY_UP,*/ /*.rotary_up_key = KEY_UP,*/
...@@ -1102,9 +1109,15 @@ static struct bfin_rotary_platform_data bfin_rotary_data = { ...@@ -1102,9 +1109,15 @@ static struct bfin_rotary_platform_data bfin_rotary_data = {
.debounce = 10, /* 0..17 */ .debounce = 10, /* 0..17 */
.mode = ROT_QUAD_ENC | ROT_DEBE, .mode = ROT_QUAD_ENC | ROT_DEBE,
.pm_wakeup = 1, .pm_wakeup = 1,
.pin_list = per_cnt,
}; };
static struct resource bfin_rotary_resources[] = { static struct resource bfin_rotary_resources[] = {
{
.start = CNT_CONFIG,
.end = CNT_CONFIG + 0xff,
.flags = IORESOURCE_MEM,
},
{ {
.start = IRQ_CNT, .start = IRQ_CNT,
.end = IRQ_CNT, .end = IRQ_CNT,
......
...@@ -159,7 +159,7 @@ static struct platform_device bf54x_kpad_device = { ...@@ -159,7 +159,7 @@ static struct platform_device bf54x_kpad_device = {
#endif #endif
#if IS_ENABLED(CONFIG_INPUT_BFIN_ROTARY) #if IS_ENABLED(CONFIG_INPUT_BFIN_ROTARY)
#include <asm/bfin_rotary.h> #include <linux/platform_data/bfin_rotary.h>
static struct bfin_rotary_platform_data bfin_rotary_data = { static struct bfin_rotary_platform_data bfin_rotary_data = {
/*.rotary_up_key = KEY_UP,*/ /*.rotary_up_key = KEY_UP,*/
...@@ -172,6 +172,11 @@ static struct bfin_rotary_platform_data bfin_rotary_data = { ...@@ -172,6 +172,11 @@ static struct bfin_rotary_platform_data bfin_rotary_data = {
}; };
static struct resource bfin_rotary_resources[] = { static struct resource bfin_rotary_resources[] = {
{
.start = CNT_CONFIG,
.end = CNT_CONFIG + 0xff,
.flags = IORESOURCE_MEM,
},
{ {
.start = IRQ_CNT, .start = IRQ_CNT,
.end = IRQ_CNT, .end = IRQ_CNT,
......
...@@ -75,7 +75,7 @@ static struct platform_device bfin_isp1760_device = { ...@@ -75,7 +75,7 @@ static struct platform_device bfin_isp1760_device = {
#endif #endif
#if IS_ENABLED(CONFIG_INPUT_BFIN_ROTARY) #if IS_ENABLED(CONFIG_INPUT_BFIN_ROTARY)
#include <asm/bfin_rotary.h> #include <linux/platform_data/bfin_rotary.h>
static struct bfin_rotary_platform_data bfin_rotary_data = { static struct bfin_rotary_platform_data bfin_rotary_data = {
/*.rotary_up_key = KEY_UP,*/ /*.rotary_up_key = KEY_UP,*/
...@@ -87,6 +87,11 @@ static struct bfin_rotary_platform_data bfin_rotary_data = { ...@@ -87,6 +87,11 @@ static struct bfin_rotary_platform_data bfin_rotary_data = {
}; };
static struct resource bfin_rotary_resources[] = { static struct resource bfin_rotary_resources[] = {
{
.start = CNT_CONFIG,
.end = CNT_CONFIG + 0xff,
.flags = IORESOURCE_MEM,
},
{ {
.start = IRQ_CNT, .start = IRQ_CNT,
.end = IRQ_CNT, .end = IRQ_CNT,
......
...@@ -535,7 +535,6 @@ static int adi_connect(struct gameport *gameport, struct gameport_driver *drv) ...@@ -535,7 +535,6 @@ static int adi_connect(struct gameport *gameport, struct gameport_driver *drv)
} }
} }
fail2: for (i = 0; i < 2; i++) fail2: for (i = 0; i < 2; i++)
if (port->adi[i].dev)
input_free_device(port->adi[i].dev); input_free_device(port->adi[i].dev);
gameport_close(gameport); gameport_close(gameport);
fail1: gameport_set_drvdata(gameport, NULL); fail1: gameport_set_drvdata(gameport, NULL);
......
...@@ -345,13 +345,11 @@ static int pxa27x_keypad_build_keycode(struct pxa27x_keypad *keypad) ...@@ -345,13 +345,11 @@ static int pxa27x_keypad_build_keycode(struct pxa27x_keypad *keypad)
{ {
const struct pxa27x_keypad_platform_data *pdata = keypad->pdata; const struct pxa27x_keypad_platform_data *pdata = keypad->pdata;
struct input_dev *input_dev = keypad->input_dev; struct input_dev *input_dev = keypad->input_dev;
const struct matrix_keymap_data *keymap_data =
pdata ? pdata->matrix_keymap_data : NULL;
unsigned short keycode; unsigned short keycode;
int i; int i;
int error; int error;
error = matrix_keypad_build_keymap(keymap_data, NULL, error = matrix_keypad_build_keymap(pdata->matrix_keymap_data, NULL,
pdata->matrix_key_rows, pdata->matrix_key_rows,
pdata->matrix_key_cols, pdata->matrix_key_cols,
keypad->keycodes, input_dev); keypad->keycodes, input_dev);
......
...@@ -7,29 +7,37 @@ ...@@ -7,29 +7,37 @@
#include <linux/module.h> #include <linux/module.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/io.h>
#include <linux/irq.h> #include <linux/irq.h>
#include <linux/pm.h> #include <linux/pm.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/input.h> #include <linux/input.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/platform_data/bfin_rotary.h>
#include <asm/portmux.h> #include <asm/portmux.h>
#include <asm/bfin_rotary.h>
static const u16 per_cnt[] = { #define CNT_CONFIG_OFF 0 /* CNT Config Offset */
P_CNT_CUD, #define CNT_IMASK_OFF 4 /* CNT Interrupt Mask Offset */
P_CNT_CDG, #define CNT_STATUS_OFF 8 /* CNT Status Offset */
P_CNT_CZM, #define CNT_COMMAND_OFF 12 /* CNT Command Offset */
0 #define CNT_DEBOUNCE_OFF 16 /* CNT Debounce Offset */
}; #define CNT_COUNTER_OFF 20 /* CNT Counter Offset */
#define CNT_MAX_OFF 24 /* CNT Maximum Count Offset */
#define CNT_MIN_OFF 28 /* CNT Minimum Count Offset */
struct bfin_rot { struct bfin_rot {
struct input_dev *input; struct input_dev *input;
void __iomem *base;
int irq; int irq;
unsigned int up_key; unsigned int up_key;
unsigned int down_key; unsigned int down_key;
unsigned int button_key; unsigned int button_key;
unsigned int rel_code; unsigned int rel_code;
unsigned short mode;
unsigned short debounce;
unsigned short cnt_config; unsigned short cnt_config;
unsigned short cnt_imask; unsigned short cnt_imask;
unsigned short cnt_debounce; unsigned short cnt_debounce;
...@@ -59,18 +67,17 @@ static void report_rotary_event(struct bfin_rot *rotary, int delta) ...@@ -59,18 +67,17 @@ static void report_rotary_event(struct bfin_rot *rotary, int delta)
static irqreturn_t bfin_rotary_isr(int irq, void *dev_id) static irqreturn_t bfin_rotary_isr(int irq, void *dev_id)
{ {
struct platform_device *pdev = dev_id; struct bfin_rot *rotary = dev_id;
struct bfin_rot *rotary = platform_get_drvdata(pdev);
int delta; int delta;
switch (bfin_read_CNT_STATUS()) { switch (readw(rotary->base + CNT_STATUS_OFF)) {
case ICII: case ICII:
break; break;
case UCII: case UCII:
case DCII: case DCII:
delta = bfin_read_CNT_COUNTER(); delta = readl(rotary->base + CNT_COUNTER_OFF);
if (delta) if (delta)
report_rotary_event(rotary, delta); report_rotary_event(rotary, delta);
break; break;
...@@ -83,16 +90,52 @@ static irqreturn_t bfin_rotary_isr(int irq, void *dev_id) ...@@ -83,16 +90,52 @@ static irqreturn_t bfin_rotary_isr(int irq, void *dev_id)
break; break;
} }
bfin_write_CNT_COMMAND(W1LCNT_ZERO); /* Clear COUNTER */ writew(W1LCNT_ZERO, rotary->base + CNT_COMMAND_OFF); /* Clear COUNTER */
bfin_write_CNT_STATUS(-1); /* Clear STATUS */ writew(-1, rotary->base + CNT_STATUS_OFF); /* Clear STATUS */
return IRQ_HANDLED; return IRQ_HANDLED;
} }
static int bfin_rotary_open(struct input_dev *input)
{
struct bfin_rot *rotary = input_get_drvdata(input);
unsigned short val;
if (rotary->mode & ROT_DEBE)
writew(rotary->debounce & DPRESCALE,
rotary->base + CNT_DEBOUNCE_OFF);
writew(rotary->mode & ~CNTE, rotary->base + CNT_CONFIG_OFF);
val = UCIE | DCIE;
if (rotary->button_key)
val |= CZMIE;
writew(val, rotary->base + CNT_IMASK_OFF);
writew(rotary->mode | CNTE, rotary->base + CNT_CONFIG_OFF);
return 0;
}
static void bfin_rotary_close(struct input_dev *input)
{
struct bfin_rot *rotary = input_get_drvdata(input);
writew(0, rotary->base + CNT_CONFIG_OFF);
writew(0, rotary->base + CNT_IMASK_OFF);
}
static void bfin_rotary_free_action(void *data)
{
peripheral_free_list(data);
}
static int bfin_rotary_probe(struct platform_device *pdev) static int bfin_rotary_probe(struct platform_device *pdev)
{ {
struct bfin_rotary_platform_data *pdata = dev_get_platdata(&pdev->dev); struct device *dev = &pdev->dev;
const struct bfin_rotary_platform_data *pdata = dev_get_platdata(dev);
struct bfin_rot *rotary; struct bfin_rot *rotary;
struct resource *res;
struct input_dev *input; struct input_dev *input;
int error; int error;
...@@ -102,18 +145,37 @@ static int bfin_rotary_probe(struct platform_device *pdev) ...@@ -102,18 +145,37 @@ static int bfin_rotary_probe(struct platform_device *pdev)
return -EINVAL; return -EINVAL;
} }
error = peripheral_request_list(per_cnt, dev_name(&pdev->dev)); if (pdata->pin_list) {
error = peripheral_request_list(pdata->pin_list,
dev_name(&pdev->dev));
if (error) { if (error) {
dev_err(&pdev->dev, "requesting peripherals failed\n"); dev_err(dev, "requesting peripherals failed: %d\n",
error);
return error; return error;
} }
rotary = kzalloc(sizeof(struct bfin_rot), GFP_KERNEL); error = devm_add_action(dev, bfin_rotary_free_action,
input = input_allocate_device(); pdata->pin_list);
if (!rotary || !input) { if (error) {
error = -ENOMEM; dev_err(dev, "setting cleanup action failed: %d\n",
goto out1; error);
peripheral_free_list(pdata->pin_list);
return error;
} }
}
rotary = devm_kzalloc(dev, sizeof(struct bfin_rot), GFP_KERNEL);
if (!rotary)
return -ENOMEM;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
rotary->base = devm_ioremap_resource(dev, res);
if (IS_ERR(rotary->base))
return PTR_ERR(rotary->base);
input = devm_input_allocate_device(dev);
if (!input)
return -ENOMEM;
rotary->input = input; rotary->input = input;
...@@ -122,9 +184,8 @@ static int bfin_rotary_probe(struct platform_device *pdev) ...@@ -122,9 +184,8 @@ static int bfin_rotary_probe(struct platform_device *pdev)
rotary->button_key = pdata->rotary_button_key; rotary->button_key = pdata->rotary_button_key;
rotary->rel_code = pdata->rotary_rel_code; rotary->rel_code = pdata->rotary_rel_code;
error = rotary->irq = platform_get_irq(pdev, 0); rotary->mode = pdata->mode;
if (error < 0) rotary->debounce = pdata->debounce;
goto out1;
input->name = pdev->name; input->name = pdev->name;
input->phys = "bfin-rotary/input0"; input->phys = "bfin-rotary/input0";
...@@ -137,6 +198,9 @@ static int bfin_rotary_probe(struct platform_device *pdev) ...@@ -137,6 +198,9 @@ static int bfin_rotary_probe(struct platform_device *pdev)
input->id.product = 0x0001; input->id.product = 0x0001;
input->id.version = 0x0100; input->id.version = 0x0100;
input->open = bfin_rotary_open;
input->close = bfin_rotary_close;
if (rotary->up_key) { if (rotary->up_key) {
__set_bit(EV_KEY, input->evbit); __set_bit(EV_KEY, input->evbit);
__set_bit(rotary->up_key, input->keybit); __set_bit(rotary->up_key, input->keybit);
...@@ -151,75 +215,43 @@ static int bfin_rotary_probe(struct platform_device *pdev) ...@@ -151,75 +215,43 @@ static int bfin_rotary_probe(struct platform_device *pdev)
__set_bit(rotary->button_key, input->keybit); __set_bit(rotary->button_key, input->keybit);
} }
error = request_irq(rotary->irq, bfin_rotary_isr, /* Quiesce the device before requesting irq */
0, dev_name(&pdev->dev), pdev); bfin_rotary_close(input);
rotary->irq = platform_get_irq(pdev, 0);
if (rotary->irq < 0) {
dev_err(dev, "No rotary IRQ specified\n");
return -ENOENT;
}
error = devm_request_irq(dev, rotary->irq, bfin_rotary_isr,
0, dev_name(dev), rotary);
if (error) { if (error) {
dev_err(&pdev->dev, dev_err(dev, "unable to claim irq %d; error %d\n",
"unable to claim irq %d; error %d\n",
rotary->irq, error); rotary->irq, error);
goto out1; return error;
} }
error = input_register_device(input); error = input_register_device(input);
if (error) { if (error) {
dev_err(&pdev->dev, dev_err(dev, "unable to register input device (%d)\n", error);
"unable to register input device (%d)\n", error); return error;
goto out2;
} }
if (pdata->rotary_button_key)
bfin_write_CNT_IMASK(CZMIE);
if (pdata->mode & ROT_DEBE)
bfin_write_CNT_DEBOUNCE(pdata->debounce & DPRESCALE);
if (pdata->mode)
bfin_write_CNT_CONFIG(bfin_read_CNT_CONFIG() |
(pdata->mode & ~CNTE));
bfin_write_CNT_IMASK(bfin_read_CNT_IMASK() | UCIE | DCIE);
bfin_write_CNT_CONFIG(bfin_read_CNT_CONFIG() | CNTE);
platform_set_drvdata(pdev, rotary); platform_set_drvdata(pdev, rotary);
device_init_wakeup(&pdev->dev, 1); device_init_wakeup(&pdev->dev, 1);
return 0;
out2:
free_irq(rotary->irq, pdev);
out1:
input_free_device(input);
kfree(rotary);
peripheral_free_list(per_cnt);
return error;
}
static int bfin_rotary_remove(struct platform_device *pdev)
{
struct bfin_rot *rotary = platform_get_drvdata(pdev);
bfin_write_CNT_CONFIG(0);
bfin_write_CNT_IMASK(0);
free_irq(rotary->irq, pdev);
input_unregister_device(rotary->input);
peripheral_free_list(per_cnt);
kfree(rotary);
return 0; return 0;
} }
#ifdef CONFIG_PM static int __maybe_unused bfin_rotary_suspend(struct device *dev)
static int bfin_rotary_suspend(struct device *dev)
{ {
struct platform_device *pdev = to_platform_device(dev); struct platform_device *pdev = to_platform_device(dev);
struct bfin_rot *rotary = platform_get_drvdata(pdev); struct bfin_rot *rotary = platform_get_drvdata(pdev);
rotary->cnt_config = bfin_read_CNT_CONFIG(); rotary->cnt_config = readw(rotary->base + CNT_CONFIG_OFF);
rotary->cnt_imask = bfin_read_CNT_IMASK(); rotary->cnt_imask = readw(rotary->base + CNT_IMASK_OFF);
rotary->cnt_debounce = bfin_read_CNT_DEBOUNCE(); rotary->cnt_debounce = readw(rotary->base + CNT_DEBOUNCE_OFF);
if (device_may_wakeup(&pdev->dev)) if (device_may_wakeup(&pdev->dev))
enable_irq_wake(rotary->irq); enable_irq_wake(rotary->irq);
...@@ -227,38 +259,32 @@ static int bfin_rotary_suspend(struct device *dev) ...@@ -227,38 +259,32 @@ static int bfin_rotary_suspend(struct device *dev)
return 0; return 0;
} }
static int bfin_rotary_resume(struct device *dev) static int __maybe_unused bfin_rotary_resume(struct device *dev)
{ {
struct platform_device *pdev = to_platform_device(dev); struct platform_device *pdev = to_platform_device(dev);
struct bfin_rot *rotary = platform_get_drvdata(pdev); struct bfin_rot *rotary = platform_get_drvdata(pdev);
bfin_write_CNT_DEBOUNCE(rotary->cnt_debounce); writew(rotary->cnt_debounce, rotary->base + CNT_DEBOUNCE_OFF);
bfin_write_CNT_IMASK(rotary->cnt_imask); writew(rotary->cnt_imask, rotary->base + CNT_IMASK_OFF);
bfin_write_CNT_CONFIG(rotary->cnt_config & ~CNTE); writew(rotary->cnt_config & ~CNTE, rotary->base + CNT_CONFIG_OFF);
if (device_may_wakeup(&pdev->dev)) if (device_may_wakeup(&pdev->dev))
disable_irq_wake(rotary->irq); disable_irq_wake(rotary->irq);
if (rotary->cnt_config & CNTE) if (rotary->cnt_config & CNTE)
bfin_write_CNT_CONFIG(rotary->cnt_config); writew(rotary->cnt_config, rotary->base + CNT_CONFIG_OFF);
return 0; return 0;
} }
static const struct dev_pm_ops bfin_rotary_pm_ops = { static SIMPLE_DEV_PM_OPS(bfin_rotary_pm_ops,
.suspend = bfin_rotary_suspend, bfin_rotary_suspend, bfin_rotary_resume);
.resume = bfin_rotary_resume,
};
#endif
static struct platform_driver bfin_rotary_device_driver = { static struct platform_driver bfin_rotary_device_driver = {
.probe = bfin_rotary_probe, .probe = bfin_rotary_probe,
.remove = bfin_rotary_remove,
.driver = { .driver = {
.name = "bfin-rotary", .name = "bfin-rotary",
#ifdef CONFIG_PM
.pm = &bfin_rotary_pm_ops, .pm = &bfin_rotary_pm_ops,
#endif
}, },
}; };
module_platform_driver(bfin_rotary_device_driver); module_platform_driver(bfin_rotary_device_driver);
......
...@@ -195,7 +195,7 @@ static int soc_button_probe(struct platform_device *pdev) ...@@ -195,7 +195,7 @@ static int soc_button_probe(struct platform_device *pdev)
static struct soc_button_info soc_button_PNP0C40[] = { static struct soc_button_info soc_button_PNP0C40[] = {
{ "power", 0, EV_KEY, KEY_POWER, false, true }, { "power", 0, EV_KEY, KEY_POWER, false, true },
{ "home", 1, EV_KEY, KEY_HOME, false, true }, { "home", 1, EV_KEY, KEY_LEFTMETA, false, true },
{ "volume_up", 2, EV_KEY, KEY_VOLUMEUP, true, false }, { "volume_up", 2, EV_KEY, KEY_VOLUMEUP, true, false },
{ "volume_down", 3, EV_KEY, KEY_VOLUMEDOWN, true, false }, { "volume_down", 3, EV_KEY, KEY_VOLUMEDOWN, true, false },
{ "rotation_lock", 4, EV_SW, SW_ROTATE_LOCK, false, false }, { "rotation_lock", 4, EV_SW, SW_ROTATE_LOCK, false, false },
......
This diff is collapsed.
...@@ -14,13 +14,14 @@ ...@@ -14,13 +14,14 @@
#include <linux/input/mt.h> #include <linux/input/mt.h>
#define ALPS_PROTO_V1 1 #define ALPS_PROTO_V1 0x100
#define ALPS_PROTO_V2 2 #define ALPS_PROTO_V2 0x200
#define ALPS_PROTO_V3 3 #define ALPS_PROTO_V3 0x300
#define ALPS_PROTO_V4 4 #define ALPS_PROTO_V3_RUSHMORE 0x310
#define ALPS_PROTO_V5 5 #define ALPS_PROTO_V4 0x400
#define ALPS_PROTO_V6 6 #define ALPS_PROTO_V5 0x500
#define ALPS_PROTO_V7 7 /* t3btl t4s */ #define ALPS_PROTO_V6 0x600
#define ALPS_PROTO_V7 0x700 /* t3btl t4s */
#define MAX_TOUCHES 2 #define MAX_TOUCHES 2
...@@ -45,6 +46,21 @@ enum V7_PACKET_ID { ...@@ -45,6 +46,21 @@ enum V7_PACKET_ID {
V7_PACKET_ID_UNKNOWN, V7_PACKET_ID_UNKNOWN,
}; };
/**
* struct alps_protocol_info - information about protocol used by a device
* @version: Indicates V1/V2/V3/...
* @byte0: Helps figure out whether a position report packet matches the
* known format for this model. The first byte of the report, ANDed with
* mask0, should match byte0.
* @mask0: The mask used to check the first byte of the report.
* @flags: Additional device capabilities (passthrough port, trackstick, etc.).
*/
struct alps_protocol_info {
u16 version;
u8 byte0, mask0;
unsigned int flags;
};
/** /**
* struct alps_model_info - touchpad ID table * struct alps_model_info - touchpad ID table
* @signature: E7 response string to match. * @signature: E7 response string to match.
...@@ -52,23 +68,16 @@ enum V7_PACKET_ID { ...@@ -52,23 +68,16 @@ enum V7_PACKET_ID {
* (aka command mode response) identifies the firmware minor version. This * (aka command mode response) identifies the firmware minor version. This
* can be used to distinguish different hardware models which are not * can be used to distinguish different hardware models which are not
* uniquely identifiable through their E7 responses. * uniquely identifiable through their E7 responses.
* @proto_version: Indicates V1/V2/V3/... * @protocol_info: information about protcol used by the device.
* @byte0: Helps figure out whether a position report packet matches the
* known format for this model. The first byte of the report, ANDed with
* mask0, should match byte0.
* @mask0: The mask used to check the first byte of the report.
* @flags: Additional device capabilities (passthrough port, trackstick, etc.).
* *
* Many (but not all) ALPS touchpads can be identified by looking at the * Many (but not all) ALPS touchpads can be identified by looking at the
* values returned in the "E7 report" and/or the "EC report." This table * values returned in the "E7 report" and/or the "EC report." This table
* lists a number of such touchpads. * lists a number of such touchpads.
*/ */
struct alps_model_info { struct alps_model_info {
unsigned char signature[3]; u8 signature[3];
unsigned char command_mode_resp; u8 command_mode_resp;
unsigned char proto_version; struct alps_protocol_info protocol_info;
unsigned char byte0, mask0;
int flags;
}; };
/** /**
...@@ -132,8 +141,12 @@ struct alps_fields { ...@@ -132,8 +141,12 @@ struct alps_fields {
/** /**
* struct alps_data - private data structure for the ALPS driver * struct alps_data - private data structure for the ALPS driver
* @dev2: "Relative" device used to report trackstick or mouse activity. * @psmouse: Pointer to parent psmouse device
* @phys: Physical path for the relative device. * @dev2: Trackstick device (can be NULL).
* @dev3: Generic PS/2 mouse (can be NULL, delayed registering).
* @phys2: Physical path for the trackstick device.
* @phys3: Physical path for the generic PS/2 mouse.
* @dev3_register_work: Delayed work for registering PS/2 mouse.
* @nibble_commands: Command mapping used for touchpad register accesses. * @nibble_commands: Command mapping used for touchpad register accesses.
* @addr_command: Command used to tell the touchpad that a register address * @addr_command: Command used to tell the touchpad that a register address
* follows. * follows.
...@@ -160,15 +173,19 @@ struct alps_fields { ...@@ -160,15 +173,19 @@ struct alps_fields {
* @timer: Timer for flushing out the final report packet in the stream. * @timer: Timer for flushing out the final report packet in the stream.
*/ */
struct alps_data { struct alps_data {
struct psmouse *psmouse;
struct input_dev *dev2; struct input_dev *dev2;
char phys[32]; struct input_dev *dev3;
char phys2[32];
char phys3[32];
struct delayed_work dev3_register_work;
/* these are autodetected when the device is identified */ /* these are autodetected when the device is identified */
const struct alps_nibble_commands *nibble_commands; const struct alps_nibble_commands *nibble_commands;
int addr_command; int addr_command;
unsigned char proto_version; u16 proto_version;
unsigned char byte0, mask0; u8 byte0, mask0;
unsigned char fw_ver[3]; u8 fw_ver[3];
int flags; int flags;
int x_max; int x_max;
int y_max; int y_max;
......
...@@ -710,8 +710,3 @@ int cypress_init(struct psmouse *psmouse) ...@@ -710,8 +710,3 @@ int cypress_init(struct psmouse *psmouse)
return -1; return -1;
} }
bool cypress_supported(void)
{
return true;
}
...@@ -172,7 +172,6 @@ struct cytp_data { ...@@ -172,7 +172,6 @@ struct cytp_data {
#ifdef CONFIG_MOUSE_PS2_CYPRESS #ifdef CONFIG_MOUSE_PS2_CYPRESS
int cypress_detect(struct psmouse *psmouse, bool set_properties); int cypress_detect(struct psmouse *psmouse, bool set_properties);
int cypress_init(struct psmouse *psmouse); int cypress_init(struct psmouse *psmouse);
bool cypress_supported(void);
#else #else
inline int cypress_detect(struct psmouse *psmouse, bool set_properties) inline int cypress_detect(struct psmouse *psmouse, bool set_properties)
{ {
...@@ -182,10 +181,6 @@ inline int cypress_init(struct psmouse *psmouse) ...@@ -182,10 +181,6 @@ inline int cypress_init(struct psmouse *psmouse)
{ {
return -ENOSYS; return -ENOSYS;
} }
inline bool cypress_supported(void)
{
return 0;
}
#endif /* CONFIG_MOUSE_PS2_CYPRESS */ #endif /* CONFIG_MOUSE_PS2_CYPRESS */
#endif /* _CYPRESS_PS2_H */ #endif /* _CYPRESS_PS2_H */
...@@ -424,11 +424,6 @@ int focaltech_init(struct psmouse *psmouse) ...@@ -424,11 +424,6 @@ int focaltech_init(struct psmouse *psmouse)
return error; return error;
} }
bool focaltech_supported(void)
{
return true;
}
#else /* CONFIG_MOUSE_PS2_FOCALTECH */ #else /* CONFIG_MOUSE_PS2_FOCALTECH */
int focaltech_init(struct psmouse *psmouse) int focaltech_init(struct psmouse *psmouse)
...@@ -438,9 +433,4 @@ int focaltech_init(struct psmouse *psmouse) ...@@ -438,9 +433,4 @@ int focaltech_init(struct psmouse *psmouse)
return 0; return 0;
} }
bool focaltech_supported(void)
{
return false;
}
#endif /* CONFIG_MOUSE_PS2_FOCALTECH */ #endif /* CONFIG_MOUSE_PS2_FOCALTECH */
...@@ -19,6 +19,5 @@ ...@@ -19,6 +19,5 @@
int focaltech_detect(struct psmouse *psmouse, bool set_properties); int focaltech_detect(struct psmouse *psmouse, bool set_properties);
int focaltech_init(struct psmouse *psmouse); int focaltech_init(struct psmouse *psmouse);
bool focaltech_supported(void);
#endif #endif
...@@ -727,7 +727,7 @@ static int psmouse_extensions(struct psmouse *psmouse, ...@@ -727,7 +727,7 @@ static int psmouse_extensions(struct psmouse *psmouse,
if (psmouse_do_detect(focaltech_detect, psmouse, set_properties) == 0) { if (psmouse_do_detect(focaltech_detect, psmouse, set_properties) == 0) {
if (max_proto > PSMOUSE_IMEX) { if (max_proto > PSMOUSE_IMEX) {
if (!set_properties || focaltech_init(psmouse) == 0) { if (!set_properties || focaltech_init(psmouse) == 0) {
if (focaltech_supported()) if (IS_ENABLED(CONFIG_MOUSE_PS2_FOCALTECH))
return PSMOUSE_FOCALTECH; return PSMOUSE_FOCALTECH;
/* /*
* Note that we need to also restrict * Note that we need to also restrict
...@@ -776,7 +776,7 @@ static int psmouse_extensions(struct psmouse *psmouse, ...@@ -776,7 +776,7 @@ static int psmouse_extensions(struct psmouse *psmouse,
* Try activating protocol, but check if support is enabled first, since * Try activating protocol, but check if support is enabled first, since
* we try detecting Synaptics even when protocol is disabled. * we try detecting Synaptics even when protocol is disabled.
*/ */
if (synaptics_supported() && if (IS_ENABLED(CONFIG_MOUSE_PS2_SYNAPTICS) &&
(!set_properties || synaptics_init(psmouse) == 0)) { (!set_properties || synaptics_init(psmouse) == 0)) {
return PSMOUSE_SYNAPTICS; return PSMOUSE_SYNAPTICS;
} }
...@@ -801,7 +801,7 @@ static int psmouse_extensions(struct psmouse *psmouse, ...@@ -801,7 +801,7 @@ static int psmouse_extensions(struct psmouse *psmouse,
*/ */
if (max_proto > PSMOUSE_IMEX && if (max_proto > PSMOUSE_IMEX &&
cypress_detect(psmouse, set_properties) == 0) { cypress_detect(psmouse, set_properties) == 0) {
if (cypress_supported()) { if (IS_ENABLED(CONFIG_MOUSE_PS2_CYPRESS)) {
if (cypress_init(psmouse) == 0) if (cypress_init(psmouse) == 0)
return PSMOUSE_CYPRESS; return PSMOUSE_CYPRESS;
......
...@@ -1454,11 +1454,6 @@ int synaptics_init_relative(struct psmouse *psmouse) ...@@ -1454,11 +1454,6 @@ int synaptics_init_relative(struct psmouse *psmouse)
return __synaptics_init(psmouse, false); return __synaptics_init(psmouse, false);
} }
bool synaptics_supported(void)
{
return true;
}
#else /* CONFIG_MOUSE_PS2_SYNAPTICS */ #else /* CONFIG_MOUSE_PS2_SYNAPTICS */
void __init synaptics_module_init(void) void __init synaptics_module_init(void)
...@@ -1470,9 +1465,4 @@ int synaptics_init(struct psmouse *psmouse) ...@@ -1470,9 +1465,4 @@ int synaptics_init(struct psmouse *psmouse)
return -ENOSYS; return -ENOSYS;
} }
bool synaptics_supported(void)
{
return false;
}
#endif /* CONFIG_MOUSE_PS2_SYNAPTICS */ #endif /* CONFIG_MOUSE_PS2_SYNAPTICS */
...@@ -175,6 +175,5 @@ int synaptics_detect(struct psmouse *psmouse, bool set_properties); ...@@ -175,6 +175,5 @@ int synaptics_detect(struct psmouse *psmouse, bool set_properties);
int synaptics_init(struct psmouse *psmouse); int synaptics_init(struct psmouse *psmouse);
int synaptics_init_relative(struct psmouse *psmouse); int synaptics_init_relative(struct psmouse *psmouse);
void synaptics_reset(struct psmouse *psmouse); void synaptics_reset(struct psmouse *psmouse);
bool synaptics_supported(void);
#endif /* _SYNAPTICS_H */ #endif /* _SYNAPTICS_H */
...@@ -40,6 +40,7 @@ struct bfin_rotary_platform_data { ...@@ -40,6 +40,7 @@ struct bfin_rotary_platform_data {
unsigned short debounce; /* 0..17 */ unsigned short debounce; /* 0..17 */
unsigned short mode; unsigned short mode;
unsigned short pm_wakeup; unsigned short pm_wakeup;
unsigned short *pin_list;
}; };
/* CNT_CONFIG bitmasks */ /* CNT_CONFIG bitmasks */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment