aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/codecs/sn95031.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/soc/codecs/sn95031.c')
-rw-r--r--sound/soc/codecs/sn95031.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/sound/soc/codecs/sn95031.c b/sound/soc/codecs/sn95031.c
index 84ffdebb8a8b..f681e41fc12e 100644
--- a/sound/soc/codecs/sn95031.c
+++ b/sound/soc/codecs/sn95031.c
@@ -79,7 +79,7 @@ static void configure_adc(struct snd_soc_codec *sn95031_codec, int val)
79 */ 79 */
80static int find_free_channel(struct snd_soc_codec *sn95031_codec) 80static int find_free_channel(struct snd_soc_codec *sn95031_codec)
81{ 81{
82 int ret = 0, i, value; 82 int i, value;
83 83
84 /* check whether ADC is enabled */ 84 /* check whether ADC is enabled */
85 value = snd_soc_read(sn95031_codec, SN95031_ADC1CNTL1); 85 value = snd_soc_read(sn95031_codec, SN95031_ADC1CNTL1);
@@ -91,12 +91,10 @@ static int find_free_channel(struct snd_soc_codec *sn95031_codec)
91 for (i = 0; i < SN95031_ADC_CHANLS_MAX; i++) { 91 for (i = 0; i < SN95031_ADC_CHANLS_MAX; i++) {
92 value = snd_soc_read(sn95031_codec, 92 value = snd_soc_read(sn95031_codec,
93 SN95031_ADC_CHNL_START_ADDR + i); 93 SN95031_ADC_CHNL_START_ADDR + i);
94 if (value & SN95031_STOPBIT_MASK) { 94 if (value & SN95031_STOPBIT_MASK)
95 ret = i;
96 break; 95 break;
97 }
98 } 96 }
99 return (ret > SN95031_ADC_LOOP_MAX) ? (-EINVAL) : ret; 97 return (i == SN95031_ADC_CHANLS_MAX) ? (-EINVAL) : i;
100} 98}
101 99
102/* Initialize the ADC for reading micbias values. Can sleep. */ 100/* Initialize the ADC for reading micbias values. Can sleep. */
@@ -104,7 +102,7 @@ static int sn95031_initialize_adc(struct snd_soc_codec *sn95031_codec)
104{ 102{
105 int base_addr, chnl_addr; 103 int base_addr, chnl_addr;
106 int value; 104 int value;
107 static int channel_index; 105 int channel_index;
108 106
109 /* Index of the first channel in which the stop bit is set */ 107 /* Index of the first channel in which the stop bit is set */
110 channel_index = find_free_channel(sn95031_codec); 108 channel_index = find_free_channel(sn95031_codec);
@@ -163,7 +161,6 @@ static unsigned int sn95031_get_mic_bias(struct snd_soc_codec *codec)
163 pr_debug("mic bias = %dmV\n", mic_bias); 161 pr_debug("mic bias = %dmV\n", mic_bias);
164 return mic_bias; 162 return mic_bias;
165} 163}
166EXPORT_SYMBOL_GPL(sn95031_get_mic_bias);
167/*end - adc helper functions */ 164/*end - adc helper functions */
168 165
169static inline unsigned int sn95031_read(struct snd_soc_codec *codec, 166static inline unsigned int sn95031_read(struct snd_soc_codec *codec,
@@ -660,7 +657,7 @@ static int sn95031_pcm_spkr_mute(struct snd_soc_dai *dai, int mute)
660 return 0; 657 return 0;
661} 658}
662 659
663int sn95031_pcm_hw_params(struct snd_pcm_substream *substream, 660static int sn95031_pcm_hw_params(struct snd_pcm_substream *substream,
664 struct snd_pcm_hw_params *params, struct snd_soc_dai *dai) 661 struct snd_pcm_hw_params *params, struct snd_soc_dai *dai)
665{ 662{
666 unsigned int format, rate; 663 unsigned int format, rate;
@@ -718,7 +715,7 @@ static struct snd_soc_dai_ops sn95031_vib2_dai_ops = {
718 .hw_params = sn95031_pcm_hw_params, 715 .hw_params = sn95031_pcm_hw_params,
719}; 716};
720 717
721struct snd_soc_dai_driver sn95031_dais[] = { 718static struct snd_soc_dai_driver sn95031_dais[] = {
722{ 719{
723 .name = "SN95031 Headset", 720 .name = "SN95031 Headset",
724 .playback = { 721 .playback = {
@@ -829,7 +826,6 @@ static int sn95031_codec_probe(struct snd_soc_codec *codec)
829{ 826{
830 pr_debug("codec_probe called\n"); 827 pr_debug("codec_probe called\n");
831 828
832 codec->dapm.bias_level = SND_SOC_BIAS_OFF;
833 codec->dapm.idle_bias_off = 1; 829 codec->dapm.idle_bias_off = 1;
834 830
835 /* PCM interface config 831 /* PCM interface config