Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/1.1/patches/2230090/?format=api
{ "id": 2230090, "url": "http://patchwork.ozlabs.org/api/1.1/patches/2230090/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linux-gpio/patch/20260429074356.118420-12-herve.codina@bootlin.com/", "project": { "id": 42, "url": "http://patchwork.ozlabs.org/api/1.1/projects/42/?format=api", "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-12-herve.codina@bootlin.com>", "date": "2026-04-29T07:43:47", "name": "[v2,11/17] ASoC: simple-amplifier: gpio-audio-amp: Add support for mute gpio", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "8396f3993f5be482d75c6d7d3ebdefebf6b02997", "submitter": { "id": 81983, "url": "http://patchwork.ozlabs.org/api/1.1/people/81983/?format=api", "name": "Herve Codina", "email": "herve.codina@bootlin.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/linux-gpio/patch/20260429074356.118420-12-herve.codina@bootlin.com/mbox/", "series": [ { "id": 502009, "url": "http://patchwork.ozlabs.org/api/1.1/series/502009/?format=api", "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/2230090/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2230090/checks/", "tags": {}, "headers": { "Return-Path": "\n <linux-gpio+bounces-35768-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=CUoqdaC1;\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-35768-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=\"CUoqdaC1\"", "smtp.subspace.kernel.org;\n arc=none smtp.client-ip=185.246.84.56", "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 4g58ZX59JSz1yHv\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 29 Apr 2026 17:49:08 +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 AE58B3086882\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 29 Apr 2026 07:45:41 +0000 (UTC)", "from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id CB9B73B635A;\n\tWed, 29 Apr 2026 07:44:42 +0000 (UTC)", "from smtpout-02.galae.net (smtpout-02.galae.net [185.246.84.56])\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 B62093B4EB0\n\tfor <linux-gpio@vger.kernel.org>; Wed, 29 Apr 2026 07:44:40 +0000 (UTC)", "from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233])\n\tby smtpout-02.galae.net (Postfix) with ESMTPS id 7994D1A3478;\n\tWed, 29 Apr 2026 07:44:39 +0000 (UTC)", "from mail.galae.net (mail.galae.net [212.83.136.155])\n\tby smtpout-01.galae.net (Postfix) with ESMTPS id 4E56E601DF;\n\tWed, 29 Apr 2026 07:44:39 +0000 (UTC)", "from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon)\n with ESMTPSA id 2D5E010728FEB;\n\tWed, 29 Apr 2026 09:44:36 +0200 (CEST)" ], "ARC-Seal": "i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1777448682; cv=none;\n b=Zl+6FirRJhKUh2SVX8cjggbGMDPEH6047XfCd+ThZ7/HsY/jgeowbEwgYCR1ALGe+kMaBR7lfuYujda+4ANS7wB9dIszTQH5mlKsCQuthMTf26jrf+afizk64+XLQkYSiWbWHnAnkqUkDMtmb2Q/UF+nJdkjBRKTac0IktRRgEQ=", "ARC-Message-Signature": "i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1777448682; c=relaxed/simple;\n\tbh=96M87psX4P0J4QLuFDJoFjKutTQlszkl0O3PgUCYtyA=;\n\th=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:\n\t MIME-Version;\n b=l0N/HLYvJ0ACWTCMu3/LK+jEve5eWh/ZdQdlp8oMsLvax7FoTq9kp2/Jbo0y80/ffxNtsoxZowhD0RfE9+QXNwACgISO6UoNVTIwWXcK86m532++zZLTiwZ77KXrxJ5gVVZQboOErU6M5de0aCYzAeF34LnNdQB59n6O68xy51o=", "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=CUoqdaC1; arc=none smtp.client-ip=185.246.84.56", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim;\n\tt=1777448678; h=from:subject:date:message-id:to:cc:mime-version:\n\t content-transfer-encoding:in-reply-to:references;\n\tbh=Jz4TmAue/ulWA5im5r6RM8s61tPN0+iCOmjz7hw7KII=;\n\tb=CUoqdaC1C93P3tXLbPL81TS0GBQi9Y1Cv+o6vkza+W8oVDgX09+WgOG2elPRf/3rnSM94Z\n\tq/x3N/7IHeDMq/b7/y7Ls04/kB2JRN9kvUcyHD0/q1WmR5SJc6C417ZnVWuWnk7jM6NwCn\n\tB2HLkYpFRMeDjUJb8LowW9C7Wmo/JYwHwr9621AJB3uHvEMVkgfx5+6XgLgyWwHo481rBo\n\tX+ELBYUUG8cOlEhCEOMg+VJLPSs//F8Bt/BVWMctrCTQVBhwsegyhYmvXuTMJfAiCdGv8R\n\t1+oAOQFkuiF9QKRG440TU09pqxsG813fctAfTxnnXHQiXTzh9pDeQK/dttlpcw==", "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 11/17] ASoC: simple-amplifier: gpio-audio-amp: Add support\n for mute gpio", "Date": "Wed, 29 Apr 2026 09:43:47 +0200", "Message-ID": "<20260429074356.118420-12-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": "A gpio can be used to control the amplifier mute feature.\n\nAdd support for this mute gpio.\n\nSigned-off-by: Herve Codina <herve.codina@bootlin.com>\n---\n sound/soc/codecs/simple-amplifier.c | 127 +++++++++++++++++++++++++++-\n 1 file changed, 125 insertions(+), 2 deletions(-)", "diff": "diff --git a/sound/soc/codecs/simple-amplifier.c b/sound/soc/codecs/simple-amplifier.c\nindex 537731996544..61d1cbb0661d 100644\n--- a/sound/soc/codecs/simple-amplifier.c\n+++ b/sound/soc/codecs/simple-amplifier.c\n@@ -12,10 +12,18 @@\n #include <linux/regulator/consumer.h>\n #include <sound/soc.h>\n \n+struct simple_amp_single {\n+\tstruct gpio_desc *gpio;\n+\tbool is_inverted;\n+\tint kctrl_val;\n+\tconst char *control_name;\n+};\n+\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+#define SIMPLE_AUDIO_SUPPORT_MUTE\t\tBIT(2)\n \n \tconst struct snd_soc_dapm_widget *dapm_widgets;\n \tunsigned int num_dapm_widgets;\n@@ -26,6 +34,7 @@ struct simple_amp_data {\n struct simple_amp {\n \tconst struct simple_amp_data *data;\n \tstruct gpio_desc *gpiod_enable;\n+\tstruct simple_amp_single mute;\n };\n \n static int simple_amp_power_event(struct snd_soc_dapm_widget *w,\n@@ -103,6 +112,78 @@ static const struct snd_soc_dapm_route simple_amp_stereo_pga_dapm_routes[] = {\n \t{ \"OUTR\", NULL, \"PGA\" },\n };\n \n+static int simple_amp_single_kctrl_write_gpio(struct simple_amp_single *single,\n+\t\t\t\t\t int kctrl_val)\n+{\n+\tint gpio_val;\n+\n+\tgpio_val = single->is_inverted ? !kctrl_val : kctrl_val;\n+\n+\treturn gpiod_set_value_cansleep(single->gpio, gpio_val);\n+}\n+\n+static int simple_amp_single_kctrl_info(struct snd_kcontrol *kcontrol,\n+\t\t\t\t\tstruct snd_ctl_elem_info *uinfo)\n+{\n+\tuinfo->count = 1;\n+\tuinfo->value.integer.min = 0;\n+\tuinfo->value.integer.max = 1;\n+\tuinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN;\n+\treturn 0;\n+}\n+\n+static int simple_amp_single_kctrl_get(struct snd_kcontrol *kcontrol,\n+\t\t\t\t struct snd_ctl_elem_value *ucontrol)\n+{\n+\tstruct simple_amp_single *single = (struct simple_amp_single *)kcontrol->private_value;\n+\n+\tucontrol->value.integer.value[0] = single->kctrl_val;\n+\n+\treturn 0;\n+}\n+\n+static int simple_amp_single_kctrl_put(struct snd_kcontrol *kcontrol,\n+\t\t\t\t struct snd_ctl_elem_value *ucontrol)\n+{\n+\tstruct simple_amp_single *single = (struct simple_amp_single *)kcontrol->private_value;\n+\tint kctrl_val;\n+\tint err;\n+\n+\tkctrl_val = ucontrol->value.integer.value[0];\n+\n+\tif (kctrl_val == single->kctrl_val)\n+\t\treturn 0;\n+\n+\terr = simple_amp_single_kctrl_write_gpio(single, kctrl_val);\n+\tif (err)\n+\t\treturn err;\n+\n+\tsingle->kctrl_val = kctrl_val;\n+\n+\treturn 1; /* The value changed */\n+}\n+\n+static int simple_amp_single_add_kcontrol(struct snd_soc_component *component,\n+\t\t\t\t\t struct simple_amp_single *single)\n+{\n+\tstruct snd_kcontrol_new control = {\n+\t\t.iface = SNDRV_CTL_ELEM_IFACE_MIXER,\n+\t\t.name = single->control_name,\n+\t\t.info = simple_amp_single_kctrl_info,\n+\t\t.get = simple_amp_single_kctrl_get,\n+\t\t.put = simple_amp_single_kctrl_put,\n+\t\t.private_value = (unsigned long)single,\n+\t};\n+\tint ret;\n+\n+\t/* Be consistent between single->kctrl_val value and the GPIO value */\n+\tret = simple_amp_single_kctrl_write_gpio(single, single->kctrl_val);\n+\tif (ret)\n+\t\treturn ret;\n+\n+\treturn snd_soc_add_component_controls(component, &control, 1);\n+}\n+\n static int simple_amp_add_basic_dapm(struct snd_soc_component *component)\n {\n \tstruct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);\n@@ -207,6 +288,21 @@ static int simple_amp_component_probe(struct snd_soc_component *component)\n \t\t\treturn ret;\n \t}\n \n+\tif (simple_amp->mute.gpio) {\n+\t\t/*\n+\t\t * The name of the GPIO used is mute. According to this name, 1\n+\t\t * means muted and 0 means un-muted.\n+\t\t *\n+\t\t * An inversion is expected by ALSA. Indeed from ALSA point of\n+\t\t * view, 1 means 'on' (un-muted) and 0 means 'off' (muted).\n+\t\t */\n+\t\tsimple_amp->mute.is_inverted = true;\n+\t\tsimple_amp->mute.kctrl_val = 1; /* Un-muted */\n+\t\tret = simple_amp_single_add_kcontrol(component, &simple_amp->mute);\n+\t\tif (ret)\n+\t\t\treturn ret;\n+\t}\n+\n \treturn 0;\n }\n \n@@ -214,10 +310,26 @@ static const struct snd_soc_component_driver simple_amp_component_driver = {\n \t.probe = simple_amp_component_probe,\n };\n \n+static int simple_amp_parse_single_gpio(struct device *dev,\n+\t\t\t\t\tstruct simple_amp_single *single,\n+\t\t\t\t\tconst char *gpio_property)\n+{\n+\t/* Start with the inactive value */\n+\tsingle->is_inverted = false;\n+\tsingle->kctrl_val = 0;\n+\tsingle->gpio = devm_gpiod_get_optional(dev, gpio_property, GPIOD_OUT_LOW);\n+\tif (IS_ERR(single->gpio))\n+\t\treturn dev_err_probe(dev, PTR_ERR(single->gpio),\n+\t\t\t\t \"Failed to get '%s' gpio\\n\",\n+\t\t\t\t gpio_property);\n+\treturn 0;\n+}\n+\n static int simple_amp_probe(struct platform_device *pdev)\n {\n \tstruct device *dev = &pdev->dev;\n \tstruct simple_amp *simple_amp;\n+\tint ret;\n \n \tsimple_amp = devm_kzalloc(dev, sizeof(*simple_amp), GFP_KERNEL);\n \tif (!simple_amp)\n@@ -234,6 +346,15 @@ static int simple_amp_probe(struct platform_device *pdev)\n \t\treturn dev_err_probe(dev, PTR_ERR(simple_amp->gpiod_enable),\n \t\t\t\t \"Failed to get 'enable' gpio\");\n \n+\tif (simple_amp->data->supports & SIMPLE_AUDIO_SUPPORT_MUTE) {\n+\t\tret = simple_amp_parse_single_gpio(dev, &simple_amp->mute, \"mute\");\n+\t\tif (ret)\n+\t\t\treturn ret;\n+\t}\n+\n+\t/* Set controls name */\n+\tsimple_amp->mute.control_name = \"Switch\";\n+\n \treturn devm_snd_soc_register_component(dev,\n \t\t\t\t\t &simple_amp_component_driver,\n \t\t\t\t\t NULL, 0);\n@@ -248,7 +369,8 @@ static const struct simple_amp_data simple_audio_amplifier_data = {\n \n static const struct simple_amp_data simple_audio_mono_pga_data = {\n \t.supports\t\t= SIMPLE_AUDIO_SUPPORT_PGA |\n-\t\t\t\t SIMPLE_AUDIO_SUPPORT_POWER_SUPPLIES,\n+\t\t\t\t SIMPLE_AUDIO_SUPPORT_POWER_SUPPLIES |\n+\t\t\t\t SIMPLE_AUDIO_SUPPORT_MUTE,\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@@ -257,7 +379,8 @@ static const struct simple_amp_data simple_audio_mono_pga_data = {\n \n static const struct simple_amp_data simple_audio_stereo_pga_data = {\n \t.supports\t\t= SIMPLE_AUDIO_SUPPORT_PGA |\n-\t\t\t\t SIMPLE_AUDIO_SUPPORT_POWER_SUPPLIES,\n+\t\t\t\t SIMPLE_AUDIO_SUPPORT_POWER_SUPPLIES |\n+\t\t\t\t SIMPLE_AUDIO_SUPPORT_MUTE,\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", "11/17" ] }