From patchwork Thu Jun 21 22:41:28 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janusz Krzysztofik X-Patchwork-Id: 10480909 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 62C5E60365 for ; Thu, 21 Jun 2018 22:48:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6346D28471 for ; Thu, 21 Jun 2018 22:48:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 578DB28500; Thu, 21 Jun 2018 22:48:26 +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=-2.9 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, DKIM_VALID, FREEMAIL_FROM, MAILING_LIST_MULTI autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id BB69C28471 for ; Thu, 21 Jun 2018 22:48:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=G4ia88FK46Ux0srbVZ/PxlTpk1MCT3rEcNFpFDkmCXE=; b=nd9UBMuiCcKLC4Z6BQy3YSXSzp /ZtBJSbVNX2P+N0KnwmDIodUJqFlXbwt4oLEjtaWY3MrsBnm5DQ4A1ziSnPK9EUnogIfz6egfiIUb dQk5PigwOcDz6lBJyPxMvA4Ek9LfCnQSVM9x8O+IiYKgoN8AY4B50D/IlY7swso7H4rdN3pmY5EGH OG5d1p37ivyuiI3NtXA330yyzv2PQ9Oyqa6a4vOpkEcpTzwMiEtTVlluI09f7aYXIdh0Z/iYZH/Tk EdT4AQ0s1CKBXKuW+4U0kfVCd72odK+/NRV3PmMN4zesudsHvlanywWQ6JQwaBP+YqZwkEg6V6F0Z lRN4iMpQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fW8ND-0007L4-IF; Thu, 21 Jun 2018 22:48:15 +0000 Received: from mail-lf0-x244.google.com ([2a00:1450:4010:c07::244]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fW8I6-0003Yg-9g for linux-arm-kernel@lists.infradead.org; Thu, 21 Jun 2018 22:43:07 +0000 Received: by mail-lf0-x244.google.com with SMTP id e13-v6so6650211lfc.1 for ; Thu, 21 Jun 2018 15:42:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=c9NV9dOMTYPsP4/sX7FCRBR0qzAOJybNywIA8RFbuZI=; b=NI840kbNGt/QIKBzM6pTijHAIqIJQP38yFSGVYJD0I1qZNTNDycpZKcWqt0clxOQjc 5GRSTCTCBlS26Vd5zvxifJlr8E/OLnxYSJk5+OE0ZueigmLNaoKJIDz5jIQRrbZ7nSMM k41qQJc12LCGK+PmX94wBBhDGwP5rybvYxlNw3E+s77DvhXIIppsZPlJBv+wYgkrMuxo NtNJoCoPYHntqffsQ9WUz8Gry3NWaJIVsxvJszm90IwsNUE/ZlMkQlT1RWlwFGKNB0dx ahzgmzHgT4TmLpcV4bd4TGOeBzkFmHijXeSnxEfR38zDib8vJSS4nYHOBmbz3kgHFO2G Ibuw== 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:in-reply-to :references; bh=c9NV9dOMTYPsP4/sX7FCRBR0qzAOJybNywIA8RFbuZI=; b=tPj6AQBsM69OC5sVXT+7nAKBTiOWWtYofc6IYyY5FUaKH036AUQFOZTv1X7+4KFkFF ETv5Rw4RL1iaKFnQwqq6ovs6keWlicRg5Vw9EpkmpoWrezA7E97kuIKnGLo6Qros2Jfw xwAoQyPfL5BRBWFQO2NSRLlpX8tBYrM/WQzfJoLXa1EDWlsDn4YWbDG+f/VZrY1/Aa7k PJqI8v/2kwCWWvKGrxDieVl37oDZ4g1u+I5xkNzXRWy06JdorXpMH8TeOb8mJXFxBctM Gt3J9wFKPAWOREWqWDS2qpvEt/AiZG7vICazpEQYeQtccxEygrjBnj6P8XoYELnBoBxR LClw== X-Gm-Message-State: APt69E0qpvhYJJbOs5mS+0jYQk9MFQ0mfa7jK6P2E6BsU5azu7dUXIxm s5pEzPjvBCAKqpjeHHg7gTE= X-Google-Smtp-Source: ADUXVKKJlcPgfOizcSlOVj+xNWy1eTgjtc/fVWMrtM/nouhy/8ipBGDJyX/5PFE86fLdjmNBCBqkzA== X-Received: by 2002:a2e:750d:: with SMTP id q13-v6mr17800119ljc.56.1529620966225; Thu, 21 Jun 2018 15:42:46 -0700 (PDT) Received: from z50.lan (93-181-165-181.internetia.net.pl. [93.181.165.181]) by smtp.gmail.com with ESMTPSA id t6-v6sm1046153lje.18.2018.06.21.15.42.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 21 Jun 2018 15:42:45 -0700 (PDT) From: Janusz Krzysztofik To: Dmitry Torokhov , Tony Lindgren , Aaro Koskinen Subject: [PATCH v2 10/10] Input: ams_delta_serio: Get FIQ buffer from platform_data Date: Fri, 22 Jun 2018 00:41:28 +0200 Message-Id: <20180621224128.17623-10-jmkrzyszt@gmail.com> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20180621224128.17623-1-jmkrzyszt@gmail.com> References: <20180609140224.32606-1-jmkrzyszt@gmail.com> <20180621224128.17623-1-jmkrzyszt@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180621_154258_360833_FE788FFC X-CRM114-Status: GOOD ( 19.07 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Greg Kroah-Hartman , Linus Walleij , Randy Dunlap , Janusz Krzysztofik , Liam Girdwood , linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org, Mark Brown , linux-input@vger.kernel.org, Mauro Carvalho Chehab , Andrew Morton , linux-omap@vger.kernel.org, "David S . Miller " , linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Instead of exporting the FIQ buffer symbol to be used in ams-delta-serio driver, pass it to the driver as platform_data. Signed-off-by: Janusz Krzysztofik Acked-by: Dmitry Torokhov --- Changelog: v2: rebased on v4.18-rc1, no conflicts arch/arm/mach-omap1/ams-delta-fiq.c | 6 +++--- arch/arm/mach-omap1/board-ams-delta.c | 8 ++++++++ drivers/input/serio/ams_delta_serio.c | 20 +++++++++++++------- include/linux/platform_data/ams-delta-fiq.h | 4 ---- 4 files changed, 24 insertions(+), 14 deletions(-) diff --git a/arch/arm/mach-omap1/ams-delta-fiq.c b/arch/arm/mach-omap1/ams-delta-fiq.c index 82ca4246a5e4..b0dc7ddf5877 100644 --- a/arch/arm/mach-omap1/ams-delta-fiq.c +++ b/arch/arm/mach-omap1/ams-delta-fiq.c @@ -40,8 +40,7 @@ static struct fiq_handler fh = { * keystrokes received from the qwerty keyboard. See * for details of offsets. */ -unsigned int fiq_buffer[1024]; -EXPORT_SYMBOL(fiq_buffer); +static unsigned int fiq_buffer[1024]; static struct irq_chip *irq_chip; static struct irq_data *irq_data[16]; @@ -203,9 +202,10 @@ void __init ams_delta_init_fiq(struct gpio_chip *chip, val = omap_readl(OMAP_IH1_BASE + offset) | 1; omap_writel(val, OMAP_IH1_BASE + offset); - /* Initialize serio device IRQ resource */ + /* Initialize serio device IRQ resource and platform_data */ serio->resource[0].start = gpiod_to_irq(clk); serio->resource[0].end = serio->resource[0].start; + serio->dev.platform_data = fiq_buffer; /* * Since FIQ handler performs handling of GPIO registers for diff --git a/arch/arm/mach-omap1/board-ams-delta.c b/arch/arm/mach-omap1/board-ams-delta.c index 84177ba3e39a..772892487827 100644 --- a/arch/arm/mach-omap1/board-ams-delta.c +++ b/arch/arm/mach-omap1/board-ams-delta.c @@ -520,6 +520,14 @@ static struct resource ams_delta_serio_resources[] = { static struct platform_device ams_delta_serio_device = { .name = "ams-delta-serio", .id = PLATFORM_DEVID_NONE, + .dev = { + /* + * Initialize .platform_data explicitly with NULL to + * indicate it is going to be used. It will be replaced + * with FIQ buffer address as soon as FIQ is initialized. + */ + .platform_data = NULL, + }, .num_resources = ARRAY_SIZE(ams_delta_serio_resources), .resource = ams_delta_serio_resources, }; diff --git a/drivers/input/serio/ams_delta_serio.c b/drivers/input/serio/ams_delta_serio.c index c1f8226f172e..f8663d7891f2 100644 --- a/drivers/input/serio/ams_delta_serio.c +++ b/drivers/input/serio/ams_delta_serio.c @@ -37,6 +37,7 @@ MODULE_LICENSE("GPL"); struct ams_delta_serio { struct serio *serio; struct regulator *vcc; + unsigned int *fiq_buffer; }; static int check_data(struct serio *serio, int data) @@ -66,22 +67,23 @@ static int check_data(struct serio *serio, int data) static irqreturn_t ams_delta_serio_interrupt(int irq, void *dev_id) { struct ams_delta_serio *priv = dev_id; - int *circ_buff = &fiq_buffer[FIQ_CIRC_BUFF]; + int *circ_buff = &priv->fiq_buffer[FIQ_CIRC_BUFF]; int data, dfl; u8 scancode; - fiq_buffer[FIQ_IRQ_PEND] = 0; + priv->fiq_buffer[FIQ_IRQ_PEND] = 0; /* * Read data from the circular buffer, check it * and then pass it on the serio */ - while (fiq_buffer[FIQ_KEYS_CNT] > 0) { + while (priv->fiq_buffer[FIQ_KEYS_CNT] > 0) { - data = circ_buff[fiq_buffer[FIQ_HEAD_OFFSET]++]; - fiq_buffer[FIQ_KEYS_CNT]--; - if (fiq_buffer[FIQ_HEAD_OFFSET] == fiq_buffer[FIQ_BUF_LEN]) - fiq_buffer[FIQ_HEAD_OFFSET] = 0; + data = circ_buff[priv->fiq_buffer[FIQ_HEAD_OFFSET]++]; + priv->fiq_buffer[FIQ_KEYS_CNT]--; + if (priv->fiq_buffer[FIQ_HEAD_OFFSET] == + priv->fiq_buffer[FIQ_BUF_LEN]) + priv->fiq_buffer[FIQ_HEAD_OFFSET] = 0; dfl = check_data(priv->serio, data); scancode = (u8) (data >> 1) & 0xFF; @@ -116,6 +118,10 @@ static int ams_delta_serio_init(struct platform_device *pdev) if (!priv) return -ENOMEM; + priv->fiq_buffer = pdev->dev.platform_data; + if (!priv->fiq_buffer) + return -EINVAL; + priv->vcc = devm_regulator_get(&pdev->dev, "vcc"); if (IS_ERR(priv->vcc)) { err = PTR_ERR(priv->vcc); diff --git a/include/linux/platform_data/ams-delta-fiq.h b/include/linux/platform_data/ams-delta-fiq.h index dc0f835ea918..cf4589ccb720 100644 --- a/include/linux/platform_data/ams-delta-fiq.h +++ b/include/linux/platform_data/ams-delta-fiq.h @@ -55,8 +55,4 @@ #define FIQ_CIRC_BUFF 30 /*Start of circular buffer */ -#ifndef __ASSEMBLER__ -extern unsigned int fiq_buffer[]; -#endif - #endif