Skip to content

Conversation

@ujfalusi
Copy link
Collaborator

@ujfalusi ujfalusi commented Dec 5, 2023

The current code flow is:

  1. snd_hdac_device_register()
  2. set parameters needed by the hdac driver
  3. request_codec_module()
    the hdac driver is probed at this point

During boot the codec drivers are not loaded when the hdac device is
registered, it is going to be probed later when loading the codec module,
which point the parameters are set.

On module remove/insert
rmmod snd_sof_pci_intel_tgl
modprobe snd_sof_pci_intel_tgl

The codec module remains loaded and the driver will be probed when the
hdac device is created right away, before the parameters for the driver
has been configured:

  1. snd_hdac_device_register()
    the hdac driver is probed at this point
  2. set parameters needed by the hdac driver
  3. request_codec_module()
    will be a NOP as the module is already loaded

Move the snd_hdac_device_register() later, to be done right before
requesting the codec module to make sure that the parameters are all set
before the device is created:

  1. set parameters needed by the hdac driver
  2. snd_hdac_device_register()
  3. request_codec_module()

This way at the hdac driver probe all parameters will be set in all cases.

Link: #4731
Fixes: a0575b4 ("ASoC: hdac_hda: Conditionally register dais for HDMI and Analog")

@ujfalusi ujfalusi requested a review from bardliao as a code owner December 5, 2023 09:34
@ujfalusi ujfalusi linked an issue Dec 5, 2023 that may be closed by this pull request
@ujfalusi
Copy link
Collaborator Author

ujfalusi commented Dec 5, 2023

Changes since v1:

  • reword the commit message

@ujfalusi ujfalusi force-pushed the peter/sof/pr/fix_module_reload_crash_01 branch 2 times, most recently from bca8e67 to f602234 Compare December 5, 2023 18:46
The current code flow is:
1. snd_hdac_device_register()
2. set parameters needed by the hdac driver
3. request_codec_module()
   the hdac driver is probed at this point

During boot the codec drivers are not loaded when the hdac device is
registered, it is going to be probed later when loading the codec module,
which point the parameters are set.

On module remove/insert
rmmod snd_sof_pci_intel_tgl
modprobe snd_sof_pci_intel_tgl

The codec module remains loaded and the driver will be probed when the
hdac device is created right away, before the parameters for the driver
has been configured:

1. snd_hdac_device_register()
   the hdac driver is probed at this point
2. set parameters needed by the hdac driver
3. request_codec_module()
   will be a NOP as the module is already loaded

Move the snd_hdac_device_register() later, to be done right before
requesting the codec module to make sure that the parameters are all set
before the device is created:

1. set parameters needed by the hdac driver
2. snd_hdac_device_register()
3. request_codec_module()

This way at the hdac driver probe all parameters will be set in all cases.

Link: thesofproject#4731
Fixes: a0575b4 ("ASoC: hdac_hda: Conditionally register dais for HDMI and Analog")
Signed-off-by: Peter Ujfalusi <[email protected]>
@plbossart plbossart merged commit b384b72 into thesofproject:topic/sof-dev Dec 6, 2023
@ujfalusi ujfalusi deleted the peter/sof/pr/fix_module_reload_crash_01 branch December 13, 2024 09:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] kernel oops when testing kmod on TGLU_UP_HDA-ipc4

3 participants