aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci
diff options
context:
space:
mode:
authorAlexander Beregalov <a.beregalov@gmail.com>2008-09-07 06:17:02 -0400
committerJaroslav Kysela <perex@perex.cz>2008-09-09 03:11:46 -0400
commit3d8cb466a885cb5a0fb53ef3d39c36432d67fcbb (patch)
tree39530360556fd14dede1758548c5c5006bbf3572 /sound/pci
parent1de9fdc24b01869e70ef9c576c3978506748db85 (diff)
ALSA: ice1712.c: fix coding style
before: total: 113 errors, 169 warnings, 2786 lines checked total: 26 errors, 24 warnings, 504 lines checked after: total: 14 errors, 163 warnings, 2799 lines checked total: 0 errors, 24 warnings, 504 lines checked Compile tested only. Signed-off-by: Alexander Beregalov <a.beregalov@gmail.com> Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Diffstat (limited to 'sound/pci')
-rw-r--r--sound/pci/ice1712/ice1712.c237
-rw-r--r--sound/pci/ice1712/ice1712.h52
2 files changed, 151 insertions, 138 deletions
diff --git a/sound/pci/ice1712/ice1712.c b/sound/pci/ice1712/ice1712.c
index 05ffab65d167..5b442383fcda 100644
--- a/sound/pci/ice1712/ice1712.c
+++ b/sound/pci/ice1712/ice1712.c
@@ -17,7 +17,7 @@
17 * along with this program; if not, write to the Free Software 17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 * 19 *
20 */ 20 */
21 21
22/* 22/*
23 NOTES: 23 NOTES:
@@ -35,7 +35,7 @@
35 * 35 *
36 * 2002.11.26 James Stafford <jstafford@ampltd.com> 36 * 2002.11.26 James Stafford <jstafford@ampltd.com>
37 * Added support for VT1724 (Envy24HT) 37 * Added support for VT1724 (Envy24HT)
38 * I have left out support for 176.4 and 192 KHz for the moment. 38 * I have left out support for 176.4 and 192 KHz for the moment.
39 * I also haven't done anything with the internal S/PDIF transmitter or the MPU-401 39 * I also haven't done anything with the internal S/PDIF transmitter or the MPU-401
40 * 40 *
41 * 2003.02.20 Taksahi Iwai <tiwai@suse.de> 41 * 2003.02.20 Taksahi Iwai <tiwai@suse.de>
@@ -47,7 +47,7 @@
47 */ 47 */
48 48
49 49
50#include <asm/io.h> 50#include <linux/io.h>
51#include <linux/delay.h> 51#include <linux/delay.h>
52#include <linux/interrupt.h> 52#include <linux/interrupt.h>
53#include <linux/init.h> 53#include <linux/init.h>
@@ -123,7 +123,7 @@ static unsigned int PRO_RATE_DEFAULT = 44100;
123/* 123/*
124 * Basic I/O 124 * Basic I/O
125 */ 125 */
126 126
127/* check whether the clock mode is spdif-in */ 127/* check whether the clock mode is spdif-in */
128static inline int is_spdif_master(struct snd_ice1712 *ice) 128static inline int is_spdif_master(struct snd_ice1712 *ice)
129{ 129{
@@ -135,13 +135,13 @@ static inline int is_pro_rate_locked(struct snd_ice1712 *ice)
135 return is_spdif_master(ice) || PRO_RATE_LOCKED; 135 return is_spdif_master(ice) || PRO_RATE_LOCKED;
136} 136}
137 137
138static inline void snd_ice1712_ds_write(struct snd_ice1712 * ice, u8 channel, u8 addr, u32 data) 138static inline void snd_ice1712_ds_write(struct snd_ice1712 *ice, u8 channel, u8 addr, u32 data)
139{ 139{
140 outb((channel << 4) | addr, ICEDS(ice, INDEX)); 140 outb((channel << 4) | addr, ICEDS(ice, INDEX));
141 outl(data, ICEDS(ice, DATA)); 141 outl(data, ICEDS(ice, DATA));
142} 142}
143 143
144static inline u32 snd_ice1712_ds_read(struct snd_ice1712 * ice, u8 channel, u8 addr) 144static inline u32 snd_ice1712_ds_read(struct snd_ice1712 *ice, u8 channel, u8 addr)
145{ 145{
146 outb((channel << 4) | addr, ICEDS(ice, INDEX)); 146 outb((channel << 4) | addr, ICEDS(ice, INDEX));
147 return inl(ICEDS(ice, DATA)); 147 return inl(ICEDS(ice, DATA));
@@ -260,7 +260,7 @@ static unsigned short snd_ice1712_pro_ac97_read(struct snd_ac97 *ac97,
260static int snd_ice1712_digmix_route_ac97_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) 260static int snd_ice1712_digmix_route_ac97_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
261{ 261{
262 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); 262 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
263 263
264 ucontrol->value.integer.value[0] = inb(ICEMT(ice, MONITOR_ROUTECTRL)) & ICE1712_ROUTE_AC97 ? 1 : 0; 264 ucontrol->value.integer.value[0] = inb(ICEMT(ice, MONITOR_ROUTECTRL)) & ICE1712_ROUTE_AC97 ? 1 : 0;
265 return 0; 265 return 0;
266} 266}
@@ -269,11 +269,12 @@ static int snd_ice1712_digmix_route_ac97_put(struct snd_kcontrol *kcontrol, stru
269{ 269{
270 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); 270 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
271 unsigned char val, nval; 271 unsigned char val, nval;
272 272
273 spin_lock_irq(&ice->reg_lock); 273 spin_lock_irq(&ice->reg_lock);
274 val = inb(ICEMT(ice, MONITOR_ROUTECTRL)); 274 val = inb(ICEMT(ice, MONITOR_ROUTECTRL));
275 nval = val & ~ICE1712_ROUTE_AC97; 275 nval = val & ~ICE1712_ROUTE_AC97;
276 if (ucontrol->value.integer.value[0]) nval |= ICE1712_ROUTE_AC97; 276 if (ucontrol->value.integer.value[0])
277 nval |= ICE1712_ROUTE_AC97;
277 outb(nval, ICEMT(ice, MONITOR_ROUTECTRL)); 278 outb(nval, ICEMT(ice, MONITOR_ROUTECTRL));
278 spin_unlock_irq(&ice->reg_lock); 279 spin_unlock_irq(&ice->reg_lock);
279 return val != nval; 280 return val != nval;
@@ -329,7 +330,7 @@ static int snd_ice1712_cs8427_set_input_clock(struct snd_ice1712 *ice, int spdif
329 unsigned char reg[2] = { 0x80 | 4, 0 }; /* CS8427 auto increment | register number 4 + data */ 330 unsigned char reg[2] = { 0x80 | 4, 0 }; /* CS8427 auto increment | register number 4 + data */
330 unsigned char val, nval; 331 unsigned char val, nval;
331 int res = 0; 332 int res = 0;
332 333
333 snd_i2c_lock(ice->i2c); 334 snd_i2c_lock(ice->i2c);
334 if (snd_i2c_sendbytes(ice->cs8427, reg, 1) != 1) { 335 if (snd_i2c_sendbytes(ice->cs8427, reg, 1) != 1) {
335 snd_i2c_unlock(ice->i2c); 336 snd_i2c_unlock(ice->i2c);
@@ -381,9 +382,9 @@ int __devinit snd_ice1712_init_cs8427(struct snd_ice1712 *ice, int addr)
381{ 382{
382 int err; 383 int err;
383 384
384 if ((err = snd_cs8427_create(ice->i2c, addr, 385 err = snd_cs8427_create(ice->i2c, addr,
385 (ice->cs8427_timeout * HZ) / 1000, 386 (ice->cs8427_timeout * HZ) / 1000, &ice->cs8427);
386 &ice->cs8427)) < 0) { 387 if (err < 0) {
387 snd_printk(KERN_ERR "CS8427 initialization failed\n"); 388 snd_printk(KERN_ERR "CS8427 initialization failed\n");
388 return err; 389 return err;
389 } 390 }
@@ -395,9 +396,9 @@ int __devinit snd_ice1712_init_cs8427(struct snd_ice1712 *ice, int addr)
395 396
396static void snd_ice1712_set_input_clock_source(struct snd_ice1712 *ice, int spdif_is_master) 397static void snd_ice1712_set_input_clock_source(struct snd_ice1712 *ice, int spdif_is_master)
397{ 398{
398 /* change CS8427 clock source too */ 399 /* change CS8427 clock source too */
399 if (ice->cs8427) 400 if (ice->cs8427)
400 snd_ice1712_cs8427_set_input_clock(ice, spdif_is_master); 401 snd_ice1712_cs8427_set_input_clock(ice, spdif_is_master);
401 /* notify ak4524 chip as well */ 402 /* notify ak4524 chip as well */
402 if (spdif_is_master) { 403 if (spdif_is_master) {
403 unsigned int i; 404 unsigned int i;
@@ -457,11 +458,12 @@ static irqreturn_t snd_ice1712_interrupt(int irq, void *dev_id)
457 u16 pbkstatus; 458 u16 pbkstatus;
458 struct snd_pcm_substream *substream; 459 struct snd_pcm_substream *substream;
459 pbkstatus = inw(ICEDS(ice, INTSTAT)); 460 pbkstatus = inw(ICEDS(ice, INTSTAT));
460 //printk("pbkstatus = 0x%x\n", pbkstatus); 461 /* printk("pbkstatus = 0x%x\n", pbkstatus); */
461 for (idx = 0; idx < 6; idx++) { 462 for (idx = 0; idx < 6; idx++) {
462 if ((pbkstatus & (3 << (idx * 2))) == 0) 463 if ((pbkstatus & (3 << (idx * 2))) == 0)
463 continue; 464 continue;
464 if ((substream = ice->playback_con_substream_ds[idx]) != NULL) 465 substream = ice->playback_con_substream_ds[idx];
466 if (substream != NULL)
465 snd_pcm_period_elapsed(substream); 467 snd_pcm_period_elapsed(substream);
466 outw(3 << (idx * 2), ICEDS(ice, INTSTAT)); 468 outw(3 << (idx * 2), ICEDS(ice, INTSTAT));
467 } 469 }
@@ -507,7 +509,7 @@ static int snd_ice1712_playback_trigger(struct snd_pcm_substream *substream,
507 struct snd_ice1712 *ice = snd_pcm_substream_chip(substream); 509 struct snd_ice1712 *ice = snd_pcm_substream_chip(substream);
508 int result = 0; 510 int result = 0;
509 u32 tmp; 511 u32 tmp;
510 512
511 spin_lock(&ice->reg_lock); 513 spin_lock(&ice->reg_lock);
512 tmp = snd_ice1712_read(ice, ICE1712_IREG_PBK_CTRL); 514 tmp = snd_ice1712_read(ice, ICE1712_IREG_PBK_CTRL);
513 if (cmd == SNDRV_PCM_TRIGGER_START) { 515 if (cmd == SNDRV_PCM_TRIGGER_START) {
@@ -532,7 +534,7 @@ static int snd_ice1712_playback_ds_trigger(struct snd_pcm_substream *substream,
532 struct snd_ice1712 *ice = snd_pcm_substream_chip(substream); 534 struct snd_ice1712 *ice = snd_pcm_substream_chip(substream);
533 int result = 0; 535 int result = 0;
534 u32 tmp; 536 u32 tmp;
535 537
536 spin_lock(&ice->reg_lock); 538 spin_lock(&ice->reg_lock);
537 tmp = snd_ice1712_ds_read(ice, substream->number * 2, ICE1712_DSC_CONTROL); 539 tmp = snd_ice1712_ds_read(ice, substream->number * 2, ICE1712_DSC_CONTROL);
538 if (cmd == SNDRV_PCM_TRIGGER_START) { 540 if (cmd == SNDRV_PCM_TRIGGER_START) {
@@ -557,7 +559,7 @@ static int snd_ice1712_capture_trigger(struct snd_pcm_substream *substream,
557 struct snd_ice1712 *ice = snd_pcm_substream_chip(substream); 559 struct snd_ice1712 *ice = snd_pcm_substream_chip(substream);
558 int result = 0; 560 int result = 0;
559 u8 tmp; 561 u8 tmp;
560 562
561 spin_lock(&ice->reg_lock); 563 spin_lock(&ice->reg_lock);
562 tmp = snd_ice1712_read(ice, ICE1712_IREG_CAP_CTRL); 564 tmp = snd_ice1712_read(ice, ICE1712_IREG_CAP_CTRL);
563 if (cmd == SNDRV_PCM_TRIGGER_START) { 565 if (cmd == SNDRV_PCM_TRIGGER_START) {
@@ -711,8 +713,7 @@ static snd_pcm_uframes_t snd_ice1712_capture_pointer(struct snd_pcm_substream *s
711 return bytes_to_frames(substream->runtime, ptr); 713 return bytes_to_frames(substream->runtime, ptr);
712} 714}
713 715
714static const struct snd_pcm_hardware snd_ice1712_playback = 716static const struct snd_pcm_hardware snd_ice1712_playback = {
715{
716 .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | 717 .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED |
717 SNDRV_PCM_INFO_BLOCK_TRANSFER | 718 SNDRV_PCM_INFO_BLOCK_TRANSFER |
718 SNDRV_PCM_INFO_MMAP_VALID | 719 SNDRV_PCM_INFO_MMAP_VALID |
@@ -731,8 +732,7 @@ static const struct snd_pcm_hardware snd_ice1712_playback =
731 .fifo_size = 0, 732 .fifo_size = 0,
732}; 733};
733 734
734static const struct snd_pcm_hardware snd_ice1712_playback_ds = 735static const struct snd_pcm_hardware snd_ice1712_playback_ds = {
735{
736 .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | 736 .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED |
737 SNDRV_PCM_INFO_BLOCK_TRANSFER | 737 SNDRV_PCM_INFO_BLOCK_TRANSFER |
738 SNDRV_PCM_INFO_MMAP_VALID | 738 SNDRV_PCM_INFO_MMAP_VALID |
@@ -751,8 +751,7 @@ static const struct snd_pcm_hardware snd_ice1712_playback_ds =
751 .fifo_size = 0, 751 .fifo_size = 0,
752}; 752};
753 753
754static const struct snd_pcm_hardware snd_ice1712_capture = 754static const struct snd_pcm_hardware snd_ice1712_capture = {
755{
756 .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | 755 .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED |
757 SNDRV_PCM_INFO_BLOCK_TRANSFER | 756 SNDRV_PCM_INFO_BLOCK_TRANSFER |
758 SNDRV_PCM_INFO_MMAP_VALID), 757 SNDRV_PCM_INFO_MMAP_VALID),
@@ -788,7 +787,7 @@ static int snd_ice1712_playback_ds_open(struct snd_pcm_substream *substream)
788 787
789 ice->playback_con_substream_ds[substream->number] = substream; 788 ice->playback_con_substream_ds[substream->number] = substream;
790 runtime->hw = snd_ice1712_playback_ds; 789 runtime->hw = snd_ice1712_playback_ds;
791 spin_lock_irq(&ice->reg_lock); 790 spin_lock_irq(&ice->reg_lock);
792 tmp = inw(ICEDS(ice, INTMASK)) & ~(1 << (substream->number * 2)); 791 tmp = inw(ICEDS(ice, INTMASK)) & ~(1 << (substream->number * 2));
793 outw(tmp, ICEDS(ice, INTMASK)); 792 outw(tmp, ICEDS(ice, INTMASK));
794 spin_unlock_irq(&ice->reg_lock); 793 spin_unlock_irq(&ice->reg_lock);
@@ -821,7 +820,7 @@ static int snd_ice1712_playback_ds_close(struct snd_pcm_substream *substream)
821 struct snd_ice1712 *ice = snd_pcm_substream_chip(substream); 820 struct snd_ice1712 *ice = snd_pcm_substream_chip(substream);
822 u32 tmp; 821 u32 tmp;
823 822
824 spin_lock_irq(&ice->reg_lock); 823 spin_lock_irq(&ice->reg_lock);
825 tmp = inw(ICEDS(ice, INTMASK)) | (3 << (substream->number * 2)); 824 tmp = inw(ICEDS(ice, INTMASK)) | (3 << (substream->number * 2));
826 outw(tmp, ICEDS(ice, INTMASK)); 825 outw(tmp, ICEDS(ice, INTMASK));
827 spin_unlock_irq(&ice->reg_lock); 826 spin_unlock_irq(&ice->reg_lock);
@@ -870,7 +869,7 @@ static struct snd_pcm_ops snd_ice1712_capture_ops = {
870 .pointer = snd_ice1712_capture_pointer, 869 .pointer = snd_ice1712_capture_pointer,
871}; 870};
872 871
873static int __devinit snd_ice1712_pcm(struct snd_ice1712 * ice, int device, struct snd_pcm ** rpcm) 872static int __devinit snd_ice1712_pcm(struct snd_ice1712 *ice, int device, struct snd_pcm **rpcm)
874{ 873{
875 struct snd_pcm *pcm; 874 struct snd_pcm *pcm;
876 int err; 875 int err;
@@ -900,7 +899,7 @@ static int __devinit snd_ice1712_pcm(struct snd_ice1712 * ice, int device, struc
900 return 0; 899 return 0;
901} 900}
902 901
903static int __devinit snd_ice1712_pcm_ds(struct snd_ice1712 * ice, int device, struct snd_pcm ** rpcm) 902static int __devinit snd_ice1712_pcm_ds(struct snd_ice1712 *ice, int device, struct snd_pcm **rpcm)
904{ 903{
905 struct snd_pcm *pcm; 904 struct snd_pcm *pcm;
906 int err; 905 int err;
@@ -1029,14 +1028,14 @@ static void snd_ice1712_set_pro_rate(struct snd_ice1712 *ice, unsigned int rate,
1029 if (inb(ICEMT(ice, PLAYBACK_CONTROL)) & (ICE1712_CAPTURE_START_SHADOW| 1028 if (inb(ICEMT(ice, PLAYBACK_CONTROL)) & (ICE1712_CAPTURE_START_SHADOW|
1030 ICE1712_PLAYBACK_PAUSE| 1029 ICE1712_PLAYBACK_PAUSE|
1031 ICE1712_PLAYBACK_START)) { 1030 ICE1712_PLAYBACK_START)) {
1032 __out: 1031__out:
1033 spin_unlock_irqrestore(&ice->reg_lock, flags); 1032 spin_unlock_irqrestore(&ice->reg_lock, flags);
1034 return; 1033 return;
1035 } 1034 }
1036 if (!force && is_pro_rate_locked(ice)) 1035 if (!force && is_pro_rate_locked(ice))
1037 goto __out; 1036 goto __out;
1038 1037
1039 old = inb(ICEMT(ice, RATE)); 1038 old = inb(ICEMT(ice, RATE));
1040 if (!force && old == val) 1039 if (!force && old == val)
1041 goto __out; 1040 goto __out;
1042 outb(val, ICEMT(ice, RATE)); 1041 outb(val, ICEMT(ice, RATE));
@@ -1123,8 +1122,7 @@ static snd_pcm_uframes_t snd_ice1712_capture_pro_pointer(struct snd_pcm_substrea
1123 return bytes_to_frames(substream->runtime, ptr); 1122 return bytes_to_frames(substream->runtime, ptr);
1124} 1123}
1125 1124
1126static const struct snd_pcm_hardware snd_ice1712_playback_pro = 1125static const struct snd_pcm_hardware snd_ice1712_playback_pro = {
1127{
1128 .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | 1126 .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED |
1129 SNDRV_PCM_INFO_BLOCK_TRANSFER | 1127 SNDRV_PCM_INFO_BLOCK_TRANSFER |
1130 SNDRV_PCM_INFO_MMAP_VALID | 1128 SNDRV_PCM_INFO_MMAP_VALID |
@@ -1143,8 +1141,7 @@ static const struct snd_pcm_hardware snd_ice1712_playback_pro =
1143 .fifo_size = 0, 1141 .fifo_size = 0,
1144}; 1142};
1145 1143
1146static const struct snd_pcm_hardware snd_ice1712_capture_pro = 1144static const struct snd_pcm_hardware snd_ice1712_capture_pro = {
1147{
1148 .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | 1145 .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED |
1149 SNDRV_PCM_INFO_BLOCK_TRANSFER | 1146 SNDRV_PCM_INFO_BLOCK_TRANSFER |
1150 SNDRV_PCM_INFO_MMAP_VALID | 1147 SNDRV_PCM_INFO_MMAP_VALID |
@@ -1238,7 +1235,7 @@ static struct snd_pcm_ops snd_ice1712_capture_pro_ops = {
1238 .pointer = snd_ice1712_capture_pro_pointer, 1235 .pointer = snd_ice1712_capture_pro_pointer,
1239}; 1236};
1240 1237
1241static int __devinit snd_ice1712_pcm_profi(struct snd_ice1712 * ice, int device, struct snd_pcm ** rpcm) 1238static int __devinit snd_ice1712_pcm_profi(struct snd_ice1712 *ice, int device, struct snd_pcm **rpcm)
1242{ 1239{
1243 struct snd_pcm *pcm; 1240 struct snd_pcm *pcm;
1244 int err; 1241 int err;
@@ -1262,7 +1259,7 @@ static int __devinit snd_ice1712_pcm_profi(struct snd_ice1712 * ice, int device,
1262 ice->pcm_pro = pcm; 1259 ice->pcm_pro = pcm;
1263 if (rpcm) 1260 if (rpcm)
1264 *rpcm = pcm; 1261 *rpcm = pcm;
1265 1262
1266 if (ice->cs8427) { 1263 if (ice->cs8427) {
1267 /* assign channels to iec958 */ 1264 /* assign channels to iec958 */
1268 err = snd_cs8427_iec958_build(ice->cs8427, 1265 err = snd_cs8427_iec958_build(ice->cs8427,
@@ -1272,7 +1269,8 @@ static int __devinit snd_ice1712_pcm_profi(struct snd_ice1712 * ice, int device,
1272 return err; 1269 return err;
1273 } 1270 }
1274 1271
1275 if ((err = snd_ice1712_build_pro_mixer(ice)) < 0) 1272 err = snd_ice1712_build_pro_mixer(ice);
1273 if (err < 0)
1276 return err; 1274 return err;
1277 return 0; 1275 return 0;
1278} 1276}
@@ -1299,7 +1297,7 @@ static int snd_ice1712_pro_mixer_switch_get(struct snd_kcontrol *kcontrol, struc
1299 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); 1297 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
1300 int priv_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id) + 1298 int priv_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id) +
1301 kcontrol->private_value; 1299 kcontrol->private_value;
1302 1300
1303 spin_lock_irq(&ice->reg_lock); 1301 spin_lock_irq(&ice->reg_lock);
1304 ucontrol->value.integer.value[0] = 1302 ucontrol->value.integer.value[0] =
1305 !((ice->pro_volumes[priv_idx] >> 15) & 1); 1303 !((ice->pro_volumes[priv_idx] >> 15) & 1);
@@ -1341,7 +1339,7 @@ static int snd_ice1712_pro_mixer_volume_get(struct snd_kcontrol *kcontrol, struc
1341 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); 1339 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
1342 int priv_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id) + 1340 int priv_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id) +
1343 kcontrol->private_value; 1341 kcontrol->private_value;
1344 1342
1345 spin_lock_irq(&ice->reg_lock); 1343 spin_lock_irq(&ice->reg_lock);
1346 ucontrol->value.integer.value[0] = 1344 ucontrol->value.integer.value[0] =
1347 (ice->pro_volumes[priv_idx] >> 0) & 127; 1345 (ice->pro_volumes[priv_idx] >> 0) & 127;
@@ -1406,7 +1404,7 @@ static struct snd_kcontrol_new snd_ice1712_multi_capture_analog_switch __devinit
1406 1404
1407static struct snd_kcontrol_new snd_ice1712_multi_capture_spdif_switch __devinitdata = { 1405static struct snd_kcontrol_new snd_ice1712_multi_capture_spdif_switch __devinitdata = {
1408 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 1406 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1409 .name = SNDRV_CTL_NAME_IEC958("Multi ",CAPTURE,SWITCH), 1407 .name = SNDRV_CTL_NAME_IEC958("Multi ", CAPTURE, SWITCH),
1410 .info = snd_ice1712_pro_mixer_switch_info, 1408 .info = snd_ice1712_pro_mixer_switch_info,
1411 .get = snd_ice1712_pro_mixer_switch_get, 1409 .get = snd_ice1712_pro_mixer_switch_get,
1412 .put = snd_ice1712_pro_mixer_switch_put, 1410 .put = snd_ice1712_pro_mixer_switch_put,
@@ -1428,7 +1426,7 @@ static struct snd_kcontrol_new snd_ice1712_multi_capture_analog_volume __devinit
1428 1426
1429static struct snd_kcontrol_new snd_ice1712_multi_capture_spdif_volume __devinitdata = { 1427static struct snd_kcontrol_new snd_ice1712_multi_capture_spdif_volume __devinitdata = {
1430 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 1428 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1431 .name = SNDRV_CTL_NAME_IEC958("Multi ",CAPTURE,VOLUME), 1429 .name = SNDRV_CTL_NAME_IEC958("Multi ", CAPTURE, VOLUME),
1432 .info = snd_ice1712_pro_mixer_volume_info, 1430 .info = snd_ice1712_pro_mixer_volume_info,
1433 .get = snd_ice1712_pro_mixer_volume_get, 1431 .get = snd_ice1712_pro_mixer_volume_get,
1434 .put = snd_ice1712_pro_mixer_volume_put, 1432 .put = snd_ice1712_pro_mixer_volume_put,
@@ -1448,7 +1446,7 @@ static int __devinit snd_ice1712_build_pro_mixer(struct snd_ice1712 *ice)
1448 if (err < 0) 1446 if (err < 0)
1449 return err; 1447 return err;
1450 } 1448 }
1451 1449
1452 if (ice->num_total_adcs > 0) { 1450 if (ice->num_total_adcs > 0) {
1453 struct snd_kcontrol_new tmp = snd_ice1712_multi_capture_analog_switch; 1451 struct snd_kcontrol_new tmp = snd_ice1712_multi_capture_analog_switch;
1454 tmp.count = ice->num_total_adcs; 1452 tmp.count = ice->num_total_adcs;
@@ -1495,7 +1493,7 @@ static void snd_ice1712_mixer_free_ac97(struct snd_ac97 *ac97)
1495 ice->ac97 = NULL; 1493 ice->ac97 = NULL;
1496} 1494}
1497 1495
1498static int __devinit snd_ice1712_ac97_mixer(struct snd_ice1712 * ice) 1496static int __devinit snd_ice1712_ac97_mixer(struct snd_ice1712 *ice)
1499{ 1497{
1500 int err, bus_num = 0; 1498 int err, bus_num = 0;
1501 struct snd_ac97_template ac97; 1499 struct snd_ac97_template ac97;
@@ -1510,27 +1508,32 @@ static int __devinit snd_ice1712_ac97_mixer(struct snd_ice1712 * ice)
1510 }; 1508 };
1511 1509
1512 if (ice_has_con_ac97(ice)) { 1510 if (ice_has_con_ac97(ice)) {
1513 if ((err = snd_ac97_bus(ice->card, bus_num++, &con_ops, NULL, &pbus)) < 0) 1511 err = snd_ac97_bus(ice->card, bus_num++, &con_ops, NULL, &pbus);
1512 if (err < 0)
1514 return err; 1513 return err;
1515 memset(&ac97, 0, sizeof(ac97)); 1514 memset(&ac97, 0, sizeof(ac97));
1516 ac97.private_data = ice; 1515 ac97.private_data = ice;
1517 ac97.private_free = snd_ice1712_mixer_free_ac97; 1516 ac97.private_free = snd_ice1712_mixer_free_ac97;
1518 if ((err = snd_ac97_mixer(pbus, &ac97, &ice->ac97)) < 0) 1517 err = snd_ac97_mixer(pbus, &ac97, &ice->ac97);
1518 if (err < 0)
1519 printk(KERN_WARNING "ice1712: cannot initialize ac97 for consumer, skipped\n"); 1519 printk(KERN_WARNING "ice1712: cannot initialize ac97 for consumer, skipped\n");
1520 else { 1520 else {
1521 if ((err = snd_ctl_add(ice->card, snd_ctl_new1(&snd_ice1712_mixer_digmix_route_ac97, ice))) < 0) 1521 err = snd_ctl_add(ice->card, snd_ctl_new1(&snd_ice1712_mixer_digmix_route_ac97, ice));
1522 if (err < 0)
1522 return err; 1523 return err;
1523 return 0; 1524 return 0;
1524 } 1525 }
1525 } 1526 }
1526 1527
1527 if (! (ice->eeprom.data[ICE_EEP1_ACLINK] & ICE1712_CFG_PRO_I2S)) { 1528 if (!(ice->eeprom.data[ICE_EEP1_ACLINK] & ICE1712_CFG_PRO_I2S)) {
1528 if ((err = snd_ac97_bus(ice->card, bus_num, &pro_ops, NULL, &pbus)) < 0) 1529 err = snd_ac97_bus(ice->card, bus_num, &pro_ops, NULL, &pbus);
1530 if (err < 0)
1529 return err; 1531 return err;
1530 memset(&ac97, 0, sizeof(ac97)); 1532 memset(&ac97, 0, sizeof(ac97));
1531 ac97.private_data = ice; 1533 ac97.private_data = ice;
1532 ac97.private_free = snd_ice1712_mixer_free_ac97; 1534 ac97.private_free = snd_ice1712_mixer_free_ac97;
1533 if ((err = snd_ac97_mixer(pbus, &ac97, &ice->ac97)) < 0) 1535 err = snd_ac97_mixer(pbus, &ac97, &ice->ac97);
1536 if (err < 0)
1534 printk(KERN_WARNING "ice1712: cannot initialize pro ac97, skipped\n"); 1537 printk(KERN_WARNING "ice1712: cannot initialize pro ac97, skipped\n");
1535 else 1538 else
1536 return 0; 1539 return 0;
@@ -1549,7 +1552,7 @@ static inline unsigned int eeprom_double(struct snd_ice1712 *ice, int idx)
1549 return (unsigned int)ice->eeprom.data[idx] | ((unsigned int)ice->eeprom.data[idx + 1] << 8); 1552 return (unsigned int)ice->eeprom.data[idx] | ((unsigned int)ice->eeprom.data[idx + 1] << 8);
1550} 1553}
1551 1554
1552static void snd_ice1712_proc_read(struct snd_info_entry *entry, 1555static void snd_ice1712_proc_read(struct snd_info_entry *entry,
1553 struct snd_info_buffer *buffer) 1556 struct snd_info_buffer *buffer)
1554{ 1557{
1555 struct snd_ice1712 *ice = entry->private_data; 1558 struct snd_ice1712 *ice = entry->private_data;
@@ -1585,15 +1588,15 @@ static void snd_ice1712_proc_read(struct snd_info_entry *entry,
1585 snd_iprintf(buffer, " SPDOUT : 0x%04x\n", (unsigned)inw(ICEMT(ice, ROUTE_SPDOUT))); 1588 snd_iprintf(buffer, " SPDOUT : 0x%04x\n", (unsigned)inw(ICEMT(ice, ROUTE_SPDOUT)));
1586 snd_iprintf(buffer, " RATE : 0x%02x\n", (unsigned)inb(ICEMT(ice, RATE))); 1589 snd_iprintf(buffer, " RATE : 0x%02x\n", (unsigned)inb(ICEMT(ice, RATE)));
1587 snd_iprintf(buffer, " GPIO_DATA : 0x%02x\n", (unsigned)snd_ice1712_get_gpio_data(ice)); 1590 snd_iprintf(buffer, " GPIO_DATA : 0x%02x\n", (unsigned)snd_ice1712_get_gpio_data(ice));
1588 snd_iprintf(buffer, " GPIO_WRITE_MASK : 0x%02x\n", (unsigned)snd_ice1712_read(ice, ICE1712_IREG_GPIO_WRITE_MASK)); 1591 snd_iprintf(buffer, " GPIO_WRITE_MASK : 0x%02x\n", (unsigned)snd_ice1712_read(ice, ICE1712_IREG_GPIO_WRITE_MASK));
1589 snd_iprintf(buffer, " GPIO_DIRECTION : 0x%02x\n", (unsigned)snd_ice1712_read(ice, ICE1712_IREG_GPIO_DIRECTION)); 1592 snd_iprintf(buffer, " GPIO_DIRECTION : 0x%02x\n", (unsigned)snd_ice1712_read(ice, ICE1712_IREG_GPIO_DIRECTION));
1590} 1593}
1591 1594
1592static void __devinit snd_ice1712_proc_init(struct snd_ice1712 * ice) 1595static void __devinit snd_ice1712_proc_init(struct snd_ice1712 *ice)
1593{ 1596{
1594 struct snd_info_entry *entry; 1597 struct snd_info_entry *entry;
1595 1598
1596 if (! snd_card_proc_new(ice->card, "ice1712", &entry)) 1599 if (!snd_card_proc_new(ice->card, "ice1712", &entry))
1597 snd_info_set_text_ops(entry, ice, snd_ice1712_proc_read); 1600 snd_info_set_text_ops(entry, ice, snd_ice1712_proc_read);
1598} 1601}
1599 1602
@@ -1613,7 +1616,7 @@ static int snd_ice1712_eeprom_get(struct snd_kcontrol *kcontrol,
1613 struct snd_ctl_elem_value *ucontrol) 1616 struct snd_ctl_elem_value *ucontrol)
1614{ 1617{
1615 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); 1618 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
1616 1619
1617 memcpy(ucontrol->value.bytes.data, &ice->eeprom, sizeof(ice->eeprom)); 1620 memcpy(ucontrol->value.bytes.data, &ice->eeprom, sizeof(ice->eeprom));
1618 return 0; 1621 return 0;
1619} 1622}
@@ -1641,7 +1644,7 @@ static int snd_ice1712_spdif_default_get(struct snd_kcontrol *kcontrol,
1641{ 1644{
1642 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); 1645 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
1643 if (ice->spdif.ops.default_get) 1646 if (ice->spdif.ops.default_get)
1644 ice->spdif.ops.default_get(ice, ucontrol); 1647 ice->spdif.ops.default_get(ice, ucontrol);
1645 return 0; 1648 return 0;
1646} 1649}
1647 1650
@@ -1657,7 +1660,7 @@ static int snd_ice1712_spdif_default_put(struct snd_kcontrol *kcontrol,
1657static struct snd_kcontrol_new snd_ice1712_spdif_default __devinitdata = 1660static struct snd_kcontrol_new snd_ice1712_spdif_default __devinitdata =
1658{ 1661{
1659 .iface = SNDRV_CTL_ELEM_IFACE_PCM, 1662 .iface = SNDRV_CTL_ELEM_IFACE_PCM,
1660 .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,DEFAULT), 1663 .name = SNDRV_CTL_NAME_IEC958("", PLAYBACK, DEFAULT),
1661 .info = snd_ice1712_spdif_info, 1664 .info = snd_ice1712_spdif_info,
1662 .get = snd_ice1712_spdif_default_get, 1665 .get = snd_ice1712_spdif_default_get,
1663 .put = snd_ice1712_spdif_default_put 1666 .put = snd_ice1712_spdif_default_put
@@ -1709,7 +1712,7 @@ static struct snd_kcontrol_new snd_ice1712_spdif_maskc __devinitdata =
1709{ 1712{
1710 .access = SNDRV_CTL_ELEM_ACCESS_READ, 1713 .access = SNDRV_CTL_ELEM_ACCESS_READ,
1711 .iface = SNDRV_CTL_ELEM_IFACE_PCM, 1714 .iface = SNDRV_CTL_ELEM_IFACE_PCM,
1712 .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,CON_MASK), 1715 .name = SNDRV_CTL_NAME_IEC958("", PLAYBACK, CON_MASK),
1713 .info = snd_ice1712_spdif_info, 1716 .info = snd_ice1712_spdif_info,
1714 .get = snd_ice1712_spdif_maskc_get, 1717 .get = snd_ice1712_spdif_maskc_get,
1715}; 1718};
@@ -1718,7 +1721,7 @@ static struct snd_kcontrol_new snd_ice1712_spdif_maskp __devinitdata =
1718{ 1721{
1719 .access = SNDRV_CTL_ELEM_ACCESS_READ, 1722 .access = SNDRV_CTL_ELEM_ACCESS_READ,
1720 .iface = SNDRV_CTL_ELEM_IFACE_PCM, 1723 .iface = SNDRV_CTL_ELEM_IFACE_PCM,
1721 .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,PRO_MASK), 1724 .name = SNDRV_CTL_NAME_IEC958("", PLAYBACK, PRO_MASK),
1722 .info = snd_ice1712_spdif_info, 1725 .info = snd_ice1712_spdif_info,
1723 .get = snd_ice1712_spdif_maskp_get, 1726 .get = snd_ice1712_spdif_maskp_get,
1724}; 1727};
@@ -1746,7 +1749,7 @@ static struct snd_kcontrol_new snd_ice1712_spdif_stream __devinitdata =
1746 .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | 1749 .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE |
1747 SNDRV_CTL_ELEM_ACCESS_INACTIVE), 1750 SNDRV_CTL_ELEM_ACCESS_INACTIVE),
1748 .iface = SNDRV_CTL_ELEM_IFACE_PCM, 1751 .iface = SNDRV_CTL_ELEM_IFACE_PCM,
1749 .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,PCM_STREAM), 1752 .name = SNDRV_CTL_NAME_IEC958("", PLAYBACK, PCM_STREAM),
1750 .info = snd_ice1712_spdif_info, 1753 .info = snd_ice1712_spdif_info,
1751 .get = snd_ice1712_spdif_stream_get, 1754 .get = snd_ice1712_spdif_stream_get,
1752 .put = snd_ice1712_spdif_stream_put 1755 .put = snd_ice1712_spdif_stream_put
@@ -1758,7 +1761,7 @@ int snd_ice1712_gpio_get(struct snd_kcontrol *kcontrol,
1758 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); 1761 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
1759 unsigned char mask = kcontrol->private_value & 0xff; 1762 unsigned char mask = kcontrol->private_value & 0xff;
1760 int invert = (kcontrol->private_value & (1<<24)) ? 1 : 0; 1763 int invert = (kcontrol->private_value & (1<<24)) ? 1 : 0;
1761 1764
1762 snd_ice1712_save_gpio_status(ice); 1765 snd_ice1712_save_gpio_status(ice);
1763 ucontrol->value.integer.value[0] = 1766 ucontrol->value.integer.value[0] =
1764 (snd_ice1712_gpio_read(ice) & mask ? 1 : 0) ^ invert; 1767 (snd_ice1712_gpio_read(ice) & mask ? 1 : 0) ^ invert;
@@ -1825,7 +1828,7 @@ static int snd_ice1712_pro_internal_clock_get(struct snd_kcontrol *kcontrol,
1825 9, 6, 3, 1, 7, 4, 0, 12, 8, 5, 2, 11, 255, 255, 255, 10 1828 9, 6, 3, 1, 7, 4, 0, 12, 8, 5, 2, 11, 255, 255, 255, 10
1826 }; 1829 };
1827 unsigned char val; 1830 unsigned char val;
1828 1831
1829 spin_lock_irq(&ice->reg_lock); 1832 spin_lock_irq(&ice->reg_lock);
1830 if (is_spdif_master(ice)) { 1833 if (is_spdif_master(ice)) {
1831 ucontrol->value.enumerated.item[0] = 13; 1834 ucontrol->value.enumerated.item[0] = 13;
@@ -1867,7 +1870,7 @@ static int snd_ice1712_pro_internal_clock_put(struct snd_kcontrol *kcontrol,
1867 1870
1868 if ((oval & ICE1712_SPDIF_MASTER) != 1871 if ((oval & ICE1712_SPDIF_MASTER) !=
1869 (inb(ICEMT(ice, RATE)) & ICE1712_SPDIF_MASTER)) 1872 (inb(ICEMT(ice, RATE)) & ICE1712_SPDIF_MASTER))
1870 snd_ice1712_set_input_clock_source(ice, is_spdif_master(ice)); 1873 snd_ice1712_set_input_clock_source(ice, is_spdif_master(ice));
1871 1874
1872 return change; 1875 return change;
1873} 1876}
@@ -1897,7 +1900,7 @@ static int snd_ice1712_pro_internal_clock_default_info(struct snd_kcontrol *kcon
1897 "64000", /* 10: 15 */ 1900 "64000", /* 10: 15 */
1898 "88200", /* 11: 11 */ 1901 "88200", /* 11: 11 */
1899 "96000", /* 12: 7 */ 1902 "96000", /* 12: 7 */
1900 // "IEC958 Input", /* 13: -- */ 1903 /* "IEC958 Input", 13: -- */
1901 }; 1904 };
1902 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; 1905 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
1903 uinfo->count = 1; 1906 uinfo->count = 1;
@@ -2026,7 +2029,7 @@ static int snd_ice1712_pro_route_info(struct snd_kcontrol *kcontrol,
2026 "IEC958 In L", "IEC958 In R", /* 9-10 */ 2029 "IEC958 In L", "IEC958 In R", /* 9-10 */
2027 "Digital Mixer", /* 11 - optional */ 2030 "Digital Mixer", /* 11 - optional */
2028 }; 2031 };
2029 2032
2030 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; 2033 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
2031 uinfo->count = 1; 2034 uinfo->count = 1;
2032 uinfo->value.enumerated.items = 2035 uinfo->value.enumerated.items =
@@ -2070,7 +2073,7 @@ static int snd_ice1712_pro_route_analog_put(struct snd_kcontrol *kcontrol,
2070 int change, shift; 2073 int change, shift;
2071 int idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); 2074 int idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
2072 unsigned int val, old_val, nval; 2075 unsigned int val, old_val, nval;
2073 2076
2074 /* update PSDOUT */ 2077 /* update PSDOUT */
2075 if (ucontrol->value.enumerated.item[0] >= 11) 2078 if (ucontrol->value.enumerated.item[0] >= 11)
2076 nval = idx < 2 ? 1 : 0; /* dig mixer (or pcm) */ 2079 nval = idx < 2 ? 1 : 0; /* dig mixer (or pcm) */
@@ -2140,7 +2143,7 @@ static int snd_ice1712_pro_route_spdif_put(struct snd_kcontrol *kcontrol,
2140 int change, shift; 2143 int change, shift;
2141 int idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); 2144 int idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
2142 unsigned int val, old_val, nval; 2145 unsigned int val, old_val, nval;
2143 2146
2144 /* update SPDOUT */ 2147 /* update SPDOUT */
2145 spin_lock_irq(&ice->reg_lock); 2148 spin_lock_irq(&ice->reg_lock);
2146 val = old_val = inw(ICEMT(ice, ROUTE_SPDOUT)); 2149 val = old_val = inw(ICEMT(ice, ROUTE_SPDOUT));
@@ -2182,7 +2185,7 @@ static struct snd_kcontrol_new snd_ice1712_mixer_pro_analog_route __devinitdata
2182 2185
2183static struct snd_kcontrol_new snd_ice1712_mixer_pro_spdif_route __devinitdata = { 2186static struct snd_kcontrol_new snd_ice1712_mixer_pro_spdif_route __devinitdata = {
2184 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 2187 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2185 .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,NONE) "Route", 2188 .name = SNDRV_CTL_NAME_IEC958("", PLAYBACK, NONE) "Route",
2186 .info = snd_ice1712_pro_route_info, 2189 .info = snd_ice1712_pro_route_info,
2187 .get = snd_ice1712_pro_route_spdif_get, 2190 .get = snd_ice1712_pro_route_spdif_get,
2188 .put = snd_ice1712_pro_route_spdif_put, 2191 .put = snd_ice1712_pro_route_spdif_put,
@@ -2204,7 +2207,7 @@ static int snd_ice1712_pro_volume_rate_get(struct snd_kcontrol *kcontrol,
2204 struct snd_ctl_elem_value *ucontrol) 2207 struct snd_ctl_elem_value *ucontrol)
2205{ 2208{
2206 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); 2209 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
2207 2210
2208 ucontrol->value.integer.value[0] = inb(ICEMT(ice, MONITOR_RATE)); 2211 ucontrol->value.integer.value[0] = inb(ICEMT(ice, MONITOR_RATE));
2209 return 0; 2212 return 0;
2210} 2213}
@@ -2245,7 +2248,7 @@ static int snd_ice1712_pro_peak_get(struct snd_kcontrol *kcontrol,
2245{ 2248{
2246 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); 2249 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
2247 int idx; 2250 int idx;
2248 2251
2249 spin_lock_irq(&ice->reg_lock); 2252 spin_lock_irq(&ice->reg_lock);
2250 for (idx = 0; idx < 22; idx++) { 2253 for (idx = 0; idx < 22; idx++) {
2251 outb(idx, ICEMT(ice, MONITOR_PEAKINDEX)); 2254 outb(idx, ICEMT(ice, MONITOR_PEAKINDEX));
@@ -2296,12 +2299,12 @@ static int __devinit snd_ice1712_read_eeprom(struct snd_ice1712 *ice,
2296 unsigned int i, size; 2299 unsigned int i, size;
2297 struct snd_ice1712_card_info * const *tbl, *c; 2300 struct snd_ice1712_card_info * const *tbl, *c;
2298 2301
2299 if (! modelname || ! *modelname) { 2302 if (!modelname || !*modelname) {
2300 ice->eeprom.subvendor = 0; 2303 ice->eeprom.subvendor = 0;
2301 if ((inb(ICEREG(ice, I2C_CTRL)) & ICE1712_I2C_EEPROM) != 0) 2304 if ((inb(ICEREG(ice, I2C_CTRL)) & ICE1712_I2C_EEPROM) != 0)
2302 ice->eeprom.subvendor = (snd_ice1712_read_i2c(ice, dev, 0x00) << 0) | 2305 ice->eeprom.subvendor = (snd_ice1712_read_i2c(ice, dev, 0x00) << 0) |
2303 (snd_ice1712_read_i2c(ice, dev, 0x01) << 8) | 2306 (snd_ice1712_read_i2c(ice, dev, 0x01) << 8) |
2304 (snd_ice1712_read_i2c(ice, dev, 0x02) << 16) | 2307 (snd_ice1712_read_i2c(ice, dev, 0x02) << 16) |
2305 (snd_ice1712_read_i2c(ice, dev, 0x03) << 24); 2308 (snd_ice1712_read_i2c(ice, dev, 0x03) << 24);
2306 if (ice->eeprom.subvendor == 0 || 2309 if (ice->eeprom.subvendor == 0 ||
2307 ice->eeprom.subvendor == (unsigned int)-1) { 2310 ice->eeprom.subvendor == (unsigned int)-1) {
@@ -2318,12 +2321,12 @@ static int __devinit snd_ice1712_read_eeprom(struct snd_ice1712 *ice,
2318 } 2321 }
2319 for (tbl = card_tables; *tbl; tbl++) { 2322 for (tbl = card_tables; *tbl; tbl++) {
2320 for (c = *tbl; c->subvendor; c++) { 2323 for (c = *tbl; c->subvendor; c++) {
2321 if (modelname && c->model && ! strcmp(modelname, c->model)) { 2324 if (modelname && c->model && !strcmp(modelname, c->model)) {
2322 printk(KERN_INFO "ice1712: Using board model %s\n", c->name); 2325 printk(KERN_INFO "ice1712: Using board model %s\n", c->name);
2323 ice->eeprom.subvendor = c->subvendor; 2326 ice->eeprom.subvendor = c->subvendor;
2324 } else if (c->subvendor != ice->eeprom.subvendor) 2327 } else if (c->subvendor != ice->eeprom.subvendor)
2325 continue; 2328 continue;
2326 if (! c->eeprom_size || ! c->eeprom_data) 2329 if (!c->eeprom_size || !c->eeprom_data)
2327 goto found; 2330 goto found;
2328 /* if the EEPROM is given by the driver, use it */ 2331 /* if the EEPROM is given by the driver, use it */
2329 snd_printdd("using the defined eeprom..\n"); 2332 snd_printdd("using the defined eeprom..\n");
@@ -2484,13 +2487,13 @@ static int __devinit snd_ice1712_build_controls(struct snd_ice1712 *ice)
2484 2487
2485static int snd_ice1712_free(struct snd_ice1712 *ice) 2488static int snd_ice1712_free(struct snd_ice1712 *ice)
2486{ 2489{
2487 if (! ice->port) 2490 if (!ice->port)
2488 goto __hw_end; 2491 goto __hw_end;
2489 /* mask all interrupts */ 2492 /* mask all interrupts */
2490 outb(0xc0, ICEMT(ice, IRQ)); 2493 outb(0xc0, ICEMT(ice, IRQ));
2491 outb(0xff, ICEREG(ice, IRQMASK)); 2494 outb(0xff, ICEREG(ice, IRQMASK));
2492 /* --- */ 2495 /* --- */
2493 __hw_end: 2496__hw_end:
2494 if (ice->irq >= 0) 2497 if (ice->irq >= 0)
2495 free_irq(ice->irq, ice); 2498 free_irq(ice->irq, ice);
2496 2499
@@ -2515,7 +2518,7 @@ static int __devinit snd_ice1712_create(struct snd_card *card,
2515 int omni, 2518 int omni,
2516 int cs8427_timeout, 2519 int cs8427_timeout,
2517 int dxr_enable, 2520 int dxr_enable,
2518 struct snd_ice1712 ** r_ice1712) 2521 struct snd_ice1712 **r_ice1712)
2519{ 2522{
2520 struct snd_ice1712 *ice; 2523 struct snd_ice1712 *ice;
2521 int err; 2524 int err;
@@ -2525,8 +2528,9 @@ static int __devinit snd_ice1712_create(struct snd_card *card,
2525 2528
2526 *r_ice1712 = NULL; 2529 *r_ice1712 = NULL;
2527 2530
2528 /* enable PCI device */ 2531 /* enable PCI device */
2529 if ((err = pci_enable_device(pci)) < 0) 2532 err = pci_enable_device(pci);
2533 if (err < 0)
2530 return err; 2534 return err;
2531 /* check, if we can restrict PCI DMA transfers to 28 bits */ 2535 /* check, if we can restrict PCI DMA transfers to 28 bits */
2532 if (pci_set_dma_mask(pci, DMA_28BIT_MASK) < 0 || 2536 if (pci_set_dma_mask(pci, DMA_28BIT_MASK) < 0 ||
@@ -2570,7 +2574,8 @@ static int __devinit snd_ice1712_create(struct snd_card *card,
2570 snd_ice1712_proc_init(ice); 2574 snd_ice1712_proc_init(ice);
2571 synchronize_irq(pci->irq); 2575 synchronize_irq(pci->irq);
2572 2576
2573 if ((err = pci_request_regions(pci, "ICE1712")) < 0) { 2577 err = pci_request_regions(pci, "ICE1712");
2578 if (err < 0) {
2574 kfree(ice); 2579 kfree(ice);
2575 pci_disable_device(pci); 2580 pci_disable_device(pci);
2576 return err; 2581 return err;
@@ -2586,7 +2591,7 @@ static int __devinit snd_ice1712_create(struct snd_card *card,
2586 snd_ice1712_free(ice); 2591 snd_ice1712_free(ice);
2587 return -EIO; 2592 return -EIO;
2588 } 2593 }
2589 2594
2590 ice->irq = pci->irq; 2595 ice->irq = pci->irq;
2591 2596
2592 if (snd_ice1712_read_eeprom(ice, modelname) < 0) { 2597 if (snd_ice1712_read_eeprom(ice, modelname) < 0) {
@@ -2606,9 +2611,10 @@ static int __devinit snd_ice1712_create(struct snd_card *card,
2606 ICEREG(ice, IRQMASK)); 2611 ICEREG(ice, IRQMASK));
2607 outb(0x00, ICEMT(ice, IRQ)); 2612 outb(0x00, ICEMT(ice, IRQ));
2608 2613
2609 if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, ice, &ops)) < 0) { 2614 err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, ice, &ops);
2615 if (err < 0) {
2610 snd_ice1712_free(ice); 2616 snd_ice1712_free(ice);
2611 return err; 2617 return err;
2612 } 2618 }
2613 2619
2614 snd_card_set_dev(card, &pci->dev); 2620 snd_card_set_dev(card, &pci->dev);
@@ -2648,10 +2654,10 @@ static int __devinit snd_ice1712_probe(struct pci_dev *pci,
2648 2654
2649 strcpy(card->driver, "ICE1712"); 2655 strcpy(card->driver, "ICE1712");
2650 strcpy(card->shortname, "ICEnsemble ICE1712"); 2656 strcpy(card->shortname, "ICEnsemble ICE1712");
2651 2657
2652 if ((err = snd_ice1712_create(card, pci, model[dev], omni[dev], 2658 err = snd_ice1712_create(card, pci, model[dev], omni[dev],
2653 cs8427_timeout[dev], dxr_enable[dev], 2659 cs8427_timeout[dev], dxr_enable[dev], &ice);
2654 &ice)) < 0) { 2660 if (err < 0) {
2655 snd_card_free(card); 2661 snd_card_free(card);
2656 return err; 2662 return err;
2657 } 2663 }
@@ -2663,7 +2669,8 @@ static int __devinit snd_ice1712_probe(struct pci_dev *pci,
2663 if (c->driver) /* specific driver? */ 2669 if (c->driver) /* specific driver? */
2664 strcpy(card->driver, c->driver); 2670 strcpy(card->driver, c->driver);
2665 if (c->chip_init) { 2671 if (c->chip_init) {
2666 if ((err = c->chip_init(ice)) < 0) { 2672 err = c->chip_init(ice);
2673 if (err < 0) {
2667 snd_card_free(card); 2674 snd_card_free(card);
2668 return err; 2675 return err;
2669 } 2676 }
@@ -2675,47 +2682,52 @@ static int __devinit snd_ice1712_probe(struct pci_dev *pci,
2675 c = &no_matched; 2682 c = &no_matched;
2676 __found: 2683 __found:
2677 2684
2678 if ((err = snd_ice1712_pcm_profi(ice, pcm_dev++, NULL)) < 0) { 2685 err = snd_ice1712_pcm_profi(ice, pcm_dev++, NULL);
2686 if (err < 0) {
2679 snd_card_free(card); 2687 snd_card_free(card);
2680 return err; 2688 return err;
2681 } 2689 }
2682 2690
2683 if (ice_has_con_ac97(ice)) 2691 if (ice_has_con_ac97(ice))
2684 if ((err = snd_ice1712_pcm(ice, pcm_dev++, NULL)) < 0) { 2692 err = snd_ice1712_pcm(ice, pcm_dev++, NULL);
2693 if (err < 0) {
2685 snd_card_free(card); 2694 snd_card_free(card);
2686 return err; 2695 return err;
2687 } 2696 }
2688 2697
2689 if ((err = snd_ice1712_ac97_mixer(ice)) < 0) { 2698 err = snd_ice1712_ac97_mixer(ice);
2699 if (err < 0) {
2690 snd_card_free(card); 2700 snd_card_free(card);
2691 return err; 2701 return err;
2692 } 2702 }
2693 2703
2694 if ((err = snd_ice1712_build_controls(ice)) < 0) { 2704 err = snd_ice1712_build_controls(ice);
2705 if (err < 0) {
2695 snd_card_free(card); 2706 snd_card_free(card);
2696 return err; 2707 return err;
2697 } 2708 }
2698 2709
2699 if (c->build_controls) { 2710 if (c->build_controls) {
2700 if ((err = c->build_controls(ice)) < 0) { 2711 err = c->build_controls(ice);
2712 if (err < 0) {
2701 snd_card_free(card); 2713 snd_card_free(card);
2702 return err; 2714 return err;
2703 } 2715 }
2704 } 2716 }
2705 2717
2706 if (ice_has_con_ac97(ice)) 2718 if (ice_has_con_ac97(ice))
2707 if ((err = snd_ice1712_pcm_ds(ice, pcm_dev++, NULL)) < 0) { 2719 err = snd_ice1712_pcm_ds(ice, pcm_dev++, NULL);
2720 if (err < 0) {
2708 snd_card_free(card); 2721 snd_card_free(card);
2709 return err; 2722 return err;
2710 } 2723 }
2711 2724
2712 if (! c->no_mpu401) { 2725 if (!c->no_mpu401) {
2713 if ((err = snd_mpu401_uart_new(card, 0, MPU401_HW_ICE1712, 2726 err = snd_mpu401_uart_new(card, 0, MPU401_HW_ICE1712,
2714 ICEREG(ice, MPU1_CTRL), 2727 ICEREG(ice, MPU1_CTRL),
2715 (c->mpu401_1_info_flags | 2728 (c->mpu401_1_info_flags | MPU401_INFO_INTEGRATED),
2716 MPU401_INFO_INTEGRATED), 2729 ice->irq, 0, &ice->rmidi[0]);
2717 ice->irq, 0, 2730 if (err < 0) {
2718 &ice->rmidi[0])) < 0) {
2719 snd_card_free(card); 2731 snd_card_free(card);
2720 return err; 2732 return err;
2721 } 2733 }
@@ -2727,12 +2739,12 @@ static int __devinit snd_ice1712_probe(struct pci_dev *pci,
2727 2739
2728 if (ice->eeprom.data[ICE_EEP1_CODEC] & ICE1712_CFG_2xMPU401) { 2740 if (ice->eeprom.data[ICE_EEP1_CODEC] & ICE1712_CFG_2xMPU401) {
2729 /* 2nd port used */ 2741 /* 2nd port used */
2730 if ((err = snd_mpu401_uart_new(card, 1, MPU401_HW_ICE1712, 2742 err = snd_mpu401_uart_new(card, 1, MPU401_HW_ICE1712,
2731 ICEREG(ice, MPU2_CTRL), 2743 ICEREG(ice, MPU2_CTRL),
2732 (c->mpu401_2_info_flags | 2744 (c->mpu401_2_info_flags | MPU401_INFO_INTEGRATED),
2733 MPU401_INFO_INTEGRATED), 2745 ice->irq, 0, &ice->rmidi[1]);
2734 ice->irq, 0, 2746
2735 &ice->rmidi[1])) < 0) { 2747 if (err < 0) {
2736 snd_card_free(card); 2748 snd_card_free(card);
2737 return err; 2749 return err;
2738 } 2750 }
@@ -2750,7 +2762,8 @@ static int __devinit snd_ice1712_probe(struct pci_dev *pci,
2750 sprintf(card->longname, "%s at 0x%lx, irq %i", 2762 sprintf(card->longname, "%s at 0x%lx, irq %i",
2751 card->shortname, ice->port, ice->irq); 2763 card->shortname, ice->port, ice->irq);
2752 2764
2753 if ((err = snd_card_register(card)) < 0) { 2765 err = snd_card_register(card);
2766 if (err < 0) {
2754 snd_card_free(card); 2767 snd_card_free(card);
2755 return err; 2768 return err;
2756 } 2769 }
diff --git a/sound/pci/ice1712/ice1712.h b/sound/pci/ice1712/ice1712.h
index 762fbd7a7507..fdae6deba16b 100644
--- a/sound/pci/ice1712/ice1712.h
+++ b/sound/pci/ice1712/ice1712.h
@@ -20,7 +20,7 @@
20 * along with this program; if not, write to the Free Software 20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 * 22 *
23 */ 23 */
24 24
25#include <sound/control.h> 25#include <sound/control.h>
26#include <sound/ac97_codec.h> 26#include <sound/ac97_codec.h>
@@ -112,7 +112,7 @@
112 */ 112 */
113 113
114#define ICEDS(ice, x) ((ice)->dmapath_port + ICE1712_DS_##x) 114#define ICEDS(ice, x) ((ice)->dmapath_port + ICE1712_DS_##x)
115 115
116#define ICE1712_DS_INTMASK 0x00 /* word - interrupt mask */ 116#define ICE1712_DS_INTMASK 0x00 /* word - interrupt mask */
117#define ICE1712_DS_INTSTAT 0x02 /* word - interrupt status */ 117#define ICE1712_DS_INTSTAT 0x02 /* word - interrupt status */
118#define ICE1712_DS_DATA 0x04 /* dword - channel data */ 118#define ICE1712_DS_DATA 0x04 /* dword - channel data */
@@ -121,7 +121,7 @@
121/* 121/*
122 * Consumer section channel registers 122 * Consumer section channel registers
123 */ 123 */
124 124
125#define ICE1712_DSC_ADDR0 0x00 /* dword - base address 0 */ 125#define ICE1712_DSC_ADDR0 0x00 /* dword - base address 0 */
126#define ICE1712_DSC_COUNT0 0x01 /* word - count 0 */ 126#define ICE1712_DSC_COUNT0 0x01 /* word - count 0 */
127#define ICE1712_DSC_ADDR1 0x02 /* dword - base address 1 */ 127#define ICE1712_DSC_ADDR1 0x02 /* dword - base address 1 */
@@ -138,7 +138,7 @@
138#define ICE1712_DSC_RATE 0x05 /* dword - rate */ 138#define ICE1712_DSC_RATE 0x05 /* dword - rate */
139#define ICE1712_DSC_VOLUME 0x06 /* word - volume control */ 139#define ICE1712_DSC_VOLUME 0x06 /* word - volume control */
140 140
141/* 141/*
142 * Professional multi-track direct control registers 142 * Professional multi-track direct control registers
143 */ 143 */
144 144
@@ -214,7 +214,7 @@
214 214
215 215
216/* 216/*
217 * 217 *
218 */ 218 */
219 219
220struct snd_ice1712; 220struct snd_ice1712;
@@ -253,12 +253,12 @@ enum {
253 ICE_EEP1_ADC_ID2, 253 ICE_EEP1_ADC_ID2,
254 ICE_EEP1_ADC_ID3 254 ICE_EEP1_ADC_ID3
255}; 255};
256 256
257#define ice_has_con_ac97(ice) (!((ice)->eeprom.data[ICE_EEP1_CODEC] & ICE1712_CFG_NO_CON_AC97)) 257#define ice_has_con_ac97(ice) (!((ice)->eeprom.data[ICE_EEP1_CODEC] & ICE1712_CFG_NO_CON_AC97))
258 258
259 259
260struct snd_ak4xxx_private { 260struct snd_ak4xxx_private {
261 unsigned int cif: 1; /* CIF mode */ 261 unsigned int cif:1; /* CIF mode */
262 unsigned char caddr; /* C0 and C1 bits */ 262 unsigned char caddr; /* C0 and C1 bits */
263 unsigned int data_mask; /* DATA gpio bit */ 263 unsigned int data_mask; /* DATA gpio bit */
264 unsigned int clk_mask; /* CLK gpio bit */ 264 unsigned int clk_mask; /* CLK gpio bit */
@@ -306,11 +306,11 @@ struct snd_ice1712 {
306 struct snd_pcm *pcm; 306 struct snd_pcm *pcm;
307 struct snd_pcm *pcm_ds; 307 struct snd_pcm *pcm_ds;
308 struct snd_pcm *pcm_pro; 308 struct snd_pcm *pcm_pro;
309 struct snd_pcm_substream *playback_con_substream; 309 struct snd_pcm_substream *playback_con_substream;
310 struct snd_pcm_substream *playback_con_substream_ds[6]; 310 struct snd_pcm_substream *playback_con_substream_ds[6];
311 struct snd_pcm_substream *capture_con_substream; 311 struct snd_pcm_substream *capture_con_substream;
312 struct snd_pcm_substream *playback_pro_substream; 312 struct snd_pcm_substream *playback_pro_substream;
313 struct snd_pcm_substream *capture_pro_substream; 313 struct snd_pcm_substream *capture_pro_substream;
314 unsigned int playback_pro_size; 314 unsigned int playback_pro_size;
315 unsigned int capture_pro_size; 315 unsigned int capture_pro_size;
316 unsigned int playback_con_virt_addr[6]; 316 unsigned int playback_con_virt_addr[6];
@@ -326,15 +326,15 @@ struct snd_ice1712 {
326 struct snd_ice1712_eeprom eeprom; 326 struct snd_ice1712_eeprom eeprom;
327 327
328 unsigned int pro_volumes[20]; 328 unsigned int pro_volumes[20];
329 unsigned int omni: 1; /* Delta Omni I/O */ 329 unsigned int omni:1; /* Delta Omni I/O */
330 unsigned int dxr_enable: 1; /* Terratec DXR enable for DMX6FIRE */ 330 unsigned int dxr_enable:1; /* Terratec DXR enable for DMX6FIRE */
331 unsigned int vt1724: 1; 331 unsigned int vt1724:1;
332 unsigned int vt1720: 1; 332 unsigned int vt1720:1;
333 unsigned int has_spdif: 1; /* VT1720/4 - has SPDIF I/O */ 333 unsigned int has_spdif:1; /* VT1720/4 - has SPDIF I/O */
334 unsigned int force_pdma4: 1; /* VT1720/4 - PDMA4 as non-spdif */ 334 unsigned int force_pdma4:1; /* VT1720/4 - PDMA4 as non-spdif */
335 unsigned int force_rdma1: 1; /* VT1720/4 - RDMA1 as non-spdif */ 335 unsigned int force_rdma1:1; /* VT1720/4 - RDMA1 as non-spdif */
336 unsigned int midi_output: 1; /* VT1720/4: MIDI output triggered */ 336 unsigned int midi_output:1; /* VT1720/4: MIDI output triggered */
337 unsigned int midi_input: 1; /* VT1720/4: MIDI input triggered */ 337 unsigned int midi_input:1; /* VT1720/4: MIDI input triggered */
338 unsigned int num_total_dacs; /* total DACs */ 338 unsigned int num_total_dacs; /* total DACs */
339 unsigned int num_total_adcs; /* total ADCs */ 339 unsigned int num_total_adcs; /* total ADCs */
340 unsigned int cur_rate; /* current rate */ 340 unsigned int cur_rate; /* current rate */
@@ -351,7 +351,7 @@ struct snd_ice1712 {
351 struct snd_i2c_bus *i2c; /* I2C bus */ 351 struct snd_i2c_bus *i2c; /* I2C bus */
352 struct snd_i2c_device *cs8427; /* CS8427 I2C device */ 352 struct snd_i2c_device *cs8427; /* CS8427 I2C device */
353 unsigned int cs8427_timeout; /* CS8427 reset timeout in HZ/100 */ 353 unsigned int cs8427_timeout; /* CS8427 reset timeout in HZ/100 */
354 354
355 struct ice1712_gpio { 355 struct ice1712_gpio {
356 unsigned int direction; /* current direction bits */ 356 unsigned int direction; /* current direction bits */
357 unsigned int write_mask; /* current mask bits */ 357 unsigned int write_mask; /* current mask bits */
@@ -455,7 +455,7 @@ static inline int snd_ice1712_gpio_read_bits(struct snd_ice1712 *ice,
455{ 455{
456 ice->gpio.direction &= ~mask; 456 ice->gpio.direction &= ~mask;
457 snd_ice1712_gpio_set_dir(ice, ice->gpio.direction); 457 snd_ice1712_gpio_set_dir(ice, ice->gpio.direction);
458 return (snd_ice1712_gpio_read(ice) & mask); 458 return snd_ice1712_gpio_read(ice) & mask;
459} 459}
460 460
461int snd_ice1712_spdif_build_controls(struct snd_ice1712 *ice); 461int snd_ice1712_spdif_build_controls(struct snd_ice1712 *ice);
@@ -467,13 +467,13 @@ int snd_ice1712_akm4xxx_build_controls(struct snd_ice1712 *ice);
467 467
468int snd_ice1712_init_cs8427(struct snd_ice1712 *ice, int addr); 468int snd_ice1712_init_cs8427(struct snd_ice1712 *ice, int addr);
469 469
470static inline void snd_ice1712_write(struct snd_ice1712 * ice, u8 addr, u8 data) 470static inline void snd_ice1712_write(struct snd_ice1712 *ice, u8 addr, u8 data)
471{ 471{
472 outb(addr, ICEREG(ice, INDEX)); 472 outb(addr, ICEREG(ice, INDEX));
473 outb(data, ICEREG(ice, DATA)); 473 outb(data, ICEREG(ice, DATA));
474} 474}
475 475
476static inline u8 snd_ice1712_read(struct snd_ice1712 * ice, u8 addr) 476static inline u8 snd_ice1712_read(struct snd_ice1712 *ice, u8 addr)
477{ 477{
478 outb(addr, ICEREG(ice, INDEX)); 478 outb(addr, ICEREG(ice, INDEX));
479 return inb(ICEREG(ice, DATA)); 479 return inb(ICEREG(ice, DATA));
@@ -491,7 +491,7 @@ struct snd_ice1712_card_info {
491 char *driver; 491 char *driver;
492 int (*chip_init)(struct snd_ice1712 *); 492 int (*chip_init)(struct snd_ice1712 *);
493 int (*build_controls)(struct snd_ice1712 *); 493 int (*build_controls)(struct snd_ice1712 *);
494 unsigned int no_mpu401: 1; 494 unsigned int no_mpu401:1;
495 unsigned int mpu401_1_info_flags; 495 unsigned int mpu401_1_info_flags;
496 unsigned int mpu401_2_info_flags; 496 unsigned int mpu401_2_info_flags;
497 const char *mpu401_1_name; 497 const char *mpu401_1_name;