From patchwork Wed Oct 10 20:00:17 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 10635155 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4E8A3679F for ; Wed, 10 Oct 2018 20:00:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3522D2AC86 for ; Wed, 10 Oct 2018 20:00:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 337732AC9A; Wed, 10 Oct 2018 20:00:21 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 909322AC86 for ; Wed, 10 Oct 2018 20:00:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727852AbeJKDYA (ORCPT ); Wed, 10 Oct 2018 23:24:00 -0400 Received: from mail-pf1-f195.google.com ([209.85.210.195]:42568 "EHLO mail-pf1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727526AbeJKDYA (ORCPT ); Wed, 10 Oct 2018 23:24:00 -0400 Received: by mail-pf1-f195.google.com with SMTP id f26-v6so3151412pfn.9 for ; Wed, 10 Oct 2018 13:00:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=SxoZz210WU3emzSTDYAt6L2retk8yyhL4yJgnH8MmJQ=; b=PSnth3BbrlXmrhADCeij34F7b75p8XMnhvLAmeZoMeKugrFgGBmDn2jn30dWA0F5Co m8UErn9j4hpIkLjks0JqUz38n3VFBXAuK471MiqMUBC7nYFr4r+pa/J0t9NbpxST+2Wd 801h3pX9Lvj2ac0dCN7u4xP0A9trf47tLCszQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=SxoZz210WU3emzSTDYAt6L2retk8yyhL4yJgnH8MmJQ=; b=iJJoUY1Udf9KvwStCX2pPidgKLw69Tfl6thzGiajFlTlu3suwDBfvjHUNeiE6iJsX8 ocO0ZeHQ0BGqp0uJ+dlOrhqKr4Ungi2wZqd4eU1/dsGauwhmzwvxqZAv3zcdBgfAgCTV 8fsWZSTmOtGqdHLiPQh/89AOzV6sCpCQxuOtZTs+bq37g8AwpbPUoR7jGGryHCPQexW6 tjX6URqHUd4bdf3RtNmw7QG9d7FAxwdfqo1tbAW0UH5Upybt/z8sYdNb91jfiV5Q6d8F lt6D69svDQJPLM8lHiksq6bNXLI+WDePmqmu4S9NNmgryk23pY2QlVb6k6yGzEg6rJgQ APPg== X-Gm-Message-State: ABuFfohHqw5WYBEwLzWfsTi3YoV7XcclYw2sMc4AWTvA50DToFcfwnlW xhBQ2dFj3uQ1w1juorBz1Hyh45JlCH8= X-Google-Smtp-Source: ACcGV61YqYu5MDG8HSIV07mjL/iVDrAFCVmd4Cn6cY+bP97ouxgTgzvLoUBcn5aVh8Ss28dwmAQAGg== X-Received: by 2002:a63:d208:: with SMTP id a8-v6mr28700522pgg.99.1539201619183; Wed, 10 Oct 2018 13:00:19 -0700 (PDT) Received: from smtp.gmail.com ([2620:15c:202:1:fed3:9637:a13a:6c15]) by smtp.gmail.com with ESMTPSA id 20-v6sm25776996pge.77.2018.10.10.13.00.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 10 Oct 2018 13:00:18 -0700 (PDT) From: Stephen Boyd To: Dmitry Torokhov Cc: linux-kernel@vger.kernel.org, linux-input@vger.kernel.org, Wolfram Sang Subject: [PATCH v2] Input: elants_i2c - Use DMA safe i2c when possible Date: Wed, 10 Oct 2018 13:00:17 -0700 Message-Id: <20181010200017.255874-1-swboyd@chromium.org> X-Mailer: git-send-email 2.19.0.605.g01d371f741-goog MIME-Version: 1.0 Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This irq handler is always reading bytes from the device into a kmalloced buffer, so it's safe to mark this transaction as DMA safe. This avoids bouncing the buffer when an i2c controller decides to use DMA for a transaction. Cc: Wolfram Sang Signed-off-by: Stephen Boyd Acked-by: Wolfram Sang --- Changes from v1: * Moved buf to end of structure to keep it cacheline aligned and DMA safe drivers/input/touchscreen/elants_i2c.c | 7 ++++--- 1 file 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 { 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, @@ -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);