Skip to contentSkip to conversation

ASoC: codecs: add support for TAS5720 digital amplifier

PATCH Superseded Andreas Dannenberg 3 participants 9 messages Mar 21, 2016 – Apr 2, 2016

Subsystems (3)

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

v2 cover ASoC: codecs: add support for TAS5720 digital amplifier

Driver for TI's TAS5720L/M digital audio amplifiers. The driver should be pretty standard except the optional interrupt-based fault reporting.

Some background on the fault reporting since that might be a discussion of interest. The code should have that documented rather well but I wanted to bring it up right away. The TAS5720 devices can report conditions such as over-current (short), over temp, and others that can be important to know in a real-world system. However the device lacks a way to mask the generation of fault interrupts except by shutting it down, which can lead to cases where the device generates SAIF-fault host interrupts every 300us! This is clearly a lot of overhead to be thrown at the SoC (and my bench testing has demonstrated that) so after trying different things to tame this behavior I ended up implementing method to disable/enable the interrupts in the driver itself in combination with rate-limiting the processing of those events. The fact of processing interrupts in a threaded fashion (IRQF_ONESHOT) alone was not enough under certain conditions to prevent the SoC from not being able to get to all interrupts even with an empty threaded handler, and it would freeze and eventually the Kernel would disable the interrupt ("no one cared").

The scheme currently implemented seems to work reliably cycling different audio files over hours also forcing error conditions. But if anybody has a "cleaner" idea how to rate-limit IRQs on a very low level (currently done in the IRQ handler function) I'm absolutely open to suggestions. This all may not be an issue at all when using a faster/lower-latency SoC than what I'm using (BeagleBone Black) but the fact that IRQF_ONESHOT alone was not enough to prevent the system to be brought to its knees (again, even with an empty threaded handler) was a bit of a surprise to me.

#1 lore raw

PATCH v2 1/2 ASoC: codecs: add TA5720 digital amplifier DT bindings

The Texas Instruments TAS5720L/M device is a high-efficiency mono Class-D audio power amplifier optimized for high transient power capability to use the dynamic power headroom of small loudspeakers. Its digital time division multiplexed (TDM) interface enables up to 16 devices to share the same bus.

---
 .../devicetree/bindings/sound/tas5720.txt          | 37 ++++++++++++++++++++++
 1 file changed, 37 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/sound/tas5720.txt
Documentation/devicetree/bindings/sound/tas5720.txt new file +37 -0
new file mode 100644
index 0000000..276b258
@@ -0,0 +1,37 @@
+Texas Instruments TAS5720 Mono Audio amplifier
+
+The TAS5720 serial control bus communicates through the I2C protocol only.
+
+Required properties:
+
+- compatible : "ti,tas5720"
+- reg : I2C slave address
+
+Optional properties:
+
+- dvdd-supply : phandle to a 3.3-V supply for the digital circuitry
+- pvdd-supply : phandle to a supply used for the Class-D amp and the analog
+- interrupts  : reference to a GPIO pin connected to the TAS5720 FAULTZ pin for
+                error reporting purposes
+
+Note that in case of codec errors the driver relies on the TAS5720 datasheet-
+proposed "Auto Recovery Circuit" (connection between the FAULTZ and SDZ device
+pins) for continued operation. This connection should always be made independent
+of whether the optional interrupt-based fault-reporting feature is used.
+
+For more product information please see the links below:
+
+http://www.ti.com/product/TAS5720L
+http://www.ti.com/product/TAS5720M
+
+Example:
+
+tas5720: tas5720@6c {
+	status = "okay";
+	compatible = "ti,tas5720";
+	reg = <0x6c>;
+
+	pinctrl-names = "default";
+	pinctrl-0 = <&tas572x_int_pin>;
+	interrupts-extended = <&gpio1 28 IRQ_TYPE_EDGE_FALLING>;
+};
Signature · 1 line
2.6.4
maintainer Acked-by on v2 1/2
#2 lore raw

