All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Ravi Hothi" <ravi.hothi@oss.qualcomm.com>
Cc: linux-sound@vger.kernel.org, devicetree@vger.kernel.org,
	robh@kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH v3 2/2] ASoC: codecs: wcd9378: add non-SDCA (mobile) mode support
Date: Fri, 27 Nov 2026 14:29:42 +0000	[thread overview]
Message-ID: <sashiko-outbox-237561@kernel.org> (raw)
In-Reply-To: <20261127-b4-wcd9378-v3-v3-2-397e5ba2da55@oss.qualcomm.com>

Thank you for your contribution! Sashiko AI review found 13 potential
issues to consider:
- [High] ASoC: wcd9378: NULL slave_irq or regmap deref in
  wcd9378_interrupt_callback()
- [Medium] ASoC: wcd9378: broken rx_clk_cnt refcounting in
  wcd9378_rx_clk_enable()
- [Medium] ASoC: wcd9378: IRQ domain leak and devm mismatch in
  wcd9378_irq_init()
- [Medium] ASoC: wcd9378: per-port switch tracking in
  wcd9378_get/set_swr_port()
- [Medium] ASoC: wcd9378: unchecked txdev runtime PM resume in HPH DAPM
  events
- [Medium] ASoC: wcd9378: unhandled wcd9378_sys_usage_update() errors in
  DAPM
- [Medium] ASoC: wcd9378: stale MB_PULLUP_EN bit in
  wcd9378_micbias_control()
- [Medium] ASoC: wcd9378: codec probe runs in cache-only mode during
  synchronous bind
- [Medium] ASoC: wcd9378: stale Class-AB and compander bits on HPH mode
  switch
- [Low] ASoC: wcd9378: commit message claims unimplemented DMIC0-5
  capture support
- [Low] ASoC: wcd9378: unchecked regcache_sync() return in
  wcd9378_runtime_resume()
- [Low] ASoC: wcd9378: unsorted reg_defaults in wcd9378_defaults[]
  triggers warning
- [Low] ASoC: wcd9378: missing enum bounds check in
  wcd9378_rx_hph_mode_put()
--

commit 3efff0a28bcb4ca9fa2daba4e11c040c70206084
Author: Jorijn van der Graaf <jorijnvdgraaf@catcrafts.net>

ASoC: codecs: wcd9378: add non-SDCA (mobile) mode support

This commit adds ASoC codec support for the non-SDCA (mobile) fusing of
the Qualcomm WCD9378 SoundWire audio codec, dispatching between SDCA and
non-SDCA modes in the shared SoundWire slave driver.

> Capture covers ADC1-3 fed from AMIC1-4 plus DMIC0-5, with mic bias 1-3.

[Severity: Low]
This isn't a runtime bug, but the commit message claims capture covers
DMIC0-5, whereas wcd9378.c only implements controls, DAPM widgets, and
routes for ADC1-3 and AMIC1-4.

> diff --git a/sound/soc/codecs/wcd9378-sdw.c b/sound/soc/codecs/wcd9378-sdw.c
> index 52295e7646cf0..cb9a9fc15272c 100644
> --- a/sound/soc/codecs/wcd9378-sdw.c
> +++ b/sound/soc/codecs/wcd9378-sdw.c
[ ... ]
> +/*
> + * Handle a SoundWire out-of-band interrupt event by triggering the
> + * first irq of the slave_irq domain, which is then handled by the
> + * regmap_irq threaded irq.
> + */
> +static int wcd9378_interrupt_callback(struct sdw_slave *slave,
> +				      struct sdw_slave_intr_status *status)
> +{
> +	struct wcd9378_sdw_priv *wcd;
> +
> +	if (wcd9378_is_sdca(&slave->dev))
> +		return 0;
> +
> +	wcd = dev_get_drvdata(&slave->dev);
> +
> +	return wcd_interrupt_callback(slave, wcd->slave_irq,
> +				      WCD9378_SWRS_SCP_SDCA_INTSTAT_1,
> +				      WCD9378_SWRS_SCP_SDCA_INTSTAT_2,
> +				      WCD9378_SWRS_SCP_SDCA_INTSTAT_3);
> +}

