Skip to content

Commit 1e345ac

Browse files
committed
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input
Pull input updates from Dmitry Torokhov: "A few new haptic/button drivers, a rudimentary support for laptops using FocalTech touchpads; xpad driver will bind to more devices, and a few other driver fixes." * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input: Input: soc_button_array - convert to platform bus Input: palmas-pwrbutton - fix typo in the license string Input: palmas-pwrbutton - use IRQF_ONESHOT Input: psmouse - add support for detecting FocalTech PS/2 touchpads Input: psmouse - add psmouse_matches_pnp_id helper function Input: joystick - use ktime for measuring timing Input: add haptic driver on max77693 Input: introduce palmas-pwrbutton Input: add support for the DRV2667 haptic driver Input: xpad - sync device IDs with xboxdrv Input: xpad - add VID/PID for Razer Sabertooth Input: cros_ec_keyb - optimize ghosting algorithm Input: drv260x - fix binding document Input: drv260x - add check for ERM mode and LRA Libraries Input: drv260x - remove unused defines Input: drv260x - add TI drv260x haptics driver
2 parents 39520ee + 447a8b8 commit 1e345ac

24 files changed

Lines changed: 2468 additions & 109 deletions

File tree

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
* Texas Instruments - drv260x Haptics driver family
2+
3+
Required properties:
4+
- compatible - One of:
5+
"ti,drv2604" - DRV2604
6+
"ti,drv2605" - DRV2605
7+
"ti,drv2605l" - DRV2605L
8+
- reg - I2C slave address
9+
- vbat-supply - Required supply regulator
10+
- mode - Power up mode of the chip (defined in include/dt-bindings/input/ti-drv260x.h)
11+
DRV260X_LRA_MODE - Linear Resonance Actuator mode (Piezoelectric)
12+
DRV260X_LRA_NO_CAL_MODE - This is a LRA Mode but there is no calibration
13+
sequence during init. And the device is configured for real
14+
time playback mode (RTP mode).
15+
DRV260X_ERM_MODE - Eccentric Rotating Mass mode (Rotary vibrator)
16+
- library-sel - These are ROM based waveforms pre-programmed into the IC.
17+
This should be set to set the library to use at power up.
18+
(defined in include/dt-bindings/input/ti-drv260x.h)
19+
DRV260X_LIB_EMPTY - Do not use a pre-programmed library
20+
DRV260X_ERM_LIB_A - Pre-programmed Library
21+
DRV260X_ERM_LIB_B - Pre-programmed Library
22+
DRV260X_ERM_LIB_C - Pre-programmed Library
23+
DRV260X_ERM_LIB_D - Pre-programmed Library
24+
DRV260X_ERM_LIB_E - Pre-programmed Library
25+
DRV260X_ERM_LIB_F - Pre-programmed Library
26+
DRV260X_LIB_LRA - Pre-programmed LRA Library
27+
28+
Optional properties:
29+
- enable-gpio - gpio pin to enable/disable the device.
30+
- vib-rated-mv - The rated voltage of the actuator in millivolts.
31+
If this is not set then the value will be defaulted to
32+
3.2 v.
33+
- vib-overdrive-mv - The overdrive voltage of the actuator in millivolts.
34+
If this is not set then the value will be defaulted to
35+
3.2 v.
36+
Example:
37+
38+
haptics: haptics@5a {
39+
compatible = "ti,drv2605l";
40+
reg = <0x5a>;
41+
vbat-supply = <&vbat>;
42+
enable-gpio = <&gpio1 28 GPIO_ACTIVE_HIGH>;
43+
mode = <DRV260X_LRA_MODE>;
44+
library-sel = <DRV260X_LIB_LRA>;
45+
vib-rated-mv = <3200>;
46+
vib-overdriver-mv = <3200>;
47+
}
48+
49+
For more product information please see the link below:
50+
http://www.ti.com/product/drv2605
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
* Texas Instruments - drv2667 Haptics driver
2+
3+
Required properties:
4+
- compatible - "ti,drv2667" - DRV2667
5+
- reg - I2C slave address
6+
- vbat-supply - Required supply regulator
7+
8+
Example:
9+
10+
haptics: haptics@59 {
11+
compatible = "ti,drv2667";
12+
reg = <0x59>;
13+
vbat-supply = <&vbat>;
14+
};
15+
16+
For more product information please see the link below:
17+
http://www.ti.com/product/drv2667
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
Texas Instruments Palmas family power button module
2+
3+
This module is part of the Palmas family of PMICs. For more details
4+
about the whole chip see:
5+
Documentation/devicetree/bindings/mfd/palmas.txt.
6+
7+
This module provides a simple power button event via an Interrupt.
8+
9+
Required properties:
10+
- compatible: should be one of the following
11+
- "ti,palmas-pwrbutton": For Palmas compatible power on button
12+
- interrupt-parent: Parent interrupt device, must be handle of palmas node.
13+
- interrupts: Interrupt number of power button submodule on device.
14+
15+
Optional Properties:
16+
17+
- ti,palmas-long-press-seconds: Duration in seconds which the power
18+
button should be kept pressed for Palmas to power off automatically.
19+
NOTE: This depends on OTP support and POWERHOLD signal configuration
20+
on platform. Valid values are 6, 8, 10 and 12.
21+
- ti,palmas-pwron-debounce-milli-seconds: Duration in milliseconds
22+
which the power button should be kept pressed for Palmas to register
23+
a press for debouncing purposes. NOTE: This depends on specific
24+
Palmas variation capability. Valid values are 15, 100, 500 and 1000.
25+
26+
Example:
27+
28+
&palmas {
29+
palmas_pwr_button: pwrbutton {
30+
compatible = "ti,palmas-pwrbutton";
31+
interrupt-parent = <&tps659038>;
32+
interrupts = <1 IRQ_TYPE_EDGE_FALLING>;
33+
ti,palmas-long-press-seconds = <12>;
34+
ti,palmas-pwron-debounce-milli-seconds = <15>;
35+
};
36+
};

