dect
/
linux-2.6
Archived
13
0
Fork 0

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
This commit is contained in:
Linus Torvalds 2009-12-31 11:12:35 -08:00
commit 4e58fb7305
14 changed files with 94 additions and 96 deletions

View File

@ -220,12 +220,28 @@ static int get_compatible_type(struct ff_device *ff, int effect_type)
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.
*/
static void ml_combine_effects(struct ff_effect *effect,
struct ml_effect_state *state,
unsigned int gain)
int gain)
{
struct ff_effect *new = state->effect;
unsigned int strong, weak, i;
@ -252,8 +268,21 @@ static void ml_combine_effects(struct ff_effect *effect,
break;
case FF_RUMBLE:
strong = new->u.rumble.strong_magnitude * gain / 0xffff;
weak = new->u.rumble.weak_magnitude * gain / 0xffff;
strong = (u32)new->u.rumble.strong_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 =
min(strong + effect->u.rumble.strong_magnitude,
0xffffU);
@ -268,6 +297,13 @@ static void ml_combine_effects(struct ff_effect *effect,
/* here we also scale it 0x7fff => 0xffff */
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 =
min(i + effect->u.rumble.strong_magnitude, 0xffffU);
effect->u.rumble.weak_magnitude =
@ -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);
state->adj_at = state->play_at;
ml_schedule_timer(ml);
} else {
debug("initiated stop");
@ -420,10 +454,10 @@ static int ml_ff_playback(struct input_dev *dev, int effect_id, int value)
__set_bit(FF_EFFECT_ABORTING, &state->flags);
else
__clear_bit(FF_EFFECT_STARTED, &state->flags);
ml_play_effects(ml);
}
ml_play_effects(ml);
return 0;
}

View File

