Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4e58fb73 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
* '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
Loading
Loading
Loading
Loading
+41 −7
Original line number Diff line number Diff line
@@ -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,9 +454,9 @@ 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);
	}

	return 0;
}
+8 −21
Original line number Diff line number Diff line
@@ -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->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.
+8 −21
Original line number Diff line number Diff line
@@ -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,34 +187,20 @@ fail:
	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)
{
	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);
	usb_free_urb(iforce->irq);
	usb_free_urb(iforce->out);
	usb_free_urb(iforce->ctrl);

	kfree(iforce);
}
	}
}

static struct usb_device_id iforce_usb_ids [] = {
	{ USB_DEVICE(0x044f, 0xa01c) },		/* Thrustmaster Motor Sport GT */
+0 −2
Original line number Diff line number Diff line
@@ -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);
+3 −2
Original line number Diff line number Diff line
@@ -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);
}


Loading