Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp1746695ybg; Sat, 19 Oct 2019 01:36:59 -0700 (PDT) X-Google-Smtp-Source: APXvYqykK9uwVhj/SkbcIWpuDgpYf8rDKvbDAPpfgTjLxG5UTIUnVuBWcfyqSQKTEIXdgKvfPQQh X-Received: by 2002:a05:6402:88c:: with SMTP id e12mr668800edy.170.1571474219850; Sat, 19 Oct 2019 01:36:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571474219; cv=none; d=google.com; s=arc-20160816; b=TAiSGOCX3Rz2eEj7K7bxLC+xekO3cJcWVvvOKOt5Id3afvqeLOPcdU8YWWudbJQeeG 4BZNxWIJI73joZNVdKfGqoMOIgTHRKWI5/7NaC277N/quS1e/PkhtxEqHawuYmp2y4+O ylMFuWKMPhd2z8SEbudNPUI/6aOf6vwK4NiNVqeA7szEV0e9aI0kcS2op2NxzUNzc24J 2Lo4VjUl3wGVFvzDlVKAH6oBmWJY8ElRv5Zz3X/BYG1ZNljvpBRcaR9IgJS9iTd0CfmV i6sPDPmpc3umWnIZ89x7IIdm9FeJU7HwC1XrB4mf0AN0Xnh5Go01rlYwIMQ2RSv/LxtS fZzQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=5BeXtn8rcjlUDgHsb8acK8FXOMPCiGH/IebdqCxSg8M=; b=D7ak6ZUX+NflL5iTLkpRplGRrN728szq38KfaXTtbSeXEBtevssO2KmjYS/eM0oP1s pD2JfywGWOFTplY9dUzUnbNXAOLfq7gNSDiejle9p2uJjgHnLDMJmfDIKgwzvBdYiiNX tF4nBzsitIF69WLzRz46HmnenxSMxd4NaTgR5riJYLYpR4jloc3OEg61bbbZobVD5ezM yrXZ1Tlnam6QYuUGqzMy8FH5TToetwdTouwzkZQacsfSROtps+5INvwdGjkTao3M/RPn JadKsjhUSfMTbYvogP6ypEnhPu4P1o2pYT/bId/gkXz4a43TrGK+OcH9FjytGW20feD6 9IKQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b30si5549057eda.200.2019.10.19.01.36.36; Sat, 19 Oct 2019 01:36:59 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2505432AbfJRPoc (ORCPT + 99 others); Fri, 18 Oct 2019 11:44:32 -0400 Received: from mout.kundenserver.de ([217.72.192.73]:56099 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2505169AbfJRPml (ORCPT ); Fri, 18 Oct 2019 11:42:41 -0400 Received: from threadripper.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue108 [212.227.15.145]) with ESMTPA (Nemesis) id 1M7JrG-1iOl7h3IKK-007k2b; Fri, 18 Oct 2019 17:42:29 +0200 From: Arnd Bergmann To: Daniel Mack , Haojian Zhuang , Robert Jarzmik Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Linus Walleij , Arnd Bergmann , Dmitry Torokhov , linux-input@vger.kernel.org, alsa-devel@alsa-project.org Subject: [PATCH 29/46] Input: touchscreen: use wrapper for pxa2xx ac97 registers Date: Fri, 18 Oct 2019 17:41:44 +0200 Message-Id: <20191018154201.1276638-29-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20191018154052.1276506-1-arnd@arndb.de> References: <20191018154052.1276506-1-arnd@arndb.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Provags-ID: V03:K1:MK8JfTnTg0lPFTWmTXYVConFc6n0BBIQ8G+iv99wHsjwJ8GpckN WfS0UdxIaZu/fxc1H/6LNUOHWpL2xSEFPQ6W03NM1LBrLN0j3TAEBNOHC9Ak+SZFqB5Np5P cBv2685GglbI1t+P7kdvgbtFLL2aNQrwh/zUXcMSx23AYaxPMjFkmPfUeQEIBlSR8jJStci PJterFpo7iLKTqstnNT4Q== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:GJMqnt/pGVA=:EKxLIgmzbmMu61TQSTosuf gnVEJX0ztxVdyO4z7UFQ2x/wfcms3eF5wz06LFuo1kgZhPHx0v9J3kUVmEbt/IFOZHFMcTrzV qxC7UEJMWIoxlDcv6rkIjvr1xYK4eJ8HIaD0Mvh0V3trgZaVQdjJOftHvkgAQ/rFUjEyqmjrn l3zaJN9jvJcbxjPkZIDS1SKiqgdQ6FQAQY4+s1qHIJ5fW5yLZ/bCzxn8M3cfKIIMcuFO1x0Em 9F74udBauIflN4XgL/mxj8HGSI2srkKNrDdfO/rmrA+FPUr1ERAVhAzhqxOglKChpDdqPi7kV J+AqwsBF1idqsMZ7cApARQJl2Bz07q2+Cqql6vcV4A7x5oGw+y2nO5/mMrBgoyXqNjsyeZPde VuRWY/PFkcCDyLjfFjCZESP9ggl9st3BNn5kEwRz8VS+PElmOelJfyxZyKWsGFDfy56jmYE1d pCZG4geuaF7c+LEd08mmWO8rvfr2aOBFjSgPsw63Lg08tWx4OtK7miLsohhN+jIs7petifzUt OgqjwpfdZgh8JM/+ztp1y1zGQzsS0nUyGyjud91BA0Sx4f2vD/qUToiGpv/dEC/YOB95uu4yq i4BOkEYfAu1q0mgvm8uSrbTtiMMVXtibbi5CiTwm0WVxGgrlUVkUAdqyit+bYTVAyh0MuFvxK B3x6QLwtp8rHSJO3LDDC8F+i3Yfpzb3w3HswLBcyyMHlHA7YhedHARB0+T4OnQp5O4dIEUz/+ lR/iB+chX7WlzQIkNTGRS739Zf/oUV7ixTwduxprShyU+CkUtPqmazK6GhRpwxI/qkICcmnce QUfTdBWtkKyuIaknQt8IYi+FxwID9nB/IoSMUxX0rNUI5GE/bMQ0Sc8mS0MLhXyBx8t92xXTs DkSH6kM4PoyPDWgHlHsw== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Cc: Dmitry Torokhov 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 46ad9090493b..c60199550d89 100644 --- a/drivers/input/touchscreen/Kconfig +++ b/drivers/input/touchscreen/Kconfig @@ -848,6 +848,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. @@ -860,6 +861,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 6758fc12fa84..79c32a8f4c91 100644 --- a/include/sound/pxa2xx-lib.h +++ b/include/sound/pxa2xx-lib.h @@ -41,4 +41,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"); -- 2.20.0