aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMengdong Lin <mengdong.lin@linux.intel.com>2016-11-02 13:05:15 -0400
committerMark Brown <broonie@kernel.org>2016-11-04 13:26:46 -0400
commit9aa3f03473ce1187062bb0c68aeacf7b3ac52831 (patch)
treeebdd6fa6e643def7c0e31e5360b9664f1171ee12
parent3fbf793510c7628248a965972112fab958e6e3cf (diff)
ASoC: topology: Rename functions & variables for physical DAIs
Code refactoring. These functions and variables are for configuring physical DAIs, not only backend DAIs since users may not need DPCM. So remove 'be' from the function names, and rename variables 'be' to 'd' or 'dai'. Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com> Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r--sound/soc/soc-topology.c57
1 files changed, 29 insertions, 28 deletions
diff --git a/sound/soc/soc-topology.c b/sound/soc/soc-topology.c
index a839dc857e0d..f44f12eb1798 100644
--- a/sound/soc/soc-topology.c
+++ b/sound/soc/soc-topology.c
@@ -2081,16 +2081,16 @@ static int soc_tplg_link_elems_load(struct soc_tplg *tplg,
2081 return 0; 2081 return 0;
2082} 2082}
2083 2083
2084/* * 2084/**
2085 * soc_tplg_be_dai_config - Find and configure an existing BE DAI. 2085 * soc_tplg_dai_config - Find and configure an existing physical DAI.
2086 * @tplg: topology context 2086 * @tplg: topology context
2087 * @be: topology BE DAI configs. 2087 * @d: physical DAI configs.
2088 * 2088 *
2089 * The BE dai should already be registered by the platform driver. The 2089 * The physical dai should already be registered by the platform driver.
2090 * platform driver should specify the BE DAI name and ID for matching. 2090 * The platform driver should specify the DAI name and ID for matching.
2091 */ 2091 */
2092static int soc_tplg_be_dai_config(struct soc_tplg *tplg, 2092static int soc_tplg_dai_config(struct soc_tplg *tplg,
2093 struct snd_soc_tplg_dai *be) 2093 struct snd_soc_tplg_dai *d)
2094{ 2094{
2095 struct snd_soc_dai_link_component dai_component = {0}; 2095 struct snd_soc_dai_link_component dai_component = {0};
2096 struct snd_soc_dai *dai; 2096 struct snd_soc_dai *dai;
@@ -2099,17 +2099,17 @@ static int soc_tplg_be_dai_config(struct soc_tplg *tplg,
2099 struct snd_soc_tplg_stream_caps *caps; 2099 struct snd_soc_tplg_stream_caps *caps;
2100 int ret; 2100 int ret;
2101 2101
2102 dai_component.dai_name = be->dai_name; 2102 dai_component.dai_name = d->dai_name;
2103 dai = snd_soc_find_dai(&dai_component); 2103 dai = snd_soc_find_dai(&dai_component);
2104 if (!dai) { 2104 if (!dai) {
2105 dev_err(tplg->dev, "ASoC: BE DAI %s not registered\n", 2105 dev_err(tplg->dev, "ASoC: physical DAI %s not registered\n",
2106 be->dai_name); 2106 d->dai_name);
2107 return -EINVAL; 2107 return -EINVAL;
2108 } 2108 }
2109 2109
2110 if (be->dai_id != dai->id) { 2110 if (d->dai_id != dai->id) {
2111 dev_err(tplg->dev, "ASoC: BE DAI %s id mismatch\n", 2111 dev_err(tplg->dev, "ASoC: physical DAI %s id mismatch\n",
2112 be->dai_name); 2112 d->dai_name);
2113 return -EINVAL; 2113 return -EINVAL;
2114 } 2114 }
2115 2115
@@ -2117,20 +2117,20 @@ static int soc_tplg_be_dai_config(struct soc_tplg *tplg,
2117 if (!dai_drv) 2117 if (!dai_drv)
2118 return -EINVAL; 2118 return -EINVAL;
2119 2119
2120 if (be->playback) { 2120 if (d->playback) {
2121 stream = &dai_drv->playback; 2121 stream = &dai_drv->playback;
2122 caps = &be->caps[SND_SOC_TPLG_STREAM_PLAYBACK]; 2122 caps = &d->caps[SND_SOC_TPLG_STREAM_PLAYBACK];
2123 set_stream_info(stream, caps); 2123 set_stream_info(stream, caps);
2124 } 2124 }
2125 2125
2126 if (be->capture) { 2126 if (d->capture) {
2127 stream = &dai_drv->capture; 2127 stream = &dai_drv->capture;
2128 caps = &be->caps[SND_SOC_TPLG_STREAM_CAPTURE]; 2128 caps = &d->caps[SND_SOC_TPLG_STREAM_CAPTURE];
2129 set_stream_info(stream, caps); 2129 set_stream_info(stream, caps);
2130 } 2130 }
2131 2131
2132 if (be->flag_mask) 2132 if (d->flag_mask)
2133 set_dai_flags(dai_drv, be->flag_mask, be->flags); 2133 set_dai_flags(dai_drv, d->flag_mask, d->flags);
2134 2134
2135 /* pass control to component driver for optional further init */ 2135 /* pass control to component driver for optional further init */
2136 ret = soc_tplg_dai_load(tplg, dai_drv); 2136 ret = soc_tplg_dai_load(tplg, dai_drv);
@@ -2142,10 +2142,11 @@ static int soc_tplg_be_dai_config(struct soc_tplg *tplg,
2142 return 0; 2142 return 0;
2143} 2143}
2144 2144
2145static int soc_tplg_be_dai_elems_load(struct soc_tplg *tplg, 2145/* load physical DAI elements */
2146 struct snd_soc_tplg_hdr *hdr) 2146static int soc_tplg_dai_elems_load(struct soc_tplg *tplg,
2147 struct snd_soc_tplg_hdr *hdr)
2147{ 2148{
2148 struct snd_soc_tplg_dai *be; 2149 struct snd_soc_tplg_dai *dai;
2149 int count = hdr->count; 2150 int count = hdr->count;
2150 int i; 2151 int i;
2151 2152
@@ -2154,14 +2155,14 @@ static int soc_tplg_be_dai_elems_load(struct soc_tplg *tplg,
2154 2155
2155 /* config the existing BE DAIs */ 2156 /* config the existing BE DAIs */
2156 for (i = 0; i < count; i++) { 2157 for (i = 0; i < count; i++) {
2157 be = (struct snd_soc_tplg_dai *)tplg->pos; 2158 dai = (struct snd_soc_tplg_dai *)tplg->pos;
2158 if (be->size != sizeof(*be)) { 2159 if (dai->size != sizeof(*dai)) {
2159 dev_err(tplg->dev, "ASoC: invalid BE DAI size\n"); 2160 dev_err(tplg->dev, "ASoC: invalid physical DAI size\n");
2160 return -EINVAL; 2161 return -EINVAL;
2161 } 2162 }
2162 2163
2163 soc_tplg_be_dai_config(tplg, be); 2164 soc_tplg_dai_config(tplg, dai);
2164 tplg->pos += (sizeof(*be) + be->priv.size); 2165 tplg->pos += (sizeof(*dai) + dai->priv.size);
2165 } 2166 }
2166 2167
2167 dev_dbg(tplg->dev, "ASoC: Configure %d BE DAIs\n", count); 2168 dev_dbg(tplg->dev, "ASoC: Configure %d BE DAIs\n", count);
@@ -2329,7 +2330,7 @@ static int soc_tplg_load_header(struct soc_tplg *tplg,
2329 case SND_SOC_TPLG_TYPE_PCM: 2330 case SND_SOC_TPLG_TYPE_PCM:
2330 return soc_tplg_pcm_elems_load(tplg, hdr); 2331 return soc_tplg_pcm_elems_load(tplg, hdr);
2331 case SND_SOC_TPLG_TYPE_DAI: 2332 case SND_SOC_TPLG_TYPE_DAI:
2332 return soc_tplg_be_dai_elems_load(tplg, hdr); 2333 return soc_tplg_dai_elems_load(tplg, hdr);
2333 case SND_SOC_TPLG_TYPE_DAI_LINK: 2334 case SND_SOC_TPLG_TYPE_DAI_LINK:
2334 case SND_SOC_TPLG_TYPE_BACKEND_LINK: 2335 case SND_SOC_TPLG_TYPE_BACKEND_LINK:
2335 /* physical link configurations */ 2336 /* physical link configurations */