ASoC/HDA cs35l56: Remove redundant IRQ handling
Subsystems (3)
PATCH 1/1 ASoC/HDA cs35l56: Remove redundant IRQ handling
The IRQ handling in the cs35l56 driver was purely informational. It was not necessary to support the HDA or ASoC driver functionality and added unnecessary complexity to the drivers.
As the IRQ signal GPIO line could be connected and shared with other components the handling is replaced with a regmap patch to ensure the cs35l56 IRQ sources are masked and will not generate interrupts that go unhandled.
---
v1 - As this changes both the ASoC and HDA cs35l56 device drivers we
considered a series of patches that stepped through the removal of the common code but thought that the co-ordination would be unnecessarily complicated so we initially offer a combined patch that that applies to both Mark and Takashi's for-next branches so that either route can be taken.
include/sound/cs35l56.h | 4 -- sound/pci/hda/cs35l56_hda.c | 53 +-------------- sound/pci/hda/cs35l56_hda_i2c.c | 9 +-- sound/pci/hda/cs35l56_hda_spi.c | 9 +-- sound/soc/codecs/cs35l56-i2c.c | 2 - sound/soc/codecs/cs35l56-sdw.c | 104 +----------------------------- sound/soc/codecs/cs35l56-shared.c | 101 +---------------------------- sound/soc/codecs/cs35l56-spi.c | 2 - sound/soc/codecs/cs35l56.c | 92 ++------------------------ sound/soc/codecs/cs35l56.h | 10 --- 10 files changed, 14 insertions(+), 372 deletions(-)
include/sound/cs35l56.h +0 -4
@@ -257,8 +257,6 @@struct cs35l56_base {struct device *dev;struct regmap *regmap; -int irq; -struct mutex irq_lock;u8 type;u8 rev;bool init_done;
@@ -298,8 +296,6 @@ int cs35l56_wait_for_firmware_boot(struct cs35l56_base *cs35l56_base);void cs35l56_wait_control_port_ready (void );void cs35l56_wait_min_reset_pulse (void );void cs35l56_system_reset (struct cs35l56_base *cs35l56_base,bool is_soundwire); -int cs35l56_irq_request (struct cs35l56_base *cs35l56_base,int irq); -irqreturn_t cs35l56_irq (int irq,void *data);int cs35l56_is_fw_reload_needed (struct cs35l56_base *cs35l56_base);int cs35l56_runtime_suspend_common (struct cs35l56_base *cs35l56_base);int cs35l56_runtime_resume_common (struct cs35l56_base *cs35l56_base,bool is_soundwire);
sound/pci/hda/cs35l56_hda.c +3 -50
108 lines not on this page · raw message
sound/pci/hda/cs35l56_hda_i2c.c +1 -8
@@ -34,14 +34,7 @@ static int cs35l56_hda_i2c_probe(struct i2c_client *clt)return ret; } - ret =cs35l56_hda_common_probe (cs35l56, id->driver_data, clt->addr); -if (ret) -return ret; - ret =cs35l56_irq_request (&cs35l56->base, clt->irq); -if (ret <0 ) -cs35l56_hda_remove (cs35l56->base.dev); - -return ret; +return cs35l56_hda_common_probe (cs35l56, id->driver_data, clt->addr); }static void cs35l56_hda_i2c_remove (struct i2c_client *clt)
sound/pci/hda/cs35l56_hda_spi.c +1 -8
@@ -34,14 +34,7 @@ static int cs35l56_hda_spi_probe(struct spi_device *spi)return ret; } - ret =cs35l56_hda_common_probe (cs35l56, id->driver_data,spi_get_chipselect (spi,0 )); -if (ret) -return ret; - ret =cs35l56_irq_request (&cs35l56->base, spi->irq); -if (ret <0 ) -cs35l56_hda_remove (cs35l56->base.dev); - -return ret; +return cs35l56_hda_common_probe (cs35l56, id->driver_data,spi_get_chipselect (spi,0 )); }static void cs35l56_hda_spi_remove (struct spi_device *spi)
sound/soc/codecs/cs35l56-i2c.c +0 -2
@@ -41,8 +41,6 @@ static int cs35l56_i2c_probe(struct i2c_client *client)return ret; ret =cs35l56_init (cs35l56); -if (ret ==0 ) - ret =cs35l56_irq_request (&cs35l56->base, client->irq);if (ret <0 )cs35l56_remove (cs35l56);
sound/soc/codecs/cs35l56-sdw.c +3 -101
163 lines not on this page · raw message
sound/soc/codecs/cs35l56-shared.c +1 -100
125 lines not on this page · raw message
sound/soc/codecs/cs35l56-spi.c +0 -2
@@ -39,8 +39,6 @@ static int cs35l56_spi_probe(struct spi_device *spi)return ret; ret =cs35l56_init (cs35l56); -if (ret ==0 ) - ret =cs35l56_irq_request (&cs35l56->base, spi->irq);if (ret <0 )cs35l56_remove (cs35l56);
sound/soc/codecs/cs35l56.c +5 -87
165 lines not on this page · raw message
sound/soc/codecs/cs35l56.h +0 -10
@@ -16,10 +16,6 @@#include <sound/cs35l56.h> #include "wm_adsp.h" -#define CS35L56_SDW_GEN_INT_STAT_1 0xc0 -#define CS35L56_SDW_GEN_INT_MASK_1 0xc1 -#define CS35L56_SDW_INT_MASK_CODEC_IRQ BIT(0) -#define CS35L56_SDW_INVALID_BUS_SCALE 0xf#define CS35L56_RX_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S24_LE)
@@ -38,8 +34,6 @@ struct cs35l56_private {struct snd_soc_component *component;struct regulator_bulk_data supplies[CS35L56_NUM_BULK_SUPPLIES ];struct sdw_slave *sdw_peripheral; -struct work_struct sdw_irq_work; -bool sdw_irq_no_unmask;bool soft_resetting;bool sdw_attached;struct completion init_completion;
@@ -57,12 +51,8 @@ extern const struct dev_pm_ops cs35l56_pm_ops_i2c_spi;int cs35l56_system_suspend (struct device *dev);int cs35l56_system_suspend_late (struct device *dev); -int cs35l56_system_suspend_no_irq (struct device *dev); -int cs35l56_system_resume_no_irq (struct device *dev);int cs35l56_system_resume_early (struct device *dev);int cs35l56_system_resume (struct device *dev); -irqreturn_t cs35l56_irq (int irq,void *data); -int cs35l56_irq_request (struct cs35l56_base *cs35l56_base,int irq);int cs35l56_common_probe (struct cs35l56_private *cs35l56);int cs35l56_init (struct cs35l56_private *cs35l56);void cs35l56_remove (struct cs35l56_private *cs35l56);
Signature · 1 line
2.43.0
Mark Brown
maintainerQuoted 8 lines · Simon Trimmer
The IRQ handling in the cs35l56 driver was purely informational. It was not necessary to support the HDA or ASoC driver functionality and added unnecessary complexity to the drivers.
As the IRQ signal GPIO line could be connected and shared with other components the handling is replaced with a regmap patch to ensure the cs35l56 IRQ sources are masked and will not generate interrupts that go unhandled.
Given that the code is there now and has been since the driver was introduced about 18 months ago what's the ongoing cost of having it? The information it's providing is notification of hardware faults, reporting those does seem useful.
Quoted 10 lines · Mark Brown
Quoted 8 lines · Simon Trimmer
The IRQ handling in the cs35l56 driver was purely informational. It was not necessary to support the HDA or ASoC driver functionality and added unnecessary complexity to the drivers.
As the IRQ signal GPIO line could be connected and shared with other components the handling is replaced with a regmap patch to ensure the cs35l56 IRQ sources are masked and will not generate interrupts that go unhandled.
Quoted 4 lines
Given that the code is there now and has been since the driver was introduced about 18 months ago what's the ongoing cost of having it? The information it's providing is notification of hardware faults, reporting those does seem useful.
Originally we were expecting to use the IRQ mechanism for an event logging stream that would function in a similar manner to compressed streams to be able to get an information feed for debug and tuning tools, but those were never created and the logging infrastructure not implemented.
It's quite a spread of code and a lot of complexity in the regular execution paths managing them / synchronizing the contexts, there is more going on in the SoundWire bus variant compared to the conventional i2c/spi that it is hard to justify maintaining it all for a couple of log messages - in the event that someone did encounter the two situations being reported the regmap dump would point us to the cause pretty quickly.
-Simon
Quoted 3 lines · Simon Trimmer
Quoted 2 lines · Mark Brown
Quoted 1 line · Simon Trimmer
The IRQ handling in the cs35l56 driver was purely informational. It
was
Quoted 1 line
Quoted 1 line
Quoted 1 line
not necessary to support the HDA or ASoC driver functionality and
added
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
unnecessary complexity to the drivers.
As the IRQ signal GPIO line could be connected and shared with other components the handling is replaced with a regmap patch to ensure the cs35l56 IRQ sources are masked and will not generate interrupts that
go
Quoted 7 lines
Quoted 6 lines
Quoted 1 line
unhandled.
Given that the code is there now and has been since the driver was introduced about 18 months ago what's the ongoing cost of having it? The information it's providing is notification of hardware faults, reporting those does seem useful.
Quoted 6 lines
Originally we were expecting to use the IRQ mechanism for an event logging stream that would function in a similar manner to compressed streams to be able to get an information feed for debug and tuning tools, but those were never created and the logging infrastructure not implemented.
It's quite a spread of code and a lot of complexity in the regular
execution
Quoted 1 line
paths managing them / synchronizing the contexts, there is more going on
in
Quoted 4 lines
the SoundWire bus variant compared to the conventional i2c/spi that it is hard to justify maintaining it all for a couple of log messages - in the event that someone did encounter the two situations being reported the regmap dump would point us to the cause pretty quickly.
Hi Mark and Takashi,
Hold off merging this one - we should think about it a bit more and people are off on PTO.
-Simon
Mark Brown
maintainerQuoted 12 lines · Simon Trimmer
Quoted 10 lines · Mark Brown
Quoted 3 lines · Simon Trimmer
The IRQ handling in the cs35l56 driver was purely informational. It was not necessary to support the HDA or ASoC driver functionality and added unnecessary complexity to the drivers.
Given that the code is there now and has been since the driver was introduced about 18 months ago what's the ongoing cost of having it? The information it's providing is notification of hardware faults, reporting those does seem useful.
Quoted 4 lines
Originally we were expecting to use the IRQ mechanism for an event logging stream that would function in a similar manner to compressed streams to be able to get an information feed for debug and tuning tools, but those were never created and the logging infrastructure not implemented.
Right. Though ideally we might actually do something about some of the errors that are reported.
Quoted 6 lines
It's quite a spread of code and a lot of complexity in the regular execution paths managing them / synchronizing the contexts, there is more going on in the SoundWire bus variant compared to the conventional i2c/spi that it is hard to justify maintaining it all for a couple of log messages - in the event that someone did encounter the two situations being reported the regmap dump would point us to the cause pretty quickly.
I'm not sure how many end users are going to get as far as talking to you in the event that they have issues - people often won't get as far as trying to contact their distros or upstreams. Even errors in dmesg are pretty obscure but they're more discoverable than interpreting the regmap, people would need to identify that they need to look at the chip first and actually be experiencing the problem when they figure that out. Ideally we'd hae better handling for this (I did note that the latest Iron Devices driver will back off speaker volume during a thermal warning which isn't a terrible idea, though there's potential issues).
It sounds like the only real concern is the Soundwire stuff (I2C and SPI interrupt stuff should generally be trivial?) - if that's the case I'd be more inclined to only pull out the Soundwire bits and leave the support there for the simpler buses.
Quoted 5 lines · Mark Brown
Quoted 4 lines · Simon Trimmer
Quoted 3 lines · Mark Brown
Quoted 1 line · Simon Trimmer
The IRQ handling in the cs35l56 driver was purely informational. It
was
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
not necessary to support the HDA or ASoC driver functionality and
added
Quoted 8 lines
Quoted 8 lines
Quoted 6 lines
Quoted 1 line
unnecessary complexity to the drivers.
Given that the code is there now and has been since the driver was introduced about 18 months ago what's the ongoing cost of having it? The information it's providing is notification of hardware faults, reporting those does seem useful.
Originally we were expecting to use the IRQ mechanism for an event
logging
Quoted 1 line
Quoted 1 line
stream that would function in a similar manner to compressed streams to
be
Quoted 1 line
Quoted 1 line
able to get an information feed for debug and tuning tools, but those
were
Quoted 6 lines
Quoted 1 line
never created and the logging infrastructure not implemented.
Right. Though ideally we might actually do something about some of the errors that are reported.
Quoted 1 line
It's quite a spread of code and a lot of complexity in the regular
execution
Quoted 1 line
Quoted 1 line
paths managing them / synchronizing the contexts, there is more going on
in
Quoted 1 line
Quoted 1 line
the SoundWire bus variant compared to the conventional i2c/spi that it
is
Quoted 4 lines
Quoted 3 lines
hard to justify maintaining it all for a couple of log messages - in the event that someone did encounter the two situations being reported the regmap dump would point us to the cause pretty quickly.
Quoted 9 lines
I'm not sure how many end users are going to get as far as talking to you in the event that they have issues - people often won't get as far as trying to contact their distros or upstreams. Even errors in dmesg are pretty obscure but they're more discoverable than interpreting the regmap, people would need to identify that they need to look at the chip first and actually be experiencing the problem when they figure that out. Ideally we'd hae better handling for this (I did note that the latest Iron Devices driver will back off speaker volume during a thermal warning which isn't a terrible idea, though there's potential issues).
I'll have a chat to people when they are back at work - the IRQ signals we were logging were from the firmware rather than the hardware as it entered a protection state, this isn't fatal and can clear. Over the last few years I don't think I've encountered them in testing except for when I deliberately abused the hardware which I don't think anyone would recommend :)
How people behave when encountering trouble is certainly true - as more PCs adopt our devices we have a steadily increasing stream of direct support messages and have been getting tagged in distro issue reports. These have been universally around missing support in particular kernel versions or the linux-firmware package not containing the necessary tuning files, so far I've only asked our field/partner engineers for a dump of a regmap and I've not seen a report of a hardware warning yet but I too suspect these are the tip of the iceberg for people encountering troubles.
A general Linux tangent - we had been debating how many of our end users multiboot their hardware vs those who just run Linux on them - has anyone seen any reports or statistics in this area?
Quoted 4 lines
It sounds like the only real concern is the Soundwire stuff (I2C and SPI interrupt stuff should generally be trivial?) - if that's the case I'd be more inclined to only pull out the Soundwire bits and leave the support there for the simpler buses.
That is a good idea and would certainly make things better - I'll see what I can do
-Simon