aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/codecs/tlv320dac33.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/soc/codecs/tlv320dac33.c')
-rw-r--r--sound/soc/codecs/tlv320dac33.c36
1 files changed, 18 insertions, 18 deletions
diff --git a/sound/soc/codecs/tlv320dac33.c b/sound/soc/codecs/tlv320dac33.c
index ee2e1e36d995..824bb354ebc9 100644
--- a/sound/soc/codecs/tlv320dac33.c
+++ b/sound/soc/codecs/tlv320dac33.c
@@ -167,7 +167,7 @@ static inline void dac33_write_reg_cache(struct snd_soc_codec *codec,
167static int dac33_read(struct snd_soc_codec *codec, unsigned int reg, 167static int dac33_read(struct snd_soc_codec *codec, unsigned int reg,
168 u8 *value) 168 u8 *value)
169{ 169{
170 struct tlv320dac33_priv *dac33 = codec->private_data; 170 struct tlv320dac33_priv *dac33 = snd_soc_codec_get_drvdata(codec);
171 int val; 171 int val;
172 172
173 *value = reg & 0xff; 173 *value = reg & 0xff;
@@ -192,7 +192,7 @@ static int dac33_read(struct snd_soc_codec *codec, unsigned int reg,
192static int dac33_write(struct snd_soc_codec *codec, unsigned int reg, 192static int dac33_write(struct snd_soc_codec *codec, unsigned int reg,
193 unsigned int value) 193 unsigned int value)
194{ 194{
195 struct tlv320dac33_priv *dac33 = codec->private_data; 195 struct tlv320dac33_priv *dac33 = snd_soc_codec_get_drvdata(codec);
196 u8 data[2]; 196 u8 data[2];
197 int ret = 0; 197 int ret = 0;
198 198
@@ -219,7 +219,7 @@ static int dac33_write(struct snd_soc_codec *codec, unsigned int reg,
219static int dac33_write_locked(struct snd_soc_codec *codec, unsigned int reg, 219static int dac33_write_locked(struct snd_soc_codec *codec, unsigned int reg,
220 unsigned int value) 220 unsigned int value)
221{ 221{
222 struct tlv320dac33_priv *dac33 = codec->private_data; 222 struct tlv320dac33_priv *dac33 = snd_soc_codec_get_drvdata(codec);
223 int ret; 223 int ret;
224 224
225 mutex_lock(&dac33->mutex); 225 mutex_lock(&dac33->mutex);
@@ -233,7 +233,7 @@ static int dac33_write_locked(struct snd_soc_codec *codec, unsigned int reg,
233static int dac33_write16(struct snd_soc_codec *codec, unsigned int reg, 233static int dac33_write16(struct snd_soc_codec *codec, unsigned int reg,
234 unsigned int value) 234 unsigned int value)
235{ 235{
236 struct tlv320dac33_priv *dac33 = codec->private_data; 236 struct tlv320dac33_priv *dac33 = snd_soc_codec_get_drvdata(codec);
237 u8 data[3]; 237 u8 data[3];
238 int ret = 0; 238 int ret = 0;
239 239
@@ -265,7 +265,7 @@ static int dac33_write16(struct snd_soc_codec *codec, unsigned int reg,
265 265
266static void dac33_restore_regs(struct snd_soc_codec *codec) 266static void dac33_restore_regs(struct snd_soc_codec *codec)
267{ 267{
268 struct tlv320dac33_priv *dac33 = codec->private_data; 268 struct tlv320dac33_priv *dac33 = snd_soc_codec_get_drvdata(codec);
269 u8 *cache = codec->reg_cache; 269 u8 *cache = codec->reg_cache;
270 u8 data[2]; 270 u8 data[2];
271 int i, ret; 271 int i, ret;
@@ -319,7 +319,7 @@ static inline void dac33_soft_power(struct snd_soc_codec *codec, int power)
319 319
320static int dac33_hard_power(struct snd_soc_codec *codec, int power) 320static int dac33_hard_power(struct snd_soc_codec *codec, int power)
321{ 321{
322 struct tlv320dac33_priv *dac33 = codec->private_data; 322 struct tlv320dac33_priv *dac33 = snd_soc_codec_get_drvdata(codec);
323 int ret; 323 int ret;
324 324
325 mutex_lock(&dac33->mutex); 325 mutex_lock(&dac33->mutex);
@@ -366,7 +366,7 @@ static int dac33_get_nsample(struct snd_kcontrol *kcontrol,
366 struct snd_ctl_elem_value *ucontrol) 366 struct snd_ctl_elem_value *ucontrol)
367{ 367{
368 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); 368 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
369 struct tlv320dac33_priv *dac33 = codec->private_data; 369 struct tlv320dac33_priv *dac33 = snd_soc_codec_get_drvdata(codec);
370 370
371 ucontrol->value.integer.value[0] = dac33->nsample; 371 ucontrol->value.integer.value[0] = dac33->nsample;
372 372
@@ -377,7 +377,7 @@ static int dac33_set_nsample(struct snd_kcontrol *kcontrol,
377 struct snd_ctl_elem_value *ucontrol) 377 struct snd_ctl_elem_value *ucontrol)
378{ 378{
379 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); 379 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
380 struct tlv320dac33_priv *dac33 = codec->private_data; 380 struct tlv320dac33_priv *dac33 = snd_soc_codec_get_drvdata(codec);
381 int ret = 0; 381 int ret = 0;
382 382
383 if (dac33->nsample == ucontrol->value.integer.value[0]) 383 if (dac33->nsample == ucontrol->value.integer.value[0])
@@ -396,7 +396,7 @@ static int dac33_get_fifo_mode(struct snd_kcontrol *kcontrol,
396 struct snd_ctl_elem_value *ucontrol) 396 struct snd_ctl_elem_value *ucontrol)
397{ 397{
398 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); 398 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
399 struct tlv320dac33_priv *dac33 = codec->private_data; 399 struct tlv320dac33_priv *dac33 = snd_soc_codec_get_drvdata(codec);
400 400
401 ucontrol->value.integer.value[0] = dac33->fifo_mode; 401 ucontrol->value.integer.value[0] = dac33->fifo_mode;
402 402
@@ -407,7 +407,7 @@ static int dac33_set_fifo_mode(struct snd_kcontrol *kcontrol,
407 struct snd_ctl_elem_value *ucontrol) 407 struct snd_ctl_elem_value *ucontrol)
408{ 408{
409 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); 409 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
410 struct tlv320dac33_priv *dac33 = codec->private_data; 410 struct tlv320dac33_priv *dac33 = snd_soc_codec_get_drvdata(codec);
411 int ret = 0; 411 int ret = 0;
412 412
413 if (dac33->fifo_mode == ucontrol->value.integer.value[0]) 413 if (dac33->fifo_mode == ucontrol->value.integer.value[0])
@@ -630,7 +630,7 @@ static void dac33_work(struct work_struct *work)
630static irqreturn_t dac33_interrupt_handler(int irq, void *dev) 630static irqreturn_t dac33_interrupt_handler(int irq, void *dev)
631{ 631{
632 struct snd_soc_codec *codec = dev; 632 struct snd_soc_codec *codec = dev;
633 struct tlv320dac33_priv *dac33 = codec->private_data; 633 struct tlv320dac33_priv *dac33 = snd_soc_codec_get_drvdata(codec);
634 634
635 queue_work(dac33->dac33_wq, &dac33->work); 635 queue_work(dac33->dac33_wq, &dac33->work);
636 636
@@ -697,7 +697,7 @@ static int dac33_prepare_chip(struct snd_pcm_substream *substream)
697 struct snd_soc_pcm_runtime *rtd = substream->private_data; 697 struct snd_soc_pcm_runtime *rtd = substream->private_data;
698 struct snd_soc_device *socdev = rtd->socdev; 698 struct snd_soc_device *socdev = rtd->socdev;
699 struct snd_soc_codec *codec = socdev->card->codec; 699 struct snd_soc_codec *codec = socdev->card->codec;
700 struct tlv320dac33_priv *dac33 = codec->private_data; 700 struct tlv320dac33_priv *dac33 = snd_soc_codec_get_drvdata(codec);
701 unsigned int oscset, ratioset, pwr_ctrl, reg_tmp; 701 unsigned int oscset, ratioset, pwr_ctrl, reg_tmp;
702 u8 aictrl_a, aictrl_b, fifoctrl_a; 702 u8 aictrl_a, aictrl_b, fifoctrl_a;
703 703
@@ -883,7 +883,7 @@ static void dac33_calculate_times(struct snd_pcm_substream *substream)
883 struct snd_soc_pcm_runtime *rtd = substream->private_data; 883 struct snd_soc_pcm_runtime *rtd = substream->private_data;
884 struct snd_soc_device *socdev = rtd->socdev; 884 struct snd_soc_device *socdev = rtd->socdev;
885 struct snd_soc_codec *codec = socdev->card->codec; 885 struct snd_soc_codec *codec = socdev->card->codec;
886 struct tlv320dac33_priv *dac33 = codec->private_data; 886 struct tlv320dac33_priv *dac33 = snd_soc_codec_get_drvdata(codec);
887 unsigned int nsample_limit; 887 unsigned int nsample_limit;
888 888
889 /* Number of samples (16bit, stereo) in one period */ 889 /* Number of samples (16bit, stereo) in one period */
@@ -936,7 +936,7 @@ static int dac33_pcm_trigger(struct snd_pcm_substream *substream, int cmd,
936 struct snd_soc_pcm_runtime *rtd = substream->private_data; 936 struct snd_soc_pcm_runtime *rtd = substream->private_data;
937 struct snd_soc_device *socdev = rtd->socdev; 937 struct snd_soc_device *socdev = rtd->socdev;
938 struct snd_soc_codec *codec = socdev->card->codec; 938 struct snd_soc_codec *codec = socdev->card->codec;
939 struct tlv320dac33_priv *dac33 = codec->private_data; 939 struct tlv320dac33_priv *dac33 = snd_soc_codec_get_drvdata(codec);
940 int ret = 0; 940 int ret = 0;
941 941
942 switch (cmd) { 942 switch (cmd) {
@@ -967,7 +967,7 @@ static int dac33_set_dai_sysclk(struct snd_soc_dai *codec_dai,
967 int clk_id, unsigned int freq, int dir) 967 int clk_id, unsigned int freq, int dir)
968{ 968{
969 struct snd_soc_codec *codec = codec_dai->codec; 969 struct snd_soc_codec *codec = codec_dai->codec;
970 struct tlv320dac33_priv *dac33 = codec->private_data; 970 struct tlv320dac33_priv *dac33 = snd_soc_codec_get_drvdata(codec);
971 u8 ioc_reg, asrcb_reg; 971 u8 ioc_reg, asrcb_reg;
972 972
973 ioc_reg = dac33_read_reg_cache(codec, DAC33_INT_OSC_CTRL); 973 ioc_reg = dac33_read_reg_cache(codec, DAC33_INT_OSC_CTRL);
@@ -997,7 +997,7 @@ static int dac33_set_dai_fmt(struct snd_soc_dai *codec_dai,
997 unsigned int fmt) 997 unsigned int fmt)
998{ 998{
999 struct snd_soc_codec *codec = codec_dai->codec; 999 struct snd_soc_codec *codec = codec_dai->codec;
1000 struct tlv320dac33_priv *dac33 = codec->private_data; 1000 struct tlv320dac33_priv *dac33 = snd_soc_codec_get_drvdata(codec);
1001 u8 aictrl_a, aictrl_b; 1001 u8 aictrl_a, aictrl_b;
1002 1002
1003 aictrl_a = dac33_read_reg_cache(codec, DAC33_SER_AUDIOIF_CTRL_A); 1003 aictrl_a = dac33_read_reg_cache(codec, DAC33_SER_AUDIOIF_CTRL_A);
@@ -1088,7 +1088,7 @@ static int dac33_soc_probe(struct platform_device *pdev)
1088 1088
1089 codec = tlv320dac33_codec; 1089 codec = tlv320dac33_codec;
1090 socdev->card->codec = codec; 1090 socdev->card->codec = codec;
1091 dac33 = codec->private_data; 1091 dac33 = snd_soc_codec_get_drvdata(codec);
1092 1092
1093 /* Power up the codec */ 1093 /* Power up the codec */
1094 dac33_hard_power(codec, 1); 1094 dac33_hard_power(codec, 1);
@@ -1209,7 +1209,7 @@ static int __devinit dac33_i2c_probe(struct i2c_client *client,
1209 return -ENOMEM; 1209 return -ENOMEM;
1210 1210
1211 codec = &dac33->codec; 1211 codec = &dac33->codec;
1212 codec->private_data = dac33; 1212 snd_soc_codec_set_drvdata(codec, dac33);
1213 codec->control_data = client; 1213 codec->control_data = client;
1214 1214
1215 mutex_init(&codec->mutex); 1215 mutex_init(&codec->mutex);