Re: [PATCH v2 1/2] ASoC: codecs: add TA5720 digital amplifier DT bindings

Quoted 11 lines · Andreas Dannenberg

The Texas Instruments TAS5720L/M device is a high-efficiency mono Class-D audio power amplifier optimized for high transient power capability to use the dynamic power headroom of small loudspeakers. Its digital time division multiplexed (TDM) interface enables up to 16 devices to share the same bus.

---
 .../devicetree/bindings/sound/tas5720.txt          | 37 ++++++++++++++++++++++
 1 file changed, 37 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/sound/tas5720.txt

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#3 lore raw

PATCH v2 2/2 ASoC: codecs: add support for TAS5720 digital amplifier

In reply to Andreas Dannenberg

The Texas Instruments TAS5720L/M device is a high-efficiency mono Class-D audio power amplifier optimized for high transient power capability to use the dynamic power headroom of small loudspeakers. Its digital time division multiplexed (TDM) interface enables up to 16 devices to share the same bus.

---
 sound/soc/codecs/Kconfig   |  10 +
 sound/soc/codecs/Makefile  |   2 +
 sound/soc/codecs/tas5720.c | 734 +++++++++++++++++++++++++++++++++++++++++++++
 sound/soc/codecs/tas5720.h |  90 ++++++
 4 files changed, 836 insertions(+)
 create mode 100644 sound/soc/codecs/tas5720.c
 create mode 100644 sound/soc/codecs/tas5720.h
sound/soc/codecs/Kconfig +10 -0
index 7ef3a0c..a0bb8cb 100644
@@ -124,6 +124,7 @@ config SND_SOC_ALL_CODECS
 	select SND_SOC_TAS2552 if I2C
 	select SND_SOC_TAS5086 if I2C
 	select SND_SOC_TAS571X if I2C
+	select SND_SOC_TAS5720 if I2C
 	select SND_SOC_TFA9879 if I2C
 	select SND_SOC_TLV320AIC23_I2C if I2C
 	select SND_SOC_TLV320AIC23_SPI if SPI_MASTER
@@ -741,6 +742,15 @@ config SND_SOC_TAS571X
 	tristate "Texas Instruments TAS5711/TAS5717/TAS5719 power amplifiers"
 	depends on I2C
 
+config SND_SOC_TAS5720
+	tristate "Texas Instruments TAS5720 Mono Audio amplifier"
+	depends on I2C
+	help
+	  Enable support for Texas Instruments TAS5720L/M high-efficiency mono
+	  Class-D audio power amplifiers. The devices use an I2C interface for
+	  setup/control and support an optional GPIO interrupt signal for fault
+	  reporting.
+
 config SND_SOC_TFA9879
 	tristate "NXP Semiconductors TFA9879 amplifier"
 	depends on I2C
sound/soc/codecs/Makefile +2 -0
index 185a712..83d352e 100644
@@ -129,6 +129,7 @@ snd-soc-stac9766-objs := stac9766.o
 snd-soc-sti-sas-objs := sti-sas.o
 snd-soc-tas5086-objs := tas5086.o
 snd-soc-tas571x-objs := tas571x.o
+snd-soc-tas5720-objs := tas5720.o
 snd-soc-tfa9879-objs := tfa9879.o
 snd-soc-tlv320aic23-objs := tlv320aic23.o
 snd-soc-tlv320aic23-i2c-objs := tlv320aic23-i2c.o
@@ -335,6 +336,7 @@ obj-$(CONFIG_SND_SOC_STI_SAS)	+= snd-soc-sti-sas.o
 obj-$(CONFIG_SND_SOC_TAS2552)	+= snd-soc-tas2552.o
 obj-$(CONFIG_SND_SOC_TAS5086)	+= snd-soc-tas5086.o
 obj-$(CONFIG_SND_SOC_TAS571X)	+= snd-soc-tas571x.o
