From patchwork Tue Sep 26 13:25:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 13399246 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 9074CE7E635 for ; Tue, 26 Sep 2023 13:26:11 +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=l8re13//KXviKjGAfbMt5LiUz/D6HWfYpq39MHadpK4=; b=MwbfGdcRgJex3a 6sJHRxc5PuPqcWw0VWI004zVsXhLDkpC4nMDLYVk6VOLIHfsMKo6wEj2XMwa2IHbRKOYb0J7/Ieiw nHBQLxZDTHit2n1StBAcVd/2DAMrL1EBlzAa5xxXoeMYCbN/pdRpui5eqTJag0t52VR7k8XR+2mYJ 8WY2LbILoC0ViIsD4Zr4dI1wmR/Ls1Qm0VlHT0fyPvHFgJZul/dHPK/C3NRUU9Mqsfs9s3Q6t1vdg YlAUNpFogNg/6/hBgV2ysdMhEUX/HlG+EPEtDThHva8B4A5fp2BTAlJNxWWX4GjPzIPk3uBReb8/Z U+6V4iQEGU1ZevoIm4uw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1ql84S-00GSsR-2i; Tue, 26 Sep 2023 13:25:48 +0000 Received: from mail-lf1-x12b.google.com ([2a00:1450:4864:20::12b]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1ql84M-00GSow-11 for linux-arm-kernel@lists.infradead.org; Tue, 26 Sep 2023 13:25:43 +0000 Received: by mail-lf1-x12b.google.com with SMTP id 2adb3069b0e04-504427aae4fso7906816e87.1 for ; Tue, 26 Sep 2023 06:25:39 -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=PP4dsIT0hsQMnKCfQfmUy8AzAauOm+H9b2ueCh3mGC0=; b=O3Nx6/1zK2TZ3FG199rut2CNW1meSymADKY54hBdWBwediVnDJFKPCirdR1GOyFW13 8TrNoPof53/cm0nxvaxY05I08G4DXITjBWcXUvbKxdilt/oYRFowYMI/WutWqIuNjAvZ gB+fTn/QgvY5U8gd7efvHHtcM+DmtL/1c6K/QBvn3QkvCyGWYt5LD0uO9cdMqWOYpkBx mnYiNrC8mKH2vBF4wy65S3xDI/OBMHV0U6GUFBpGar1objmaswcXeue+MWCsKvQPMLXs pdp+dQPh17Gg2vFxdPcnTCtszDzABDqkxXQ/8E9XY3ZvZIa1GSADhDQpRJiwB6yMqojw xlrQ== 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=PP4dsIT0hsQMnKCfQfmUy8AzAauOm+H9b2ueCh3mGC0=; b=piUbbn+UJINJeZ4W4VnyjS/fHPtw1EJgA2M++XO1UIwd6/3LOZbGgZf/CsrEYKXZIU O3LkYRRDJuxmmPBri64tBItKr/rECR8YLQEZ0eoo8St/aaivc+jswdu6aSCBLpmrTbWq 1DhjRPCAnAkqOi0k8bGtuCXbwq9xt4emiXVG+t6KKDVUgCDg2ksCHucXerXEJGWdd+Gy +sv4g5jwVSotzy+uDQwVCFoLGzvz9D8isRbOhLFCDArI2gDy1Sr3afPqEBWMl/uU6496 jLVUzxZHyQ7Xgki4IJVXZF623jk9Un6Se0JzH1dqOZCBZUMEFXxXEX820sJuepcPd4C2 iQLA== X-Gm-Message-State: AOJu0YyW4fmBFErHIOrEkt/pvxqPLy7rx1GocGJd+DrO6DYIAkP0Zkyb gn7hMSdSkmWnHAP2pLZ4pyOXaw== X-Google-Smtp-Source: AGHT+IHjNjM07GGKUJBQohAZCxjfCTTm3uisP+onS6McTyzKEkNGgzi9C5o8RDP6x4JphD2R52UnRg== X-Received: by 2002:a05:6512:304b:b0:503:2567:c42f with SMTP id b11-20020a056512304b00b005032567c42fmr1048278lfb.0.1695734737749; Tue, 26 Sep 2023 06:25:37 -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.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Sep 2023 06:25:37 -0700 (PDT) From: Linus Walleij Date: Tue, 26 Sep 2023 15:25:31 +0200 Subject: [PATCH 3/5] ASoC: ti: Convert TWL4030 to use GPIO descriptors MIME-Version: 1.0 Message-Id: <20230926-descriptors-asoc-ti-v1-3-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_062542_359470_2D6DF52B X-CRM114-Status: GOOD ( 22.87 ) 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 TWL4030 is actually only ever populated from the device tree, so we can just pass the right device and headphone jack GPIO name to snd_soc_jack_add_gpios() and it will pick the right GPIO right from the device tree. The platform data patch is unused (no in-tree users of the pdata method) but these can use GPIO descriptor tables rather than global GPIO numbers if they need this. Signed-off-by: Linus Walleij --- include/linux/platform_data/omap-twl4030.h | 3 --- sound/soc/ti/omap-twl4030.c | 20 ++++++++------------ 2 files changed, 8 insertions(+), 15 deletions(-) diff --git a/include/linux/platform_data/omap-twl4030.h b/include/linux/platform_data/omap-twl4030.h index 0dd851ea1c72..7fcb55fe21c9 100644 --- a/include/linux/platform_data/omap-twl4030.h +++ b/include/linux/platform_data/omap-twl4030.h @@ -37,9 +37,6 @@ struct omap_tw4030_pdata { bool has_digimic0; bool has_digimic1; u8 has_linein; - - /* Jack detect GPIO or <= 0 if it is not implemented */ - int jack_detect; }; #endif /* _OMAP_TWL4030_H_ */ diff --git a/sound/soc/ti/omap-twl4030.c b/sound/soc/ti/omap-twl4030.c index 950eec44503b..c7055bb424e6 100644 --- a/sound/soc/ti/omap-twl4030.c +++ b/sound/soc/ti/omap-twl4030.c @@ -20,8 +20,6 @@ #include #include #include -#include -#include #include #include @@ -31,7 +29,6 @@ #include "omap-mcbsp.h" struct omap_twl4030 { - int jack_detect; /* board can detect jack events */ struct snd_soc_jack hs_jack; }; @@ -130,7 +127,7 @@ static struct snd_soc_jack_pin hs_jack_pins[] = { /* Headset jack detection gpios */ static struct snd_soc_jack_gpio hs_jack_gpios[] = { { - .name = "hsdet-gpio", + .name = "ti,jack-det", .report = SND_JACK_HEADSET, .debounce_time = 200, }, @@ -151,9 +148,13 @@ static int omap_twl4030_init(struct snd_soc_pcm_runtime *rtd) struct omap_twl4030 *priv = snd_soc_card_get_drvdata(card); int ret = 0; - /* Headset jack detection only if it is supported */ - if (priv->jack_detect > 0) { - hs_jack_gpios[0].gpio = priv->jack_detect; + /* + * This is a bit of a hack, but the GPIO is optional so we + * only want to add the jack detection if the GPIO is there. + */ + if (of_property_present(card->dev->of_node, "ti,jack-det-gpio")) { + hs_jack_gpios[0].gpiod_dev = card->dev; + hs_jack_gpios[0].idx = 0; ret = snd_soc_card_jack_new_pins(rtd->card, "Headset Jack", SND_JACK_HEADSET, @@ -279,9 +280,6 @@ static int omap_twl4030_probe(struct platform_device *pdev) omap_twl4030_dai_links[1].platforms->of_node = dai_node; } - priv->jack_detect = of_get_named_gpio(node, - "ti,jack-det-gpio", 0); - /* Optional: audio routing can be provided */ prop = of_find_property(node, "ti,audio-routing", NULL); if (prop) { @@ -302,8 +300,6 @@ static int omap_twl4030_probe(struct platform_device *pdev) if (!pdata->voice_connected) card->num_links = 1; - - priv->jack_detect = pdata->jack_detect; } else { dev_err(&pdev->dev, "Missing pdata\n"); return -ENODEV;