diff options
-rw-r--r-- | Documentation/devicetree/bindings/sound/simple-card.txt | 6 | ||||
-rw-r--r-- | sound/soc/generic/simple-card.c | 20 |
2 files changed, 20 insertions, 6 deletions
diff --git a/Documentation/devicetree/bindings/sound/simple-card.txt b/Documentation/devicetree/bindings/sound/simple-card.txt index b30c222f9cd3..881914b139ca 100644 --- a/Documentation/devicetree/bindings/sound/simple-card.txt +++ b/Documentation/devicetree/bindings/sound/simple-card.txt | |||
@@ -43,6 +43,12 @@ Optional CPU/CODEC subnodes properties: | |||
43 | clock node (= common clock), or "system-clock-frequency" | 43 | clock node (= common clock), or "system-clock-frequency" |
44 | (if system doens't support common clock) | 44 | (if system doens't support common clock) |
45 | 45 | ||
46 | Note: | ||
47 | * For 'format', 'frame-master', 'bitclock-master', 'bitclock-inversion' and | ||
48 | 'frame-inversion', the simple card will use the settings of CODEC for both | ||
49 | CPU and CODEC sides as we need to keep the settings identical for both ends | ||
50 | of the link. | ||
51 | |||
46 | Example: | 52 | Example: |
47 | 53 | ||
48 | sound { | 54 | sound { |
diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c index ca7e63ef858a..2ee8ed56bcf1 100644 --- a/sound/soc/generic/simple-card.c +++ b/sound/soc/generic/simple-card.c | |||
@@ -151,6 +151,8 @@ static int asoc_simple_card_parse_of(struct device_node *node, | |||
151 | struct device *dev) | 151 | struct device *dev) |
152 | { | 152 | { |
153 | struct snd_soc_dai_link *dai_link = priv->snd_card.dai_link; | 153 | struct snd_soc_dai_link *dai_link = priv->snd_card.dai_link; |
154 | struct asoc_simple_dai *codec_dai = &priv->codec_dai; | ||
155 | struct asoc_simple_dai *cpu_dai = &priv->cpu_dai; | ||
154 | struct device_node *np; | 156 | struct device_node *np; |
155 | char *name; | 157 | char *name; |
156 | unsigned int daifmt; | 158 | unsigned int daifmt; |
@@ -184,7 +186,7 @@ static int asoc_simple_card_parse_of(struct device_node *node, | |||
184 | np = of_get_child_by_name(node, "simple-audio-card,cpu"); | 186 | np = of_get_child_by_name(node, "simple-audio-card,cpu"); |
185 | if (np) { | 187 | if (np) { |
186 | ret = asoc_simple_card_sub_parse_of(np, daifmt, | 188 | ret = asoc_simple_card_sub_parse_of(np, daifmt, |
187 | &priv->cpu_dai, | 189 | cpu_dai, |
188 | &dai_link->cpu_of_node, | 190 | &dai_link->cpu_of_node, |
189 | &dai_link->cpu_dai_name); | 191 | &dai_link->cpu_dai_name); |
190 | of_node_put(np); | 192 | of_node_put(np); |
@@ -197,7 +199,7 @@ static int asoc_simple_card_parse_of(struct device_node *node, | |||
197 | np = of_get_child_by_name(node, "simple-audio-card,codec"); | 199 | np = of_get_child_by_name(node, "simple-audio-card,codec"); |
198 | if (np) { | 200 | if (np) { |
199 | ret = asoc_simple_card_sub_parse_of(np, daifmt, | 201 | ret = asoc_simple_card_sub_parse_of(np, daifmt, |
200 | &priv->codec_dai, | 202 | codec_dai, |
201 | &dai_link->codec_of_node, | 203 | &dai_link->codec_of_node, |
202 | &dai_link->codec_dai_name); | 204 | &dai_link->codec_dai_name); |
203 | of_node_put(np); | 205 | of_node_put(np); |
@@ -205,6 +207,12 @@ static int asoc_simple_card_parse_of(struct device_node *node, | |||
205 | if (ret < 0) | 207 | if (ret < 0) |
206 | return ret; | 208 | return ret; |
207 | 209 | ||
210 | /* | ||
211 | * overwrite cpu_dai->fmt as its DAIFMT_MASTER bit is based on CODEC | ||
212 | * while the other bits should be identical unless buggy SW/HW design. | ||
213 | */ | ||
214 | cpu_dai->fmt = codec_dai->fmt; | ||
215 | |||
208 | if (!dai_link->cpu_dai_name || !dai_link->codec_dai_name) | 216 | if (!dai_link->cpu_dai_name || !dai_link->codec_dai_name) |
209 | return -EINVAL; | 217 | return -EINVAL; |
210 | 218 | ||
@@ -226,12 +234,12 @@ static int asoc_simple_card_parse_of(struct device_node *node, | |||
226 | dev_dbg(dev, "platform : %04x\n", daifmt); | 234 | dev_dbg(dev, "platform : %04x\n", daifmt); |
227 | dev_dbg(dev, "cpu : %s / %04x / %d\n", | 235 | dev_dbg(dev, "cpu : %s / %04x / %d\n", |
228 | dai_link->cpu_dai_name, | 236 | dai_link->cpu_dai_name, |
229 | priv->cpu_dai.fmt, | 237 | cpu_dai->fmt, |
230 | priv->cpu_dai.sysclk); | 238 | cpu_dai->sysclk); |
231 | dev_dbg(dev, "codec : %s / %04x / %d\n", | 239 | dev_dbg(dev, "codec : %s / %04x / %d\n", |
232 | dai_link->codec_dai_name, | 240 | dai_link->codec_dai_name, |
233 | priv->codec_dai.fmt, | 241 | codec_dai->fmt, |
234 | priv->codec_dai.sysclk); | 242 | codec_dai->sysclk); |
235 | 243 | ||
236 | /* | 244 | /* |
237 | * soc_bind_dai_link() will check cpu name | 245 | * soc_bind_dai_link() will check cpu name |