ASoC: cs35l56: Share common SoundWire interrupt enable/disable code
Subsystems (3)
Richard Fitzgerald
maintainerPATCH v2 1/1 ASoC: cs35l56: Share common SoundWire interrupt enable/disable code
Move the duplicated SoundWire interrupt enable/disable code into shared functions. These new functions are in cs35l56.c to prevent circular dependency between cs35l56.c and cs35l56-sdw.c
---
Changes in V2:
- Put the new code in cs35l56.c instead of cs35l56-shared.c, so it's all in modules that already have a dependency on the SoundWire core.
sound/soc/codecs/cs35l56-sdw.c | 43 +++++-------------------- sound/soc/codecs/cs35l56.c | 59 ++++++++++++++++++++++++++-------- sound/soc/codecs/cs35l56.h | 5 +++ 3 files changed, 58 insertions(+), 49 deletions(-)
sound/soc/codecs/cs35l56-sdw.c +8 -35
@@ -230,11 +230,8 @@ static void cs35l56_sdw_init(struct sdw_slave *peripheral)* cs35l56_init can return with !init_done if it triggered * a soft reset. */ -if (cs35l56->base.init_done) { -/* Enable SoundWire interrupts */ -sdw_write_no_pm (peripheral,CS35L56_SDW_GEN_INT_MASK_1 , -CS35L56_SDW_INT_MASK_CODEC_IRQ ); - } +if (cs35l56->base.init_done) +cs35l56_unmask_soundwire_interrupts (cs35l56->sdw_peripheral); out:pm_runtime_put_autosuspend (cs35l56->base.dev);
@@ -259,15 +256,11 @@ static int cs35l56_sdw_interrupt(struct sdw_slave *peripheral,pm_runtime_get_noresume (cs35l56->base.dev);/* -* Mask and clear until it has been handled. The read of GEN_INT_STAT_1 -* is required as per the SoundWire spec for interrupt status bits -* to clear. GEN_INT_MASK_1 masks the _inputs_ to GEN_INT_STAT1. +* Mask and clear until it has been handled. * None of the interrupts are time-critical so use the * power-efficient queue. */ -sdw_write_no_pm (peripheral,CS35L56_SDW_GEN_INT_MASK_1 ,0 ); -sdw_read_no_pm (peripheral,CS35L56_SDW_GEN_INT_STAT_1 ); -sdw_write_no_pm (peripheral,CS35L56_SDW_GEN_INT_STAT_1 ,0xFF ); +cs35l56_mask_soundwire_interrupts (peripheral);queue_work (system_power_efficient_wq, &cs35l56->sdw_irq_work);return 0 ;
@@ -283,8 +276,7 @@ static void cs35l56_sdw_irq_work(struct work_struct *work)/* unmask interrupts */ if (!cs35l56->sdw_irq_no_unmask) -sdw_write_no_pm (cs35l56->sdw_peripheral,CS35L56_SDW_GEN_INT_MASK_1 , -CS35L56_SDW_INT_MASK_CODEC_IRQ ); +cs35l56_unmask_soundwire_interrupts (cs35l56->sdw_peripheral);pm_runtime_put_autosuspend (cs35l56->base.dev); }
@@ -441,9 +433,7 @@ static int __maybe_unused cs35l56_sdw_runtime_resume(struct device *dev)if (ret)return ret; -/* Re-enable SoundWire interrupts */ -sdw_write_no_pm (cs35l56->sdw_peripheral,CS35L56_SDW_GEN_INT_MASK_1 , -CS35L56_SDW_INT_MASK_CODEC_IRQ ); +cs35l56_unmask_soundwire_interrupts (cs35l56->sdw_peripheral);return 0 ; }
@@ -455,18 +445,7 @@ static int __maybe_unused cs35l56_sdw_system_suspend(struct device *dev)if (!cs35l56->base.init_done)return 0 ; -/* -* Disable SoundWire interrupts. -* Flush - don't cancel because that could leave an unbalanced pm_runtime_get. -*/ - cs35l56->sdw_irq_no_unmask = true; -flush_work (&cs35l56->sdw_irq_work); - -/* Mask interrupts and flush in case sdw_irq_work was queued again */ -sdw_write_no_pm (cs35l56->sdw_peripheral,CS35L56_SDW_GEN_INT_MASK_1 ,0 ); -sdw_read_no_pm (cs35l56->sdw_peripheral,CS35L56_SDW_GEN_INT_STAT_1 ); -sdw_write_no_pm (cs35l56->sdw_peripheral,CS35L56_SDW_GEN_INT_STAT_1 ,0xFF ); -flush_work (&cs35l56->sdw_irq_work); +cs35l56_disable_sdw_interrupts (cs35l56);return cs35l56_system_suspend (dev); }
@@ -542,13 +521,7 @@ static void cs35l56_sdw_remove(struct sdw_slave *peripheral) {struct cs35l56_private *cs35l56 =dev_get_drvdata (&peripheral->dev); -/* Disable SoundWire interrupts */ - cs35l56->sdw_irq_no_unmask = true; -flush_work (&cs35l56->sdw_irq_work); -sdw_write_no_pm (peripheral,CS35L56_SDW_GEN_INT_MASK_1 ,0 ); -sdw_read_no_pm (peripheral,CS35L56_SDW_GEN_INT_STAT_1 ); -sdw_write_no_pm (peripheral,CS35L56_SDW_GEN_INT_STAT_1 ,0xFF ); -flush_work (&cs35l56->sdw_irq_work); +cs35l56_disable_sdw_interrupts (cs35l56);cs35l56_remove (cs35l56); }
sound/soc/codecs/cs35l56.c +45 -14
77 lines not on this page · raw message
sound/soc/codecs/cs35l56.h +5 -0
@@ -66,6 +66,11 @@ static inline struct cs35l56_private *cs35l56_private_from_base(struct cs35l56_bextern const struct dev_pm_ops cs35l56_pm_ops_i2c_spi; +void cs35l56_mask_soundwire_interrupts (struct sdw_slave *peripheral); +void cs35l56_unmask_soundwire_interrupts (struct sdw_slave *peripheral); +void cs35l56_disable_sdw_interrupts (struct cs35l56_private *cs35l56); +void cs35l56_enable_sdw_interrupts (struct cs35l56_private *cs35l56); +int cs35l56_system_suspend (struct device *dev);int cs35l56_system_suspend_late (struct device *dev);int cs35l56_system_suspend_no_irq (struct device *dev);
Signature · 1 line
2.47.3
Mark Brown
maintainerQuoted 1 line · Richard Fitzgerald
ASoC: cs35l56: Share common SoundWire interrupt enable/disable code
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-7.2
Thanks!
[1/1] ASoC: cs35l56: Share common SoundWire interrupt enable/disable code
https://git.kernel.org/broonie/sound/c/cab82caa2d37
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks,
Mark