From patchwork Tue Sep 26 13:25:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 13399247 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8A012E7E637 for ; Tue, 26 Sep 2023 13:26:13 +0000 (UTC) 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:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=xlvHtFFz8B8jL5t2XD8NhqDkoH182ukB4BaCMNLdLWQ=; b=nFsYCEaXyqCrqz Rmcpw3MK0t4Wnu6SKaf0bPK9YTN7mjKQLGIw47c7T5qIvG9ewUEuZ54RbWpHV9EJlyxbLgBlkzAya 8ctFJAVXguwnzn4AWBtjvNxXHU4kzuy/6Y9JeTX4ycdqYHp+QcHAwJ61UpTvsR8L8/NJJyxaVxwr8 zqro3sepKqvha6PVonz7LhhPvmHkaLUzyPesL43pPv1MLhmuYicg8Ff/J6FQdjvBwU0gJioljLn/B mB67/U4FJCc3kOPWxJiisSueaCZqvykf9SDMhJChl66IIsWrPIjSFHM/fuMi+b2lMCJPpFjb+pIFR UZWSI7nr0kDSvZIY8Pxw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1ql84S-00GSs7-10; Tue, 26 Sep 2023 13:25:48 +0000 Received: from mail-lf1-x12a.google.com ([2a00:1450:4864:20::12a]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1ql84L-00GSoh-1E for linux-arm-kernel@lists.infradead.org; Tue, 26 Sep 2023 13:25:43 +0000 Received: by mail-lf1-x12a.google.com with SMTP id 2adb3069b0e04-50437f39c9dso11809528e87.3 for ; Tue, 26 Sep 2023 06:25:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1695734737; x=1696339537; darn=lists.infradead.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=AQREjlFdBBHyFFcqZ7B0gSxB7/oIU5kFAtRf/hN0PRg=; b=WzcxSlXJyIzKTwVxt/U3TgWb2qlTkGfwB9KxOwaVnb5TRFN+TfV+lZFCIdwfEBYkMB IB7mFMb1mJ/dxxLA4BxDrnErWE8ool0P13fS4BJDny+U8ohGPhujzWU6jgcT5hzcsnNP U900dB6/DTSpg4KY3KMUKyC5Wtl+IAAjNlNYCuvqAUfHjzawnbt9IuIBmMlGV4e1kjOs FQgldXPCltoPsgd/sZMK4M3wX3geFC7IcyXXRY2URx2LXL/nPp0T4iPNkF3WM5MYS2FN ravs6RpFAY17RhnnLFx038k3zdHzXHNU5eErWZij4hAUl+rSMFulijRnwOBF+DBoM9n5 rqXA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695734737; x=1696339537; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=AQREjlFdBBHyFFcqZ7B0gSxB7/oIU5kFAtRf/hN0PRg=; b=k676bymYR5glLxKXTDdfOYPTLCKB5EunZxwNhDGN72rYSIXq0BFLJ+xTlP/T2cXUux zZUE4DVJL0SzFUlvx3Pli6WopP/OgSsRaYUPMOYm3MzZZin6HcHURbI+lZ9UkaQPCbnL 5LhSbiQ/CNiAj13BhdUKFoPDPc3Umb2T4TsDwVKcCCBYwOffNYc54m5PjLRbysk91mFb l2ulB+U4KB809G/rqwjI0d3+LWFWtfhEwlJ/oW8P7CckqtzjYSiVWANQRx0LM76IeHJf P493H3+3xaI1HUGFdCf7zj5qwnw9xu0CZJyNpUWpqm9IlT8jMJpRw2VeObM2y+W/FnkO uqdQ== X-Gm-Message-State: AOJu0YwEP7+SCiCoBAZftDuuDOcqOvL1M0b+TnPI+YOxq5d1058HvOTQ BYPT5ZgZKqPjTAlb3wyE17RXTQ== X-Google-Smtp-Source: AGHT+IHMuys/v1z41Pq9CuIIy/ftelPDGx7bWyJ6wtsGQexyv6AD5OHzXbCy8nEIXF0Y020uO07SZQ== X-Received: by 2002:a05:6512:104f:b0:500:b7dc:6c90 with SMTP id c15-20020a056512104f00b00500b7dc6c90mr9505051lfb.36.1695734736594; Tue, 26 Sep 2023 06:25:36 -0700 (PDT) Received: from [127.0.1.1] ([85.235.12.238]) by smtp.gmail.com with ESMTPSA id eq25-20020a056512489900b0050307bf2bcdsm2221540lfb.247.2023.09.26.06.25.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Sep 2023 06:25:36 -0700 (PDT) From: Linus Walleij Date: Tue, 26 Sep 2023 15:25:30 +0200 Subject: [PATCH 2/5] ASoC: ti: Convert RX51 to use exclusively GPIO descriptors MIME-Version: 1.0 Message-Id: <20230926-descriptors-asoc-ti-v1-2-60cf4f8adbc5@linaro.org> References: <20230926-descriptors-asoc-ti-v1-0-60cf4f8adbc5@linaro.org> In-Reply-To: <20230926-descriptors-asoc-ti-v1-0-60cf4f8adbc5@linaro.org> To: Tony Lindgren , Peter Ujfalusi , Jarkko Nikula , Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai Cc: linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org, alsa-devel@alsa-project.org, Linus Walleij X-Mailer: b4 0.12.3 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230926_062541_419031_FBA09285 X-CRM114-Status: GOOD ( 19.00 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The RX51/Nokia n900 uses the legacy GPIO header to convert a GPIO back to the global GPIO numberspace and then the jack using it in the snd_soc_jack_add_gpios() call immediately looks up the corresponding descriptor again. The snd_soc_jack_add_gpios() handles GPIOs passed with devices just fine: pass in the device instead, and rename the GPIO to match the property in the device tree, and it should work all the same but without all the trouble. Signed-off-by: Linus Walleij Tested-by: Jarkko Nikula --- sound/soc/ti/rx51.c | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/sound/soc/ti/rx51.c b/sound/soc/ti/rx51.c index 322c398d209b..047f852c79a9 100644 --- a/sound/soc/ti/rx51.c +++ b/sound/soc/ti/rx51.c @@ -10,7 +10,6 @@ */ #include -#include #include #include #include @@ -33,7 +32,6 @@ enum { struct rx51_audio_pdata { struct gpio_desc *tvout_selection_gpio; - struct gpio_desc *jack_detection_gpio; struct gpio_desc *eci_sw_gpio; struct gpio_desc *speaker_amp_gpio; }; @@ -198,7 +196,7 @@ static struct snd_soc_jack rx51_av_jack; static struct snd_soc_jack_gpio rx51_av_jack_gpios[] = { { - .name = "avdet-gpio", + .name = "jack-detection", .report = SND_JACK_HEADSET, .invert = 1, .debounce_time = 200, @@ -263,7 +261,6 @@ static const struct snd_kcontrol_new aic34_rx51_controls[] = { static int rx51_aic34_init(struct snd_soc_pcm_runtime *rtd) { struct snd_soc_card *card = rtd->card; - struct rx51_audio_pdata *pdata = snd_soc_card_get_drvdata(card); int err; snd_soc_limit_volume(card, "TPA6130A2 Headphone Playback Volume", 42); @@ -283,9 +280,9 @@ static int rx51_aic34_init(struct snd_soc_pcm_runtime *rtd) return err; } - /* prepare gpio for snd_soc_jack_add_gpios */ - rx51_av_jack_gpios[0].gpio = desc_to_gpio(pdata->jack_detection_gpio); - devm_gpiod_put(card->dev, pdata->jack_detection_gpio); + rx51_av_jack_gpios[0].gpiod_dev = card->dev; + /* Name is assigned in the struct */ + rx51_av_jack_gpios[0].idx = 0; err = snd_soc_jack_add_gpios(&rx51_av_jack, ARRAY_SIZE(rx51_av_jack_gpios), @@ -425,14 +422,6 @@ static int rx51_soc_probe(struct platform_device *pdev) return PTR_ERR(pdata->tvout_selection_gpio); } - pdata->jack_detection_gpio = devm_gpiod_get(card->dev, - "jack-detection", - GPIOD_ASIS); - if (IS_ERR(pdata->jack_detection_gpio)) { - dev_err(card->dev, "could not get jack detection gpio\n"); - return PTR_ERR(pdata->jack_detection_gpio); - } - pdata->eci_sw_gpio = devm_gpiod_get(card->dev, "eci-switch", GPIOD_OUT_HIGH); if (IS_ERR(pdata->eci_sw_gpio)) {