Skip to content

Commit

Permalink
Input: elants_i2c - use DMA safe i2c when possible
Browse files Browse the repository at this point in the history
To avoid bounce buffer when an i2c controller decides to use DMA for a
transaction, let's make out buffer that we use for reads DMA-safe and let
the master know that DMAing into it is safe.

Signed-off-by: Stephen Boyd <swboyd@chromium.org>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
  • Loading branch information
Stephen Boyd authored and Dmitry Torokhov committed Oct 11, 2018
1 parent dde2744 commit 00f73f9
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions drivers/input/touchscreen/elants_i2c.c
Original file line number Diff line number Diff line change
Expand Up @@ -147,10 +147,11 @@ struct elants_data {
u8 cmd_resp[HEADER_SIZE];
struct completion cmd_done;

u8 buf[MAX_PACKET_SIZE];

bool wake_irq_enabled;
bool keep_power_in_suspend;

/* Must be last to be used for DMA operations */
u8 buf[MAX_PACKET_SIZE] ____cacheline_aligned;
};

static int elants_i2c_send(struct i2c_client *client,
Expand Down Expand Up @@ -863,7 +864,7 @@ static irqreturn_t elants_i2c_irq(int irq, void *_dev)
int i;
int len;

len = i2c_master_recv(client, ts->buf, sizeof(ts->buf));
len = i2c_master_recv_dmasafe(client, ts->buf, sizeof(ts->buf));
if (len < 0) {
dev_err(&client->dev, "%s: failed to read data: %d\n",
__func__, len);
Expand Down

0 comments on commit 00f73f9

Please sign in to comment.