[Severity: High]
Can wcd9378_interrupt_callback() dereference a NULL regmap or a NULL
wcd->slave_irq inside wcd_interrupt_callback()?

Both the TX and RX slaves unmask SDW_SCP_INT1_IMPL_DEF in
wcd9378_sdw_probe(), and wcd9378_soc_codec_probe() sets slave_irq on
both slaves.  However, only the TX slave initializes a regmap, so an
alert on the RX slave causes wcd_interrupt_callback() to pass a NULL
regmap from dev_get_regmap() to regmap_read().

In addition, wcd->slave_irq is not populated until the end of
wcd9378_soc_codec_probe() (and is not cleared in
wcd9378_soc_codec_remove()), while sdw_initialize_slave() unmasks
SDW_SCP_INT1_IMPL_DEF as soon as the slave attaches after
wcd9378_reset().  An alert arriving before wcd9378_soc_codec_probe()
sets wcd->slave_irq passes NULL to irq_find_mapping(slave_irq, 0) and
calls handle_nested_irq(0).

[ ... ]

> +static const struct reg_default wcd9378_defaults[] = {
> +	{ WCD9378_ANA_BIAS,			0x00 },
[ ... ]
> +	{ WCD9378_SMP_MIC_PDE11_REQ_PS(2),	0x03 },
> +	{ WCD9378_SMP_MIC_FUNC_ACT(2),		0x00 },
> +	/* All SDCA interrupts are disabled out of reset; regmap-irq owns these */
> +	{ WCD9378_SWRS_SCP_SDCA_INTMASK_1,	0x00 },
> +	{ WCD9378_SWRS_SCP_SDCA_INTMASK_2,	0x00 },
> +	{ WCD9378_SWRS_SCP_SDCA_INTMASK_3,	0x00 },
> +	{ WCD9378_SWRS_SCP_SDCA_INTRTYPE_1,	0x00 },
> +	{ WCD9378_SWRS_SCP_SDCA_INTRTYPE_2,	0x00 },
> +	{ WCD9378_SWRS_SCP_SDCA_INTRTYPE_3,	0x00 },
> +};

[Severity: Low]
Does placing the 0x5c..0xfc SCP registers at the end of
wcd9378_defaults[] after 0x41880008 trigger the "Unsorted reg_defaults"
warning in regcache_init() on every TX slave probe?

[ ... ]

> +static int wcd9378_runtime_resume(struct device *dev)
> +{
> +	struct wcd9378_sdw_priv *wcd;
> +
> +	if (wcd9378_is_sdca(dev))
> +		return wcd9378_sdca_runtime_resume(dev);
> +
> +	wcd = dev_get_drvdata(dev);
> +
> +	if (wcd->regmap) {
> +		regcache_cache_only(wcd->regmap, false);
> +		regcache_sync(wcd->regmap);
> +	}
> +
> +	return 0;
> +}

[Severity: Low]
Should wcd9378_runtime_resume() check the return value of
regcache_sync() and restore cache-only/dirty state on error, or at least
propagate the error instead of leaving the device runtime-active with an
unsynchronized register cache?

