Skip to content

Commit 2946369

Browse files
committed
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input
Pull input subsystem fixes from Dmitry Torokhov: "Updates to Synaptics touchpad to better cope with devices in Lenovo laptops, and a couple more fixes" * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input: Input: synaptics - add manual min/max quirk for ThinkPad X240 Input: synaptics - add manual min/max quirk Input: cypress_ps2 - don't report as a button pads Input: da9052_onkey - use correct register bit for key status Input: adp5588-keys - get value from data out when dir is out
2 parents 1fac1fa + 8a0435d commit 2946369

File tree

4 files changed

+82
-15
lines changed

4 files changed

+82
-15
lines changed

drivers/input/keyboard/adp5588-keys.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,18 @@ static int adp5588_gpio_get_value(struct gpio_chip *chip, unsigned off)
7676
struct adp5588_kpad *kpad = container_of(chip, struct adp5588_kpad, gc);
7777
unsigned int bank = ADP5588_BANK(kpad->gpiomap[off]);
7878
unsigned int bit = ADP5588_BIT(kpad->gpiomap[off]);
79+
int val;
7980

80-
return !!(adp5588_read(kpad->client, GPIO_DAT_STAT1 + bank) & bit);
81+
mutex_lock(&kpad->gpio_lock);
82+
83+
if (kpad->dir[bank] & bit)
84+
val = kpad->dat_out[bank];
85+
else
86+
val = adp5588_read(kpad->client, GPIO_DAT_STAT1 + bank);
87+
88+
mutex_unlock(&kpad->gpio_lock);
89+
90+
return !!(val & bit);
8191
}
8292

8393
static void adp5588_gpio_set_value(struct gpio_chip *chip,

drivers/input/misc/da9052_onkey.c

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -27,29 +27,32 @@ struct da9052_onkey {
2727

2828
static void da9052_onkey_query(struct da9052_onkey *onkey)
2929
{
30-
int key_stat;
30+
int ret;
3131

32-
key_stat = da9052_reg_read(onkey->da9052, DA9052_EVENT_B_REG);
33-
if (key_stat < 0) {
32+
ret = da9052_reg_read(onkey->da9052, DA9052_STATUS_A_REG);
33+
if (ret < 0) {
3434
dev_err(onkey->da9052->dev,
35-
"Failed to read onkey event %d\n", key_stat);
35+
"Failed to read onkey event err=%d\n", ret);
3636
} else {
3737
/*
3838
* Since interrupt for deassertion of ONKEY pin is not
3939
* generated, onkey event state determines the onkey
4040
* button state.
4141
*/
42-
key_stat &= DA9052_EVENTB_ENONKEY;
43-
input_report_key(onkey->input, KEY_POWER, key_stat);
42+
bool pressed = !(ret & DA9052_STATUSA_NONKEY);
43+
44+
input_report_key(onkey->input, KEY_POWER, pressed);
4445
input_sync(onkey->input);
45-
}
4646

47-
/*
48-
* Interrupt is generated only when the ONKEY pin is asserted.
49-
* Hence the deassertion of the pin is simulated through work queue.
50-
*/
51-
if (key_stat)
52-
schedule_delayed_work(&onkey->work, msecs_to_jiffies(50));
47+
/*
48+
* Interrupt is generated only when the ONKEY pin
49+
* is asserted. Hence the deassertion of the pin
50+
* is simulated through work queue.
51+
*/
52+
if (pressed)
53+
schedule_delayed_work(&onkey->work,
54+
msecs_to_jiffies(50));
55+
}
5356
}
5457

5558
static void da9052_onkey_work(struct work_struct *work)

drivers/input/mouse/cypress_ps2.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,6 @@ static int cypress_set_input_params(struct input_dev *input,
409409
__clear_bit(REL_X, input->relbit);
410410
__clear_bit(REL_Y, input->relbit);
411411

412-
__set_bit(INPUT_PROP_BUTTONPAD, input->propbit);
413412
__set_bit(EV_KEY, input->evbit);
414413
__set_bit(BTN_LEFT, input->keybit);
415414
__set_bit(BTN_RIGHT, input->keybit);

drivers/input/mouse/synaptics.c

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,11 +265,22 @@ static int synaptics_identify(struct psmouse *psmouse)
265265
* Read touchpad resolution and maximum reported coordinates
266266
* Resolution is left zero if touchpad does not support the query
267267
*/
268+
269+
static const int *quirk_min_max;
270+
268271
static int synaptics_resolution(struct psmouse *psmouse)
269272
{
270273
struct synaptics_data *priv = psmouse->private;
271274
unsigned char resp[3];
272275

276+
if (quirk_min_max) {
277+
priv->x_min = quirk_min_max[0];
278+
priv->x_max = quirk_min_max[1];
279+
priv->y_min = quirk_min_max[2];
280+
priv->y_max = quirk_min_max[3];
281+
return 0;
282+
}
283+
273284
if (SYN_ID_MAJOR(priv->identity) < 4)
274285
return 0;
275286

@@ -1485,10 +1496,54 @@ static const struct dmi_system_id olpc_dmi_table[] __initconst = {
14851496
{ }
14861497
};
14871498

1499+
static const struct dmi_system_id min_max_dmi_table[] __initconst = {
1500+
#if defined(CONFIG_DMI)
1501+
{
1502+
/* Lenovo ThinkPad Helix */
1503+
.matches = {
1504+
DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
1505+
DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad Helix"),
1506+
},
1507+
.driver_data = (int []){1024, 5052, 2258, 4832},
1508+
},
1509+
{
1510+
/* Lenovo ThinkPad X240 */
1511+
.matches = {
1512+
DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
1513+
DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad X240"),
1514+
},
1515+
.driver_data = (int []){1232, 5710, 1156, 4696},
1516+
},
1517+
{
1518+
/* Lenovo ThinkPad T440s */
1519+
.matches = {
1520+
DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
1521+
DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad T440"),
1522+
},
1523+
.driver_data = (int []){1024, 5112, 2024, 4832},
1524+
},
1525+
{
1526+
/* Lenovo ThinkPad T540p */
1527+
.matches = {
1528+
DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
1529+
DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad T540"),
1530+
},
1531+
.driver_data = (int []){1024, 5056, 2058, 4832},
1532+
},
1533+
#endif
1534+
{ }
1535+
};
1536+
14881537
void __init synaptics_module_init(void)
14891538
{
1539+
const struct dmi_system_id *min_max_dmi;
1540+
14901541
impaired_toshiba_kbc = dmi_check_system(toshiba_dmi_table);
14911542
broken_olpc_ec = dmi_check_system(olpc_dmi_table);
1543+
1544+
min_max_dmi = dmi_first_match(min_max_dmi_table);
1545+
if (min_max_dmi)
1546+
quirk_min_max = min_max_dmi->driver_data;
14921547
}
14931548

14941549
static int __synaptics_init(struct psmouse *psmouse, bool absolute_mode)

0 commit comments

Comments
 (0)