Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Mohammad Rafi Shaik" <mohammad.rafi.shaik@oss.qualcomm.com>
Cc: robh@kernel.org, conor+dt@kernel.org, devicetree@vger.kernel.org
Subject: Re: [PATCH v1 1/5] ASoC: codec: adau1977-i2c: Add OF device match table
Date: Mon, 07 Sep 2026 18:20:08 +0000	[thread overview]
Message-ID: <20260907182008.7AC481F00A3A@smtp.kernel.org> (raw)
In-Reply-To: <20260907-nord-asoc-driver-support-v1-1-997d3b20cf43@oss.qualcomm.com>

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Medium] Missing Match Data / ACPI PRP0001 Breakage
- [Medium] ACPI PRP0001 Compatibility broken by `of_match_ptr()`
--

commit de095d944f1c821e3699bdad1f08a37eaabe1d3f
Author: Mohammad Rafi Shaik <mohammad.rafi.shaik@oss.qualcomm.com>

ASoC: codec: adau1977-i2c: Add OF device match table

The ADAU1977 I2C driver lacks an OF device match table, preventing
it from binding to codec instances described via Device Tree. Systems
using compatible strings such as "adi,adau1977", "adi,adau1978", or
"adi,adau1979" fail to probe the driver as a result.

> diff --git a/sound/soc/codecs/adau1977-i2c.c b/sound/soc/codecs/adau1977-i2c.c
> index d1c6c4ddf5063..9f54fa8375b15 100644
> --- a/sound/soc/codecs/adau1977-i2c.c
> +++ b/sound/soc/codecs/adau1977-i2c.c
> @@ -34,9 +34,18 @@ static const struct i2c_device_id adau1977_i2c_ids[] = {
>  };
>  MODULE_DEVICE_TABLE(i2c, adau1977_i2c_ids);
>  
> +static const struct of_device_id adau1977_i2c_of_match[] __maybe_unused = {
> +	{ .compatible = "adi,adau1977" },
> +	{ .compatible = "adi,adau1978" },
> +	{ .compatible = "adi,adau1979" },

[Severity: Medium]
Will this cause ADAU1978 and ADAU1979 devices enumerated via ACPI PRP0001
to be incorrectly initialized as ADAU1977?

Without the .data field in the match table, device_get_match_data() returns
NULL. In adau1977_i2c_probe(), the chip type is determined by calling
i2c_get_match_data().

If device_get_match_data() returns NULL, i2c_get_match_data() falls back to
i2c_match_id(). On ACPI PRP0001 systems, client->name is generically set
(e.g., PRP0001:00), which fails to match legacy I2C IDs like "adau1978",
causing i2c_match_id() to also return NULL.

When cast to enum adau1977_type in adau1977_i2c_probe():

	return adau1977_probe(&client->dev,
		devm_regmap_init_i2c(client, &config),
		(uintptr_t)i2c_get_match_data(client), NULL);

NULL evaluates to 0, which incorrectly maps to ADAU1977 for all devices.

Should we include the appropriate .data fields here so they are correctly
identified?

> +	{ },
> +};
> +MODULE_DEVICE_TABLE(of, adau1977_i2c_of_match);
> +
>  static struct i2c_driver adau1977_i2c_driver = {
>  	.driver = {
>  		.name = "adau1977",
> +		.of_match_table = of_match_ptr(adau1977_i2c_of_match),

[Severity: Medium]
Will this break hardware enumeration entirely on ACPI systems using PRP0001
if the kernel is built without CONFIG_OF?

The ACPI core uses the of_match_table to match compatible strings for
PRP0001-enumerated devices on non-DT systems. Because of_match_ptr() is
used here, the table pointer is explicitly nulled out when CONFIG_OF is
disabled.

Since __maybe_unused is already applied to adau1977_i2c_of_match, can we
drop the of_match_ptr() wrapper to ensure it probes correctly in all
configurations?

>  	},
>  	.probe = adau1977_i2c_probe,
>  	.id_table = adau1977_i2c_ids,

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260907-nord-asoc-driver-support-v1-0-997d3b20cf43@oss.qualcomm.com?part=1

  reply	other threads:[~2026-09-07 18:20 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-07 18:09 [PATCH 0/5] ASoC: qcom: Add Nord Ride audio support Mohammad Rafi Shaik
2026-09-07 18:09 ` [PATCH v1 1/5] ASoC: codec: adau1977-i2c: Add OF device match table Mohammad Rafi Shaik
2026-09-07 18:20   ` sashiko-bot [this message]
2026-09-09 14:44   ` Shawn Guo
2026-09-07 18:09 ` [PATCH v1 2/5] ASoC: dt-bindings: ti,pcm1681: Document the optional SCK clock Mohammad Rafi Shaik
2026-09-09 14:50   ` Shawn Guo
2026-09-07 18:09 ` [PATCH v1 3/5] ASoC: codec: pcm1681: Enable system clock before regmap access Mohammad Rafi Shaik
2026-09-07 18:17   ` sashiko-bot
2026-09-08 17:26   ` Mark Brown
2026-09-09 12:36     ` Mohammad Rafi Shaik
2026-09-09 12:39       ` Mark Brown
2026-09-09 12:45         ` Mohammad Rafi Shaik
2026-09-09 14:59   ` Shawn Guo
2026-09-07 18:09 ` [PATCH v1 4/5] ASoC: dt-bindings: qcom,sm8250: Add Nord Ride sound card Mohammad Rafi Shaik
2026-09-07 18:20   ` sashiko-bot
2026-09-09 14:54   ` Shawn Guo
2026-09-07 18:09 ` [PATCH v1 5/5] ASoC: qcom: sc8280xp: Add Nord Ride sound card support Mohammad Rafi Shaik
2026-09-09 15:37   ` Shawn Guo
2026-09-09 14:46 ` [PATCH 0/5] ASoC: qcom: Add Nord Ride audio support Shawn Guo

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=20260907182008.7AC481F00A3A@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=mohammad.rafi.shaik@oss.qualcomm.com \
    --cc=robh@kernel.org \
    --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