Skip to content

Commit db70e26

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 drivers have been updated to use flexible-array syntax instead of GCC extension - ili210x touchscreen driver now supports the 2120 protocol flavor - a couple more of Synaptics devices have been switched over to RMI4 * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input: Input: cyapa - replace zero-length array with flexible-array member Input: tca6416-keypad - replace zero-length array with flexible-array member Input: gpio_keys_polled - replace zero-length array with flexible-array member Input: synaptics - remove the LEN0049 dmi id from topbuttonpad list Input: synaptics - enable SMBus on ThinkPad L470 Input: synaptics - switch T470s to RMI4 by default Input: gpio_keys - replace zero-length array with flexible-array member Input: goldfish_events - replace zero-length array with flexible-array member Input: psmouse - switch to using i2c_new_scanned_device() Input: ili210x - add ili2120 support Input: ili210x - fix return value of is_visible function
2 parents 54654e1 + 3dbae15 commit db70e26

File tree

9 files changed

+52
-15
lines changed

9 files changed

+52
-15
lines changed

Documentation/devicetree/bindings/input/ilitek,ili2xxx.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
Ilitek ILI210x/ILI2117/ILI251x touchscreen controller
1+
Ilitek ILI210x/ILI2117/ILI2120/ILI251x touchscreen controller
22

33
Required properties:
44
- compatible:
55
ilitek,ili210x for ILI210x
66
ilitek,ili2117 for ILI2117
7+
ilitek,ili2120 for ILI2120
78
ilitek,ili251x for ILI251x
89

910
- reg: The I2C address of the device

drivers/input/keyboard/goldfish_events.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ struct event_dev {
3030
struct input_dev *input;
3131
int irq;
3232
void __iomem *addr;
33-
char name[0];
33+
char name[];
3434
};
3535

3636
static irqreturn_t events_interrupt(int irq, void *dev_id)

drivers/input/keyboard/gpio_keys.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ struct gpio_keys_drvdata {
5555
struct input_dev *input;
5656
struct mutex disable_lock;
5757
unsigned short *keymap;
58-
struct gpio_button_data data[0];
58+
struct gpio_button_data data[];
5959
};
6060

6161
/*

drivers/input/keyboard/gpio_keys_polled.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ struct gpio_keys_polled_dev {
3838
const struct gpio_keys_platform_data *pdata;
3939
unsigned long rel_axis_seen[BITS_TO_LONGS(REL_CNT)];
4040
unsigned long abs_axis_seen[BITS_TO_LONGS(ABS_CNT)];
41-
struct gpio_keys_button_data data[0];
41+
struct gpio_keys_button_data data[];
4242
};
4343

4444
static void gpio_keys_button_event(struct input_dev *input,

drivers/input/keyboard/tca6416-keypad.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ MODULE_DEVICE_TABLE(i2c, tca6416_id);
3333

3434
struct tca6416_drv_data {
3535
struct input_dev *input;
36-
struct tca6416_button data[0];
36+
struct tca6416_button data[];
3737
};
3838

3939
struct tca6416_keypad_chip {
@@ -48,7 +48,7 @@ struct tca6416_keypad_chip {
4848
int irqnum;
4949
u16 pinmask;
5050
bool use_polling;
51-
struct tca6416_button buttons[0];
51+
struct tca6416_button buttons[];
5252
};
5353

5454
static int tca6416_write_reg(struct tca6416_keypad_chip *chip, int reg, u16 val)

drivers/input/mouse/cyapa_gen5.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ struct cyapa_tsg_bin_image_data_record {
250250

251251
struct cyapa_tsg_bin_image {
252252
struct cyapa_tsg_bin_image_head image_head;
253-
struct cyapa_tsg_bin_image_data_record records[0];
253+
struct cyapa_tsg_bin_image_data_record records[];
254254
} __packed;
255255

256256
struct pip_bl_packet_start {
@@ -271,7 +271,7 @@ struct pip_bl_cmd_head {
271271
u8 report_id; /* Bootloader output report id, must be 40h */
272272
u8 rsvd; /* Reserved, must be 0 */
273273
struct pip_bl_packet_start packet_start;
274-
u8 data[0]; /* Command data variable based on commands */
274+
u8 data[]; /* Command data variable based on commands */
275275
} __packed;
276276

277277
/* Initiate bootload command data structure. */
@@ -300,7 +300,7 @@ struct tsg_bl_metadata_row_params {
300300
struct tsg_bl_flash_row_head {
301301
u8 flash_array_id;
302302
__le16 flash_row_id;
303-
u8 flash_data[0];
303+
u8 flash_data[];
304304
} __packed;
305305

306306
struct pip_app_cmd_head {
@@ -314,7 +314,7 @@ struct pip_app_cmd_head {
314314
* Bit 6-0: command code.
315315
*/
316316
u8 cmd_code;
317-
u8 parameter_data[0]; /* Parameter data variable based on cmd_code */
317+
u8 parameter_data[]; /* Parameter data variable based on cmd_code */
318318
} __packed;
319319

320320
/* Application get/set parameter command data structure */

drivers/input/mouse/psmouse-smbus.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,7 @@ static int psmouse_smbus_create_companion(struct device *dev, void *data)
190190
struct psmouse_smbus_dev *smbdev = data;
191191
unsigned short addr_list[] = { smbdev->board.addr, I2C_CLIENT_END };
192192
struct i2c_adapter *adapter;
193+
struct i2c_client *client;
193194

194195
adapter = i2c_verify_adapter(dev);
195196
if (!adapter)
@@ -198,12 +199,13 @@ static int psmouse_smbus_create_companion(struct device *dev, void *data)
198199
if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_HOST_NOTIFY))
199200
return 0;
200201

201-
smbdev->client = i2c_new_probed_device(adapter, &smbdev->board,
202-
addr_list, NULL);
203-
if (!smbdev->client)
202+
client = i2c_new_scanned_device(adapter, &smbdev->board,
203+
addr_list, NULL);
204+
if (IS_ERR(client))
204205
return 0;
205206

206207
/* We have our(?) device, stop iterating i2c bus. */
208+
smbdev->client = client;
207209
return 1;
208210
}
209211

drivers/input/mouse/synaptics.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,6 @@ static const char * const topbuttonpad_pnp_ids[] = {
146146
"LEN0042", /* Yoga */
147147
"LEN0045",
148148
"LEN0047",
149-
"LEN0049",
150149
"LEN2000", /* S540 */
151150
"LEN2001", /* Edge E431 */
152151
"LEN2002", /* Edge E531 */
@@ -166,9 +165,11 @@ static const char * const smbus_pnp_ids[] = {
166165
/* all of the topbuttonpad_pnp_ids are valid, we just add some extras */
167166
"LEN0048", /* X1 Carbon 3 */
168167
"LEN0046", /* X250 */
168+
"LEN0049", /* Yoga 11e */
169169
"LEN004a", /* W541 */
170170
"LEN005b", /* P50 */
171171
"LEN005e", /* T560 */
172+
"LEN006c", /* T470s */
172173
"LEN0071", /* T480 */
173174
"LEN0072", /* X1 Carbon Gen 5 (2017) - Elan/ALPS trackpoint */
174175
"LEN0073", /* X1 Carbon G5 (Elantech) */
@@ -179,6 +180,7 @@ static const char * const smbus_pnp_ids[] = {
179180
"LEN0097", /* X280 -> ALPS trackpoint */
180181
"LEN009b", /* T580 */
181182
"LEN200f", /* T450s */
183+
"LEN2044", /* L470 */
182184
"LEN2054", /* E480 */
183185
"LEN2055", /* E580 */
184186
"SYN3052", /* HP EliteBook 840 G4 */

drivers/input/touchscreen/ili210x.c

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,36 @@ static const struct ili2xxx_chip ili211x_chip = {
167167
.resolution = 2048,
168168
};
169169

170+
static bool ili212x_touchdata_to_coords(const u8 *touchdata,
171+
unsigned int finger,
172+
unsigned int *x, unsigned int *y)
173+
{
174+
u16 val;
175+
176+
val = get_unaligned_be16(touchdata + 3 + (finger * 5) + 0);
177+
if (!(val & BIT(15))) /* Touch indication */
178+
return false;
179+
180+
*x = val & 0x3fff;
181+
*y = get_unaligned_be16(touchdata + 3 + (finger * 5) + 2);
182+
183+
return true;
184+
}
185+
186+
static bool ili212x_check_continue_polling(const u8 *data, bool touch)
187+
{
188+
return touch;
189+
}
190+
191+
static const struct ili2xxx_chip ili212x_chip = {
192+
.read_reg = ili210x_read_reg,
193+
.get_touch_data = ili210x_read_touch_data,
194+
.parse_touch_data = ili212x_touchdata_to_coords,
195+
.continue_polling = ili212x_check_continue_polling,
196+
.max_touches = 10,
197+
.has_calibrate_reg = true,
198+
};
199+
170200
static int ili251x_read_reg(struct i2c_client *client,
171201
u8 reg, void *buf, size_t len)
172202
{
@@ -321,7 +351,7 @@ static umode_t ili210x_calibrate_visible(struct kobject *kobj,
321351
struct i2c_client *client = to_i2c_client(dev);
322352
struct ili210x *priv = i2c_get_clientdata(client);
323353

324-
return priv->chip->has_calibrate_reg;
354+
return priv->chip->has_calibrate_reg ? attr->mode : 0;
325355
}
326356

327357
static const struct attribute_group ili210x_attr_group = {
@@ -447,6 +477,7 @@ static int ili210x_i2c_probe(struct i2c_client *client,
447477
static const struct i2c_device_id ili210x_i2c_id[] = {
448478
{ "ili210x", (long)&ili210x_chip },
449479
{ "ili2117", (long)&ili211x_chip },
480+
{ "ili2120", (long)&ili212x_chip },
450481
{ "ili251x", (long)&ili251x_chip },
451482
{ }
452483
};
@@ -455,6 +486,7 @@ MODULE_DEVICE_TABLE(i2c, ili210x_i2c_id);
455486
static const struct of_device_id ili210x_dt_ids[] = {
456487
{ .compatible = "ilitek,ili210x", .data = &ili210x_chip },
457488
{ .compatible = "ilitek,ili2117", .data = &ili211x_chip },
489+
{ .compatible = "ilitek,ili2120", .data = &ili212x_chip },
458490
{ .compatible = "ilitek,ili251x", .data = &ili251x_chip },
459491
{ }
460492
};

0 commit comments

Comments
 (0)