From patchwork Tue Apr 19 16:37:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 563361 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp3451661map; Tue, 19 Apr 2022 10:11:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwsjNgLneki+q202gFyWWVD7xroeGlupNh0ri3am2Yr67AXqQyZ4qpKX1W2BvDKIwie2IX2 X-Received: by 2002:a17:902:d1cb:b0:158:a94b:965f with SMTP id g11-20020a170902d1cb00b00158a94b965fmr16431769plb.96.1650388312581; Tue, 19 Apr 2022 10:11:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650388312; cv=none; d=google.com; s=arc-20160816; b=HalypiMu1yqOv+ZAtSSVwU1F0WJ6VJ4pmNoX7+9pHQO60bu7YSO5oaol/xkBMc9S5K iOfk7GIZgPYRobtCv4tDquUIUBOsqJpt/roi1Fy1d1PrXiCtHAbg9LntcWVsoaa7xGv2 UzHKGNcZCftojFzQ71a3yRHl53Zxd3rJFJKmNj9N4jhWD49oEI/iwEmOv5wu86GSJY+5 Bo2U+1M1Pq89Wx1zlO81l26MSGh8m2N0JUnXtSFXlO2A7kcmJxRLYxrIorbSHzOctlkv 1HfsAlrzDLj+TsIb59j9QBk2uQuU1vsK0W8s7+8dJO5pkzmF32L7anEmwpEzZfEaOk6H Apcw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:sender:content-transfer-encoding:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature:dkim-signature; bh=Hu5iGuVg+zoyx9kvyQx2dot7ljBDD1mM4za4gYLSxqA=; b=JotrWYicL/F0bppVqj/WSsow8kPp00pPzH8gPLVCTQjbKjkwgrV4zuIk/xrho3rXuO jEnJa1/vEPPI8+pikWfGznnKbQ4r0x2Br0Q3R5EIKwge7beKf1X1z3TZpiokRJuNigcs 8G2FDkHS5plHW2YAJzYvo3m4eX6JMrkSQwz1+7HoV83hWkMxhqw59cq/InauuMWDouD3 vZ/tMK5snr6wrdKkMD4hAEqBUHxRkKf/siKVfQsAF89Apy+rQYVFaTWhxhYTIP2RTh5+ JwyhdsVLXRd63ufmE+e0isNNDxFy3c7J+X3oMdHL2MfmgFBuo/saPg453vLIspYRw/Rm hJkw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lists.infradead.org header.s=bombadil.20210309 header.b=en4I5g5z; dkim=neutral (body hash did not verify) header.i=@kernel.org header.s=k20201202 header.b="M+b/M4GG"; spf=pass (google.com: best guess record for domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 2607:7c80:54:e::133 as permitted sender) smtp.mailfrom="linux-mtd-bounces+patch=linaro.org@lists.infradead.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from bombadil.infradead.org (bombadil.infradead.org. [2607:7c80:54:e::133]) by mx.google.com with ESMTPS id bc2-20020a170902930200b00156b4eda6b2si11540883plb.287.2022.04.19.10.11.52 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Apr 2022 10:11:52 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 2607:7c80:54:e::133 as permitted sender) client-ip=2607:7c80:54:e::133; Authentication-Results: mx.google.com; dkim=pass header.i=@lists.infradead.org header.s=bombadil.20210309 header.b=en4I5g5z; dkim=neutral (body hash did not verify) header.i=@kernel.org header.s=k20201202 header.b="M+b/M4GG"; spf=pass (google.com: best guess record for domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 2607:7c80:54:e::133 as permitted sender) smtp.mailfrom="linux-mtd-bounces+patch=linaro.org@lists.infradead.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Hu5iGuVg+zoyx9kvyQx2dot7ljBDD1mM4za4gYLSxqA=; b=en4I5g5zmbBThq UaaINEz1Z1qXf5s8LyiG/WGnED8DAJdulyspR5e0+55BEnE+yVCOeEQTKarHlrdxwxXGIrvEDw0DR AZQnltMFqxcgI8K+/R4r4dMrHlPusEBFkhZWv+EE/fZRuA3B6A9z+MEqT5GVq7vFVfe4CKeXRSKB8 a9ZoGnNIV4qj1QWVRydUcZf0MmAXfLyUO0BDF5rsyTJ+SBh6GRB4HlmBjCyAslaQSy2Oo0dDmtyu7 wO3WxWcRIhsUnQM7B+GprDbzymBlFK9poB/YLG7BaiqYjUhGPxxllSLxLC23bZ8BFSSeC/mVwFl1A BP1kJ0z/m6murH0wDHiA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ngrOC-005Bk1-1v; Tue, 19 Apr 2022 17:11:44 +0000 Received: from dfw.source.kernel.org ([139.178.84.217]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1ngqvw-004xgO-Eu; Tue, 19 Apr 2022 16:42:38 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id ED60461870; Tue, 19 Apr 2022 16:42:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1A777C385AC; Tue, 19 Apr 2022 16:42:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1650386551; bh=ZitIFNWOGNclnWEkC5k5wKgP8LZADBB8lqdOWZNB8wQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=M+b/M4GGqpVoZ/vtuDGOrUAXIOp7QmnE+sliunl9FKuasZGbZF8J7WC0f5+dwHIfV QC+dZIBkk7Hf4pg+kZCT8EC/A41AqH2ENGG3vZIkxJLPpRBM+Aex4V3HjClb5ZY2s8 QXyUz7wFF1e86cNx2J/LH32cIfYAT9jRVz/3EZvQYWNJDZXGGvuD5wmAvR7FCCQYz2 NZPv5X3QIar8bWv9pUOFMdDuQHRolS5csdfPn4P7i2wmWxafJsowCMdw66MeqUo3e4 4cfMCEif39tK7z2xRA3fIStlRIiOkBAdJrgnC88utYEWooh/HHVaMdBdkWFUYWuz/m 6oQTHQqp34oXw== From: Arnd Bergmann To: robert.jarzmik@free.fr, linux-arm-kernel@lists.infradead.org Cc: Arnd Bergmann , Daniel Mack , Haojian Zhuang , Marek Vasut , Philipp Zabel , Lubomir Rintel , Paul Parsons , Tomas Cech , Sergey Lapin , Thomas Bogendoerfer , Michael Turquette , Stephen Boyd , "Rafael J. Wysocki" , Viresh Kumar , Dmitry Torokhov , Ulf Hansson , Dominik Brodowski , Helge Deller , Mark Brown , Linus Walleij , linux-kernel@vger.kernel.org, linux-mips@vger.kernel.org, linux-ide@vger.kernel.org, linux-clk@vger.kernel.org, linux-pm@vger.kernel.org, linux-input@vger.kernel.org, patches@opensource.cirrus.com, linux-leds@vger.kernel.org, linux-mmc@vger.kernel.org, linux-mtd@lists.infradead.org, linux-rtc@vger.kernel.org, linux-usb@vger.kernel.org, linux-fbdev@vger.kernel.org, dri-devel@lists.freedesktop.org, alsa-devel@alsa-project.org Subject: [PATCH 28/48] Input: touchscreen: use wrapper for pxa2xx ac97 registers Date: Tue, 19 Apr 2022 18:37:50 +0200 Message-Id: <20220419163810.2118169-29-arnd@kernel.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20220419163810.2118169-1-arnd@kernel.org> References: <20220419163810.2118169-1-arnd@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220419_094232_676368_0D46A124 X-CRM114-Status: GOOD ( 20.81 ) X-Spam-Score: -5.4 (-----) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: From: Arnd Bergmann To avoid a dependency on the pxa platform header files with hardcoded registers, change the driver to call a wrapper in the pxa2xx-ac97-lib that encapsulates all the other ac97 stuff. Content analysis details: (-5.4 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -5.0 RCVD_IN_DNSWL_HI RBL: Sender listed at https://www.dnswl.org/, high trust [139.178.84.217 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.2 DKIMWL_WL_HIGH DKIMwl.org - High trust sender X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-mtd" Errors-To: linux-mtd-bounces+patch=linaro.org@lists.infradead.org From: Arnd Bergmann To avoid a dependency on the pxa platform header files with hardcoded registers, change the driver to call a wrapper in the pxa2xx-ac97-lib that encapsulates all the other ac97 stuff. Acked-by: Dmitry Torokhov Acked-by: Robert Jarzmik Cc: linux-input@vger.kernel.org Cc: alsa-devel@alsa-project.org Signed-off-by: Arnd Bergmann --- drivers/input/touchscreen/Kconfig | 2 ++ drivers/input/touchscreen/mainstone-wm97xx.c | 16 ++++++++-------- drivers/input/touchscreen/zylonite-wm97xx.c | 12 ++++++------ include/sound/pxa2xx-lib.h | 4 ++++ sound/arm/pxa2xx-ac97-lib.c | 12 ++++++++++++ 5 files changed, 32 insertions(+), 14 deletions(-) diff --git a/drivers/input/touchscreen/Kconfig b/drivers/input/touchscreen/Kconfig index 43c7d6e5bdc0..2d70c945b20a 100644 --- a/drivers/input/touchscreen/Kconfig +++ b/drivers/input/touchscreen/Kconfig @@ -902,6 +902,7 @@ config TOUCHSCREEN_WM9713 config TOUCHSCREEN_WM97XX_MAINSTONE tristate "WM97xx Mainstone/Palm accelerated touch" depends on TOUCHSCREEN_WM97XX && ARCH_PXA + depends on SND_PXA2XX_LIB_AC97 help Say Y here for support for streaming mode with WM97xx touchscreens on Mainstone, Palm Tungsten T5, TX and LifeDrive systems. @@ -914,6 +915,7 @@ config TOUCHSCREEN_WM97XX_MAINSTONE config TOUCHSCREEN_WM97XX_ZYLONITE tristate "Zylonite accelerated touch" depends on TOUCHSCREEN_WM97XX && MACH_ZYLONITE + depends on SND_PXA2XX_LIB_AC97 select TOUCHSCREEN_WM9713 help Say Y here for support for streaming mode with the touchscreen diff --git a/drivers/input/touchscreen/mainstone-wm97xx.c b/drivers/input/touchscreen/mainstone-wm97xx.c index 940d3c92b1f8..8f6fe68f1f99 100644 --- a/drivers/input/touchscreen/mainstone-wm97xx.c +++ b/drivers/input/touchscreen/mainstone-wm97xx.c @@ -28,7 +28,7 @@ #include #include -#include +#include #include @@ -104,11 +104,11 @@ static void wm97xx_acc_pen_up(struct wm97xx *wm) msleep(1); if (cpu_is_pxa27x()) { - while (MISR & (1 << 2)) - MODR; + while (pxa2xx_ac97_read_misr() & (1 << 2)) + pxa2xx_ac97_read_modr(); } else if (cpu_is_pxa3xx()) { for (count = 0; count < 16; count++) - MODR; + pxa2xx_ac97_read_modr(); } } @@ -130,7 +130,7 @@ static int wm97xx_acc_pen_down(struct wm97xx *wm) return RC_PENUP; } - x = MODR; + x = pxa2xx_ac97_read_modr(); if (x == last) { tries++; return RC_AGAIN; @@ -138,10 +138,10 @@ static int wm97xx_acc_pen_down(struct wm97xx *wm) last = x; do { if (reads) - x = MODR; - y = MODR; + x = pxa2xx_ac97_read_modr(); + y = pxa2xx_ac97_read_modr(); if (pressure) - p = MODR; + p = pxa2xx_ac97_read_modr(); dev_dbg(wm->dev, "Raw coordinates: x=%x, y=%x, p=%x\n", x, y, p); diff --git a/drivers/input/touchscreen/zylonite-wm97xx.c b/drivers/input/touchscreen/zylonite-wm97xx.c index cabdd6e3c6f8..ed7eae638713 100644 --- a/drivers/input/touchscreen/zylonite-wm97xx.c +++ b/drivers/input/touchscreen/zylonite-wm97xx.c @@ -24,7 +24,7 @@ #include #include -#include +#include struct continuous { u16 id; /* codec id */ @@ -79,7 +79,7 @@ static void wm97xx_acc_pen_up(struct wm97xx *wm) msleep(1); for (i = 0; i < 16; i++) - MODR; + pxa2xx_ac97_read_modr(); } static int wm97xx_acc_pen_down(struct wm97xx *wm) @@ -100,7 +100,7 @@ static int wm97xx_acc_pen_down(struct wm97xx *wm) return RC_PENUP; } - x = MODR; + x = pxa2xx_ac97_read_modr(); if (x == last) { tries++; return RC_AGAIN; @@ -108,10 +108,10 @@ static int wm97xx_acc_pen_down(struct wm97xx *wm) last = x; do { if (reads) - x = MODR; - y = MODR; + x = pxa2xx_ac97_read_modr(); + y = pxa2xx_ac97_read_modr(); if (pressure) - p = MODR; + p = pxa2xx_ac97_read_modr(); dev_dbg(wm->dev, "Raw coordinates: x=%x, y=%x, p=%x\n", x, y, p); diff --git a/include/sound/pxa2xx-lib.h b/include/sound/pxa2xx-lib.h index 95100cff25d1..0a6f8dabf8c4 100644 --- a/include/sound/pxa2xx-lib.h +++ b/include/sound/pxa2xx-lib.h @@ -52,4 +52,8 @@ extern int pxa2xx_ac97_hw_resume(void); extern int pxa2xx_ac97_hw_probe(struct platform_device *dev); extern void pxa2xx_ac97_hw_remove(struct platform_device *dev); +/* modem registers, used by touchscreen driver */ +u32 pxa2xx_ac97_read_modr(void); +u32 pxa2xx_ac97_read_misr(void); + #endif diff --git a/sound/arm/pxa2xx-ac97-lib.c b/sound/arm/pxa2xx-ac97-lib.c index 8c79d224f03b..572b73d73762 100644 --- a/sound/arm/pxa2xx-ac97-lib.c +++ b/sound/arm/pxa2xx-ac97-lib.c @@ -428,6 +428,18 @@ void pxa2xx_ac97_hw_remove(struct platform_device *dev) } EXPORT_SYMBOL_GPL(pxa2xx_ac97_hw_remove); +u32 pxa2xx_ac97_read_modr(void) +{ + return MODR; +} +EXPORT_SYMBOL_GPL(pxa2xx_ac97_read_modr); + +u32 pxa2xx_ac97_read_misr(void) +{ + return MISR; +} +EXPORT_SYMBOL_GPL(pxa2xx_ac97_read_misr); + MODULE_AUTHOR("Nicolas Pitre"); MODULE_DESCRIPTION("Intel/Marvell PXA sound library"); MODULE_LICENSE("GPL");