aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorRisto Suominen <Risto.Suominen@gmail.com>2008-04-16 13:39:27 -0400
committerTakashi Iwai <tiwai@suse.de>2008-04-24 06:00:38 -0400
commit7ae44cfa7ab29b277691327e8de790d7b880722f (patch)
tree11aa5e91770c71295f76245feeaa674234db411e /sound
parenta8c2a6bf464d983c642c8b8b001a57aabbf76673 (diff)
[ALSA] snd-powermac: style awacs.s and awacs.h
Coding style corrections for awacs.c and awacs.h. Signed-off-by: Risto Suominen <Risto.Suominen@gmail.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound')
-rw-r--r--sound/ppc/awacs.c94
-rw-r--r--sound/ppc/awacs.h5
2 files changed, 62 insertions, 37 deletions
diff --git a/sound/ppc/awacs.c b/sound/ppc/awacs.c
index db4e35d2824..566a6d0daf4 100644
--- a/sound/ppc/awacs.c
+++ b/sound/ppc/awacs.c
@@ -141,7 +141,7 @@ static int snd_pmac_awacs_info_volume(struct snd_kcontrol *kcontrol,
141 uinfo->value.integer.max = 15; 141 uinfo->value.integer.max = 15;
142 return 0; 142 return 0;
143} 143}
144 144
145static int snd_pmac_awacs_get_volume(struct snd_kcontrol *kcontrol, 145static int snd_pmac_awacs_get_volume(struct snd_kcontrol *kcontrol,
146 struct snd_ctl_elem_value *ucontrol) 146 struct snd_ctl_elem_value *ucontrol)
147{ 147{
@@ -267,7 +267,8 @@ static int snd_pmac_awacs_put_switch(struct snd_kcontrol *kcontrol,
267static void awacs_set_cuda(int reg, int val) 267static void awacs_set_cuda(int reg, int val)
268{ 268{
269 struct adb_request req; 269 struct adb_request req;
270 cuda_request(&req, NULL, 5, CUDA_PACKET, CUDA_GET_SET_IIC, 0x8a, reg, val); 270 cuda_request(&req, NULL, 5, CUDA_PACKET, CUDA_GET_SET_IIC, 0x8a,
271 reg, val);
271 while (! req.complete) 272 while (! req.complete)
272 cuda_poll(); 273 cuda_poll();
273} 274}
@@ -289,11 +290,11 @@ static void awacs_amp_set_tone(struct awacs_amp *amp, int bass, int treble)
289/* 290/*
290 * vol = 0 - 31 (attenuation), 32 = mute bit, stereo 291 * vol = 0 - 31 (attenuation), 32 = mute bit, stereo
291 */ 292 */
292static int awacs_amp_set_vol(struct awacs_amp *amp, int index, int lvol, int rvol, 293static int awacs_amp_set_vol(struct awacs_amp *amp, int index,
293 int do_check) 294 int lvol, int rvol, int do_check)
294{ 295{
295 if (do_check && amp->amp_vol[index][0] == lvol && 296 if (do_check && amp->amp_vol[index][0] == lvol &&
296 amp->amp_vol[index][1] == rvol) 297 amp->amp_vol[index][1] == rvol)
297 return 0; 298 return 0;
298 awacs_set_cuda(3 + index, lvol); 299 awacs_set_cuda(3 + index, lvol);
299 awacs_set_cuda(5 + index, rvol); 300 awacs_set_cuda(5 + index, rvol);
@@ -337,7 +338,7 @@ static int snd_pmac_awacs_info_volume_amp(struct snd_kcontrol *kcontrol,
337 uinfo->value.integer.max = 31; 338 uinfo->value.integer.max = 31;
338 return 0; 339 return 0;
339} 340}
340 341
341static int snd_pmac_awacs_get_volume_amp(struct snd_kcontrol *kcontrol, 342static int snd_pmac_awacs_get_volume_amp(struct snd_kcontrol *kcontrol,
342 struct snd_ctl_elem_value *ucontrol) 343 struct snd_ctl_elem_value *ucontrol)
343{ 344{
@@ -361,8 +362,10 @@ static int snd_pmac_awacs_put_volume_amp(struct snd_kcontrol *kcontrol,
361 snd_assert(amp, return -EINVAL); 362 snd_assert(amp, return -EINVAL);
362 snd_assert(index >= 0 && index <= 1, return -EINVAL); 363 snd_assert(index >= 0 && index <= 1, return -EINVAL);
363 364
364 vol[0] = (31 - (ucontrol->value.integer.value[0] & 31)) | (amp->amp_vol[index][0] & 32); 365 vol[0] = (31 - (ucontrol->value.integer.value[0] & 31))
365 vol[1] = (31 - (ucontrol->value.integer.value[1] & 31)) | (amp->amp_vol[index][1] & 32); 366 | (amp->amp_vol[index][0] & 32);
367 vol[1] = (31 - (ucontrol->value.integer.value[1] & 31))
368 | (amp->amp_vol[index][1] & 32);
366 return awacs_amp_set_vol(amp, index, vol[0], vol[1], 1); 369 return awacs_amp_set_vol(amp, index, vol[0], vol[1], 1);
367} 370}
368 371
@@ -374,8 +377,10 @@ static int snd_pmac_awacs_get_switch_amp(struct snd_kcontrol *kcontrol,
374 struct awacs_amp *amp = chip->mixer_data; 377 struct awacs_amp *amp = chip->mixer_data;
375 snd_assert(amp, return -EINVAL); 378 snd_assert(amp, return -EINVAL);
376 snd_assert(index >= 0 && index <= 1, return -EINVAL); 379 snd_assert(index >= 0 && index <= 1, return -EINVAL);
377 ucontrol->value.integer.value[0] = (amp->amp_vol[index][0] & 32) ? 0 : 1; 380 ucontrol->value.integer.value[0] = (amp->amp_vol[index][0] & 32)
378 ucontrol->value.integer.value[1] = (amp->amp_vol[index][1] & 32) ? 0 : 1; 381 ? 0 : 1;
382 ucontrol->value.integer.value[1] = (amp->amp_vol[index][1] & 32)
383 ? 0 : 1;
379 return 0; 384 return 0;
380} 385}
381 386
@@ -389,8 +394,10 @@ static int snd_pmac_awacs_put_switch_amp(struct snd_kcontrol *kcontrol,
389 snd_assert(amp, return -EINVAL); 394 snd_assert(amp, return -EINVAL);
390 snd_assert(index >= 0 && index <= 1, return -EINVAL); 395 snd_assert(index >= 0 && index <= 1, return -EINVAL);
391 396
392 vol[0] = (ucontrol->value.integer.value[0] ? 0 : 32) | (amp->amp_vol[index][0] & 31); 397 vol[0] = (ucontrol->value.integer.value[0] ? 0 : 32)
393 vol[1] = (ucontrol->value.integer.value[1] ? 0 : 32) | (amp->amp_vol[index][1] & 31); 398 | (amp->amp_vol[index][0] & 31);
399 vol[1] = (ucontrol->value.integer.value[1] ? 0 : 32)
400 | (amp->amp_vol[index][1] & 31);
394 return awacs_amp_set_vol(amp, index, vol[0], vol[1], 1); 401 return awacs_amp_set_vol(amp, index, vol[0], vol[1], 1);
395} 402}
396 403
@@ -403,7 +410,7 @@ static int snd_pmac_awacs_info_tone_amp(struct snd_kcontrol *kcontrol,
403 uinfo->value.integer.max = 14; 410 uinfo->value.integer.max = 14;
404 return 0; 411 return 0;
405} 412}
406 413
407static int snd_pmac_awacs_get_tone_amp(struct snd_kcontrol *kcontrol, 414static int snd_pmac_awacs_get_tone_amp(struct snd_kcontrol *kcontrol,
408 struct snd_ctl_elem_value *ucontrol) 415 struct snd_ctl_elem_value *ucontrol)
409{ 416{
@@ -445,7 +452,7 @@ static int snd_pmac_awacs_info_master_amp(struct snd_kcontrol *kcontrol,
445 uinfo->value.integer.max = 99; 452 uinfo->value.integer.max = 99;
446 return 0; 453 return 0;
447} 454}
448 455
449static int snd_pmac_awacs_get_master_amp(struct snd_kcontrol *kcontrol, 456static int snd_pmac_awacs_get_master_amp(struct snd_kcontrol *kcontrol,
450 struct snd_ctl_elem_value *ucontrol) 457 struct snd_ctl_elem_value *ucontrol)
451{ 458{
@@ -688,12 +695,14 @@ AWACS_SWITCH("PC Speaker Playback Switch", 1, SHIFT_PAROUT1, 0);
688/* 695/*
689 * add new mixer elements to the card 696 * add new mixer elements to the card
690 */ 697 */
691static int build_mixers(struct snd_pmac *chip, int nums, struct snd_kcontrol_new *mixers) 698static int build_mixers(struct snd_pmac *chip, int nums,
699 struct snd_kcontrol_new *mixers)
692{ 700{
693 int i, err; 701 int i, err;
694 702
695 for (i = 0; i < nums; i++) { 703 for (i = 0; i < nums; i++) {
696 if ((err = snd_ctl_add(chip->card, snd_ctl_new1(&mixers[i], chip))) < 0) 704 err = snd_ctl_add(chip->card, snd_ctl_new1(&mixers[i], chip));
705 if (err < 0)
697 return err; 706 return err;
698 } 707 }
699 return 0; 708 return 0;
@@ -743,8 +752,10 @@ static void snd_pmac_awacs_resume(struct snd_pmac *chip)
743#ifdef PMAC_AMP_AVAIL 752#ifdef PMAC_AMP_AVAIL
744 if (chip->mixer_data) { 753 if (chip->mixer_data) {
745 struct awacs_amp *amp = chip->mixer_data; 754 struct awacs_amp *amp = chip->mixer_data;
746 awacs_amp_set_vol(amp, 0, amp->amp_vol[0][0], amp->amp_vol[0][1], 0); 755 awacs_amp_set_vol(amp, 0,
747 awacs_amp_set_vol(amp, 1, amp->amp_vol[1][0], amp->amp_vol[1][1], 0); 756 amp->amp_vol[0][0], amp->amp_vol[0][1], 0);
757 awacs_amp_set_vol(amp, 1,
758 amp->amp_vol[1][0], amp->amp_vol[1][1], 0);
748 awacs_amp_set_tone(amp, amp->amp_tone[0], amp->amp_tone[1]); 759 awacs_amp_set_tone(amp, amp->amp_tone[0], amp->amp_tone[1]);
749 awacs_amp_set_master(amp, amp->amp_master); 760 awacs_amp_set_master(amp, amp->amp_master);
750 } 761 }
@@ -849,7 +860,7 @@ snd_pmac_awacs_init(struct snd_pmac *chip)
849 chip->awacs_reg[1] = MASK_CMUTE | MASK_AMUTE; 860 chip->awacs_reg[1] = MASK_CMUTE | MASK_AMUTE;
850 /* FIXME: Only machines with external SRS module need MASK_PAROUT */ 861 /* FIXME: Only machines with external SRS module need MASK_PAROUT */
851 if (chip->has_iic || chip->device_id == 0x5 || 862 if (chip->has_iic || chip->device_id == 0x5 ||
852 /*chip->_device_id == 0x8 || */ 863 /* chip->_device_id == 0x8 || */
853 chip->device_id == 0xb) 864 chip->device_id == 0xb)
854 chip->awacs_reg[1] |= MASK_PAROUT; 865 chip->awacs_reg[1] |= MASK_PAROUT;
855 /* get default volume from nvram */ 866 /* get default volume from nvram */
@@ -860,8 +871,10 @@ snd_pmac_awacs_init(struct snd_pmac *chip)
860 chip->awacs_reg[2] = vol; 871 chip->awacs_reg[2] = vol;
861 chip->awacs_reg[4] = vol; 872 chip->awacs_reg[4] = vol;
862 if (chip->model == PMAC_SCREAMER) { 873 if (chip->model == PMAC_SCREAMER) {
863 chip->awacs_reg[5] = vol; /* FIXME: screamer has loopthru vol control */ 874 /* FIXME: screamer has loopthru vol control */
864 chip->awacs_reg[6] = MASK_MIC_BOOST; /* FIXME: maybe should be vol << 3 for PCMCIA speaker */ 875 chip->awacs_reg[5] = vol;
876 /* FIXME: maybe should be vol << 3 for PCMCIA speaker */
877 chip->awacs_reg[6] = MASK_MIC_BOOST;
865 chip->awacs_reg[7] = 0; 878 chip->awacs_reg[7] = 0;
866 } 879 }
867 880
@@ -877,7 +890,8 @@ snd_pmac_awacs_init(struct snd_pmac *chip)
877 return -ENOMEM; 890 return -ENOMEM;
878 chip->mixer_data = amp; 891 chip->mixer_data = amp;
879 chip->mixer_free = awacs_amp_free; 892 chip->mixer_free = awacs_amp_free;
880 awacs_amp_set_vol(amp, 0, 63, 63, 0); /* mute and zero vol */ 893 /* mute and zero vol */
894 awacs_amp_set_vol(amp, 0, 63, 63, 0);
881 awacs_amp_set_vol(amp, 1, 63, 63, 0); 895 awacs_amp_set_vol(amp, 1, 63, 63, 0);
882 awacs_amp_set_tone(amp, 7, 7); /* 0 dB */ 896 awacs_amp_set_tone(amp, 7, 7); /* 0 dB */
883 awacs_amp_set_master(amp, 79); /* 0 dB */ 897 awacs_amp_set_master(amp, 79); /* 0 dB */
@@ -921,8 +935,9 @@ snd_pmac_awacs_init(struct snd_pmac *chip)
921 */ 935 */
922 strcpy(chip->card->mixername, "PowerMac AWACS"); 936 strcpy(chip->card->mixername, "PowerMac AWACS");
923 937
924 if ((err = build_mixers(chip, ARRAY_SIZE(snd_pmac_awacs_mixers), 938 err = build_mixers(chip, ARRAY_SIZE(snd_pmac_awacs_mixers),
925 snd_pmac_awacs_mixers)) < 0) 939 snd_pmac_awacs_mixers);
940 if (err < 0)
926 return err; 941 return err;
927 if (beige) 942 if (beige)
928 ; 943 ;
@@ -955,7 +970,8 @@ snd_pmac_awacs_init(struct snd_pmac *chip)
955 chip->master_sw_ctl = snd_ctl_new1((pm7500 || imac) 970 chip->master_sw_ctl = snd_ctl_new1((pm7500 || imac)
956 ? &snd_pmac_awacs_master_sw_imac 971 ? &snd_pmac_awacs_master_sw_imac
957 : &snd_pmac_awacs_master_sw, chip); 972 : &snd_pmac_awacs_master_sw, chip);
958 if ((err = snd_ctl_add(chip->card, chip->master_sw_ctl)) < 0) 973 err = snd_ctl_add(chip->card, chip->master_sw_ctl);
974 if (err < 0)
959 return err; 975 return err;
960#ifdef PMAC_AMP_AVAIL 976#ifdef PMAC_AMP_AVAIL
961 if (chip->mixer_data) { 977 if (chip->mixer_data) {
@@ -965,27 +981,34 @@ snd_pmac_awacs_init(struct snd_pmac *chip)
965 * screamer registers. 981 * screamer registers.
966 * in this case, it seems the route C is not used. 982 * in this case, it seems the route C is not used.
967 */ 983 */
968 if ((err = build_mixers(chip, ARRAY_SIZE(snd_pmac_awacs_amp_vol), 984 err = build_mixers(chip, ARRAY_SIZE(snd_pmac_awacs_amp_vol),
969 snd_pmac_awacs_amp_vol)) < 0) 985 snd_pmac_awacs_amp_vol);
986 if (err < 0)
970 return err; 987 return err;
971 /* overwrite */ 988 /* overwrite */
972 chip->master_sw_ctl = snd_ctl_new1(&snd_pmac_awacs_amp_hp_sw, chip); 989 chip->master_sw_ctl = snd_ctl_new1(&snd_pmac_awacs_amp_hp_sw,
973 if ((err = snd_ctl_add(chip->card, chip->master_sw_ctl)) < 0) 990 chip);
991 err = snd_ctl_add(chip->card, chip->master_sw_ctl);
992 if (err < 0)
974 return err; 993 return err;
975 chip->speaker_sw_ctl = snd_ctl_new1(&snd_pmac_awacs_amp_spk_sw, chip); 994 chip->speaker_sw_ctl = snd_ctl_new1(&snd_pmac_awacs_amp_spk_sw,
976 if ((err = snd_ctl_add(chip->card, chip->speaker_sw_ctl)) < 0) 995 chip);
996 err = snd_ctl_add(chip->card, chip->speaker_sw_ctl);
997 if (err < 0)
977 return err; 998 return err;
978 } else 999 } else
979#endif /* PMAC_AMP_AVAIL */ 1000#endif /* PMAC_AMP_AVAIL */
980 { 1001 {
981 /* route A = headphone, route C = speaker */ 1002 /* route A = headphone, route C = speaker */
982 if ((err = build_mixers(chip, ARRAY_SIZE(snd_pmac_awacs_speaker_vol), 1003 err = build_mixers(chip, ARRAY_SIZE(snd_pmac_awacs_speaker_vol),
983 snd_pmac_awacs_speaker_vol)) < 0) 1004 snd_pmac_awacs_speaker_vol);
1005 if (err < 0)
984 return err; 1006 return err;
985 chip->speaker_sw_ctl = snd_ctl_new1(imac 1007 chip->speaker_sw_ctl = snd_ctl_new1(imac
986 ? &snd_pmac_awacs_speaker_sw_imac 1008 ? &snd_pmac_awacs_speaker_sw_imac
987 : &snd_pmac_awacs_speaker_sw, chip); 1009 : &snd_pmac_awacs_speaker_sw, chip);
988 if ((err = snd_ctl_add(chip->card, chip->speaker_sw_ctl)) < 0) 1010 err = snd_ctl_add(chip->card, chip->speaker_sw_ctl);
1011 if (err < 0)
989 return err; 1012 return err;
990 } 1013 }
991 1014
@@ -1020,7 +1043,8 @@ snd_pmac_awacs_init(struct snd_pmac *chip)
1020 chip->resume = snd_pmac_awacs_resume; 1043 chip->resume = snd_pmac_awacs_resume;
1021#endif 1044#endif
1022#ifdef PMAC_SUPPORT_AUTOMUTE 1045#ifdef PMAC_SUPPORT_AUTOMUTE
1023 if ((err = snd_pmac_add_automute(chip)) < 0) 1046 err = snd_pmac_add_automute(chip);
1047 if (err < 0)
1024 return err; 1048 return err;
1025 chip->detect_headphone = snd_pmac_awacs_detect_headphone; 1049 chip->detect_headphone = snd_pmac_awacs_detect_headphone;
1026 chip->update_automute = snd_pmac_awacs_update_automute; 1050 chip->update_automute = snd_pmac_awacs_update_automute;
diff --git a/sound/ppc/awacs.h b/sound/ppc/awacs.h
index 684bfa7cfff..c33e6a531cf 100644
--- a/sound/ppc/awacs.h
+++ b/sound/ppc/awacs.h
@@ -144,7 +144,7 @@ struct awacs_regs {
144#define VOLLEFT(x) (((~(x)) << 6) & MASK_OUTVOLLEFT) 144#define VOLLEFT(x) (((~(x)) << 6) & MASK_OUTVOLLEFT)
145 145
146/* address 6 */ 146/* address 6 */
147#define MASK_MIC_BOOST (0x4) /* screamer mic boost */ 147#define MASK_MIC_BOOST (0x4) /* screamer mic boost */
148#define SHIFT_MIC_BOOST 2 148#define SHIFT_MIC_BOOST 2
149 149
150/* Audio Codec Status Reg Bit Masks */ 150/* Audio Codec Status Reg Bit Masks */
@@ -175,7 +175,8 @@ struct awacs_regs {
175/* DBDMA ChannelStatus Bit Masks */ 175/* DBDMA ChannelStatus Bit Masks */
176/* ----- ------------- --- ----- */ 176/* ----- ------------- --- ----- */
177#define MASK_CSERR (0x1 << 7) /* Error */ 177#define MASK_CSERR (0x1 << 7) /* Error */
178#define MASK_EOI (0x1 << 6) /* End of Input -- only for Input Channel */ 178#define MASK_EOI (0x1 << 6) /* End of Input --
179 only for Input Channel */
179#define MASK_CSUNUSED (0x1f << 1) /* bits 1-5 not used */ 180#define MASK_CSUNUSED (0x1f << 1) /* bits 1-5 not used */
180#define MASK_WAIT (0x1) /* Wait */ 181#define MASK_WAIT (0x1) /* Wait */
181 182