Skip to contentSkip to conversation

ASoC: pcm179x: Add support for pcm1795 and pcm1796

PATCH In review Roman Smrž 4 participants 10 messages Oct 16 – Nov 11

Subsystems (8)
lore
Share & tools
lore
#0 lore raw

v2 cover ASoC: pcm179x: Add support for pcm1795 and pcm1796

This adds support for the PCM1795 and the PCM1796 to the pcm179x driver.

The PCM1795 is register compatible with the PCM1792A, but it encodes two of the register 18 FMT[2:0] values differently, so the format encoding is described with a per-codec table instead of the width switches. Only the PCM1795 has real 32-bit formats; on the PCM1792A and the PCM1796 a 32-bit container keeps the 24-bit code, as it always has. Left-justified, which the driver accepted but never programmed, is added on the way.

This series is based on a work done in 2016 by my collegue:
https://lore.kernel.org/all/20160311232856.GC27257@panicking/

---
Changes in v2:
- Added missing entry to spi_ids.
- Added SND_SOC_POSSIBLE_DAIFMT_LEFT_J as supported format.
- Updated description of devicetree bindings commit.
- Link to v1: https://patch.msgid.link/[email protected]

To: Peter Rosin <[email protected]>
To: Martin Povišer <[email protected]>
To: Lars-Peter Clausen <[email protected]>
To: Nuno Sá <[email protected]>
To: Liam Girdwood <[email protected]>
To: Mark Brown <[email protected]>
To: Rob Herring <[email protected]>
To: Krzysztof Kozlowski <[email protected]>
To: Conor Dooley <[email protected]>
To: Shenghao Ding <[email protected]>
To: Kevin Lu <[email protected]>
To: Baojun Xu <[email protected]>
To: Sen Wang <[email protected]>
To: Jaroslav Kysela <[email protected]>
To: Takashi Iwai <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]

---
Michael Trimarchi (2):
ASoC: dt-bindings: Add ti,pcm1795 and ti,pcm1796
ASoC: pcm179x: Add support for pcm1975

Roman Smrž (3):
ASoC: pcm179x: Refactor regmap value lookup
ASoC: pcm179x: Add left-justified formats for pcm1792a
ASoC: pcm179x: Add compatible string for pcm1796 and spi_ids entry

 .../devicetree/bindings/sound/trivial-codec.yaml   |   2 +
 sound/soc/codecs/pcm179x-i2c.c                     |   2 +
 sound/soc/codecs/pcm179x-spi.c                     |   4 +
 sound/soc/codecs/pcm179x.c                         | 117 +++++++++++++++------
 sound/soc/codecs/pcm179x.h                         |  12 ++-
 5 files changed, 104 insertions(+), 33 deletions(-)

---
base-commit: 2f2f7eeef8b0a1a9b9ca998231419873ccae8d4e
change-id: 20261002-work-705f20b60284

Best regards,

Signature · 1 line
Roman Smrž <[email protected]>
#1 lore raw

PATCH v2 1/5 ASoC: dt-bindings: Add ti,pcm1795 and ti,pcm1796

From: Michael Trimarchi <[email protected]>

The PCM1795 and PCM1796 are cost/power-reduced variants of PCM1792A. Both are register compatible with the PCM1792A, so they belong in the trivial codec schema.

---
Changes in v2:
- Updated description.

---
 Documentation/devicetree/bindings/sound/trivial-codec.yaml | 2 ++
 1 file changed, 2 insertions(+)
Documentation/devicetree/bindings/sound/trivial-codec.yaml +2 -0
index 9a35dfb17349..a24a21c855e1 100644
@@ -36,6 +36,8 @@ properties:
       - sdw3019f836300
       - ti,pcm1789
       - ti,pcm1792a
+      - ti,pcm1795
+      - ti,pcm1796
       - ti,pcm5102a
       - wlf,wm8510
       - wlf,wm8523
