@@ -165,57 +165,39 @@ static const struct snd_kcontrol_new stac9766_snd_ac97_controls[] = {
165
165
SOC_ENUM ("Pop Bypass Mux" , stac9766_popbypass_enum ),
166
166
};
167
167
168
- static int stac9766_ac97_write (struct snd_soc_codec * codec , unsigned int reg ,
169
- unsigned int val )
170
- {
171
- return snd_soc_write (codec , reg , val );
172
- }
173
-
174
- static unsigned int stac9766_ac97_read (struct snd_soc_codec * codec ,
175
- unsigned int reg )
176
- {
177
- return snd_soc_read (codec , reg );
178
- }
179
-
180
168
static int ac97_analog_prepare (struct snd_pcm_substream * substream ,
181
169
struct snd_soc_dai * dai )
182
170
{
183
171
struct snd_soc_codec * codec = dai -> codec ;
184
172
struct snd_pcm_runtime * runtime = substream -> runtime ;
185
- unsigned short reg , vra ;
186
-
187
- vra = stac9766_ac97_read (codec , AC97_EXTENDED_STATUS );
173
+ unsigned short reg ;
188
174
189
- vra |= 0x1 ; /* enable variable rate audio */
190
- vra &= ~0x4 ; /* disable SPDIF output */
191
-
192
- stac9766_ac97_write (codec , AC97_EXTENDED_STATUS , vra );
175
+ /* enable variable rate audio, disable SPDIF output */
176
+ snd_soc_update_bits (codec , AC97_EXTENDED_STATUS , 0x5 , 0x1 );
193
177
194
178
if (substream -> stream == SNDRV_PCM_STREAM_PLAYBACK )
195
179
reg = AC97_PCM_FRONT_DAC_RATE ;
196
180
else
197
181
reg = AC97_PCM_LR_ADC_RATE ;
198
182
199
- return stac9766_ac97_write (codec , reg , runtime -> rate );
183
+ return snd_soc_write (codec , reg , runtime -> rate );
200
184
}
201
185
202
186
static int ac97_digital_prepare (struct snd_pcm_substream * substream ,
203
187
struct snd_soc_dai * dai )
204
188
{
205
189
struct snd_soc_codec * codec = dai -> codec ;
206
190
struct snd_pcm_runtime * runtime = substream -> runtime ;
207
- unsigned short reg , vra ;
208
-
209
- stac9766_ac97_write (codec , AC97_SPDIF , 0x2002 );
191
+ unsigned short reg ;
210
192
211
- vra = stac9766_ac97_read (codec , AC97_EXTENDED_STATUS );
212
- vra |= 0x5 ; /* Enable VRA and SPDIF out */
193
+ snd_soc_write (codec , AC97_SPDIF , 0x2002 );
213
194
214
- stac9766_ac97_write (codec , AC97_EXTENDED_STATUS , vra );
195
+ /* Enable VRA and SPDIF out */
196
+ snd_soc_update_bits (codec , AC97_EXTENDED_STATUS , 0x5 , 0x5 );
215
197
216
198
reg = AC97_PCM_FRONT_DAC_RATE ;
217
199
218
- return stac9766_ac97_write (codec , reg , runtime -> rate );
200
+ return snd_soc_write (codec , reg , runtime -> rate );
219
201
}
220
202
221
203
static int stac9766_set_bias_level (struct snd_soc_codec * codec ,
@@ -225,11 +207,11 @@ static int stac9766_set_bias_level(struct snd_soc_codec *codec,
225
207
case SND_SOC_BIAS_ON : /* full On */
226
208
case SND_SOC_BIAS_PREPARE : /* partial On */
227
209
case SND_SOC_BIAS_STANDBY : /* Off, with power */
228
- stac9766_ac97_write (codec , AC97_POWERDOWN , 0x0000 );
210
+ snd_soc_write (codec , AC97_POWERDOWN , 0x0000 );
229
211
break ;
230
212
case SND_SOC_BIAS_OFF : /* Off, without power */
231
213
/* disable everything including AC link */
232
- stac9766_ac97_write (codec , AC97_POWERDOWN , 0xffff );
214
+ snd_soc_write (codec , AC97_POWERDOWN , 0xffff );
233
215
break ;
234
216
}
235
217
return 0 ;
0 commit comments