From 1628fc3f47717fc3c8d9cd5fd6c7bc7d3796927d Mon Sep 17 00:00:00 2001 From: Shunli Wang Date: Thu, 16 May 2019 17:54:37 +0800 Subject: ASoC: Mediatek: add memory interface data align This supports two data align settings. One is S32_LE and other is S24_LE. Signed-off-by: Shunli Wang Signed-off-by: Mark Brown --- sound/soc/mediatek/common/mtk-afe-fe-dai.c | 7 +++++++ sound/soc/mediatek/common/mtk-base-afe.h | 2 ++ 2 files changed, 9 insertions(+) (limited to 'sound/soc/mediatek') diff --git a/sound/soc/mediatek/common/mtk-afe-fe-dai.c b/sound/soc/mediatek/common/mtk-afe-fe-dai.c index fded11d14cde..19048c3dc324 100644 --- a/sound/soc/mediatek/common/mtk-afe-fe-dai.c +++ b/sound/soc/mediatek/common/mtk-afe-fe-dai.c @@ -241,6 +241,7 @@ int mtk_afe_fe_prepare(struct snd_pcm_substream *substream, struct mtk_base_afe *afe = snd_soc_dai_get_drvdata(dai); struct mtk_base_afe_memif *memif = &afe->memif[rtd->cpu_dai->id]; int hd_audio = 0; + int hd_align = 1; /* set hd mode */ switch (substream->runtime->format) { @@ -249,9 +250,11 @@ int mtk_afe_fe_prepare(struct snd_pcm_substream *substream, break; case SNDRV_PCM_FORMAT_S32_LE: hd_audio = 1; + hd_align = 1; break; case SNDRV_PCM_FORMAT_S24_LE: hd_audio = 1; + hd_align = 0; break; default: dev_err(afe->dev, "%s() error: unsupported format %d\n", @@ -262,6 +265,10 @@ int mtk_afe_fe_prepare(struct snd_pcm_substream *substream, mtk_regmap_update_bits(afe->regmap, memif->data->hd_reg, 1, hd_audio, memif->data->hd_shift); + mtk_regmap_update_bits(afe->regmap, memif->data->hd_align_reg, + memif->data->hd_align_mshift, + hd_align ? memif->data->hd_align_mshift : 0); + return 0; } EXPORT_SYMBOL_GPL(mtk_afe_fe_prepare); diff --git a/sound/soc/mediatek/common/mtk-base-afe.h b/sound/soc/mediatek/common/mtk-base-afe.h index bd8d5e0c6843..60cb609a9790 100644 --- a/sound/soc/mediatek/common/mtk-base-afe.h +++ b/sound/soc/mediatek/common/mtk-base-afe.h @@ -24,7 +24,9 @@ struct mtk_base_memif_data { int enable_reg; int enable_shift; int hd_reg; + int hd_align_reg; int hd_shift; + int hd_align_mshift; int msb_reg; int msb_shift; int agent_disable_reg; -- cgit v1.2.3