Linux Sound subsystem development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Roman Smrž" <roman@amarulasolutions.com>
Cc: linux-sound@vger.kernel.org, devicetree@vger.kernel.org,
	robh@kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH v3 5/5] ASoC: pcm179x: Add support for pcm1975
Date: Thu, 03 Dec 2026 09:10:11 +0000	[thread overview]
Message-ID: <sashiko-outbox-247431@kernel.org> (raw)
In-Reply-To: <20261203-work-v3-5-e8a96f1c44e8@amarulasolutions.com>

Thank you for your contribution! Sashiko AI review found 3 potential
issues to consider:
- [Medium] ASoC: pcm179x: device_get_match_data() ignores SPI/I2C ID
  tables for PCM1795
- [Medium] ASoC: pcm179x: advertises S16 formats unsupported by PCM1795
  I2S and LEFT_J
- [Low] ASoC: pcm179x: commit subject misspells pcm1795 as pcm1975
--

commit 286abf7a34191f88264a3710eaa536e931b8370f
Author: Roman Smrž <roman@amarulasolutions.com>

ASoC: pcm179x: Add support for pcm1975

This commit adds support for the TI PCM1795 DAC to the pcm179x ASoC codec
driver, introducing per-model register 18 FMT[2:0] lookup tables and
resolving the codec model via device_get_match_data().

> ASoC: pcm179x: Add support for pcm1975

[Severity: Low]
This isn't a bug, but "pcm1975" in the subject is a typo for "pcm1795".

[ ... ]

> diff --git a/sound/soc/codecs/pcm179x.c b/sound/soc/codecs/pcm179x.c
> index 559ecaa32f59b..8b21a141f6657 100644
> --- a/sound/soc/codecs/pcm179x.c
> +++ b/sound/soc/codecs/pcm179x.c

[ ... ]

> @@ -191,7 +227,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, },
>  	.ops = &pcm179x_dai_ops,
>  };

[Severity: Medium]
As reported by Mark Brown on v2 [1], does pcm179x_dai still advertise
16-bit formats that PCM1795 does not support in I2S or LEFT_J mode?

PCM179X_FORMATS includes SNDRV_PCM_FMTBIT_S16_LE (expanded to S16_BE by
.endianness = 1), whereas pcm1795_fmt[] only accepts 16-bit samples in
RIGHT_J mode.  On a PCM1795 wired in I2S mode, userspace sees 16-bit as
natively supported, skips software conversion, and fails in
pcm179x_hw_params() with -EINVAL.

Constraining the advertised formats based on the model and configured DAI
format (preserving big-endian variants) would let userspace negotiate a
supported format.

> @@ -226,6 +262,8 @@ int pcm179x_common_init(struct device *dev, struct regmap *regmap)
>  	if (!pcm179x)
>  		return -ENOMEM;
>  
> +	pcm179x->codec_model =
> +		(enum pcm179x_type)(uintptr_t)device_get_match_data(dev);
>  	pcm179x->regmap = regmap;
>  	dev_set_drvdata(dev, pcm179x);

[Severity: Medium]
As reported by Mark Brown on v2 [1], does device_get_match_data() ignore
the SPI and I2C ID tables when probing without an OF node?

device_get_match_data() only queries fwnode match data, so instantiating
a PCM1795 via spi_board_info or I2C sysfs new_device returns NULL and
silently misidentifies the codec as PCM1792A.  pcm179x_hw_params() then
writes the wrong register 18 FMT[2:0] encodings (such as 5 instead of 4
for 32-bit I2S), breaking playback.  The PCM1795 and PCM1796 values added
to pcm179x_spi_ids[] are never read, and pcm179x_i2c_ids[] lacks
per-model entries so a pcm1795 I2C device cannot bind when CONFIG_OF is
disabled.

Resolving the model in pcm179x_spi_probe() and pcm179x_i2c_probe() via
spi_get_device_match_data() and i2c_get_match_data() (with per-model
entries in pcm179x_i2c_ids[]) and passing it to pcm179x_common_init()
would cover both OF and ID-table probes.

[1] https://lore.kernel.org/r/179304174310.199157.17471232393944903445.b4-review@b4

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261203-work-v3-0-e8a96f1c44e8@amarulasolutions.com?part=5

      reply	other threads:[~2026-12-03  9:10 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-03  8:51 [PATCH v3 0/5] ASoC: pcm179x: Add support for pcm1795 and pcm1796 Roman Smrž
2026-12-03  8:51 ` [PATCH v3 1/5] ASoC: dt-bindings: Add ti,pcm1795 and ti,pcm1796 Roman Smrž
2026-12-03  8:51 ` [PATCH v3 2/5] ASoC: pcm179x: Refactor regmap value lookup Roman Smrž
2026-12-03  8:51 ` [PATCH v3 3/5] ASoC: pcm179x: Add left-justified formats for pcm1792a Roman Smrž
2026-12-03  8:51 ` [PATCH v3 4/5] ASoC: pcm179x: Add compatible string for pcm1796 and spi_ids entry Roman Smrž
2026-12-03  8:51 ` [PATCH v3 5/5] ASoC: pcm179x: Add support for pcm1975 Roman Smrž
2026-12-03  9:10   ` sashiko-bot [this message]

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=sashiko-outbox-247431@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=robh@kernel.org \
    --cc=roman@amarulasolutions.com \
    --cc=sashiko-reviews@lists.linux.dev \
    /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