From: sashiko-bot@kernel.org
To: "Stephan Lensky" <linux@slensky.com>
Cc: linux-sound@vger.kernel.org
Subject: Re: [PATCH 3/4] ALSA: hda: Add MAX98390 side codec driver
Date: Wed, 02 Dec 2026 03:23:04 +0000 [thread overview]
Message-ID: <sashiko-outbox-244767@kernel.org> (raw)
In-Reply-To: <20261202031233.171555-4-linux@slensky.com>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] ALSA: hda/max98390: missing amp disable and state reset in
max98390_hda_unbind()
--
commit 932d4d95bd29cb7c6e758fa755dfe01e842d759c
Author: Stephan Lensky <linux@slensky.com>
ALSA: hda: Add MAX98390 side codec driver
This commit adds an HDA side codec driver for MAX98390 boosted class-D
amplifiers over I2C, binding to the HDA codec via the component framework
and applying default or firmware-loaded DSM speaker tuning.
Link: https://github.com/thesofproject/linux/pull/5616
> diff --git a/sound/hda/codecs/side-codecs/max98390_hda.c b/sound/hda/codecs/side-codecs/max98390_hda.c
> new file mode 100644
> index 0000000000000..15ae3c5a9a670
> --- /dev/null
> +++ b/sound/hda/codecs/side-codecs/max98390_hda.c
[ ... ]
> +static void max98390_hda_unbind(struct device *dev, struct device *master, void *master_data)
> +{
> + struct max98390_hda_priv *priv = dev_get_drvdata(dev);
> + struct hda_component_parent *parent = master_data;
> + struct hda_component *comp;
> +
> + comp = hda_component_from_index(parent, priv->index);
> + if (comp && comp->dev == dev)
> + memset(comp, 0, sizeof(*comp));
> +
> + guard(mutex)(&priv->lock);
> +
> + release_firmware(priv->dsm_fw);
> + priv->dsm_fw = NULL;
> +}
> +
> +static const struct component_ops max98390_hda_comp_ops = {
> + .bind = max98390_hda_bind,
> + .unbind = max98390_hda_unbind,
> +};
> +
> +int max98390_hda_probe(struct device *dev, int index, struct regmap *regmap)
> +{
> + struct max98390_hda_priv *priv;
> + unsigned int rev_id;
> + int ret;
> +
> + if (IS_ERR(regmap))
> + return dev_err_probe(dev, PTR_ERR(regmap), "Failed to allocate regmap\n");
> +
> + priv = devm_kzalloc_obj(dev, *priv);
> + if (!priv)
> + return -ENOMEM;
> +
> + ret = devm_mutex_init(dev, &priv->lock);
> + if (ret)
> + return ret;
> +
> + priv->dev = dev;
> + priv->regmap = regmap;
> + priv->index = index;
> + priv->channel = index % 2;
> + priv->is_tweeter = index >= MAX98390_HDA_NUM_AMPS / 2;
> + dev_set_drvdata(dev, priv);
> +
> + ret = regmap_read(regmap, MAX98390_R24FF_REV_ID, &rev_id);
> + if (ret)
> + return dev_err_probe(dev, ret, "Failed to read revision ID\n");
> +
> + dev_dbg(dev, "Revision ID 0x%02x\n", rev_id);
> +
> + return component_add(dev, &max98390_hda_comp_ops);
> +}
> +EXPORT_SYMBOL_NS_GPL(max98390_hda_probe, "SND_HDA_SCODEC_MAX98390");
> +
> +void max98390_hda_remove(struct device *dev)
> +{
> + struct max98390_hda_priv *priv = dev_get_drvdata(dev);
> +
> + component_del(dev, &max98390_hda_comp_ops);
> +
> + guard(mutex)(&priv->lock);
> +
> + if (priv->playback_started)
> + max98390_hda_set_amp_enable(priv, false);
> +}
[Severity: Medium]
Should max98390_hda_unbind() disable the amplifier and reset
priv->playback_started instead of doing it only in max98390_hda_remove()?
If any one amplifier or the HDA codec master is unbound while a playback
stream is open, component teardown runs max98390_hda_unbind() on all four
amplifiers and clears their playback hooks in comp. Only the single
device going through max98390_hda_remove() disables its amplifier; the
remaining unbound amplifiers miss HDA_GEN_PCM_ACT_CLOSE, stay enabled in
hardware, and retain a stale priv->playback_started = true that causes
max98390_hda_system_resume() to re-enable them even when no stream is
active.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261202031233.171555-1-linux@slensky.com?part=3
next prev parent reply other threads:[~2026-12-02 3:23 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-02 3:12 [PATCH 0/4] ALSA: hda: Add MAX98390 side codec support for Samsung Galaxy Book4 Pro 360 Stephan Lensky
2026-12-02 3:12 ` [PATCH 1/4] ASoC: max98390: Move register definitions to include/sound Stephan Lensky
2026-12-02 3:12 ` [PATCH 2/4] ACPI/platform: Add MAX98390 to serial-multi-instantiate Stephan Lensky
2026-12-02 3:12 ` [PATCH 3/4] ALSA: hda: Add MAX98390 side codec driver Stephan Lensky
2026-12-02 3:23 ` sashiko-bot [this message]
2026-12-02 3:12 ` [PATCH 4/4] ALSA: hda/realtek: Add MAX98390 fixup for Samsung Galaxy Book4 Pro 360 Stephan Lensky
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-244767@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=linux@slensky.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