Signature · 1 line
2.55.0
Acked-by on v2 1/5
#2 lore raw

Re: [PATCH v2 1/5] ASoC: dt-bindings: Add ti,pcm1795 and ti,pcm1796

Quoted 9 lines · Roman Smrž

From: Michael Trimarchi <[email protected]>

The PCM1795 and PCM1796 are cost/power-reduced variants of PCM1792A. Both are register compatible with the PCM1792A, so they belong in the trivial codec schema.

Quoted 6 lines

---
Changes in v2:
- Updated description.

---
 Documentation/devicetree/bindings/sound/trivial-codec.yaml | 2 ++
 1 file changed, 2 insertions(+)

Best regards,
Krzysztof

#3 lore raw

PATCH v2 2/5 ASoC: pcm179x: Refactor regmap value lookup

In reply to Roman Smrž

Use a table lookup to find values for fmt register instead of switch statements to prepare for additional codec variants of the same family.

---
 sound/soc/codecs/pcm179x.c | 60 +++++++++++++++++++++++-----------------------
 1 file changed, 30 insertions(+), 30 deletions(-)
sound/soc/codecs/pcm179x.c +30 -30
index cb70927872aa..61b87dab3266 100644
@@ -65,6 +65,31 @@ struct pcm179x_private {
 	unsigned int rate;
 };
 
