Skip to content

Commit 643e69a

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: - a fix for cm109 stomping on its own control URB if it tries to toggle buzzer immediately after userspace opens input device (found by syzcaller) - another fix for Raydium touchscreens that do not like splitting command transfers - quirks for i8042, soc_button_array, and goodix drivers to make them work better with certain hardware. * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input: Input: goodix - add upside-down quirk for Teclast X98 Pro tablet Input: cm109 - do not stomp on control URB Input: i8042 - add Acer laptops to the i8042 reset list Input: cros_ec_keyb - send 'scancodes' in addition to key events Input: soc_button_array - add Lenovo Yoga Tablet2 1051L to the dmi_use_low_level_irq list Input: raydium_ts_i2c - do not split tx transactions
2 parents 7f376f1 + cffdd6d commit 643e69a

File tree

6 files changed

+159
-40
lines changed

6 files changed

+159
-40
lines changed

drivers/input/keyboard/cros_ec_keyb.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,7 @@ static void cros_ec_keyb_process(struct cros_ec_keyb *ckdev,
183183
"changed: [r%d c%d]: byte %02x\n",
184184
row, col, new_state);
185185

186+
input_event(idev, EV_MSC, MSC_SCAN, pos);
186187
input_report_key(idev, keycodes[pos],
187188
new_state);
188189
}

drivers/input/misc/cm109.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -568,12 +568,15 @@ static int cm109_input_open(struct input_dev *idev)
568568
dev->ctl_data->byte[HID_OR2] = dev->keybit;
569569
dev->ctl_data->byte[HID_OR3] = 0x00;
570570

571+
dev->ctl_urb_pending = 1;
571572
error = usb_submit_urb(dev->urb_ctl, GFP_KERNEL);
572-
if (error)
573+
if (error) {
574+
dev->ctl_urb_pending = 0;
573575
dev_err(&dev->intf->dev, "%s: usb_submit_urb (urb_ctl) failed %d\n",
574576
__func__, error);
575-
else
577+
} else {
576578
dev->open = 1;
579+
}
577580

578581
mutex_unlock(&dev->pm_mutex);
579582

drivers/input/misc/soc_button_array.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,17 @@ static const struct dmi_system_id dmi_use_low_level_irq[] = {
8383
DMI_MATCH(DMI_PRODUCT_NAME, "One S1003"),
8484
},
8585
},
86+
{
87+
/*
88+
* Lenovo Yoga Tab2 1051L, something messes with the home-button
89+
* IRQ settings, leading to a non working home-button.
90+
*/
91+
.matches = {
92+
DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
93+
DMI_MATCH(DMI_PRODUCT_NAME, "60073"),
94+
DMI_MATCH(DMI_PRODUCT_VERSION, "1051L"),
95+
},
96+
},
8697
{} /* Terminating entry */
8798
};
8899

