aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKuninori Morimoto2021-01-15 13:52:54 +0900
committerMark Brown2021-01-21 12:37:43 +0000
commitf14654ddf2e982537ab476d392a87fcbf90374c3 (patch)
tree6eaf3523f3835f7ef7c06c4fe038de5711f3c024
parent80f454e283708c28f5220eda68511fc495e5ffaf (diff)
ASoC: sync parameter naming : rate / sample_bits
snd_pcm_runtime / snd_soc_dai / snd_soc_dai_driver / snd_soc_dai_link have related parameter which is similar but not same naming. struct snd_pcm_runtime { ... (A) unsigned int rate; ... (B) unsigned int sample_bits; ... }; struct snd_soc_dai { ... (A) unsigned int rate; (B) unsigned int sample_bits; ... }; struct snd_soc_dai_driver { ... (A) unsigned int symmetric_rates:1; (B) unsigned int symmetric_samplebits:1; ... }; struct snd_soc_dai_link { ... (A) unsigned int symmetric_rates:1; (B) unsigned int symmetric_samplebits:1; ... }; Because it is similar but not same naming rule, code can be verbose / can't share macro. This patch sync naming rule for framework. - xxx_rates; + xxx_rate; - xxx_samplebits; + xxx_sample_bits; old name will be removed if all drivers were switched to new naming rule. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Link: https://lore.kernel.org/r/87wnweolj6.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r--include/sound/soc-dai.h6
-rw-r--r--include/sound/soc.h4
-rw-r--r--sound/soc/rockchip/rockchip_i2s.c2
-rw-r--r--sound/soc/soc-core.c9
-rw-r--r--sound/soc/soc-pcm.c24
-rw-r--r--sound/soc/soc-topology.c8
6 files changed, 32 insertions, 21 deletions
diff --git a/include/sound/soc-dai.h b/include/sound/soc-dai.h
index 34d0dbf73ca9..ee3c6deb5719 100644
--- a/include/sound/soc-dai.h
+++ b/include/sound/soc-dai.h
@@ -353,9 +353,11 @@ struct snd_soc_dai_driver {
/* DAI capabilities */
struct snd_soc_pcm_stream capture;
struct snd_soc_pcm_stream playback;
- unsigned int symmetric_rates:1;
+ unsigned int symmetric_rates:1; /* will be removed */
+ unsigned int symmetric_rate:1;
unsigned int symmetric_channels:1;
- unsigned int symmetric_samplebits:1;
+ unsigned int symmetric_samplebits:1; /* will be removed */
+ unsigned int symmetric_sample_bits:1;
/* probe ordering - for components with runtime dependencies */
int probe_order;
diff --git a/include/sound/soc.h b/include/sound/soc.h
index 3fa6c40a63b7..bd38015d6c6d 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -685,9 +685,9 @@ struct snd_soc_dai_link {
unsigned int ignore_suspend:1;
/* Symmetry requirements */
- unsigned int symmetric_rates:1;
+ unsigned int symmetric_rate:1;
unsigned int symmetric_channels:1;
- unsigned int symmetric_samplebits:1;
+ unsigned int symmetric_sample_bits:1;
/* Do not create a PCM for this DAI link (Backend link) */
unsigned int no_pcm:1;
diff --git a/sound/soc/rockchip/rockchip_i2s.c b/sound/soc/rockchip/rockchip_i2s.c
index eae287d905eb..662de86eca11 100644
--- a/sound/soc/rockchip/rockchip_i2s.c
+++ b/sound/soc/rockchip/rockchip_i2s.c
@@ -373,7 +373,7 @@ static int rockchip_i2s_hw_params(struct snd_pcm_substream *substream,
I2S_DMACR_RDL(16));
val = I2S_CKR_TRCM_TXRX;
- if (dai->driver->symmetric_rates && rtd->dai_link->symmetric_rates)
+ if (dai->driver->symmetric_rate && rtd->dai_link->symmetric_rate)
val = I2S_CKR_TRCM_TXONLY;
regmap_update_bits(i2s->regmap, I2S_CKR,
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index f6d4e99b590c..bb8323cad51a 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -2509,6 +2509,15 @@ int snd_soc_register_component(struct device *dev,
{
struct snd_soc_component *component;
int ret;
+ int i;
+
+ /* Remove ME */
+ for (i = 0; i < num_dai; i++) {
+ if (dai_drv[i].symmetric_rates)
+ dai_drv[i].symmetric_rate = dai_drv[i].symmetric_rates;
+ if (dai_drv[i].symmetric_samplebits)
+ dai_drv[i].symmetric_sample_bits = dai_drv[i].symmetric_samplebits;
+ }
component = devm_kzalloc(dev, sizeof(*component), GFP_KERNEL);
if (!component)
diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c
index 6e9f14d482ab..1a5d0cb3dc69 100644
--- a/sound/soc/soc-pcm.c
+++ b/sound/soc/soc-pcm.c
@@ -349,8 +349,8 @@ static int soc_pcm_apply_symmetry(struct snd_pcm_substream *substream,
struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
int ret;
- if (soc_dai->rate && (soc_dai->driver->symmetric_rates ||
- rtd->dai_link->symmetric_rates)) {
+ if (soc_dai->rate && (soc_dai->driver->symmetric_rate ||
+ rtd->dai_link->symmetric_rate)) {
dev_dbg(soc_dai->dev, "ASoC: Symmetry forces %dHz rate\n",
soc_dai->rate);
@@ -381,8 +381,8 @@ static int soc_pcm_apply_symmetry(struct snd_pcm_substream *substream,
}
}
- if (soc_dai->sample_bits && (soc_dai->driver->symmetric_samplebits ||
- rtd->dai_link->symmetric_samplebits)) {
+ if (soc_dai->sample_bits && (soc_dai->driver->symmetric_sample_bits ||
+ rtd->dai_link->symmetric_sample_bits)) {
dev_dbg(soc_dai->dev, "ASoC: Symmetry forces %d sample bits\n",
soc_dai->sample_bits);
@@ -412,10 +412,10 @@ static int soc_pcm_params_symmetry(struct snd_pcm_substream *substream,
soc_pcm_set_dai_params(&d, params);
/* reject unmatched parameters when applying symmetry */
- symmetry = rtd->dai_link->symmetric_rates;
+ symmetry = rtd->dai_link->symmetric_rate;
for_each_rtd_cpu_dais(rtd, i, dai)
- symmetry |= dai->driver->symmetric_rates;
+ symmetry |= dai->driver->symmetric_rate;
if (symmetry) {
for_each_rtd_cpu_dais(rtd, i, cpu_dai) {
@@ -443,10 +443,10 @@ static int soc_pcm_params_symmetry(struct snd_pcm_substream *substream,
}
}
- symmetry = rtd->dai_link->symmetric_samplebits;
+ symmetry = rtd->dai_link->symmetric_sample_bits;
for_each_rtd_dais(rtd, i, dai)
- symmetry |= dai->driver->symmetric_samplebits;
+ symmetry |= dai->driver->symmetric_sample_bits;
if (symmetry) {
for_each_rtd_cpu_dais(rtd, i, cpu_dai) {
@@ -469,15 +469,15 @@ static bool soc_pcm_has_symmetry(struct snd_pcm_substream *substream)
struct snd_soc_dai *dai;
unsigned int symmetry, i;
- symmetry = link->symmetric_rates ||
+ symmetry = link->symmetric_rate ||
link->symmetric_channels ||
- link->symmetric_samplebits;
+ link->symmetric_sample_bits;
for_each_rtd_dais(rtd, i, dai)
symmetry = symmetry ||
- dai->driver->symmetric_rates ||
+ dai->driver->symmetric_rate ||
dai->driver->symmetric_channels ||
- dai->driver->symmetric_samplebits;
+ dai->driver->symmetric_sample_bits;
return symmetry;
}
diff --git a/sound/soc/soc-topology.c b/sound/soc/soc-topology.c
index 950c45008e24..27f7dd8fb7f6 100644
--- a/sound/soc/soc-topology.c
+++ b/sound/soc/soc-topology.c
@@ -1672,7 +1672,7 @@ static void set_dai_flags(struct snd_soc_dai_driver *dai_drv,
unsigned int flag_mask, unsigned int flags)
{
if (flag_mask & SND_SOC_TPLG_DAI_FLGBIT_SYMMETRIC_RATES)
- dai_drv->symmetric_rates =
+ dai_drv->symmetric_rate =
flags & SND_SOC_TPLG_DAI_FLGBIT_SYMMETRIC_RATES ? 1 : 0;
if (flag_mask & SND_SOC_TPLG_DAI_FLGBIT_SYMMETRIC_CHANNELS)
@@ -1681,7 +1681,7 @@ static void set_dai_flags(struct snd_soc_dai_driver *dai_drv,
1 : 0;
if (flag_mask & SND_SOC_TPLG_DAI_FLGBIT_SYMMETRIC_SAMPLEBITS)
- dai_drv->symmetric_samplebits =
+ dai_drv->symmetric_sample_bits =
flags & SND_SOC_TPLG_DAI_FLGBIT_SYMMETRIC_SAMPLEBITS ?
1 : 0;
}
@@ -1763,7 +1763,7 @@ static void set_link_flags(struct snd_soc_dai_link *link,
unsigned int flag_mask, unsigned int flags)
{
if (flag_mask & SND_SOC_TPLG_LNK_FLGBIT_SYMMETRIC_RATES)
- link->symmetric_rates =
+ link->symmetric_rate =
flags & SND_SOC_TPLG_LNK_FLGBIT_SYMMETRIC_RATES ? 1 : 0;
if (flag_mask & SND_SOC_TPLG_LNK_FLGBIT_SYMMETRIC_CHANNELS)
@@ -1772,7 +1772,7 @@ static void set_link_flags(struct snd_soc_dai_link *link,
1 : 0;
if (flag_mask & SND_SOC_TPLG_LNK_FLGBIT_SYMMETRIC_SAMPLEBITS)
- link->symmetric_samplebits =
+ link->symmetric_sample_bits =
flags & SND_SOC_TPLG_LNK_FLGBIT_SYMMETRIC_SAMPLEBITS ?
1 : 0;