MLK-23701-2 ASoc:fsl: Add support cplay in mp board
1. Add clk necessary in dsp driver 2. Add renderer type for select sai or esai Signed-off-by: Zhang Peng <peng.zhang_8@nxp.com>5.4-rM2-2.2.x-imx-squashed
parent
5e9570b387
commit
d235be4b28
|
@ -971,6 +971,7 @@ static int fsl_dsp_probe(struct platform_device *pdev)
|
|||
struct resource reserved_res;
|
||||
struct fsl_dsp *dsp_priv;
|
||||
const char *fw_name;
|
||||
const char *audio_iface;
|
||||
struct resource *res;
|
||||
void __iomem *regs;
|
||||
void *buf_virt;
|
||||
|
@ -1023,6 +1024,9 @@ static int fsl_dsp_probe(struct platform_device *pdev)
|
|||
ret = of_property_read_string(np, "fsl,dsp-firmware", &fw_name);
|
||||
dsp_priv->fw_name = fw_name;
|
||||
|
||||
ret = of_property_read_string(np, "audio-interface", &audio_iface);
|
||||
dsp_priv->audio_iface = audio_iface;
|
||||
|
||||
ret = of_property_read_u32(np, "fixup-offset", &dsp_priv->fixup_offset);
|
||||
|
||||
platform_set_drvdata(pdev, dsp_priv);
|
||||
|
@ -1156,6 +1160,28 @@ static int fsl_dsp_probe(struct platform_device *pdev)
|
|||
if (IS_ERR(dsp_priv->mu2_clk))
|
||||
dsp_priv->mu2_clk = NULL;
|
||||
|
||||
dsp_priv->sdma_root_clk = devm_clk_get(&pdev->dev, "sdma_root");
|
||||
if (IS_ERR(dsp_priv->sdma_root_clk))
|
||||
dsp_priv->sdma_root_clk = NULL;
|
||||
dsp_priv->sai_ipg_clk = devm_clk_get(&pdev->dev, "sai_ipg");
|
||||
if (IS_ERR(dsp_priv->sai_ipg_clk))
|
||||
dsp_priv->sai_ipg_clk = NULL;
|
||||
dsp_priv->sai_mclk = devm_clk_get(&pdev->dev, "sai_mclk");
|
||||
if (IS_ERR(dsp_priv->sai_mclk))
|
||||
dsp_priv->sai_mclk = NULL;
|
||||
dsp_priv->pll8k_clk = devm_clk_get(&pdev->dev, "pll8k");
|
||||
if (IS_ERR(dsp_priv->pll8k_clk))
|
||||
dsp_priv->pll8k_clk = NULL;
|
||||
dsp_priv->pll11k_clk = devm_clk_get(&pdev->dev, "pll11k");
|
||||
if (IS_ERR(dsp_priv->pll11k_clk))
|
||||
dsp_priv->pll11k_clk = NULL;
|
||||
dsp_priv->uart_ipg_clk = devm_clk_get(&pdev->dev, "uart_ipg");
|
||||
if (IS_ERR(dsp_priv->uart_ipg_clk))
|
||||
dsp_priv->uart_ipg_clk = NULL;
|
||||
dsp_priv->uart_per_clk = devm_clk_get(&pdev->dev, "uart_per");
|
||||
if (IS_ERR(dsp_priv->uart_per_clk))
|
||||
dsp_priv->uart_per_clk = NULL;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -1242,6 +1268,43 @@ static int fsl_dsp_runtime_resume(struct device *dev)
|
|||
goto mu2_clk;
|
||||
}
|
||||
|
||||
ret = clk_prepare_enable(dsp_priv->sdma_root_clk);
|
||||
if (ret < 0) {
|
||||
dev_err(dev, "Failed to enable sdma_root _clk ret = %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
ret = clk_prepare_enable(dsp_priv->sai_ipg_clk);
|
||||
if (ret < 0) {
|
||||
dev_err(dev, "Failed to enable sai_ipg_clk ret = %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
ret = clk_prepare_enable(dsp_priv->sai_mclk);
|
||||
if (ret < 0) {
|
||||
dev_err(dev, "Failed to enable sai_mclk ret = %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
ret = clk_prepare_enable(dsp_priv->pll8k_clk);
|
||||
if (ret < 0) {
|
||||
dev_err(dev, "Failed to enable pll8k_clk ret = %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
ret = clk_prepare_enable(dsp_priv->pll11k_clk);
|
||||
if (ret < 0) {
|
||||
dev_err(dev, "Failed to enable pll11k_clk ret = %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
ret = clk_prepare_enable(dsp_priv->uart_ipg_clk);
|
||||
if (ret < 0) {
|
||||
dev_err(dev, "Failed to enable uart_ipg_clk ret = %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
ret = clk_prepare_enable(dsp_priv->uart_per_clk);
|
||||
if (ret < 0) {
|
||||
dev_err(dev, "Failed to enable uart_per_clk ret = %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
if (!dsp_priv->dsp_mu_init) {
|
||||
MU_Init(dsp_priv->mu_base_virtaddr);
|
||||
MU_EnableRxFullInt(dsp_priv->mu_base_virtaddr, 0);
|
||||
|
@ -1321,6 +1384,13 @@ static int fsl_dsp_runtime_suspend(struct device *dev)
|
|||
clk_disable_unprepare(dsp_priv->dsp_root_clk);
|
||||
clk_disable_unprepare(dsp_priv->debug_clk);
|
||||
clk_disable_unprepare(dsp_priv->mu2_clk);
|
||||
clk_disable_unprepare(dsp_priv->sdma_root_clk);
|
||||
clk_disable_unprepare(dsp_priv->sai_ipg_clk);
|
||||
clk_disable_unprepare(dsp_priv->sai_mclk);
|
||||
clk_disable_unprepare(dsp_priv->pll8k_clk);
|
||||
clk_disable_unprepare(dsp_priv->pll11k_clk);
|
||||
clk_disable_unprepare(dsp_priv->uart_ipg_clk);
|
||||
clk_disable_unprepare(dsp_priv->uart_per_clk);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -70,6 +70,7 @@ union xf_client_link {
|
|||
struct fsl_dsp {
|
||||
struct device *dev;
|
||||
const char *fw_name;
|
||||
const char *audio_iface;
|
||||
void __iomem *regs;
|
||||
void __iomem *mu_base_virtaddr;
|
||||
struct imx_sc_ipc *dsp_ipcHandle;
|
||||
|
@ -117,6 +118,14 @@ struct fsl_dsp {
|
|||
struct clk *dsp_root_clk;
|
||||
struct clk *debug_clk;
|
||||
struct clk *mu2_clk;
|
||||
struct clk *sdma_root_clk;
|
||||
struct clk *sai_ipg_clk;
|
||||
struct clk *sai_mclk;
|
||||
struct clk *pll8k_clk;
|
||||
struct clk *pll11k_clk;
|
||||
struct clk *uart_ipg_clk;
|
||||
struct clk *uart_per_clk;
|
||||
|
||||
struct device **pd_dev;
|
||||
struct device_link **pd_dev_link;
|
||||
int num_domains;
|
||||
|
|
|
@ -15,6 +15,7 @@ struct dsp_data {
|
|||
struct xaf_pipeline pipeline;
|
||||
struct xaf_comp component[2];
|
||||
int codec_type;
|
||||
int renderer_type;
|
||||
int status;
|
||||
};
|
||||
|
||||
|
|
|
@ -162,13 +162,16 @@ static int dsp_platform_compr_set_params(struct snd_compr_stream *cstream,
|
|||
drv->codec_type, ret);
|
||||
goto err_pool_alloc;
|
||||
}
|
||||
|
||||
if (sysfs_streq(dsp_priv->audio_iface, "sai"))
|
||||
drv->renderer_type = RENDER_SAI;
|
||||
else
|
||||
drv->renderer_type = RENDER_ESAI;
|
||||
ret = xaf_comp_create(drv->client, p_proxy, &drv->component[1],
|
||||
RENDER_ESAI);
|
||||
drv->renderer_type);
|
||||
if (ret) {
|
||||
dev_err(component->dev,
|
||||
"create component failed, type = %d, err = %d\n",
|
||||
RENDER_ESAI, ret);
|
||||
drv->renderer_type, ret);
|
||||
goto err_comp0_create;
|
||||
}
|
||||
|
||||
|
@ -178,14 +181,14 @@ static int dsp_platform_compr_set_params(struct snd_compr_stream *cstream,
|
|||
dev_err(component->dev,
|
||||
"add component failed, type = %d, err = %d\n",
|
||||
drv->codec_type, ret);
|
||||
goto err_comp1_create;
|
||||
goto err_comp0_create;
|
||||
}
|
||||
|
||||
ret = xaf_comp_add(&drv->pipeline, &drv->component[1]);
|
||||
if (ret) {
|
||||
dev_err(component->dev,
|
||||
"add component failed, type = %d, err = %d\n",
|
||||
drv->codec_type, ret);
|
||||
drv->renderer_type, ret);
|
||||
goto err_comp1_create;
|
||||
}
|
||||
|
||||
|
|
|
@ -190,7 +190,7 @@ int xaf_comp_create(struct xf_client *client, struct xf_proxy *proxy,
|
|||
|
||||
p_comp->comp_type = comp_type;
|
||||
|
||||
if (comp_type == RENDER_ESAI)
|
||||
if (comp_type == RENDER_ESAI || comp_type == RENDER_SAI)
|
||||
loadlib = false;
|
||||
|
||||
if (loadlib) {
|
||||
|
@ -211,6 +211,9 @@ int xaf_comp_create(struct xf_client *client, struct xf_proxy *proxy,
|
|||
case RENDER_ESAI:
|
||||
p_comp->dec_id = "renderer/esai";
|
||||
break;
|
||||
case RENDER_SAI:
|
||||
p_comp->dec_id = "renderer/sai";
|
||||
break;
|
||||
|
||||
default:
|
||||
return -EINVAL;
|
||||
|
@ -283,7 +286,7 @@ int xaf_comp_delete(struct xf_client *client, struct xaf_comp *p_comp)
|
|||
/* mark component as unusable from this point */
|
||||
p_comp->active = false;
|
||||
|
||||
if (p_comp->comp_type == RENDER_ESAI)
|
||||
if (p_comp->comp_type == RENDER_ESAI || p_comp->comp_type == RENDER_SAI)
|
||||
loadlib = false;
|
||||
|
||||
p_handle = &p_comp->handle;
|
||||
|
|
Loading…
Reference in New Issue