dai: let DAI drivers access the underlying component object

DAI drivers sometimes need to access the underlying component object.
Make this possible by adding a pointer to struct dai_data into struct
dai and to struct comp_dev into struct dai_data and by assigning
those pointers accordingly.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
This commit is contained in:
Guennadi Liakhovetski 2022-05-31 14:27:11 +02:00 committed by Liam Girdwood
parent 8f9b769af8
commit 193f9118e8
4 changed files with 7 additions and 0 deletions

View File

@ -187,6 +187,7 @@ static struct comp_dev *dai_new(const struct comp_driver *drv,
comp_cl_err(&comp_dai, "dai_new(): dai_get() failed to create DAI.");
goto error;
}
dd->dai->dd = dd;
dd->ipc_config = *dai;
/* request GP LP DMA with shared access privilege */

View File

@ -161,6 +161,7 @@ struct dai_data {
#ifdef __ZEPHYR__
struct dma_config *z_config;
#endif
struct comp_dev *dai_dev;
struct comp_buffer *dma_buffer;
struct comp_buffer *local_buffer;
struct timestamp_cfg ts_config;
@ -199,6 +200,7 @@ struct dai {
int sref; /**< simple ref counter, guarded by lock */
struct dai_plat_data plat_data;
const struct dai_driver *drv;
const struct dai_data *dd;
void *priv_data;
};

View File

@ -288,6 +288,8 @@ int dai_config(struct comp_dev *dev, struct ipc_config_dai *common_config,
return 0;
}
dd->dai_dev = dev;
switch (config->flags & SOF_DAI_CONFIG_FLAGS_CMD_MASK) {
case SOF_DAI_CONFIG_FLAGS_HW_PARAMS:
/* set the delayed_dma_stop flag */

View File

@ -274,6 +274,8 @@ int dai_config(struct comp_dev *dev, struct ipc_config_dai *common_config,
if (dai_config_dma_channel(dev, spec_config) == DMA_CHAN_INVALID)
return 0;
dd->dai_dev = dev;
/* allocated dai_config if not yet */
if (!dd->dai_spec_config) {
size = sizeof(*copier_cfg);