Skip to content

Commit 7c2d183

Browse files
committed
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input
Pull input fixes from Dmitry Torokhov: "Nothing terribly interesting, just a few fixups" * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input: Input: xpad - sync supported devices with fork on GitHub Input: ariel-pwrbutton - remove unused variable ariel_pwrbutton_id_table Input: goodix - add support for Goodix GT9286 chip dt-bindings: input: touchscreen: goodix: Add binding for GT9286 IC dt-bindings: input: adc-keys: clarify description Input: ili210x - implement pressure reporting for ILI251x Input: i8042 - unbreak Pegatron C15B Input: st1232 - wait until device is ready before reading resolution Input: st1232 - do not read more bytes than needed Input: st1232 - fix off-by-one error in resolution handling
2 parents 964d069 + 9bbd77d commit 7c2d183

File tree

8 files changed

+102
-22
lines changed

8 files changed

+102
-22
lines changed

Documentation/devicetree/bindings/input/adc-keys.txt

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ Required properties:
55
- compatible: "adc-keys"
66
- io-channels: Phandle to an ADC channel
77
- io-channel-names = "buttons";
8-
- keyup-threshold-microvolt: Voltage at which all the keys are considered up.
8+
- keyup-threshold-microvolt: Voltage above or equal to which all the keys are
9+
considered up.
910

1011
Optional properties:
1112
- poll-interval: Poll interval time in milliseconds
@@ -17,7 +18,12 @@ Each button (key) is represented as a sub-node of "adc-keys":
1718
Required subnode-properties:
1819
- label: Descriptive name of the key.
1920
- linux,code: Keycode to emit.
20-
- press-threshold-microvolt: Voltage ADC input when this key is pressed.
21+
- press-threshold-microvolt: voltage above or equal to which this key is
22+
considered pressed.
23+
24+
No two values of press-threshold-microvolt may be the same.
25+
All values of press-threshold-microvolt must be less than
26+
keyup-threshold-microvolt.
2127

2228
Example:
2329

@@ -47,3 +53,15 @@ Example:
4753
press-threshold-microvolt = <500000>;
4854
};
4955
};
56+
57+
+--------------------------------+------------------------+
58+
| 2.000.000 <= value | no key pressed |
59+
+--------------------------------+------------------------+
60+
| 1.500.000 <= value < 2.000.000 | KEY_VOLUMEUP pressed |
61+
+--------------------------------+------------------------+
62+
| 1.000.000 <= value < 1.500.000 | KEY_VOLUMEDOWN pressed |
63+
+--------------------------------+------------------------+
64+
| 500.000 <= value < 1.000.000 | KEY_ENTER pressed |
65+
+--------------------------------+------------------------+
66+
| value < 500.000 | no key pressed |
67+
+--------------------------------+------------------------+

Documentation/devicetree/bindings/input/touchscreen/goodix.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ properties:
2626
- goodix,gt927
2727
- goodix,gt9271
2828
- goodix,gt928
29+
- goodix,gt9286
2930
- goodix,gt967
3031

3132
reg:

