From patchwork Tue Apr 19 16:37:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 563348 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp3439029map; Tue, 19 Apr 2022 09:56:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzTztqrrZdTFZfsATyeqFUUTjSnQGzC/rF21xlBE/MljY7JX7Oymt8Z8RdW4XG4LRXExle7 X-Received: by 2002:a17:902:e741:b0:159:627:544c with SMTP id p1-20020a170902e74100b001590627544cmr8886563plf.84.1650387410579; Tue, 19 Apr 2022 09:56:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650387410; cv=none; d=google.com; s=arc-20160816; b=qFy+fwBnuT5IXibjJEhfM7R3MHh3VArmrz1RP1GWSm9FrDKeMZPppZWbxUVdG4qI/V Rtg2NtUeCvowOLJHMlQ23JFm5/o2Je2Ypy+LJbVd8A+z0C6AkqE7Hmo1x9b0j/cVBQ3a hMOYamnYHup8UupGgo8p9eOej4mvH8NkpPBgh691R9932NZ4b9Q5P/5grNlZ5p9fNyPS 7R3vEvFysScuXKcKnD+P95LCc+T8oz/y4GFjCpw15NgUPhqqTvPqu/1DPG+EAZlHRYO6 41skDbUY1Z2NKLT6MW0BzgZq9U7pXzafld2BdUNKPCGu+t4qhigqlSbsViJw/z3p2+ri R9pg== 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=ac5n3PV3vaPk2fugdDMQOJFopR/DYyYgrar0gS2VWJg=; b=ECU7ccglZtlR5928KqPyTONvezkE5jWez8/d9UkMfcOdl5AvNRSWKqC+bL2QxFpd5K 1yxuS8CM2HWwS2ERiOxB1GySoPTQf6LI9NEtDu7zDpe6C3UZ9Cf5DRwDvaJkLx61fC6d e2Yc2sMW2dCapOeCt1qfsWuat8bs8PIug6zImn5zWG2nnCwPYs7nTCuVxseJEtvsfLqD bJqW8Vrm0/CfDx7hVvrp4cNXpToWbDngwjgAWprltmFx4BRJi3jrV+/KM/7M8DntLXZY Mx35xCdnPdMxh4vutl0KhdlPyG//oT6zowno1bSryPUoZn5TCBUhmxwsnG69YufK67T2 R3ug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lists.infradead.org header.s=bombadil.20210309 header.b=ppDiSsMc; dkim=neutral (body hash did not verify) header.i=@kernel.org header.s=k20201202 header.b=IQZbCphc; 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 m4-20020a1709026bc400b00153b2d1645asi11600899plt.98.2022.04.19.09.56.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Apr 2022 09:56:50 -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=ppDiSsMc; dkim=neutral (body hash did not verify) header.i=@kernel.org header.s=k20201202 header.b=IQZbCphc; 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=ac5n3PV3vaPk2fugdDMQOJFopR/DYyYgrar0gS2VWJg=; b=ppDiSsMcj7r1iA nTBo9h3c84gAqB8uTE/tVWhxNmWG+E2TAQnx5Mmje3tivvVdmRiRGBfsmsAVcbjB50rufRiqN/xwz N/aM1nEbckeNWrj1HBAIsrfl9f9ON0kotF7ZwhDI9kA85FR23TsRZJ8bdSIz+Ls0OgK3zh/70dCid WHprkX6t2JV0l4MkzPyMHX4wAD0luVHnZ/d6pTbq+2+xTU6HGVxoRJbhaCB4rnBUpu4Nk+z/L/B/6 W+8cdMQOEtGZhBA5eAwbSF+Z88vxYv/i4r9yRuy4BPWHq6k+vO5tCEW0JRe1EWFizaW4+/YbkH9dB La9DbenO19FkOPKloOBw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ngr9C-0054Kj-60; Tue, 19 Apr 2022 16:56:14 +0000 Received: from ams.source.kernel.org ([2604:1380:4601:e00::1]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1ngquK-004wgB-Ml; Tue, 19 Apr 2022 16:40:54 +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 ams.source.kernel.org (Postfix) with ESMTPS id 57A46B819F8; Tue, 19 Apr 2022 16:40:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B8675C385AD; Tue, 19 Apr 2022 16:40:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1650386450; bh=jhDfr1ZWF3PO87dsTFnhjEgY7CrgFIhStoxQAjgbO8c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IQZbCphc2aVG/7nQPc8i6SmaXQBHDLcd8lu8VCmzfuxTE9zQ1fttSmG7EuqkoEKfV +AijdqGUGVaVV7Gc6JQtpvmfbM8oJLiqSVhH1EBaliC1N03xEc1T1smfyTfNlPQ+ci g7D2ubLO4DZSZbQ1S7mLLZAjhkr/Lf9nzpyNW7rUgW2JoDBYVacKhRiIFK/VFk/Xdk UDw/LuEvBj9xe6IYc/bXh3fl9uuuA9b3Lcl7FHH7ZpoOjUIFEYceuWcUa/cIuAsEha DxLdKbU1RVdss4xqHuQUN0IBiEAqCfNSmrZdnpLyeTBHr4KtQrWshWX4LLED0dDmoN GxgomaIMHhKEQ== 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 15/48] ARM: pxa: tosa: use gpio descriptor for audio Date: Tue, 19 Apr 2022 18:37:37 +0200 Message-Id: <20220419163810.2118169-16-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_094053_075405_5E8D2D52 X-CRM114-Status: GOOD ( 21.25 ) 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 driver should not use a hardwired gpio number from the header. Change it to use a lookup table. Acked-by: Mark Brown Acked-by: Robert Jarzmik Cc: alsa-devel@alsa-project.org Signed-off-by: Arnd Bergmann --- arch/arm/mach-pxa/tosa.c | [...] 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:4601:e00: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 driver should not use a hardwired gpio number from the header. Change it to use a lookup table. Acked-by: Mark Brown Acked-by: Robert Jarzmik Cc: alsa-devel@alsa-project.org Signed-off-by: Arnd Bergmann Reviewed-by: Linus Walleij --- arch/arm/mach-pxa/tosa.c | 12 ++++++++++++ sound/soc/pxa/tosa.c | 16 +++++++--------- 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/arch/arm/mach-pxa/tosa.c b/arch/arm/mach-pxa/tosa.c index 9476ed0f55e9..5a16a025192c 100644 --- a/arch/arm/mach-pxa/tosa.c +++ b/arch/arm/mach-pxa/tosa.c @@ -887,6 +887,17 @@ static struct platform_device wm9712_device = { .id = -1, }; +static struct gpiod_lookup_table tosa_audio_gpio_table = { + .dev_id = "tosa-audio", + .table = { + GPIO_LOOKUP("tc6393xb", + TOSA_GPIO_L_MUTE - TOSA_TC6393XB_GPIO_BASE, + "l-mute", GPIO_ACTIVE_HIGH), + { }, + }, +}; + + static struct platform_device tosa_audio_device = { .name = "tosa-audio", .id = -1, @@ -944,6 +955,7 @@ static void __init tosa_init(void) PMCR = 0x01; gpiod_add_lookup_table(&tosa_mci_gpio_table); + gpiod_add_lookup_table(&tosa_audio_gpio_table); pxa_set_mci_info(&tosa_mci_platform_data); pxa_set_ficp_info(&tosa_ficp_platform_data); pxa_set_i2c_info(NULL); diff --git a/sound/soc/pxa/tosa.c b/sound/soc/pxa/tosa.c index 06226f9b863e..157e6bcacffd 100644 --- a/sound/soc/pxa/tosa.c +++ b/sound/soc/pxa/tosa.c @@ -16,14 +16,13 @@ #include #include #include -#include +#include #include #include #include #include -#include #include #define TOSA_HP 0 @@ -35,6 +34,7 @@ static int tosa_jack_func; static int tosa_spk_func; +static struct gpio_desc *l_mute_gpio; static void tosa_ext_control(struct snd_soc_dapm_context *dapm) { @@ -128,7 +128,7 @@ static int tosa_set_spk(struct snd_kcontrol *kcontrol, static int tosa_hp_event(struct snd_soc_dapm_widget *w, struct snd_kcontrol *k, int event) { - gpio_set_value(TOSA_GPIO_L_MUTE, SND_SOC_DAPM_EVENT_ON(event) ? 1 : 0); + gpiod_set_value(l_mute_gpio, SND_SOC_DAPM_EVENT_ON(event) ? 1 : 0); return 0; } @@ -222,25 +222,23 @@ static int tosa_probe(struct platform_device *pdev) struct snd_soc_card *card = ⤩ int ret; - ret = gpio_request_one(TOSA_GPIO_L_MUTE, GPIOF_OUT_INIT_LOW, - "Headphone Jack"); + l_mute_gpio = devm_gpiod_get(&pdev->dev, "l-mute", GPIOD_OUT_LOW); + ret = PTR_ERR_OR_ZERO(l_mute_gpio); if (ret) return ret; card->dev = &pdev->dev; ret = devm_snd_soc_register_card(&pdev->dev, card); - if (ret) { + if (ret) dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n", ret); - gpio_free(TOSA_GPIO_L_MUTE); - } + return ret; } static int tosa_remove(struct platform_device *pdev) { - gpio_free(TOSA_GPIO_L_MUTE); return 0; }