get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/1.1/patches/2230091/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 2230091,
    "url": "http://patchwork.ozlabs.org/api/1.1/patches/2230091/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/linux-gpio/patch/20260429074356.118420-14-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-14-herve.codina@bootlin.com>",
    "date": "2026-04-29T07:43:49",
    "name": "[v2,13/17] ASoC: simple-amplifier: gpio-audio-amp: Add support for basic gain",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "a76790ef1d34060452b6ddcff9b202616d9e0e8b",
    "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-14-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/2230091/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/2230091/checks/",
    "tags": {},
    "headers": {
        "Return-Path": "\n <linux-gpio+bounces-35770-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=C2knB5ao;\n\tdkim-atps=neutral",
            "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=172.105.105.114; helo=tor.lore.kernel.org;\n envelope-from=linux-gpio+bounces-35770-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=\"C2knB5ao\"",
            "smtp.subspace.kernel.org;\n arc=none smtp.client-ip=185.246.85.4",
            "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 [172.105.105.114])\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 4g58bc2jncz1yHv\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 29 Apr 2026 17:50:04 +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 1B5913093D82\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 29 Apr 2026 07:46:01 +0000 (UTC)",
            "from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id C9B903BA25B;\n\tWed, 29 Apr 2026 07:44:48 +0000 (UTC)",
            "from smtpout-03.galae.net (smtpout-03.galae.net [185.246.85.4])\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 237143A75A1;\n\tWed, 29 Apr 2026 07:44:46 +0000 (UTC)",
            "from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233])\n\tby smtpout-03.galae.net (Postfix) with ESMTPS id C21D04E42ADE;\n\tWed, 29 Apr 2026 07:44:45 +0000 (UTC)",
            "from mail.galae.net (mail.galae.net [212.83.136.155])\n\tby smtpout-01.galae.net (Postfix) with ESMTPS id 8FDFF601DF;\n\tWed, 29 Apr 2026 07:44:45 +0000 (UTC)",
            "from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon)\n with ESMTPSA id F34481072989B;\n\tWed, 29 Apr 2026 09:44:41 +0200 (CEST)"
        ],
        "ARC-Seal": "i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1777448688; cv=none;\n b=kKx4ee+qnOCCK/eclPyrXr/m4tUV+/P5EsiZg5IXIjIJy71KT08KZ7+JCnnDF8ZJ6StKB97W8X8vDI6BtSKu0FfkJ/yeiQFJ/kToHyPtic0N9Fz8l6E3ftLSDkPV814r2xgNqWeWDCTPxvCd+X5MPlqa+4nC1fPRf10lGusOmN0=",
        "ARC-Message-Signature": "i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1777448688; c=relaxed/simple;\n\tbh=9ZeNAqe2K1RpT29ZlmLoNX7+/TuYhbpdbTQk6+W5xGk=;\n\th=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:\n\t MIME-Version;\n b=PoXvWMkQZzku9SV0BPqPmFEZWXkxTdUdb0FxPaVH41YBfGKuXhh0hNsVj0nu8wbV9/y2BwmQSG0LryFTho9KHF1atuyhySV+lmMDFZGvNIj4gfu99jJMD5RJGZY4LyUmdJiRIuIJYNg51XDDKztVnWVEmAi/WgwVw4fI1W5Wh5k=",
        "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=C2knB5ao; arc=none smtp.client-ip=185.246.85.4",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim;\n\tt=1777448684; h=from:subject:date:message-id:to:cc:mime-version:\n\t content-transfer-encoding:in-reply-to:references;\n\tbh=oYgKZIs1o6j/WKLi22VenrpXpjZYinvex25VuhaxODI=;\n\tb=C2knB5aoU2HGI6GQi0DSqDKLIbs5sWvP0mGPd7Y/3l6GHLWzehXq+zLLBBnRjkFcPvWxSp\n\ts0BkRPKYaRmsi81QKmwWITuPmwJ9YtYX7PY91P4C22LZx0h394PfPuY09gfa+PFBwpDrlz\n\tYVtQahmvvDjHZJljPpGZeoC/CADGHWnkn/orkn7/kqo3sHh60Pk0rmgTJFVxVXtVwaR6wl\n\trJ9kxbtHCmJR7RnMbkqpM8jRsRgemrDnM2pJPfZhchCxNvJvlj1Ve+IdOaG1zNSH8GYcT7\n\tmDPkZtgXeDetD0r0RausFTzhGSs2cLUzALWDbekYhfRJItad9LSvdal3xogSIw==",
        "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 13/17] ASoC: simple-amplifier: gpio-audio-amp: Add support\n for basic gain",
        "Date": "Wed, 29 Apr 2026 09:43:49 +0200",
        "Message-ID": "<20260429074356.118420-14-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": "Several gpios can be used to control the amplifier gain.\n\nAdd basic support for those gpios.\n\nThis basic support doesn't include any mapping between the GPIOs value\nand the physical gain value (dB).\n\nThe support for this kind of mapping will be added later on.\n\nSigned-off-by: Herve Codina <herve.codina@bootlin.com>\n---\n sound/soc/codecs/simple-amplifier.c | 125 ++++++++++++++++++++++++++++\n 1 file changed, 125 insertions(+)",
    "diff": "diff --git a/sound/soc/codecs/simple-amplifier.c b/sound/soc/codecs/simple-amplifier.c\nindex 1c845272509c..4f4a3c10f883 100644\n--- a/sound/soc/codecs/simple-amplifier.c\n+++ b/sound/soc/codecs/simple-amplifier.c\n@@ -4,6 +4,7 @@\n  * Author: Jerome Brunet <jbrunet@baylibre.com>\n  */\n \n+#include <linux/bitmap.h>\n #include <linux/bits.h>\n #include <linux/gpio/consumer.h>\n #include <linux/mod_devicetable.h>\n@@ -19,6 +20,13 @@ struct simple_amp_single {\n \tconst char *control_name;\n };\n \n+struct simple_amp_multi {\n+\tstruct gpio_descs *gpios;\n+\tu32 kctrl_val;\n+\tu32 kctrl_max;\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@@ -37,6 +45,7 @@ struct simple_amp {\n \tstruct gpio_desc *gpiod_enable;\n \tstruct simple_amp_single mute;\n \tstruct simple_amp_single bypass;\n+\tstruct simple_amp_multi gain;\n };\n \n static int simple_amp_power_event(struct snd_soc_dapm_widget *w,\n@@ -186,6 +195,84 @@ static int simple_amp_single_add_kcontrol(struct snd_soc_component *component,\n \treturn snd_soc_add_component_controls(component, &control, 1);\n }\n \n+static int simple_amp_multi_kctrl_write_gpios(struct simple_amp_multi *multi,\n+\t\t\t\t\t      u32 kctrl_val)\n+{\n+\tDECLARE_BITMAP(bm, 32);\n+\tu32 gpio_val;\n+\n+\tif (kctrl_val > multi->kctrl_max)\n+\t\treturn -EINVAL;\n+\n+\tgpio_val = kctrl_val;\n+\tbitmap_from_arr32(bm, &gpio_val, multi->gpios->ndescs);\n+\n+\treturn gpiod_multi_set_value_cansleep(multi->gpios, bm);\n+}\n+\n+static int simple_amp_multi_kctrl_int_info(struct snd_kcontrol *kcontrol,\n+\t\t\t\t\t   struct snd_ctl_elem_info *uinfo)\n+{\n+\tstruct simple_amp_multi *multi = (struct simple_amp_multi *)kcontrol->private_value;\n+\n+\tuinfo->count = 1;\n+\tuinfo->value.integer.min = 0;\n+\tuinfo->value.integer.max = multi->kctrl_max;\n+\tuinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;\n+\treturn 0;\n+}\n+\n+static int simple_amp_multi_kctrl_int_get(struct snd_kcontrol *kcontrol,\n+\t\t\t\t\t  struct snd_ctl_elem_value *ucontrol)\n+{\n+\tstruct simple_amp_multi *multi = (struct simple_amp_multi *)kcontrol->private_value;\n+\n+\tucontrol->value.integer.value[0] = multi->kctrl_val;\n+\treturn 0;\n+}\n+\n+static int simple_amp_multi_kctrl_int_put(struct snd_kcontrol *kcontrol,\n+\t\t\t\t\t  struct snd_ctl_elem_value *ucontrol)\n+{\n+\tstruct simple_amp_multi *multi = (struct simple_amp_multi *)kcontrol->private_value;\n+\tu32 kctrl_val;\n+\tint ret;\n+\n+\tkctrl_val = ucontrol->value.integer.value[0];\n+\n+\tif (kctrl_val == multi->kctrl_val)\n+\t\treturn 0;\n+\n+\tret = simple_amp_multi_kctrl_write_gpios(multi, kctrl_val);\n+\tif (ret)\n+\t\treturn ret;\n+\n+\tmulti->kctrl_val = kctrl_val;\n+\n+\treturn 1; /* The value changed */\n+}\n+\n+static int simple_amp_multi_add_kcontrol(struct snd_soc_component *component,\n+\t\t\t\t\t struct simple_amp_multi *multi)\n+{\n+\tstruct snd_kcontrol_new control = {\n+\t\t.iface = SNDRV_CTL_ELEM_IFACE_MIXER,\n+\t\t.name = multi->control_name,\n+\t\t.info = simple_amp_multi_kctrl_int_info,\n+\t\t.get = simple_amp_multi_kctrl_int_get,\n+\t\t.put = simple_amp_multi_kctrl_int_put,\n+\t\t.private_value = (unsigned long)multi,\n+\t};\n+\tint ret;\n+\n+\t/* Be consistent between multi->kctrl_val value and the GPIOs value */\n+\tret = simple_amp_multi_kctrl_write_gpios(multi, multi->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@@ -311,6 +398,12 @@ static int simple_amp_component_probe(struct snd_soc_component *component)\n \t\t\treturn ret;\n \t}\n \n+\tif (simple_amp->gain.gpios) {\n+\t\tret = simple_amp_multi_add_kcontrol(component, &simple_amp->gain);\n+\t\tif (ret)\n+\t\t\treturn ret;\n+\t}\n+\n \treturn 0;\n }\n \n@@ -333,6 +426,31 @@ static int simple_amp_parse_single_gpio(struct device *dev,\n \treturn 0;\n }\n \n+static int simple_amp_parse_multi_gpio(struct device *dev,\n+\t\t\t\t       struct simple_amp_multi *multi,\n+\t\t\t\t       const char *gpios_property)\n+{\n+\t/* Start with the value 0 (GPIO inactive). Can be changed later */\n+\tmulti->kctrl_val = 0;\n+\tmulti->gpios = devm_gpiod_get_array_optional(dev, gpios_property, GPIOD_OUT_LOW);\n+\tif (IS_ERR(multi->gpios))\n+\t\treturn dev_err_probe(dev, PTR_ERR(multi->gpios),\n+\t\t\t\t     \"Failed to get '%s' gpios\\n\",\n+\t\t\t\t     gpios_property);\n+\tif (!multi->gpios)\n+\t\treturn 0;\n+\n+\tif (multi->gpios->ndescs > 16)\n+\t\treturn dev_err_probe(dev, -EINVAL,\n+\t\t\t\t     \"Number of '%s' gpios limited to 16\\n\",\n+\t\t\t\t     gpios_property);\n+\n+\t/* Set default value for the kctrl_max. Can be changed later */\n+\tmulti->kctrl_max = (1 << multi->gpios->ndescs) - 1;\n+\n+\treturn 0;\n+}\n+\n static int simple_amp_probe(struct platform_device *pdev)\n {\n \tstruct device *dev = &pdev->dev;\n@@ -366,7 +484,14 @@ static int simple_amp_probe(struct platform_device *pdev)\n \t\t\treturn ret;\n \t}\n \n+\tif (simple_amp->data->supports & SIMPLE_AUDIO_SUPPORT_PGA) {\n+\t\tret = simple_amp_parse_multi_gpio(dev, &simple_amp->gain, \"gain\");\n+\t\tif (ret)\n+\t\t\treturn ret;\n+\t}\n+\n \t/* Set controls name */\n+\tsimple_amp->gain.control_name = \"Volume\";\n \tsimple_amp->mute.control_name = \"Switch\";\n \tsimple_amp->bypass.control_name = \"Bypass Switch\";\n \n",
    "prefixes": [
        "v2",
        "13/17"
    ]
}