pcm1681.c (fa8173a3ef0570affde7da352de202190b3786c2) pcm1681.c (48f403be3eb9b603cfaf946ca7a0c76272750469)
1/*
2 * PCM1681 ASoC codec driver
3 *
4 * Copyright (c) StreamUnlimited GmbH 2013
5 * Marek Belisko <marek.belisko@streamunlimited.com>
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License

--- 81 unchanged lines hidden (view full) ---

90
91static const int pcm1681_deemph[] = { 44100, 48000, 32000 };
92
93static int pcm1681_set_deemph(struct snd_soc_codec *codec)
94{
95 struct pcm1681_private *priv = snd_soc_codec_get_drvdata(codec);
96 int i = 0, val = -1, enable = 0;
97
1/*
2 * PCM1681 ASoC codec driver
3 *
4 * Copyright (c) StreamUnlimited GmbH 2013
5 * Marek Belisko <marek.belisko@streamunlimited.com>
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License

--- 81 unchanged lines hidden (view full) ---

90
91static const int pcm1681_deemph[] = { 44100, 48000, 32000 };
92
93static int pcm1681_set_deemph(struct snd_soc_codec *codec)
94{
95 struct pcm1681_private *priv = snd_soc_codec_get_drvdata(codec);
96 int i = 0, val = -1, enable = 0;
97
98 if (priv->deemph)
99 for (i = 0; i < ARRAY_SIZE(pcm1681_deemph); i++)
100 if (pcm1681_deemph[i] == priv->rate)
98 if (priv->deemph) {
99 for (i = 0; i < ARRAY_SIZE(pcm1681_deemph); i++) {
100 if (pcm1681_deemph[i] == priv->rate) {
101 val = i;
101 val = i;
102 break;
103 }
104 }
105 }
102
103 if (val != -1) {
104 regmap_update_bits(priv->regmap, PCM1681_DEEMPH_CONTROL,
105 PCM1681_DEEMPH_RATE_MASK, val << 3);
106 enable = 1;
106
107 if (val != -1) {
108 regmap_update_bits(priv->regmap, PCM1681_DEEMPH_CONTROL,
109 PCM1681_DEEMPH_RATE_MASK, val << 3);
110 enable = 1;
107 } else
111 } else {
108 enable = 0;
112 enable = 0;
113 }
109
110 /* enable/disable deemphasis functionality */
111 return regmap_update_bits(priv->regmap, PCM1681_DEEMPH_CONTROL,
112 PCM1681_DEEMPH_MASK, enable);
113}
114
115static int pcm1681_get_deemph(struct snd_kcontrol *kcontrol,
116 struct snd_ctl_elem_value *ucontrol)

--- 229 unchanged lines hidden ---
114
115 /* enable/disable deemphasis functionality */
116 return regmap_update_bits(priv->regmap, PCM1681_DEEMPH_CONTROL,
117 PCM1681_DEEMPH_MASK, enable);
118}
119
120static int pcm1681_get_deemph(struct snd_kcontrol *kcontrol,
121 struct snd_ctl_elem_value *ucontrol)

--- 229 unchanged lines hidden ---