aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/generic/simple-card.c
diff options
context:
space:
mode:
authorLars-Peter Clausen <lars@metafoo.de>2015-03-23 21:07:08 -0400
committerMark Brown <broonie@kernel.org>2015-03-26 21:35:48 -0400
commit1efb53a220b78fdfdbb97b726a2156713e75bdab (patch)
tree5d1a9b68d843786eb865eacbdfca12afc25e3ba8 /sound/soc/generic/simple-card.c
parent947a37cd38796f5b196a934353165a001cbcb0a9 (diff)
ASoC: simple-card: Remove support for setting differing DAI formats
Having to set different formats on the CPU side and the CODEC side of a DAI link is usually indication that something is terribly wrong and in most cases is a result of a broken driver that implements a set_fmt() callback which does not follow the specification. In the past this feature has been used to work around broken drivers, rather than fixing them. We don't really want to encourage this, so remove support for setting different formats on both ends of the link. Along the way switch to static DAI format setup by setting the the dai_fmt field of the snd_soc_dai_link rather than calling snd_soc_dai_fmt(). Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/generic/simple-card.c')
-rw-r--r--sound/soc/generic/simple-card.c30
1 files changed, 8 insertions, 22 deletions
diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c
index f7c6734bd5da..3efd9472b8a3 100644
--- a/sound/soc/generic/simple-card.c
+++ b/sound/soc/generic/simple-card.c
@@ -125,14 +125,6 @@ static int __asoc_simple_card_dai_init(struct snd_soc_dai *dai,
125{ 125{
126 int ret; 126 int ret;
127 127
128 if (set->fmt) {
129 ret = snd_soc_dai_set_fmt(dai, set->fmt);
130 if (ret && ret != -ENOTSUPP) {
131 dev_err(dai->dev, "simple-card: set_fmt error\n");
132 goto err;
133 }
134 }
135
136 if (set->sysclk) { 128 if (set->sysclk) {
137 ret = snd_soc_dai_set_sysclk(dai, 0, set->sysclk, 0); 129 ret = snd_soc_dai_set_sysclk(dai, 0, set->sysclk, 0);
138 if (ret && ret != -ENOTSUPP) { 130 if (ret && ret != -ENOTSUPP) {
@@ -269,12 +261,10 @@ static int asoc_simple_card_parse_daifmt(struct device_node *node,
269 struct device_node *codec, 261 struct device_node *codec,
270 char *prefix, int idx) 262 char *prefix, int idx)
271{ 263{
264 struct snd_soc_dai_link *dai_link = simple_priv_to_link(priv, idx);
272 struct device *dev = simple_priv_to_dev(priv); 265 struct device *dev = simple_priv_to_dev(priv);
273 struct device_node *bitclkmaster = NULL; 266 struct device_node *bitclkmaster = NULL;
274 struct device_node *framemaster = NULL; 267 struct device_node *framemaster = NULL;
275 struct simple_dai_props *dai_props = simple_priv_to_props(priv, idx);
276 struct asoc_simple_dai *cpu_dai = &dai_props->cpu_dai;
277 struct asoc_simple_dai *codec_dai = &dai_props->codec_dai;
278 unsigned int daifmt; 268 unsigned int daifmt;
279 269
280 daifmt = snd_soc_of_parse_daifmt(node, prefix, 270 daifmt = snd_soc_of_parse_daifmt(node, prefix,
@@ -289,8 +279,7 @@ static int asoc_simple_card_parse_daifmt(struct device_node *node,
289 */ 279 */
290 dev_dbg(dev, "Revert to legacy daifmt parsing\n"); 280 dev_dbg(dev, "Revert to legacy daifmt parsing\n");
291 281
292 cpu_dai->fmt = codec_dai->fmt = 282 daifmt = snd_soc_of_parse_daifmt(codec, NULL, NULL, NULL) |
293 snd_soc_of_parse_daifmt(codec, NULL, NULL, NULL) |
294 (daifmt & ~SND_SOC_DAIFMT_CLOCK_MASK); 283 (daifmt & ~SND_SOC_DAIFMT_CLOCK_MASK);
295 } else { 284 } else {
296 if (codec == bitclkmaster) 285 if (codec == bitclkmaster)
@@ -299,11 +288,10 @@ static int asoc_simple_card_parse_daifmt(struct device_node *node,
299 else 288 else
300 daifmt |= (codec == framemaster) ? 289 daifmt |= (codec == framemaster) ?
301 SND_SOC_DAIFMT_CBS_CFM : SND_SOC_DAIFMT_CBS_CFS; 290 SND_SOC_DAIFMT_CBS_CFM : SND_SOC_DAIFMT_CBS_CFS;
302
303 cpu_dai->fmt = daifmt;
304 codec_dai->fmt = daifmt;
305 } 291 }
306 292
293 dai_link->dai_fmt = daifmt;
294
307 of_node_put(bitclkmaster); 295 of_node_put(bitclkmaster);
308 of_node_put(framemaster); 296 of_node_put(framemaster);
309 297
@@ -379,13 +367,12 @@ static int asoc_simple_card_dai_link_of(struct device_node *node,
379 dai_link->init = asoc_simple_card_dai_init; 367 dai_link->init = asoc_simple_card_dai_init;
380 368
381 dev_dbg(dev, "\tname : %s\n", dai_link->stream_name); 369 dev_dbg(dev, "\tname : %s\n", dai_link->stream_name);
382 dev_dbg(dev, "\tcpu : %s / %04x / %d\n", 370 dev_dbg(dev, "\tformat : %04x\n", dai_link->dai_fmt);
371 dev_dbg(dev, "\tcpu : %s / %d\n",
383 dai_link->cpu_dai_name, 372 dai_link->cpu_dai_name,
384 dai_props->cpu_dai.fmt,
385 dai_props->cpu_dai.sysclk); 373 dai_props->cpu_dai.sysclk);
386 dev_dbg(dev, "\tcodec : %s / %04x / %d\n", 374 dev_dbg(dev, "\tcodec : %s / %d\n",
387 dai_link->codec_dai_name, 375 dai_link->codec_dai_name,
388 dai_props->codec_dai.fmt,
389 dai_props->codec_dai.sysclk); 376 dai_props->codec_dai.sysclk);
390 377
391 /* 378 /*
@@ -572,14 +559,13 @@ static int asoc_simple_card_probe(struct platform_device *pdev)
572 dai_link->codec_name = cinfo->codec; 559 dai_link->codec_name = cinfo->codec;
573 dai_link->cpu_dai_name = cinfo->cpu_dai.name; 560 dai_link->cpu_dai_name = cinfo->cpu_dai.name;
574 dai_link->codec_dai_name = cinfo->codec_dai.name; 561 dai_link->codec_dai_name = cinfo->codec_dai.name;
562 dai_link->dai_fmt = cinfo->daifmt;
575 dai_link->init = asoc_simple_card_dai_init; 563 dai_link->init = asoc_simple_card_dai_init;
576 memcpy(&priv->dai_props->cpu_dai, &cinfo->cpu_dai, 564 memcpy(&priv->dai_props->cpu_dai, &cinfo->cpu_dai,
577 sizeof(priv->dai_props->cpu_dai)); 565 sizeof(priv->dai_props->cpu_dai));
578 memcpy(&priv->dai_props->codec_dai, &cinfo->codec_dai, 566 memcpy(&priv->dai_props->codec_dai, &cinfo->codec_dai,
579 sizeof(priv->dai_props->codec_dai)); 567 sizeof(priv->dai_props->codec_dai));
580 568
581 priv->dai_props->cpu_dai.fmt |= cinfo->daifmt;
582 priv->dai_props->codec_dai.fmt |= cinfo->daifmt;
583 } 569 }
584 570
585 snd_soc_card_set_drvdata(&priv->snd_card, priv); 571 snd_soc_card_set_drvdata(&priv->snd_card, priv);