diff options
author | Nicolin Chen <nicoleotsuka@gmail.com> | 2014-10-24 19:48:13 -0400 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2014-11-25 07:47:32 -0500 |
commit | cb3fc1ff46667ee4ab23ef22c9e391aa7d014cdf (patch) | |
tree | db63c8594062ba0ad96af6d95e6ec789614503ac /sound/soc/fsl | |
parent | 41282920aa35033a4fcf2bc68aeba42a037e6c4d (diff) |
ASoC: fsl-asoc-card: Add slot_width setting for cpu-dai
ESAI may need to use fixed slot width to comply with external
CODEC. So this set_tdm_slot() call will allow the ESAI driver
to override its default dynamic slot width policy.
Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/fsl')
-rw-r--r-- | sound/soc/fsl/fsl-asoc-card.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/sound/soc/fsl/fsl-asoc-card.c b/sound/soc/fsl/fsl-asoc-card.c index 14572e62dd51..3f6959c8e2f7 100644 --- a/sound/soc/fsl/fsl-asoc-card.c +++ b/sound/soc/fsl/fsl-asoc-card.c | |||
@@ -51,6 +51,7 @@ struct codec_priv { | |||
51 | * @sysclk_freq[2]: SYSCLK rates for set_sysclk() | 51 | * @sysclk_freq[2]: SYSCLK rates for set_sysclk() |
52 | * @sysclk_dir[2]: SYSCLK directions for set_sysclk() | 52 | * @sysclk_dir[2]: SYSCLK directions for set_sysclk() |
53 | * @sysclk_id[2]: SYSCLK ids for set_sysclk() | 53 | * @sysclk_id[2]: SYSCLK ids for set_sysclk() |
54 | * @slot_width: Slot width of each frame | ||
54 | * | 55 | * |
55 | * Note: [1] for tx and [0] for rx | 56 | * Note: [1] for tx and [0] for rx |
56 | */ | 57 | */ |
@@ -58,6 +59,7 @@ struct cpu_priv { | |||
58 | unsigned long sysclk_freq[2]; | 59 | unsigned long sysclk_freq[2]; |
59 | u32 sysclk_dir[2]; | 60 | u32 sysclk_dir[2]; |
60 | u32 sysclk_id[2]; | 61 | u32 sysclk_id[2]; |
62 | u32 slot_width; | ||
61 | }; | 63 | }; |
62 | 64 | ||
63 | /** | 65 | /** |
@@ -142,6 +144,15 @@ static int fsl_asoc_card_hw_params(struct snd_pcm_substream *substream, | |||
142 | return ret; | 144 | return ret; |
143 | } | 145 | } |
144 | 146 | ||
147 | if (cpu_priv->slot_width) { | ||
148 | ret = snd_soc_dai_set_tdm_slot(rtd->cpu_dai, 0x3, 0x3, 2, | ||
149 | cpu_priv->slot_width); | ||
150 | if (ret) { | ||
151 | dev_err(dev, "failed to set TDM slot for cpu dai\n"); | ||
152 | return ret; | ||
153 | } | ||
154 | } | ||
155 | |||
145 | return 0; | 156 | return 0; |
146 | } | 157 | } |
147 | 158 | ||
@@ -453,6 +464,7 @@ static int fsl_asoc_card_probe(struct platform_device *pdev) | |||
453 | priv->cpu_priv.sysclk_freq[RX] = priv->codec_priv.mclk_freq; | 464 | priv->cpu_priv.sysclk_freq[RX] = priv->codec_priv.mclk_freq; |
454 | priv->cpu_priv.sysclk_dir[TX] = SND_SOC_CLOCK_OUT; | 465 | priv->cpu_priv.sysclk_dir[TX] = SND_SOC_CLOCK_OUT; |
455 | priv->cpu_priv.sysclk_dir[RX] = SND_SOC_CLOCK_OUT; | 466 | priv->cpu_priv.sysclk_dir[RX] = SND_SOC_CLOCK_OUT; |
467 | priv->cpu_priv.slot_width = 32; | ||
456 | priv->dai_fmt |= SND_SOC_DAIFMT_CBS_CFS; | 468 | priv->dai_fmt |= SND_SOC_DAIFMT_CBS_CFS; |
457 | } else if (of_device_is_compatible(np, "fsl,imx-audio-sgtl5000")) { | 469 | } else if (of_device_is_compatible(np, "fsl,imx-audio-sgtl5000")) { |
458 | priv->codec_priv.mclk_id = SGTL5000_SYSCLK; | 470 | priv->codec_priv.mclk_id = SGTL5000_SYSCLK; |