Skip to content

Fix races on creation of SDCA jack detection

Charles Keepax linux-sound lkml 4 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v4 Latest7 patches 1 replyIn review
  2. v34 patches 7 repliesSuperseded
  3. v23 patches 1 replySuperseded
Earlier versions · 1
VersionPostedPatchesRepliesStatus
v13 patches0 repliesSuperseded

Changes in v4 from the cover letter

- Renamed sdca_irq_allocate to make more clear it uses devm.
- Added description of the race onto this cover-letter as well.
- Removed devm usage from all the primary IRQ requesting, although it is still used for the IRQ struct allocation.
- Added one more fix to move the kcontrol search out of the IRQ.

Patches in v4 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/7ASoC: SDCA: Rename sdca_irq_allocate() to include devminclude/sound/sdca_interrupts.h sound/soc/sdca/sdca_class.c sound/soc/sdca/sdca_interrupts.c+9 -80 replies
2/7ASoC: SDCA: Add sdca_irq_cleanup_late()include/sound/sdca_interrupts.h sound/soc/sdca/sdca_class_function.c sound/soc/sdca/sdca_interrupts.c+48 -120 replies
3/7ASoC: SDCA: Remove devm from primary IRQ cleanupinclude/sound/sdca_fdl.h include/sound/sdca_interrupts.h include/sound/sdca_jack.h +3 more+36 -40 replies
4/7ASoC: SDCA: Populate IRQ data earlierinclude/sound/sdca_interrupts.h sound/soc/sdca/sdca_interrupts.c+47 -700 replies
5/7ASoC: Add a component fixup_controls callbackinclude/sound/soc-component.h sound/soc/soc-component.c sound/soc/soc-core.c+17 -00 replies
6/7ASoC: SDCA: Switch to fixup_controls callback for IRQ registrationsound/soc/sdca/sdca_class_function.c sound/soc/sdca/sdca_jack.c+21 -270 replies
7/7ASoC: SDCA: Move kcontrol search out of IRQinclude/sound/sdca_jack.h sound/soc/sdca/sdca_interrupts.c sound/soc/sdca/sdca_jack.c+39 -170 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v4 yet.

Read the v4 thread

Cover letter [PATCH v4 0/7] Fix races on creation of SDCA jack detection

Currently there exists a couple races that can result in the DAPM graph coming up in a state that doesn't match the hardware with respect to SDCA jack detection. This series fixes these up by adding a component level fixup_controls helper into the asoc core and shuffling around the IRQ requests from the SDCA side.

The core creates DAPM widgets/routes quite a long time before it creates the associated ALSA control, and the jack detection IRQ is currently registered in component probe. At the time of component probe, the DAPM widgets exist, shortly after this the DAPM routes are added. At the time the DAPM routes are added the register value for the control is checked and the appropriate path is connected. The existing handling in the SDCA jack IRQ handles the case the control doesn't exist and updates the registers directly, which works until the DAPM routes are added. After the routes are added the DAPM graph has already set connected on a particular DAPM path, which will not be updated until an IRQ is received when the control is present. Thus those updates are usually not reflected in the resulting DAPM graph which can lead to the audio path being erroneously powered on/off.

Thanks,
Charles

Changes since v1:
- Clean up freeing of the interrupt name, Sashiko astutely pointed out there was a memory leak there.
Changes since v2:
- Add back bus remove in the class driver, and split the IRQ free into two functions.
Changes since v3:
- Renamed sdca_irq_allocate to make more clear it uses devm.
- Added description of the race onto this cover-letter as well.
- Removed devm usage from all the primary IRQ requesting, although it is still used for the IRQ struct allocation.
- Added one more fix to move the kcontrol search out of the IRQ.

Charles Keepax (7):
ASoC: SDCA: Rename sdca_irq_allocate() to include devm
ASoC: SDCA: Add sdca_irq_cleanup_late()
ASoC: SDCA: Remove devm from primary IRQ cleanup
ASoC: SDCA: Populate IRQ data earlier
ASoC: Add a component fixup_controls callback
ASoC: SDCA: Switch to fixup_controls callback for IRQ registration
ASoC: SDCA: Move kcontrol search out of IRQ

 include/sound/sdca_fdl.h             |   2 +
 include/sound/sdca_interrupts.h      |  14 ++-
 include/sound/sdca_jack.h            |   3 +
 include/sound/soc-component.h        |   2 +
 sound/soc/sdca/sdca_class.c          |   4 +-
 sound/soc/sdca/sdca_class_function.c |   6 +-
 sound/soc/sdca/sdca_fdl.c            |  13 +-
 sound/soc/sdca/sdca_interrupts.c     | 174 +++++++++++++++------------
 sound/soc/sdca/sdca_jack.c           |  88 ++++++++------
 sound/soc/soc-component.c            |  10 ++
 sound/soc/soc-core.c                 |   5 +
 11 files changed, 200 insertions(+), 121 deletions(-)
Signature · 1 line
2.47.3