Commit 4e58fb73 authored by Linus Torvalds's avatar Linus Torvalds

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

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input:
  Input: iforce - wait for command completion when closing the device
  Input: twl4030-pwrbutton - switch to using threaded IRQ
  Input: twl4030_keypad - switch to using threaded IRQ
  Input: lifebook - add CONFIG_DMI dependency
  Input: wistron - fix test for CONFIG_PM
  Input: psmouse - fix compile warning in hgpk module
  Input: matrix-keypad - handle cases when GPIOs can't be wakeup sources
  Input: iforce - fix oops on device disconnect
  Input: ff-memless - add notion of direction to for rumble effects
  Input: ff-memless - another fix for signed to unsigned overflow
  Input: ff-memless - start playing FF effects immediately
  Input: serio - do not mark kseriod freezable anymore
  Input: speed up suspend/shutdown for PS/2 mice and keyboards
parents 08d869aa c2b27ef6
...@@ -220,12 +220,28 @@ static int get_compatible_type(struct ff_device *ff, int effect_type) ...@@ -220,12 +220,28 @@ static int get_compatible_type(struct ff_device *ff, int effect_type)
return 0; return 0;
} }
/*
* Only left/right direction should be used (under/over 0x8000) for
* forward/reverse motor direction (to keep calculation fast & simple).
*/
static u16 ml_calculate_direction(u16 direction, u16 force,
u16 new_direction, u16 new_force)
{
if (!force)
return new_direction;
if (!new_force)
return direction;
return (((u32)(direction >> 1) * force +
(new_direction >> 1) * new_force) /
(force + new_force)) << 1;
}
/* /*
* Combine two effects and apply gain. * Combine two effects and apply gain.
*/ */
static void ml_combine_effects(struct ff_effect *effect, static void ml_combine_effects(struct ff_effect *effect,
struct ml_effect_state *state, struct ml_effect_state *state,
unsigned int gain) int gain)
{ {
struct ff_effect *new = state->effect; struct ff_effect *new = state->effect;
unsigned int strong, weak, i; unsigned int strong, weak, i;
...@@ -252,8 +268,21 @@ static void ml_combine_effects(struct ff_effect *effect, ...@@ -252,8 +268,21 @@ static void ml_combine_effects(struct ff_effect *effect,
break; break;
case FF_RUMBLE: case FF_RUMBLE:
strong = new->u.rumble.strong_magnitude * gain / 0xffff; strong = (u32)new->u.rumble.strong_magnitude * gain / 0xffff;
weak = new->u.rumble.weak_magnitude * gain / 0xffff; weak = (u32)new->u.rumble.weak_magnitude * gain / 0xffff;
if (effect->u.rumble.strong_magnitude + strong)
effect->direction = ml_calculate_direction(
effect->direction,
effect->u.rumble.strong_magnitude,
new->direction, strong);
else if (effect->u.rumble.weak_magnitude + weak)
effect->direction = ml_calculate_direction(
effect->direction,
effect->u.rumble.weak_magnitude,
new->direction, weak);
else
effect->direction = 0;
effect->u.rumble.strong_magnitude = effect->u.rumble.strong_magnitude =
min(strong + effect->u.rumble.strong_magnitude, min(strong + effect->u.rumble.strong_magnitude,
0xffffU); 0xffffU);
...@@ -268,6 +297,13 @@ static void ml_combine_effects(struct ff_effect *effect, ...@@ -268,6 +297,13 @@ static void ml_combine_effects(struct ff_effect *effect,
/* here we also scale it 0x7fff => 0xffff */ /* here we also scale it 0x7fff => 0xffff */
i = i * gain / 0x7fff; i = i * gain / 0x7fff;
if (effect->u.rumble.strong_magnitude + i)
effect->direction = ml_calculate_direction(
effect->direction,
effect->u.rumble.strong_magnitude,
new->direction, i);
else
effect->direction = 0;
effect->u.rumble.strong_magnitude = effect->u.rumble.strong_magnitude =
min(i + effect->u.rumble.strong_magnitude, 0xffffU); min(i + effect->u.rumble.strong_magnitude, 0xffffU);
effect->u.rumble.weak_magnitude = effect->u.rumble.weak_magnitude =
...@@ -411,8 +447,6 @@ static int ml_ff_playback(struct input_dev *dev, int effect_id, int value) ...@@ -411,8 +447,6 @@ static int ml_ff_playback(struct input_dev *dev, int effect_id, int value)
msecs_to_jiffies(state->effect->replay.length); msecs_to_jiffies(state->effect->replay.length);
state->adj_at = state->play_at; state->adj_at = state->play_at;
ml_schedule_timer(ml);
} else { } else {
debug("initiated stop"); debug("initiated stop");
...@@ -420,9 +454,9 @@ static int ml_ff_playback(struct input_dev *dev, int effect_id, int value) ...@@ -420,9 +454,9 @@ static int ml_ff_playback(struct input_dev *dev, int effect_id, int value)
__set_bit(FF_EFFECT_ABORTING, &state->flags); __set_bit(FF_EFFECT_ABORTING, &state->flags);
else else
__clear_bit(FF_EFFECT_STARTED, &state->flags); __clear_bit(FF_EFFECT_STARTED, &state->flags);
}
ml_play_effects(ml); ml_play_effects(ml);
}
return 0; return 0;
} }
......
...@@ -210,7 +210,7 @@ static int iforce_open(struct input_dev *dev) ...@@ -210,7 +210,7 @@ static int iforce_open(struct input_dev *dev)
return 0; return 0;
} }
static void iforce_release(struct input_dev *dev) static void iforce_close(struct input_dev *dev)
{ {
struct iforce *iforce = input_get_drvdata(dev); struct iforce *iforce = input_get_drvdata(dev);
int i; int i;
...@@ -228,30 +228,17 @@ static void iforce_release(struct input_dev *dev) ...@@ -228,30 +228,17 @@ static void iforce_release(struct input_dev *dev)
/* Disable force feedback playback */ /* Disable force feedback playback */
iforce_send_packet(iforce, FF_CMD_ENABLE, "\001"); iforce_send_packet(iforce, FF_CMD_ENABLE, "\001");
/* Wait for the command to complete */
wait_event_interruptible(iforce->wait,
!test_bit(IFORCE_XMIT_RUNNING, iforce->xmit_flags));
} }
switch (iforce->bus) { switch (iforce->bus) {
#ifdef CONFIG_JOYSTICK_IFORCE_USB #ifdef CONFIG_JOYSTICK_IFORCE_USB
case IFORCE_USB: case IFORCE_USB:
usb_kill_urb(iforce->irq); usb_kill_urb(iforce->irq);
usb_kill_urb(iforce->out);
/* The device was unplugged before the file usb_kill_urb(iforce->ctrl);
* was released */
if (iforce->usbdev == NULL) {
iforce_delete_device(iforce);
kfree(iforce);
}
break;
#endif
}
}
void iforce_delete_device(struct iforce *iforce)
{
switch (iforce->bus) {
#ifdef CONFIG_JOYSTICK_IFORCE_USB
case IFORCE_USB:
iforce_usb_delete(iforce);
break; break;
#endif #endif
#ifdef CONFIG_JOYSTICK_IFORCE_232 #ifdef CONFIG_JOYSTICK_IFORCE_232
...@@ -303,7 +290,7 @@ int iforce_init_device(struct iforce *iforce) ...@@ -303,7 +290,7 @@ int iforce_init_device(struct iforce *iforce)
input_dev->name = "Unknown I-Force device"; input_dev->name = "Unknown I-Force device";
input_dev->open = iforce_open; input_dev->open = iforce_open;
input_dev->close = iforce_release; input_dev->close = iforce_close;
/* /*
* On-device memory allocation. * On-device memory allocation.
......
...@@ -109,6 +109,7 @@ static void iforce_usb_out(struct urb *urb) ...@@ -109,6 +109,7 @@ static void iforce_usb_out(struct urb *urb)
struct iforce *iforce = urb->context; struct iforce *iforce = urb->context;
if (urb->status) { if (urb->status) {
clear_bit(IFORCE_XMIT_RUNNING, iforce->xmit_flags);
dbg("urb->status %d, exiting", urb->status); dbg("urb->status %d, exiting", urb->status);
return; return;
} }
...@@ -186,33 +187,19 @@ static int iforce_usb_probe(struct usb_interface *intf, ...@@ -186,33 +187,19 @@ static int iforce_usb_probe(struct usb_interface *intf,
return err; return err;
} }
/* Called by iforce_delete() */
void iforce_usb_delete(struct iforce* iforce)
{
usb_kill_urb(iforce->irq);
usb_kill_urb(iforce->out);
usb_kill_urb(iforce->ctrl);
usb_free_urb(iforce->irq);
usb_free_urb(iforce->out);
usb_free_urb(iforce->ctrl);
}
static void iforce_usb_disconnect(struct usb_interface *intf) static void iforce_usb_disconnect(struct usb_interface *intf)
{ {
struct iforce *iforce = usb_get_intfdata(intf); struct iforce *iforce = usb_get_intfdata(intf);
int open = 0; /* FIXME! iforce->dev.handle->open; */
usb_set_intfdata(intf, NULL); usb_set_intfdata(intf, NULL);
if (iforce) {
iforce->usbdev = NULL;
input_unregister_device(iforce->dev); input_unregister_device(iforce->dev);
if (!open) { usb_free_urb(iforce->irq);
iforce_delete_device(iforce); usb_free_urb(iforce->out);
usb_free_urb(iforce->ctrl);
kfree(iforce); kfree(iforce);
}
}
} }
static struct usb_device_id iforce_usb_ids [] = { static struct usb_device_id iforce_usb_ids [] = {
......
...@@ -150,11 +150,9 @@ void iforce_serial_xmit(struct iforce *iforce); ...@@ -150,11 +150,9 @@ void iforce_serial_xmit(struct iforce *iforce);
/* iforce-usb.c */ /* iforce-usb.c */
void iforce_usb_xmit(struct iforce *iforce); void iforce_usb_xmit(struct iforce *iforce);
void iforce_usb_delete(struct iforce *iforce);
/* iforce-main.c */ /* iforce-main.c */
int iforce_init_device(struct iforce *iforce); int iforce_init_device(struct iforce *iforce);
void iforce_delete_device(struct iforce *iforce);
/* iforce-packets.c */ /* iforce-packets.c */
int iforce_control_playback(struct iforce*, u16 id, unsigned int); int iforce_control_playback(struct iforce*, u16 id, unsigned int);
......
...@@ -134,7 +134,8 @@ static const unsigned short atkbd_unxlate_table[128] = { ...@@ -134,7 +134,8 @@ static const unsigned short atkbd_unxlate_table[128] = {
#define ATKBD_CMD_GETID 0x02f2 #define ATKBD_CMD_GETID 0x02f2
#define ATKBD_CMD_SETREP 0x10f3 #define ATKBD_CMD_SETREP 0x10f3
#define ATKBD_CMD_ENABLE 0x00f4 #define ATKBD_CMD_ENABLE 0x00f4
#define ATKBD_CMD_RESET_DIS 0x00f5 #define ATKBD_CMD_RESET_DIS 0x00f5 /* Reset to defaults and disable */
#define ATKBD_CMD_RESET_DEF 0x00f6 /* Reset to defaults */
#define ATKBD_CMD_SETALL_MBR 0x00fa #define ATKBD_CMD_SETALL_MBR 0x00fa
#define ATKBD_CMD_RESET_BAT 0x02ff #define ATKBD_CMD_RESET_BAT 0x02ff
#define ATKBD_CMD_RESEND 0x00fe #define ATKBD_CMD_RESEND 0x00fe
...@@ -836,7 +837,7 @@ static void atkbd_cleanup(struct serio *serio) ...@@ -836,7 +837,7 @@ static void atkbd_cleanup(struct serio *serio)
struct atkbd *atkbd = serio_get_drvdata(serio); struct atkbd *atkbd = serio_get_drvdata(serio);
atkbd_disable(atkbd); atkbd_disable(atkbd);
ps2_command(&atkbd->ps2dev, NULL, ATKBD_CMD_RESET_BAT); ps2_command(&atkbd->ps2dev, NULL, ATKBD_CMD_RESET_DEF);
} }
......
...@@ -29,11 +29,13 @@ struct matrix_keypad { ...@@ -29,11 +29,13 @@ struct matrix_keypad {
unsigned short *keycodes; unsigned short *keycodes;
unsigned int row_shift; unsigned int row_shift;
DECLARE_BITMAP(disabled_gpios, MATRIX_MAX_ROWS);
uint32_t last_key_state[MATRIX_MAX_COLS]; uint32_t last_key_state[MATRIX_MAX_COLS];
struct delayed_work work; struct delayed_work work;
spinlock_t lock;
bool scan_pending; bool scan_pending;
bool stopped; bool stopped;
spinlock_t lock;
}; };
/* /*
...@@ -222,9 +224,16 @@ static int matrix_keypad_suspend(struct device *dev) ...@@ -222,9 +224,16 @@ static int matrix_keypad_suspend(struct device *dev)
matrix_keypad_stop(keypad->input_dev); matrix_keypad_stop(keypad->input_dev);
if (device_may_wakeup(&pdev->dev)) if (device_may_wakeup(&pdev->dev)) {
for (i = 0; i < pdata->num_row_gpios; i++) for (i = 0; i < pdata->num_row_gpios; i++) {
enable_irq_wake(gpio_to_irq(pdata->row_gpios[i])); if (!test_bit(i, keypad->disabled_gpios)) {
unsigned int gpio = pdata->row_gpios[i];
if (enable_irq_wake(gpio_to_irq(gpio)) == 0)
__set_bit(i, keypad->disabled_gpios);
}
}
}
return 0; return 0;
} }
...@@ -236,9 +245,15 @@ static int matrix_keypad_resume(struct device *dev) ...@@ -236,9 +245,15 @@ static int matrix_keypad_resume(struct device *dev)
const struct matrix_keypad_platform_data *pdata = keypad->pdata; const struct matrix_keypad_platform_data *pdata = keypad->pdata;
int i; int i;
if (device_may_wakeup(&pdev->dev)) if (device_may_wakeup(&pdev->dev)) {
for (i = 0; i < pdata->num_row_gpios; i++) for (i = 0; i < pdata->num_row_gpios; i++) {
disable_irq_wake(gpio_to_irq(pdata->row_gpios[i])); if (test_and_clear_bit(i, keypad->disabled_gpios)) {
unsigned int gpio = pdata->row_gpios[i];
disable_irq_wake(gpio_to_irq(gpio));
}
}
}
matrix_keypad_start(keypad->input_dev); matrix_keypad_start(keypad->input_dev);
......
...@@ -253,14 +253,6 @@ static irqreturn_t do_kp_irq(int irq, void *_kp) ...@@ -253,14 +253,6 @@ static irqreturn_t do_kp_irq(int irq, void *_kp)
u8 reg; u8 reg;
int ret; int ret;
#ifdef CONFIG_LOCKDEP
/* WORKAROUND for lockdep forcing IRQF_DISABLED on us, which
* we don't want and can't tolerate. Although it might be
* friendlier not to borrow this thread context...
*/
local_irq_enable();
#endif
/* Read & Clear TWL4030 pending interrupt */ /* Read & Clear TWL4030 pending interrupt */
ret = twl4030_kpread(kp, &reg, KEYP_ISR1, 1); ret = twl4030_kpread(kp, &reg, KEYP_ISR1, 1);
...@@ -403,7 +395,8 @@ static int __devinit twl4030_kp_probe(struct platform_device *pdev) ...@@ -403,7 +395,8 @@ static int __devinit twl4030_kp_probe(struct platform_device *pdev)
* *
* NOTE: we assume this host is wired to TWL4040 INT1, not INT2 ... * NOTE: we assume this host is wired to TWL4040 INT1, not INT2 ...
*/ */
error = request_irq(kp->irq, do_kp_irq, 0, pdev->name, kp); error = request_threaded_irq(kp->irq, NULL, do_kp_irq,
0, pdev->name, kp);
if (error) { if (error) {
dev_info(kp->dbg_dev, "request_irq failed for irq no=%d\n", dev_info(kp->dbg_dev, "request_irq failed for irq no=%d\n",
kp->irq); kp->irq);
......
...@@ -39,16 +39,6 @@ static irqreturn_t powerbutton_irq(int irq, void *_pwr) ...@@ -39,16 +39,6 @@ static irqreturn_t powerbutton_irq(int irq, void *_pwr)
int err; int err;
u8 value; u8 value;
#ifdef CONFIG_LOCKDEP
/* WORKAROUND for lockdep forcing IRQF_DISABLED on us, which
* we don't want and can't tolerate since this is a threaded
* IRQ and can sleep due to the i2c reads it has to issue.
* Although it might be friendlier not to borrow this thread
* context...
*/
local_irq_enable();
#endif
err = twl_i2c_read_u8(TWL4030_MODULE_PM_MASTER, &value, err = twl_i2c_read_u8(TWL4030_MODULE_PM_MASTER, &value,
STS_HW_CONDITIONS); STS_HW_CONDITIONS);
if (!err) { if (!err) {
...@@ -80,7 +70,7 @@ static int __devinit twl4030_pwrbutton_probe(struct platform_device *pdev) ...@@ -80,7 +70,7 @@ static int __devinit twl4030_pwrbutton_probe(struct platform_device *pdev)
pwr->phys = "twl4030_pwrbutton/input0"; pwr->phys = "twl4030_pwrbutton/input0";
pwr->dev.parent = &pdev->dev; pwr->dev.parent = &pdev->dev;
err = request_irq(irq, powerbutton_irq, err = request_threaded_irq(irq, NULL, powerbutton_irq,
IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING, IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING,
"twl4030_pwrbutton", pwr); "twl4030_pwrbutton", pwr);
if (err < 0) { if (err < 0) {
......
...@@ -1328,7 +1328,7 @@ static struct platform_driver wistron_driver = { ...@@ -1328,7 +1328,7 @@ static struct platform_driver wistron_driver = {
.driver = { .driver = {
.name = "wistron-bios", .name = "wistron-bios",
.owner = THIS_MODULE, .owner = THIS_MODULE,
#if CONFIG_PM #ifdef CONFIG_PM
.pm = &wistron_pm_ops, .pm = &wistron_pm_ops,
#endif #endif
}, },
......
...@@ -70,7 +70,7 @@ config MOUSE_PS2_SYNAPTICS ...@@ -70,7 +70,7 @@ config MOUSE_PS2_SYNAPTICS
config MOUSE_PS2_LIFEBOOK config MOUSE_PS2_LIFEBOOK
bool "Fujitsu Lifebook PS/2 mouse protocol extension" if EMBEDDED bool "Fujitsu Lifebook PS/2 mouse protocol extension" if EMBEDDED
default y default y
depends on MOUSE_PS2 && X86 depends on MOUSE_PS2 && X86 && DMI
help help
Say Y here if you have a Fujitsu B-series Lifebook PS/2 Say Y here if you have a Fujitsu B-series Lifebook PS/2
TouchScreen connected to your system. TouchScreen connected to your system.
......
...@@ -427,7 +427,6 @@ static void hgpk_recalib_work(struct work_struct *work) ...@@ -427,7 +427,6 @@ static void hgpk_recalib_work(struct work_struct *work)
static int hgpk_register(struct psmouse *psmouse) static int hgpk_register(struct psmouse *psmouse)
{ {
struct input_dev *dev = psmouse->dev;
int err; int err;
/* register handlers */ /* register handlers */
......
...@@ -44,7 +44,6 @@ static int lifebook_set_6byte_proto(const struct dmi_system_id *d) ...@@ -44,7 +44,6 @@ static int lifebook_set_6byte_proto(const struct dmi_system_id *d)
} }
static const struct dmi_system_id __initconst lifebook_dmi_table[] = { static const struct dmi_system_id __initconst lifebook_dmi_table[] = {
#if defined(CONFIG_DMI) && defined(CONFIG_X86)
{ {
/* FLORA-ie 55mi */ /* FLORA-ie 55mi */
.matches = { .matches = {
...@@ -118,7 +117,6 @@ static const struct dmi_system_id __initconst lifebook_dmi_table[] = { ...@@ -118,7 +117,6 @@ static const struct dmi_system_id __initconst lifebook_dmi_table[] = {
}, },
}, },
{ } { }
#endif
}; };
void __init lifebook_module_init(void) void __init lifebook_module_init(void)
......
...@@ -1137,7 +1137,10 @@ static void psmouse_cleanup(struct serio *serio) ...@@ -1137,7 +1137,10 @@ static void psmouse_cleanup(struct serio *serio)
if (psmouse->cleanup) if (psmouse->cleanup)
psmouse->cleanup(psmouse); psmouse->cleanup(psmouse);
psmouse_reset(psmouse); /*
* Reset the mouse to defaults (bare PS/2 protocol).
*/
ps2_command(&psmouse->ps2dev, NULL, PSMOUSE_CMD_RESET_DIS);
/* /*
* Some boxes, such as HP nx7400, get terribly confused if mouse * Some boxes, such as HP nx7400, get terribly confused if mouse
......
...@@ -284,13 +284,7 @@ static void serio_handle_event(void) ...@@ -284,13 +284,7 @@ static void serio_handle_event(void)
mutex_lock(&serio_mutex); mutex_lock(&serio_mutex);
/* while ((event = serio_get_event())) {
* Note that we handle only one event here to give swsusp
* a chance to freeze kseriod thread. Serio events should
* be pretty rare so we are not concerned about taking
* performance hit.
*/
if ((event = serio_get_event())) {
switch (event->type) { switch (event->type) {
case SERIO_REGISTER_PORT: case SERIO_REGISTER_PORT:
...@@ -380,10 +374,9 @@ static struct serio *serio_get_pending_child(struct serio *parent) ...@@ -380,10 +374,9 @@ static struct serio *serio_get_pending_child(struct serio *parent)
static int serio_thread(void *nothing) static int serio_thread(void *nothing)
{ {
set_freezable();
do { do {
serio_handle_event(); serio_handle_event();
wait_event_freezable(serio_wait, wait_event_interruptible(serio_wait,
kthread_should_stop() || !list_empty(&serio_event_list)); kthread_should_stop() || !list_empty(&serio_event_list));
} while (!kthread_should_stop()); } while (!kthread_should_stop());
......
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