Browse Source

dma: intel_adsp_hda: Fix invalid init sequence and register use

This patch addresses the issue of invalid initialization sequence and
the use of registers in `dma_config` before the device is fully
initialized in the Intel ADSP HDA DMA driver.

Changes include:
1. Moving the `intel_adsp_hda_channels_init` call to the
   `intel_adsp_hda_dma_init` function to ensure that channels are
   initialized during device initialization.
2. Removing the redundant call to `intel_adsp_hda_channels_init` from
   the `PM_DEVICE_ACTION_RESUME` case in the
   `intel_adsp_hda_dma_pm_action` function.

These changes ensure that the device and its channels are properly
initialized before any DMA configuration is performed, preventing access
to hardware registers before the device is ready.

**Note:** This is a proposed solution, and a different approach should
be considered. Currently, we are accessing registers before the device
and power domain are fully powered up. This solution likely works
because the DMA is used to load firmware during the boot process, and
the necessary power domains are already powered up. Further
investigation and a more robust solution are recommended to ensure
proper initialization and power management.

Signed-off-by: Tomasz Leman <tomasz.m.leman@intel.com>
pull/82886/head
Tomasz Leman 7 months ago committed by Benjamin Cabé
parent
commit
fa4a9db7a3
  1. 4
      drivers/dma/dma_intel_adsp_hda.c

4
drivers/dma/dma_intel_adsp_hda.c

@ -385,10 +385,9 @@ static void intel_adsp_hda_channels_init(const struct device *dev) @@ -385,10 +385,9 @@ static void intel_adsp_hda_channels_init(const struct device *dev)
int intel_adsp_hda_dma_pm_action(const struct device *dev, enum pm_device_action action)
{
ARG_UNUSED(dev);
switch (action) {
case PM_DEVICE_ACTION_RESUME:
intel_adsp_hda_channels_init(dev);
break;
case PM_DEVICE_ACTION_SUSPEND:
case PM_DEVICE_ACTION_TURN_ON:
case PM_DEVICE_ACTION_TURN_OFF:
@ -408,6 +407,7 @@ int intel_adsp_hda_dma_init(const struct device *dev) @@ -408,6 +407,7 @@ int intel_adsp_hda_dma_init(const struct device *dev)
data->ctx.dma_channels = cfg->dma_channels;
data->ctx.atomic = data->channels_atomic;
data->ctx.magic = DMA_MAGIC;
intel_adsp_hda_channels_init(dev);
return pm_device_driver_init(dev, intel_adsp_hda_dma_pm_action);
}

Loading…
Cancel
Save