Commit 6aa7b409 authored by Kuninori Morimoto's avatar Kuninori Morimoto Committed by Mark Brown

ASoC: fsl: mpc8610_hpcd/p1022_ds/p1022_rdk: use modern dai_link style

ASoC is now supporting modern style dai_link
(= snd_soc_dai_link_component) for CPU/Codec/Platform.
This patch switches to use it.

mpc8610_hpcd/p1022_ds/p1022_rdk are sharing fsl_asoc_get_dma_channel()
which setups platform. We need to update these by 1 patch.
Signed-off-by: default avatarKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 893f1951
...@@ -57,7 +57,7 @@ int fsl_asoc_get_dma_channel(struct device_node *ssi_np, ...@@ -57,7 +57,7 @@ int fsl_asoc_get_dma_channel(struct device_node *ssi_np,
of_node_put(dma_channel_np); of_node_put(dma_channel_np);
return ret; return ret;
} }
snprintf((char *)dai->platform_name, DAI_NAME_SIZE, "%llx.%pOFn", snprintf((char *)dai->platforms->name, DAI_NAME_SIZE, "%llx.%pOFn",
(unsigned long long) res.start, dma_channel_np); (unsigned long long) res.start, dma_channel_np);
iprop = of_get_property(dma_channel_np, "cell-index", NULL); iprop = of_get_property(dma_channel_np, "cell-index", NULL);
......
...@@ -189,6 +189,7 @@ static int mpc8610_hpcd_probe(struct platform_device *pdev) ...@@ -189,6 +189,7 @@ static int mpc8610_hpcd_probe(struct platform_device *pdev)
struct device_node *np = ssi_pdev->dev.of_node; struct device_node *np = ssi_pdev->dev.of_node;
struct device_node *codec_np = NULL; struct device_node *codec_np = NULL;
struct mpc8610_hpcd_data *machine_data; struct mpc8610_hpcd_data *machine_data;
struct snd_soc_dai_link_component *comp;
int ret = -ENODEV; int ret = -ENODEV;
const char *sprop; const char *sprop;
const u32 *iprop; const u32 *iprop;
...@@ -206,14 +207,36 @@ static int mpc8610_hpcd_probe(struct platform_device *pdev) ...@@ -206,14 +207,36 @@ static int mpc8610_hpcd_probe(struct platform_device *pdev)
goto error_alloc; goto error_alloc;
} }
machine_data->dai[0].cpu_dai_name = dev_name(&ssi_pdev->dev); comp = devm_kzalloc(&pdev->dev, 6 * sizeof(*comp), GFP_KERNEL);
if (!comp) {
ret = -ENOMEM;
goto error_alloc;
}
machine_data->dai[0].cpus = &comp[0];
machine_data->dai[0].codecs = &comp[1];
machine_data->dai[0].platforms = &comp[2];
machine_data->dai[0].num_cpus = 1;
machine_data->dai[0].num_codecs = 1;
machine_data->dai[0].num_platforms = 1;
machine_data->dai[1].cpus = &comp[3];
machine_data->dai[1].codecs = &comp[4];
machine_data->dai[1].platforms = &comp[5];
machine_data->dai[1].num_cpus = 1;
machine_data->dai[1].num_codecs = 1;
machine_data->dai[1].num_platforms = 1;
machine_data->dai[0].cpus->dai_name = dev_name(&ssi_pdev->dev);
machine_data->dai[0].ops = &mpc8610_hpcd_ops; machine_data->dai[0].ops = &mpc8610_hpcd_ops;
/* ASoC core can match codec with device node */ /* ASoC core can match codec with device node */
machine_data->dai[0].codec_of_node = codec_np; machine_data->dai[0].codecs->of_node = codec_np;
/* The DAI name from the codec (snd_soc_dai_driver.name) */ /* The DAI name from the codec (snd_soc_dai_driver.name) */
machine_data->dai[0].codec_dai_name = "cs4270-hifi"; machine_data->dai[0].codecs->dai_name = "cs4270-hifi";
/* We register two DAIs per SSI, one for playback and the other for /* We register two DAIs per SSI, one for playback and the other for
* capture. Currently, we only support codecs that have one DAI for * capture. Currently, we only support codecs that have one DAI for
...@@ -306,7 +329,7 @@ static int mpc8610_hpcd_probe(struct platform_device *pdev) ...@@ -306,7 +329,7 @@ static int mpc8610_hpcd_probe(struct platform_device *pdev)
} }
/* Find the playback DMA channel to use. */ /* Find the playback DMA channel to use. */
machine_data->dai[0].platform_name = machine_data->platform_name[0]; machine_data->dai[0].platforms->name = machine_data->platform_name[0];
ret = fsl_asoc_get_dma_channel(np, "fsl,playback-dma", ret = fsl_asoc_get_dma_channel(np, "fsl,playback-dma",
&machine_data->dai[0], &machine_data->dai[0],
&machine_data->dma_channel_id[0], &machine_data->dma_channel_id[0],
...@@ -317,7 +340,7 @@ static int mpc8610_hpcd_probe(struct platform_device *pdev) ...@@ -317,7 +340,7 @@ static int mpc8610_hpcd_probe(struct platform_device *pdev)
} }
/* Find the capture DMA channel to use. */ /* Find the capture DMA channel to use. */
machine_data->dai[1].platform_name = machine_data->platform_name[1]; machine_data->dai[1].platforms->name = machine_data->platform_name[1];
ret = fsl_asoc_get_dma_channel(np, "fsl,capture-dma", ret = fsl_asoc_get_dma_channel(np, "fsl,capture-dma",
&machine_data->dai[1], &machine_data->dai[1],
&machine_data->dma_channel_id[1], &machine_data->dma_channel_id[1],
......
...@@ -199,6 +199,7 @@ static int p1022_ds_probe(struct platform_device *pdev) ...@@ -199,6 +199,7 @@ static int p1022_ds_probe(struct platform_device *pdev)
struct device_node *np = ssi_pdev->dev.of_node; struct device_node *np = ssi_pdev->dev.of_node;
struct device_node *codec_np = NULL; struct device_node *codec_np = NULL;
struct machine_data *mdata; struct machine_data *mdata;
struct snd_soc_dai_link_component *comp;
int ret = -ENODEV; int ret = -ENODEV;
const char *sprop; const char *sprop;
const u32 *iprop; const u32 *iprop;
...@@ -216,11 +217,34 @@ static int p1022_ds_probe(struct platform_device *pdev) ...@@ -216,11 +217,34 @@ static int p1022_ds_probe(struct platform_device *pdev)
goto error_put; goto error_put;
} }
mdata->dai[0].cpu_dai_name = dev_name(&ssi_pdev->dev); comp = devm_kzalloc(&pdev->dev, 6 * sizeof(*comp), GFP_KERNEL);
if (!comp) {
ret = -ENOMEM;
goto error_put;
}
mdata->dai[0].cpus = &comp[0];
mdata->dai[0].codecs = &comp[1];
mdata->dai[0].platforms = &comp[2];
mdata->dai[0].num_cpus = 1;
mdata->dai[0].num_codecs = 1;
mdata->dai[0].num_platforms = 1;
mdata->dai[1].cpus = &comp[3];
mdata->dai[1].codecs = &comp[4];
mdata->dai[1].platforms = &comp[5];
mdata->dai[1].num_cpus = 1;
mdata->dai[1].num_codecs = 1;
mdata->dai[1].num_platforms = 1;
mdata->dai[0].cpus->dai_name = dev_name(&ssi_pdev->dev);
mdata->dai[0].ops = &p1022_ds_ops; mdata->dai[0].ops = &p1022_ds_ops;
/* ASoC core can match codec with device node */ /* ASoC core can match codec with device node */
mdata->dai[0].codec_of_node = codec_np; mdata->dai[0].codecs->of_node = codec_np;
/* We register two DAIs per SSI, one for playback and the other for /* We register two DAIs per SSI, one for playback and the other for
* capture. We support codecs that have separate DAIs for both playback * capture. We support codecs that have separate DAIs for both playback
...@@ -229,8 +253,8 @@ static int p1022_ds_probe(struct platform_device *pdev) ...@@ -229,8 +253,8 @@ static int p1022_ds_probe(struct platform_device *pdev)
memcpy(&mdata->dai[1], &mdata->dai[0], sizeof(struct snd_soc_dai_link)); memcpy(&mdata->dai[1], &mdata->dai[0], sizeof(struct snd_soc_dai_link));
/* The DAI names from the codec (snd_soc_dai_driver.name) */ /* The DAI names from the codec (snd_soc_dai_driver.name) */
mdata->dai[0].codec_dai_name = "wm8776-hifi-playback"; mdata->dai[0].codecs->dai_name = "wm8776-hifi-playback";
mdata->dai[1].codec_dai_name = "wm8776-hifi-capture"; mdata->dai[1].codecs->dai_name = "wm8776-hifi-capture";
/* Get the device ID */ /* Get the device ID */
iprop = of_get_property(np, "cell-index", NULL); iprop = of_get_property(np, "cell-index", NULL);
...@@ -316,7 +340,7 @@ static int p1022_ds_probe(struct platform_device *pdev) ...@@ -316,7 +340,7 @@ static int p1022_ds_probe(struct platform_device *pdev)
} }
/* Find the playback DMA channel to use. */ /* Find the playback DMA channel to use. */
mdata->dai[0].platform_name = mdata->platform_name[0]; mdata->dai[0].platforms->name = mdata->platform_name[0];
ret = fsl_asoc_get_dma_channel(np, "fsl,playback-dma", &mdata->dai[0], ret = fsl_asoc_get_dma_channel(np, "fsl,playback-dma", &mdata->dai[0],
&mdata->dma_channel_id[0], &mdata->dma_channel_id[0],
&mdata->dma_id[0]); &mdata->dma_id[0]);
...@@ -326,7 +350,7 @@ static int p1022_ds_probe(struct platform_device *pdev) ...@@ -326,7 +350,7 @@ static int p1022_ds_probe(struct platform_device *pdev)
} }
/* Find the capture DMA channel to use. */ /* Find the capture DMA channel to use. */
mdata->dai[1].platform_name = mdata->platform_name[1]; mdata->dai[1].platforms->name = mdata->platform_name[1];
ret = fsl_asoc_get_dma_channel(np, "fsl,capture-dma", &mdata->dai[1], ret = fsl_asoc_get_dma_channel(np, "fsl,capture-dma", &mdata->dai[1],
&mdata->dma_channel_id[1], &mdata->dma_channel_id[1],
&mdata->dma_id[1]); &mdata->dma_id[1]);
......
...@@ -203,6 +203,7 @@ static int p1022_rdk_probe(struct platform_device *pdev) ...@@ -203,6 +203,7 @@ static int p1022_rdk_probe(struct platform_device *pdev)
struct device_node *np = ssi_pdev->dev.of_node; struct device_node *np = ssi_pdev->dev.of_node;
struct device_node *codec_np = NULL; struct device_node *codec_np = NULL;
struct machine_data *mdata; struct machine_data *mdata;
struct snd_soc_dai_link_component *comp;
const u32 *iprop; const u32 *iprop;
int ret; int ret;
...@@ -219,11 +220,33 @@ static int p1022_rdk_probe(struct platform_device *pdev) ...@@ -219,11 +220,33 @@ static int p1022_rdk_probe(struct platform_device *pdev)
goto error_put; goto error_put;
} }
mdata->dai[0].cpu_dai_name = dev_name(&ssi_pdev->dev); comp = devm_kzalloc(&pdev->dev, 6 * sizeof(*comp), GFP_KERNEL);
if (!comp) {
ret = -ENOMEM;
goto error_put;
}
mdata->dai[0].cpus = &comp[0];
mdata->dai[0].codecs = &comp[1];
mdata->dai[0].platforms = &comp[2];
mdata->dai[0].num_cpus = 1;
mdata->dai[0].num_codecs = 1;
mdata->dai[0].num_platforms = 1;
mdata->dai[1].cpus = &comp[3];
mdata->dai[1].codecs = &comp[4];
mdata->dai[1].platforms = &comp[5];
mdata->dai[1].num_cpus = 1;
mdata->dai[1].num_codecs = 1;
mdata->dai[1].num_platforms = 1;
mdata->dai[0].cpus->dai_name = dev_name(&ssi_pdev->dev);
mdata->dai[0].ops = &p1022_rdk_ops; mdata->dai[0].ops = &p1022_rdk_ops;
/* ASoC core can match codec with device node */ /* ASoC core can match codec with device node */
mdata->dai[0].codec_of_node = codec_np; mdata->dai[0].codecs->of_node = codec_np;
/* /*
* We register two DAIs per SSI, one for playback and the other for * We register two DAIs per SSI, one for playback and the other for
...@@ -233,8 +256,8 @@ static int p1022_rdk_probe(struct platform_device *pdev) ...@@ -233,8 +256,8 @@ static int p1022_rdk_probe(struct platform_device *pdev)
memcpy(&mdata->dai[1], &mdata->dai[0], sizeof(struct snd_soc_dai_link)); memcpy(&mdata->dai[1], &mdata->dai[0], sizeof(struct snd_soc_dai_link));
/* The DAI names from the codec (snd_soc_dai_driver.name) */ /* The DAI names from the codec (snd_soc_dai_driver.name) */
mdata->dai[0].codec_dai_name = "wm8960-hifi"; mdata->dai[0].codecs->dai_name = "wm8960-hifi";
mdata->dai[1].codec_dai_name = mdata->dai[0].codec_dai_name; mdata->dai[1].codecs->dai_name = mdata->dai[0].codecs->dai_name;
/* /*
* Configure the SSI for I2S slave mode. Older device trees have * Configure the SSI for I2S slave mode. Older device trees have
...@@ -266,7 +289,7 @@ static int p1022_rdk_probe(struct platform_device *pdev) ...@@ -266,7 +289,7 @@ static int p1022_rdk_probe(struct platform_device *pdev)
} }
/* Find the playback DMA channel to use. */ /* Find the playback DMA channel to use. */
mdata->dai[0].platform_name = mdata->platform_name[0]; mdata->dai[0].platforms->name = mdata->platform_name[0];
ret = fsl_asoc_get_dma_channel(np, "fsl,playback-dma", &mdata->dai[0], ret = fsl_asoc_get_dma_channel(np, "fsl,playback-dma", &mdata->dai[0],
&mdata->dma_channel_id[0], &mdata->dma_channel_id[0],
&mdata->dma_id[0]); &mdata->dma_id[0]);
...@@ -277,7 +300,7 @@ static int p1022_rdk_probe(struct platform_device *pdev) ...@@ -277,7 +300,7 @@ static int p1022_rdk_probe(struct platform_device *pdev)
} }
/* Find the capture DMA channel to use. */ /* Find the capture DMA channel to use. */
mdata->dai[1].platform_name = mdata->platform_name[1]; mdata->dai[1].platforms->name = mdata->platform_name[1];
ret = fsl_asoc_get_dma_channel(np, "fsl,capture-dma", &mdata->dai[1], ret = fsl_asoc_get_dma_channel(np, "fsl,capture-dma", &mdata->dai[1],
&mdata->dma_channel_id[1], &mdata->dma_channel_id[1],
&mdata->dma_id[1]); &mdata->dma_id[1]);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment