Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp1746469ybg; Sat, 19 Oct 2019 01:36:42 -0700 (PDT) X-Google-Smtp-Source: APXvYqxF7jBdYODuPTvws2wprsDVLs24DHdcPF6ClSCoVNjftZX7letib6AiKpDUxB2OmMVAuamB X-Received: by 2002:a05:6402:550:: with SMTP id i16mr14418203edx.102.1571474202602; Sat, 19 Oct 2019 01:36:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571474202; cv=none; d=google.com; s=arc-20160816; b=LwNsPS0OeW5Fy0eX39kK56lsEDPfCECrltUc1gYxbCykG3S7M5W9V0yzTC/FLguxfT OpBAOFNBSfPCwYusSJP1mXKO7QIB9pLrZ2F3pztWW5p3oXv5araZtu9Ipw2X45I+CkJP 4QzkD3vnTOFwtaARRXSjteDECfZSllBSUBgPxpZG5cW0fNaSjdNLlIeQKQgNNEQ6ljUr msnpsLeAh9+5w+hGxliCY7TJzCINUK6OqLXBa4runwutGJyKzUmzY59PcwXa/LKScYId SPXkc9C3ZtT/7CimHGPGu1/zBk+5YdH6RY/3BG1LXeJ915FsewOvHehRA50u7FhAbvtK gNtg== 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=MRnBrRZdGrK9fB0gBEbvh3ElYTjXTBgbkmhK3WblZtBd1OklkLWV2I8fUKh3V3rrnc ZU4fumsGazkwcK7t/w9D1OuO/FJnApWL8i3GijK5nMfdCr5Rg5cP8rmlEBszm1xGcpKE Crg+Yr+BFCWMoW/Opyqa2e2BIwsSO35TKfqCd3SU4w/6MMS9gJfYBTYePh9gj5et0Y12 mEr9/HLuZ9NkhiUujIvI6bAYBaPQLp/CMK0vkWP4Zniq6hHWGECiXUl7J2TqoK7ck+Id PeVDKiKA7NTDi2tq78wXOcJkWlwQgQNsGe8DpcqBUShF29sKwR+Y0yGngcVv0upNQvoF CVHw== 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 f2si4923424ejw.335.2019.10.19.01.36.19; Sat, 19 Oct 2019 01:36:42 -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 S2505382AbfJRPoB (ORCPT + 99 others); Fri, 18 Oct 2019 11:44:01 -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 Content-Transfer-Encoding: 8bit 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-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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 --- drivers/input/touchscreen/mainstone-wm97xx.c | 59 ++++++++++---------- 1 file changed, 31 insertions(+), 28 deletions(-) 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); -- 2.20.0