From: Sean Anderson <sean.anderson@linux.dev>
To: Vincenzo Frascino <vincenzo.frascino@arm.com>,
Liam Girdwood <lgirdwood@gmail.com>,
Mark Brown <broonie@kernel.org>,
linux-sound@vger.kernel.org
Cc: Jaroslav Kysela <perex@perex.cz>,
linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
Michal Simek <michal.simek@amd.com>,
Takashi Iwai <tiwai@suse.com>,
Sean Anderson <sean.anderson@linux.dev>
Subject: [PATCH 2/2] ASoC: xilinx: xlnx_i2s: Discover parameters from registers
Date: Thu, 29 Jan 2026 12:23:15 -0500 [thread overview]
Message-ID: <20260129172315.3871602-3-sean.anderson@linux.dev> (raw)
In-Reply-To: <20260129172315.3871602-1-sean.anderson@linux.dev>
Xilinx helpfully included a read-only "config" register that contains
configuration parameters. Discover our parameters from this register
instead of reading them from the device tree.
Signed-off-by: Sean Anderson <sean.anderson@linux.dev>
---
sound/soc/xilinx/xlnx_i2s.c | 32 +++++++++++---------------------
1 file changed, 11 insertions(+), 21 deletions(-)
diff --git a/sound/soc/xilinx/xlnx_i2s.c b/sound/soc/xilinx/xlnx_i2s.c
index ca915a001ad5..a2b426376676 100644
--- a/sound/soc/xilinx/xlnx_i2s.c
+++ b/sound/soc/xilinx/xlnx_i2s.c
@@ -17,6 +17,9 @@
#define DRV_NAME "xlnx_i2s"
+#define I2S_CORE_CFG 0x04
+#define I2S_CORE_CFG_DATA_24BIT BIT(16)
+#define I2S_CORE_CFG_CHANNELS GENMASK(11, 8)
#define I2S_CORE_CTRL_OFFSET 0x08
#define I2S_CORE_CTRL_32BIT_LRCLK BIT(3)
#define I2S_CORE_CTRL_ENABLE BIT(0)
@@ -172,7 +175,7 @@ static int xlnx_i2s_probe(struct platform_device *pdev)
{
struct xlnx_i2s_drv_data *drv_data;
int ret;
- u32 format;
+ u32 format, cfg;
struct device *dev = &pdev->dev;
struct device_node *node = dev->of_node;
@@ -184,27 +187,14 @@ static int xlnx_i2s_probe(struct platform_device *pdev)
if (IS_ERR(drv_data->base))
return PTR_ERR(drv_data->base);
- ret = of_property_read_u32(node, "xlnx,num-channels", &drv_data->channels);
- if (ret < 0) {
- dev_err(dev, "cannot get supported channels\n");
- return ret;
- }
- drv_data->channels *= 2;
-
- ret = of_property_read_u32(node, "xlnx,dwidth", &drv_data->data_width);
- if (ret < 0) {
- dev_err(dev, "cannot get data width\n");
- return ret;
- }
- switch (drv_data->data_width) {
- case 16:
- format = SNDRV_PCM_FMTBIT_S16_LE;
- break;
- case 24:
+ cfg = readl(drv_data->base + I2S_CORE_CFG);
+ drv_data->channels = FIELD_GET(I2S_CORE_CFG_CHANNELS, cfg);
+ if (cfg & I2S_CORE_CFG_DATA_24BIT) {
+ drv_data->data_width = 24;
format = SNDRV_PCM_FMTBIT_S24_LE;
- break;
- default:
- return -EINVAL;
+ } else {
+ drv_data->data_width = 16;
+ format = SNDRV_PCM_FMTBIT_S16_LE;
}
if (of_device_is_compatible(node, "xlnx,i2s-transmitter-1.0")) {
--
2.35.1.1320.gc452695387.dirty
next prev parent reply other threads:[~2026-01-29 17:25 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-29 17:23 [PATCH 0/2] ASoC: xilinx: xlnx_i2s: Discover parameters from registers Sean Anderson
2026-01-29 17:23 ` [PATCH 1/2] dt-bindings: sound: xlnx,i2s: Make discoverable parameters optional Sean Anderson
2026-01-29 17:37 ` Conor Dooley
2026-01-29 17:23 ` Sean Anderson [this message]
2026-01-29 17:27 ` [PATCH 2/2] ASoC: xilinx: xlnx_i2s: Discover parameters from registers Mark Brown
2026-01-29 17:46 ` Sean Anderson
2026-01-29 18:09 ` Mark Brown
2026-01-29 18:17 ` Sean Anderson
2026-01-29 18:46 ` Mark Brown
2026-01-30 8:19 ` Michal Simek
2026-02-02 17:52 ` Peter Korsgaard
2026-01-29 19:58 ` Andrew Lunn
2026-01-29 20:13 ` Sean Anderson
2026-01-29 17:37 ` Andrew Lunn
2026-01-29 17:51 ` Sean Anderson
2026-01-30 6:35 ` kernel test robot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260129172315.3871602-3-sean.anderson@linux.dev \
--to=sean.anderson@linux.dev \
--cc=broonie@kernel.org \
--cc=lgirdwood@gmail.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=michal.simek@amd.com \
--cc=perex@perex.cz \
--cc=tiwai@suse.com \
--cc=vincenzo.frascino@arm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox