get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 2220619,
    "url": "http://patchwork.ozlabs.org/api/1.1/patches/2220619/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/linux-tegra/patch/20260407170308.100238-3-piyushpatle228@gmail.com/",
    "project": {
        "id": 21,
        "url": "http://patchwork.ozlabs.org/api/1.1/projects/21/?format=api",
        "name": "Linux Tegra Development",
        "link_name": "linux-tegra",
        "list_id": "linux-tegra.vger.kernel.org",
        "list_email": "linux-tegra@vger.kernel.org",
        "web_url": null,
        "scm_url": null,
        "webscm_url": null
    },
    "msgid": "<20260407170308.100238-3-piyushpatle228@gmail.com>",
    "date": "2026-04-07T17:03:08",
    "name": "[2/2] ASoC: tegra210_amx: simplify byte map get/put logic",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "e59b0d00be93a582a2571ee9c895305d70b77b9a",
    "submitter": {
        "id": 92665,
        "url": "http://patchwork.ozlabs.org/api/1.1/people/92665/?format=api",
        "name": "Piyush Patle",
        "email": "piyushpatle228@gmail.com"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/linux-tegra/patch/20260407170308.100238-3-piyushpatle228@gmail.com/mbox/",
    "series": [
        {
            "id": 499009,
            "url": "http://patchwork.ozlabs.org/api/1.1/series/499009/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/linux-tegra/list/?series=499009",
            "date": "2026-04-07T17:03:06",
            "name": "ASoC: tegra210: simplify byte map handling in ADX and AMX",
            "version": 1,
            "mbox": "http://patchwork.ozlabs.org/series/499009/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/2220619/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/2220619/checks/",
    "tags": {},
    "headers": {
        "Return-Path": "\n <linux-tegra+bounces-13600-incoming=patchwork.ozlabs.org@vger.kernel.org>",
        "X-Original-To": [
            "incoming@patchwork.ozlabs.org",
            "linux-tegra@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=gmail.com header.i=@gmail.com header.a=rsa-sha256\n header.s=20251104 header.b=eGQIXz5n;\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-tegra+bounces-13600-incoming=patchwork.ozlabs.org@vger.kernel.org;\n receiver=patchwork.ozlabs.org)",
            "smtp.subspace.kernel.org;\n\tdkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com\n header.b=\"eGQIXz5n\"",
            "smtp.subspace.kernel.org;\n arc=none smtp.client-ip=209.85.214.180",
            "smtp.subspace.kernel.org;\n dmarc=pass (p=none dis=none) header.from=gmail.com",
            "smtp.subspace.kernel.org;\n spf=pass smtp.mailfrom=gmail.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 4fqsws6BKkz1xy1\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 08 Apr 2026 03:03:57 +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 11C6230036DB\n\tfor <incoming@patchwork.ozlabs.org>; Tue,  7 Apr 2026 17:03:50 +0000 (UTC)",
            "from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id B76B23D301A;\n\tTue,  7 Apr 2026 17:03:49 +0000 (UTC)",
            "from mail-pl1-f180.google.com (mail-pl1-f180.google.com\n [209.85.214.180])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))\n\t(No client certificate requested)\n\tby smtp.subspace.kernel.org (Postfix) with ESMTPS id 14A153CBE63\n\tfor <linux-tegra@vger.kernel.org>; Tue,  7 Apr 2026 17:03:46 +0000 (UTC)",
            "by mail-pl1-f180.google.com with SMTP id\n d9443c01a7336-2ab077e3f32so22338775ad.3\n        for <linux-tegra@vger.kernel.org>;\n Tue, 07 Apr 2026 10:03:46 -0700 (PDT)",
            "from\n lorddaniel-VivoBook-ASUSLaptop-K3502ZA-S3502ZA.www.tendawifi.com\n ([14.139.108.62])\n        by smtp.gmail.com with ESMTPSA id\n d9443c01a7336-2b27478cb4fsm196617905ad.29.2026.04.07.10.03.41\n        (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n        Tue, 07 Apr 2026 10:03:45 -0700 (PDT)"
        ],
        "ARC-Seal": "i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1775581429; cv=none;\n b=GsPvK9zbHXzmd5C60KjpkaM4O0DvW73OcwaDvd8tU/h44jhlSVtpBTcCLwI0fj/d3F2IHDSGigDRApzv85hBwvB9dhjd/im3d0B0rims7jSzJGCZwHQLc0rZuVmlVSaJlDPZN3sLNJRjmH6NXgKqFJjDrBUsQEp+JB5lQmb8F0g=",
        "ARC-Message-Signature": "i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1775581429; c=relaxed/simple;\n\tbh=LEaAiWuc2iDIokGArBD4Y2Hs4D2o0VD9O5lvKNgWjEk=;\n\th=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References:\n\t MIME-Version;\n b=qEupe3CaLpt02g6vqzbRLDU7L4GwO5pRJU5ZPt3Hfig16t7IGLyU4CkvKw9saDtcvf0Rgup641yLDig/dkYPiTKFkEQS1fmMwJMViOFohaBdwMprD8KusdDhPVAmUSM6CduI6PunaCovSwZDrz52P39lvkDtbbi1GpmLwjf810k=",
        "ARC-Authentication-Results": "i=1; smtp.subspace.kernel.org;\n dmarc=pass (p=none dis=none) header.from=gmail.com;\n spf=pass smtp.mailfrom=gmail.com;\n dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com\n header.b=eGQIXz5n; arc=none smtp.client-ip=209.85.214.180",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n        d=gmail.com; s=20251104; t=1775581426; x=1776186226;\n darn=vger.kernel.org;\n        h=content-transfer-encoding:mime-version:references:in-reply-to\n         :message-id:date:subject:cc:to:from:from:to:cc:subject:date\n         :message-id:reply-to;\n        bh=0fesHMBqfmQJa8k2eFKVrT51rcc3PDADSOTcCGgAHuI=;\n        b=eGQIXz5n3boH74uQVLyhloS2PGw2S9ZJu3TKHSzEXjmWJh1Y3rVGXD9m2qNm6pfT0s\n         TC9IPdZsxn6WKl8zzAO39M7joL+DY0PQ0zopd4mAa54nd4qwrLG8NstuPzNchPIUOaPf\n         LIzCDXgmq840lmExwyx+npq8VFT2nH/2nFEEaCrj8y9Yz/1ICBoZWvWLYKZ12P9Q40I9\n         k+wxxFlPK6o+dkTkzGM6UrUW7JZ6e5kIHPGq/VbF/vzM50IwzDj/7t8+AEtmOTPfgaIW\n         UxraawVvXXKHv28b0vWLYV96pjhsSV3f+KTVVYoAdCBU8Q2BMSpjV8uY+2cx7FGKNBK4\n         XQ9Q==",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n        d=1e100.net; s=20251104; t=1775581426; x=1776186226;\n        h=content-transfer-encoding:mime-version:references:in-reply-to\n         :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from\n         :to:cc:subject:date:message-id:reply-to;\n        bh=0fesHMBqfmQJa8k2eFKVrT51rcc3PDADSOTcCGgAHuI=;\n        b=TE4cChFLdd6YxHvBYQTDgbZd0yKFoPOryIgnn11j7gWfbKS0CKhLXxpeRUp8uzPw0L\n         kOPXrTmETFyiN+c9JH/DCukN2jIeFPts3VuCOvgeuKQbun4VzRJHRahQwbv305yo7saD\n         oLr+fIuTmyOEgGU+YR729I0rvm5TiU8HxU9RgIRkcgKXFJLqm/eJqoKlDHOV6sQr6X+q\n         HLH+pzqfOkeqdsgCI9YIWnao/ZTlwT8N48b5PRqzOjoyhCdZBZDY6WqbGM+Kket65zAm\n         Kcmp4w8LVXWIs/33/Ww4fhLOKP3eqYLfaMWH4GCjLOEhIx+eJyns3aP8x5UrzaFzQqFl\n         YPIg==",
        "X-Forwarded-Encrypted": "i=1;\n AJvYcCXivfH5131xqYMx5oWZfSzzFqR9xO++chQtZTLPM0bhxoRiaRZfldRKYIZf6vncpXhCXqpvdFQgWpKtCg==@vger.kernel.org",
        "X-Gm-Message-State": "AOJu0YwKozV33Mvrx/xPjd6O/+dJParb5+En2K4hpNuxcTNHRfWuxiOw\n\tts34bKG/M1rIJXDVHvjXFpOViG800qIVN0dLMbrvKXEM642i87lYILgM",
        "X-Gm-Gg": "AeBDiesd37Yd6H7MFk8ImnWb2SC05/FIkmulVAA1JWIvSczdousE7nlfua5iQpW0GLb\n\tzsIplgcdfz1UiXRkzL+I3ZLEwOuOaSdsSdrvJMD7ldHUkZNnx1YzyKIAhfIp36J4xGf2/DSGkMz\n\tQph4uhlTQ8+IjxJGXVbRVzanHFTrjOjKXI7MWbjqSXc6QM5iPKNaybZU5rqitKFxzJztvUGmTZF\n\tWKbhl7O1qGmtzMVnkdcA/nfXtQHnp9mKpvfFT+DClfd5GE2zM+M99R8dW0wzkJRUbei1F0U9Wjh\n\tzpM851RGnFWSwBBlnba5QPKVvIBf2a0OHaRdkIdXjV2n7uHx0brHeaKhQMWPXcHe3Pls4Jys25V\n\tPi8NbOEueLs98DAfgeJdFCsEzN/mhp+XjYAtdKXljS7vDSCy5djqv7WNAFS+HmWhgKn7QS4/naT\n\tSqlOiO3Zvc6k6z3DMw0I5ZQxGZE7zh3fzs6/xKhAcHv0EjyjXVYFfoB1oBYZ59GJ/86gdfb62XM\n\t3XApMGyysDV571NLlhGgS9Fcq9HJX0NFuXqKAAWu02sPSqqoqAKXO6agQ==",
        "X-Received": "by 2002:a17:902:f541:b0:2b2:4e5a:9473 with SMTP id\n d9443c01a7336-2b2816dcedbmr171355955ad.21.1775581426079;\n        Tue, 07 Apr 2026 10:03:46 -0700 (PDT)",
        "From": "Piyush Patle <piyushpatle228@gmail.com>",
        "To": "Mark Brown <broonie@kernel.org>",
        "Cc": "Liam Girdwood <lgirdwood@gmail.com>,\n\tJaroslav Kysela <perex@perex.cz>,\n\tTakashi Iwai <tiwai@suse.com>,\n\tThierry Reding <thierry.reding@gmail.com>,\n\tJonathan Hunter <jonathanh@nvidia.com>,\n\tSheetal <sheetal@nvidia.com>,\n\tKuninori Morimoto <kuninori.morimoto.gx@renesas.com>,\n\tlinux-sound@vger.kernel.org,\n\tlinux-tegra@vger.kernel.org,\n\tlinux-kernel@vger.kernel.org",
        "Subject": "[PATCH 2/2] ASoC: tegra210_amx: simplify byte map get/put logic",
        "Date": "Tue,  7 Apr 2026 22:33:08 +0530",
        "Message-Id": "<20260407170308.100238-3-piyushpatle228@gmail.com>",
        "X-Mailer": "git-send-email 2.34.1",
        "In-Reply-To": "<20260407170308.100238-1-piyushpatle228@gmail.com>",
        "References": "<20260407170308.100238-1-piyushpatle228@gmail.com>",
        "Precedence": "bulk",
        "X-Mailing-List": "linux-tegra@vger.kernel.org",
        "List-Id": "<linux-tegra.vger.kernel.org>",
        "List-Subscribe": "<mailto:linux-tegra+subscribe@vger.kernel.org>",
        "List-Unsubscribe": "<mailto:linux-tegra+unsubscribe@vger.kernel.org>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit"
    },
    "content": "The byte-map controls (\"Byte Map N\") already expose a value range of\n[0, 256] to userspace via SOC_SINGLE_EXT(), where 256 is the\n\"disabled\" sentinel. The driver stored this state as a byte-packed\nu32 map[] array plus a separate byte_mask[] bitmap tracking which\nslots were enabled, because 256 does not fit in a byte. As a result\nget_byte_map() had to consult byte_mask[] to decide whether to\nreport the stored byte or 256, and put_byte_map() had to keep the\ntwo arrays in sync on every write.\n\nStore each slot as a u16 holding the control value directly\n(0..255 enabled, 256 disabled). This is the native representation\nfor what userspace already sees, so get_byte_map() becomes a direct\nreturn and put_byte_map() becomes a compare-and-store. The\nhardware-facing packed RAM word and the OUT_BYTE_EN mask are now\nderived on the fly inside tegra210_amx_write_map_ram() from the\nslot array, which is the only place that needs to know about the\nhardware layout. This also lets us drop the byte_mask field from\nstruct tegra210_amx.\n\nSlots are initialised to 256 in probe() so the default reported\nvalue stays \"disabled\", matching previous behaviour. Values written\nfrom userspace that fall outside [0, 255] are clamped to 256\n(\"disabled\") exactly as before -- no userspace-visible change.\n\nAs a side effect this also fixes a latent bug in the previous\nput_byte_map(): because it compared the enable mask rather than the\nstored byte, changing a slot from one enabled value to another\nenabled value (e.g. 42 -> 99) would early-return without persisting\nthe new value.\n\nAlso fix a potential undefined behavior when constructing the packed\nRAM word by ensuring the shift operates on a u32 value.\n\nAddresses TODO left in tegra210_amx_get_byte_map().\n\nSigned-off-by: Piyush Patle <piyushpatle228@gmail.com>\n---\n sound/soc/tegra/tegra210_amx.c | 77 ++++++++++++++++------------------\n sound/soc/tegra/tegra210_amx.h |  5 ++-\n 2 files changed, 38 insertions(+), 44 deletions(-)",
    "diff": "diff --git a/sound/soc/tegra/tegra210_amx.c b/sound/soc/tegra/tegra210_amx.c\nindex bfda82505298..4dd158e6e974 100644\n--- a/sound/soc/tegra/tegra210_amx.c\n+++ b/sound/soc/tegra/tegra210_amx.c\n@@ -60,6 +60,7 @@ static const struct reg_default tegra264_amx_reg_defaults[] = {\n \n static void tegra210_amx_write_map_ram(struct tegra210_amx *amx)\n {\n+\tunsigned int byte_mask[TEGRA264_AMX_BYTE_MASK_COUNT] = { 0 };\n \tint i;\n \n \tregmap_write(amx->regmap, TEGRA210_AMX_CFG_RAM_CTRL + amx->soc_data->reg_offset,\n@@ -67,14 +68,28 @@ static void tegra210_amx_write_map_ram(struct tegra210_amx *amx)\n \t\t     TEGRA210_AMX_CFG_RAM_CTRL_ADDR_INIT_EN |\n \t\t     TEGRA210_AMX_CFG_RAM_CTRL_RW_WRITE);\n \n-\tfor (i = 0; i < amx->soc_data->ram_depth; i++)\n+\tfor (i = 0; i < amx->soc_data->ram_depth; i++) {\n+\t\tu32 word = 0;\n+\t\tint b;\n+\n+\t\tfor (b = 0; b < 4; b++) {\n+\t\t\tunsigned int slot = i * 4 + b;\n+\t\t\tu16 val = amx->map[slot];\n+\n+\t\t\tif (val >= 256)\n+\t\t\t\tcontinue;\n+\n+\t\t\tword |= (u32)val << (b * 8);\n+\t\t\tbyte_mask[slot / 32] |= 1U << (slot % 32);\n+\t\t}\n \t\tregmap_write(amx->regmap, TEGRA210_AMX_CFG_RAM_DATA + amx->soc_data->reg_offset,\n-\t\t\t     amx->map[i]);\n+\t\t\t     word);\n+\t}\n \n \tfor (i = 0; i < amx->soc_data->byte_mask_size; i++)\n \t\tregmap_write(amx->regmap,\n \t\t\t     TEGRA210_AMX_OUT_BYTE_EN0 + (i * TEGRA210_AMX_AUDIOCIF_CH_STRIDE),\n-\t\t\t     amx->byte_mask[i]);\n+\t\t\t     byte_mask[i]);\n }\n \n static int tegra210_amx_startup(struct snd_pcm_substream *substream,\n@@ -212,26 +227,8 @@ static int tegra210_amx_get_byte_map(struct snd_kcontrol *kcontrol,\n \tstruct soc_mixer_control *mc =\n \t\t(struct soc_mixer_control *)kcontrol->private_value;\n \tstruct tegra210_amx *amx = snd_soc_component_get_drvdata(cmpnt);\n-\tunsigned char *bytes_map = (unsigned char *)amx->map;\n-\tint reg = mc->reg;\n-\tint enabled;\n \n-\tenabled = amx->byte_mask[reg / 32] & (1 << (reg % 32));\n-\n-\t/*\n-\t * TODO: Simplify this logic to just return from bytes_map[]\n-\t *\n-\t * Presently below is required since bytes_map[] is\n-\t * tightly packed and cannot store the control value of 256.\n-\t * Byte mask state is used to know if 256 needs to be returned.\n-\t * Note that for control value of 256, the put() call stores 0\n-\t * in the bytes_map[] and disables the corresponding bit in\n-\t * byte_mask[].\n-\t */\n-\tif (enabled)\n-\t\tucontrol->value.integer.value[0] = bytes_map[reg];\n-\telse\n-\t\tucontrol->value.integer.value[0] = 256;\n+\tucontrol->value.integer.value[0] = amx->map[mc->reg];\n \n \treturn 0;\n }\n@@ -243,22 +240,20 @@ static int tegra210_amx_put_byte_map(struct snd_kcontrol *kcontrol,\n \t\t(struct soc_mixer_control *)kcontrol->private_value;\n \tstruct snd_soc_component *cmpnt = snd_kcontrol_chip(kcontrol);\n \tstruct tegra210_amx *amx = snd_soc_component_get_drvdata(cmpnt);\n-\tunsigned char *bytes_map = (unsigned char *)amx->map;\n-\tint reg = mc->reg;\n-\tint value = ucontrol->value.integer.value[0];\n-\tunsigned int mask_val = amx->byte_mask[reg / 32];\n+\tunsigned int value = ucontrol->value.integer.value[0];\n \n-\tif (value >= 0 && value <= 255)\n-\t\tmask_val |= (1 << (reg % 32));\n-\telse\n-\t\tmask_val &= ~(1 << (reg % 32));\n+\t/*\n+\t * Match the previous behaviour: any value outside [0, 255] is\n+\t * treated as the \"disabled\" sentinel (256). Negative values from\n+\t * userspace fold in through the unsigned cast and are caught here.\n+\t */\n+\tif (value > 255)\n+\t\tvalue = 256;\n \n-\tif (mask_val == amx->byte_mask[reg / 32])\n+\tif (amx->map[mc->reg] == value)\n \t\treturn 0;\n \n-\t/* Update byte map and slot */\n-\tbytes_map[reg] = value % 256;\n-\tamx->byte_mask[reg / 32] = mask_val;\n+\tamx->map[mc->reg] = value;\n \n \treturn 1;\n }\n@@ -727,7 +722,7 @@ static int tegra210_amx_platform_probe(struct platform_device *pdev)\n \tstruct device *dev = &pdev->dev;\n \tstruct tegra210_amx *amx;\n \tvoid __iomem *regs;\n-\tint err;\n+\tint err, i;\n \n \tamx = devm_kzalloc(dev, sizeof(*amx), GFP_KERNEL);\n \tif (!amx)\n@@ -750,16 +745,14 @@ static int tegra210_amx_platform_probe(struct platform_device *pdev)\n \n \tregcache_cache_only(amx->regmap, true);\n \n-\tamx->map = devm_kzalloc(dev, amx->soc_data->ram_depth * sizeof(*amx->map),\n-\t\t\t\tGFP_KERNEL);\n+\tamx->map = devm_kcalloc(dev, amx->soc_data->ram_depth * 4,\n+\t\t\t\tsizeof(*amx->map), GFP_KERNEL);\n \tif (!amx->map)\n \t\treturn -ENOMEM;\n \n-\tamx->byte_mask = devm_kzalloc(dev,\n-\t\t\t\t      amx->soc_data->byte_mask_size * sizeof(*amx->byte_mask),\n-\t\t\t\t      GFP_KERNEL);\n-\tif (!amx->byte_mask)\n-\t\treturn -ENOMEM;\n+\t/* Initialize all byte map slots as disabled (value 256). */\n+\tfor (i = 0; i < amx->soc_data->ram_depth * 4; i++)\n+\t\tamx->map[i] = 256;\n \n \ttegra210_amx_dais[TEGRA_AMX_OUT_DAI_ID].capture.channels_max =\n \t\t\tamx->soc_data->max_ch;\ndiff --git a/sound/soc/tegra/tegra210_amx.h b/sound/soc/tegra/tegra210_amx.h\nindex 50a237b197ba..6df9ab0fe220 100644\n--- a/sound/soc/tegra/tegra210_amx.h\n+++ b/sound/soc/tegra/tegra210_amx.h\n@@ -8,6 +8,8 @@\n #ifndef __TEGRA210_AMX_H__\n #define __TEGRA210_AMX_H__\n \n+#include <linux/types.h>\n+\n /* Register offsets from TEGRA210_AMX*_BASE */\n #define TEGRA210_AMX_RX_STATUS\t\t\t0x0c\n #define TEGRA210_AMX_RX_INT_STATUS\t\t0x10\n@@ -105,8 +107,7 @@ struct tegra210_amx_soc_data {\n \n struct tegra210_amx {\n \tconst struct tegra210_amx_soc_data *soc_data;\n-\tunsigned int *map;\n-\tunsigned int *byte_mask;\n+\tu16 *map;\n \tstruct regmap *regmap;\n };\n \n",
    "prefixes": [
        "2/2"
    ]
}