From patchwork Tue Apr 19 16:37:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 563355 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp3444716map; Tue, 19 Apr 2022 10:04:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx+pTagKQP/N0kXdYym/IoaRU8yC6oI0mEY1thOPE977TF4DehS2EKKWbATP8SI9v7F3pah X-Received: by 2002:a05:6e02:1e0a:b0:2cc:315a:8b1b with SMTP id g10-20020a056e021e0a00b002cc315a8b1bmr4383990ila.7.1650387845012; Tue, 19 Apr 2022 10:04:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650387845; cv=none; d=google.com; s=arc-20160816; b=fAfbcUV24NM8x+Vwg7SjrIeqmZA+kApp1F0mi9ViZlGQlgHEhRA5kDzDhz0yFoGnUp Lxrddk94Bcs2sWKSse9AblPUUzugSj2XhEpS/wzncY5UoMtk+Wbfbuz2cv6rspZaYQ/k MTcgKxpXC3CqzM+7c2TGNt0OSC3QXp5pgZu5FaWgug4lD7WmX3/mPIZUzAFHc4GnADCA 0zVN+uy+sKzqHgwTlN0h7FPkv8C0fSARsWoON348MRCZi8v4DH+MOJkHFJ4po/mqc3aE r9WYbZQPc77AGFxPSdQc2V9VlVRQLhBB2Bn3F77BrLVKB6KhMaZZmKFAv7/Txv3UHJ5r h6tg== 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=TDVj3Rw9UESdofSip89mYEwwYv7uwR9CMMBJhSO7YB4=; b=k8MUroiWJxiYZZUpEhg8Lzw64MePJSSZ+DGT9p6jQJQliIeOkkIXB4ql5fQaIf5RF7 24kPCVVuTcGURPyCdHjCOmnsl9WJCtWmB6rz1iPv5CRNNtNcwrWjxEoq2EOGuM67j4CK jp5HMY4IshiUFYbn7h2ySd6g3tWeN/ISwKHSs/cIUGywvArX8VUUY6eiEnQbVl5tPAUu LqA8g0l6N+GJp3V8NvdgoFC1VrRuKURail0ZS4e7VstvOeFdl2u+UqNW8dtO6mcODzTP OKRrq8ap56oOniPhCpXABTkSeEDZ3mp0gA83Yi9N7CM8pMkNUXxKY3hulz+6Uh+XubA8 qhyQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lists.infradead.org header.s=bombadil.20210309 header.b=CoRTbv5+; dkim=neutral (body hash did not verify) header.i=@kernel.org header.s=k20201202 header.b=M9+kiqJI; 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 z8-20020a5e8608000000b006533b8eebd8si5391240ioj.2.2022.04.19.10.04.04 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Apr 2022 10:04:04 -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=CoRTbv5+; dkim=neutral (body hash did not verify) header.i=@kernel.org header.s=k20201202 header.b=M9+kiqJI; 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=TDVj3Rw9UESdofSip89mYEwwYv7uwR9CMMBJhSO7YB4=; b=CoRTbv5+XNGsfZ UsVMS9hb6XMvKI8P5VRPBwYSMvNzCprpe2hOQ1Mu1wqY28tcEPefg1NEzej20IjSzivAmZ1Krd6dB SH0rXZ3UuYUBcZSiFjhZemnVqdnS+q6/qoJAQW+MK3w0cZLXPWm4Cd+AlO3VXbN/5pFefE9alrN9y AFzXFCho6orKqxWFDbJKt5s/iszDjKdkMP0idRuY/DR3m6+vZ0FR2EuU1rhbSQ/003G7ZjnHVpxfq NyXTwOMIS7Tsdv+4BhQIBmhQTlbRyK0dpdB6izQZ1af2//Rwl2jnDoWQiUkxmaBaZ0fT3biZIv8G8 Xx9OTPwH56lruZvrUw1g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ngrGd-0057ue-Cd; Tue, 19 Apr 2022 17:03:55 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1ngqvB-004xDd-VV; Tue, 19 Apr 2022 16:41:47 +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 66E976184D; Tue, 19 Apr 2022 16:41:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7B048C385A5; Tue, 19 Apr 2022 16:41:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1650386504; bh=F7MBpdNOWf67bimqHOji31bTXpJ1ZCUAsldDqvgUu28=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=M9+kiqJIfUhfsFE1H4YAU921VV0VonfY9j1NKObGUwzCjRXR46YiY5Nj5Dl5rsV5L iADk6/ddM85QG95gOh8OUVYyoEgAxa4D3s0bKJkfzDri4GMhVZSzQQuTx0F/9H+wsJ MVlTyeihlRVWFJ5B3aJxEUdAG2tMIaPk7ers3/ONTltRkZsg/z88XIF9SNvMLClZls I6TvEKcDx5DRBX76OZrUNtcSo4m6dLcfqZX2lAkhvSfR9zZVl354Yk7Zy6TbAGL6Ya K7sfhczH1+GW+wFu7/eCNYeSzMXgdYelcxwq9ivucHJV+x+FdLYDsJhrGZDEpOBDtI Wp06/+3vmFtwg== 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 22/48] ARM: pxa: z2: use gpio lookup for audio device Date: Tue, 19 Apr 2022 18:37:44 +0200 Message-Id: <20220419163810.2118169-23-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_094146_158301_9C246B2E X-CRM114-Status: GOOD ( 22.13 ) 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 The audio device is allocated by the audio driver, and it uses a gpio number from the mach/z2.h header file. Change it to use a gpio lookup table for the device allocated by the driver to keep the header file local to the machine. 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 [2604:1380:4641:c500:0:0:0:1 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 The audio device is allocated by the audio driver, and it uses a gpio number from the mach/z2.h header file. Change it to use a gpio lookup table for the device allocated by the driver to keep the header file local to the machine. Acked-by: Mark Brown Cc: alsa-devel@alsa-project.org Reviewed-by: Linus Walleij Acked-by: Robert Jarzmik Signed-off-by: Arnd Bergmann Reviewed-by: Linus Walleij --- arch/arm/mach-pxa/z2.c | 11 +++++++++++ sound/soc/pxa/z2.c | 5 ++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/arch/arm/mach-pxa/z2.c b/arch/arm/mach-pxa/z2.c index 7eaeda269927..bb854e903c8f 100644 --- a/arch/arm/mach-pxa/z2.c +++ b/arch/arm/mach-pxa/z2.c @@ -651,6 +651,15 @@ static void __init z2_spi_init(void) static inline void z2_spi_init(void) {} #endif +static struct gpiod_lookup_table z2_audio_gpio_table = { + .dev_id = "soc-audio", + .table = { + GPIO_LOOKUP("gpio-pxa", GPIO37_ZIPITZ2_HEADSET_DETECT, + "hsdet-gpio", GPIO_ACTIVE_HIGH), + { }, + }, +}; + /****************************************************************************** * Core power regulator ******************************************************************************/ @@ -755,6 +764,8 @@ static void __init z2_init(void) z2_keys_init(); z2_pmic_init(); + gpiod_add_lookup_table(&z2_audio_gpio_table); + pm_power_off = z2_power_off; } diff --git a/sound/soc/pxa/z2.c b/sound/soc/pxa/z2.c index dc6c48e4738b..7f1c6bc69510 100644 --- a/sound/soc/pxa/z2.c +++ b/sound/soc/pxa/z2.c @@ -13,7 +13,7 @@ #include #include #include -#include +#include #include #include @@ -22,7 +22,6 @@ #include #include -#include #include "../codecs/wm8750.h" #include "pxa2xx-i2s.h" @@ -89,7 +88,6 @@ static struct snd_soc_jack_pin hs_jack_pins[] = { /* Headset jack detection gpios */ static struct snd_soc_jack_gpio hs_jack_gpios[] = { { - .gpio = GPIO37_ZIPITZ2_HEADSET_DETECT, .name = "hsdet-gpio", .report = SND_JACK_HEADSET, .debounce_time = 200, @@ -195,6 +193,7 @@ static int __init z2_init(void) if (!z2_snd_device) return -ENOMEM; + hs_jack_gpios[0].gpiod_dev = &z2_snd_device->dev; platform_set_drvdata(z2_snd_device, &snd_soc_z2); ret = platform_device_add(z2_snd_device);