aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/codecs/es8328.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2015-12-23 10:28:39 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2015-12-23 10:28:39 -0800
commita88164345b81292b55a8d4829fdd35c8d611cd7d (patch)
treebeaf46dbd0876d3f93bb55de0c789fc08d00211a /sound/soc/codecs/es8328.c
parentMerge tag 'drm-intel-fixes-2015-12-23' of git://anongit.freedesktop.org/drm-intel (diff)
parentMerge tag 'asoc-fix-v4.4-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into for-linus (diff)
downloadlinux-dev-a88164345b81292b55a8d4829fdd35c8d611cd7d.tar.xz
linux-dev-a88164345b81292b55a8d4829fdd35c8d611cd7d.zip
Merge tag 'sound-4.4-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound
Pull sound fixes from Takashi Iwai: "This shouldn't be a nightmare before Christmas: just a handful small device-specific fixes for various ASoC and HD-audio drivers. Most of them are stable fixes" * tag 'sound-4.4-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound: ALSA: hda/realtek - Fix silent headphone output on MacPro 4,1 (v2) ASoC: fsl_sai: fix no frame clk in master mode ALSA: hda - Set SKL+ hda controller power at freeze() and thaw() ASoC: sgtl5000: fix VAG power up timing ASoC: rockchip: spdif: Set transmit data level to 16 samples ASoC: wm8974: set cache type for regmap ASoC: es8328: Fix shifts for mixer switches ASoC: davinci-mcasp: Fix XDATA check in mcasp_start_tx ASoC: es8328: Fix deemphasis values
Diffstat (limited to 'sound/soc/codecs/es8328.c')
-rw-r--r--sound/soc/codecs/es8328.c25
1 files changed, 17 insertions, 8 deletions
diff --git a/sound/soc/codecs/es8328.c b/sound/soc/codecs/es8328.c
index 84f5eb07a91b..afa6c5db9dcc 100644
--- a/sound/soc/codecs/es8328.c
+++ b/sound/soc/codecs/es8328.c
@@ -85,7 +85,15 @@ static const DECLARE_TLV_DB_SCALE(pga_tlv, 0, 300, 0);
static const DECLARE_TLV_DB_SCALE(bypass_tlv, -1500, 300, 0);
static const DECLARE_TLV_DB_SCALE(mic_tlv, 0, 300, 0);
-static const int deemph_settings[] = { 0, 32000, 44100, 48000 };
+static const struct {
+ int rate;
+ unsigned int val;
+} deemph_settings[] = {
+ { 0, ES8328_DACCONTROL6_DEEMPH_OFF },
+ { 32000, ES8328_DACCONTROL6_DEEMPH_32k },
+ { 44100, ES8328_DACCONTROL6_DEEMPH_44_1k },
+ { 48000, ES8328_DACCONTROL6_DEEMPH_48k },
+};
static int es8328_set_deemph(struct snd_soc_codec *codec)
{
@@ -97,21 +105,22 @@ static int es8328_set_deemph(struct snd_soc_codec *codec)
* rate.
*/
if (es8328->deemph) {
- best = 1;
- for (i = 2; i < ARRAY_SIZE(deemph_settings); i++) {
- if (abs(deemph_settings[i] - es8328->playback_fs) <
- abs(deemph_settings[best] - es8328->playback_fs))
+ best = 0;
+ for (i = 1; i < ARRAY_SIZE(deemph_settings); i++) {
+ if (abs(deemph_settings[i].rate - es8328->playback_fs) <
+ abs(deemph_settings[best].rate - es8328->playback_fs))
best = i;
}
- val = best << 1;
+ val = deemph_settings[best].val;
} else {
- val = 0;
+ val = ES8328_DACCONTROL6_DEEMPH_OFF;
}
dev_dbg(codec->dev, "Set deemphasis %d\n", val);
- return snd_soc_update_bits(codec, ES8328_DACCONTROL6, 0x6, val);
+ return snd_soc_update_bits(codec, ES8328_DACCONTROL6,
+ ES8328_DACCONTROL6_DEEMPH_MASK, val);
}
static int es8328_get_deemph(struct snd_kcontrol *kcontrol,