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

Commit a5cba18c authored by Dmitry Torokhov's avatar Dmitry Torokhov
Browse files

Merge branch 'next' into for-linus

Prepare second round of input updates for 4.2 merge window.
parents f7ebc4dc d55d0b56
Loading
Loading
Loading
Loading
+9 −25
Original line number Diff line number Diff line
@@ -677,12 +677,9 @@ static void input_dev_release_keys(struct input_dev *dev)
	int code;

	if (is_event_supported(EV_KEY, dev->evbit, EV_MAX)) {
		for (code = 0; code <= KEY_MAX; code++) {
			if (is_event_supported(code, dev->keybit, KEY_MAX) &&
			    __test_and_clear_bit(code, dev->key)) {
		for_each_set_bit(code, dev->key, KEY_CNT)
			input_pass_event(dev, EV_KEY, code, 0);
			}
		}
		memset(dev->key, 0, sizeof(dev->key));
		input_pass_event(dev, EV_SYN, SYN_REPORT, 1);
	}
}
@@ -1626,10 +1623,7 @@ static int input_dev_uevent(struct device *device, struct kobj_uevent_env *env)
		if (!test_bit(EV_##type, dev->evbit))			\
			break;						\
									\
		for (i = 0; i < type##_MAX; i++) {			\
			if (!test_bit(i, dev->bits##bit))		\
				continue;				\
									\
		for_each_set_bit(i, dev->bits##bit, type##_CNT) {	\
			active = test_bit(i, dev->bits);		\
			if (!active && !on)				\
				continue;				\
@@ -1980,22 +1974,12 @@ static unsigned int input_estimate_events_per_packet(struct input_dev *dev)

	events = mt_slots + 1; /* count SYN_MT_REPORT and SYN_REPORT */

	if (test_bit(EV_ABS, dev->evbit)) {
		for (i = 0; i < ABS_CNT; i++) {
			if (test_bit(i, dev->absbit)) {
				if (input_is_mt_axis(i))
					events += mt_slots;
				else
					events++;
			}
		}
	}
	if (test_bit(EV_ABS, dev->evbit))
		for_each_set_bit(i, dev->absbit, ABS_CNT)
			events += input_is_mt_axis(i) ? mt_slots : 1;

	if (test_bit(EV_REL, dev->evbit)) {
		for (i = 0; i < REL_CNT; i++)
			if (test_bit(i, dev->relbit))
				events++;
	}
	if (test_bit(EV_REL, dev->evbit))
		events += bitmap_weight(dev->relbit, REL_CNT);

	/* Make room for KEY and MSC events */
	events += 7;
+65 −13
Original line number Diff line number Diff line
@@ -344,6 +344,7 @@ struct usb_xpad {

	int mapping;			/* map d-pad to buttons or to axes */
	int xtype;			/* type of xbox device */
	unsigned long led_no;		/* led to lit on xbox360 controllers */
};

/*
@@ -488,6 +489,8 @@ static void xpad360_process_packet(struct usb_xpad *xpad,
	input_sync(dev);
}

static void xpad_identify_controller(struct usb_xpad *xpad);

/*
 * xpad360w_process_packet
 *
@@ -510,6 +513,11 @@ static void xpad360w_process_packet(struct usb_xpad *xpad, u16 cmd, unsigned cha
		if (data[1] & 0x80) {
			xpad->pad_present = 1;
			usb_submit_urb(xpad->bulk_out, GFP_ATOMIC);
			/*
			 * Light up the segment corresponding to
			 * controller number.
			 */
			xpad_identify_controller(xpad);
		} else
			xpad->pad_present = 0;
	}
@@ -881,17 +889,63 @@ struct xpad_led {
	struct usb_xpad *xpad;
};

/**
 * @param command
 *  0: off
 *  1: all blink, then previous setting
 *  2: 1/top-left blink, then on
 *  3: 2/top-right blink, then on
 *  4: 3/bottom-left blink, then on
 *  5: 4/bottom-right blink, then on
 *  6: 1/top-left on
 *  7: 2/top-right on
 *  8: 3/bottom-left on
 *  9: 4/bottom-right on
 * 10: rotate
 * 11: blink, based on previous setting
 * 12: slow blink, based on previous setting
 * 13: rotate with two lights
 * 14: persistent slow all blink
 * 15: blink once, then previous setting
 */
static void xpad_send_led_command(struct usb_xpad *xpad, int command)
{
	if (command >= 0 && command < 14) {
	command %= 16;

	mutex_lock(&xpad->odata_mutex);

	switch (xpad->xtype) {
	case XTYPE_XBOX360:
		xpad->odata[0] = 0x01;
		xpad->odata[1] = 0x03;
		xpad->odata[2] = command;
		xpad->irq_out->transfer_buffer_length = 3;
		break;
	case XTYPE_XBOX360W:
		xpad->odata[0] = 0x00;
		xpad->odata[1] = 0x00;
		xpad->odata[2] = 0x08;
		xpad->odata[3] = 0x40 + command;
		xpad->odata[4] = 0x00;
		xpad->odata[5] = 0x00;
		xpad->odata[6] = 0x00;
		xpad->odata[7] = 0x00;
		xpad->odata[8] = 0x00;
		xpad->odata[9] = 0x00;
		xpad->odata[10] = 0x00;
		xpad->odata[11] = 0x00;
		xpad->irq_out->transfer_buffer_length = 12;
		break;
	}

	usb_submit_urb(xpad->irq_out, GFP_KERNEL);
	mutex_unlock(&xpad->odata_mutex);
}

static void xpad_identify_controller(struct usb_xpad *xpad)
{
	/* Light up the segment corresponding to controller number */
	xpad_send_led_command(xpad, (xpad->led_no % 4) + 2);
}

static void xpad_led_set(struct led_classdev *led_cdev,
@@ -906,21 +960,20 @@ static void xpad_led_set(struct led_classdev *led_cdev,
static int xpad_led_probe(struct usb_xpad *xpad)
{
	static atomic_t led_seq = ATOMIC_INIT(-1);
	unsigned long led_no;
	struct xpad_led *led;
	struct led_classdev *led_cdev;
	int error;

	if (xpad->xtype != XTYPE_XBOX360)
	if (xpad->xtype != XTYPE_XBOX360 && xpad->xtype != XTYPE_XBOX360W)
		return 0;

	xpad->led = led = kzalloc(sizeof(struct xpad_led), GFP_KERNEL);
	if (!led)
		return -ENOMEM;

	led_no = atomic_inc_return(&led_seq);
	xpad->led_no = atomic_inc_return(&led_seq);

	snprintf(led->name, sizeof(led->name), "xpad%lu", led_no);
	snprintf(led->name, sizeof(led->name), "xpad%lu", xpad->led_no);
	led->xpad = xpad;

	led_cdev = &led->led_cdev;
@@ -934,10 +987,8 @@ static int xpad_led_probe(struct usb_xpad *xpad)
		return error;
	}

	/*
	 * Light up the segment corresponding to controller number
	 */
	xpad_send_led_command(xpad, (led_no % 4) + 2);
	/* Light up the segment corresponding to controller number */
	xpad_identify_controller(xpad);

	return 0;
}
@@ -954,6 +1005,7 @@ static void xpad_led_disconnect(struct usb_xpad *xpad)
#else
static int xpad_led_probe(struct usb_xpad *xpad) { return 0; }
static void xpad_led_disconnect(struct usb_xpad *xpad) { }
static void xpad_identify_controller(struct usb_xpad *xpad) { }
#endif


+3 −1
Original line number Diff line number Diff line
@@ -506,7 +506,9 @@ static int imx_keypad_probe(struct platform_device *pdev)
	input_set_drvdata(input_dev, keypad);

	/* Ensure that the keypad will stay dormant until opened */
	clk_prepare_enable(keypad->clk);
	error = clk_prepare_enable(keypad->clk);
	if (error)
		return error;
	imx_keypad_inhibit(keypad);
	clk_disable_unprepare(keypad->clk);

+6 −2
Original line number Diff line number Diff line
@@ -167,9 +167,13 @@ static irqreturn_t axp20x_pek_irq(int irq, void *pwr)
	struct input_dev *idev = pwr;
	struct axp20x_pek *axp20x_pek = input_get_drvdata(idev);

	if (irq == axp20x_pek->irq_dbr)
	/*
	 * The power-button is connected to ground so a falling edge (dbf)
	 * means it is pressed.
	 */
	if (irq == axp20x_pek->irq_dbf)
		input_report_key(idev, KEY_POWER, true);
	else if (irq == axp20x_pek->irq_dbf)
	else if (irq == axp20x_pek->irq_dbr)
		input_report_key(idev, KEY_POWER, false);

	input_sync(idev);
+1 −0
Original line number Diff line number Diff line
@@ -244,6 +244,7 @@ config SERIO_PS2MULT

config SERIO_ARC_PS2
	tristate "ARC PS/2 support"
	depends on HAS_IOMEM
	help
	  Say Y here if you have an ARC FPGA platform with a PS/2
	  controller in it.
Loading