Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/1.1/patches/2220618/?format=api
{ "id": 2220618, "url": "http://patchwork.ozlabs.org/api/1.1/patches/2220618/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linux-tegra/patch/20260407170308.100238-2-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-2-piyushpatle228@gmail.com>", "date": "2026-04-07T17:03:07", "name": "[1/2] ASoC: tegra210_adx: simplify byte map get/put logic", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "433180afb414c867f880e234f28e937b8c859186", "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-2-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/2220618/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2220618/checks/", "tags": {}, "headers": { "Return-Path": "\n <linux-tegra+bounces-13599-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=fwGTc+No;\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-13599-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=\"fwGTc+No\"", "smtp.subspace.kernel.org;\n arc=none smtp.client-ip=209.85.214.174", "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 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fqswc67rZz1xy1\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 08 Apr 2026 03:03:44 +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 C9A3B3008E0F\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 7 Apr 2026 17:03:33 +0000 (UTC)", "from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id 652303D1CBE;\n\tTue, 7 Apr 2026 17:03:33 +0000 (UTC)", "from mail-pl1-f174.google.com (mail-pl1-f174.google.com\n [209.85.214.174])\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 E1EDC3CBE63\n\tfor <linux-tegra@vger.kernel.org>; Tue, 7 Apr 2026 17:03:31 +0000 (UTC)", "by mail-pl1-f174.google.com with SMTP id\n d9443c01a7336-2b299b3c739so10970655ad.3\n for <linux-tegra@vger.kernel.org>;\n Tue, 07 Apr 2026 10:03:31 -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.26\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Tue, 07 Apr 2026 10:03:30 -0700 (PDT)" ], "ARC-Seal": "i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1775581413; cv=none;\n b=MNIBN8AWRlb9sqJYPmxXxhLttSgBjncsB3t/d1ENDxv2jVhagA9WE9XqZi32VxqpeoavcqJHWFI0qONyw7jz/V+aY4KxSXyMszJ4zPgRwB/rjQB2t+V0JYJ5/Jmomz8Io923vD+u4su6mwEfx1c6Y/LbpW8P6tyHK7ngVBpl9sA=", "ARC-Message-Signature": "i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1775581413; c=relaxed/simple;\n\tbh=O4uHzkKNl3IGefNGYCIuKpLs23GHSxTNT7OQCSZWAb4=;\n\th=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References:\n\t MIME-Version;\n b=o1gZDMV5V00Z0Y8JsZpFj9zA3R2XwM0Q+DmjiWoVYC3nPFosRcoIrvEjfxGCI0q4+AHpioRXnW/qV35tgT6OHosOCOMwzyJEQVNOYKUsfOnfwsLUZNl75VHlnYHcg83OHxjNx1CKELI+JVsm0RekEBpIdGqSuzPeAg8sYbWKQ48=", "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=fwGTc+No; arc=none smtp.client-ip=209.85.214.174", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=gmail.com; s=20251104; t=1775581411; x=1776186211;\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=sZoeSKMzor941OtTI2XswOre9sDwC8ZQogmJadnwKsI=;\n b=fwGTc+NoQzs7CC/0HsmFHA2t1fWwpmdRHuWZ41u+LDvPAEkRC51wI2OiNQ8kTsM5FV\n r7jonuR+8Xc5B+YyoFkbOxC9qXW/z8bhYXD7vnYNBd9eTpIvLcTVbiQ6nliT1rEfNTwb\n sUiRJXKvrAEA9Z6bGEfosa/qc/FvpTbDFKKxT73pnA29ZdCQb4ckDIzDtPyONcTFsGU1\n kXaHN+GB7C666e/avzv8mTBCz3jeRGrMfBnfIjK/IxHe52diXz+R4OjRYnJvxgsYzudG\n DCxSk80oi9Z3BsG6AOO3101JQDm1LpmV7sV23mSaHgFR2ax0t2ZEkqt8Kx8DrYDIOxZp\n QeSw==", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1775581411; x=1776186211;\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=sZoeSKMzor941OtTI2XswOre9sDwC8ZQogmJadnwKsI=;\n b=GXhRED+99NkeAeQ72yCWSQYTTBnz0Aoc1IYRusoSfcwIsg3BRirIOdaMIFMnE0E7Zs\n hfKDgNcLcmnMYNFJ6cBKPl/eiRlBDid8BpE/mS4HyisE1o27KKCJTPXnNwYZzXkzY+82\n //YGov9Gs9Q/rOEnPDMWF3nB7YnoRuZX4K8+soGRBOgHcMtBITcCttDPmr6NYQyTDMJ0\n G+jPnNk8ZrxFxC9qs99VWHjR4SliWRLXG5ECEY6vygNkWBfDnGo3xjG9p7dn9w8N5cNB\n kf1herxlm0m6FGV6ujcLqCbfmQB54RbUxpnVZCSXwdhX84rbk2mINb8ecQUuCK1oVmV9\n hWtA==", "X-Forwarded-Encrypted": "i=1;\n AJvYcCWS+lYE5icVR+pmcTr3d4zd4YmrjEXPsI7oj+9t3dUek722tJdQZ269RZi0l8mJcFSN+Gh5PUtJ4v1KRg==@vger.kernel.org", "X-Gm-Message-State": "AOJu0YyqG5TYKf0hqbLXdh8D8fEUbw8LOB61lbSGxPyGibhiHWE+AIUm\n\tl1H+4ayZlzn0FG+gxDLbhKWklaJugfO+td9BWo2gGtr4mz8H2GgRab2C", "X-Gm-Gg": "AeBDietlYXKRjzSdTlVVhjRdKYPvn16R9zqJ18Wf6t39coagA/So2gv5lIirGJLnWqj\n\tIdUu24fDN6EOlLpLdhaJn+j+z23XnQyEr54b6Yo3CCYqHH7GMljhzCu7mOqZFOIwP4WEEZatjIE\n\tRwuP3zhpW2xHZINjjOtIfafJ0sRpxasYKYkeBVwfh3fzuWe89cXNTiv4exbKRN8aWz8Omy3nwk7\n\t8baRTsLyZOLyuEdCYKvPgCDLthShzv/utFp53gHJAhOjld8civRFo3o9OHdU/r/+AanqDJcgVwz\n\tC9whZPaqzvdGAGrthK8NMMvCjeazEetax48EX59Jz/tvT69J8erPwW8Fev2Fa4XZGzX4+rfGXer\n\t5QI9JIJC1UBLgl1xeJikny7AjUMK5CvFjx1BDdiihXIrPXsuGtjsGMp7hVa5PN2DXXHQ60gbqQ3\n\tzRz1D/ecpjXyERH33+VwASmQXjMSIfTgGckjnrnyn+OO4Fyz3xCN5IEWETsSvdCuahJYAsuwhIt\n\tiUJNFRQv8ctX2ZN8FTthqOb2nEBrUjT0s2lLDKx6nI/qTz3xmISVNwK9w==", "X-Received": "by 2002:a17:903:32cd:b0:2b2:4697:78f5 with SMTP id\n d9443c01a7336-2b281798164mr173228185ad.36.1775581411233;\n Tue, 07 Apr 2026 10:03:31 -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 1/2] ASoC: tegra210_adx: simplify byte map get/put logic", "Date": "Tue, 7 Apr 2026 22:33:07 +0530", "Message-Id": "<20260407170308.100238-2-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 IN_BYTE_EN mask are now\nderived on the fly inside tegra210_adx_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_adx.\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_adx_get_byte_map().\n\nSigned-off-by: Piyush Patle <piyushpatle228@gmail.com>\n---\n sound/soc/tegra/tegra210_adx.c | 80 ++++++++++++++++------------------\n sound/soc/tegra/tegra210_adx.h | 5 ++-\n 2 files changed, 40 insertions(+), 45 deletions(-)", "diff": "diff --git a/sound/soc/tegra/tegra210_adx.c b/sound/soc/tegra/tegra210_adx.c\nindex 95875c75ddf8..67948459e884 100644\n--- a/sound/soc/tegra/tegra210_adx.c\n+++ b/sound/soc/tegra/tegra210_adx.c\n@@ -47,6 +47,7 @@ static const struct reg_default tegra264_adx_reg_defaults[] = {\n \n static void tegra210_adx_write_map_ram(struct tegra210_adx *adx)\n {\n+\tunsigned int byte_mask[TEGRA264_ADX_BYTE_MASK_COUNT] = { 0 };\n \tint i;\n \n \tregmap_write(adx->regmap, TEGRA210_ADX_CFG_RAM_CTRL +\n@@ -55,15 +56,28 @@ static void tegra210_adx_write_map_ram(struct tegra210_adx *adx)\n \t\t TEGRA210_ADX_CFG_RAM_CTRL_ADDR_INIT_EN |\n \t\t TEGRA210_ADX_CFG_RAM_CTRL_RW_WRITE);\n \n-\tfor (i = 0; i < adx->soc_data->ram_depth; i++)\n+\tfor (i = 0; i < adx->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 = adx->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(adx->regmap, TEGRA210_ADX_CFG_RAM_DATA +\n-\t\t\t\tadx->soc_data->cya_offset,\n-\t\t\t adx->map[i]);\n+\t\t\t\tadx->soc_data->cya_offset, word);\n+\t}\n \n \tfor (i = 0; i < adx->soc_data->byte_mask_size; i++)\n \t\tregmap_write(adx->regmap,\n \t\t\t TEGRA210_ADX_IN_BYTE_EN0 + (i * TEGRA210_ADX_AUDIOCIF_CH_STRIDE),\n-\t\t\t adx->byte_mask[i]);\n+\t\t\t byte_mask[i]);\n }\n \n static int tegra210_adx_startup(struct snd_pcm_substream *substream,\n@@ -188,27 +202,10 @@ static int tegra210_adx_get_byte_map(struct snd_kcontrol *kcontrol,\n {\n \tstruct snd_soc_component *cmpnt = snd_kcontrol_chip(kcontrol);\n \tstruct tegra210_adx *adx = snd_soc_component_get_drvdata(cmpnt);\n-\tstruct soc_mixer_control *mc;\n-\tunsigned char *bytes_map = (unsigned char *)adx->map;\n-\tint enabled;\n+\tstruct soc_mixer_control *mc =\n+\t\t(struct soc_mixer_control *)kcontrol->private_value;\n \n-\tmc = (struct soc_mixer_control *)kcontrol->private_value;\n-\tenabled = adx->byte_mask[mc->reg / 32] & (1 << (mc->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[mc->reg];\n-\telse\n-\t\tucontrol->value.integer.value[0] = 256;\n+\tucontrol->value.integer.value[0] = adx->map[mc->reg];\n \n \treturn 0;\n }\n@@ -218,23 +215,22 @@ static int tegra210_adx_put_byte_map(struct snd_kcontrol *kcontrol,\n {\n \tstruct snd_soc_component *cmpnt = snd_kcontrol_chip(kcontrol);\n \tstruct tegra210_adx *adx = snd_soc_component_get_drvdata(cmpnt);\n-\tunsigned char *bytes_map = (unsigned char *)adx->map;\n-\tint value = ucontrol->value.integer.value[0];\n \tstruct soc_mixer_control *mc =\n \t\t(struct soc_mixer_control *)kcontrol->private_value;\n-\tunsigned int mask_val = adx->byte_mask[mc->reg / 32];\n+\tunsigned int value = ucontrol->value.integer.value[0];\n \n-\tif (value >= 0 && value <= 255)\n-\t\tmask_val |= (1 << (mc->reg % 32));\n-\telse\n-\t\tmask_val &= ~(1 << (mc->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 == adx->byte_mask[mc->reg / 32])\n+\tif (adx->map[mc->reg] == value)\n \t\treturn 0;\n \n-\t/* Update byte map and slot */\n-\tbytes_map[mc->reg] = value % 256;\n-\tadx->byte_mask[mc->reg / 32] = mask_val;\n+\tadx->map[mc->reg] = value;\n \n \treturn 1;\n }\n@@ -675,7 +671,7 @@ static int tegra210_adx_platform_probe(struct platform_device *pdev)\n \tconst struct of_device_id *match;\n \tstruct tegra210_adx_soc_data *soc_data;\n \tvoid __iomem *regs;\n-\tint err;\n+\tint err, i;\n \n \tadx = devm_kzalloc(dev, sizeof(*adx), GFP_KERNEL);\n \tif (!adx)\n@@ -700,16 +696,14 @@ static int tegra210_adx_platform_probe(struct platform_device *pdev)\n \n \tregcache_cache_only(adx->regmap, true);\n \n-\tadx->map = devm_kzalloc(dev, soc_data->ram_depth * sizeof(*adx->map),\n-\t\t\t\tGFP_KERNEL);\n+\tadx->map = devm_kcalloc(dev, soc_data->ram_depth * 4,\n+\t\t\t\tsizeof(*adx->map), GFP_KERNEL);\n \tif (!adx->map)\n \t\treturn -ENOMEM;\n \n-\tadx->byte_mask = devm_kzalloc(dev,\n-\t\t\t\t soc_data->byte_mask_size * sizeof(*adx->byte_mask),\n-\t\t\t\t GFP_KERNEL);\n-\tif (!adx->byte_mask)\n-\t\treturn -ENOMEM;\n+\t/* Initialize all byte map slots as disabled (value 256). */\n+\tfor (i = 0; i < soc_data->ram_depth * 4; i++)\n+\t\tadx->map[i] = 256;\n \n \ttegra210_adx_dais[TEGRA_ADX_IN_DAI_ID].playback.channels_max =\n \t\t\tadx->soc_data->max_ch;\ndiff --git a/sound/soc/tegra/tegra210_adx.h b/sound/soc/tegra/tegra210_adx.h\nindex 176a4e40de0a..afe95e45458f 100644\n--- a/sound/soc/tegra/tegra210_adx.h\n+++ b/sound/soc/tegra/tegra210_adx.h\n@@ -8,6 +8,8 @@\n #ifndef __TEGRA210_ADX_H__\n #define __TEGRA210_ADX_H__\n \n+#include <linux/types.h>\n+\n /* Register offsets from TEGRA210_ADX*_BASE */\n #define TEGRA210_ADX_RX_STATUS\t\t0x0c\n #define TEGRA210_ADX_RX_INT_STATUS\t0x10\n@@ -88,8 +90,7 @@ struct tegra210_adx_soc_data {\n \n struct tegra210_adx {\n \tstruct regmap *regmap;\n-\tunsigned int *map;\n-\tunsigned int *byte_mask;\n+\tu16 *map;\n \tconst struct tegra210_adx_soc_data *soc_data;\n };\n \n", "prefixes": [ "1/2" ] }