Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp2057119imm; Sat, 9 Jun 2018 07:04:33 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLTvKAAjOXZ3KbJlSmB36XJI7ZLYxweUrcNFYnfGswBmtsrrFyLxt/8O9ZHHDPC6mn5m7Gu X-Received: by 2002:a17:902:4101:: with SMTP id e1-v6mr11016156pld.205.1528553073133; Sat, 09 Jun 2018 07:04:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528553073; cv=none; d=google.com; s=arc-20160816; b=TEBHrFEWoIv64mfxkZ2LzlbMXpjt48QVIwvskQHRrRHS6um0W4D3J+idVJI/zVK/Rx HyLClp/BXnDwTKRD1jNJRiyj2GOxwW9paUhvoqx5OiQ6BbNjtZKJSwLpaeURS8vwg+7r GUFgKCbGEDh+AD57bN/dVsbIdXRzuf+vYzULuxGijNc54DUrBdlTh7OsTQvdRUWFxjqd 0jruriYIOhzRG/uQg2o+mPl6w+gKIIOxZEmYuoE4H+CzFCRPCZi0qV9gC4iTZNCuEo8G xzTk4aTdnLo2TfOZ0WRRnjluaf1vj9iNSgVawcZo/0GCQokD2Bp8IQz2fLpgAtC74GRr 8rew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=djSnsPBRAqn84tARJhTa0m7NEna6Za9l4TCMdj3DMCQ=; b=JlSS988YBWFZOyDkjdIJt2dUxm9bA36bYjUmHRxOSYMGMhQGKE/nS2hYb1TV8OYuFs VnoQSTHCSOGYkKwGmaQcn/ldscmAhJlnMQHEyJGjRE1hru75RCQUzk/Sg3voLryWGJw2 TqZVPda4t5HOXZUnNdOk+8uyhZPhWOyegz5cmmlzK6dGGQDlGtKvNI37T30SMxt3o2FT w3Xfb/7Nd7Jpt1jwvBeipGQZ6mwekhMYB9f+uzNdc8oZrVW0jsHlokG0TJ2cHCzH7daZ 2a0s6xk/N/mAfmFo6ubpXOQc1fJKJcT7eOiFAkByAdEStsahOQPLdBeZrdzar1W2r6Ol m7Hw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=qo0lbknO; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d88-v6si21190109pfl.297.2018.06.09.07.04.18; Sat, 09 Jun 2018 07:04:33 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=qo0lbknO; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753521AbeFIODg (ORCPT + 99 others); Sat, 9 Jun 2018 10:03:36 -0400 Received: from mail-lf0-f68.google.com ([209.85.215.68]:39865 "EHLO mail-lf0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753479AbeFIOD1 (ORCPT ); Sat, 9 Jun 2018 10:03:27 -0400 Received: by mail-lf0-f68.google.com with SMTP id t134-v6so24194328lff.6; Sat, 09 Jun 2018 07:03:26 -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=djSnsPBRAqn84tARJhTa0m7NEna6Za9l4TCMdj3DMCQ=; b=qo0lbknOc4CU3V0flBUX9rkduwMFaM7tM01hZqZweTwmDXrdipxwaiw76Si4G3Sjpy cQGTz3yKi9rUozkdAOpsUFkyAYVj5IgmM4bhq9WU1qJs5mMboKVUZ4MFxQfju69HpHPK +vtmpYni6LMLyu0ktnGfBFp7khbHIzp0/DB7840nHaYVQLq2RiGXug5DFsoRZ5JJEi/y sd8SA70CijQLwSANpcDLiEDa8/upg+Q0pNtfyS+KEkZBSUx1Si57XXL3isZDbVkZxaFg GNIzDvwdr3MI/8CavwYM9tckNL0H2AmMYLeM/85g4H+uHhvFpyIag5pMJ1d0TWzHKOfq hpfw== 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=djSnsPBRAqn84tARJhTa0m7NEna6Za9l4TCMdj3DMCQ=; b=t2lOOAOKWjRtd47CB/0gqCU+WOV+xrFCPVzfFzEBX+ThFNwbx/foAQFdHOXSCSWV0u 80iQNDU/Jqn/7FJuLP8il/RwVHnnVoOyBrWSFqleQ87mYRMjBnZY3s3qW5zOWCyTgr29 dcqsXRgXFpLz6Cm5+c+5tth5WA/979D6So4bfkX1Q9K91F9swXacJjmJ+zhi42OiP8gj yrr5Nt4QqKhbT8vnM1vB1PKxcnO7z8Vzjv+lZaputONWQVasqGUJlBT02KCDAXCvzaNB gl+98HEqVbLGGq/bYgDiqXujjCbfZqu3dOP6kJ2FloUa16MdxJDQ6j3hCSLRCfk6GjM3 2kbA== X-Gm-Message-State: APt69E3KX2NkOR+VUVxCStzGxht54dM5+Zm3Po9m/fEgdcwhOxsuzmsv OmbTBbHAJHXmhG2U96HHLgE= X-Received: by 2002:a2e:1092:: with SMTP id 18-v6mr7540444ljq.115.1528553005489; Sat, 09 Jun 2018 07:03:25 -0700 (PDT) Received: from localhost.localdomain (apn-31-0-40-98.dynamic.gprs.plus.pl. [31.0.40.98]) by smtp.gmail.com with ESMTPSA id n84-v6sm4477727lfi.19.2018.06.09.07.03.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 09 Jun 2018 07:03:24 -0700 (PDT) From: Janusz Krzysztofik To: Dmitry Torokhov , Tony Lindgren , Aaro Koskinen Cc: "David S . Miller" , Mauro Carvalho Chehab , Greg Kroah-Hartman , Andrew Morton , Randy Dunlap , Liam Girdwood , Mark Brown , Linus Walleij , linux-arm-kernel@lists.infradead.org, linux-input@vger.kernel.org, linux-omap@vger.kernel.org, linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, Janusz Krzysztofik Subject: [PATCH 10/10] Input: ams_delta_serio: Get FIQ buffer from platform_data Date: Sat, 9 Jun 2018 16:02:24 +0200 Message-Id: <20180609140224.32606-10-jmkrzyszt@gmail.com> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180609140224.32606-1-jmkrzyszt@gmail.com> References: <20180609140224.32606-1-jmkrzyszt@gmail.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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 e9d350117240..983638994bd4 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; return; 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 03640b171516..ee38c5140f43 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 -- 2.16.1