Commit 026f8f61 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 input updates from Dmitry Torokhov:
 "A bit later than I would want, but the changes are very minor - a few
  new device IDs for new hardware in existing drivers, fix for battery
  in Wacom devices not be considered system battery and cause emergency
  hibernations, and a couple of other bug fixes"

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input:
  Input: ALPS - add support for model found on Dell XT2
  Input: wacom - add support for ISDv4 0x10E sensor
  Input: wacom - add support for ISDv4 0x10F sensor
  Input: wacom - export battery scope
  Input: cm109 - convert high volume dev_err() to dev_err_ratelimited()
  Input: move name/timer init to input_alloc_dev()
  Input: i8042 - i8042_flush fix for a full 8042 buffer
  Input: pxa27x_keypad - fix NULL pointer dereference
parents e7647027 5beea882
...@@ -1734,6 +1734,7 @@ EXPORT_SYMBOL_GPL(input_class); ...@@ -1734,6 +1734,7 @@ EXPORT_SYMBOL_GPL(input_class);
*/ */
struct input_dev *input_allocate_device(void) struct input_dev *input_allocate_device(void)
{ {
static atomic_t input_no = ATOMIC_INIT(0);
struct input_dev *dev; struct input_dev *dev;
dev = kzalloc(sizeof(struct input_dev), GFP_KERNEL); dev = kzalloc(sizeof(struct input_dev), GFP_KERNEL);
...@@ -1743,9 +1744,13 @@ struct input_dev *input_allocate_device(void) ...@@ -1743,9 +1744,13 @@ struct input_dev *input_allocate_device(void)
device_initialize(&dev->dev); device_initialize(&dev->dev);
mutex_init(&dev->mutex); mutex_init(&dev->mutex);
spin_lock_init(&dev->event_lock); spin_lock_init(&dev->event_lock);
init_timer(&dev->timer);
INIT_LIST_HEAD(&dev->h_list); INIT_LIST_HEAD(&dev->h_list);
INIT_LIST_HEAD(&dev->node); INIT_LIST_HEAD(&dev->node);
dev_set_name(&dev->dev, "input%ld",
(unsigned long) atomic_inc_return(&input_no) - 1);
__module_get(THIS_MODULE); __module_get(THIS_MODULE);
} }
...@@ -2019,7 +2024,6 @@ static void devm_input_device_unregister(struct device *dev, void *res) ...@@ -2019,7 +2024,6 @@ static void devm_input_device_unregister(struct device *dev, void *res)
*/ */
int input_register_device(struct input_dev *dev) int input_register_device(struct input_dev *dev)
{ {
static atomic_t input_no = ATOMIC_INIT(0);
struct input_devres *devres = NULL; struct input_devres *devres = NULL;
struct input_handler *handler; struct input_handler *handler;
unsigned int packet_size; unsigned int packet_size;
...@@ -2059,7 +2063,6 @@ int input_register_device(struct input_dev *dev) ...@@ -2059,7 +2063,6 @@ int input_register_device(struct input_dev *dev)
* If delay and period are pre-set by the driver, then autorepeating * If delay and period are pre-set by the driver, then autorepeating
* is handled by the driver itself and we don't do it in input.c. * is handled by the driver itself and we don't do it in input.c.
*/ */
init_timer(&dev->timer);
if (!dev->rep[REP_DELAY] && !dev->rep[REP_PERIOD]) { if (!dev->rep[REP_DELAY] && !dev->rep[REP_PERIOD]) {
dev->timer.data = (long) dev; dev->timer.data = (long) dev;
dev->timer.function = input_repeat_key; dev->timer.function = input_repeat_key;
...@@ -2073,9 +2076,6 @@ int input_register_device(struct input_dev *dev) ...@@ -2073,9 +2076,6 @@ int input_register_device(struct input_dev *dev)
if (!dev->setkeycode) if (!dev->setkeycode)
dev->setkeycode = input_default_setkeycode; dev->setkeycode = input_default_setkeycode;
dev_set_name(&dev->dev, "input%ld",
(unsigned long) atomic_inc_return(&input_no) - 1);
error = device_add(&dev->dev); error = device_add(&dev->dev);
if (error) if (error)
goto err_free_vals; goto err_free_vals;
......
...@@ -786,10 +786,17 @@ static int pxa27x_keypad_probe(struct platform_device *pdev) ...@@ -786,10 +786,17 @@ static int pxa27x_keypad_probe(struct platform_device *pdev)
input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REP); input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REP);
input_set_capability(input_dev, EV_MSC, MSC_SCAN); input_set_capability(input_dev, EV_MSC, MSC_SCAN);
if (pdata) if (pdata) {
error = pxa27x_keypad_build_keycode(keypad); error = pxa27x_keypad_build_keycode(keypad);
else } else {
error = pxa27x_keypad_build_keycode_from_dt(keypad); error = pxa27x_keypad_build_keycode_from_dt(keypad);
/*
* Data that we get from DT resides in dynamically
* allocated memory so we need to update our pdata
* pointer.
*/
pdata = keypad->pdata;
}
if (error) { if (error) {
dev_err(&pdev->dev, "failed to build keycode\n"); dev_err(&pdev->dev, "failed to build keycode\n");
goto failed_put_clk; goto failed_put_clk;
......
...@@ -351,7 +351,9 @@ static void cm109_urb_irq_callback(struct urb *urb) ...@@ -351,7 +351,9 @@ static void cm109_urb_irq_callback(struct urb *urb)
if (status) { if (status) {
if (status == -ESHUTDOWN) if (status == -ESHUTDOWN)
return; return;
dev_err(&dev->intf->dev, "%s: urb status %d\n", __func__, status); dev_err_ratelimited(&dev->intf->dev, "%s: urb status %d\n",
__func__, status);
goto out;
} }
/* Special keys */ /* Special keys */
...@@ -418,8 +420,12 @@ static void cm109_urb_ctl_callback(struct urb *urb) ...@@ -418,8 +420,12 @@ static void cm109_urb_ctl_callback(struct urb *urb)
dev->ctl_data->byte[2], dev->ctl_data->byte[2],
dev->ctl_data->byte[3]); dev->ctl_data->byte[3]);
if (status) if (status) {
dev_err(&dev->intf->dev, "%s: urb status %d\n", __func__, status); if (status == -ESHUTDOWN)
return;
dev_err_ratelimited(&dev->intf->dev, "%s: urb status %d\n",
__func__, status);
}
spin_lock(&dev->ctl_submit_lock); spin_lock(&dev->ctl_submit_lock);
...@@ -427,7 +433,7 @@ static void cm109_urb_ctl_callback(struct urb *urb) ...@@ -427,7 +433,7 @@ static void cm109_urb_ctl_callback(struct urb *urb)
if (likely(!dev->shutdown)) { if (likely(!dev->shutdown)) {
if (dev->buzzer_pending) { if (dev->buzzer_pending || status) {
dev->buzzer_pending = 0; dev->buzzer_pending = 0;
dev->ctl_urb_pending = 1; dev->ctl_urb_pending = 1;
cm109_submit_buzz_toggle(dev); cm109_submit_buzz_toggle(dev);
......
...@@ -103,6 +103,7 @@ static const struct alps_model_info alps_model_data[] = { ...@@ -103,6 +103,7 @@ static const struct alps_model_info alps_model_data[] = {
/* Dell Latitude E5500, E6400, E6500, Precision M4400 */ /* Dell Latitude E5500, E6400, E6500, Precision M4400 */
{ { 0x62, 0x02, 0x14 }, 0x00, ALPS_PROTO_V2, 0xcf, 0xcf, { { 0x62, 0x02, 0x14 }, 0x00, ALPS_PROTO_V2, 0xcf, 0xcf,
ALPS_PASS | ALPS_DUALPOINT | ALPS_PS2_INTERLEAVED }, ALPS_PASS | ALPS_DUALPOINT | ALPS_PS2_INTERLEAVED },
{ { 0x73, 0x00, 0x14 }, 0x00, ALPS_PROTO_V2, 0xcf, 0xcf, ALPS_DUALPOINT }, /* Dell XT2 */
{ { 0x73, 0x02, 0x50 }, 0x00, ALPS_PROTO_V2, 0xcf, 0xcf, ALPS_FOUR_BUTTONS }, /* Dell Vostro 1400 */ { { 0x73, 0x02, 0x50 }, 0x00, ALPS_PROTO_V2, 0xcf, 0xcf, ALPS_FOUR_BUTTONS }, /* Dell Vostro 1400 */
{ { 0x52, 0x01, 0x14 }, 0x00, ALPS_PROTO_V2, 0xff, 0xff, { { 0x52, 0x01, 0x14 }, 0x00, ALPS_PROTO_V2, 0xff, 0xff,
ALPS_PASS | ALPS_DUALPOINT | ALPS_PS2_INTERLEAVED }, /* Toshiba Tecra A11-11L */ ALPS_PASS | ALPS_DUALPOINT | ALPS_PS2_INTERLEAVED }, /* Toshiba Tecra A11-11L */
......
...@@ -223,21 +223,26 @@ static int i8042_flush(void) ...@@ -223,21 +223,26 @@ static int i8042_flush(void)
{ {
unsigned long flags; unsigned long flags;
unsigned char data, str; unsigned char data, str;
int i = 0; int count = 0;
int retval = 0;
spin_lock_irqsave(&i8042_lock, flags); spin_lock_irqsave(&i8042_lock, flags);
while (((str = i8042_read_status()) & I8042_STR_OBF) && (i < I8042_BUFFER_SIZE)) { while ((str = i8042_read_status()) & I8042_STR_OBF) {
if (count++ < I8042_BUFFER_SIZE) {
udelay(50); udelay(50);
data = i8042_read_data(); data = i8042_read_data();
i++;
dbg("%02x <- i8042 (flush, %s)\n", dbg("%02x <- i8042 (flush, %s)\n",
data, str & I8042_STR_AUXDATA ? "aux" : "kbd"); data, str & I8042_STR_AUXDATA ? "aux" : "kbd");
} else {
retval = -EIO;
break;
}
} }
spin_unlock_irqrestore(&i8042_lock, flags); spin_unlock_irqrestore(&i8042_lock, flags);
return i; return retval;
} }
/* /*
...@@ -849,7 +854,7 @@ static int __init i8042_check_aux(void) ...@@ -849,7 +854,7 @@ static int __init i8042_check_aux(void)
static int i8042_controller_check(void) static int i8042_controller_check(void)
{ {
if (i8042_flush() == I8042_BUFFER_SIZE) { if (i8042_flush()) {
pr_err("No controller found\n"); pr_err("No controller found\n");
return -ENODEV; return -ENODEV;
} }
......
...@@ -1031,6 +1031,7 @@ static void wacom_destroy_leds(struct wacom *wacom) ...@@ -1031,6 +1031,7 @@ static void wacom_destroy_leds(struct wacom *wacom)
} }
static enum power_supply_property wacom_battery_props[] = { static enum power_supply_property wacom_battery_props[] = {
POWER_SUPPLY_PROP_SCOPE,
POWER_SUPPLY_PROP_CAPACITY POWER_SUPPLY_PROP_CAPACITY
}; };
...@@ -1042,6 +1043,9 @@ static int wacom_battery_get_property(struct power_supply *psy, ...@@ -1042,6 +1043,9 @@ static int wacom_battery_get_property(struct power_supply *psy,
int ret = 0; int ret = 0;
switch (psp) { switch (psp) {
case POWER_SUPPLY_PROP_SCOPE:
val->intval = POWER_SUPPLY_SCOPE_DEVICE;
break;
case POWER_SUPPLY_PROP_CAPACITY: case POWER_SUPPLY_PROP_CAPACITY:
val->intval = val->intval =
wacom->wacom_wac.battery_capacity * 100 / 31; wacom->wacom_wac.battery_capacity * 100 / 31;
......
...@@ -2054,6 +2054,12 @@ static const struct wacom_features wacom_features_0x101 = ...@@ -2054,6 +2054,12 @@ static const struct wacom_features wacom_features_0x101 =
static const struct wacom_features wacom_features_0x10D = static const struct wacom_features wacom_features_0x10D =
{ "Wacom ISDv4 10D", WACOM_PKGLEN_MTTPC, 26202, 16325, 255, { "Wacom ISDv4 10D", WACOM_PKGLEN_MTTPC, 26202, 16325, 255,
0, MTTPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; 0, MTTPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
static const struct wacom_features wacom_features_0x10E =
{ "Wacom ISDv4 10E", WACOM_PKGLEN_MTTPC, 27760, 15694, 255,
0, MTTPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
static const struct wacom_features wacom_features_0x10F =
{ "Wacom ISDv4 10F", WACOM_PKGLEN_MTTPC, 27760, 15694, 255,
0, MTTPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
static const struct wacom_features wacom_features_0x4001 = static const struct wacom_features wacom_features_0x4001 =
{ "Wacom ISDv4 4001", WACOM_PKGLEN_MTTPC, 26202, 16325, 255, { "Wacom ISDv4 4001", WACOM_PKGLEN_MTTPC, 26202, 16325, 255,
0, MTTPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; 0, MTTPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
...@@ -2248,6 +2254,8 @@ const struct usb_device_id wacom_ids[] = { ...@@ -2248,6 +2254,8 @@ const struct usb_device_id wacom_ids[] = {
{ USB_DEVICE_WACOM(0x100) }, { USB_DEVICE_WACOM(0x100) },
{ USB_DEVICE_WACOM(0x101) }, { USB_DEVICE_WACOM(0x101) },
{ USB_DEVICE_WACOM(0x10D) }, { USB_DEVICE_WACOM(0x10D) },
{ USB_DEVICE_WACOM(0x10E) },
{ USB_DEVICE_WACOM(0x10F) },
{ USB_DEVICE_WACOM(0x300) }, { USB_DEVICE_WACOM(0x300) },
{ USB_DEVICE_WACOM(0x301) }, { USB_DEVICE_WACOM(0x301) },
{ USB_DEVICE_WACOM(0x304) }, { USB_DEVICE_WACOM(0x304) },
......
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