Skip to content

Commit de88910

Browse files
Marek Vasutdtor
authored andcommitted
Input: ili210x - special case ili251x sample read out
The ili251x touch controller needs 5ms delay between sending I2C device address and register address, and, writing or reading register data. According to downstream ili251x example code, this 5ms delay is not required when reading touch samples out of the controller. Implement such a special case. Signed-off-by: Marek Vasut <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Dmitry Torokhov <[email protected]>
1 parent be896bd commit de88910

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

drivers/input/touchscreen/ili210x.c

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -224,15 +224,17 @@ static const struct ili2xxx_chip ili212x_chip = {
224224
.has_calibrate_reg = true,
225225
};
226226

227-
static int ili251x_read_reg(struct i2c_client *client,
228-
u8 reg, void *buf, size_t len)
227+
static int ili251x_read_reg_common(struct i2c_client *client,
228+
u8 reg, void *buf, size_t len,
229+
unsigned int delay)
229230
{
230231
int error;
231232
int ret;
232233

233234
ret = i2c_master_send(client, &reg, 1);
234235
if (ret == 1) {
235-
usleep_range(5000, 5500);
236+
if (delay)
237+
usleep_range(delay, delay + 500);
236238

237239
ret = i2c_master_recv(client, buf, len);
238240
if (ret == len)
@@ -244,12 +246,18 @@ static int ili251x_read_reg(struct i2c_client *client,
244246
return ret;
245247
}
246248

249+
static int ili251x_read_reg(struct i2c_client *client,
250+
u8 reg, void *buf, size_t len)
251+
{
252+
return ili251x_read_reg_common(client, reg, buf, len, 5000);
253+
}
254+
247255
static int ili251x_read_touch_data(struct i2c_client *client, u8 *data)
248256
{
249257
int error;
250258

251-
error = ili251x_read_reg(client, REG_TOUCHDATA,
252-
data, ILI251X_DATA_SIZE1);
259+
error = ili251x_read_reg_common(client, REG_TOUCHDATA,
260+
data, ILI251X_DATA_SIZE1, 0);
253261
if (!error && data[0] == 2) {
254262
error = i2c_master_recv(client, data + ILI251X_DATA_SIZE1,
255263
ILI251X_DATA_SIZE2);

0 commit comments

Comments
 (0)