{"id":2230089,"url":"http://patchwork.ozlabs.org/api/1.1/patches/2230089/?format=json","web_url":"http://patchwork.ozlabs.org/project/linux-gpio/patch/20260429074356.118420-11-herve.codina@bootlin.com/","project":{"id":42,"url":"http://patchwork.ozlabs.org/api/1.1/projects/42/?format=json","name":"Linux GPIO development","link_name":"linux-gpio","list_id":"linux-gpio.vger.kernel.org","list_email":"linux-gpio@vger.kernel.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20260429074356.118420-11-herve.codina@bootlin.com>","date":"2026-04-29T07:43:46","name":"[v2,10/17] ASoC: simple-amplifier: gpio-audio-amp: Add support for extra power supplies","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"54bf8e5f6e09f4880fed88f3af8c497fb32b16ee","submitter":{"id":81983,"url":"http://patchwork.ozlabs.org/api/1.1/people/81983/?format=json","name":"Herve Codina","email":"herve.codina@bootlin.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/linux-gpio/patch/20260429074356.118420-11-herve.codina@bootlin.com/mbox/","series":[{"id":502009,"url":"http://patchwork.ozlabs.org/api/1.1/series/502009/?format=json","web_url":"http://patchwork.ozlabs.org/project/linux-gpio/list/?series=502009","date":"2026-04-29T07:43:41","name":"ASoC: Add support for GPIOs driven amplifiers","version":2,"mbox":"http://patchwork.ozlabs.org/series/502009/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/2230089/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/2230089/checks/","tags":{},"headers":{"Return-Path":"\n <linux-gpio+bounces-35767-incoming=patchwork.ozlabs.org@vger.kernel.org>","X-Original-To":["incoming@patchwork.ozlabs.org","linux-gpio@vger.kernel.org"],"Delivered-To":"patchwork-incoming@legolas.ozlabs.org","Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=bootlin.com header.i=@bootlin.com header.a=rsa-sha256\n header.s=dkim header.b=c2e5JnIE;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=2600:3c04:e001:36c::12fc:5321; helo=tor.lore.kernel.org;\n envelope-from=linux-gpio+bounces-35767-incoming=patchwork.ozlabs.org@vger.kernel.org;\n receiver=patchwork.ozlabs.org)","smtp.subspace.kernel.org;\n\tdkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com\n header.b=\"c2e5JnIE\"","smtp.subspace.kernel.org;\n arc=none smtp.client-ip=185.171.202.116","smtp.subspace.kernel.org;\n dmarc=pass (p=reject dis=none) header.from=bootlin.com","smtp.subspace.kernel.org;\n spf=pass smtp.mailfrom=bootlin.com"],"Received":["from tor.lore.kernel.org (tor.lore.kernel.org\n [IPv6:2600:3c04:e001:36c::12fc:5321])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4g58Yt6t8Wz1yHv\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 29 Apr 2026 17:48:34 +1000 (AEST)","from smtp.subspace.kernel.org (conduit.subspace.kernel.org\n [100.90.174.1])\n\tby tor.lore.kernel.org (Postfix) with ESMTP id F04BD302FEAF\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 29 Apr 2026 07:45:30 +0000 (UTC)","from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id 6D21B33DEDD;\n\tWed, 29 Apr 2026 07:44:39 +0000 (UTC)","from smtpout-04.galae.net (smtpout-04.galae.net [185.171.202.116])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby smtp.subspace.kernel.org (Postfix) with ESMTPS id A4C2A3B27CD\n\tfor <linux-gpio@vger.kernel.org>; Wed, 29 Apr 2026 07:44:37 +0000 (UTC)","from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233])\n\tby smtpout-04.galae.net (Postfix) with ESMTPS id 9464BC5CD5A;\n\tWed, 29 Apr 2026 07:45:20 +0000 (UTC)","from mail.galae.net (mail.galae.net [212.83.136.155])\n\tby smtpout-01.galae.net (Postfix) with ESMTPS id 92AB3601DF;\n\tWed, 29 Apr 2026 07:44:36 +0000 (UTC)","from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon)\n with ESMTPSA id 95089107298A3;\n\tWed, 29 Apr 2026 09:44:33 +0200 (CEST)"],"ARC-Seal":"i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1777448679; cv=none;\n b=V8JrZQg26LFIcRqJYB20mIs9Gae4+gpN9XCZGHKSrQZ539blHoDRFqVorrTMAiKKQN8AgYo4q8Zpj9pbe8J6+RztLsA4TJQyNgj4eyeJ/jNgmTW7gPVtuIlO3I/Aj4Xn1ET9yQmca5CfEai8+VkE11UwdQvUe5J85eqpNcIbCRA=","ARC-Message-Signature":"i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1777448679; c=relaxed/simple;\n\tbh=Tq9Zm5cc8QAyn6CoesgnMmrTCJ/2c3DE+Za8nxun/8U=;\n\th=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:\n\t MIME-Version;\n b=t5w0KFDGU8F+7Zj+g/gJdz7J0eNVVLaQJhGhUDB4YrR7xySpIfKnYWdXAxHWjpQKiqkTKaVGbaFeCJGlboZcdKMjZ4O5zQGJPLvSERQ5FlkV8NfXBg9Byj3ODSZKOYm5N0NVGIk+8sFN9zPptt5ZZM2Q8y4nKGzyQydPshugaAM=","ARC-Authentication-Results":"i=1; smtp.subspace.kernel.org;\n dmarc=pass (p=reject dis=none) header.from=bootlin.com;\n spf=pass smtp.mailfrom=bootlin.com;\n dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com\n header.b=c2e5JnIE; arc=none smtp.client-ip=185.171.202.116","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim;\n\tt=1777448675; h=from:subject:date:message-id:to:cc:mime-version:\n\t content-transfer-encoding:in-reply-to:references;\n\tbh=zPHbeqWn73H0ZvBSUfxN/4jGBDJpeb4A0vDFShhp6ms=;\n\tb=c2e5JnIE2JY6xEja9UFUxU6quTMyEyqNo9/zfoufj5HupML1SsqzN5qsmpRrxEhH4X0FPs\n\tT8hw5uuF52aikZWOzkrgWYFqbJPoMGl8/B1Ua5hmdllzS0U3+5DDutsI8tmIj7W1kj2r9D\n\tLwsi6PHU18jOzUHPusAsVmcAvd2ztkG58RrPAh441Sd1OWjCO+L4N2m7s3F7SgNJLidA80\n\trUkmp6RfXxUco8E/D2+qRGSwGZq4RYz0+1lUfGCJRwb+H+VJwF0jC72rka+DPNT0f5h1sQ\n\tswPdmNdrKXsBZPHSKQDUk80ox5OgH20WBAu77N4kUH8EQ3St4FCYIr9anZ9GUw==","From":"Herve Codina <herve.codina@bootlin.com>","To":"Herve Codina <herve.codina@bootlin.com>,\n\tBartosz Golaszewski <brgl@kernel.org>,\n\tLinus Walleij <linusw@kernel.org>,\n\tLiam Girdwood <lgirdwood@gmail.com>,\n\tMark Brown <broonie@kernel.org>,\n\tRob Herring <robh@kernel.org>,\n\tKrzysztof Kozlowski <krzk+dt@kernel.org>,\n\tConor Dooley <conor+dt@kernel.org>,\n\tSaravana Kannan <saravanak@kernel.org>,\n\tJaroslav Kysela <perex@perex.cz>,\n\tTakashi Iwai <tiwai@suse.com>","Cc":"linux-sound@vger.kernel.org,\n\tlinux-gpio@vger.kernel.org,\n\tdevicetree@vger.kernel.org,\n\tlinux-kernel@vger.kernel.org,\n\tChristophe Leroy <christophe.leroy@csgroup.eu>,\n\tThomas Petazzoni <thomas.petazzoni@bootlin.com>","Subject":"[PATCH v2 10/17] ASoC: simple-amplifier: gpio-audio-amp: Add support\n for extra power supplies","Date":"Wed, 29 Apr 2026 09:43:46 +0200","Message-ID":"<20260429074356.118420-11-herve.codina@bootlin.com>","X-Mailer":"git-send-email 2.53.0","In-Reply-To":"<20260429074356.118420-1-herve.codina@bootlin.com>","References":"<20260429074356.118420-1-herve.codina@bootlin.com>","Precedence":"bulk","X-Mailing-List":"linux-gpio@vger.kernel.org","List-Id":"<linux-gpio.vger.kernel.org>","List-Subscribe":"<mailto:linux-gpio+subscribe@vger.kernel.org>","List-Unsubscribe":"<mailto:linux-gpio+unsubscribe@vger.kernel.org>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","X-Last-TLS-Session-Version":"TLSv1.3"},"content":"The gpio-audio-amp devices can use additional power supplies:\n  - vddio,\n  - vdda1,\n  - vdda2\n\nAdd support for those additional power supplies.\n\nSigned-off-by: Herve Codina <herve.codina@bootlin.com>\n---\n sound/soc/codecs/simple-amplifier.c | 85 ++++++++++++++++++++++++++++-\n 1 file changed, 82 insertions(+), 3 deletions(-)","diff":"diff --git a/sound/soc/codecs/simple-amplifier.c b/sound/soc/codecs/simple-amplifier.c\nindex ab4fa074603e..537731996544 100644\n--- a/sound/soc/codecs/simple-amplifier.c\n+++ b/sound/soc/codecs/simple-amplifier.c\n@@ -15,6 +15,7 @@\n struct simple_amp_data {\n \tunsigned int supports;\n #define SIMPLE_AUDIO_SUPPORT_PGA\t\tBIT(0)\n+#define SIMPLE_AUDIO_SUPPORT_POWER_SUPPLIES\tBIT(1)\n \n \tconst struct snd_soc_dapm_widget *dapm_widgets;\n \tunsigned int num_dapm_widgets;\n@@ -127,10 +128,86 @@ static int simple_amp_add_basic_dapm(struct snd_soc_component *component)\n \treturn 0;\n }\n \n+struct simple_amp_supply {\n+\tconst char *prop_name;\n+\tconst struct snd_soc_dapm_widget dapm_widget;\n+\tconst struct snd_soc_dapm_route dapm_route;\n+};\n+\n+static const struct simple_amp_supply simple_amp_supplies[] = {\n+\t{\n+\t\t.prop_name = \"vddio-supply\",\n+\t\t.dapm_widget = SND_SOC_DAPM_REGULATOR_SUPPLY(\"vddio\", 0, 0),\n+\t\t.dapm_route = { \"PGA\", NULL, \"vddio\" },\n+\t}, {\n+\t\t.prop_name = \"vdda1-supply\",\n+\t\t.dapm_widget = SND_SOC_DAPM_REGULATOR_SUPPLY(\"vdda1\", 0, 0),\n+\t\t.dapm_route = { \"PGA\", NULL, \"vdda1\" },\n+\t}, {\n+\t\t.prop_name = \"vdda2-supply\",\n+\t\t.dapm_widget = SND_SOC_DAPM_REGULATOR_SUPPLY(\"vdda2\", 0, 0),\n+\t\t.dapm_route = { \"PGA\", NULL, \"vdda2\" },\n+\t},\n+\t{ /* End of list */}\n+};\n+\n+static int simple_amp_add_power_supplies(struct snd_soc_component *component)\n+{\n+\tstruct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);\n+\tstruct simple_amp *simple_amp = snd_soc_component_get_drvdata(component);\n+\tconst struct simple_amp_supply *supply;\n+\tstruct device *dev = component->dev;\n+\tint ret;\n+\n+\t/*\n+\t * Those additional power supplies are attached to the PGA.\n+\t * If PGA is not supported, simply skipped them.\n+\t */\n+\tif (!(simple_amp->data->supports & SIMPLE_AUDIO_SUPPORT_PGA)) {\n+\t\tdev_err(dev, \"Extra power supplied need PGA\\n\");\n+\t\treturn -EINVAL;\n+\t}\n+\n+\tsupply = simple_amp_supplies;\n+\tdo {\n+\t\tif (!of_property_present(dev->of_node, supply->prop_name))\n+\t\t\tcontinue;\n+\n+\t\tret = snd_soc_dapm_new_controls(dapm, &supply->dapm_widget, 1);\n+\t\tif (ret) {\n+\t\t\tdev_err(dev, \"Failed to add control for '%s' (%d)\\n\",\n+\t\t\t\tsupply->prop_name, ret);\n+\t\t\treturn ret;\n+\t\t}\n+\t\tret = snd_soc_dapm_add_routes(dapm, &supply->dapm_route, 1);\n+\t\tif (ret) {\n+\t\t\tdev_err(dev, \"Failed to add route for '%s' (%d)\\n\",\n+\t\t\t\tsupply->prop_name, ret);\n+\t\t\treturn ret;\n+\t\t}\n+\t} while ((++supply)->prop_name);\n+\n+\treturn 0;\n+}\n+\n static int simple_amp_component_probe(struct snd_soc_component *component)\n {\n+\tstruct simple_amp *simple_amp = snd_soc_component_get_drvdata(component);\n+\tint ret;\n+\n \t/* Add basic dapm widgets and routes */\n-\treturn simple_amp_add_basic_dapm(component);\n+\tret = simple_amp_add_basic_dapm(component);\n+\tif (ret)\n+\t\treturn ret;\n+\n+\t/* Add additional power supplies */\n+\tif (simple_amp->data->supports & SIMPLE_AUDIO_SUPPORT_POWER_SUPPLIES) {\n+\t\tret = simple_amp_add_power_supplies(component);\n+\t\tif (ret)\n+\t\t\treturn ret;\n+\t}\n+\n+\treturn 0;\n }\n \n static const struct snd_soc_component_driver simple_amp_component_driver = {\n@@ -170,7 +247,8 @@ static const struct simple_amp_data simple_audio_amplifier_data = {\n };\n \n static const struct simple_amp_data simple_audio_mono_pga_data = {\n-\t.supports\t\t= SIMPLE_AUDIO_SUPPORT_PGA,\n+\t.supports\t\t= SIMPLE_AUDIO_SUPPORT_PGA |\n+\t\t\t\t  SIMPLE_AUDIO_SUPPORT_POWER_SUPPLIES,\n \t.dapm_widgets\t\t= simple_amp_mono_pga_dapm_widgets,\n \t.num_dapm_widgets\t= ARRAY_SIZE(simple_amp_mono_pga_dapm_widgets),\n \t.dapm_routes\t\t= simple_amp_mono_pga_dapm_routes,\n@@ -178,7 +256,8 @@ static const struct simple_amp_data simple_audio_mono_pga_data = {\n };\n \n static const struct simple_amp_data simple_audio_stereo_pga_data = {\n-\t.supports\t\t= SIMPLE_AUDIO_SUPPORT_PGA,\n+\t.supports\t\t= SIMPLE_AUDIO_SUPPORT_PGA |\n+\t\t\t\t  SIMPLE_AUDIO_SUPPORT_POWER_SUPPLIES,\n \t.dapm_widgets\t\t= simple_amp_stereo_pga_dapm_widgets,\n \t.num_dapm_widgets\t= ARRAY_SIZE(simple_amp_stereo_pga_dapm_widgets),\n \t.dapm_routes\t\t= simple_amp_stereo_pga_dapm_routes,\n","prefixes":["v2","10/17"]}