From patchwork Fri Oct 18 15:41:42 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 176879 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp1032307ill; Fri, 18 Oct 2019 08:44:28 -0700 (PDT) X-Google-Smtp-Source: APXvYqz9aKf8gdS3j8gCcHOqH5Vd7YCO3v5VJo1YBNi2dUEl6L+O33XhVeKjDdEf4nkBYXJd6s1p X-Received: by 2002:a05:6402:751:: with SMTP id p17mr10342071edy.161.1571413468148; Fri, 18 Oct 2019 08:44:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571413468; cv=none; d=google.com; s=arc-20160816; b=vpBO6FC3H//w4nqTDmMoFvNmvdnlc1ptFTVd7CTUStZETsVBdTA0DmbtEVLIE30Nhd cMDAzUvElT73KCj1j9zkQgaOeeXAAdSU4eKdUbT6iyjAcciYT1cLYnwqt5qZNtAxtne1 Px5LoxD4MdEcdH1ht6KUhBI7I7y6anHpAnILo1MyawVTaFWORYoWfsf/tS3uKPAkIe6P qo2NCrIUKjOdoKldQkJhNLj0H5b9d0SLgSZ29Lj1XzexTJL+Pm5d7PvRGw6egcxfahrt 9uOUSLd2C1LSUghzH/RDtV2IBNq+/XGt2IREjmhEf8A9DbbSRmgcqwLKJJYKRY74XnGP BW8w== 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=E0E/Jo7kWKrGS8TJ58aOYmw7R/6JFH3CjhsgRiKHKIA=; b=m5DV1dXlAU42RyOnAMz1oaCNhK+b7k2OSjXIOXW+vuoAsQBA8ZsbqonBTEJC+l/EQJ K63nrHOiXd3VBsUrhy4uvQQPqMsgZL2al1Lu1yeoMCsbUniwcZiRD60KLSBmP39NWp2I QWNw9hWnURiu72AvFbEkujq3D7dW2/1HM8ujwGoJR/7TNW0CE5OjXH8Raf0R7om9m7sH UnY8/SHrNzN/HfZiBGNv3NJNSqsWpnipzAiUtLK6kMLP7+EF4dGJ4OHwLT/absEb21Am t246yjzqeGsXmnhpX3o3Z4MoGQlJR8LiuevjmBc3/ewJuZvSasytqh5+JUWX3lHXsGxY aSkg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-input-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-input-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 j14si3430925ejf.53.2019.10.18.08.44.28 for ; Fri, 18 Oct 2019 08:44:28 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-input-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-input-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-input-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727991AbfJRPo0 (ORCPT ); Fri, 18 Oct 2019 11:44:26 -0400 Received: from mout.kundenserver.de ([217.72.192.75]:35545 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2408928AbfJRPml (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 1M7ayR-1iOU0W0GFx-00819k; 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 Subject: [PATCH 27/46] input: touchscreen: mainstone: fix pxa2xx+pxa3xx configuration Date: Fri, 18 Oct 2019 17:41:42 +0200 Message-Id: <20191018154201.1276638-27-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 X-Provags-ID: V03:K1:Ng/eyI4thlC2GCBRgdpQcO3nmYU5CsaSTwm+I+PB6/L+XERvTt3 mM+f2NcUCRVt671B1y+gsqqvmpOFOcfe2W3Fv7ZMf6s270ujaqjmTpnZW86HvY4KspXdIL2 7G4rcVEFd985Q2LZzPjf6lQRJx81j9teHbdRhLAh6nUIfYMLSEHldIIZx0GGCx5wdGX6Nkb VF3cjt30YDf01jbjdVmTQ== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:BwtJjcZ6s0M=:VJNJb6LSwdn18+QEAXftWz Yc6hA5MFJhCeUC92lhyYkd0l2evj94gw1WsMZXrEak4+MVGInJHGH/sqSH/C61E0r52sAJyJs vZnF5oHEkMjf/1t5qtQ55+EMku67tiU8F9Wb30edaMzg3B4SzS/re2gszOcf2AMOchXs87Vss KFIEIh248dVRSDa8cGA522jU8mdhOip0vKeImFDtYJ7KZkrAfQUH1g/XdlbYwtuyKhrLAd0d7 vfIqOnGsvlf/YFxhZMhoufGydFwzrgiTL3twAuH0agB0zsnTvk+N+x2VXYPbpUDgKp8sh8pNs yolVUafZdH5uViVeKrT/VqzG8j6cssqk5s41GNgxhsVOIq5nx8DFtL175fENk3Rne1WtVHru7 iFan/GJQ5E2rmeHbpcQMmlc3+4Yskz6WdqAVe6SqDOL1pYuCCQDcc8OhkgXe5WfBeQXQdEfy8 16wwvFkIudwbnQVtR5A0o8zkRIlyQHUhRkX4ObQe2ImkUMBokBazMuRhrnLU/062g23+5IX92 9+KoucPEL1AZA5nEddpsl2YuE7sxIyCMT23TEcJPfw9k2JIWvQkaaZ0vu/0gPNyIHBDztkkK/ xkP731J42Vex6oKsgi0ufGg0xPDECcwyN0OYOYAPD36VLwOIqpNZFL2JhCm+L+0GPae9SDpKN AeTu9qN2Bs1izyk7/OUCYApw6clVtexNA/L9lO0YovOgKMMYxfvxWDX/awGlh9bYtaQ52z3yJ 0I9oFv+ITx9f83TC6QZ3dIHsjFsq9SNSECoc5u7gS/4lUX/tUiPs0TAWIweAt9wwtykuu7ARC 8wjaly5zkukSgfPFUT2y0P6+i+lyT/cXG7+eJxS5E9I2G+EqH7G9md3PHeliD57FE0viv6nTV XPJYVreGmjEVQN80iRBQ== Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org There are two different ways of flushing the ac97 queue in this driver, selected by a compile time option. Change this to a runtime selection to make it work when both are enabled. Cc: Dmitry Torokhov Cc: linux-input@vger.kernel.org Signed-off-by: Arnd Bergmann Acked-by: Dmitry Torokhov Acked-by: Robert Jarzmik --- drivers/input/touchscreen/mainstone-wm97xx.c | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) -- 2.20.0 diff --git a/drivers/input/touchscreen/mainstone-wm97xx.c b/drivers/input/touchscreen/mainstone-wm97xx.c index 87655105ef3a..618c80847d9f 100644 --- a/drivers/input/touchscreen/mainstone-wm97xx.c +++ b/drivers/input/touchscreen/mainstone-wm97xx.c @@ -98,25 +98,20 @@ MODULE_PARM_DESC(ac97_touch_slot, "Touch screen data slot AC97 number"); /* flush AC97 slot 5 FIFO on pxa machines */ -#ifdef CONFIG_PXA27x -static void wm97xx_acc_pen_up(struct wm97xx *wm) -{ - schedule_timeout_uninterruptible(1); - - while (MISR & (1 << 2)) - MODR; -} -#else static void wm97xx_acc_pen_up(struct wm97xx *wm) { unsigned int count; schedule_timeout_uninterruptible(1); - for (count = 0; count < 16; count++) - MODR; + if (cpu_is_pxa27x()) { + while (MISR & (1 << 2)) + MODR; + } else if (cpu_is_pxa3xx()) { + for (count = 0; count < 16; count++) + MODR; + } } -#endif static int wm97xx_acc_pen_down(struct wm97xx *wm) { From patchwork Fri Oct 18 15:41:43 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 176872 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp1031727ill; Fri, 18 Oct 2019 08:43:59 -0700 (PDT) X-Google-Smtp-Source: APXvYqzI0k4F9UcsVvU4XBFjfFtehpsC7rUiA5t7iLtFlyiKmpYl6EYiTfe3gxyMotzKnr9ehG7C X-Received: by 2002:a50:f390:: with SMTP id g16mr10323030edm.41.1571413439890; Fri, 18 Oct 2019 08:43:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571413439; cv=none; d=google.com; s=arc-20160816; b=aiuKMvVLF+SprLK5oCYzG6Q5oewKW5qchk3haO9j48UnOqYX8JWuagKnbFxfXUzdeq iXBh6IB98YSkGTsUTWg8gh+bpC7DwOZvPrOJqB7gpL5kqFZHwGC1AFTBBwpUWnuw6hbV 2hTFKBMrOT4Gx6xSI4dIyAa8sufhFxIHMeTf+6j0V4LoIDTVLM7s7j65QWX9tfOZo0AC mXev5g00H538cBFc2UcnIHrK7W5j9wnnYfi4Tdd3KEVK4hsztYa/sT8Bh78BvYJ8UZXN tzFvRw6VunR99N6BidYPiepRUKK/89/M/AdZJYY7NfCgpvfziezTou/biV4RCvXShL2/ e2eA== 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=ngRoi/otSWCo1llqlbBAr2jDip2WnNr+QzUON85jV0o=; b=gHfPg7pPG6Omhb+IfaUDeMUPl40FBKz1FdaBX9JgBcbuFj0VxuzHEY8ugbWpM/fhNI rWMyPGiP3F+wX1K7qfpRmTaB+lAdZbF+UGXmyefSc1gYBn4I8v/Q+YNsd9UG8prEkoGa cGnLHaIfdx4q9azm9rP/kg9GRrDzlIiHfya3LMPo8xVGfKmtBH31hHObBzW4Yd1e71ni S3vQYUF6qCJm+F7klDxb8RQdJw0TWfKbVOGT1L7yuwzH/w9lGEcI0a8gWN1B6JpjAPaP KDEs52bxrKD8VTdDbYo/ecS9xh1R+9lQP7TI++7ya5eLi9O6rqCyC5GeLOr8olMnbdxu JTfQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-input-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-input-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 q15si3627019ejj.183.2019.10.18.08.43.59 for ; Fri, 18 Oct 2019 08:43:59 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-input-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-input-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-input-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2408982AbfJRPn6 (ORCPT ); Fri, 18 Oct 2019 11:43:58 -0400 Received: from mout.kundenserver.de ([217.72.192.74]:40943 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2505179AbfJRPmn (ORCPT ); Fri, 18 Oct 2019 11:42:43 -0400 Received: from threadripper.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue108 [212.227.15.145]) with ESMTPA (Nemesis) id 1Mysa4-1i8cRr1njm-00vzeJ; 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 Subject: [PATCH 28/46] input: touchscreen: mainstone: sync with zylonite driver Date: Fri, 18 Oct 2019 17:41:43 +0200 Message-Id: <20191018154201.1276638-28-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 X-Provags-ID: V03:K1:saH5kjlynqqUDVkNub5Ma1XPk99l3/V8Shfn2TYRSAgJ+P8L2B6 BW8X/SikVvaOq1ChVLPL+Of+XJoeTLZrZY6UpRMW6ZDaHWB1H67j0yTBW4Nn+QKik7OfK0s BRLFMQTIUi8MD4xWkYicAIqu9TTHjaw4cO810QTUsevOMSakQjKerNMLBoqT+m4COuEiotF xKold953kpPZEF6py6DGg== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:VFZafkCMpQc=:TSB0QPeWSMmMsc+ju761Lc Aor1M1UlkuWqzyCepVKJRWMw6mjhUcLJ2ch5cAT+HfnrQ/zaGA7ES5Vtn5PKgc0+DRabL2tin tfO/ctOrIlsDUU0yqo5657VddgJy+LR/yXRHlILuJCdtdAl2P+Vbp8rL9+fJDRgyLaFh2+WDr o0eE1bzfjJ623IfYpCSXIWN2WE9n/pLpb5DyCyMEXNpMixLRmoZvP9zzSGN4co2mFb8+qnZVP R5Nc9M+GsZZ2UZJmqiyZXjggRwrGFGWSSL65TlviYwrPh3eCL+XG5DdhwRovgpTKaMjXQuI4o E0okqEkx2EQncIF5Ah3i9+aAPiwLivXaa8RvIr9XYrDLqWoqhvvYdf2lvUnCf5ZwheHKtq8HY mJJAnncRKYt/YdyhxqNdlknDNgF4cKjzQIipD5FDYo6USfkma9BcCsSGOmn1Xka9auBrZ42N9 i1XEjPsXdOLDyLlpstrB7ehWCL0fop5tCKMZ6Pz8tbplQuhOhFaqD4V8nBatCUwxqdFZIsclM FB215AW8DvS4J7rMi5UFJzKV9qT6uvWX9g5DBuMo9Ppdr4oZA8WvQMH44goj8QqTGAysuU8aS 7dn4p/d6ldtNR9hYXFQ6SUbXyk1zox88b4Leg4swSNkYzaEIDdUF3vNN6PDCrJA7XfR+BVJkk rLJuUXTLn/bCaVYDKfSPUSoCHLCxyjfH5xiwKpvMYkcLqsS/Yj+EXgkGaN7pd4lTJJTwyysMK O265YIQ46ZkZpv8v97d5kYuNd8rjVPcmwKh8MMjrQl8Hdg0xG8I0oCpQtDvQ2genFLTEhtaye emngIGpWB17R2Lvv7SzpHy2ghJVH4vhbzk4xjaB+NMm+rvziRDl5mOpUHgxHWNSQuwu+67tR4 fBf7nvAQTI1eTA35d6Yw== Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org The two drivers are almost identical and can work on a variety of hardware in principle. The mainstone driver supports additional hardware, and the zylonite driver has a few cleanup patches. Sync the two by adding the zylonite changes into the mainstone one, and checking for the zylonite board to order to keep the default behavior (interrupt enabled) there. Cc: Dmitry Torokhov Cc: linux-input@vger.kernel.org Signed-off-by: Arnd Bergmann Acked-by: Dmitry Torokhov --- drivers/input/touchscreen/mainstone-wm97xx.c | 59 ++++++++++---------- 1 file changed, 31 insertions(+), 28 deletions(-) -- 2.20.0 diff --git a/drivers/input/touchscreen/mainstone-wm97xx.c b/drivers/input/touchscreen/mainstone-wm97xx.c index 618c80847d9f..940d3c92b1f8 100644 --- a/drivers/input/touchscreen/mainstone-wm97xx.c +++ b/drivers/input/touchscreen/mainstone-wm97xx.c @@ -24,9 +24,9 @@ #include #include #include -#include #include -#include +#include +#include #include @@ -42,23 +42,22 @@ struct continuous { #define WM_READS(sp) ((sp / HZ) + 1) static const struct continuous cinfo[] = { - {WM9705_ID2, 0, WM_READS(94), 94}, - {WM9705_ID2, 1, WM_READS(188), 188}, - {WM9705_ID2, 2, WM_READS(375), 375}, - {WM9705_ID2, 3, WM_READS(750), 750}, - {WM9712_ID2, 0, WM_READS(94), 94}, - {WM9712_ID2, 1, WM_READS(188), 188}, - {WM9712_ID2, 2, WM_READS(375), 375}, - {WM9712_ID2, 3, WM_READS(750), 750}, - {WM9713_ID2, 0, WM_READS(94), 94}, - {WM9713_ID2, 1, WM_READS(120), 120}, - {WM9713_ID2, 2, WM_READS(154), 154}, - {WM9713_ID2, 3, WM_READS(188), 188}, + { WM9705_ID2, 0, WM_READS(94), 94 }, + { WM9705_ID2, 1, WM_READS(188), 188 }, + { WM9705_ID2, 2, WM_READS(375), 375 }, + { WM9705_ID2, 3, WM_READS(750), 750 }, + { WM9712_ID2, 0, WM_READS(94), 94 }, + { WM9712_ID2, 1, WM_READS(188), 188 }, + { WM9712_ID2, 2, WM_READS(375), 375 }, + { WM9712_ID2, 3, WM_READS(750), 750 }, + { WM9713_ID2, 0, WM_READS(94), 94 }, + { WM9713_ID2, 1, WM_READS(120), 120 }, + { WM9713_ID2, 2, WM_READS(154), 154 }, + { WM9713_ID2, 3, WM_READS(188), 188 }, }; /* continuous speed index */ static int sp_idx; -static u16 last, tries; static struct gpio_desc *gpiod_irq; /* @@ -102,7 +101,7 @@ static void wm97xx_acc_pen_up(struct wm97xx *wm) { unsigned int count; - schedule_timeout_uninterruptible(1); + msleep(1); if (cpu_is_pxa27x()) { while (MISR & (1 << 2)) @@ -117,13 +116,14 @@ static int wm97xx_acc_pen_down(struct wm97xx *wm) { u16 x, y, p = 0x100 | WM97XX_ADCSEL_PRES; int reads = 0; + static u16 last, tries; /* When the AC97 queue has been drained we need to allow time * to buffer up samples otherwise we end up spinning polling * for samples. The controller can't have a suitably low * threshold set to use the notifications it gives. */ - schedule_timeout_uninterruptible(1); + msleep(1); if (tries > 5) { tries = 0; @@ -193,6 +193,8 @@ static int wm97xx_acc_startup(struct wm97xx *wm) /* There is some obscure mutant of WM9712 interbred with WM9713 * used on Palm HW */ wm->variant = WM97xx_WM1613; + } else if (machine_is_zylonite()) { + pen_int = 1; } if (pen_int) { @@ -253,13 +255,13 @@ static void wm97xx_irq_enable(struct wm97xx *wm, int enable) } static struct wm97xx_mach_ops mainstone_mach_ops = { - .acc_enabled = 1, - .acc_pen_up = wm97xx_acc_pen_up, - .acc_pen_down = wm97xx_acc_pen_down, - .acc_startup = wm97xx_acc_startup, - .acc_shutdown = wm97xx_acc_shutdown, - .irq_enable = wm97xx_irq_enable, - .irq_gpio = WM97XX_GPIO_2, + .acc_enabled = 1, + .acc_pen_up = wm97xx_acc_pen_up, + .acc_pen_down = wm97xx_acc_pen_down, + .acc_startup = wm97xx_acc_startup, + .acc_shutdown = wm97xx_acc_shutdown, + .irq_enable = wm97xx_irq_enable, + .irq_gpio = WM97XX_GPIO_2, }; static int mainstone_wm97xx_probe(struct platform_device *pdev) @@ -274,14 +276,15 @@ static int mainstone_wm97xx_remove(struct platform_device *pdev) struct wm97xx *wm = platform_get_drvdata(pdev); wm97xx_unregister_mach_ops(wm); + return 0; } static struct platform_driver mainstone_wm97xx_driver = { - .probe = mainstone_wm97xx_probe, - .remove = mainstone_wm97xx_remove, - .driver = { - .name = "wm97xx-touch", + .probe = mainstone_wm97xx_probe, + .remove = mainstone_wm97xx_remove, + .driver = { + .name = "wm97xx-touch", }, }; module_platform_driver(mainstone_wm97xx_driver); From patchwork Fri Oct 18 15:41:44 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 176880 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp1032317ill; Fri, 18 Oct 2019 08:44:28 -0700 (PDT) X-Google-Smtp-Source: APXvYqwvk/bZFvdQigMD59Kn7+ZJPeCzPKjTTvGWJXoB4oxdZ7iKtYsL5FFMr2JD+9CJdjnk95rk X-Received: by 2002:a05:6402:2c5:: with SMTP id b5mr10521393edx.45.1571413468469; Fri, 18 Oct 2019 08:44:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571413468; cv=none; d=google.com; s=arc-20160816; b=UK+A2L+cKRrrvi1/BHWy7e0Kt5POG8RBXxRsNd/R0d9KOkqSNx1JPeHMeQOw6cpW7x s5C4d1aaRdHyNXogrYXoxNJ1TjhVBEONQZaplEsNDBxI4j0dzeiJ4FgJuhmft2AZR9wd GzoaO04NAvgqrA1CKazs7g8OWIXFWH4MO26FQyUb17jQ4m/SWwN5HB2k0MNp9BBVf0O5 BDAl5Y7R4uP+AzNl3l5bkLApfvB4bsBzi/WtpVeXgIVojq4ZJOf5GQf67xO3Bq3tv6Qg EbwxDY4OygAloMuLUteYfq3cMk1I9nuErZFkP1FPC7IIx9VSBY1u0P4akhaUpoXPbCxS C+aA== 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=IArHgfukJyOUfXvr+GEeYoAB/ZRw2Ky0Ehx9TbjQRwTNaed23q3Vvn3b5nPwxJu8V1 6QIdMNTuE4YudkoieSSJUaMr/iRDgJaInW2CWeHP3be9f0h1JGS0yId260PehZjgphzb HC4fMJUJa4CKFnug1aTKAMEbhI6v/sLj8mUlUCSGQRa0fsTH4wpTx8hxUbywl9xbRKLl X0mB2J/8ax/j5c++OTGGGc9shaeAQPRkDP4YVCZdGtDlZ3Q/xV0ArY6EasW9nX9BgL3r DkXXygNSy6/Wum7+NToK+eRH0/kcFeSyDVz7cjS6vY94xMdvdnZjSBX5XpL3AFbqeL76 2fow== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-input-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-input-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 j14si3430925ejf.53.2019.10.18.08.44.28 for ; Fri, 18 Oct 2019 08:44:28 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-input-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-input-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-input-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2502189AbfJRPo0 (ORCPT ); Fri, 18 Oct 2019 11:44:26 -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 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-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@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 Acked-by: Dmitry Torokhov Acked-by: Robert Jarzmik --- 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(-) -- 2.20.0 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");