summaryrefslogtreecommitdiffstats
path: root/sound/soc/sti/uniperif.h
diff options
context:
space:
mode:
authorMoise Gergaud <moise.gergaud@st.com>2016-04-07 11:25:35 +0200
committerMark Brown <broonie@kernel.org>2016-04-12 04:59:09 +0100
commit8d8b1e2eddaef25ca0a18500dd9425638f1cfd02 (patch)
tree2c8a4a60e30e3230dacf4aaec1cb248369b0f887 /sound/soc/sti/uniperif.h
parent72199787662612a7747248f8b56bc5d42694538f (diff)
downloadlinux-stable-8d8b1e2eddaef25ca0a18500dd9425638f1cfd02.tar.gz
linux-stable-8d8b1e2eddaef25ca0a18500dd9425638f1cfd02.tar.bz2
linux-stable-8d8b1e2eddaef25ca0a18500dd9425638f1cfd02.zip
ASoC: sti: unip player tdm mode
here are the changes to enable player tdm mode: - When TDM_ENABLE is set to 1, the i2s format should be automatically configured. Unfortunately this is not the case (HW bug). Then, we shall force DATA_SIZE setting. - Compute the transfer size for tdm mode: transfer size = user frame size - Manage tdm slots configuration given in DT. - Don't use mclk-fs when unip in tdm mode; use tdm slot config to compute frame size and to set mclk rate. - Refine the hw param (channels & format) according to tdm slot config. Signed-off-by: Moise Gergaud <moise.gergaud@st.com> Acked-by: Arnaud Pouliquen <arnaud.pouliquen@st.com> Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/sti/uniperif.h')
-rw-r--r--sound/soc/sti/uniperif.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/sound/soc/sti/uniperif.h b/sound/soc/sti/uniperif.h
index 17d5d1030741..d0e24468478c 100644
--- a/sound/soc/sti/uniperif.h
+++ b/sound/soc/sti/uniperif.h
@@ -1389,6 +1389,17 @@ int sti_uniperiph_dai_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params,
struct snd_soc_dai *dai);
+static inline int sti_uniperiph_get_user_frame_size(
+ struct snd_pcm_runtime *runtime)
+{
+ return (runtime->channels * snd_pcm_format_width(runtime->format) / 8);
+}
+
+static inline int sti_uniperiph_get_unip_tdm_frame_size(struct uniperif *uni)
+{
+ return (uni->tdm_slot.slots * uni->tdm_slot.slot_width / 8);
+}
+
int sti_uniperiph_set_tdm_slot(struct snd_soc_dai *dai, unsigned int tx_mask,
unsigned int rx_mask, int slots,
int slot_width);