drivers/input/joystick/xpad.c

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,9 +215,17 @@ static const struct xpad_device {
215215
{ 0x0e6f, 0x0213, "Afterglow Gamepad for Xbox 360", 0, XTYPE_XBOX360 },
216216
{ 0x0e6f, 0x021f, "Rock Candy Gamepad for Xbox 360", 0, XTYPE_XBOX360 },
217217
{ 0x0e6f, 0x0246, "Rock Candy Gamepad for Xbox One 2015", 0, XTYPE_XBOXONE },
218-
{ 0x0e6f, 0x02ab, "PDP Controller for Xbox One", 0, XTYPE_XBOXONE },
218+
{ 0x0e6f, 0x02a0, "PDP Xbox One Controller", 0, XTYPE_XBOXONE },
219+
{ 0x0e6f, 0x02a1, "PDP Xbox One Controller", 0, XTYPE_XBOXONE },
220+
{ 0x0e6f, 0x02a2, "PDP Wired Controller for Xbox One - Crimson Red", 0, XTYPE_XBOXONE },
219221
{ 0x0e6f, 0x02a4, "PDP Wired Controller for Xbox One - Stealth Series", 0, XTYPE_XBOXONE },
220222
{ 0x0e6f, 0x02a6, "PDP Wired Controller for Xbox One - Camo Series", 0, XTYPE_XBOXONE },
223+
{ 0x0e6f, 0x02a7, "PDP Xbox One Controller", 0, XTYPE_XBOXONE },
224+
{ 0x0e6f, 0x02a8, "PDP Xbox One Controller", 0, XTYPE_XBOXONE },
225+
{ 0x0e6f, 0x02ab, "PDP Controller for Xbox One", 0, XTYPE_XBOXONE },
226+
{ 0x0e6f, 0x02ad, "PDP Wired Controller for Xbox One - Stealth Series", 0, XTYPE_XBOXONE },
227+
{ 0x0e6f, 0x02b3, "Afterglow Prismatic Wired Controller", 0, XTYPE_XBOXONE },
228+
{ 0x0e6f, 0x02b8, "Afterglow Prismatic Wired Controller", 0, XTYPE_XBOXONE },
221229
{ 0x0e6f, 0x0301, "Logic3 Controller", 0, XTYPE_XBOX360 },
222230
{ 0x0e6f, 0x0346, "Rock Candy Gamepad for Xbox One 2016", 0, XTYPE_XBOXONE },
223231
{ 0x0e6f, 0x0401, "Logic3 Controller", 0, XTYPE_XBOX360 },
@@ -296,6 +304,9 @@ static const struct xpad_device {
296304
{ 0x1bad, 0xfa01, "MadCatz GamePad", 0, XTYPE_XBOX360 },
297305
{ 0x1bad, 0xfd00, "Razer Onza TE", 0, XTYPE_XBOX360 },
298306
{ 0x1bad, 0xfd01, "Razer Onza", 0, XTYPE_XBOX360 },
307+
{ 0x20d6, 0x2001, "BDA Xbox Series X Wired Controller", 0, XTYPE_XBOXONE },
308+
{ 0x20d6, 0x281f, "PowerA Wired Controller For Xbox 360", 0, XTYPE_XBOX360 },
309+
{ 0x2e24, 0x0652, "Hyperkin Duke X-Box One pad", 0, XTYPE_XBOXONE },
299310
{ 0x24c6, 0x5000, "Razer Atrox Arcade Stick", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 },
300311
{ 0x24c6, 0x5300, "PowerA MINI PROEX Controller", 0, XTYPE_XBOX360 },
301312
{ 0x24c6, 0x5303, "Xbox Airflo wired controller", 0, XTYPE_XBOX360 },
@@ -429,8 +440,12 @@ static const struct usb_device_id xpad_table[] = {
429440
XPAD_XBOX360_VENDOR(0x162e), /* Joytech X-Box 360 controllers */
430441
XPAD_XBOX360_VENDOR(0x1689), /* Razer Onza */
431442
XPAD_XBOX360_VENDOR(0x1bad), /* Harminix Rock Band Guitar and Drums */
443+
XPAD_XBOX360_VENDOR(0x20d6), /* PowerA Controllers */
444+
XPAD_XBOXONE_VENDOR(0x20d6), /* PowerA Controllers */
432445
XPAD_XBOX360_VENDOR(0x24c6), /* PowerA Controllers */
433446
XPAD_XBOXONE_VENDOR(0x24c6), /* PowerA Controllers */
447+
XPAD_XBOXONE_VENDOR(0x2e24), /* Hyperkin Duke X-Box One pad */
448+
XPAD_XBOX360_VENDOR(0x2f24), /* GameSir Controllers */
434449
{ }
435450
};
436451

drivers/input/misc/ariel-pwrbutton.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -149,12 +149,6 @@ static const struct of_device_id ariel_pwrbutton_of_match[] = {
149149
};
150150
MODULE_DEVICE_TABLE(of, ariel_pwrbutton_of_match);
151151

152-
static const struct spi_device_id ariel_pwrbutton_id_table[] = {
153-
{ "wyse-ariel-ec-input", 0 },
154-
{}
155-
};
156-
MODULE_DEVICE_TABLE(spi, ariel_pwrbutton_id_table);
157-
158152
static struct spi_driver ariel_pwrbutton_driver = {
159153
.driver = {
160154
.name = "dell-wyse-ariel-ec-input",

drivers/input/serio/i8042-x86ia64io.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,8 @@ static const struct dmi_system_id __initconst i8042_dmi_noloop_table[] = {
219219
DMI_MATCH(DMI_SYS_VENDOR, "PEGATRON CORPORATION"),
220220
DMI_MATCH(DMI_PRODUCT_NAME, "C15B"),
221221
},
222+
},
223+
{
222224
.matches = {
223225
DMI_MATCH(DMI_SYS_VENDOR, "ByteSpeed LLC"),
224226
DMI_MATCH(DMI_PRODUCT_NAME, "ByteSpeed Laptop C15B"),

drivers/input/touchscreen/goodix.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,7 @@ static const struct goodix_chip_id goodix_chip_ids[] = {
157157
{ .id = "5663", .data = &gt1x_chip_data },
158158
{ .id = "5688", .data = &gt1x_chip_data },
159159
{ .id = "917S", .data = &gt1x_chip_data },
160+
{ .id = "9286", .data = &gt1x_chip_data },
160161

161162
{ .id = "911", .data = &gt911_chip_data },
162163
{ .id = "9271", .data = &gt911_chip_data },
@@ -1448,6 +1449,7 @@ static const struct of_device_id goodix_of_match[] = {
14481449
{ .compatible = "goodix,gt927" },
14491450
{ .compatible = "goodix,gt9271" },
14501451
{ .compatible = "goodix,gt928" },
1452+
{ .compatible = "goodix,gt9286" },
14511453
{ .compatible = "goodix,gt967" },
14521454
{ }
14531455
};

drivers/input/touchscreen/ili210x.c

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,13 @@ struct ili2xxx_chip {
2929
void *buf, size_t len);
3030
int (*get_touch_data)(struct i2c_client *client, u8 *data);
3131
bool (*parse_touch_data)(const u8 *data, unsigned int finger,
32-
unsigned int *x, unsigned int *y);
32+
unsigned int *x, unsigned int *y,
33+
unsigned int *z);
3334
bool (*continue_polling)(const u8 *data, bool touch);
3435
unsigned int max_touches;
3536
unsigned int resolution;
3637
bool has_calibrate_reg;
38+
bool has_pressure_reg;
3739
};
3840

3941
struct ili210x {
@@ -82,7 +84,8 @@ static int ili210x_read_touch_data(struct i2c_client *client, u8 *data)
8284

8385
static bool ili210x_touchdata_to_coords(const u8 *touchdata,
8486
unsigned int finger,
85-
unsigned int *x, unsigned int *y)
87+
unsigned int *x, unsigned int *y,
88+
unsigned int *z)
8689
{
8790
if (touchdata[0] & BIT(finger))
8891
return false;
@@ -137,7 +140,8 @@ static int ili211x_read_touch_data(struct i2c_client *client, u8 *data)
137140

138141
static bool ili211x_touchdata_to_coords(const u8 *touchdata,
139142
unsigned int finger,
140-
unsigned int *x, unsigned int *y)
143+
unsigned int *x, unsigned int *y,
144+
unsigned int *z)
141145
{
142146
u32 data;
143147

@@ -169,7 +173,8 @@ static const struct ili2xxx_chip ili211x_chip = {
169173

170174
static bool ili212x_touchdata_to_coords(const u8 *touchdata,
171175
unsigned int finger,
172-
unsigned int *x, unsigned int *y)
176+
unsigned int *x, unsigned int *y,
177+
unsigned int *z)
173178
{
174179
u16 val;
175180

@@ -235,7 +240,8 @@ static int ili251x_read_touch_data(struct i2c_client *client, u8 *data)
235240

236241
static bool ili251x_touchdata_to_coords(const u8 *touchdata,
237242
unsigned int finger,
238-
unsigned int *x, unsigned int *y)
243+
unsigned int *x, unsigned int *y,
244+
unsigned int *z)
239245
{
240246
u16 val;
241247

@@ -245,6 +251,7 @@ static bool ili251x_touchdata_to_coords(const u8 *touchdata,
245251

246252
*x = val & 0x3fff;
247253
*y = get_unaligned_be16(touchdata + 1 + (finger * 5) + 2);
254+
*z = touchdata[1 + (finger * 5) + 4];
248255

249256
return true;
250257
}
@@ -261,21 +268,24 @@ static const struct ili2xxx_chip ili251x_chip = {
261268
.continue_polling = ili251x_check_continue_polling,
262269
.max_touches = 10,
263270
.has_calibrate_reg = true,
271+
.has_pressure_reg = true,
264272
};
265273

266274
static bool ili210x_report_events(struct ili210x *priv, u8 *touchdata)
267275
{
268276
struct input_dev *input = priv->input;
269277
int i;
270278
bool contact = false, touch;
271-
unsigned int x = 0, y = 0;
279+
unsigned int x = 0, y = 0, z = 0;
272280

273281
for (i = 0; i < priv->chip->max_touches; i++) {
274-
touch = priv->chip->parse_touch_data(touchdata, i, &x, &y);
282+
touch = priv->chip->parse_touch_data(touchdata, i, &x, &y, &z);
275283

276284
input_mt_slot(input, i);
277285
if (input_mt_report_slot_state(input, MT_TOOL_FINGER, touch)) {
278286
touchscreen_report_pos(input, &priv->prop, x, y, true);
287+
if (priv->chip->has_pressure_reg)
288+
input_report_abs(input, ABS_MT_PRESSURE, z);
279289
contact = true;
280290
}
281291
}
@@ -437,6 +447,8 @@ static int ili210x_i2c_probe(struct i2c_client *client,
437447
max_xy = (chip->resolution ?: SZ_64K) - 1;
438448
input_set_abs_params(input, ABS_MT_POSITION_X, 0, max_xy, 0, 0);
439449
input_set_abs_params(input, ABS_MT_POSITION_Y, 0, max_xy, 0, 0);
450+
if (priv->chip->has_pressure_reg)
451+
input_set_abs_params(input, ABS_MT_PRESSURE, 0, 0xa, 0, 0);
440452
touchscreen_parse_properties(input, true, &priv->prop);
441453

442454
error = input_mt_init_slots(input, priv->chip->max_touches,

drivers/input/touchscreen/st1232.c

Lines changed: 42 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,20 @@
2626
#define ST1232_TS_NAME "st1232-ts"
2727
#define ST1633_TS_NAME "st1633-ts"
2828

29+
#define REG_STATUS 0x01 /* Device Status | Error Code */
30+
31+
#define STATUS_NORMAL 0x00
32+
#define STATUS_INIT 0x01
33+
#define STATUS_ERROR 0x02
34+
#define STATUS_AUTO_TUNING 0x03
35+
#define STATUS_IDLE 0x04
36+
#define STATUS_POWER_DOWN 0x05
37+
38+
#define ERROR_NONE 0x00
39+
#define ERROR_INVALID_ADDRESS 0x10
40+
#define ERROR_INVALID_VALUE 0x20
41+
#define ERROR_INVALID_PLATFORM 0x30
42+
2943
#define REG_XY_RESOLUTION 0x04
3044
#define REG_XY_COORDINATES 0x12
3145
#define ST_TS_MAX_FINGERS 10
@@ -47,7 +61,8 @@ struct st1232_ts_data {
4761
u8 *read_buf;
4862
};
4963

50-
static int st1232_ts_read_data(struct st1232_ts_data *ts, u8 reg)
64+
static int st1232_ts_read_data(struct st1232_ts_data *ts, u8 reg,
65+
unsigned int n)
5166
{
5267
struct i2c_client *client = ts->client;
5368
struct i2c_msg msg[] = {
@@ -59,7 +74,7 @@ static int st1232_ts_read_data(struct st1232_ts_data *ts, u8 reg)
5974
{
6075
.addr = client->addr,
6176
.flags = I2C_M_RD | I2C_M_DMA_SAFE,
62-
.len = ts->read_buf_len,
77+
.len = n,
6378
.buf = ts->read_buf,
6479
}
6580
};
@@ -72,21 +87,37 @@ static int st1232_ts_read_data(struct st1232_ts_data *ts, u8 reg)
7287
return 0;
7388
}
7489

90+
static int st1232_ts_wait_ready(struct st1232_ts_data *ts)
91+
{
92+
unsigned int retries;
93+
int error;
94+
95+
for (retries = 10; retries; retries--) {
96+
error = st1232_ts_read_data(ts, REG_STATUS, 1);
97+
if (!error && ts->read_buf[0] == (STATUS_NORMAL | ERROR_NONE))
98+
return 0;
99+
100+
usleep_range(1000, 2000);
101+
}
102+
103+
return -ENXIO;
104+
}
105+
75106
static int st1232_ts_read_resolution(struct st1232_ts_data *ts, u16 *max_x,
76107
u16 *max_y)
77108
{
78109
u8 *buf;
79110
int error;
80111

81112
/* select resolution register */
82-
error = st1232_ts_read_data(ts, REG_XY_RESOLUTION);
113+
error = st1232_ts_read_data(ts, REG_XY_RESOLUTION, 3);
83114
if (error)
84115
return error;
85116

86117
buf = ts->read_buf;
87118

88-
*max_x = ((buf[0] & 0x0070) << 4) | buf[1];
89-
*max_y = ((buf[0] & 0x0007) << 8) | buf[2];
119+
*max_x = (((buf[0] & 0x0070) << 4) | buf[1]) - 1;
120+
*max_y = (((buf[0] & 0x0007) << 8) | buf[2]) - 1;
90121

91122
return 0;
92123
}
@@ -140,7 +171,7 @@ static irqreturn_t st1232_ts_irq_handler(int irq, void *dev_id)
140171
int count;
141172
int error;
142173

143-
error = st1232_ts_read_data(ts, REG_XY_COORDINATES);
174+
error = st1232_ts_read_data(ts, REG_XY_COORDINATES, ts->read_buf_len);
144175
if (error)
145176
goto out;
146177

@@ -251,6 +282,11 @@ static int st1232_ts_probe(struct i2c_client *client,
251282
input_dev->name = "st1232-touchscreen";
252283
input_dev->id.bustype = BUS_I2C;
253284

285+
/* Wait until device is ready */
286+
error = st1232_ts_wait_ready(ts);
287+
if (error)
288+
return error;
289+
254290
/* Read resolution from the chip */
255291
error = st1232_ts_read_resolution(ts, &max_x, &max_y);
256292
if (error) {

0 commit comments

Comments
 (0)