public inbox for devicetree@vger.kernel.org
 help / color / mirror / Atom feed
From: Sen Wang <sen@ti.com>
To: Mark Brown <broonie@kernel.org>
Cc: <linux-sound@vger.kernel.org>, <lgirdwood@gmail.com>,
	<robh@kernel.org>, <krzk+dt@kernel.org>, <conor+dt@kernel.org>,
	<devicetree@vger.kernel.org>, <perex@perex.cz>, <tiwai@suse.com>,
	<shenghao-ding@ti.com>, <kevin-lu@ti.com>, <baojun.xu@ti.com>,
	<niranjan.hy@ti.com>, <l-badrinarayanan@ti.com>,
	<devarsht@ti.com>, <v-singh1@ti.com>,
	<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2 2/4] ASoC: codecs: Add TAS675x quad-channel audio amplifier driver
Date: Thu, 2 Apr 2026 20:16:31 -0500	[thread overview]
Message-ID: <fee4b641-c89f-45e3-a476-58d7728e2775@ti.com> (raw)
In-Reply-To: <3c300b9c-1589-492c-ace3-4d8a1d25f1ed@sirena.org.uk>

On 4/2/26 12:10, Mark Brown wrote:
> On Wed, Apr 01, 2026 at 05:28:43PM -0500, Sen Wang wrote:
>> The TAS675x (TAS6754, TAS67524) are quad-channel, digital-input
>> Class-D amplifiers with an integrated DSP, controlled over I2C.
>> They support I2S and TDM serial audio interfaces.
> 
> One issue that didn't get noticed last time, sorry:
> 

The more the merrier :)

>> +static int tas675x_runtime_suspend(struct device *dev)
>> +{
>> +	struct tas675x_priv *tas = dev_get_drvdata(dev);
>> +
>> +	cancel_delayed_work_sync(&tas->fault_check_work);
>> +	tas675x_set_state_all(tas, TAS675X_STATE_SLEEP_BOTH);
>> +
>> +	return 0;
>> +}
> 
> This cancels the work, completing any that's already running, but...
> 
>> +static void tas675x_fault_check_work(struct work_struct *work)
>> +{
>> +	struct tas675x_priv *tas = container_of(work, struct tas675x_priv,
>> +						fault_check_work.work);
>> +
>> +	if (tas675x_check_faults(tas))
>> +		regmap_write(tas->regmap, TAS675X_RESET_REG, TAS675X_FAULT_CLEAR);
>> +
>> +	schedule_delayed_work(&tas->fault_check_work,
>> +			      msecs_to_jiffies(TAS675X_FAULT_CHECK_INTERVAL_MS));
>> +}
> 
> ...the work unconditionally rearms itself so we might race and requeue
> (we cancel *then* wait) with the device powered off.  There's the
> disable_delayed_work_sync() API which should be a better fit.
> 

Right the APIs themselves aren't atomic, disable would be a much less 
error-prone approach. Looks like TAS5720 & TAS6424 has a similar issue 
too, where they have cancel work at DAPM events instead of runtime 
suspend. I can test and send these changes in a separate patch.

>> +static irqreturn_t tas675x_irq_handler(int irq, void *data)
>> +{
>> +	struct tas675x_priv *tas = data;
>> +
>> +	tas675x_check_faults(tas);
>> +
>> +	/* Clear the FAULT pin latch as something latched */
>> +	regmap_write(tas->regmap, TAS675X_RESET_REG, TAS675X_FAULT_CLEAR);
>> +
>> +	return IRQ_HANDLED;
>> +}
> 
> Also, this should return IRQ_NONE if no faults were seen (to allow for
> interrupt sharing and the genirq core's handling of hardware faults).

Understood, thank you for the context, didn't know IRQ_NONE provides 
additional heuristics to irq core. Will post a follow-up V3 addressing 
the issues.

Best,
Sen Wang

  reply	other threads:[~2026-04-03  1:16 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <message-id-of-your-RFC-cover-letter>
2026-04-01 22:28 ` [PATCH v2 0/4] ASoC: Add TAS675x quad-channel Class-D amplifier driver Sen Wang
2026-04-01 22:28   ` [PATCH v2 1/4] dt-bindings: sound: Add ti,tas675x Sen Wang
2026-04-02  7:53     ` Krzysztof Kozlowski
2026-04-03  0:40       ` Sen Wang
2026-04-03  7:19         ` Krzysztof Kozlowski
2026-04-04  3:40           ` Sen Wang
2026-04-04  5:20             ` Krzysztof Kozlowski
2026-04-01 22:28   ` [PATCH v2 2/4] ASoC: codecs: Add TAS675x quad-channel audio amplifier driver Sen Wang
2026-04-02  7:54     ` Krzysztof Kozlowski
2026-04-02 17:10     ` Mark Brown
2026-04-03  1:16       ` Sen Wang [this message]
2026-04-01 22:28   ` [PATCH v2 3/4] Documentation: sound: Add TAS675x codec mixer controls documentation Sen Wang
2026-04-01 22:28   ` [PATCH v2 4/4] MAINTAINERS: add entry for TAS675x audio amplifier Sen Wang

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=fee4b641-c89f-45e3-a476-58d7728e2775@ti.com \
    --to=sen@ti.com \
    --cc=baojun.xu@ti.com \
    --cc=broonie@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devarsht@ti.com \
    --cc=devicetree@vger.kernel.org \
    --cc=kevin-lu@ti.com \
    --cc=krzk+dt@kernel.org \
    --cc=l-badrinarayanan@ti.com \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=niranjan.hy@ti.com \
    --cc=perex@perex.cz \
    --cc=robh@kernel.org \
    --cc=shenghao-ding@ti.com \
    --cc=tiwai@suse.com \
    --cc=v-singh1@ti.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