Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Zhang Yi" <zhangyi@everest-semi.com>
Cc: robh@kernel.org, conor+dt@kernel.org, devicetree@vger.kernel.org
Subject: Re: [PATCH 5/7] ASoC: codecs: ES8389: Add private members related to HPF
Date: Tue, 09 Jun 2026 07:30:09 +0000	[thread overview]
Message-ID: <20260609073009.CFEB81F00893@smtp.kernel.org> (raw)
In-Reply-To: <20260609071732.20939-6-zhangyi@everest-semi.com>

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Medium] ADC High Pass Filter (HPF) configurations are exposed as devicetree properties rather than ALSA kcontrols, violating ASoC subsystem conventions.
- [Medium] Using `device_property_read_u8()` for a scalar devicetree property creates a silent fallback trap if standard 32-bit devicetree cells are used.
--

commit 709f7c3cb7dfda3e2bb5a1b6319ef2eb235e0bae
Author: Zhang Yi <zhangyi@everest-semi.com>

ASoC: codecs: ES8389: Add private members related to HPF

This commit adds private members to manage the left and right High Pass
Filter (HPF) values on the ES8389 codec. It reads these configurations from
devicetree properties during probe and applies them in the un-mute sequence.

> diff --git a/sound/soc/codecs/es8389.c b/sound/soc/codecs/es8389.c
> index 284eb707f9f7f..2460cf9775c75 100644
> --- a/sound/soc/codecs/es8389.c
> +++ b/sound/soc/codecs/es8389.c

[ ... ]

> @@ -902,6 +904,18 @@ static int es8389_probe(struct snd_soc_component *component)
>  
>  	es8389->mclk_src = device_property_read_bool(component->dev, "everest,mclk-from-sclk");
>  
> +	ret = device_property_read_u8(component->dev, "everest,hpfl", &es8389->hpfl);

[Severity: Medium]
Devicetree is typically reserved for describing hardware topology, while
software-configurable tuning parameters like an ADC High Pass Filter are
usually exposed as ALSA kcontrols. Should these HPF values be registered as
mixer controls instead of devicetree properties so userspace can dynamically
adjust them at runtime?

[Severity: Medium]
Could using device_property_read_u8() here lead to a silent misconfiguration
if standard 32-bit devicetree cells are used?

If a devicetree specifies the property as a standard cell, for example:
    everest,hpfl = <10>;

The read_u8 function will read the first zero-padded byte (0x00) and return
success instead of an error. This means the fallback to ES8389_HPF_DEFAULT
will be bypassed, and the hardware will be configured with 0 instead. Would
it be safer to read this as a u32 using device_property_read_u32() and then
cast or bounds-check the result?

> +	if (ret != 0) {
> +		dev_dbg(component->dev, "hpfl return %d\n", ret);
> +		es8389->hpfl = ES8389_HPF_DEFAULT;
> +	}
> +
> +	ret = device_property_read_u8(component->dev, "everest,hpfr", &es8389->hpfr);
> +	if (ret != 0) {
> +		dev_dbg(component->dev, "hpfr return %d\n", ret);
> +		es8389->hpfr = ES8389_HPF_DEFAULT;
> +	}
> +

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260609071732.20939-1-zhangyi@everest-semi.com?part=5

  reply	other threads:[~2026-06-09  7:30 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-09  7:17 [PATCH 0/7] ASoC: codecs: ES8389: Modify the ES8389 driver Zhang Yi
2026-06-09  7:17 ` [PATCH 1/7] ASoC: codecs: ES8389: Modify volatile_register Zhang Yi
2026-06-09  7:32   ` sashiko-bot
2026-06-09  7:17 ` [PATCH 2/7] ASoC: codecs: ES8389: Fix the issue about mclk_src Zhang Yi
2026-06-09  7:36   ` sashiko-bot
2026-06-09  7:17 ` [PATCH 3/7] ASoC: codecs: ES8389: Modify the clock table Zhang Yi
2026-06-09  7:29   ` sashiko-bot
2026-06-09  7:17 ` [PATCH 4/7] ASoC: codecs: ES8389: Modify the initial configuration Zhang Yi
2026-06-09  7:26   ` sashiko-bot
2026-06-09  7:17 ` [PATCH 5/7] ASoC: codecs: ES8389: Add private members related to HPF Zhang Yi
2026-06-09  7:30   ` sashiko-bot [this message]
2026-06-09  7:17 ` [PATCH 6/7] ASoC: codecs: ES8389: Add INPUTL MUX and INPUTR MUX Zhang Yi
2026-06-09  7:17 ` [PATCH 7/7] ASoC: dt-bindings: ES8389: Add members about HPF and clock Zhang Yi
  -- strict thread matches above, loose matches on Subject: below --
2026-06-09  3:06 [PATCH 0/7] ASoC: codecs: ES8389: Modify the ES8389 driver Zhang Yi
2026-06-09  3:06 ` [PATCH 5/7] ASoC: codecs: ES8389: Add private members related to HPF Zhang Yi
2026-06-09  2:55 [PATCH 0/7] ASoC: codecs: ES8389: Modify the ES8389 driver Zhang Yi
2026-06-09  2:56 ` [PATCH 5/7] ASoC: codecs: ES8389: Add private members related to HPF Zhang Yi
2026-06-09  3:07   ` sashiko-bot

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=20260609073009.CFEB81F00893@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=zhangyi@everest-semi.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