diff options
Diffstat (limited to 'sound/soc/codecs/wm8904.c')
-rw-r--r-- | sound/soc/codecs/wm8904.c | 111 |
1 files changed, 55 insertions, 56 deletions
diff --git a/sound/soc/codecs/wm8904.c b/sound/soc/codecs/wm8904.c index b178232c990c..0013afe48e66 100644 --- a/sound/soc/codecs/wm8904.c +++ b/sound/soc/codecs/wm8904.c | |||
@@ -2054,8 +2054,7 @@ static void wm8904_handle_pdata(struct snd_soc_codec *codec) | |||
2054 | static int wm8904_probe(struct snd_soc_codec *codec) | 2054 | static int wm8904_probe(struct snd_soc_codec *codec) |
2055 | { | 2055 | { |
2056 | struct wm8904_priv *wm8904 = snd_soc_codec_get_drvdata(codec); | 2056 | struct wm8904_priv *wm8904 = snd_soc_codec_get_drvdata(codec); |
2057 | struct wm8904_pdata *pdata = wm8904->pdata; | 2057 | int ret; |
2058 | int ret, i; | ||
2059 | 2058 | ||
2060 | codec->control_data = wm8904->regmap; | 2059 | codec->control_data = wm8904->regmap; |
2061 | 2060 | ||
@@ -2077,60 +2076,6 @@ static int wm8904_probe(struct snd_soc_codec *codec) | |||
2077 | return ret; | 2076 | return ret; |
2078 | } | 2077 | } |
2079 | 2078 | ||
2080 | /* Change some default settings - latch VU and enable ZC */ | ||
2081 | snd_soc_update_bits(codec, WM8904_ADC_DIGITAL_VOLUME_LEFT, | ||
2082 | WM8904_ADC_VU, WM8904_ADC_VU); | ||
2083 | snd_soc_update_bits(codec, WM8904_ADC_DIGITAL_VOLUME_RIGHT, | ||
2084 | WM8904_ADC_VU, WM8904_ADC_VU); | ||
2085 | snd_soc_update_bits(codec, WM8904_DAC_DIGITAL_VOLUME_LEFT, | ||
2086 | WM8904_DAC_VU, WM8904_DAC_VU); | ||
2087 | snd_soc_update_bits(codec, WM8904_DAC_DIGITAL_VOLUME_RIGHT, | ||
2088 | WM8904_DAC_VU, WM8904_DAC_VU); | ||
2089 | snd_soc_update_bits(codec, WM8904_ANALOGUE_OUT1_LEFT, | ||
2090 | WM8904_HPOUT_VU | WM8904_HPOUTLZC, | ||
2091 | WM8904_HPOUT_VU | WM8904_HPOUTLZC); | ||
2092 | snd_soc_update_bits(codec, WM8904_ANALOGUE_OUT1_RIGHT, | ||
2093 | WM8904_HPOUT_VU | WM8904_HPOUTRZC, | ||
2094 | WM8904_HPOUT_VU | WM8904_HPOUTRZC); | ||
2095 | snd_soc_update_bits(codec, WM8904_ANALOGUE_OUT2_LEFT, | ||
2096 | WM8904_LINEOUT_VU | WM8904_LINEOUTLZC, | ||
2097 | WM8904_LINEOUT_VU | WM8904_LINEOUTLZC); | ||
2098 | snd_soc_update_bits(codec, WM8904_ANALOGUE_OUT2_RIGHT, | ||
2099 | WM8904_LINEOUT_VU | WM8904_LINEOUTRZC, | ||
2100 | WM8904_LINEOUT_VU | WM8904_LINEOUTRZC); | ||
2101 | snd_soc_update_bits(codec, WM8904_CLOCK_RATES_0, | ||
2102 | WM8904_SR_MODE, 0); | ||
2103 | |||
2104 | /* Apply configuration from the platform data. */ | ||
2105 | if (wm8904->pdata) { | ||
2106 | for (i = 0; i < WM8904_GPIO_REGS; i++) { | ||
2107 | if (!pdata->gpio_cfg[i]) | ||
2108 | continue; | ||
2109 | |||
2110 | regmap_update_bits(wm8904->regmap, | ||
2111 | WM8904_GPIO_CONTROL_1 + i, | ||
2112 | 0xffff, | ||
2113 | pdata->gpio_cfg[i]); | ||
2114 | } | ||
2115 | |||
2116 | /* Zero is the default value for these anyway */ | ||
2117 | for (i = 0; i < WM8904_MIC_REGS; i++) | ||
2118 | regmap_update_bits(wm8904->regmap, | ||
2119 | WM8904_MIC_BIAS_CONTROL_0 + i, | ||
2120 | 0xffff, | ||
2121 | pdata->mic_cfg[i]); | ||
2122 | } | ||
2123 | |||
2124 | /* Set Class W by default - this will be managed by the Class | ||
2125 | * G widget at runtime where bypass paths are available. | ||
2126 | */ | ||
2127 | snd_soc_update_bits(codec, WM8904_CLASS_W_0, | ||
2128 | WM8904_CP_DYN_PWR, WM8904_CP_DYN_PWR); | ||
2129 | |||
2130 | /* Use normal bias source */ | ||
2131 | snd_soc_update_bits(codec, WM8904_BIAS_CONTROL_0, | ||
2132 | WM8904_POBCTRL, 0); | ||
2133 | |||
2134 | wm8904_handle_pdata(codec); | 2079 | wm8904_handle_pdata(codec); |
2135 | 2080 | ||
2136 | wm8904_add_widgets(codec); | 2081 | wm8904_add_widgets(codec); |
@@ -2234,6 +2179,60 @@ static __devinit int wm8904_i2c_probe(struct i2c_client *i2c, | |||
2234 | goto err_enable; | 2179 | goto err_enable; |
2235 | } | 2180 | } |
2236 | 2181 | ||
2182 | /* Change some default settings - latch VU and enable ZC */ | ||
2183 | regmap_update_bits(wm8904->regmap, WM8904_ADC_DIGITAL_VOLUME_LEFT, | ||
2184 | WM8904_ADC_VU, WM8904_ADC_VU); | ||
2185 | regmap_update_bits(wm8904->regmap, WM8904_ADC_DIGITAL_VOLUME_RIGHT, | ||
2186 | WM8904_ADC_VU, WM8904_ADC_VU); | ||
2187 | regmap_update_bits(wm8904->regmap, WM8904_DAC_DIGITAL_VOLUME_LEFT, | ||
2188 | WM8904_DAC_VU, WM8904_DAC_VU); | ||
2189 | regmap_update_bits(wm8904->regmap, WM8904_DAC_DIGITAL_VOLUME_RIGHT, | ||
2190 | WM8904_DAC_VU, WM8904_DAC_VU); | ||
2191 | regmap_update_bits(wm8904->regmap, WM8904_ANALOGUE_OUT1_LEFT, | ||
2192 | WM8904_HPOUT_VU | WM8904_HPOUTLZC, | ||
2193 | WM8904_HPOUT_VU | WM8904_HPOUTLZC); | ||
2194 | regmap_update_bits(wm8904->regmap, WM8904_ANALOGUE_OUT1_RIGHT, | ||
2195 | WM8904_HPOUT_VU | WM8904_HPOUTRZC, | ||
2196 | WM8904_HPOUT_VU | WM8904_HPOUTRZC); | ||
2197 | regmap_update_bits(wm8904->regmap, WM8904_ANALOGUE_OUT2_LEFT, | ||
2198 | WM8904_LINEOUT_VU | WM8904_LINEOUTLZC, | ||
2199 | WM8904_LINEOUT_VU | WM8904_LINEOUTLZC); | ||
2200 | regmap_update_bits(wm8904->regmap, WM8904_ANALOGUE_OUT2_RIGHT, | ||
2201 | WM8904_LINEOUT_VU | WM8904_LINEOUTRZC, | ||
2202 | WM8904_LINEOUT_VU | WM8904_LINEOUTRZC); | ||
2203 | regmap_update_bits(wm8904->regmap, WM8904_CLOCK_RATES_0, | ||
2204 | WM8904_SR_MODE, 0); | ||
2205 | |||
2206 | /* Apply configuration from the platform data. */ | ||
2207 | if (wm8904->pdata) { | ||
2208 | for (i = 0; i < WM8904_GPIO_REGS; i++) { | ||
2209 | if (!wm8904->pdata->gpio_cfg[i]) | ||
2210 | continue; | ||
2211 | |||
2212 | regmap_update_bits(wm8904->regmap, | ||
2213 | WM8904_GPIO_CONTROL_1 + i, | ||
2214 | 0xffff, | ||
2215 | wm8904->pdata->gpio_cfg[i]); | ||
2216 | } | ||
2217 | |||
2218 | /* Zero is the default value for these anyway */ | ||
2219 | for (i = 0; i < WM8904_MIC_REGS; i++) | ||
2220 | regmap_update_bits(wm8904->regmap, | ||
2221 | WM8904_MIC_BIAS_CONTROL_0 + i, | ||
2222 | 0xffff, | ||
2223 | wm8904->pdata->mic_cfg[i]); | ||
2224 | } | ||
2225 | |||
2226 | /* Set Class W by default - this will be managed by the Class | ||
2227 | * G widget at runtime where bypass paths are available. | ||
2228 | */ | ||
2229 | regmap_update_bits(wm8904->regmap, WM8904_CLASS_W_0, | ||
2230 | WM8904_CP_DYN_PWR, WM8904_CP_DYN_PWR); | ||
2231 | |||
2232 | /* Use normal bias source */ | ||
2233 | regmap_update_bits(wm8904->regmap, WM8904_BIAS_CONTROL_0, | ||
2234 | WM8904_POBCTRL, 0); | ||
2235 | |||
2237 | /* Can leave the device powered off until we need it */ | 2236 | /* Can leave the device powered off until we need it */ |
2238 | regcache_cache_only(wm8904->regmap, true); | 2237 | regcache_cache_only(wm8904->regmap, true); |
2239 | regulator_bulk_disable(ARRAY_SIZE(wm8904->supplies), wm8904->supplies); | 2238 | regulator_bulk_disable(ARRAY_SIZE(wm8904->supplies), wm8904->supplies); |