aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/sound/ak4531_codec.h12
-rw-r--r--sound/pci/ac97/ak4531_codec.c59
2 files changed, 36 insertions, 35 deletions
diff --git a/include/sound/ak4531_codec.h b/include/sound/ak4531_codec.h
index 8b18992376d5..4e7c661af484 100644
--- a/include/sound/ak4531_codec.h
+++ b/include/sound/ak4531_codec.h
@@ -64,17 +64,17 @@
64#define AK4531_AD_IN 0x18 /* AD input select */ 64#define AK4531_AD_IN 0x18 /* AD input select */
65#define AK4531_MIC_GAIN 0x19 /* MIC amplified gain */ 65#define AK4531_MIC_GAIN 0x19 /* MIC amplified gain */
66 66
67typedef struct _snd_ak4531 ak4531_t; 67struct snd_ak4531 {
68 68 void (*write) (struct snd_ak4531 *ak4531, unsigned short reg,
69struct _snd_ak4531 { 69 unsigned short val);
70 void (*write) (ak4531_t *ak4531, unsigned short reg, unsigned short val);
71 void *private_data; 70 void *private_data;
72 void (*private_free) (ak4531_t *ak4531); 71 void (*private_free) (struct snd_ak4531 *ak4531);
73 /* --- */ 72 /* --- */
74 unsigned char regs[0x20]; 73 unsigned char regs[0x20];
75 struct semaphore reg_mutex; 74 struct semaphore reg_mutex;
76}; 75};
77 76
78int snd_ak4531_mixer(snd_card_t * card, ak4531_t * _ak4531, ak4531_t ** rak4531); 77int snd_ak4531_mixer(struct snd_card *card, struct snd_ak4531 *_ak4531,
78 struct snd_ak4531 **rak4531);
79 79
80#endif /* __SOUND_AK4531_CODEC_H */ 80#endif /* __SOUND_AK4531_CODEC_H */
diff --git a/sound/pci/ac97/ak4531_codec.c b/sound/pci/ac97/ak4531_codec.c
index 4032c5748370..088d8dc336be 100644
--- a/sound/pci/ac97/ak4531_codec.c
+++ b/sound/pci/ac97/ak4531_codec.c
@@ -30,7 +30,7 @@ MODULE_AUTHOR("Jaroslav Kysela <perex@suse.cz>");
30MODULE_DESCRIPTION("Universal routines for AK4531 codec"); 30MODULE_DESCRIPTION("Universal routines for AK4531 codec");
31MODULE_LICENSE("GPL"); 31MODULE_LICENSE("GPL");
32 32
33static void snd_ak4531_proc_init(snd_card_t * card, ak4531_t * ak4531); 33static void snd_ak4531_proc_init(struct snd_card *card, struct snd_ak4531 *ak4531);
34 34
35/* 35/*
36 * 36 *
@@ -38,7 +38,7 @@ static void snd_ak4531_proc_init(snd_card_t * card, ak4531_t * ak4531);
38 38
39#if 0 39#if 0
40 40
41static void snd_ak4531_dump(ak4531_t *ak4531) 41static void snd_ak4531_dump(struct snd_ak4531 *ak4531)
42{ 42{
43 int idx; 43 int idx;
44 44
@@ -58,7 +58,7 @@ static void snd_ak4531_dump(ak4531_t *ak4531)
58 .get = snd_ak4531_get_single, .put = snd_ak4531_put_single, \ 58 .get = snd_ak4531_get_single, .put = snd_ak4531_put_single, \
59 .private_value = reg | (shift << 16) | (mask << 24) | (invert << 22) } 59 .private_value = reg | (shift << 16) | (mask << 24) | (invert << 22) }
60 60
61static int snd_ak4531_info_single(snd_kcontrol_t * kcontrol, snd_ctl_elem_info_t * uinfo) 61static int snd_ak4531_info_single(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
62{ 62{
63 int mask = (kcontrol->private_value >> 24) & 0xff; 63 int mask = (kcontrol->private_value >> 24) & 0xff;
64 64
@@ -69,9 +69,9 @@ static int snd_ak4531_info_single(snd_kcontrol_t * kcontrol, snd_ctl_elem_info_t
69 return 0; 69 return 0;
70} 70}
71 71
72static int snd_ak4531_get_single(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) 72static int snd_ak4531_get_single(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
73{ 73{
74 ak4531_t *ak4531 = snd_kcontrol_chip(kcontrol); 74 struct snd_ak4531 *ak4531 = snd_kcontrol_chip(kcontrol);
75 int reg = kcontrol->private_value & 0xff; 75 int reg = kcontrol->private_value & 0xff;
76 int shift = (kcontrol->private_value >> 16) & 0x07; 76 int shift = (kcontrol->private_value >> 16) & 0x07;
77 int mask = (kcontrol->private_value >> 24) & 0xff; 77 int mask = (kcontrol->private_value >> 24) & 0xff;
@@ -88,9 +88,9 @@ static int snd_ak4531_get_single(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t
88 return 0; 88 return 0;
89} 89}
90 90
91static int snd_ak4531_put_single(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) 91static int snd_ak4531_put_single(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
92{ 92{
93 ak4531_t *ak4531 = snd_kcontrol_chip(kcontrol); 93 struct snd_ak4531 *ak4531 = snd_kcontrol_chip(kcontrol);
94 int reg = kcontrol->private_value & 0xff; 94 int reg = kcontrol->private_value & 0xff;
95 int shift = (kcontrol->private_value >> 16) & 0x07; 95 int shift = (kcontrol->private_value >> 16) & 0x07;
96 int mask = (kcontrol->private_value >> 24) & 0xff; 96 int mask = (kcontrol->private_value >> 24) & 0xff;
@@ -117,7 +117,7 @@ static int snd_ak4531_put_single(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t
117 .get = snd_ak4531_get_double, .put = snd_ak4531_put_double, \ 117 .get = snd_ak4531_get_double, .put = snd_ak4531_put_double, \
118 .private_value = left_reg | (right_reg << 8) | (left_shift << 16) | (right_shift << 19) | (mask << 24) | (invert << 22) } 118 .private_value = left_reg | (right_reg << 8) | (left_shift << 16) | (right_shift << 19) | (mask << 24) | (invert << 22) }
119 119
120static int snd_ak4531_info_double(snd_kcontrol_t * kcontrol, snd_ctl_elem_info_t * uinfo) 120static int snd_ak4531_info_double(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
121{ 121{
122 int mask = (kcontrol->private_value >> 24) & 0xff; 122 int mask = (kcontrol->private_value >> 24) & 0xff;
123 123
@@ -128,9 +128,9 @@ static int snd_ak4531_info_double(snd_kcontrol_t * kcontrol, snd_ctl_elem_info_t
128 return 0; 128 return 0;
129} 129}
130 130
131static int snd_ak4531_get_double(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) 131static int snd_ak4531_get_double(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
132{ 132{
133 ak4531_t *ak4531 = snd_kcontrol_chip(kcontrol); 133 struct snd_ak4531 *ak4531 = snd_kcontrol_chip(kcontrol);
134 int left_reg = kcontrol->private_value & 0xff; 134 int left_reg = kcontrol->private_value & 0xff;
135 int right_reg = (kcontrol->private_value >> 8) & 0xff; 135 int right_reg = (kcontrol->private_value >> 8) & 0xff;
136 int left_shift = (kcontrol->private_value >> 16) & 0x07; 136 int left_shift = (kcontrol->private_value >> 16) & 0x07;
@@ -152,9 +152,9 @@ static int snd_ak4531_get_double(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t
152 return 0; 152 return 0;
153} 153}
154 154
155static int snd_ak4531_put_double(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) 155static int snd_ak4531_put_double(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
156{ 156{
157 ak4531_t *ak4531 = snd_kcontrol_chip(kcontrol); 157 struct snd_ak4531 *ak4531 = snd_kcontrol_chip(kcontrol);
158 int left_reg = kcontrol->private_value & 0xff; 158 int left_reg = kcontrol->private_value & 0xff;
159 int right_reg = (kcontrol->private_value >> 8) & 0xff; 159 int right_reg = (kcontrol->private_value >> 8) & 0xff;
160 int left_shift = (kcontrol->private_value >> 16) & 0x07; 160 int left_shift = (kcontrol->private_value >> 16) & 0x07;
@@ -194,7 +194,7 @@ static int snd_ak4531_put_double(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t
194 .get = snd_ak4531_get_input_sw, .put = snd_ak4531_put_input_sw, \ 194 .get = snd_ak4531_get_input_sw, .put = snd_ak4531_put_input_sw, \
195 .private_value = reg1 | (reg2 << 8) | (left_shift << 16) | (right_shift << 24) } 195 .private_value = reg1 | (reg2 << 8) | (left_shift << 16) | (right_shift << 24) }
196 196
197static int snd_ak4531_info_input_sw(snd_kcontrol_t * kcontrol, snd_ctl_elem_info_t * uinfo) 197static int snd_ak4531_info_input_sw(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
198{ 198{
199 uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN; 199 uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN;
200 uinfo->count = 4; 200 uinfo->count = 4;
@@ -203,9 +203,9 @@ static int snd_ak4531_info_input_sw(snd_kcontrol_t * kcontrol, snd_ctl_elem_info
203 return 0; 203 return 0;
204} 204}
205 205
206static int snd_ak4531_get_input_sw(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) 206static int snd_ak4531_get_input_sw(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
207{ 207{
208 ak4531_t *ak4531 = snd_kcontrol_chip(kcontrol); 208 struct snd_ak4531 *ak4531 = snd_kcontrol_chip(kcontrol);
209 int reg1 = kcontrol->private_value & 0xff; 209 int reg1 = kcontrol->private_value & 0xff;
210 int reg2 = (kcontrol->private_value >> 8) & 0xff; 210 int reg2 = (kcontrol->private_value >> 8) & 0xff;
211 int left_shift = (kcontrol->private_value >> 16) & 0x0f; 211 int left_shift = (kcontrol->private_value >> 16) & 0x0f;
@@ -220,9 +220,9 @@ static int snd_ak4531_get_input_sw(snd_kcontrol_t * kcontrol, snd_ctl_elem_value
220 return 0; 220 return 0;
221} 221}
222 222
223static int snd_ak4531_put_input_sw(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) 223static int snd_ak4531_put_input_sw(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
224{ 224{
225 ak4531_t *ak4531 = snd_kcontrol_chip(kcontrol); 225 struct snd_ak4531 *ak4531 = snd_kcontrol_chip(kcontrol);
226 int reg1 = kcontrol->private_value & 0xff; 226 int reg1 = kcontrol->private_value & 0xff;
227 int reg2 = (kcontrol->private_value >> 8) & 0xff; 227 int reg2 = (kcontrol->private_value >> 8) & 0xff;
228 int left_shift = (kcontrol->private_value >> 16) & 0x0f; 228 int left_shift = (kcontrol->private_value >> 16) & 0x0f;
@@ -244,7 +244,7 @@ static int snd_ak4531_put_input_sw(snd_kcontrol_t * kcontrol, snd_ctl_elem_value
244 return change; 244 return change;
245} 245}
246 246
247static snd_kcontrol_new_t snd_ak4531_controls[] = { 247static struct snd_kcontrol_new snd_ak4531_controls[] = {
248 248
249AK4531_DOUBLE("Master Playback Switch", 0, AK4531_LMASTER, AK4531_RMASTER, 7, 7, 1, 1), 249AK4531_DOUBLE("Master Playback Switch", 0, AK4531_LMASTER, AK4531_RMASTER, 7, 7, 1, 1),
250AK4531_DOUBLE("Master Playback Volume", 0, AK4531_LMASTER, AK4531_RMASTER, 0, 0, 0x1f, 1), 250AK4531_DOUBLE("Master Playback Volume", 0, AK4531_LMASTER, AK4531_RMASTER, 0, 0, 0x1f, 1),
@@ -300,7 +300,7 @@ AK4531_SINGLE("AD Input Select", 0, AK4531_AD_IN, 0, 1, 0),
300AK4531_SINGLE("Mic Boost (+30dB)", 0, AK4531_MIC_GAIN, 0, 1, 0) 300AK4531_SINGLE("Mic Boost (+30dB)", 0, AK4531_MIC_GAIN, 0, 1, 0)
301}; 301};
302 302
303static int snd_ak4531_free(ak4531_t *ak4531) 303static int snd_ak4531_free(struct snd_ak4531 *ak4531)
304{ 304{
305 if (ak4531) { 305 if (ak4531) {
306 if (ak4531->private_free) 306 if (ak4531->private_free)
@@ -310,9 +310,9 @@ static int snd_ak4531_free(ak4531_t *ak4531)
310 return 0; 310 return 0;
311} 311}
312 312
313static int snd_ak4531_dev_free(snd_device_t *device) 313static int snd_ak4531_dev_free(struct snd_device *device)
314{ 314{
315 ak4531_t *ak4531 = device->device_data; 315 struct snd_ak4531 *ak4531 = device->device_data;
316 return snd_ak4531_free(ak4531); 316 return snd_ak4531_free(ak4531);
317} 317}
318 318
@@ -345,12 +345,13 @@ static u8 snd_ak4531_initial_map[0x19 + 1] = {
345 0x01 /* 19: Mic Amp Setup */ 345 0x01 /* 19: Mic Amp Setup */
346}; 346};
347 347
348int snd_ak4531_mixer(snd_card_t * card, ak4531_t * _ak4531, ak4531_t ** rak4531) 348int snd_ak4531_mixer(struct snd_card *card, struct snd_ak4531 *_ak4531,
349 struct snd_ak4531 **rak4531)
349{ 350{
350 unsigned int idx; 351 unsigned int idx;
351 int err; 352 int err;
352 ak4531_t * ak4531; 353 struct snd_ak4531 *ak4531;
353 static snd_device_ops_t ops = { 354 static struct snd_device_ops ops = {
354 .dev_free = snd_ak4531_dev_free, 355 .dev_free = snd_ak4531_dev_free,
355 }; 356 };
356 357
@@ -398,10 +399,10 @@ int snd_ak4531_mixer(snd_card_t * card, ak4531_t * _ak4531, ak4531_t ** rak4531)
398 399
399 */ 400 */
400 401
401static void snd_ak4531_proc_read(snd_info_entry_t *entry, 402static void snd_ak4531_proc_read(struct snd_info_entry *entry,
402 snd_info_buffer_t * buffer) 403 struct snd_info_buffer *buffer)
403{ 404{
404 ak4531_t *ak4531 = entry->private_data; 405 struct snd_ak4531 *ak4531 = entry->private_data;
405 406
406 snd_iprintf(buffer, "Asahi Kasei AK4531\n\n"); 407 snd_iprintf(buffer, "Asahi Kasei AK4531\n\n");
407 snd_iprintf(buffer, "Recording source : %s\n" 408 snd_iprintf(buffer, "Recording source : %s\n"
@@ -410,9 +411,9 @@ static void snd_ak4531_proc_read(snd_info_entry_t *entry,
410 ak4531->regs[AK4531_MIC_GAIN] & 1 ? "+30dB" : "+0dB"); 411 ak4531->regs[AK4531_MIC_GAIN] & 1 ? "+30dB" : "+0dB");
411} 412}
412 413
413static void snd_ak4531_proc_init(snd_card_t * card, ak4531_t * ak4531) 414static void snd_ak4531_proc_init(struct snd_card *card, struct snd_ak4531 *ak4531)
414{ 415{
415 snd_info_entry_t *entry; 416 struct snd_info_entry *entry;
416 417
417 if (! snd_card_proc_new(card, "ak4531", &entry)) 418 if (! snd_card_proc_new(card, "ak4531", &entry))
418 snd_info_set_text_ops(entry, ak4531, 1024, snd_ak4531_proc_read); 419 snd_info_set_text_ops(entry, ak4531, 1024, snd_ak4531_proc_read);