mirror of
https://github.com/raspberrypi/linux.git
synced 2025-12-06 18:09:56 +00:00
input: edt-ft5x06: Only read data for number of points reported
Rather than always reading the maximum number of points supported by the chip (which may be as high as 10), read the number of active points first, and read data for just those. In most cases this will result in less data on the I2C bus, with only the maximum touch points taking more due to a second read that has to configure the start address. Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
This commit is contained in:
committed by
Dom Cobley
parent
a5e4c14408
commit
7216fcfe2e
@@ -330,6 +330,11 @@ static irqreturn_t edt_ft5x06_ts_isr(int irq, void *dev_id)
|
|||||||
* points.
|
* points.
|
||||||
*/
|
*/
|
||||||
num_points = min(rdbuf[2] & 0xf, tsdata->max_support_points);
|
num_points = min(rdbuf[2] & 0xf, tsdata->max_support_points);
|
||||||
|
if (num_points)
|
||||||
|
error = regmap_bulk_read(tsdata->regmap,
|
||||||
|
tsdata->offset,
|
||||||
|
&rdbuf[tsdata->tdata_offset],
|
||||||
|
tsdata->point_len * num_points);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < num_points; i++) {
|
for (i = 0; i < num_points; i++) {
|
||||||
@@ -1103,20 +1108,23 @@ static void edt_ft5x06_ts_get_parameters(struct edt_ft5x06_ts_data *tsdata)
|
|||||||
static void edt_ft5x06_ts_set_tdata_parameters(struct edt_ft5x06_ts_data *tsdata)
|
static void edt_ft5x06_ts_set_tdata_parameters(struct edt_ft5x06_ts_data *tsdata)
|
||||||
{
|
{
|
||||||
int crclen;
|
int crclen;
|
||||||
|
int points;
|
||||||
|
|
||||||
if (tsdata->version == EDT_M06) {
|
if (tsdata->version == EDT_M06) {
|
||||||
tsdata->tdata_cmd = 0xf9;
|
tsdata->tdata_cmd = 0xf9;
|
||||||
tsdata->tdata_offset = 5;
|
tsdata->tdata_offset = 5;
|
||||||
tsdata->point_len = 4;
|
tsdata->point_len = 4;
|
||||||
crclen = 1;
|
crclen = 1;
|
||||||
|
points = tsdata->max_support_points;
|
||||||
} else {
|
} else {
|
||||||
tsdata->tdata_cmd = 0x0;
|
tsdata->tdata_cmd = 0x0;
|
||||||
tsdata->tdata_offset = 3;
|
tsdata->tdata_offset = 3;
|
||||||
tsdata->point_len = 6;
|
tsdata->point_len = 6;
|
||||||
crclen = 0;
|
crclen = 0;
|
||||||
|
points = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
tsdata->tdata_len = tsdata->point_len * tsdata->max_support_points +
|
tsdata->tdata_len = tsdata->point_len * points +
|
||||||
tsdata->tdata_offset + crclen;
|
tsdata->tdata_offset + crclen;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user