aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Boyd <swboyd@chromium.org>2018-10-10 18:50:50 -0400
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2018-10-10 20:10:40 -0400
commit00f73f97527f6ea8b4bc2bc63c44299bcc2f5cab (patch)
tree22cdc496989587a749f3cbbc745ca96a73dce36b
parentdde27443211062e841806feaf690674b7c3a599f (diff)
Input: elants_i2c - use DMA safe i2c when possible
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>
-rw-r--r--drivers/input/touchscreen/elants_i2c.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/input/touchscreen/elants_i2c.c b/drivers/input/touchscreen/elants_i2c.c
index d21ca39b0fdb..f2cb23121833 100644
--- a/drivers/input/touchscreen/elants_i2c.c
+++ b/drivers/input/touchscreen/elants_i2c.c
@@ -147,10 +147,11 @@ struct elants_data {
147 u8 cmd_resp[HEADER_SIZE]; 147 u8 cmd_resp[HEADER_SIZE];
148 struct completion cmd_done; 148 struct completion cmd_done;
149 149
150 u8 buf[MAX_PACKET_SIZE];
151
152 bool wake_irq_enabled; 150 bool wake_irq_enabled;
153 bool keep_power_in_suspend; 151 bool keep_power_in_suspend;
152
153 /* Must be last to be used for DMA operations */
154 u8 buf[MAX_PACKET_SIZE] ____cacheline_aligned;
154}; 155};
155 156
156static int elants_i2c_send(struct i2c_client *client, 157static int elants_i2c_send(struct i2c_client *client,
@@ -863,7 +864,7 @@ static irqreturn_t elants_i2c_irq(int irq, void *_dev)
863 int i; 864 int i;
864 int len; 865 int len;
865 866
866 len = i2c_master_recv(client, ts->buf, sizeof(ts->buf)); 867 len = i2c_master_recv_dmasafe(client, ts->buf, sizeof(ts->buf));
867 if (len < 0) { 868 if (len < 0) {
868 dev_err(&client->dev, "%s: failed to read data: %d\n", 869 dev_err(&client->dev, "%s: failed to read data: %d\n",
869 __func__, len); 870 __func__, len);