dma: intel_adsp_hda: Refactor power management and correct power domains
This patch addresses several issues with the Intel ADSP HDA DMA driver: 1. Refactors the HDA DMA power management initialization. The previous use of `pm_device_runtime_enable` was incorrect. The updated approach relies on enabling runtime power management through the device tree using the `zephyr,pm-device-runtime-auto` property. Additionally, the patch removes redundant device initialization steps as these are already handled by `pm_device_driver_init` when the device is under a power domain. 2. Corrects the power domain assignment for the HDA link. The HDA link was previously assigned to the io0 power domain based on a misinterpretation of the documentation. The correct power domain assignment is now based on updated documentation for LNL, ensuring that the HDA link is associated with the appropriate power domain. These changes ensure that the HDA DMA driver properly manages power states, reducing power consumption and improving system stability, while ensuring the correct power domains are used. Signed-off-by: Tomasz Leman <tomasz.m.leman@intel.com>
This commit is contained in:
parent
fd4a4bf702
commit
329675ab7c
5 changed files with 44 additions and 38 deletions
|
@ -383,6 +383,23 @@ static void intel_adsp_hda_channels_init(const struct device *dev)
|
|||
#endif
|
||||
}
|
||||
|
||||
int intel_adsp_hda_dma_pm_action(const struct device *dev, enum pm_device_action action)
|
||||
{
|
||||
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:
|
||||
break;
|
||||
default:
|
||||
return -ENOTSUP;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int intel_adsp_hda_dma_init(const struct device *dev)
|
||||
{
|
||||
struct intel_adsp_hda_dma_data *data = dev->data;
|
||||
|
@ -391,19 +408,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;
|
||||
#ifdef CONFIG_PM_DEVICE_RUNTIME
|
||||
if (pm_device_on_power_domain(dev)) {
|
||||
pm_device_init_off(dev);
|
||||
} else {
|
||||
intel_adsp_hda_channels_init(dev);
|
||||
pm_device_init_suspended(dev);
|
||||
}
|
||||
|
||||
return pm_device_runtime_enable(dev);
|
||||
#else
|
||||
intel_adsp_hda_channels_init(dev);
|
||||
return 0;
|
||||
#endif
|
||||
return pm_device_driver_init(dev, intel_adsp_hda_dma_pm_action);
|
||||
}
|
||||
|
||||
int intel_adsp_hda_dma_get_attribute(const struct device *dev, uint32_t type, uint32_t *value)
|
||||
|
@ -430,25 +435,6 @@ int intel_adsp_hda_dma_get_attribute(const struct device *dev, uint32_t type, ui
|
|||
return 0;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_PM_DEVICE
|
||||
int intel_adsp_hda_dma_pm_action(const struct device *dev, enum pm_device_action action)
|
||||
{
|
||||
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:
|
||||
break;
|
||||
default:
|
||||
return -ENOTSUP;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
#define DEVICE_DT_GET_AND_COMMA(node_id) DEVICE_DT_GET(node_id),
|
||||
|
||||
void intel_adsp_hda_dma_isr(void)
|
||||
|
|
|
@ -478,7 +478,8 @@
|
|||
dma-buf-addr-alignment = <128>;
|
||||
dma-buf-size-alignment = <32>;
|
||||
dma-copy-alignment = <16>;
|
||||
power-domains = <&io0_domain>;
|
||||
power-domains = <&hub_ulp_domain>;
|
||||
zephyr,pm-device-runtime-auto;
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
|
@ -490,7 +491,8 @@
|
|||
dma-buf-addr-alignment = <128>;
|
||||
dma-buf-size-alignment = <32>;
|
||||
dma-copy-alignment = <16>;
|
||||
power-domains = <&io0_domain>;
|
||||
power-domains = <&hub_ulp_domain>;
|
||||
zephyr,pm-device-runtime-auto;
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
|
@ -503,6 +505,7 @@
|
|||
dma-buf-size-alignment = <32>;
|
||||
dma-copy-alignment = <16>;
|
||||
power-domains = <&hst_domain>;
|
||||
zephyr,pm-device-runtime-auto;
|
||||
interrupts = <13 0 0>;
|
||||
interrupt-parent = <&ace_intc>;
|
||||
status = "okay";
|
||||
|
@ -517,6 +520,7 @@
|
|||
dma-buf-size-alignment = <32>;
|
||||
dma-copy-alignment = <16>;
|
||||
power-domains = <&hst_domain>;
|
||||
zephyr,pm-device-runtime-auto;
|
||||
interrupts = <12 0 0>;
|
||||
interrupt-parent = <&ace_intc>;
|
||||
status = "okay";
|
||||
|
|
|
@ -383,6 +383,8 @@
|
|||
dma-buf-addr-alignment = <128>;
|
||||
dma-buf-size-alignment = <32>;
|
||||
dma-copy-alignment = <16>;
|
||||
power-domains = <&hst_domain>;
|
||||
zephyr,pm-device-runtime-auto;
|
||||
interrupts = <13 0 0>;
|
||||
interrupt-parent = <&ace_intc>;
|
||||
status = "okay";
|
||||
|
@ -396,6 +398,8 @@
|
|||
dma-buf-addr-alignment = <128>;
|
||||
dma-buf-size-alignment = <32>;
|
||||
dma-copy-alignment = <16>;
|
||||
power-domains = <&hst_domain>;
|
||||
zephyr,pm-device-runtime-auto;
|
||||
interrupts = <12 0 0>;
|
||||
interrupt-parent = <&ace_intc>;
|
||||
status = "okay";
|
||||
|
@ -417,6 +421,8 @@
|
|||
dma-buf-addr-alignment = <128>;
|
||||
dma-buf-size-alignment = <32>;
|
||||
dma-copy-alignment = <16>;
|
||||
power-domains = <&hub_ulp_domain>;
|
||||
zephyr,pm-device-runtime-auto;
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
|
@ -428,6 +434,8 @@
|
|||
dma-buf-addr-alignment = <128>;
|
||||
dma-buf-size-alignment = <32>;
|
||||
dma-copy-alignment = <16>;
|
||||
power-domains = <&hub_ulp_domain>;
|
||||
zephyr,pm-device-runtime-auto;
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
|
|
|
@ -505,6 +505,7 @@
|
|||
dma-buf-size-alignment = <32>;
|
||||
dma-copy-alignment = <32>;
|
||||
power-domains = <&hst_domain>;
|
||||
zephyr,pm-device-runtime-auto;
|
||||
interrupts = <13 0 0>;
|
||||
interrupt-parent = <&ace_intc>;
|
||||
status = "okay";
|
||||
|
@ -519,6 +520,7 @@
|
|||
dma-buf-size-alignment = <32>;
|
||||
dma-copy-alignment = <32>;
|
||||
power-domains = <&hst_domain>;
|
||||
zephyr,pm-device-runtime-auto;
|
||||
interrupts = <12 0 0>;
|
||||
interrupt-parent = <&ace_intc>;
|
||||
status = "okay";
|
||||
|
@ -540,7 +542,8 @@
|
|||
dma-buf-addr-alignment = <128>;
|
||||
dma-buf-size-alignment = <32>;
|
||||
dma-copy-alignment = <32>;
|
||||
power-domains = <&io0_domain>;
|
||||
power-domains = <&hub_ulp_domain>;
|
||||
zephyr,pm-device-runtime-auto;
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
|
@ -552,7 +555,8 @@
|
|||
dma-buf-addr-alignment = <128>;
|
||||
dma-buf-size-alignment = <32>;
|
||||
dma-copy-alignment = <32>;
|
||||
power-domains = <&io0_domain>;
|
||||
power-domains = <&hub_ulp_domain>;
|
||||
zephyr,pm-device-runtime-auto;
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
|
|
|
@ -510,6 +510,7 @@
|
|||
dma-buf-size-alignment = <32>;
|
||||
dma-copy-alignment = <32>;
|
||||
power-domains = <&hst_domain>;
|
||||
zephyr,pm-device-runtime-auto;
|
||||
interrupts = <13 0 0>;
|
||||
interrupt-parent = <&ace_intc>;
|
||||
status = "okay";
|
||||
|
@ -524,6 +525,7 @@
|
|||
dma-buf-size-alignment = <32>;
|
||||
dma-copy-alignment = <32>;
|
||||
power-domains = <&hst_domain>;
|
||||
zephyr,pm-device-runtime-auto;
|
||||
interrupts = <12 0 0>;
|
||||
interrupt-parent = <&ace_intc>;
|
||||
status = "okay";
|
||||
|
@ -545,7 +547,8 @@
|
|||
dma-buf-addr-alignment = <128>;
|
||||
dma-buf-size-alignment = <32>;
|
||||
dma-copy-alignment = <32>;
|
||||
power-domains = <&io0_domain>;
|
||||
power-domains = <&hub_ulp_domain>;
|
||||
zephyr,pm-device-runtime-auto;
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
|
@ -557,7 +560,8 @@
|
|||
dma-buf-addr-alignment = <128>;
|
||||
dma-buf-size-alignment = <32>;
|
||||
dma-copy-alignment = <32>;
|
||||
power-domains = <&io0_domain>;
|
||||
power-domains = <&hub_ulp_domain>;
|
||||
zephyr,pm-device-runtime-auto;
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue