drivers: hda: enable runtime power mgmt in intel hda dma
Enable Zephyr device runtime power management mechanisms in Intel HDA DMA driver. This allows Zephyr to track usage reference for power domain gating. PM action handler is currently empty and will be fill out later. Signed-off-by: Tomasz Leman <tomasz.m.leman@intel.com>
This commit is contained in:
parent
d9432ebcb9
commit
af6d827b64
6 changed files with 43 additions and 7 deletions
|
@ -236,7 +236,7 @@ int intel_adsp_hda_dma_start(const struct device *dev, uint32_t channel)
|
|||
intel_adsp_hda_link_commit(cfg->base, cfg->regblock_size, channel, size);
|
||||
}
|
||||
|
||||
return 0;
|
||||
return pm_device_runtime_get(dev);
|
||||
}
|
||||
|
||||
int intel_adsp_hda_dma_stop(const struct device *dev, uint32_t channel)
|
||||
|
@ -247,7 +247,7 @@ int intel_adsp_hda_dma_stop(const struct device *dev, uint32_t channel)
|
|||
|
||||
intel_adsp_hda_disable(cfg->base, cfg->regblock_size, channel);
|
||||
|
||||
return 0;
|
||||
return pm_device_runtime_put(dev);
|
||||
}
|
||||
|
||||
int intel_adsp_hda_dma_init(const struct device *dev)
|
||||
|
@ -263,7 +263,8 @@ int intel_adsp_hda_dma_init(const struct device *dev)
|
|||
data->ctx.atomic = data->channels_atomic;
|
||||
data->ctx.magic = DMA_MAGIC;
|
||||
|
||||
return 0;
|
||||
pm_device_init_suspended(dev);
|
||||
return pm_device_runtime_enable(dev);
|
||||
}
|
||||
|
||||
int intel_adsp_hda_dma_get_attribute(const struct device *dev, uint32_t type, uint32_t *value)
|
||||
|
@ -289,3 +290,20 @@ 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_SUSPEND:
|
||||
case PM_DEVICE_ACTION_RESUME:
|
||||
case PM_DEVICE_ACTION_TURN_ON:
|
||||
case PM_DEVICE_ACTION_TURN_OFF:
|
||||
break;
|
||||
default:
|
||||
return -ENOTSUP;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -10,6 +10,8 @@
|
|||
#define INTEL_ADSP_HDA_MAX_CHANNELS DT_PROP(DT_NODELABEL(hda_host_out), dma_channels)
|
||||
|
||||
#include <zephyr/drivers/dma.h>
|
||||
#include <zephyr/pm/device.h>
|
||||
#include <zephyr/pm/device_runtime.h>
|
||||
|
||||
struct intel_adsp_hda_dma_data {
|
||||
struct dma_context ctx;
|
||||
|
@ -60,4 +62,8 @@ int intel_adsp_hda_dma_init(const struct device *dev);
|
|||
|
||||
int intel_adsp_hda_dma_get_attribute(const struct device *dev, uint32_t type, uint32_t *value);
|
||||
|
||||
#ifdef CONFIG_PM_DEVICE
|
||||
int intel_adsp_hda_dma_pm_action(const struct device *dev, enum pm_device_action action);
|
||||
#endif
|
||||
|
||||
#endif /* ZEPHYR_DRIVERS_DMA_INTEL_ADSP_HDA_COMMON_H_ */
|
||||
|
|
|
@ -29,7 +29,10 @@ static const struct dma_driver_api intel_adsp_hda_dma_host_in_api = {
|
|||
\
|
||||
static struct intel_adsp_hda_dma_data intel_adsp_hda_dma##inst##_data = {}; \
|
||||
\
|
||||
DEVICE_DT_INST_DEFINE(inst, &intel_adsp_hda_dma_init, NULL, \
|
||||
PM_DEVICE_DT_INST_DEFINE(inst, intel_adsp_hda_dma_pm_action); \
|
||||
\
|
||||
DEVICE_DT_INST_DEFINE(inst, &intel_adsp_hda_dma_init, \
|
||||
PM_DEVICE_DT_INST_GET(inst), \
|
||||
&intel_adsp_hda_dma##inst##_data, \
|
||||
&intel_adsp_hda_dma##inst##_config, POST_KERNEL, \
|
||||
CONFIG_DMA_INIT_PRIORITY, \
|
||||
|
|
|
@ -33,7 +33,10 @@ static const struct dma_driver_api intel_adsp_hda_dma_host_out_api = {
|
|||
\
|
||||
static struct intel_adsp_hda_dma_data intel_adsp_hda_dma##inst##_data = {}; \
|
||||
\
|
||||
DEVICE_DT_INST_DEFINE(inst, &intel_adsp_hda_dma_init, NULL, \
|
||||
PM_DEVICE_DT_INST_DEFINE(inst, intel_adsp_hda_dma_pm_action); \
|
||||
\
|
||||
DEVICE_DT_INST_DEFINE(inst, &intel_adsp_hda_dma_init, \
|
||||
PM_DEVICE_DT_INST_GET(inst), \
|
||||
&intel_adsp_hda_dma##inst##_data, \
|
||||
&intel_adsp_hda_dma##inst##_config, POST_KERNEL, \
|
||||
CONFIG_DMA_INIT_PRIORITY, \
|
||||
|
|
|
@ -34,7 +34,10 @@ static const struct dma_driver_api intel_adsp_hda_dma_link_in_api = {
|
|||
\
|
||||
static struct intel_adsp_hda_dma_data intel_adsp_hda_dma##inst##_data = {}; \
|
||||
\
|
||||
DEVICE_DT_INST_DEFINE(inst, &intel_adsp_hda_dma_init, NULL, \
|
||||
PM_DEVICE_DT_INST_DEFINE(inst, intel_adsp_hda_dma_pm_action); \
|
||||
\
|
||||
DEVICE_DT_INST_DEFINE(inst, &intel_adsp_hda_dma_init, \
|
||||
PM_DEVICE_DT_INST_GET(inst), \
|
||||
&intel_adsp_hda_dma##inst##_data, \
|
||||
&intel_adsp_hda_dma##inst##_config, POST_KERNEL, \
|
||||
CONFIG_DMA_INIT_PRIORITY, \
|
||||
|
|
|
@ -34,7 +34,10 @@ static const struct dma_driver_api intel_adsp_hda_dma_link_out_api = {
|
|||
\
|
||||
static struct intel_adsp_hda_dma_data intel_adsp_hda_dma##inst##_data = {}; \
|
||||
\
|
||||
DEVICE_DT_INST_DEFINE(inst, &intel_adsp_hda_dma_init, NULL, \
|
||||
PM_DEVICE_DT_INST_DEFINE(inst, intel_adsp_hda_dma_pm_action); \
|
||||
\
|
||||
DEVICE_DT_INST_DEFINE(inst, &intel_adsp_hda_dma_init, \
|
||||
PM_DEVICE_DT_INST_GET(inst), \
|
||||
&intel_adsp_hda_dma##inst##_data, \
|
||||
&intel_adsp_hda_dma##inst##_config, POST_KERNEL, \
|
||||
CONFIG_DMA_INIT_PRIORITY, \
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue