Commit db70e26e authored by Linus Torvalds's avatar Linus Torvalds

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
parents 54654e14 3dbae155
Ilitek ILI210x/ILI2117/ILI251x touchscreen controller Ilitek ILI210x/ILI2117/ILI2120/ILI251x touchscreen controller
Required properties: Required properties:
- compatible: - compatible:
ilitek,ili210x for ILI210x ilitek,ili210x for ILI210x
ilitek,ili2117 for ILI2117 ilitek,ili2117 for ILI2117
ilitek,ili2120 for ILI2120
ilitek,ili251x for ILI251x ilitek,ili251x for ILI251x
- reg: The I2C address of the device - reg: The I2C address of the device
......
...@@ -30,7 +30,7 @@ struct event_dev { ...@@ -30,7 +30,7 @@ struct event_dev {
struct input_dev *input; struct input_dev *input;
int irq; int irq;
void __iomem *addr; void __iomem *addr;
char name[0]; char name[];
}; };
static irqreturn_t events_interrupt(int irq, void *dev_id) static irqreturn_t events_interrupt(int irq, void *dev_id)
......
...@@ -55,7 +55,7 @@ struct gpio_keys_drvdata { ...@@ -55,7 +55,7 @@ struct gpio_keys_drvdata {
struct input_dev *input; struct input_dev *input;
struct mutex disable_lock; struct mutex disable_lock;
unsigned short *keymap; unsigned short *keymap;
struct gpio_button_data data[0]; struct gpio_button_data data[];
}; };
/* /*
......
...@@ -38,7 +38,7 @@ struct gpio_keys_polled_dev { ...@@ -38,7 +38,7 @@ struct gpio_keys_polled_dev {
const struct gpio_keys_platform_data *pdata; const struct gpio_keys_platform_data *pdata;
unsigned long rel_axis_seen[BITS_TO_LONGS(REL_CNT)]; unsigned long rel_axis_seen[BITS_TO_LONGS(REL_CNT)];
unsigned long abs_axis_seen[BITS_TO_LONGS(ABS_CNT)]; unsigned long abs_axis_seen[BITS_TO_LONGS(ABS_CNT)];
struct gpio_keys_button_data data[0]; struct gpio_keys_button_data data[];
}; };
static void gpio_keys_button_event(struct input_dev *input, static void gpio_keys_button_event(struct input_dev *input,
......
...@@ -33,7 +33,7 @@ MODULE_DEVICE_TABLE(i2c, tca6416_id); ...@@ -33,7 +33,7 @@ MODULE_DEVICE_TABLE(i2c, tca6416_id);
struct tca6416_drv_data { struct tca6416_drv_data {
struct input_dev *input; struct input_dev *input;
struct tca6416_button data[0]; struct tca6416_button data[];
}; };
struct tca6416_keypad_chip { struct tca6416_keypad_chip {
...@@ -48,7 +48,7 @@ struct tca6416_keypad_chip { ...@@ -48,7 +48,7 @@ struct tca6416_keypad_chip {
int irqnum; int irqnum;
u16 pinmask; u16 pinmask;
bool use_polling; bool use_polling;
struct tca6416_button buttons[0]; struct tca6416_button buttons[];
}; };
static int tca6416_write_reg(struct tca6416_keypad_chip *chip, int reg, u16 val) static int tca6416_write_reg(struct tca6416_keypad_chip *chip, int reg, u16 val)
......
...@@ -250,7 +250,7 @@ struct cyapa_tsg_bin_image_data_record { ...@@ -250,7 +250,7 @@ struct cyapa_tsg_bin_image_data_record {
struct cyapa_tsg_bin_image { struct cyapa_tsg_bin_image {
struct cyapa_tsg_bin_image_head image_head; struct cyapa_tsg_bin_image_head image_head;
struct cyapa_tsg_bin_image_data_record records[0]; struct cyapa_tsg_bin_image_data_record records[];
} __packed; } __packed;
struct pip_bl_packet_start { struct pip_bl_packet_start {
...@@ -271,7 +271,7 @@ struct pip_bl_cmd_head { ...@@ -271,7 +271,7 @@ struct pip_bl_cmd_head {
u8 report_id; /* Bootloader output report id, must be 40h */ u8 report_id; /* Bootloader output report id, must be 40h */
u8 rsvd; /* Reserved, must be 0 */ u8 rsvd; /* Reserved, must be 0 */
struct pip_bl_packet_start packet_start; struct pip_bl_packet_start packet_start;
u8 data[0]; /* Command data variable based on commands */ u8 data[]; /* Command data variable based on commands */
} __packed; } __packed;
/* Initiate bootload command data structure. */ /* Initiate bootload command data structure. */
...@@ -300,7 +300,7 @@ struct tsg_bl_metadata_row_params { ...@@ -300,7 +300,7 @@ struct tsg_bl_metadata_row_params {
struct tsg_bl_flash_row_head { struct tsg_bl_flash_row_head {
u8 flash_array_id; u8 flash_array_id;
__le16 flash_row_id; __le16 flash_row_id;
u8 flash_data[0]; u8 flash_data[];
} __packed; } __packed;
struct pip_app_cmd_head { struct pip_app_cmd_head {
...@@ -314,7 +314,7 @@ struct pip_app_cmd_head { ...@@ -314,7 +314,7 @@ struct pip_app_cmd_head {
* Bit 6-0: command code. * Bit 6-0: command code.
*/ */
u8 cmd_code; u8 cmd_code;
u8 parameter_data[0]; /* Parameter data variable based on cmd_code */ u8 parameter_data[]; /* Parameter data variable based on cmd_code */
} __packed; } __packed;
/* Application get/set parameter command data structure */ /* Application get/set parameter command data structure */
......
...@@ -190,6 +190,7 @@ static int psmouse_smbus_create_companion(struct device *dev, void *data) ...@@ -190,6 +190,7 @@ static int psmouse_smbus_create_companion(struct device *dev, void *data)
struct psmouse_smbus_dev *smbdev = data; struct psmouse_smbus_dev *smbdev = data;
unsigned short addr_list[] = { smbdev->board.addr, I2C_CLIENT_END }; unsigned short addr_list[] = { smbdev->board.addr, I2C_CLIENT_END };
struct i2c_adapter *adapter; struct i2c_adapter *adapter;
struct i2c_client *client;
adapter = i2c_verify_adapter(dev); adapter = i2c_verify_adapter(dev);
if (!adapter) if (!adapter)
...@@ -198,12 +199,13 @@ static int psmouse_smbus_create_companion(struct device *dev, void *data) ...@@ -198,12 +199,13 @@ static int psmouse_smbus_create_companion(struct device *dev, void *data)
if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_HOST_NOTIFY)) if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_HOST_NOTIFY))
return 0; return 0;
smbdev->client = i2c_new_probed_device(adapter, &smbdev->board, client = i2c_new_scanned_device(adapter, &smbdev->board,
addr_list, NULL); addr_list, NULL);
if (!smbdev->client) if (IS_ERR(client))
return 0; return 0;
/* We have our(?) device, stop iterating i2c bus. */ /* We have our(?) device, stop iterating i2c bus. */
smbdev->client = client;
return 1; return 1;
} }
......
...@@ -146,7 +146,6 @@ static const char * const topbuttonpad_pnp_ids[] = { ...@@ -146,7 +146,6 @@ static const char * const topbuttonpad_pnp_ids[] = {
"LEN0042", /* Yoga */ "LEN0042", /* Yoga */
"LEN0045", "LEN0045",
"LEN0047", "LEN0047",
"LEN0049",
"LEN2000", /* S540 */ "LEN2000", /* S540 */
"LEN2001", /* Edge E431 */ "LEN2001", /* Edge E431 */
"LEN2002", /* Edge E531 */ "LEN2002", /* Edge E531 */
...@@ -166,9 +165,11 @@ static const char * const smbus_pnp_ids[] = { ...@@ -166,9 +165,11 @@ static const char * const smbus_pnp_ids[] = {
/* all of the topbuttonpad_pnp_ids are valid, we just add some extras */ /* all of the topbuttonpad_pnp_ids are valid, we just add some extras */
"LEN0048", /* X1 Carbon 3 */ "LEN0048", /* X1 Carbon 3 */
"LEN0046", /* X250 */ "LEN0046", /* X250 */
"LEN0049", /* Yoga 11e */
"LEN004a", /* W541 */ "LEN004a", /* W541 */
"LEN005b", /* P50 */ "LEN005b", /* P50 */
"LEN005e", /* T560 */ "LEN005e", /* T560 */
"LEN006c", /* T470s */
"LEN0071", /* T480 */ "LEN0071", /* T480 */
"LEN0072", /* X1 Carbon Gen 5 (2017) - Elan/ALPS trackpoint */ "LEN0072", /* X1 Carbon Gen 5 (2017) - Elan/ALPS trackpoint */
"LEN0073", /* X1 Carbon G5 (Elantech) */ "LEN0073", /* X1 Carbon G5 (Elantech) */
...@@ -179,6 +180,7 @@ static const char * const smbus_pnp_ids[] = { ...@@ -179,6 +180,7 @@ static const char * const smbus_pnp_ids[] = {
"LEN0097", /* X280 -> ALPS trackpoint */ "LEN0097", /* X280 -> ALPS trackpoint */
"LEN009b", /* T580 */ "LEN009b", /* T580 */
"LEN200f", /* T450s */ "LEN200f", /* T450s */
"LEN2044", /* L470 */
"LEN2054", /* E480 */ "LEN2054", /* E480 */
"LEN2055", /* E580 */ "LEN2055", /* E580 */
"SYN3052", /* HP EliteBook 840 G4 */ "SYN3052", /* HP EliteBook 840 G4 */
......
...@@ -167,6 +167,36 @@ static const struct ili2xxx_chip ili211x_chip = { ...@@ -167,6 +167,36 @@ static const struct ili2xxx_chip ili211x_chip = {
.resolution = 2048, .resolution = 2048,
}; };
static bool ili212x_touchdata_to_coords(const u8 *touchdata,
unsigned int finger,
unsigned int *x, unsigned int *y)
{
u16 val;
val = get_unaligned_be16(touchdata + 3 + (finger * 5) + 0);
if (!(val & BIT(15))) /* Touch indication */
return false;
*x = val & 0x3fff;
*y = get_unaligned_be16(touchdata + 3 + (finger * 5) + 2);
return true;
}
static bool ili212x_check_continue_polling(const u8 *data, bool touch)
{
return touch;
}
static const struct ili2xxx_chip ili212x_chip = {
.read_reg = ili210x_read_reg,
.get_touch_data = ili210x_read_touch_data,
.parse_touch_data = ili212x_touchdata_to_coords,
.continue_polling = ili212x_check_continue_polling,
.max_touches = 10,
.has_calibrate_reg = true,
};
static int ili251x_read_reg(struct i2c_client *client, static int ili251x_read_reg(struct i2c_client *client,
u8 reg, void *buf, size_t len) u8 reg, void *buf, size_t len)
{ {
...@@ -321,7 +351,7 @@ static umode_t ili210x_calibrate_visible(struct kobject *kobj, ...@@ -321,7 +351,7 @@ static umode_t ili210x_calibrate_visible(struct kobject *kobj,
struct i2c_client *client = to_i2c_client(dev); struct i2c_client *client = to_i2c_client(dev);
struct ili210x *priv = i2c_get_clientdata(client); struct ili210x *priv = i2c_get_clientdata(client);
return priv->chip->has_calibrate_reg; return priv->chip->has_calibrate_reg ? attr->mode : 0;
} }
static const struct attribute_group ili210x_attr_group = { static const struct attribute_group ili210x_attr_group = {
...@@ -447,6 +477,7 @@ static int ili210x_i2c_probe(struct i2c_client *client, ...@@ -447,6 +477,7 @@ static int ili210x_i2c_probe(struct i2c_client *client,
static const struct i2c_device_id ili210x_i2c_id[] = { static const struct i2c_device_id ili210x_i2c_id[] = {
{ "ili210x", (long)&ili210x_chip }, { "ili210x", (long)&ili210x_chip },
{ "ili2117", (long)&ili211x_chip }, { "ili2117", (long)&ili211x_chip },
{ "ili2120", (long)&ili212x_chip },
{ "ili251x", (long)&ili251x_chip }, { "ili251x", (long)&ili251x_chip },
{ } { }
}; };
...@@ -455,6 +486,7 @@ MODULE_DEVICE_TABLE(i2c, ili210x_i2c_id); ...@@ -455,6 +486,7 @@ MODULE_DEVICE_TABLE(i2c, ili210x_i2c_id);
static const struct of_device_id ili210x_dt_ids[] = { static const struct of_device_id ili210x_dt_ids[] = {
{ .compatible = "ilitek,ili210x", .data = &ili210x_chip }, { .compatible = "ilitek,ili210x", .data = &ili210x_chip },
{ .compatible = "ilitek,ili2117", .data = &ili211x_chip }, { .compatible = "ilitek,ili2117", .data = &ili211x_chip },
{ .compatible = "ilitek,ili2120", .data = &ili212x_chip },
{ .compatible = "ilitek,ili251x", .data = &ili251x_chip }, { .compatible = "ilitek,ili251x", .data = &ili251x_chip },
{ } { }
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment