Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp807623pxb; Fri, 22 Apr 2022 11:34:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxX3xwkJj2yabRujOnL6owGPMtoTfx5SGCFqzN/CzhnoZO3DszHbXNzXCUvdVg3BwkgQksZ X-Received: by 2002:a63:e952:0:b0:382:65eb:257 with SMTP id q18-20020a63e952000000b0038265eb0257mr5035453pgj.465.1650652461684; Fri, 22 Apr 2022 11:34:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650652461; cv=none; d=google.com; s=arc-20160816; b=NIYPCwYyMFt07W9a2aPYkqamPAFNY89MfD7OKWdF42wt56ishTEUNrBzN7dhlk+qMa VVIuRZ5Cio/WqPGvqQBrnSFoqX9LbD5Ql1H0ZmK7Zr8rxLAHRijpG6Hk1FiOTOUDw/58 wIRwa8oTH2PHYaKsWxOjo+fcyMOGxjTjELRaVVxOF+mMFaOmsEloB8iVzo/RPYrhS3RH XrtB2NwQXlRolr5PB/MggjkX8gutM8r4SIqKfvN2Ml5ZRdEEVdyahWtMHYASaA91NNP0 FVCV61JZ7aMDMAdjNsN79Bfc1RpeU8RzrugpVlanHD+VHt6n65iqhsLQjPy9IxUlDzy9 U+lg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=A5HppCJcsREV8bqaNulQ+xlPWn1aONR1jD6mLOJUbB4=; b=RNHP5zoG6eFRVDoDsmbHnKU67oOVhQqdPDtNGg+USYu7/0b/pRqOkU88MJefz1eJC/ N1I5HsY0opD/LvtYpOcZRP7NBL3EQXN5uTQhkvzKow41eAE+ySKJOpWcvlEptAmekpdz 8791TSV5SnwXEj/Qh0egY4RtutXbncjjXQn7GHEVpoE7h3m892KJY+g6iQL+FuA892zI KSp1Q6YuUUYmALtjdWXeOThVLcPBXkHDGyh17rV1yGlcoo0o5VHSzKwAiGbPdUhopmfS kui8XGsZtIV3+i6uzRlaScE+cfxQCh+cSfbqQiOZDuRptNnnjjyMiW0NR6/4xUBpTzh5 2T+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=WNtq6L7k; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id o8-20020a1709026b0800b00156f0783c58si8039232plk.47.2022.04.22.11.34.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 11:34:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=WNtq6L7k; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 67C60117A47; Fri, 22 Apr 2022 11:02:21 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1355314AbiDSQve (ORCPT + 99 others); Tue, 19 Apr 2022 12:51:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54500 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355104AbiDSQow (ORCPT ); Tue, 19 Apr 2022 12:44:52 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 61E11326ED; Tue, 19 Apr 2022 09:42:09 -0700 (PDT) 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 AAB6461866; Tue, 19 Apr 2022 16:42:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C61CCC385AC; Tue, 19 Apr 2022 16:42:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1650386528; bh=pMXP3tiz+pXmptnDBsvlTEJvLY7a6WjIQlAUDseVC7c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WNtq6L7kYzLqPo1CgDnRfCSkhbU40rWot44wiH0w7KY5q5PTaeX6yBsSjejpCMIO5 7YyF6BGgXkj9KCnK6hk1vKyGqJQqYGi0k986h/js2Dhzln1p0JAC3zoc9J0QoVPOEL TweRk/7T+kSDIDXkf8Ls1dRyo2LMdJPLhNkThXg9d52y29Ru+lYVKiNP2G3UFkn5vQ cGC7cmPNtQJ2U0GFsNug3uLKlp06uWSZX6uTKLJ1lTu+kvNpDykOw9NqOoWZtYj2UY ruEFGMjX0RkqbWcX1HOwB0ciYaSwKKyyeA+rysBsucYttmfP/kQc1miV4a16y8Cds+ GVXQTXNlRlmpA== 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 25/48] ARM: pxa: zylonite: use gpio lookup instead mfp header Date: Tue, 19 Apr 2022 18:37:47 +0200 Message-Id: <20220419163810.2118169-26-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 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.9 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, RDNS_NONE,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Arnd Bergmann The mach/mfp.h header is only used by this one driver for hardcoded gpio numbers. Change that to use a lookup table instead. Cc: Dmitry Torokhov Cc: linux-input@vger.kernel.org Acked-by: Robert Jarzmik Acked-by: Linus Walleij Signed-off-by: Arnd Bergmann --- arch/arm/mach-pxa/zylonite.c | 31 +++++++++++++++++++++ drivers/input/touchscreen/zylonite-wm97xx.c | 20 +++++++------ 2 files changed, 42 insertions(+), 9 deletions(-) diff --git a/arch/arm/mach-pxa/zylonite.c b/arch/arm/mach-pxa/zylonite.c index c48dd6d03df9..ba6dc86da855 100644 --- a/arch/arm/mach-pxa/zylonite.c +++ b/arch/arm/mach-pxa/zylonite.c @@ -32,6 +32,7 @@ #include #include #include +#include #include "devices.h" #include "generic.h" @@ -425,6 +426,35 @@ static void __init zylonite_init_ohci(void) static inline void zylonite_init_ohci(void) {} #endif /* CONFIG_USB_OHCI_HCD || CONFIG_USB_OHCI_HCD_MODULE */ +static struct gpiod_lookup_table zylonite_wm97xx_touch_gpio15_table = { + .dev_id = "wm97xx-touch.0", + .table = { + GPIO_LOOKUP("gpio-pxa", mfp_to_gpio(MFP_PIN_GPIO15), + "touch", GPIO_ACTIVE_LOW), + { }, + }, +}; + +static struct gpiod_lookup_table zylonite_wm97xx_touch_gpio26_table = { + .dev_id = "wm97xx-touch.0", + .table = { + GPIO_LOOKUP("gpio-pxa", mfp_to_gpio(MFP_PIN_GPIO26), + "touch", GPIO_ACTIVE_LOW), + { }, + }, +}; + +static void __init zylonite_init_wm97xx_touch(void) +{ + if (!IS_ENABLED(CONFIG_TOUCHSCREEN_WM97XX_ZYLONITE)) + return; + + if (cpu_is_pxa320()) + gpiod_add_lookup_table(&zylonite_wm97xx_touch_gpio15_table); + else + gpiod_add_lookup_table(&zylonite_wm97xx_touch_gpio26_table); +} + static void __init zylonite_init(void) { pxa_set_ffuart_info(NULL); @@ -450,6 +480,7 @@ static void __init zylonite_init(void) zylonite_init_nand(); zylonite_init_leds(); zylonite_init_ohci(); + zylonite_init_wm97xx_touch(); } MACHINE_START(ZYLONITE, "PXA3xx Platform Development Kit (aka Zylonite)") diff --git a/drivers/input/touchscreen/zylonite-wm97xx.c b/drivers/input/touchscreen/zylonite-wm97xx.c index f57bdf083188..cabdd6e3c6f8 100644 --- a/drivers/input/touchscreen/zylonite-wm97xx.c +++ b/drivers/input/touchscreen/zylonite-wm97xx.c @@ -17,14 +17,13 @@ #include #include #include -#include +#include #include #include #include #include #include -#include #include struct continuous { @@ -181,14 +180,17 @@ static struct wm97xx_mach_ops zylonite_mach_ops = { static int zylonite_wm97xx_probe(struct platform_device *pdev) { struct wm97xx *wm = platform_get_drvdata(pdev); - int gpio_touch_irq; - - if (cpu_is_pxa320()) - gpio_touch_irq = mfp_to_gpio(MFP_PIN_GPIO15); - else - gpio_touch_irq = mfp_to_gpio(MFP_PIN_GPIO26); + struct gpio_desc *gpio_touch_irq; + int err; + + gpio_touch_irq = devm_gpiod_get(&pdev->dev, "touch", GPIOD_IN); + err = PTR_ERR_OR_ZERO(gpio_touch_irq); + if (err) { + dev_err(&pdev->dev, "Cannot get irq gpio: %d\n", err); + return err; + } - wm->pen_irq = gpio_to_irq(gpio_touch_irq); + wm->pen_irq = gpiod_to_irq(gpio_touch_irq); irq_set_irq_type(wm->pen_irq, IRQ_TYPE_EDGE_BOTH); wm97xx_config_gpio(wm, WM97XX_GPIO_13, WM97XX_GPIO_IN, -- 2.29.2