summaryrefslogtreecommitdiffstats
path: root/sound/soc/codecs/es8328.c
diff options
context:
space:
mode:
authorJohn Keeping <john@metanate.com>2016-05-09 12:24:34 +0100
committerMark Brown <broonie@kernel.org>2016-05-10 18:56:01 +0100
commit8865c95e43257e6676bc0f6b042ecce17eff74fe (patch)
tree7fedd1819643b7b4e16290be2d0baef9a3ee7b3e /sound/soc/codecs/es8328.c
parentf2ed04a4317e5c8074d98a5c1da175596811a2d8 (diff)
downloadlinux-stable-8865c95e43257e6676bc0f6b042ecce17eff74fe.tar.gz
linux-stable-8865c95e43257e6676bc0f6b042ecce17eff74fe.tar.bz2
linux-stable-8865c95e43257e6676bc0f6b042ecce17eff74fe.zip
ASoC: es8328: Move sample size setup to hw_params
This is a refactor in preparation for supporting more sample sizes which has no functional change. Signed-off-by: John Keeping <john@metanate.com> Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/codecs/es8328.c')
-rw-r--r--sound/soc/codecs/es8328.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/sound/soc/codecs/es8328.c b/sound/soc/codecs/es8328.c
index d580300d9220..c5a36e65fc40 100644
--- a/sound/soc/codecs/es8328.c
+++ b/sound/soc/codecs/es8328.c
@@ -482,9 +482,16 @@ static int es8328_hw_params(struct snd_pcm_substream *substream,
ratio = mclk_ratios[i].ratio;
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ snd_soc_update_bits(codec, ES8328_DACCONTROL1,
+ ES8328_DACCONTROL1_DACWL_MASK,
+ ES8328_DACCONTROL1_DACWL_16);
+
es8328->playback_fs = params_rate(params);
es8328_set_deemph(codec);
- }
+ } else
+ snd_soc_update_bits(codec, ES8328_ADCCONTROL4,
+ ES8328_ADCCONTROL4_ADCWL_MASK,
+ ES8328_ADCCONTROL4_ADCWL_16);
return snd_soc_update_bits(codec, reg, ES8328_RATEMASK, ratio);
}
@@ -493,8 +500,8 @@ static int es8328_set_dai_fmt(struct snd_soc_dai *codec_dai,
unsigned int fmt)
{
struct snd_soc_codec *codec = codec_dai->codec;
- u8 dac_mode = ES8328_DACCONTROL1_DACWL_16;
- u8 adc_mode = ES8328_ADCCONTROL4_ADCWL_16;
+ u8 dac_mode = 0;
+ u8 adc_mode = 0;
/* set master/slave audio interface */
if ((fmt & SND_SOC_DAIFMT_MASTER_MASK) != SND_SOC_DAIFMT_CBM_CFM)
@@ -522,8 +529,10 @@ static int es8328_set_dai_fmt(struct snd_soc_dai *codec_dai,
if ((fmt & SND_SOC_DAIFMT_INV_MASK) != SND_SOC_DAIFMT_NB_NF)
return -EINVAL;
- snd_soc_write(codec, ES8328_DACCONTROL1, dac_mode);
- snd_soc_write(codec, ES8328_ADCCONTROL4, adc_mode);
+ snd_soc_update_bits(codec, ES8328_DACCONTROL1,
+ ES8328_DACCONTROL1_DACFORMAT_MASK, dac_mode);
+ snd_soc_update_bits(codec, ES8328_ADCCONTROL4,
+ ES8328_ADCCONTROL4_ADCFORMAT_MASK, adc_mode);
/* Master serial port mode, with BCLK generated automatically */
snd_soc_update_bits(codec, ES8328_MASTERMODE,