+obj-$(CONFIG_SND_SOC_TAS5720)	+= snd-soc-tas5720.o
 obj-$(CONFIG_SND_SOC_TFA9879)	+= snd-soc-tfa9879.o
 obj-$(CONFIG_SND_SOC_TLV320AIC23)	+= snd-soc-tlv320aic23.o
 obj-$(CONFIG_SND_SOC_TLV320AIC23_I2C)	+= snd-soc-tlv320aic23-i2c.o
sound/soc/codecs/tas5720.c new file +734 -0

734 lines not on this page · raw message

sound/soc/codecs/tas5720.h new file +90 -0

90 lines not on this page · raw message

Signature · 1 line
2.6.4
maintainer
#4 lore raw

sound/soc/codecs/tas5720.c line 168

Quoted 12 lines · Andreas Dannenberg
sound/soc/codecs/tas5720.c new file +12 -0
+static int tas5720_set_dai_sysclk(struct snd_soc_dai *dai, int clk_id,
+				  unsigned int freq, int dir)
+{
+	/*
+	 * Nothing to configure here for TAS5720. It's a simple codec slave.
+	 * However we need to keep this function in here otherwise the ASoC
+	 * platform driver will throw an ENOTSUPP at us when trying to play
+	 * audio.
+	 */
+
+	return 0;
+}

Remove empty funnctions, -ENOTSUPP is expected behaviour for anything that isn't explicitly supported by a driver.

sound/soc/codecs/tas5720.c line 178