@ -210,7 +210,7 @@ static int iforce_open(struct input_dev *dev)
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);
int i;
@ -228,30 +228,17 @@ static void iforce_release(struct input_dev *dev)
/* Disable force feedback playback */
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) {
#ifdef CONFIG_JOYSTICK_IFORCE_USB
case IFORCE_USB:
usb_kill_urb(iforce->irq);
/* The device was unplugged before the file
* 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);
usb_kill_urb(iforce->irq);
usb_kill_urb(iforce->out);
usb_kill_urb(iforce->ctrl);
break;
#endif
#ifdef CONFIG_JOYSTICK_IFORCE_232
@ -303,7 +290,7 @@ int iforce_init_device(struct iforce *iforce)
input_dev->name = "Unknown I-Force device";
input_dev->open = iforce_open;
input_dev->close = iforce_release;
input_dev->close = iforce_close;
/*
* On-device memory allocation.

View File

@ -109,6 +109,7 @@ static void iforce_usb_out(struct urb *urb)
struct iforce *iforce = urb->context;
if (urb->status) {
clear_bit(IFORCE_XMIT_RUNNING, iforce->xmit_flags);
dbg("urb->status %d, exiting", urb->status);
return;
}
@ -186,33 +187,19 @@ fail:
return err;
}
/* Called by iforce_delete() */
void iforce_usb_delete(struct iforce* iforce)
static void iforce_usb_disconnect(struct usb_interface *intf)
{
usb_kill_urb(iforce->irq);
usb_kill_urb(iforce->out);
usb_kill_urb(iforce->ctrl);
struct iforce *iforce = usb_get_intfdata(intf);
usb_set_intfdata(intf, NULL);
input_unregister_device(iforce->dev);
usb_free_urb(iforce->irq);
usb_free_urb(iforce->out);
usb_free_urb(iforce->ctrl);
}
static void iforce_usb_disconnect(struct usb_interface *intf)
{
struct iforce *iforce = usb_get_intfdata(intf);
int open = 0; /* FIXME! iforce->dev.handle->open; */
usb_set_intfdata(intf, NULL);
if (iforce) {
iforce->usbdev = NULL;
input_unregister_device(iforce->dev);
if (!open) {
iforce_delete_device(iforce);
kfree(iforce);
}
}
kfree(iforce);
}
static struct usb_device_id iforce_usb_ids [] = {

View File

@ -150,11 +150,9 @@ void iforce_serial_xmit(struct iforce *iforce);
/* iforce-usb.c */
void iforce_usb_xmit(struct iforce *iforce);
void iforce_usb_delete(struct iforce *iforce);
/* iforce-main.c */
int iforce_init_device(struct iforce *iforce);
void iforce_delete_device(struct iforce *iforce);
/* iforce-packets.c */
int iforce_control_playback(struct iforce*, u16 id, unsigned int);

View File

@ -134,7 +134,8 @@ static const unsigned short atkbd_unxlate_table[128] = {
#define ATKBD_CMD_GETID 0x02f2
#define ATKBD_CMD_SETREP 0x10f3
#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_RESET_BAT 0x02ff
#define ATKBD_CMD_RESEND 0x00fe
@ -836,7 +837,7 @@ static void atkbd_cleanup(struct serio *serio)
struct atkbd *atkbd = serio_get_drvdata(serio);
atkbd_disable(atkbd);
ps2_command(&atkbd->ps2dev, NULL, ATKBD_CMD_RESET_BAT);
ps2_command(&atkbd->ps2dev, NULL, ATKBD_CMD_RESET_DEF);
}

View File

@ -29,11 +29,13 @@ struct matrix_keypad {
unsigned short *keycodes;
unsigned int row_shift;
DECLARE_BITMAP(disabled_gpios, MATRIX_MAX_ROWS);
uint32_t last_key_state[MATRIX_MAX_COLS];
struct delayed_work work;
spinlock_t lock;
bool scan_pending;
bool stopped;
spinlock_t lock;
};
/*
@ -222,9 +224,16 @@ static int matrix_keypad_suspend(struct device *dev)
matrix_keypad_stop(keypad->input_dev);
if (device_may_wakeup(&pdev->dev))
for (i = 0; i < pdata->num_row_gpios; i++)
enable_irq_wake(gpio_to_irq(pdata->row_gpios[i]));
if (device_may_wakeup(&pdev->dev)) {
for (i = 0; i < pdata->num_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;
}
@ -236,9 +245,15 @@ static int matrix_keypad_resume(struct device *dev)
const struct matrix_keypad_platform_data *pdata = keypad->pdata;
int i;
if (device_may_wakeup(&pdev->dev))
for (i = 0; i < pdata->num_row_gpios; i++)
disable_irq_wake(gpio_to_irq(pdata->row_gpios[i]));
if (device_may_wakeup(&pdev->dev)) {
for (i = 0; i < pdata->num_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);

View File

@ -253,14 +253,6 @@ static irqreturn_t do_kp_irq(int irq, void *_kp)
u8 reg;
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 */
ret = twl4030_kpread(kp, &reg, KEYP_ISR1, 1);
@ -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 ...
*/
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) {
dev_info(kp->dbg_dev, "request_irq failed for irq no=%d\n",
kp->irq);

View File

@ -39,18 +39,8 @@ static irqreturn_t powerbutton_irq(int irq, void *_pwr)
int err;
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,
STS_HW_CONDITIONS);
STS_HW_CONDITIONS);
if (!err) {
input_report_key(pwr, KEY_POWER, value & PWR_PWRON_IRQ);
input_sync(pwr);
@ -80,7 +70,7 @@ static int __devinit twl4030_pwrbutton_probe(struct platform_device *pdev)
pwr->phys = "twl4030_pwrbutton/input0";
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,
"twl4030_pwrbutton", pwr);
if (err < 0) {

View File

@ -1328,7 +1328,7 @@ static struct platform_driver wistron_driver = {
.driver = {
.name = "wistron-bios",
.owner = THIS_MODULE,
#if CONFIG_PM
#ifdef CONFIG_PM
.pm = &wistron_pm_ops,
#endif
},

View File

@ -70,7 +70,7 @@ config MOUSE_PS2_SYNAPTICS
config MOUSE_PS2_LIFEBOOK
bool "Fujitsu Lifebook PS/2 mouse protocol extension" if EMBEDDED
default y
depends on MOUSE_PS2 && X86
depends on MOUSE_PS2 && X86 && DMI
help
Say Y here if you have a Fujitsu B-series Lifebook PS/2
TouchScreen connected to your system.

View File

@ -427,7 +427,6 @@ static void hgpk_recalib_work(struct work_struct *work)
static int hgpk_register(struct psmouse *psmouse)
{
struct input_dev *dev = psmouse->dev;
int err;
/* register handlers */

View File

@ -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[] = {
#if defined(CONFIG_DMI) && defined(CONFIG_X86)
{
/* FLORA-ie 55mi */
.matches = {
@ -118,7 +117,6 @@ static const struct dmi_system_id __initconst lifebook_dmi_table[] = {
},
},
{ }
#endif
};
void __init lifebook_module_init(void)

View File

@ -1137,7 +1137,10 @@ static void psmouse_cleanup(struct serio *serio)
if (psmouse->cleanup)
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

View File

@ -284,13 +284,7 @@ static void serio_handle_event(void)
mutex_lock(&serio_mutex);
/*
* 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())) {
while ((event = serio_get_event())) {
switch (event->type) {
case SERIO_REGISTER_PORT:
@ -380,10 +374,9 @@ static struct serio *serio_get_pending_child(struct serio *parent)
static int serio_thread(void *nothing)
{
set_freezable();
do {
serio_handle_event();
wait_event_freezable(serio_wait,
wait_event_interruptible(serio_wait,
kthread_should_stop() || !list_empty(&serio_event_list));
} while (!kthread_should_stop());