drivers/input/serio/i8042-x86ia64io.h

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -611,6 +611,48 @@ static const struct dmi_system_id __initconst i8042_dmi_reset_table[] = {
611611
DMI_MATCH(DMI_PRODUCT_NAME, "AOA150"),
612612
},
613613
},
614+
{
615+
.matches = {
616+
DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
617+
DMI_MATCH(DMI_PRODUCT_NAME, "Aspire A114-31"),
618+
},
619+
},
620+
{
621+
.matches = {
622+
DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
623+
DMI_MATCH(DMI_PRODUCT_NAME, "Aspire A314-31"),
624+
},
625+
},
626+
{
627+
.matches = {
628+
DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
629+
DMI_MATCH(DMI_PRODUCT_NAME, "Aspire A315-31"),
630+
},
631+
},
632+
{
633+
.matches = {
634+
DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
635+
DMI_MATCH(DMI_PRODUCT_NAME, "Aspire ES1-132"),
636+
},
637+
},
638+
{
639+
.matches = {
640+
DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
641+
DMI_MATCH(DMI_PRODUCT_NAME, "Aspire ES1-332"),
642+
},
643+
},
644+
{
645+
.matches = {
646+
DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
647+
DMI_MATCH(DMI_PRODUCT_NAME, "Aspire ES1-432"),
648+
},
649+
},
650+
{
651+
.matches = {
652+
DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
653+
DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate Spin B118-RN"),
654+
},
655+
},
614656
{
615657
/* Advent 4211 */
616658
.matches = {

drivers/input/touchscreen/goodix.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,18 @@ static const struct dmi_system_id rotated_screen[] = {
192192
DMI_MATCH(DMI_BIOS_DATE, "12/19/2014"),
193193
},
194194
},
195+
{
196+
.ident = "Teclast X98 Pro",
197+
.matches = {
198+
/*
199+
* Only match BIOS date, because the manufacturers
200+
* BIOS does not report the board name at all
201+
* (sometimes)...
202+
*/
203+
DMI_MATCH(DMI_BOARD_VENDOR, "TECLAST"),
204+
DMI_MATCH(DMI_BIOS_DATE, "10/28/2015"),
205+
},
206+
},
195207
{
196208
.ident = "WinBook TW100",
197209
.matches = {

drivers/input/touchscreen/raydium_i2c_ts.c

Lines changed: 88 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -137,45 +137,25 @@ struct raydium_data {
137137
bool wake_irq_enabled;
138138
};
139139

140-
static int raydium_i2c_xfer(struct i2c_client *client,
141-
u32 addr, void *data, size_t len, bool is_read)
142-
{
143-
struct raydium_bank_switch_header {
144-
u8 cmd;
145-
__be32 be_addr;
146-
} __packed header = {
147-
.cmd = RM_CMD_BANK_SWITCH,
148-
.be_addr = cpu_to_be32(addr),
149-
};
150-
151-
u8 reg_addr = addr & 0xff;
152-
153-
struct i2c_msg xfer[] = {
154-
{
155-
.addr = client->addr,
156-
.len = sizeof(header),
157-
.buf = (u8 *)&header,
158-
},
159-
{
160-
.addr = client->addr,
161-
.len = 1,
162-
.buf = &reg_addr,
163-
},
164-
{
165-
.addr = client->addr,
166-
.len = len,
167-
.buf = data,
168-
.flags = is_read ? I2C_M_RD : 0,
169-
}
170-
};
140+
/*
141+
* Header to be sent for RM_CMD_BANK_SWITCH command. This is used by
142+
* raydium_i2c_{read|send} below.
143+
*/
144+
struct __packed raydium_bank_switch_header {
145+
u8 cmd;
146+
__be32 be_addr;
147+
};
171148

149+
static int raydium_i2c_xfer(struct i2c_client *client, u32 addr,
150+
struct i2c_msg *xfer, size_t xfer_count)
151+
{
152+
int ret;
172153
/*
173154
* If address is greater than 255, then RM_CMD_BANK_SWITCH needs to be
174155
* sent first. Else, skip the header i.e. xfer[0].
175156
*/
176157
int xfer_start_idx = (addr > 0xff) ? 0 : 1;
177-
size_t xfer_count = ARRAY_SIZE(xfer) - xfer_start_idx;
178-
int ret;
158+
xfer_count -= xfer_start_idx;
179159

180160
ret = i2c_transfer(client->adapter, &xfer[xfer_start_idx], xfer_count);
181161
if (likely(ret == xfer_count))
@@ -189,10 +169,46 @@ static int raydium_i2c_send(struct i2c_client *client,
189169
{
190170
int tries = 0;
191171
int error;
172+
u8 *tx_buf;
173+
u8 reg_addr = addr & 0xff;
174+
175+
tx_buf = kmalloc(len + 1, GFP_KERNEL);
176+
if (!tx_buf)
177+
return -ENOMEM;
178+
179+
tx_buf[0] = reg_addr;
180+
memcpy(tx_buf + 1, data, len);
192181

193182
do {
194-
error = raydium_i2c_xfer(client, addr, (void *)data, len,
195-
false);
183+
struct raydium_bank_switch_header header = {
184+
.cmd = RM_CMD_BANK_SWITCH,
185+
.be_addr = cpu_to_be32(addr),
186+
};
187+
188+
/*
189+
* Perform as a single i2c_transfer transaction to ensure that
190+
* no other I2C transactions are initiated on the bus to any
191+
* other device in between. Initiating transacations to other
192+
* devices after RM_CMD_BANK_SWITCH is sent is known to cause
193+
* issues. This is also why regmap infrastructure cannot be used
194+
* for this driver. Regmap handles page(bank) switch and reads
195+
* as separate i2c_transfer() operations. This can result in
196+
* problems if the Raydium device is on a shared I2C bus.
197+
*/
198+
struct i2c_msg xfer[] = {
199+
{
200+
.addr = client->addr,
201+
.len = sizeof(header),
202+
.buf = (u8 *)&header,
203+
},
204+
{
205+
.addr = client->addr,
206+
.len = len + 1,
207+
.buf = tx_buf,
208+
},
209+
};
210+
211+
error = raydium_i2c_xfer(client, addr, xfer, ARRAY_SIZE(xfer));
196212
if (likely(!error))
197213
return 0;
198214

@@ -206,12 +222,46 @@ static int raydium_i2c_send(struct i2c_client *client,
206222
static int raydium_i2c_read(struct i2c_client *client,
207223
u32 addr, void *data, size_t len)
208224
{
209-
size_t xfer_len;
210225
int error;
211226

212227
while (len) {
213-
xfer_len = min_t(size_t, len, RM_MAX_READ_SIZE);
214-
error = raydium_i2c_xfer(client, addr, data, xfer_len, true);
228+
u8 reg_addr = addr & 0xff;
229+
struct raydium_bank_switch_header header = {
230+
.cmd = RM_CMD_BANK_SWITCH,
231+
.be_addr = cpu_to_be32(addr),
232+
};
233+
size_t xfer_len = min_t(size_t, len, RM_MAX_READ_SIZE);
234+
235+
/*
236+
* Perform as a single i2c_transfer transaction to ensure that
237+
* no other I2C transactions are initiated on the bus to any
238+
* other device in between. Initiating transacations to other
239+
* devices after RM_CMD_BANK_SWITCH is sent is known to cause
240+
* issues. This is also why regmap infrastructure cannot be used
241+
* for this driver. Regmap handles page(bank) switch and writes
242+
* as separate i2c_transfer() operations. This can result in
243+
* problems if the Raydium device is on a shared I2C bus.
244+
*/
245+
struct i2c_msg xfer[] = {
246+
{
247+
.addr = client->addr,
248+
.len = sizeof(header),
249+
.buf = (u8 *)&header,
250+
},
251+
{
252+
.addr = client->addr,
253+
.len = 1,
254+
.buf = &reg_addr,
255+
},
256+
{
257+
.addr = client->addr,
258+
.len = xfer_len,
259+
.buf = data,
260+
.flags = I2C_M_RD,
261+
}
262+
};
263+
264+
error = raydium_i2c_xfer(client, addr, xfer, ARRAY_SIZE(xfer));
215265
if (unlikely(error))
216266
return error;
217267

0 commit comments

Comments
 (0)