Quoted 1 line
sound/soc/codecs/tas5720.c new file +1 -0
+	if (unlikely(!tx_mask)) {

unlikely() is for optimising hot paths, just write the logic clearly unless there's a reason for it.

Quoted 8 lines
sound/soc/codecs/tas5720.c new file +8 -0
+static irqreturn_t tas5720_irq_handler(int irq, void *_dev)
+{
+	/*
+	 * Immediately disable TAS5720 FAULTZ interrupts inside the low-level
+	 * handler to prevent the system getting saturated or even overrun
+	 * by interrupt requests. Normally the fact that we create a threaded
+	 * interrupt with IRQF_ONESHOT should take care of this as by design
+	 * it masks interrupts while the thread is processed however testing

sound/soc/codecs/tas5720.c line 247

Quoted 10 lines
sound/soc/codecs/tas5720.c new file +10 -0
+	 * has shown that at the high frequency the FAULTZ signal triggers
+	 * (every 300us!) occasionally the system would lock up even with a
+	 * threaded handler that's completely empty until the Kernel breaks the
+	 * cycle, disables that interrupt, and reports a "nobody cared" error.
+	 *
+	 * Disabling the interrupt here combined with a deferred re-enabling
+	 * after the thread has run not only prevents this lock condition but
+	 * also helps to rate-limit the processing of FAULTZ interrupts.
+	 */
+	disable_irq_nosync(irq);

No, this is completely broken. Whatever is going on in your system with the interrupt core you need to address that at the appropriate level not by putting a nonsensical bodge in here. The interrupt is disabled while the threaded handler is running, if that's not having the desired effect then whatever causes that needs to be fixed.

Quoted 4 lines
sound/soc/codecs/tas5720.c new file +4 -0
+static int tas5720_dapm_post_event(struct snd_soc_dapm_widget *w,
+				   struct snd_kcontrol *kcontrol, int event)
+{
+	struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);

sound/soc/codecs/tas5720.c line 433

Quoted 10 lines
sound/soc/codecs/tas5720.c new file +10 -0
+	int ret;
+
+	switch (event) {
+	case SND_SOC_DAPM_POST_PMU:
+		/*
+		 * Check if the codec is still powered up in which case exit
+		 * right away also skipping the shutdown-to-active wait time.
+		 */
+		ret = snd_soc_test_bits(codec, TAS5720_POWER_CTRL_REG,
+					TAS5720_SDZ, 0);

I don't understand this. Why on earth would we be calling the PMU handler if the widget was not previously powered?

sound/soc/codecs/tas5720.c line 450

Quoted 10 lines
sound/soc/codecs/tas5720.c new file +10 -0
+		/*
+		 * Take TAS5720 out of shutdown mode in preparation for widget
+		 * power up.
+		 */
+		ret = snd_soc_update_bits(codec, TAS5720_POWER_CTRL_REG,
+					  TAS5720_SDZ, TAS5720_SDZ);
+		if (ret < 0) {
+			dev_err(codec->dev, "error waking codec: %d\n", ret);
+			return ret;
+		}

This is a _POST_PMU handler not a pre-PMU handler...

sound/soc/codecs/tas5720.c line 589

Quoted 3 lines
sound/soc/codecs/tas5720.c new file +3 -0
+	/* Events used to control the TAS5720 SHUTDOWN state */
+	SND_SOC_DAPM_PRE("Pre Event", tas5720_dapm_pre_event),
+	SND_SOC_DAPM_POST("Post Event", tas5720_dapm_post_event),

Oh, we're using _PRE() and _POST() events... this almost certainly indicates a problem, there are very few circumstances where these are a good idea and I'm not seeing anything in this driver which indicates that this is going on. Please just use normal DAPM widgets (I'm guessing a PGA) to represent the device and work within DAPM, don't shoehorn some bodge around the side.

#5 lore raw

Hi Mark,
thanks for taking time reviewing the driver. Some comments below...

Quoted 17 lines · Mark Brown

sound/soc/codecs/tas5720.c line 168

Quoted 12 lines · Andreas Dannenberg
sound/soc/codecs/tas5720.c new file +12 -0
+static int tas5720_set_dai_sysclk(struct snd_soc_dai *dai, int clk_id,
+				  unsigned int freq, int dir)
+{
+	/*
+	 * Nothing to configure here for TAS5720. It's a simple codec slave.
+	 * However we need to keep this function in here otherwise the ASoC
+	 * platform driver will throw an ENOTSUPP at us when trying to play
+	 * audio.
+	 */
+
+	return 0;
+}

Remove empty funnctions, -ENOTSUPP is expected behaviour for anything that isn't explicitly supported by a driver.

Ok will double-check. Very early during my driver development I was not able to play audio through aplay if this function was not provided. I don't recall what specific Kernel version that was but it may have been something like 4.1.

Quoted 5 lines

sound/soc/codecs/tas5720.c line 178

Quoted 2 lines
sound/soc/codecs/tas5720.c new file +1 -0
+	if (unlikely(!tx_mask)) {

unlikely() is for optimising hot paths, just write the logic clearly unless there's a reason for it.

Got it. This was plagiarized from a similar driver but I agree this is not a performance critical loop or something.

Quoted 16 lines
Quoted 16 lines
sound/soc/codecs/tas5720.c new file +16 -0
+static irqreturn_t tas5720_irq_handler(int irq, void *_dev)
+{
+	/*
+	 * Immediately disable TAS5720 FAULTZ interrupts inside the low-level
+	 * handler to prevent the system getting saturated or even overrun
+	 * by interrupt requests. Normally the fact that we create a threaded
+	 * interrupt with IRQF_ONESHOT should take care of this as by design
+	 * it masks interrupts while the thread is processed however testing
+	 * has shown that at the high frequency the FAULTZ signal triggers
+	 * (every 300us!) occasionally the system would lock up even with a
+	 * threaded handler that's completely empty until the Kernel breaks the
+	 * cycle, disables that interrupt, and reports a "nobody cared" error.
+	 *
+	 * Disabling the interrupt here combined with a deferred re-enabling
+	 * after the thread has run not only prevents this lock condition but
+	 * also helps to rate-limit the processing of FAULTZ interrupts.
Quoted 8 lines

Review

Quoted 2 lines
(quoted diff) +2 -0
+	 */
+	disable_irq_nosync(irq);

No, this is completely broken. Whatever is going on in your system with the interrupt core you need to address that at the appropriate level not by putting a nonsensical bodge in here. The interrupt is disabled while the threaded handler is running, if that's not having the desired effect then whatever causes that needs to be fixed.

Good feedback, I needed some outside guidance here. Definitely will dig into this again but I'll be on vacation for a bit starting tomorrow so I won't get to it right away.

As explained in the code comment even with a boiled-down test code that has an empty threaded handler the system would come to a grinding halt when bombarded with interrupts every 300us which I found odd but not completely unexpected (from my MCU background POV that is). And while digging I had seen that the interrupts do get disabled just like you mention during threaded handling to operate in a more graceful manner. But I wasn't sure at this point if the additional (high priority, I suppose) overhead of creating/starting the thread (even an empty one) every 300us was just too much for my poor single-core SoC to handle so my assumption was that it never got cycles to process stuff other than interrupts, and disabling interrupts in the low-level handler fixed just that. But I'm going to spend some extra cycles trying to re-digest the realtime behavior of my particular SoC/setup to understand why exactly this is happening.

Quoted 32 lines
Quoted 5 lines
sound/soc/codecs/tas5720.c new file +4 -0
+static int tas5720_dapm_post_event(struct snd_soc_dapm_widget *w,
+				   struct snd_kcontrol *kcontrol, int event)
+{
+	struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);

sound/soc/codecs/tas5720.c line 433

Quoted 10 lines
sound/soc/codecs/tas5720.c new file +10 -0
+	int ret;
+
+	switch (event) {
+	case SND_SOC_DAPM_POST_PMU:
+		/*
+		 * Check if the codec is still powered up in which case exit
+		 * right away also skipping the shutdown-to-active wait time.
+		 */
+		ret = snd_soc_test_bits(codec, TAS5720_POWER_CTRL_REG,
+					TAS5720_SDZ, 0);

I don't understand this. Why on earth would we be calling the PMU handler if the widget was not previously powered?

sound/soc/codecs/tas5720.c line 450

Quoted 10 lines
sound/soc/codecs/tas5720.c new file +10 -0
+		/*
+		 * Take TAS5720 out of shutdown mode in preparation for widget
+		 * power up.
+		 */
+		ret = snd_soc_update_bits(codec, TAS5720_POWER_CTRL_REG,
+					  TAS5720_SDZ, TAS5720_SDZ);
+		if (ret < 0) {
+			dev_err(codec->dev, "error waking codec: %d\n", ret);
+			return ret;
+		}

This is a _POST_PMU handler not a pre-PMU handler...

Quoted 10 lines

sound/soc/codecs/tas5720.c line 589

Quoted 3 lines
sound/soc/codecs/tas5720.c new file +3 -0
+	/* Events used to control the TAS5720 SHUTDOWN state */
+	SND_SOC_DAPM_PRE("Pre Event", tas5720_dapm_pre_event),
+	SND_SOC_DAPM_POST("Post Event", tas5720_dapm_post_event),

Oh, we're using _PRE() and _POST() events... this almost certainly indicates a problem, there are very few circumstances where these are a good idea and I'm not seeing anything in this driver which indicates that this is going on. Please just use normal DAPM widgets (I'm guessing a PGA) to represent the device and work within DAPM, don't shoehorn some bodge around the side.

I'm currently using these handlers to essentially tame the TAS5720 error reporting. Only when the device is in shutdown mode it will seize bombarding the host with 300us-spaced FAULT interrupts (that will come as soon as the SAIF stream stops). Unfortunately that's the way the TAS5720 was designed and I've already provided feedback internally that this makes an elegant / low-overhead SW implementation quite challenging. Anyways I did see several places where this shutdown mode handling could get added so I simply picked the one that was not directly associated with the audio stream itself to make it more explicit what this is about but this can certainly be changed.

Regards,

--
Andreas Dannenberg
Texas Instruments Inc

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

maintainer
#6 lore raw
Quoted 10 lines · Andreas Dannenberg
Quoted 4 lines · Mark Brown

On Mon, Mar 21, 2016 at 12:08:27PM -0500, Andreas Dannenberg wrote:

Remove empty funnctions, -ENOTSUPP is expected behaviour for anything that isn't explicitly supported by a driver.

Ok will double-check. Very early during my driver development I was not able to play audio through aplay if this function was not provided. I don't recall what specific Kernel version that was but it may have been something like 4.1.

This would be a bug in your machine driver then.

Quoted 6 lines

As explained in the code comment even with a boiled-down test code that has an empty threaded handler the system would come to a grinding halt when bombarded with interrupts every 300us which I found odd but not completely unexpected (from my MCU background POV that is). And while digging I had seen that the interrupts do get disabled just like you mention during threaded handling to operate in a more graceful manner.

Quoted 8 lines

But I wasn't sure at this point if the additional (high priority, I suppose) overhead of creating/starting the thread (even an empty one) every 300us was just too much for my poor single-core SoC to handle so my assumption was that it never got cycles to process stuff other than interrupts, and disabling interrupts in the low-level handler fixed just that. But I'm going to spend some extra cycles trying to re-digest the realtime behavior of my particular SoC/setup to understand why exactly this is happening.

If your device is constantly retriggering the same interrupt that suggests there is a problem with how you are handling your device, perhaps you need to disable the interrupts at source if it's truly broken beyond repair.

Quoted 7 lines
Quoted 6 lines

Oh, we're using _PRE() and _POST() events... this almost certainly indicates a problem, there are very few circumstances where these are a good idea and I'm not seeing anything in this driver which indicates that this is going on. Please just use normal DAPM widgets (I'm guessing a PGA) to represent the device and work within DAPM, don't shoehorn some bodge around the side.

Quoted 10 lines

I'm currently using these handlers to essentially tame the TAS5720 error reporting. Only when the device is in shutdown mode it will seize bombarding the host with 300us-spaced FAULT interrupts (that will come as soon as the SAIF stream stops). Unfortunately that's the way the TAS5720 was designed and I've already provided feedback internally that this makes an elegant / low-overhead SW implementation quite challenging. Anyways I did see several places where this shutdown mode handling could get added so I simply picked the one that was not directly associated with the audio stream itself to make it more explicit what this is about but this can certainly be changed.

It sounds like this feature is unusably broken... possibly you could do something in the mute handler but it seems that anything you try to do to use this feature is going to be both fragile and disruptive to the system. What is the value in implementing it?

#7 lore raw

Hi Mark,
thanks for the continued feedback - please see below.

Quoted 7 lines · Mark Brown
Quoted 5 lines · Andreas Dannenberg
Quoted 4 lines · Mark Brown

On Mon, Mar 21, 2016 at 12:08:27PM -0500, Andreas Dannenberg wrote:

Remove empty funnctions, -ENOTSUPP is expected behaviour for anything that isn't explicitly supported by a driver.

Quoted 6 lines
Quoted 4 lines

Ok will double-check. Very early during my driver development I was not able to play audio through aplay if this function was not provided. I don't recall what specific Kernel version that was but it may have been something like 4.1.

This would be a bug in your machine driver then.

Will look at this again in context of later Kernel versions and make sure we'll get this fixed as needed.

Quoted 15 lines
Quoted 6 lines

As explained in the code comment even with a boiled-down test code that has an empty threaded handler the system would come to a grinding halt when bombarded with interrupts every 300us which I found odd but not completely unexpected (from my MCU background POV that is). And while digging I had seen that the interrupts do get disabled just like you mention during threaded handling to operate in a more graceful manner.

Quoted 8 lines

But I wasn't sure at this point if the additional (high priority, I suppose) overhead of creating/starting the thread (even an empty one) every 300us was just too much for my poor single-core SoC to handle so my assumption was that it never got cycles to process stuff other than interrupts, and disabling interrupts in the low-level handler fixed just that. But I'm going to spend some extra cycles trying to re-digest the realtime behavior of my particular SoC/setup to understand why exactly this is happening.

Quoted 4 lines

If your device is constantly retriggering the same interrupt that suggests there is a problem with how you are handling your device, perhaps you need to disable the interrupts at source if it's truly broken beyond repair.

The only way to prevent the device from throwing those crazy 300us-spaced SAIF errors would be by (1) providing an always-on SAIF audio stream (not really a solution...), or (2) by keeping it in SHUTDOWN most of the time (while not actively playing audio) which is what I attempted.

Quoted 12 lines
Quoted 11 lines

I'm currently using these handlers to essentially tame the TAS5720 error reporting. Only when the device is in shutdown mode it will seize bombarding the host with 300us-spaced FAULT interrupts (that will come as soon as the SAIF stream stops). Unfortunately that's the way the TAS5720 was designed and I've already provided feedback internally that this makes an elegant / low-overhead SW implementation quite challenging. Anyways I did see several places where this shutdown mode handling could get added so I simply picked the one that was not directly
associated with the audio stream itself to make it more explicit what this is about but this can certainly be changed.

Quoted 4 lines

It sounds like this feature is unusably broken... possibly you could do something in the mute handler but it seems that anything you try to do to use this feature is going to be both fragile and disruptive to the system.

Agreed, this is not the first time this has come up :( Btw in my quest for a solution one of my earlier implementations actually hooked into the MUTE handler, but while this worked keeping the TA5720 in shutdown most of the time it did not completely solve the interrupt-overrun issue (the TAS5720 would still generate SAIF errors for brief periods, dead-locking my SoC even with an empty threaded handler). I was also concerned that hooking such parasitic code into a MUTE handler would be a bit of an abuse and not make me may friends here.

Quoted 1 line

What is the value in implementing it?

There is a strong request from one rather large customer to have interrupt-driven fault handling. I did have an early implementation of the driver that polled for errors (except SAIF) at the beginning and the end of the audio playback but this was not good enough.

But thinking about this some more, what if I do not actually use the interrupt signal, but rather during playback use a timer that fires every let's say 1s to check the TAS5720 fault register? This way one would still get critical error reporting _during_ the playback (which is likely the reason for the customer requirement) of longer audio files, and while not immediate, this should still give a good enough response time as the errors being reported (over current, over temp, ...) would be latched and their detection involves some time constants as well. Any comments/concerns with such an approach?

Thanks,

--
Andreas Dannenberg
Texas Instruments Inc

maintainer
#8 lore raw
Quoted 7 lines · Andreas Dannenberg
Quoted 4 lines · Mark Brown

It sounds like this feature is unusably broken... possibly you could do something in the mute handler but it seems that anything you try to do to use this feature is going to be both fragile and disruptive to the system.

Quoted 8 lines

Agreed, this is not the first time this has come up :( Btw in my quest for a solution one of my earlier implementations actually hooked into the MUTE handler, but while this worked keeping the TA5720 in shutdown most of the time it did not completely solve the interrupt-overrun issue (the TAS5720 would still generate SAIF errors for brief periods, dead-locking my SoC even with an empty threaded handler). I was also concerned that hooking such parasitic code into a MUTE handler would be a bit of an abuse and not make me may friends here.

I think this feature is so broken that any attempt to use it is going to cause problems. Even if you somehow manage to make something that holds together in your test system I'm not convinced it's going to be safe for other users.

Quoted 6 lines
Quoted 1 line

What is the value in implementing it?

There is a strong request from one rather large customer to have interrupt-driven fault handling. I did have an early implementation of the driver that polled for errors (except SAIF) at the beginning and the end of the audio playback but this was not good enough.

I really think this is something that the user needs to carry out of tree, it seems clear that that enbling interrupts is very disruptive.

Quoted 3 lines

But thinking about this some more, what if I do not actually use the interrupt signal, but rather during playback use a timer that fires every let's say 1s to check the TAS5720 fault register? This way one

That's fine, some other drivers do this for things that don't have interrupts or don't have usable interrupts.