Lines Matching refs:codec
139 static int stac9766_ac97_write(struct snd_soc_codec *codec, unsigned int reg, in stac9766_ac97_write() argument
142 struct snd_ac97 *ac97 = snd_soc_codec_get_drvdata(codec); in stac9766_ac97_write()
143 u16 *cache = codec->reg_cache; in stac9766_ac97_write()
146 stac9766_ac97_write(codec, AC97_INT_PAGING, 0); in stac9766_ac97_write()
148 stac9766_ac97_write(codec, AC97_INT_PAGING, 1); in stac9766_ac97_write()
159 static unsigned int stac9766_ac97_read(struct snd_soc_codec *codec, in stac9766_ac97_read() argument
162 struct snd_ac97 *ac97 = snd_soc_codec_get_drvdata(codec); in stac9766_ac97_read()
163 u16 val = 0, *cache = codec->reg_cache; in stac9766_ac97_read()
166 stac9766_ac97_write(codec, AC97_INT_PAGING, 0); in stac9766_ac97_read()
168 stac9766_ac97_write(codec, AC97_INT_PAGING, 1); in stac9766_ac97_read()
187 struct snd_soc_codec *codec = dai->codec; in ac97_analog_prepare() local
191 vra = stac9766_ac97_read(codec, AC97_EXTENDED_STATUS); in ac97_analog_prepare()
196 stac9766_ac97_write(codec, AC97_EXTENDED_STATUS, vra); in ac97_analog_prepare()
203 return stac9766_ac97_write(codec, reg, runtime->rate); in ac97_analog_prepare()
209 struct snd_soc_codec *codec = dai->codec; in ac97_digital_prepare() local
213 stac9766_ac97_write(codec, AC97_SPDIF, 0x2002); in ac97_digital_prepare()
215 vra = stac9766_ac97_read(codec, AC97_EXTENDED_STATUS); in ac97_digital_prepare()
218 stac9766_ac97_write(codec, AC97_EXTENDED_STATUS, vra); in ac97_digital_prepare()
222 return stac9766_ac97_write(codec, reg, runtime->rate); in ac97_digital_prepare()
225 static int stac9766_set_bias_level(struct snd_soc_codec *codec, in stac9766_set_bias_level() argument
232 stac9766_ac97_write(codec, AC97_POWERDOWN, 0x0000); in stac9766_set_bias_level()
236 stac9766_ac97_write(codec, AC97_POWERDOWN, 0xffff); in stac9766_set_bias_level()
239 codec->dapm.bias_level = level; in stac9766_set_bias_level()
243 static int stac9766_reset(struct snd_soc_codec *codec, int try_warm) in stac9766_reset() argument
245 struct snd_ac97 *ac97 = snd_soc_codec_get_drvdata(codec); in stac9766_reset()
249 if (stac9766_ac97_read(codec, 0) == stac9766_reg[0]) in stac9766_reset()
256 if (stac9766_ac97_read(codec, 0) != stac9766_reg[0]) in stac9766_reset()
261 static int stac9766_codec_resume(struct snd_soc_codec *codec) in stac9766_codec_resume() argument
263 struct snd_ac97 *ac97 = snd_soc_codec_get_drvdata(codec); in stac9766_codec_resume()
270 dev_err(codec->dev, "Failed to resume\n"); in stac9766_codec_resume()
276 stac9766_reset(codec, 0); in stac9766_codec_resume()
331 static int stac9766_codec_probe(struct snd_soc_codec *codec) in stac9766_codec_probe() argument
336 ac97 = snd_soc_new_ac97_codec(codec); in stac9766_codec_probe()
340 snd_soc_codec_set_drvdata(codec, ac97); in stac9766_codec_probe()
344 stac9766_reset(codec, 0); in stac9766_codec_probe()
345 ret = stac9766_reset(codec, 1); in stac9766_codec_probe()
347 dev_err(codec->dev, "Failed to reset: AC97 link error\n"); in stac9766_codec_probe()
358 static int stac9766_codec_remove(struct snd_soc_codec *codec) in stac9766_codec_remove() argument
360 struct snd_ac97 *ac97 = snd_soc_codec_get_drvdata(codec); in stac9766_codec_remove()