‎drivers/acpi/acpi_pnp.c‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@
1515
#include <linux/ctype.h>
1616

1717
static const struct acpi_device_id acpi_pnp_device_ids[] = {
18-
/* soc_button_array */
19-
{"PNP0C40"},
2018
/* pata_isapnp */
2119
{"PNP0600"}, /* Generic ESDI/IDE/ATA compatible hard disk controller */
2220
/* floppy */

‎drivers/input/gameport/gameport.c‎

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,18 @@
2323
#include <linux/workqueue.h>
2424
#include <linux/sched.h> /* HZ */
2525
#include <linux/mutex.h>
26+
#include <linux/timekeeping.h>
2627

2728
/*#include <asm/io.h>*/
2829

2930
MODULE_AUTHOR("Vojtech Pavlik <vojtech@ucw.cz>");
3031
MODULE_DESCRIPTION("Generic gameport layer");
3132
MODULE_LICENSE("GPL");
3233

34+
static bool use_ktime = true;
35+
module_param(use_ktime, bool, 0400);
36+
MODULE_PARM_DESC(use_ktime, "Use ktime for measuring I/O speed");
37+
3338
/*
3439
* gameport_mutex protects entire gameport subsystem and is taken
3540
* every time gameport port or driver registrered or unregistered.
@@ -75,6 +80,38 @@ static unsigned int get_time_pit(void)
7580
*/
7681

7782
static int gameport_measure_speed(struct gameport *gameport)
83+
{
84+
unsigned int i, t, tx;
85+
u64 t1, t2, t3;
86+
unsigned long flags;
87+
88+
if (gameport_open(gameport, NULL, GAMEPORT_MODE_RAW))
89+
return 0;
90+
91+
tx = ~0;
92+
93+
for (i = 0; i < 50; i++) {
94+
local_irq_save(flags);
95+
t1 = ktime_get_ns();
96+
for (t = 0; t < 50; t++)
97+
gameport_read(gameport);
98+
t2 = ktime_get_ns();
99+
t3 = ktime_get_ns();
100+
local_irq_restore(flags);
101+
udelay(i * 10);
102+
t = (t2 - t1) - (t3 - t2);
103+
if (t < tx)
104+
tx = t;
105+
}
106+
107+
gameport_close(gameport);
108+
t = 1000000 * 50;
109+
if (tx)
110+
t /= tx;
111+
return t;
112+
}
113+
114+
static int old_gameport_measure_speed(struct gameport *gameport)
78115
{
79116
#if defined(__i386__)
80117

@@ -521,7 +558,9 @@ static void gameport_add_port(struct gameport *gameport)
521558
if (gameport->parent)
522559
gameport->parent->child = gameport;
523560

524-
gameport->speed = gameport_measure_speed(gameport);
561+
gameport->speed = use_ktime ?
562+
gameport_measure_speed(gameport) :
563+
old_gameport_measure_speed(gameport);
525564

526565
list_add_tail(&gameport->node, &gameport_list);
527566

‎drivers/input/joystick/analog.c‎

Lines changed: 52 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,18 @@
3636
#include <linux/gameport.h>
3737
#include <linux/jiffies.h>
3838
#include <linux/timex.h>
39+
#include <linux/timekeeping.h>
3940

4041
#define DRIVER_DESC "Analog joystick and gamepad driver"
4142

4243
MODULE_AUTHOR("Vojtech Pavlik <vojtech@ucw.cz>");
4344
MODULE_DESCRIPTION(DRIVER_DESC);
4445
MODULE_LICENSE("GPL");
4546

47+
static bool use_ktime = true;
48+
module_param(use_ktime, bool, 0400);
49+
MODULE_PARM_DESC(use_ktime, "Use ktime for measuring I/O speed");
50+
4651
/*
4752
* Option parsing.
4853
*/
@@ -171,6 +176,25 @@ static unsigned long analog_faketime = 0;
171176
#warning Precise timer not defined for this architecture.
172177
#endif
173178

179+
static inline u64 get_time(void)
180+
{
181+
if (use_ktime) {
182+
return ktime_get_ns();
183+
} else {
184+
unsigned int x;
185+
GET_TIME(x);
186+
return x;
187+
}
188+
}
189+
190+
static inline unsigned int delta(u64 x, u64 y)
191+
{
192+
if (use_ktime)
193+
return y - x;
194+
else
195+
return DELTA((unsigned int)x, (unsigned int)y);
196+
}
197+
174198
/*
175199
* analog_decode() decodes analog joystick data and reports input events.
176200
*/
@@ -226,7 +250,8 @@ static void analog_decode(struct analog *analog, int *axes, int *initial, int bu
226250
static int analog_cooked_read(struct analog_port *port)
227251
{
228252
struct gameport *gameport = port->gameport;
229-
unsigned int time[4], start, loop, now, loopout, timeout;
253+
u64 time[4], start, loop, now;
254+
unsigned int loopout, timeout;
230255
unsigned char data[4], this, last;
231256
unsigned long flags;
232257
int i, j;
@@ -236,7 +261,7 @@ static int analog_cooked_read(struct analog_port *port)
236261

237262
local_irq_save(flags);
238263
gameport_trigger(gameport);
239-
GET_TIME(now);
264+
now = get_time();
240265
local_irq_restore(flags);
241266

242267
start = now;
@@ -249,24 +274,24 @@ static int analog_cooked_read(struct analog_port *port)
249274

250275
local_irq_disable();
251276
this = gameport_read(gameport) & port->mask;
252-
GET_TIME(now);
277+
now = get_time();
253278
local_irq_restore(flags);
254279

255-
if ((last ^ this) && (DELTA(loop, now) < loopout)) {
280+
if ((last ^ this) && (delta(loop, now) < loopout)) {
256281
data[i] = last ^ this;
257282
time[i] = now;
258283
i++;
259284
}
260285

261-
} while (this && (i < 4) && (DELTA(start, now) < timeout));
286+
} while (this && (i < 4) && (delta(start, now) < timeout));
262287

263288
this <<= 4;
264289

265290
for (--i; i >= 0; i--) {
266291
this |= data[i];
267292
for (j = 0; j < 4; j++)
268293
if (data[i] & (1 << j))
269-
port->axes[j] = (DELTA(start, time[i]) << ANALOG_FUZZ_BITS) / port->loop;
294+
port->axes[j] = (delta(start, time[i]) << ANALOG_FUZZ_BITS) / port->loop;
270295
}
271296

272297
return -(this != port->mask);
@@ -365,31 +390,39 @@ static void analog_close(struct input_dev *dev)
365390
static void analog_calibrate_timer(struct analog_port *port)
366391
{
367392
struct gameport *gameport = port->gameport;
368-
unsigned int i, t, tx, t1, t2, t3;
393+
unsigned int i, t, tx;
394+
u64 t1, t2, t3;
369395
unsigned long flags;
370396

371-
local_irq_save(flags);
372-
GET_TIME(t1);
397+
if (use_ktime) {
398+
port->speed = 1000000;
399+
} else {
400+
local_irq_save(flags);
401+
t1 = get_time();
373402
#ifdef FAKE_TIME
374-
analog_faketime += 830;
403+
analog_faketime += 830;
375404
#endif
376-
mdelay(1);
377-
GET_TIME(t2);
378-
GET_TIME(t3);
379-
local_irq_restore(flags);
405+
mdelay(1);
406+
t2 = get_time();
407+
t3 = get_time();
408+
local_irq_restore(flags);
380409

381-
port->speed = DELTA(t1, t2) - DELTA(t2, t3);
410+
port->speed = delta(t1, t2) - delta(t2, t3);
411+
}
382412

383413
tx = ~0;
384414

385415
for (i = 0; i < 50; i++) {
386416
local_irq_save(flags);
387-
GET_TIME(t1);
388-
for (t = 0; t < 50; t++) { gameport_read(gameport); GET_TIME(t2); }
389-
GET_TIME(t3);
417+
t1 = get_time();
418+
for (t = 0; t < 50; t++) {
419+
gameport_read(gameport);
420+
t2 = get_time();
421+
}
422+
t3 = get_time();
390423
local_irq_restore(flags);
391424
udelay(i);
392-
t = DELTA(t1, t2) - DELTA(t2, t3);
425+
t = delta(t1, t2) - delta(t2, t3);
393426
if (t < tx) tx = t;
394427
}
395428

0 commit comments

Comments
 (0)