+struct pcm179x_fmt_table {
+	unsigned int fmt;	/* SND_SOC_DAIFMT_* */
+	unsigned int width;	/* sample width in bits */
+	unsigned int value;	/* FMT[2:0] */
+};
+
+static const struct pcm179x_fmt_table pcm1792a_fmt[] = {
+	{ SND_SOC_DAIFMT_RIGHT_J, 16, 0 },
+	{ SND_SOC_DAIFMT_RIGHT_J, 24, 2 },
+	{ SND_SOC_DAIFMT_RIGHT_J, 32, 2 },
+	{ SND_SOC_DAIFMT_I2S,     16, 4 },
+	{ SND_SOC_DAIFMT_I2S,     24, 5 },
+	{ SND_SOC_DAIFMT_I2S,     32, 5 },
+};
+
+static int pcm179x_fmt_value(struct pcm179x_private *priv, unsigned int fmt,
+			     unsigned int width)
+{
+	for (unsigned int i = 0; i < ARRAY_SIZE(pcm1792a_fmt); i++)
+		if (pcm1792a_fmt[i].fmt == fmt && pcm1792a_fmt[i].width == width)
+			return pcm1792a_fmt[i].value;
+
+	return -EINVAL;
+}
+
 static int pcm179x_set_dai_fmt(struct snd_soc_dai *codec_dai,
                              unsigned int format)
 {
@@ -96,40 +121,15 @@ static int pcm179x_hw_params(struct snd_pcm_substream *substream,
 {
 	struct snd_soc_component *component = dai->component;
 	struct pcm179x_private *priv = snd_soc_component_get_drvdata(component);
-	int val = 0, ret;
+	int val, ret;
 
 	priv->rate = params_rate(params);
 
-	switch (priv->format & SND_SOC_DAIFMT_FORMAT_MASK) {
-	case SND_SOC_DAIFMT_RIGHT_J:
-		switch (params_width(params)) {
-		case 24:
-		case 32:
-			val = 2;
-			break;
-		case 16:
-			val = 0;
-			break;
-		default:
-			return -EINVAL;
-		}
-		break;
-	case SND_SOC_DAIFMT_I2S:
-		switch (params_width(params)) {
-		case 24:
-		case 32:
-			val = 5;
-			break;
-		case 16:
-			val = 4;
-			break;
-		default:
-			return -EINVAL;
-		}
-		break;
-	default:
+	val = pcm179x_fmt_value(priv, priv->format & SND_SOC_DAIFMT_FORMAT_MASK,
+				params_width(params));
+	if (val < 0) {
 		dev_err(component->dev, "Invalid DAI format\n");
-		return -EINVAL;
+		return val;
 	}
 
 	val = val << PCM179X_FMT_SHIFT | PCM179X_ATLD_ENABLE;
Signature · 1 line
2.55.0
#4 lore raw

PATCH v2 3/5 ASoC: pcm179x: Add left-justified formats for pcm1792a

In reply to Roman Smrž

The left-justified format is supported per the datasheet, but was missing in the table.

---
 sound/soc/codecs/pcm179x.c | 3 +++
 1 file changed, 3 insertions(+)
sound/soc/codecs/pcm179x.c +3 -0
index 61b87dab3266..fae5de318b6e 100644
@@ -75,6 +75,8 @@ static const struct pcm179x_fmt_table pcm1792a_fmt[] = {
 	{ SND_SOC_DAIFMT_RIGHT_J, 16, 0 },
 	{ SND_SOC_DAIFMT_RIGHT_J, 24, 2 },
 	{ SND_SOC_DAIFMT_RIGHT_J, 32, 2 },
+	{ SND_SOC_DAIFMT_LEFT_J,  24, 3 },
+	{ SND_SOC_DAIFMT_LEFT_J,  32, 3 },
 	{ SND_SOC_DAIFMT_I2S,     16, 4 },
 	{ SND_SOC_DAIFMT_I2S,     24, 5 },
 	{ SND_SOC_DAIFMT_I2S,     32, 5 },
@@ -144,6 +146,7 @@ static int pcm179x_hw_params(struct snd_pcm_substream *substream,
 
 static const u64 pcm179x_selectable_formats =
 	SND_SOC_POSSIBLE_DAIFMT_I2S	|
+	SND_SOC_POSSIBLE_DAIFMT_LEFT_J  |
 	SND_SOC_POSSIBLE_DAIFMT_RIGHT_J;
 
 static const struct snd_soc_dai_ops pcm179x_dai_ops = {
Signature · 1 line
2.55.0
#5 lore raw

PATCH v2 4/5 ASoC: pcm179x: Add compatible string for pcm1796 and spi_ids entry

In reply to Roman Smrž

The PCM1796 is fully compatible with the PCM1792A.

---
Changes in v2:
- Added missing entry to spi_ids.

---
 sound/soc/codecs/pcm179x-i2c.c | 1 +
 sound/soc/codecs/pcm179x-spi.c | 2 ++
 2 files changed, 3 insertions(+)
sound/soc/codecs/pcm179x-i2c.c +1 -0
index 5337bcc7c62c..e81e20fadadf 100644
@@ -32,6 +32,7 @@ static int pcm179x_i2c_probe(struct i2c_client *client)
 #ifdef CONFIG_OF
 static const struct of_device_id pcm179x_of_match[] = {
 	{ .compatible = "ti,pcm1792a", },
+	{ .compatible = "ti,pcm1796", },
 	{ }
 };
 MODULE_DEVICE_TABLE(of, pcm179x_of_match);
sound/soc/codecs/pcm179x-spi.c +2 -0
index 192fee90c971..4b873f2986c7 100644
@@ -31,12 +31,14 @@ static int pcm179x_spi_probe(struct spi_device *spi)
 
 static const struct of_device_id pcm179x_of_match[] __maybe_unused = {
 	{ .compatible = "ti,pcm1792a", },
+	{ .compatible = "ti,pcm1796" },
 	{ }
 };
 MODULE_DEVICE_TABLE(of, pcm179x_of_match);
 
 static const struct spi_device_id pcm179x_spi_ids[] = {
 	{ "pcm1792a", 0 },
+	{ "pcm1796", 0 },
 	{ "pcm179x", 0 },
 	{ },
 };
Signature · 1 line
2.55.0
#6 lore raw

PATCH v2 5/5 ASoC: pcm179x: Add support for pcm1975

In reply to Roman Smrž

From: Michael Trimarchi <[email protected]>

The PCM1795 is register compatible with the PCM1792A, but it encodes two of the register 18 FMT[2:0] values differently: code 001 selects 32-bit standard data instead of 20-bit, and code 100 selects 32-bit I2S instead of 16-bit I2S. It has no 20-bit format at all. The PCM1796 shares the PCM1792A encoding.

The model is read with device_get_match_data(), so each bus driver carries the model in its own of_device_id table. The tables cannot move to the common file: MODULE_DEVICE_TABLE() aliases a table that has to be defined in the same translation unit.

---
Changes in v2:
- Added missing entry to spi_ids.

---
 sound/soc/codecs/pcm179x-i2c.c |  3 +-
 sound/soc/codecs/pcm179x-spi.c |  4 ++-
 sound/soc/codecs/pcm179x.c     | 62 ++++++++++++++++++++++++++++++++++++++----
 sound/soc/codecs/pcm179x.h     | 12 ++++++--
 4 files changed, 72 insertions(+), 9 deletions(-)
sound/soc/codecs/pcm179x-i2c.c +2 -1
index e81e20fadadf..751f4b74647a 100644
@@ -32,7 +32,8 @@ static int pcm179x_i2c_probe(struct i2c_client *client)
 #ifdef CONFIG_OF
 static const struct of_device_id pcm179x_of_match[] = {
 	{ .compatible = "ti,pcm1792a", },
-	{ .compatible = "ti,pcm1796", },
+	{ .compatible = "ti,pcm1795", .data = (void *)PCM1795, },
+	{ .compatible = "ti,pcm1796", .data = (void *)PCM1796, },
 	{ }
 };
 MODULE_DEVICE_TABLE(of, pcm179x_of_match);
sound/soc/codecs/pcm179x-spi.c +3 -1
index 4b873f2986c7..a6c6ac1eb97b 100644
@@ -31,13 +31,15 @@ static int pcm179x_spi_probe(struct spi_device *spi)
 
 static const struct of_device_id pcm179x_of_match[] __maybe_unused = {
 	{ .compatible = "ti,pcm1792a", },
-	{ .compatible = "ti,pcm1796" },
+	{ .compatible = "ti,pcm1795", .data = (void *)PCM1795, },
+	{ .compatible = "ti,pcm1796", .data = (void *)PCM1796, },
 	{ }
 };
 MODULE_DEVICE_TABLE(of, pcm179x_of_match);
 
 static const struct spi_device_id pcm179x_spi_ids[] = {
 	{ "pcm1792a", 0 },
+	{ "pcm1795", 0 },
 	{ "pcm1796", 0 },
 	{ "pcm179x", 0 },
 	{ },
sound/soc/codecs/pcm179x.c +57 -5

111 lines not on this page · raw message

sound/soc/codecs/pcm179x.h +10 -2
index 0039ca8ee742..33971fa93546 100644
@@ -8,8 +8,16 @@
 #ifndef __PCM179X_H__
 #define __PCM179X_H__
 
-#define PCM1792A_FORMATS (SNDRV_PCM_FMTBIT_S32_LE | SNDRV_PCM_FMTBIT_S24_LE | \
-			  SNDRV_PCM_FMTBIT_S16_LE)
+enum pcm179x_type {
+	PCM1792A,
+	PCM1795,
+	PCM1796,
+};
+
+#define PCM179X_FORMATS (SNDRV_PCM_FMTBIT_S32_LE | SNDRV_PCM_FMTBIT_S24_LE | \
+			 SNDRV_PCM_FMTBIT_S16_LE)
+
+#define PCM1795_FORMATS (SNDRV_PCM_FMTBIT_S32_LE | SNDRV_PCM_FMTBIT_S24_LE)
 
 extern const struct regmap_config pcm179x_regmap_config;
 
Signature · 1 line
2.55.0
#7 lore raw

Re: [PATCH v2 5/5] ASoC: pcm179x: Add support for pcm1975

Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider: - [Medium] sound: pcm1795 misidentified as pcm1792a on spi/i2c due to missing driver_data - [Medium] ASoC…

Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:
- [Medium] sound: pcm1795 misidentified as pcm1792a on spi/i2c due to missing driver_data
- [Medium] ASoC: pcm179x: 16-bit format missing for PCM1795
- [Medium] ASoC: pcm1795: hw_params fails with -EINVAL for 32-bit LEFT_J streams --

commit 82f31b72b82184d1d5d7c469d77cb1c8fab51b6d
Author: Michael Trimarchi <[email protected]>
Subject: ASoC: pcm179x: Add support for pcm1975

The commit adds support for the PCM1795 audio codec, introducing a new codec model differentiation based on device match data. It adds device match tables for OF along with SPI ID tables, and separate format handling tables and startup constraints for the new model.

Quoted 4 lines
sound/soc/codecs/pcm179x-spi.c +0 -0
index 4b873f2986c77..a6c6ac1eb97b2 100644

[ ... ]

Quoted 1 line
sound/soc/codecs/pcm179x-spi.c +0 -0
@@ -31,13 +31,15 @@ static int pcm179x_spi_probe(struct spi_device *spi)

[ ... ]

sound/soc/codecs/pcm179x-spi.c static int pcm179x_spi_probe(struct spi_device *spi) · line 45

Quoted 6 lines

static const struct spi_device_id pcm179x_spi_ids[] = {

sound/soc/codecs/pcm179x-spi.c +1 -0
 	{ "pcm1792a", 0 },
+	{ "pcm1795", 0 },
 	{ "pcm1796", 0 },
 	{ "pcm179x", 0 },
 	{ },

[Severity: Medium]
Since the driver differentiates models using enum pcm179x_type where PCM1795 is 1, will leaving the driver_data as 0 cause non-OF setups to misidentify the PCM1795 as a PCM1792A?

When device_get_match_data() is called in pcm179x_common_init(), it will resolve to 0 for these legacy boards. This could break audio playback for formats encoded differently between models, such as 32-bit I2S.

Additionally, should the new models be added to the I2C ID table in pcm179x-i2c.c for the same reason?

Quoted 4 lines
sound/soc/codecs/pcm179x.c +0 -0
index fae5de318b6ea..8e9b9e98c8dff 100644

[ ... ]

sound/soc/codecs/pcm179x.c static const struct pcm179x_fmt_table pcm1792a_fmt[] = { · line 104

Quoted 12 lines
sound/soc/codecs/pcm179x.c +8 -0
@@ -82,16 +94,53 @@ static const struct pcm179x_fmt_table pcm1792a_fmt[] = {
 	{ SND_SOC_DAIFMT_I2S,     32, 5 },
 };
 
+static const struct pcm179x_fmt_table pcm1795_fmt[] = {
+	{ SND_SOC_DAIFMT_RIGHT_J, 16, 0 },
+	{ SND_SOC_DAIFMT_RIGHT_J, 24, 2 },
+	{ SND_SOC_DAIFMT_RIGHT_J, 32, 1 },
+	{ SND_SOC_DAIFMT_LEFT_J,  24, 3 },
+	{ SND_SOC_DAIFMT_I2S,     24, 5 },
+	{ SND_SOC_DAIFMT_I2S,     32, 4 },
+};

[Severity: Medium]
Is there a missing entry here for { SND_SOC_DAIFMT_LEFT_J, 32, 3 }?

Because PCM1795_FORMATS includes SNDRV_PCM_FMTBIT_S32_LE and the ASoC core allows LEFT_J for all models, userspace can request 32-bit LEFT_J streams.

Without an entry in this table, pcm179x_fmt_value() will fail and return -EINVAL during pcm179x_hw_params(), causing playback to fail at runtime.

Quoted 4 lines
sound/soc/codecs/pcm179x.h +0 -0
index 0039ca8ee7420..33971fa935469 100644

[ ... ]

Quoted 6 lines
sound/soc/codecs/pcm179x.h +0 -2
@@ -8,8 +8,16 @@
 #ifndef __PCM179X_H__
 #define __PCM179X_H__
 
-#define PCM1792A_FORMATS (SNDRV_PCM_FMTBIT_S32_LE | SNDRV_PCM_FMTBIT_S24_LE | \
-			  SNDRV_PCM_FMTBIT_S16_LE)

sound/soc/codecs/pcm179x.h line 20

Quoted 10 lines
sound/soc/codecs/pcm179x.h +10 -0
+enum pcm179x_type {
+	PCM1792A,
+	PCM1795,
+	PCM1796,
+};
+
+#define PCM179X_FORMATS (SNDRV_PCM_FMTBIT_S32_LE | SNDRV_PCM_FMTBIT_S24_LE | \
+			 SNDRV_PCM_FMTBIT_S16_LE)
+
+#define PCM1795_FORMATS (SNDRV_PCM_FMTBIT_S32_LE | SNDRV_PCM_FMTBIT_S24_LE)

[Severity: Medium]
Does the PCM1795 support 16-bit audio streams?

The pcm1795_fmt table in pcm179x.c contains an entry for 16-bit Right-J:

        { SND_SOC_DAIFMT_RIGHT_J, 16, 0 },

By excluding SNDRV_PCM_FMTBIT_S16_LE from PCM1795_FORMATS, the ALSA core unconditionally rejects all 16-bit streams at open time. This forces userspace to upsample or pad streams, and makes the 16-bit Right-J table entry unreachable dead code.

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=5
maintainer
#8 lore raw

Re: [PATCH v2 5/5] ASoC: pcm179x: Add support for pcm1975

In reply to Roman Smrž
Quoted 6 lines

The PCM1795 is register compatible with the PCM1792A, but it encodes two of the register 18 FMT[2:0] values differently: code 001 selects 32-bit standard data instead of 20-bit, and code 100 selects 32-bit I2S instead of 16-bit I2S. It has no 20-bit format at all. The PCM1796 shares the PCM1792A encoding.

sound/soc/codecs/pcm179x-spi.c static int pcm179x_spi_probe(struct spi_device *spi) · line 42

Quoted 8 lines
sound/soc/codecs/pcm179x-spi.c +3 -0
+	{ .compatible = "ti,pcm1795", .data = (void *)PCM1795, },
+	{ .compatible = "ti,pcm1796", .data = (void *)PCM1796, },
 	{ }
 };
 
 static const struct spi_device_id pcm179x_spi_ids[] = {
 	{ "pcm1792a", 0 },
+	{ "pcm1795", 0 },

Don't we need to set the driver data to PCM1795 like we do for the other DT based entries?

sound/soc/codecs/pcm179x.c static const struct pcm179x_fmt_table pcm1792a_fmt[] = { · line 103

Quoted 7 lines
sound/soc/codecs/pcm179x.c +7 -0
+static const struct pcm179x_fmt_table pcm1795_fmt[] = {
+	{ SND_SOC_DAIFMT_RIGHT_J, 16, 0 },
+	{ SND_SOC_DAIFMT_RIGHT_J, 24, 2 },
+	{ SND_SOC_DAIFMT_RIGHT_J, 32, 1 },
+	{ SND_SOC_DAIFMT_LEFT_J,  24, 3 },
+	{ SND_SOC_DAIFMT_I2S,     24, 5 },
+	{ SND_SOC_DAIFMT_I2S,     32, 4 },

Does this line up with the constraints advertised by the driver? LEFT_J and S32 isn't here, but S16 is? We're also not handling big endian.

sound/soc/codecs/pcm179x.c static struct snd_soc_dai_driver pcm179x_dai = { · line 244

Quoted 6 lines
sound/soc/codecs/pcm179x.c +1 -1
@@ -191,7 +241,7 @@ static struct snd_soc_dai_driver pcm179x_dai = {
 		.rates = SNDRV_PCM_RATE_CONTINUOUS,
 		.rate_min = 10000,
 		.rate_max = 200000,
-		.formats = PCM1792A_FORMATS, },
+		.formats = PCM179X_FORMATS, },

It'd probably be easier to just register different constraints depending on the device rather than having constraints in startup, you'd get much better reuse of the core code that way. Dynamic updates are usually done for things that can vary at runtime like clock rates.

Signature · 1 line
Mark Brown <[email protected]>
#9 lore raw

Re: [PATCH v2 5/5] ASoC: pcm179x: Add support for pcm1975

Quoted 11 lines · Mark Brown
Quoted 10 lines

The PCM1795 is register compatible with the PCM1792A, but it encodes two of the register 18 FMT[2:0] values differently: code 001 selects 32-bit standard data instead of 20-bit, and code 100 selects 32-bit I2S instead of 16-bit I2S. It has no 20-bit format at all. The PCM1796 shares the PCM1792A encoding.

sound/soc/codecs/pcm179x-i2c.c +2 -0
+	{ .compatible = "ti,pcm1795", .data = (void *)PCM1795, },
+	{ .compatible = "ti,pcm1796", .data = (void *)PCM1796, },
 	{ }
 };
Quoted 6 lines

sound/soc/codecs/pcm179x-spi.c static int pcm179x_spi_probe(struct spi_device *spi) · line 42

Quoted 3 lines

static const struct spi_device_id pcm179x_spi_ids[] = {

sound/soc/codecs/pcm179x-spi.c +1 -0
 	{ "pcm1792a", 0 },
+	{ "pcm1795", 0 },

Don't we need to set the driver data to PCM1795 like we do for the other DT based entries?

Yes, I'll fix that.

Quoted 10 lines

sound/soc/codecs/pcm179x.c static const struct pcm179x_fmt_table pcm1792a_fmt[] = { · line 103

Quoted 7 lines
sound/soc/codecs/pcm179x.c +7 -0
+static const struct pcm179x_fmt_table pcm1795_fmt[] = {
+	{ SND_SOC_DAIFMT_RIGHT_J, 16, 0 },
+	{ SND_SOC_DAIFMT_RIGHT_J, 24, 2 },
+	{ SND_SOC_DAIFMT_RIGHT_J, 32, 1 },
+	{ SND_SOC_DAIFMT_LEFT_J,  24, 3 },
+	{ SND_SOC_DAIFMT_I2S,     24, 5 },
+	{ SND_SOC_DAIFMT_I2S,     32, 4 },

Does this line up with the constraints advertised by the driver? LEFT_J and S32 isn't here, but S16 is? We're also not handling big endian.

Yes, the 32bit variant for LEFT_J should be here as well. But what should be handled for big endian here? As far as I've understood, the bit stream on wire would be the same regardless of byte order in memory.

Quoted 11 lines

sound/soc/codecs/pcm179x.c static struct snd_soc_dai_driver pcm179x_dai = { · line 244

Quoted 6 lines
sound/soc/codecs/pcm179x.c +1 -1
@@ -191,7 +241,7 @@ static struct snd_soc_dai_driver pcm179x_dai = {
 		.rates = SNDRV_PCM_RATE_CONTINUOUS,
 		.rate_min = 10000,
 		.rate_max = 200000,
-		.formats = PCM1792A_FORMATS, },
+		.formats = PCM179X_FORMATS, },

It'd probably be easier to just register different constraints depending on the device rather than having constraints in startup, you'd get much better reuse of the core code that way. Dynamic updates are usually done for things that can vary at runtime like clock rates.

After rechecking the format list, all the supported variants should have the same "formats" field, so I can remove the distinction for that point altogether.

Best Regrads
Roman Smrž