mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-05-24 10:39:52 +00:00
Input: elantech/SMBus - export all capabilities from the PS/2 node
The recent touchpads might not have all the information regarding the characteristics through the I2C port. On some Lenovo t480s, this results in the touchpad not being detected as a clickpad, and on the Lenovo P52, this results in a failure while fetching the resolution through I2C. We need to imitate the Windows behavior: fetch the data under PS/2, and limit the querries under I2C. This patch prepares this by exporting the info from PS/2. Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
This commit is contained in:
parent
e3a9a12906
commit
3abcc5329a
2 changed files with 44 additions and 5 deletions
|
@ -1736,6 +1736,15 @@ static int elantech_query_info(struct psmouse *psmouse,
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
info->width = info->x_max / (traces - 1);
|
info->width = info->x_max / (traces - 1);
|
||||||
|
|
||||||
|
/* column number of traces */
|
||||||
|
info->x_traces = traces;
|
||||||
|
|
||||||
|
/* row number of traces */
|
||||||
|
traces = info->capabilities[2];
|
||||||
|
if ((traces >= 2) && (traces <= info->y_max))
|
||||||
|
info->y_traces = traces;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1781,17 +1790,45 @@ static int elantech_create_smbus(struct psmouse *psmouse,
|
||||||
struct elantech_device_info *info,
|
struct elantech_device_info *info,
|
||||||
bool leave_breadcrumbs)
|
bool leave_breadcrumbs)
|
||||||
{
|
{
|
||||||
const struct property_entry i2c_properties[] = {
|
struct property_entry i2c_props[11] = {};
|
||||||
PROPERTY_ENTRY_BOOL("elan,trackpoint"),
|
|
||||||
{ },
|
|
||||||
};
|
|
||||||
struct i2c_board_info smbus_board = {
|
struct i2c_board_info smbus_board = {
|
||||||
I2C_BOARD_INFO("elan_i2c", 0x15),
|
I2C_BOARD_INFO("elan_i2c", 0x15),
|
||||||
.flags = I2C_CLIENT_HOST_NOTIFY,
|
.flags = I2C_CLIENT_HOST_NOTIFY,
|
||||||
};
|
};
|
||||||
|
unsigned int idx = 0;
|
||||||
|
|
||||||
|
smbus_board.properties = i2c_props;
|
||||||
|
|
||||||
|
i2c_props[idx++] = PROPERTY_ENTRY_U32("touchscreen-size-x",
|
||||||
|
info->x_max + 1);
|
||||||
|
i2c_props[idx++] = PROPERTY_ENTRY_U32("touchscreen-size-y",
|
||||||
|
info->y_max + 1);
|
||||||
|
i2c_props[idx++] = PROPERTY_ENTRY_U32("touchscreen-min-x",
|
||||||
|
info->x_min);
|
||||||
|
i2c_props[idx++] = PROPERTY_ENTRY_U32("touchscreen-min-y",
|
||||||
|
info->y_min);
|
||||||
|
if (info->x_res)
|
||||||
|
i2c_props[idx++] = PROPERTY_ENTRY_U32("touchscreen-x-mm",
|
||||||
|
(info->x_max + 1) / info->x_res);
|
||||||
|
if (info->y_res)
|
||||||
|
i2c_props[idx++] = PROPERTY_ENTRY_U32("touchscreen-y-mm",
|
||||||
|
(info->y_max + 1) / info->y_res);
|
||||||
|
|
||||||
if (info->has_trackpoint)
|
if (info->has_trackpoint)
|
||||||
smbus_board.properties = i2c_properties;
|
i2c_props[idx++] = PROPERTY_ENTRY_BOOL("elan,trackpoint");
|
||||||
|
|
||||||
|
if (info->has_middle_button)
|
||||||
|
i2c_props[idx++] = PROPERTY_ENTRY_BOOL("elan,middle-button");
|
||||||
|
|
||||||
|
if (info->x_traces)
|
||||||
|
i2c_props[idx++] = PROPERTY_ENTRY_U32("elan,x_traces",
|
||||||
|
info->x_traces);
|
||||||
|
if (info->y_traces)
|
||||||
|
i2c_props[idx++] = PROPERTY_ENTRY_U32("elan,y_traces",
|
||||||
|
info->y_traces);
|
||||||
|
|
||||||
|
if (elantech_is_buttonpad(info))
|
||||||
|
i2c_props[idx++] = PROPERTY_ENTRY_BOOL("elan,clickpad");
|
||||||
|
|
||||||
return psmouse_smbus_init(psmouse, &smbus_board, NULL, 0, false,
|
return psmouse_smbus_init(psmouse, &smbus_board, NULL, 0, false,
|
||||||
leave_breadcrumbs);
|
leave_breadcrumbs);
|
||||||
|
|
|
@ -150,6 +150,8 @@ struct elantech_device_info {
|
||||||
unsigned int y_max;
|
unsigned int y_max;
|
||||||
unsigned int x_res;
|
unsigned int x_res;
|
||||||
unsigned int y_res;
|
unsigned int y_res;
|
||||||
|
unsigned int x_traces;
|
||||||
|
unsigned int y_traces;
|
||||||
unsigned int width;
|
unsigned int width;
|
||||||
unsigned int bus;
|
unsigned int bus;
|
||||||
bool paritycheck;
|
bool paritycheck;
|
||||||
|
|
Loading…
Add table
Reference in a new issue