From patchwork Fri Oct 18 15:41:31 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 11198821 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CBC01112B for ; Fri, 18 Oct 2019 15:45:08 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 6308D21852 for ; Fri, 18 Oct 2019 15:45:08 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="hPyF5iFQ" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6308D21852 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arndb.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 79A9E15E2; Fri, 18 Oct 2019 17:44:15 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 79A9E15E2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1571413505; bh=rRAxC5hmo1QPLC0FHNO3o/NTlBPG1j3UWMShBS1CYWk=; h=From:To:Date:In-Reply-To:References:Cc:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=hPyF5iFQ7hX2s7ODq3HTB1gmwEAX8vv56rUNeHkP46VcH16V8o24KT4uwigNOSoEj Fo2Fzn7/94txJ6ifzCeM4mTda9rNy0eMdanuy3lt1z0dqzw5lZAbB6oK45AUvdIsKY MbQ13L/n9BFojnK16Pho7QHjve5WVncw65SanHA4= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 52C76F80612; Fri, 18 Oct 2019 17:42:37 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa1.perex.cz (Postfix, from userid 50401) id 22953F800F3; Fri, 18 Oct 2019 17:42:29 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on alsa1.perex.cz X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=SPF_HELO_NONE,SPF_NONE, URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from mout.kundenserver.de (mout.kundenserver.de [217.72.192.74]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 0BE36F800F3 for ; Fri, 18 Oct 2019 17:42:26 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 0BE36F800F3 Received: from threadripper.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue108 [212.227.15.145]) with ESMTPA (Nemesis) id 1MG9Xu-1iFzgL1eRQ-00GVSz; Fri, 18 Oct 2019 17:42:25 +0200 From: Arnd Bergmann To: Daniel Mack , Haojian Zhuang , Robert Jarzmik Date: Fri, 18 Oct 2019 17:41:31 +0200 Message-Id: <20191018154201.1276638-16-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:E20XgLKSQLAmPv/Au++8EwmYOgk3y+XACbUkV3LAih2e2Yj07KM g05RSY7gyHzJgD4iIfT7YhtgXiu1Lr1vuBtrh6M2wc4pYSmo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Q== Cc: alsa-devel@alsa-project.org, Arnd Bergmann , Linus Walleij , linux-kernel@vger.kernel.org, Mark Brown , linux-arm-kernel@lists.infradead.org Subject: [alsa-devel] [PATCH 16/46] ARM: pxa: tosa: use gpio descriptor for audio X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" The audio driver should not use a hardwired gpio number from the header. Change it to use a lookup table. Cc: Mark Brown Cc: alsa-devel@alsa-project.org Signed-off-by: Arnd Bergmann Acked-by: Mark Brown Acked-by: Robert Jarzmik --- 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 264b5b6ed13b..9a7f1e42adac 100644 --- a/arch/arm/mach-pxa/tosa.c +++ b/arch/arm/mach-pxa/tosa.c @@ -859,6 +859,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, @@ -916,6 +927,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 81ee1bcf4c44..d671cf3d44ed 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; }