> diff --git a/sound/soc/codecs/wcd9378.c b/sound/soc/codecs/wcd9378.c
> new file mode 100644
> index 0000000000000..8a771a027127c
> --- /dev/null
> +++ b/sound/soc/codecs/wcd9378.c
[ ... ]
> +static int wcd9378_tx_sequencer_enable(struct snd_soc_dapm_widget *w,
> +				       struct snd_kcontrol *kcontrol,
> +				       int event)
> +{
> +	struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm);
> +	struct wcd9378_priv *wcd9378 = wcd9378_dev_priv(component->dev);
> +	const struct wcd9378_smp_fn *fn;
> +	int adc = w->shift;
> +	bool is_jack = false;
> +	int sys_bit, retries;
> +	u32 val;
> +
> +	switch (event) {
> +	case SND_SOC_DAPM_PRE_PMU:
> +		sys_bit = wcd9378_sys_usage_bit_get(component, adc, &is_jack);
> +		if (sys_bit < 0)
> +			return sys_bit;
> +
> +		/*
> +		 * Latch the profile bit and the target function: the input
> +		 * mux can be rewritten while the path is powered, and
> +		 * power-down must tear down what was actually powered up.
> +		 */
> +		wcd9378->tx_sys_bit[adc] = sys_bit;
> +		wcd9378->tx_is_jack[adc] = is_jack;
> +		if (is_jack)
> +			fn = &wcd9378_smp_jack_adc2;
> +		else
> +			fn = &wcd9378_smp_mic[adc];
> +
> +		if (wcd9378_sys_usage_update(component, sys_bit, true))
> +			return -EINVAL;

[Severity: Medium]
If wcd9378_sys_usage_update() fails here, does latching
wcd9378->tx_sys_bit[adc] beforehand cause SND_SOC_DAPM_POST_PMD to tear
down hardware registers and clear sys_bit in wcd9378->sys_usage_mask for
a sequencer that never powered up?

In wcd9378_hph_sequencer_enable() below, the return value of
wcd9378_sys_usage_update(component, WCD9378_SYS_USAGE_RX0_RX1_HPH, true)
is also ignored, so an incompatible profile combination continues
programming PDE47 and waits 40 ms in wcd9378_pde_act_ps_check() before
timing out.

[ ... ]

> +static int wcd9378_rx_clk_enable(struct snd_soc_component *component)
> +{
> +	struct wcd9378_priv *wcd9378 = wcd9378_dev_priv(component->dev);
> +
> +	if (atomic_read(&wcd9378->rx_clk_cnt))
> +		return 0;
> +
> +	snd_soc_component_update_bits(component,
> +				      WCD9378_ANA_RX_SUPPLIES, BIT(0), BIT(0));
> +	atomic_inc(&wcd9378->rx_clk_cnt);
> +
> +	return 0;
> +}
> +
> +static int wcd9378_rx_clk_disable(struct snd_soc_component *component)
> +{
> +	struct wcd9378_priv *wcd9378 = wcd9378_dev_priv(component->dev);
> +
> +	if (!atomic_read(&wcd9378->rx_clk_cnt)) {
> +		dev_err(component->dev, "clk already disabled\n");
> +		return 0;
> +	}
> +
> +	atomic_dec(&wcd9378->rx_clk_cnt);
> +	snd_soc_component_update_bits(component,
> +				      WCD9378_ANA_RX_SUPPLIES, BIT(0), 0x00);
> +
> +	return 0;
> +}

[Severity: Medium]
Does returning early in wcd9378_rx_clk_enable() when rx_clk_cnt is
non-zero keep rx_clk_cnt from ever exceeding 1?

When stereo playback powers up both RDAC1 and RDAC2, rx_clk_cnt stays at
1, and wcd9378_rx_clk_disable() unconditionally clears BIT(0) of
WCD9378_ANA_RX_SUPPLIES on the first disable call and logs "clk already
disabled" on the second.  Note also that wcd9378_rx_clk_enable() is
called from RDAC1 and RDAC2 (downstream of HPH SEQUENCER), while
wcd9378_rx_clk_disable() is called from RX1 and RX2 (upstream of HPH
SEQUENCER), so powering even a single RDAC powers both RX1 and RX2 and
calls wcd9378_rx_clk_disable() twice on teardown.

[ ... ]

> +static int wcd9378_hph_sequencer_enable(struct snd_soc_dapm_widget *w,
> +					struct snd_kcontrol *kcontrol,
> +					int event)
> +{
> +	struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm);
> +	struct wcd9378_priv *wcd9378 = wcd9378_dev_priv(component->dev);
> +	int hph_mode = wcd9378->hph_mode;
> +	int ret = 0;
> +
> +	switch (event) {
> +	case SND_SOC_DAPM_PRE_PMU:
[ ... ]
> +		if (!wcd9378->comp1_enable || !wcd9378->comp2_enable) {
> +			snd_soc_component_update_bits(component, WCD9378_HPH_UP_T7, 0x07, 0x07);
> +			snd_soc_component_update_bits(component, WCD9378_HPH_DN_T1, 0x07, 0x07);
> +		}
> +
> +		if (hph_mode == CLS_AB || hph_mode == CLS_AB_HIFI ||
> +		    hph_mode == CLS_AB_LP || hph_mode == CLS_AB_LOHIFI)
> +			snd_soc_component_update_bits(component, WCD9378_CP_CP_DTOP_CTRL_14,
> +						      BIT(7), BIT(7));

[Severity: Medium]
Are WCD9378_CP_CP_DTOP_CTRL_14 BIT(7), WCD9378_ANA_RX_SUPPLIES BIT(1)
(set in wcd9378_codec_enable_hphl_pa() and
wcd9378_codec_enable_hphr_pa()), and WCD9378_HPH_UP_T7 /
WCD9378_HPH_DN_T1 ever cleared when switching away from Class-AB or
enabling both companders?

Once playback runs in a Class-AB mode or with a compander disabled,
those bits stay set in hardware and the register cache on subsequent
Class-H or compander-enabled streams.

[ ... ]

> +static int wcd9378_codec_hphl_dac_event(struct snd_soc_dapm_widget *w,
> +					struct snd_kcontrol *kcontrol,
> +					int event)
> +{
> +	struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm);
> +	struct wcd9378_priv *wcd9378 = wcd9378_dev_priv(component->dev);
> +	int hph_mode = wcd9378->hph_mode;
> +
> +	switch (event) {
> +	case SND_SOC_DAPM_PRE_PMU:
> +		if (wcd9378->txdev)
> +			pm_runtime_resume_and_get(wcd9378->txdev);
[ ... ]
> +	case SND_SOC_DAPM_POST_PMD:
> +		snd_soc_component_update_bits(component,
> +					      WCD9378_HPH_RDAC_HD2_CTL_L,
> +					      0x0f, BIT(0));
> +		snd_soc_component_update_bits(component,
> +					      WCD9378_CDC_HPH_GAIN_CTL,
> +					      WCD9378_CDC_HPH_GAIN_CTL_HPHL_RX_EN, 0);
> +		if (wcd9378->txdev)
> +			pm_runtime_put_autosuspend(wcd9378->txdev);
> +		break;
> +	}
> +
> +	return 0;
> +}

[Severity: Medium]
If pm_runtime_resume_and_get(wcd9378->txdev) fails in
SND_SOC_DAPM_PRE_PMU, does the unconditional pm_runtime_put_autosuspend()
in SND_SOC_DAPM_POST_PMD drop the runtime PM reference held by
wcd9378_bind()?

wcd9378_codec_enable_hphl_pa() and wcd9378_codec_enable_hphr_pa() also
call pm_runtime_get_sync(wcd9378->txdev) without checking for failure
before writing registers.

[ ... ]

> +static int wcd9378_micbias_control(struct snd_soc_component *component,
> +				   int micb_num, int req)
> +{
> +	struct wcd9378_priv *wcd9378 = wcd9378_dev_priv(component->dev);
> +	int mb_index = micb_num - 1;
> +	u32 usage_reg;
> +	u8 usage_val;
> +	u8 pullup_bit;
> +
> +	if (micb_num < MIC_BIAS_1 || micb_num > MIC_BIAS_3)
> +		return -EINVAL;
> +
> +	usage_reg = wcd9378_smp_mic[mb_index].micb_reg;
> +	usage_val = wcd9378->micb_usage_val[mb_index];
> +	pullup_bit = BIT(mb_index);
> +
> +	mutex_lock(&wcd9378->micb_lock);
> +
> +	switch (req) {
> +	case MICB_ENABLE:
> +		wcd9378->micb_ref[mb_index]++;
> +		if (wcd9378->micb_ref[mb_index] == 1) {
> +			if (micb_num == MIC_BIAS_2) {
> +				snd_soc_component_update_bits(component,
> +							      WCD9378_ANA_MICB2_RAMP,
> +							      WCD9378_ANA_MICB2_RAMP_SHIFT_CTL_MASK,
> +							      0x0c);
> +				snd_soc_component_update_bits(component,
> +							      WCD9378_ANA_MICB2_RAMP,
> +							      WCD9378_ANA_MICB2_RAMP_EN, 0x00);
> +			}
> +			snd_soc_component_update_bits(component, usage_reg,
> +						      0xff, usage_val);
> +			if (micb_num == MIC_BIAS_2)
> +				snd_soc_component_update_bits(component,
> +							      WCD9378_SMP_JACK_IT31_MICB,
> +							      0xff, usage_val);
> +		}
> +		break;
> +	case MICB_DISABLE:
> +		if (wcd9378->micb_ref[mb_index] > 0)
> +			wcd9378->micb_ref[mb_index]--;
> +		if (wcd9378->micb_ref[mb_index] == 0 &&
> +		    wcd9378->pullup_ref[mb_index] > 0) {
> +			snd_soc_component_update_bits(component,
> +						      WCD9378_MB_PULLUP_EN,
> +						      pullup_bit, pullup_bit);
> +			snd_soc_component_update_bits(component, usage_reg, 0xff,
> +						      WCD9378_MICB_USAGE_1P8V_OR_PULLUP);
> +			if (micb_num == MIC_BIAS_2)
> +				snd_soc_component_update_bits(component,
> +							      WCD9378_SMP_JACK_IT31_MICB, 0xff,
> +							      WCD9378_MICB_USAGE_1P8V_OR_PULLUP);
> +		} else if (wcd9378->micb_ref[mb_index] == 0) {
> +			snd_soc_component_update_bits(component, usage_reg,
> +						      0xff, WCD9378_MICB_USAGE_OFF);

[Severity: Medium]
Does wcd9378_micbias_control() leave pullup_bit set in
WCD9378_MB_PULLUP_EN when MICB_ENABLE is requested while pull-up is
active, or when MICB_PULLUP_DISABLE runs while micb_ref > 0 and
MICB_DISABLE runs later?

MICB_ENABLE never clears pullup_bit in WCD9378_MB_PULLUP_EN (even though
MICB_DISABLE re-sets it when pullup_ref > 0), and the
`else if (wcd9378->micb_ref[mb_index] == 0)` branch in MICB_DISABLE
never clears pullup_bit if pullup_ref dropped to 0 while micb_ref was
still non-zero.

[ ... ]

> +static int wcd9378_get_swr_port(struct snd_kcontrol *kcontrol,
> +				struct snd_ctl_elem_value *ucontrol)
> +{
> +	struct soc_mixer_control *mixer = (struct soc_mixer_control *)kcontrol->private_value;
> +	struct snd_soc_component *comp = snd_kcontrol_chip(kcontrol);
> +	struct wcd9378_priv *wcd9378 = wcd9378_dev_priv(comp->dev);
> +	struct wcd9378_sdw_priv *wcd;
> +	int dai_id = mixer->shift;
> +	int ch_idx = mixer->reg;
> +	int portidx;
> +
> +	wcd = wcd9378->sdw_priv[dai_id];
> +	portidx = wcd->ch_info[ch_idx].port_num;
> +
> +	ucontrol->value.integer.value[0] = wcd->port_enable[portidx];
> +
> +	return 0;
> +}
> +
> +static int wcd9378_set_swr_port(struct snd_kcontrol *kcontrol,
> +				struct snd_ctl_elem_value *ucontrol)
> +{
> +	struct soc_mixer_control *mixer = (struct soc_mixer_control *)kcontrol->private_value;
> +	struct snd_soc_component *comp = snd_kcontrol_chip(kcontrol);
> +	struct wcd9378_priv *wcd9378 = wcd9378_dev_priv(comp->dev);
> +	struct wcd9378_sdw_priv *wcd;
> +	int dai_id = mixer->shift;
> +	int ch_idx = mixer->reg;
> +	int portidx;
> +	bool enable;
> +
> +	wcd = wcd9378->sdw_priv[dai_id];
> +	portidx = wcd->ch_info[ch_idx].port_num;
> +
> +	enable = ucontrol->value.integer.value[0];
> +
> +	if (enable == wcd->port_enable[portidx]) {
> +		wcd9378_connect_port(wcd, portidx, ch_idx, enable);
> +		return 0;
> +	}
> +
> +	wcd->port_enable[portidx] = enable;
> +	wcd9378_connect_port(wcd, portidx, ch_idx, enable);
> +
> +	return 1;
> +}

[Severity: Medium]
Does indexing wcd->port_enable[] by portidx instead of ch_idx cause
"HPHL Switch" and "HPHR Switch" to overwrite each other's state?

WCD9378_HPH_L and WCD9378_HPH_R both use WCD9378_HPH_PORT (port 1).
Enabling "HPHL Switch" sets wcd->port_enable[1] = true, so reading "HPHR
Switch" returns 1 even though BIT(1) is not set in port_config[0].ch_mask
(causing userspace tools that read before writing to skip enabling the
right channel), and disabling either switch causes the other to read back
as 0.  See commit e7860dc5d8d4 ("ASoC: codecs: wcd939x: Fix logic of get
and set swr port").

[ ... ]

> +static int wcd9378_rx_hph_mode_put(struct snd_kcontrol *kcontrol,
> +				   struct snd_ctl_elem_value *ucontrol)
> +{
> +	struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
> +	struct wcd9378_priv *wcd9378 = wcd9378_dev_priv(component->dev);
> +	u32 mode_val = ucontrol->value.enumerated.item[0];
> +
> +	if (mode_val == wcd9378->hph_mode)
> +		return 0;
> +
> +	wcd9378->hph_mode = mode_val;
> +
> +	return 1;
> +}

[Severity: Low]
Should wcd9378_rx_hph_mode_put() reject `mode_val >= e->items` with
-EINVAL, matching wcd9378_tx_mode_put() right above it?

[ ... ]

> +static int wcd9378_irq_init(struct wcd9378_priv *wcd9378, struct device *dev)
> +{
> +	struct regmap_irq_chip *chip_desc;
> +
> +	wcd9378->virq = irq_domain_create_linear(NULL, 1, &wcd9378_domain_ops, NULL);
> +	if (!wcd9378->virq) {
> +		dev_err(dev, "%s: Failed to add IRQ domain\n", __func__);
> +		return -EINVAL;
> +	}
> +
> +	/*
> +	 * regmap-irq keeps the descriptor by reference and passes
> +	 * irq_drv_data to handle_post_irq(), so take a per-instance
> +	 * copy and point it at this codec.
> +	 */
> +	chip_desc = devm_kmemdup(dev, &wcd9378_regmap_irq_chip,
> +				 sizeof(wcd9378_regmap_irq_chip), GFP_KERNEL);
> +	if (!chip_desc)
> +		return -ENOMEM;
> +
> +	chip_desc->irq_drv_data = wcd9378;
> +	wcd9378->chip_desc = chip_desc;
> +
> +	return devm_regmap_add_irq_chip(dev, wcd9378->regmap,
> +					irq_create_mapping(wcd9378->virq, 0),
> +					IRQF_ONESHOT, 0,
> +					wcd9378->chip_desc,
> +					&wcd9378->irq_chip);
> +}
[ ... ]
> +static int wcd9378_soc_codec_probe(struct snd_soc_component *component)
> +{
> +	struct wcd9378_priv *wcd9378 = wcd9378_dev_priv(component->dev);
> +	struct device *dev = component->dev;
> +	unsigned int part0 = 0, part1 = 0;
> +	int ret;
> +
> +	/*
> +	 * Flow up to this point: the TX probe reset the codec and added the
> +	 * component master, the RX probe registered its component, and the
> +	 * master's bind then registered this snd_soc component. io_init()
> +	 * below programs the analog core and must hit an enumerated codec
> +	 * with the bus clock indicated, so first wait out both slaves'
> +	 * post-reset (re-)enumeration; this codec probe is the earliest
> +	 * point where all of that holds.
> +	 */
> +	ret = sdw_slave_wait_for_init(wcd9378->tx_sdw_dev, 5000);
> +	if (ret)
> +		return ret;
> +
> +	ret = sdw_slave_wait_for_init(dev_to_sdw_dev(wcd9378->rxdev), 5000);
> +	if (ret)
> +		return ret;
> +
> +	snd_soc_component_init_regmap(component, wcd9378->regmap);
> +
> +	ret = pm_runtime_resume_and_get(dev);
> +	if (ret < 0)
> +		return ret;

[Severity: Medium]
Can wcd9378_soc_codec_probe() run while wcd9378->regmap is still in
cache-only mode?

If the RX slave has already probed and the sound card is waiting to
bind, component_master_add_with_match() in wcd9378_tx_master_probe()
synchronously calls wcd9378_bind() -> snd_soc_register_component() ->
wcd9378_soc_codec_probe() before wcd9378_sdw_probe() returns to
sdw_bus_probe(), where slave->probed is set to true.  While
wcd9378_soc_codec_probe() waits in sdw_slave_wait_for_init(),
sdw_handle_slave_status() skips wcd9378_update_status() because
slave->probed is still false, and then completes
slave->initialization_complete.  Because wcd9378_tx_master_probe()
already marked dev RPM_ACTIVE via devm_pm_runtime_set_active_enabled(),
pm_runtime_resume_and_get(dev) is a no-op and never invokes
wcd9378_runtime_resume(), leaving wcd9378->regmap cache-only during
wcd9378_io_init() and wcd9378_class_load().

> +
> +	regmap_read(wcd9378->regmap, WCD9378_DEV_PART_ID_0, &part0);
[ ... ]
> +	ret = wcd9378_irq_init(wcd9378, dev);
> +	if (ret) {
> +		dev_err(dev, "IRQ init failed: %d\n", ret);
> +		goto err_pm_put;
> +	}
[ ... ]
> +static void wcd9378_soc_codec_remove(struct snd_soc_component *component)
> +{
> +	struct wcd9378_priv *wcd9378 = wcd9378_dev_priv(component->dev);
> +
> +	free_irq(wcd9378->hphl_pdm_wd_int, wcd9378);
> +	free_irq(wcd9378->hphr_pdm_wd_int, wcd9378);
> +}

[Severity: Medium]
Does calling wcd9378_irq_init() from the ASoC component probe callback
leak wcd9378->virq and duplicate the devm_regmap_add_irq_chip()
registration across sound card probe deferral or card unbind/rebind?

wcd9378->virq is allocated with irq_domain_create_linear() and never
disposed or removed in wcd9378_soc_codec_remove() or on driver removal,
and devm_regmap_add_irq_chip() is tied to the TX slave device rather
than the ASoC component lifecycle.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261127-b4-wcd9378-v3-v3-0-397e5ba2da55@oss.qualcomm.com?part=2

  reply	other threads:[~2026-11-27 14:29 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-27 13:51 [PATCH v3 0/2] ASoC: codecs: wcd9378: add non-SDCA (mobile) mode support Ravi Hothi
2026-11-27 13:51 ` [PATCH v3 1/2] ASoC: dt-bindings: qcom,wcd9378-sdw: add non-SDCA (mobile) mode Ravi Hothi
2026-11-27 14:01   ` sashiko-bot
2026-11-27 13:51 ` [PATCH v3 2/2] ASoC: codecs: wcd9378: add non-SDCA (mobile) mode support Ravi Hothi
2026-11-27 14:29   ` sashiko-bot [this message]
2026-11-30 15:38   ` Mohammad Rafi Shaik

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-237561@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=ravi.hothi@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.