Changeset 598 for GPL/trunk/alsa-kernel/isa
- Timestamp:
- Apr 3, 2017, 4:51:56 PM (9 years ago)
- Location:
- GPL/trunk
- Files:
-
- 9 added
- 6 deleted
- 26 edited
-
. (modified) (1 prop)
-
alsa-kernel/isa/ad1816a/Makefile (deleted)
-
alsa-kernel/isa/ad1816a/ad1816a.c (modified) (1 diff)
-
alsa-kernel/isa/ad1848/ad1848_lib.c (added)
-
alsa-kernel/isa/adlib.c (deleted)
-
alsa-kernel/isa/als100.c (modified) (11 diffs)
-
alsa-kernel/isa/azt2320.c (modified) (1 diff)
-
alsa-kernel/isa/cmi8330.c (modified) (3 diffs)
-
alsa-kernel/isa/cs423x/cs4231_lib.c (added)
-
alsa-kernel/isa/cs423x/cs4232.c (added)
-
alsa-kernel/isa/cs423x/cs4236.c (modified) (5 diffs)
-
alsa-kernel/isa/cs423x/cs4236_lib.c (modified) (18 diffs)
-
alsa-kernel/isa/dt0197h.c (added)
-
alsa-kernel/isa/dt019x.c (deleted)
-
alsa-kernel/isa/es1688/es1688.c (modified) (11 diffs)
-
alsa-kernel/isa/es1688/es1688_lib.c (modified) (13 diffs)
-
alsa-kernel/isa/es18xx.c (modified) (41 diffs)
-
alsa-kernel/isa/gus/gus_lfo.c (added)
-
alsa-kernel/isa/gus/gus_mem.c (modified) (1 diff)
-
alsa-kernel/isa/gus/gus_mem_proc.c (modified) (2 diffs)
-
alsa-kernel/isa/gus/gus_sample.c (added)
-
alsa-kernel/isa/gus/gus_simple.c (added)
-
alsa-kernel/isa/gus/gus_synth.c (added)
-
alsa-kernel/isa/gus/gusextreme.c (modified) (7 diffs)
-
alsa-kernel/isa/gus/gusmax.c (modified) (2 diffs)
-
alsa-kernel/isa/gus/interwave.c (modified) (1 diff)
-
alsa-kernel/isa/opl3sa2.c (modified) (2 diffs)
-
alsa-kernel/isa/opti9xx/opti92x-ad1848.c (modified) (34 diffs)
-
alsa-kernel/isa/sb/emu8000.c (modified) (4 diffs)
-
alsa-kernel/isa/sb/emu8000_pcm.c (deleted)
-
alsa-kernel/isa/sb/sb16.c (modified) (1 diff)
-
alsa-kernel/isa/sb/sb16_csp_codecs.h (added)
-
alsa-kernel/isa/sb/sb8.c (modified) (2 diffs)
-
alsa-kernel/isa/sb/sb8_main.c (modified) (21 diffs)
-
alsa-kernel/isa/sb/sb_common.c (modified) (1 diff)
-
alsa-kernel/isa/sb/sb_mixer.c (modified) (11 diffs)
-
alsa-kernel/isa/sc6000.c (deleted)
-
alsa-kernel/isa/sscape.c (deleted)
-
alsa-kernel/isa/wavefront/wavefront.c (modified) (1 diff)
-
alsa-kernel/isa/wavefront/wavefront_fx.c (modified) (1 diff)
-
alsa-kernel/isa/wavefront/wavefront_synth.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
GPL/trunk
-
Property svn:mergeinfo
set to
/GPL/branches/uniaud32-2.1.x merged eligible
-
Property svn:mergeinfo
set to
-
GPL/trunk/alsa-kernel/isa/ad1816a/ad1816a.c
r426 r598 163 163 if (error < 0) 164 164 return error; 165 acard = (struct snd_card_ad1816a *)card->private_data;165 acard = card->private_data; 166 166 167 167 if ((error = snd_card_ad1816a_pnp(dev, acard, pcard, pid))) { -
GPL/trunk/alsa-kernel/isa/als100.c
r410 r598 3 3 card-als100.c - driver for Avance Logic ALS100 based soundcards. 4 4 Copyright (C) 1999-2000 by Massimo Piccioni <dafastidio@libero.it> 5 Copyright (C) 1999-2002 by Massimo Piccioni <dafastidio@libero.it> 5 6 6 7 Thanks to Pierfrancesco 'qM2' Passerini. 8 9 Generalised for soundcards based on DT-0196 and ALS-007 chips 10 by Jonathan Woithe <jwoithe@physics.adelaide.edu.au>: June 2002. 7 11 8 12 This program is free software; you can redistribute it and/or modify … … 34 38 #define PFX "als100: " 35 39 36 MODULE_ AUTHOR("Massimo Piccioni <dafastidio@libero.it>");37 MODULE_ DESCRIPTION("Avance Logic ALS1X0");38 MODULE_LICENSE("GPL"); 39 MODULE_SUPPORTED_DEVICE("{{Avance Logic,ALS100 - PRO16PNP},"40 MODULE_DESCRIPTION("Avance Logic ALS007/ALS1X0"); 41 MODULE_SUPPORTED_DEVICE("{{Diamond Technologies DT-019X}," 42 "{Avance Logic ALS-007}}" 43 "{{Avance Logic,ALS100 - PRO16PNP}," 40 44 "{Avance Logic,ALS110}," 41 45 "{Avance Logic,ALS120}," … … 46 50 "{RTL,RTL3000}}"); 47 51 52 MODULE_AUTHOR("Massimo Piccioni <dafastidio@libero.it>"); 53 MODULE_LICENSE("GPL"); 54 48 55 static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ 49 56 static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 50 static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE _ISAPNP;/* Enable this card */57 static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE; /* Enable this card */ 51 58 static long port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* PnP setup */ 52 59 static long mpu_port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* PnP setup */ … … 58 65 59 66 module_param_array(index, int, NULL, 0444); 60 MODULE_PARM_DESC(index, "Index value for als100based soundcard.");67 MODULE_PARM_DESC(index, "Index value for Avance Logic based soundcard."); 61 68 module_param_array(id, charp, NULL, 0444); 62 MODULE_PARM_DESC(id, "ID string for als100based soundcard.");69 MODULE_PARM_DESC(id, "ID string for Avance Logic based soundcard."); 63 70 module_param_array(enable, bool, NULL, 0444); 64 MODULE_PARM_DESC(enable, "Enable als100 based soundcard."); 71 MODULE_PARM_DESC(enable, "Enable Avance Logic based soundcard."); 72 73 MODULE_ALIAS("snd-dt019x"); 65 74 66 75 struct snd_card_als100 { 67 int dev_no;68 76 struct pnp_dev *dev; 69 77 struct pnp_dev *devmpu; … … 73 81 74 82 static struct pnp_card_device_id snd_als100_pnpids[] = { 83 /* DT197A30 */ 84 { .id = "RWB1688", 85 .devs = { { "@@@0001" }, { "@X@0001" }, { "@H@0001" } }, 86 .driver_data = SB_HW_DT019X }, 87 /* DT0196 / ALS-007 */ 88 { .id = "ALS0007", 89 .devs = { { "@@@0001" }, { "@X@0001" }, { "@H@0001" } }, 90 .driver_data = SB_HW_DT019X }, 75 91 /* ALS100 - PRO16PNP */ 76 { .id = "ALS0001", .devs = { { "@@@0001" }, { "@X@0001" }, { "@H@0001" } } }, 92 { .id = "ALS0001", 93 .devs = { { "@@@0001" }, { "@X@0001" }, { "@H@0001" } }, 94 .driver_data = SB_HW_ALS100 }, 77 95 /* ALS110 - MF1000 - Digimate 3D Sound */ 78 { .id = "ALS0110", .devs = { { "@@@1001" }, { "@X@1001" }, { "@H@1001" } } }, 96 { .id = "ALS0110", 97 .devs = { { "@@@1001" }, { "@X@1001" }, { "@H@1001" } }, 98 .driver_data = SB_HW_ALS100 }, 79 99 /* ALS120 */ 80 { .id = "ALS0120", .devs = { { "@@@2001" }, { "@X@2001" }, { "@H@2001" } } }, 100 { .id = "ALS0120", 101 .devs = { { "@@@2001" }, { "@X@2001" }, { "@H@2001" } }, 102 .driver_data = SB_HW_ALS100 }, 81 103 /* ALS200 */ 82 { .id = "ALS0200", .devs = { { "@@@0020" }, { "@X@0020" }, { "@H@0001" } } }, 104 { .id = "ALS0200", 105 .devs = { { "@@@0020" }, { "@X@0020" }, { "@H@0001" } }, 106 .driver_data = SB_HW_ALS100 }, 83 107 /* ALS200 OEM */ 84 { .id = "ALS0200", .devs = { { "@@@0020" }, { "@X@0020" }, { "@H@0020" } } }, 108 { .id = "ALS0200", 109 .devs = { { "@@@0020" }, { "@X@0020" }, { "@H@0020" } }, 110 .driver_data = SB_HW_ALS100 }, 85 111 /* RTL3000 */ 86 { .id = "RTL3000", .devs = { { "@@@2001" }, { "@X@2001" }, { "@H@2001" } } }, 87 { .id = "", } /* end */ 112 { .id = "RTL3000", 113 .devs = { { "@@@2001" }, { "@X@2001" }, { "@H@2001" } }, 114 .driver_data = SB_HW_ALS100 }, 115 { .id = "" } /* end */ 88 116 }; 89 117 90 118 MODULE_DEVICE_TABLE(pnp_card, snd_als100_pnpids); 91 92 #define DRIVER_NAME "snd-card-als100"93 119 94 120 static int __devinit snd_card_als100_pnp(int dev, struct snd_card_als100 *acard, … … 114 140 } 115 141 port[dev] = pnp_port_start(pdev, 0); 116 dma8[dev] = pnp_dma(pdev, 1); 117 dma16[dev] = pnp_dma(pdev, 0); 142 if (id->driver_data == SB_HW_DT019X) 143 dma8[dev] = pnp_dma(pdev, 0); 144 else { 145 dma8[dev] = pnp_dma(pdev, 1); 146 dma16[dev] = pnp_dma(pdev, 0); 147 } 118 148 irq[dev] = pnp_irq(pdev, 0); 119 149 … … 176 206 snd_card_set_dev(card, &pcard->card->dev); 177 207 178 if ((error = snd_sbdsp_create(card, port[dev], 179 irq[dev], 180 snd_sb16dsp_interrupt, 181 dma8[dev], 182 dma16[dev], 183 SB_HW_ALS100, &chip)) < 0) { 208 if (pid->driver_data == SB_HW_DT019X) 209 dma16[dev] = -1; 210 211 error = snd_sbdsp_create(card, port[dev], irq[dev], 212 snd_sb16dsp_interrupt, 213 dma8[dev], dma16[dev], 214 pid->driver_data, 215 &chip); 216 if (error < 0) { 184 217 snd_card_free(card); 185 218 return error; … … 187 220 acard->chip = chip; 188 221 189 strcpy(card->driver, "ALS100"); 190 strcpy(card->shortname, "Avance Logic ALS100"); 191 sprintf(card->longname, "%s, %s at 0x%lx, irq %d, dma %d&%d", 192 card->shortname, chip->name, chip->port, 193 irq[dev], dma8[dev], dma16[dev]); 222 if (pid->driver_data == SB_HW_DT019X) { 223 strcpy(card->driver, "DT-019X"); 224 strcpy(card->shortname, "Diamond Tech. DT-019X"); 225 sprintf(card->longname, "%s, %s at 0x%lx, irq %d, dma %d", 226 card->shortname, chip->name, chip->port, 227 irq[dev], dma8[dev]); 228 } else { 229 strcpy(card->driver, "ALS100"); 230 strcpy(card->shortname, "Avance Logic ALS100"); 231 sprintf(card->longname, "%s, %s at 0x%lx, irq %d, dma %d&%d", 232 card->shortname, chip->name, chip->port, 233 irq[dev], dma8[dev], dma16[dev]); 234 } 194 235 195 236 if ((error = snd_sb16dsp_pcm(chip, 0, NULL)) < 0) { … … 204 245 205 246 if (mpu_port[dev] > 0 && mpu_port[dev] != SNDRV_AUTO_PORT) { 206 if (snd_mpu401_uart_new(card, 0, MPU401_HW_ALS100, 247 int mpu_type = MPU401_HW_ALS100; 248 249 if (mpu_irq[dev] == SNDRV_AUTO_IRQ) 250 mpu_irq[dev] = -1; 251 252 if (pid->driver_data == SB_HW_DT019X) 253 mpu_type = MPU401_HW_MPU401; 254 255 if (snd_mpu401_uart_new(card, 0, 256 mpu_type, 207 257 mpu_port[dev], 0, 208 mpu_irq[dev], IRQF_DISABLED, 258 mpu_irq[dev], 259 mpu_irq[dev] >= 0 ? IRQF_DISABLED : 0, 209 260 NULL) < 0) 210 261 snd_printk(KERN_ERR PFX "no MPU-401 device at 0x%lx\n", mpu_port[dev]); … … 292 343 static struct pnp_card_driver als100_pnpc_driver = { 293 344 .flags = PNP_DRIVER_RES_DISABLE, 294 .name= "als100",345 .name = "als100", 295 346 .id_table = snd_als100_pnpids, 296 347 .probe = snd_als100_pnp_detect, … … 313 364 pnp_unregister_card_driver(&als100_pnpc_driver); 314 365 #ifdef MODULE 315 snd_printk(KERN_ERR "no A LS100based soundcards found\n");366 snd_printk(KERN_ERR "no Avance Logic based soundcards found\n"); 316 367 #endif 317 368 return -ENODEV; -
GPL/trunk/alsa-kernel/isa/azt2320.c
r410 r598 189 189 if (error < 0) 190 190 return error; 191 acard = (struct snd_card_azt2320 *)card->private_data;191 acard = card->private_data; 192 192 193 193 if ((error = snd_card_azt2320_pnp(dev, acard, pcard, pid))) { -
GPL/trunk/alsa-kernel/isa/cmi8330.c
r464 r598 47 47 #include <linux/err.h> 48 48 #include <linux/isa.h> 49 #include <linux/slab.h>50 49 #include <linux/pnp.h> 51 50 #include <linux/moduleparam.h> … … 238 237 WSS_SINGLE("3D Control - Switch", 0, 239 238 CMI8330_RMUX3D, 5, 1, 1), 240 WSS_SINGLE(" PC SpeakerPlayback Volume", 0,239 WSS_SINGLE("Beep Playback Volume", 0, 241 240 CMI8330_OUTPUTVOL, 3, 3, 0), 242 241 WSS_DOUBLE("FM Playback Switch", 0, … … 263 262 SB_SINGLE("SB Mic Playback Switch", SB_DSP4_OUTPUT_SW, 0, 1), 264 263 SB_SINGLE("SB Mic Playback Volume", SB_DSP4_MIC_DEV, 3, 31), 265 SB_SINGLE("SB PC SpeakerVolume", SB_DSP4_SPEAKER_DEV, 6, 3),264 SB_SINGLE("SB Beep Volume", SB_DSP4_SPEAKER_DEV, 6, 3), 266 265 SB_DOUBLE("SB Capture Volume", SB_DSP4_IGAIN_DEV, (SB_DSP4_IGAIN_DEV + 1), 6, 6, 3), 267 266 SB_DOUBLE("SB Playback Volume", SB_DSP4_OGAIN_DEV, (SB_DSP4_OGAIN_DEV + 1), 6, 6, 3), -
GPL/trunk/alsa-kernel/isa/cs423x/cs4236.c
r426 r598 23 23 #include <linux/err.h> 24 24 #include <linux/isa.h> 25 #include <linux/slab.h>26 25 #include <linux/pnp.h> 27 26 #include <linux/moduleparam.h> … … 178 177 /* Digital PC 5000 Onboard - CS4236B */ 179 178 { .id = "CSC0735", .devs = { { "CSC0000" }, { "CSC0010" } } }, 180 /* some u known CS4236B */179 /* some unknown CS4236B */ 181 180 { .id = "CSC0b35", .devs = { { "CSC0000" }, { "CSC0010" }, { "CSC0003" } } }, 182 181 /* Intel PR440FX Onboard sound */ … … 395 394 } 396 395 397 err = snd_ wss_create(card, port[dev], cport[dev],396 err = snd_cs4236_create(card, port[dev], cport[dev], 398 397 irq[dev], 399 398 dma1[dev], dma2[dev], … … 401 400 if (err < 0) 402 401 return err; 402 403 acard->chip = chip; 403 404 if (chip->hardware & WSS_HW_CS4236B_MASK) { 404 snd_wss_free(chip);405 err = snd_cs4236_create(card,406 port[dev], cport[dev],407 irq[dev], dma1[dev], dma2[dev],408 WSS_HW_DETECT, 0, &chip);409 if (err < 0)410 return err;411 acard->chip = chip;412 405 413 406 err = snd_cs4236_pcm(chip, 0, &pcm); … … 419 412 return err; 420 413 } else { 421 acard->chip = chip;422 414 err = snd_wss_pcm(chip, 0, &pcm); 423 415 if (err < 0) -
GPL/trunk/alsa-kernel/isa/cs423x/cs4236_lib.c
r426 r598 88 88 #include <sound/wss.h> 89 89 #include <sound/asoundef.h> 90 #include <sound/initval.h> 91 #include <sound/tlv.h> 90 92 91 93 /* … … 265 267 266 268 #endif /* CONFIG_PM */ 267 269 /* 270 * This function does no fail if the chip is not CS4236B or compatible. 271 * It just an equivalent to the snd_wss_create() then. 272 */ 268 273 int snd_cs4236_create(struct snd_card *card, 269 274 unsigned long port, … … 282 287 if (hardware == WSS_HW_DETECT) 283 288 hardware = WSS_HW_DETECT3; 284 if (cport < 0x100) { 285 snd_printk(KERN_ERR "please, specify control port " 286 "for CS4236+ chips\n"); 287 return -ENODEV; 288 } 289 289 290 err = snd_wss_create(card, port, cport, 290 291 irq, dma1, dma2, hardware, hwshare, &chip); … … 292 293 return err; 293 294 294 if ( !(chip->hardware & WSS_HW_CS4236B_MASK)) {295 snd_print k(KERN_ERR "CS4236+: MODE3 and extended registers "296 "not available, hardware=0x%x\n",chip->hardware);297 snd_device_free(card, chip);298 return -ENODEV;295 if ((chip->hardware & WSS_HW_CS4236B_MASK) == 0) { 296 snd_printd("chip is not CS4236+, hardware=0x%x\n", 297 chip->hardware); 298 *rchip = chip; 299 return 0; 299 300 } 300 301 #if 0 … … 309 310 } 310 311 #endif 312 if (cport < 0x100 || cport == SNDRV_AUTO_PORT) { 313 snd_printk(KERN_ERR "please, specify control port " 314 "for CS4236+ chips\n"); 315 snd_device_free(card, chip); 316 return -ENODEV; 317 } 311 318 ver1 = snd_cs4236_ctrl_in(chip, 1); 312 319 ver2 = snd_cs4236_ext_in(chip, CS4236_VERSION); 313 snd_printdd("CS4236: [0x%lx] C1 (version) = 0x%x, ext = 0x%x\n", cport, ver1, ver2); 320 snd_printdd("CS4236: [0x%lx] C1 (version) = 0x%x, ext = 0x%x\n", 321 cport, ver1, ver2); 314 322 if (ver1 != ver2) { 315 323 snd_printk(KERN_ERR "CS4236+ chip detected, but " … … 322 330 snd_cs4236_ctrl_out(chip, 3, 0x00); 323 331 snd_cs4236_ctrl_out(chip, 4, 0x80); 324 snd_cs4236_ctrl_out(chip, 5, ((IEC958_AES1_CON_PCM_CODER & 3) << 6) | IEC958_AES0_CON_EMPHASIS_NONE); 332 reg = ((IEC958_AES1_CON_PCM_CODER & 3) << 6) | 333 IEC958_AES0_CON_EMPHASIS_NONE; 334 snd_cs4236_ctrl_out(chip, 5, reg); 325 335 snd_cs4236_ctrl_out(chip, 6, IEC958_AES1_CON_PCM_CODER >> 2); 326 336 snd_cs4236_ctrl_out(chip, 7, 0x00); 327 /* 0x8c for C8 is valid for Turtle Beach Malibu - the IEC-958 output */ 328 /* is working with this setup, other hardware should have */ 329 /* different signal paths and this value should be selectable */ 330 /* in the future */ 337 /* 338 * 0x8c for C8 is valid for Turtle Beach Malibu - the IEC-958 339 * output is working with this setup, other hardware should 340 * have different signal paths and this value should be 341 * selectable in the future 342 */ 331 343 snd_cs4236_ctrl_out(chip, 8, 0x8c); 332 344 chip->rate_constraint = snd_cs4236_xrate; … … 340 352 /* initialize extended registers */ 341 353 for (reg = 0; reg < sizeof(snd_cs4236_ext_map); reg++) 342 snd_cs4236_ext_out(chip, CS4236_I23VAL(reg), snd_cs4236_ext_map[reg]); 343 344 /* initialize compatible but more featured registers */ 354 snd_cs4236_ext_out(chip, CS4236_I23VAL(reg), 355 snd_cs4236_ext_map[reg]); 356 357 /* initialize compatible but more featured registers */ 345 358 snd_wss_out(chip, CS4231_LEFT_INPUT, 0x40); 346 359 snd_wss_out(chip, CS4231_RIGHT_INPUT, 0x40); … … 388 401 .private_value = reg | (shift << 8) | (mask << 16) | (invert << 24) } 389 402 403 #define CS4236_SINGLE_TLV(xname, xindex, reg, shift, mask, invert, xtlv) \ 404 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = xindex, \ 405 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE | SNDRV_CTL_ELEM_ACCESS_TLV_READ, \ 406 .info = snd_cs4236_info_single, \ 407 .get = snd_cs4236_get_single, .put = snd_cs4236_put_single, \ 408 .private_value = reg | (shift << 8) | (mask << 16) | (invert << 24), \ 409 .tlv = { .p = (xtlv) } } 410 390 411 static int snd_cs4236_info_single(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) 391 412 { … … 490 511 .get = snd_cs4236_get_double, .put = snd_cs4236_put_double, \ 491 512 .private_value = left_reg | (right_reg << 8) | (shift_left << 16) | (shift_right << 19) | (mask << 24) | (invert << 22) } 513 514 #define CS4236_DOUBLE_TLV(xname, xindex, left_reg, right_reg, shift_left, \ 515 shift_right, mask, invert, xtlv) \ 516 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = xindex, \ 517 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE | SNDRV_CTL_ELEM_ACCESS_TLV_READ, \ 518 .info = snd_cs4236_info_double, \ 519 .get = snd_cs4236_get_double, .put = snd_cs4236_put_double, \ 520 .private_value = left_reg | (right_reg << 8) | (shift_left << 16) | \ 521 (shift_right << 19) | (mask << 24) | (invert << 22), \ 522 .tlv = { .p = (xtlv) } } 492 523 493 524 static int snd_cs4236_info_double(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) … … 561 592 } 562 593 563 #define CS4236_DOUBLE1(xname, xindex, left_reg, right_reg, shift_left, shift_right, mask, invert) \ 594 #define CS4236_DOUBLE1(xname, xindex, left_reg, right_reg, shift_left, \ 595 shift_right, mask, invert) \ 564 596 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = xindex, \ 565 597 .info = snd_cs4236_info_double, \ 566 598 .get = snd_cs4236_get_double1, .put = snd_cs4236_put_double1, \ 567 599 .private_value = left_reg | (right_reg << 8) | (shift_left << 16) | (shift_right << 19) | (mask << 24) | (invert << 22) } 600 601 #define CS4236_DOUBLE1_TLV(xname, xindex, left_reg, right_reg, shift_left, \ 602 shift_right, mask, invert, xtlv) \ 603 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = xindex, \ 604 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE | SNDRV_CTL_ELEM_ACCESS_TLV_READ, \ 605 .info = snd_cs4236_info_double, \ 606 .get = snd_cs4236_get_double1, .put = snd_cs4236_put_double1, \ 607 .private_value = left_reg | (right_reg << 8) | (shift_left << 16) | \ 608 (shift_right << 19) | (mask << 24) | (invert << 22), \ 609 .tlv = { .p = (xtlv) } } 568 610 569 611 static int snd_cs4236_get_double1(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) … … 620 662 } 621 663 622 #define CS4236_MASTER_DIGITAL(xname, xindex ) \664 #define CS4236_MASTER_DIGITAL(xname, xindex, xtlv) \ 623 665 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = xindex, \ 666 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE | SNDRV_CTL_ELEM_ACCESS_TLV_READ, \ 624 667 .info = snd_cs4236_info_double, \ 625 668 .get = snd_cs4236_get_master_digital, .put = snd_cs4236_put_master_digital, \ 626 .private_value = 71 << 24 } 669 .private_value = 71 << 24, \ 670 .tlv = { .p = (xtlv) } } 627 671 628 672 static inline int snd_cs4236_mixer_master_digital_invert_volume(int vol) 629 673 { 630 674 return (vol < 64) ? 63 - vol : 64 + (71 - vol); 631 } 675 } 632 676 633 677 static int snd_cs4236_get_master_digital(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) … … 662 706 } 663 707 664 #define CS4235_OUTPUT_ACCU(xname, xindex ) \708 #define CS4235_OUTPUT_ACCU(xname, xindex, xtlv) \ 665 709 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = xindex, \ 710 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE | SNDRV_CTL_ELEM_ACCESS_TLV_READ, \ 666 711 .info = snd_cs4236_info_double, \ 667 712 .get = snd_cs4235_get_output_accu, .put = snd_cs4235_put_output_accu, \ 668 .private_value = 3 << 24 } 713 .private_value = 3 << 24, \ 714 .tlv = { .p = (xtlv) } } 669 715 670 716 static inline int snd_cs4235_mixer_output_accu_get_volume(int vol) … … 721 767 } 722 768 769 static const DECLARE_TLV_DB_SCALE(db_scale_7bit, -9450, 150, 0); 770 static const DECLARE_TLV_DB_SCALE(db_scale_6bit, -9450, 150, 0); 771 static const DECLARE_TLV_DB_SCALE(db_scale_6bit_12db_max, -8250, 150, 0); 772 static const DECLARE_TLV_DB_SCALE(db_scale_5bit_12db_max, -3450, 150, 0); 773 static const DECLARE_TLV_DB_SCALE(db_scale_5bit_22db_max, -2400, 150, 0); 774 static const DECLARE_TLV_DB_SCALE(db_scale_4bit, -4500, 300, 0); 775 static const DECLARE_TLV_DB_SCALE(db_scale_2bit, -1800, 600, 0); 776 static const DECLARE_TLV_DB_SCALE(db_scale_rec_gain, 0, 150, 0); 777 723 778 static struct snd_kcontrol_new snd_cs4236_controls[] = { 724 779 … … 727 782 CS4236_DOUBLE("Master Digital Capture Switch", 0, 728 783 CS4236_DAC_MUTE, CS4236_DAC_MUTE, 7, 6, 1, 1), 729 CS4236_MASTER_DIGITAL("Master Digital Volume", 0), 730 731 CS4236_DOUBLE("Capture Boost Volume", 0, 732 CS4236_LEFT_MIX_CTRL, CS4236_RIGHT_MIX_CTRL, 5, 5, 3, 1), 784 CS4236_MASTER_DIGITAL("Master Digital Volume", 0, db_scale_7bit), 785 786 CS4236_DOUBLE_TLV("Capture Boost Volume", 0, 787 CS4236_LEFT_MIX_CTRL, CS4236_RIGHT_MIX_CTRL, 5, 5, 3, 1, 788 db_scale_2bit), 733 789 734 790 WSS_DOUBLE("PCM Playback Switch", 0, 735 791 CS4231_LEFT_OUTPUT, CS4231_RIGHT_OUTPUT, 7, 7, 1, 1), 736 WSS_DOUBLE("PCM Playback Volume", 0, 737 CS4231_LEFT_OUTPUT, CS4231_RIGHT_OUTPUT, 0, 0, 63, 1), 792 WSS_DOUBLE_TLV("PCM Playback Volume", 0, 793 CS4231_LEFT_OUTPUT, CS4231_RIGHT_OUTPUT, 0, 0, 63, 1, 794 db_scale_6bit), 738 795 739 796 CS4236_DOUBLE("DSP Playback Switch", 0, 740 797 CS4236_LEFT_DSP, CS4236_RIGHT_DSP, 7, 7, 1, 1), 741 CS4236_DOUBLE("DSP Playback Volume", 0, 742 CS4236_LEFT_DSP, CS4236_RIGHT_DSP, 0, 0, 63, 1), 798 CS4236_DOUBLE_TLV("DSP Playback Volume", 0, 799 CS4236_LEFT_DSP, CS4236_RIGHT_DSP, 0, 0, 63, 1, 800 db_scale_6bit), 743 801 744 802 CS4236_DOUBLE("FM Playback Switch", 0, 745 803 CS4236_LEFT_FM, CS4236_RIGHT_FM, 7, 7, 1, 1), 746 CS4236_DOUBLE("FM Playback Volume", 0, 747 CS4236_LEFT_FM, CS4236_RIGHT_FM, 0, 0, 63, 1), 804 CS4236_DOUBLE_TLV("FM Playback Volume", 0, 805 CS4236_LEFT_FM, CS4236_RIGHT_FM, 0, 0, 63, 1, 806 db_scale_6bit), 748 807 749 808 CS4236_DOUBLE("Wavetable Playback Switch", 0, 750 809 CS4236_LEFT_WAVE, CS4236_RIGHT_WAVE, 7, 7, 1, 1), 751 CS4236_DOUBLE("Wavetable Playback Volume", 0, 752 CS4236_LEFT_WAVE, CS4236_RIGHT_WAVE, 0, 0, 63, 1), 810 CS4236_DOUBLE_TLV("Wavetable Playback Volume", 0, 811 CS4236_LEFT_WAVE, CS4236_RIGHT_WAVE, 0, 0, 63, 1, 812 db_scale_6bit_12db_max), 753 813 754 814 WSS_DOUBLE("Synth Playback Switch", 0, 755 815 CS4231_LEFT_LINE_IN, CS4231_RIGHT_LINE_IN, 7, 7, 1, 1), 756 WSS_DOUBLE("Synth Volume", 0, 757 CS4231_LEFT_LINE_IN, CS4231_RIGHT_LINE_IN, 0, 0, 31, 1), 816 WSS_DOUBLE_TLV("Synth Volume", 0, 817 CS4231_LEFT_LINE_IN, CS4231_RIGHT_LINE_IN, 0, 0, 31, 1, 818 db_scale_5bit_12db_max), 758 819 WSS_DOUBLE("Synth Capture Switch", 0, 759 820 CS4231_LEFT_LINE_IN, CS4231_RIGHT_LINE_IN, 6, 6, 1, 1), … … 765 826 CS4236_DOUBLE("Mic Capture Switch", 0, 766 827 CS4236_LEFT_MIC, CS4236_RIGHT_MIC, 7, 7, 1, 1), 767 CS4236_DOUBLE("Mic Volume", 0, CS4236_LEFT_MIC, CS4236_RIGHT_MIC, 0, 0, 31, 1), 768 CS4236_DOUBLE("Mic Playback Boost", 0, 828 CS4236_DOUBLE_TLV("Mic Volume", 0, CS4236_LEFT_MIC, CS4236_RIGHT_MIC, 829 0, 0, 31, 1, db_scale_5bit_22db_max), 830 CS4236_DOUBLE("Mic Playback Boost (+20dB)", 0, 769 831 CS4236_LEFT_MIC, CS4236_RIGHT_MIC, 5, 5, 1, 0), 770 832 771 833 WSS_DOUBLE("Line Playback Switch", 0, 772 834 CS4231_AUX1_LEFT_INPUT, CS4231_AUX1_RIGHT_INPUT, 7, 7, 1, 1), 773 WSS_DOUBLE("Line Volume", 0, 774 CS4231_AUX1_LEFT_INPUT, CS4231_AUX1_RIGHT_INPUT, 0, 0, 31, 1), 835 WSS_DOUBLE_TLV("Line Volume", 0, 836 CS4231_AUX1_LEFT_INPUT, CS4231_AUX1_RIGHT_INPUT, 0, 0, 31, 1, 837 db_scale_5bit_12db_max), 775 838 WSS_DOUBLE("Line Capture Switch", 0, 776 839 CS4231_AUX1_LEFT_INPUT, CS4231_AUX1_RIGHT_INPUT, 6, 6, 1, 1), … … 780 843 WSS_DOUBLE("CD Playback Switch", 0, 781 844 CS4231_AUX2_LEFT_INPUT, CS4231_AUX2_RIGHT_INPUT, 7, 7, 1, 1), 782 WSS_DOUBLE("CD Volume", 0, 783 CS4231_AUX2_LEFT_INPUT, CS4231_AUX2_RIGHT_INPUT, 0, 0, 31, 1), 845 WSS_DOUBLE_TLV("CD Volume", 0, 846 CS4231_AUX2_LEFT_INPUT, CS4231_AUX2_RIGHT_INPUT, 0, 0, 31, 1, 847 db_scale_5bit_12db_max), 784 848 WSS_DOUBLE("CD Capture Switch", 0, 785 849 CS4231_AUX2_LEFT_INPUT, CS4231_AUX2_RIGHT_INPUT, 6, 6, 1, 1), … … 787 851 CS4236_DOUBLE1("Mono Output Playback Switch", 0, 788 852 CS4231_MONO_CTRL, CS4236_RIGHT_MIX_CTRL, 6, 7, 1, 1), 789 CS4236_DOUBLE1(" MonoPlayback Switch", 0,853 CS4236_DOUBLE1("Beep Playback Switch", 0, 790 854 CS4231_MONO_CTRL, CS4236_LEFT_MIX_CTRL, 7, 7, 1, 1), 791 WSS_SINGLE("Mono Playback Volume", 0, CS4231_MONO_CTRL, 0, 15, 1), 792 WSS_SINGLE("Mono Playback Bypass", 0, CS4231_MONO_CTRL, 5, 1, 0), 793 794 WSS_DOUBLE("Capture Volume", 0, 795 CS4231_LEFT_INPUT, CS4231_RIGHT_INPUT, 0, 0, 15, 0), 855 WSS_SINGLE_TLV("Beep Playback Volume", 0, CS4231_MONO_CTRL, 0, 15, 1, 856 db_scale_4bit), 857 WSS_SINGLE("Beep Bypass Playback Switch", 0, CS4231_MONO_CTRL, 5, 1, 0), 858 859 WSS_DOUBLE_TLV("Capture Volume", 0, CS4231_LEFT_INPUT, CS4231_RIGHT_INPUT, 860 0, 0, 15, 0, db_scale_rec_gain), 796 861 WSS_DOUBLE("Analog Loopback Capture Switch", 0, 797 862 CS4231_LEFT_INPUT, CS4231_RIGHT_INPUT, 7, 7, 1, 0), 798 863 799 WSS_SINGLE("Digital Loopback Playback Switch", 0, CS4231_LOOPBACK, 0, 1, 0), 800 CS4236_DOUBLE1("Digital Loopback Playback Volume", 0, 801 CS4231_LOOPBACK, CS4236_RIGHT_LOOPBACK, 2, 0, 63, 1) 864 WSS_SINGLE("Loopback Digital Playback Switch", 0, CS4231_LOOPBACK, 0, 1, 0), 865 CS4236_DOUBLE1_TLV("Loopback Digital Playback Volume", 0, 866 CS4231_LOOPBACK, CS4236_RIGHT_LOOPBACK, 2, 0, 63, 1, 867 db_scale_6bit), 802 868 }; 803 869 870 static const DECLARE_TLV_DB_SCALE(db_scale_5bit_6db_max, -5600, 200, 0); 871 static const DECLARE_TLV_DB_SCALE(db_scale_2bit_16db_max, -2400, 800, 0); 872 804 873 static struct snd_kcontrol_new snd_cs4235_controls[] = { 805 874 806 WSS_DOUBLE("Master Switch", 0,875 WSS_DOUBLE("Master Playback Switch", 0, 807 876 CS4235_LEFT_MASTER, CS4235_RIGHT_MASTER, 7, 7, 1, 1), 808 WSS_DOUBLE("Master Volume", 0, 809 CS4235_LEFT_MASTER, CS4235_RIGHT_MASTER, 0, 0, 31, 1), 810 811 CS4235_OUTPUT_ACCU("Playback Volume", 0), 812 813 CS4236_DOUBLE("Master Digital Playback Switch", 0, 814 CS4236_LEFT_MASTER, CS4236_RIGHT_MASTER, 7, 7, 1, 1), 815 CS4236_DOUBLE("Master Digital Capture Switch", 0, 877 WSS_DOUBLE_TLV("Master Playback Volume", 0, 878 CS4235_LEFT_MASTER, CS4235_RIGHT_MASTER, 0, 0, 31, 1, 879 db_scale_5bit_6db_max), 880 881 CS4235_OUTPUT_ACCU("Playback Volume", 0, db_scale_2bit_16db_max), 882 883 WSS_DOUBLE("Synth Playback Switch", 1, 884 CS4231_LEFT_LINE_IN, CS4231_RIGHT_LINE_IN, 7, 7, 1, 1), 885 WSS_DOUBLE("Synth Capture Switch", 1, 886 CS4231_LEFT_LINE_IN, CS4231_RIGHT_LINE_IN, 6, 6, 1, 1), 887 WSS_DOUBLE_TLV("Synth Volume", 1, 888 CS4231_LEFT_LINE_IN, CS4231_RIGHT_LINE_IN, 0, 0, 31, 1, 889 db_scale_5bit_12db_max), 890 891 CS4236_DOUBLE_TLV("Capture Volume", 0, 892 CS4236_LEFT_MIX_CTRL, CS4236_RIGHT_MIX_CTRL, 5, 5, 3, 1, 893 db_scale_2bit), 894 895 WSS_DOUBLE("PCM Playback Switch", 0, 896 CS4231_LEFT_OUTPUT, CS4231_RIGHT_OUTPUT, 7, 7, 1, 1), 897 WSS_DOUBLE("PCM Capture Switch", 0, 816 898 CS4236_DAC_MUTE, CS4236_DAC_MUTE, 7, 6, 1, 1), 817 CS4236_MASTER_DIGITAL("Master Digital Volume", 0), 818 819 WSS_DOUBLE("Master Digital Playback Switch", 1, 820 CS4231_LEFT_LINE_IN, CS4231_RIGHT_LINE_IN, 7, 7, 1, 1), 821 WSS_DOUBLE("Master Digital Capture Switch", 1, 822 CS4231_LEFT_LINE_IN, CS4231_RIGHT_LINE_IN, 6, 6, 1, 1), 823 WSS_DOUBLE("Master Digital Volume", 1, 824 CS4231_LEFT_LINE_IN, CS4231_RIGHT_LINE_IN, 0, 0, 31, 1), 825 826 CS4236_DOUBLE("Capture Volume", 0, 827 CS4236_LEFT_MIX_CTRL, CS4236_RIGHT_MIX_CTRL, 5, 5, 3, 1), 828 829 WSS_DOUBLE("PCM Switch", 0, 830 CS4231_LEFT_OUTPUT, CS4231_RIGHT_OUTPUT, 7, 7, 1, 1), 831 WSS_DOUBLE("PCM Volume", 0, 832 CS4231_LEFT_OUTPUT, CS4231_RIGHT_OUTPUT, 0, 0, 63, 1), 899 WSS_DOUBLE_TLV("PCM Volume", 0, 900 CS4231_LEFT_OUTPUT, CS4231_RIGHT_OUTPUT, 0, 0, 63, 1, 901 db_scale_6bit), 833 902 834 903 CS4236_DOUBLE("DSP Switch", 0, CS4236_LEFT_DSP, CS4236_RIGHT_DSP, 7, 7, 1, 1), … … 843 912 CS4236_DOUBLE("Mic Playback Switch", 0, 844 913 CS4236_LEFT_MIC, CS4236_RIGHT_MIC, 6, 6, 1, 1), 845 CS4236_SINGLE("Mic Volume", 0, CS4236_LEFT_MIC, 0, 31, 1), 846 CS4236_SINGLE("Mic Playback Boost", 0, CS4236_LEFT_MIC, 5, 1, 0), 847 848 WSS_DOUBLE("Aux Playback Switch", 0, 914 CS4236_SINGLE_TLV("Mic Volume", 0, CS4236_LEFT_MIC, 0, 31, 1, 915 db_scale_5bit_22db_max), 916 CS4236_SINGLE("Mic Boost (+20dB)", 0, CS4236_LEFT_MIC, 5, 1, 0), 917 918 WSS_DOUBLE("Line Playback Switch", 0, 849 919 CS4231_AUX1_LEFT_INPUT, CS4231_AUX1_RIGHT_INPUT, 7, 7, 1, 1), 850 WSS_DOUBLE(" AuxCapture Switch", 0,920 WSS_DOUBLE("Line Capture Switch", 0, 851 921 CS4231_AUX1_LEFT_INPUT, CS4231_AUX1_RIGHT_INPUT, 6, 6, 1, 1), 852 WSS_DOUBLE("Aux Volume", 0, 853 CS4231_AUX1_LEFT_INPUT, CS4231_AUX1_RIGHT_INPUT, 0, 0, 31, 1), 854 855 WSS_DOUBLE("Aux Playback Switch", 1, 922 WSS_DOUBLE_TLV("Line Volume", 0, 923 CS4231_AUX1_LEFT_INPUT, CS4231_AUX1_RIGHT_INPUT, 0, 0, 31, 1, 924 db_scale_5bit_12db_max), 925 926 WSS_DOUBLE("CD Playback Switch", 1, 856 927 CS4231_AUX2_LEFT_INPUT, CS4231_AUX2_RIGHT_INPUT, 7, 7, 1, 1), 857 WSS_DOUBLE(" AuxCapture Switch", 1,928 WSS_DOUBLE("CD Capture Switch", 1, 858 929 CS4231_AUX2_LEFT_INPUT, CS4231_AUX2_RIGHT_INPUT, 6, 6, 1, 1), 859 WSS_DOUBLE("Aux Volume", 1, 860 CS4231_AUX2_LEFT_INPUT, CS4231_AUX2_RIGHT_INPUT, 0, 0, 31, 1), 861 862 CS4236_DOUBLE1("Master Mono Switch", 0, 863 CS4231_MONO_CTRL, CS4236_RIGHT_MIX_CTRL, 6, 7, 1, 1), 864 865 CS4236_DOUBLE1("Mono Switch", 0, 930 WSS_DOUBLE_TLV("CD Volume", 1, 931 CS4231_AUX2_LEFT_INPUT, CS4231_AUX2_RIGHT_INPUT, 0, 0, 31, 1, 932 db_scale_5bit_12db_max), 933 934 CS4236_DOUBLE1("Beep Playback Switch", 0, 866 935 CS4231_MONO_CTRL, CS4236_LEFT_MIX_CTRL, 7, 7, 1, 1), 867 WSS_SINGLE(" MonoVolume", 0, CS4231_MONO_CTRL, 0, 15, 1),936 WSS_SINGLE("Beep Playback Volume", 0, CS4231_MONO_CTRL, 0, 15, 1), 868 937 869 938 WSS_DOUBLE("Analog Loopback Switch", 0, -
GPL/trunk/alsa-kernel/isa/es1688/es1688.c
r464 r598 23 23 #include <linux/err.h> 24 24 #include <linux/isa.h> 25 #include <linux/isapnp.h> 25 26 #include <linux/time.h> 26 27 #include <linux/wait.h> … … 46 47 "{ESS,ES1688 AudioDrive,pnp:ESS1681}}"); 47 48 49 MODULE_ALIAS("snd_es968"); 50 48 51 static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ 49 52 static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 53 #ifdef CONFIG_PNP 54 static int isapnp[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_ISAPNP; 55 #endif 50 56 static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE; /* Enable this card */ 51 57 static long port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* 0x220,0x240,0x260 */ … … 61 67 MODULE_PARM_DESC(id, "ID string for " CRD_NAME " soundcard."); 62 68 module_param_array(enable, bool, NULL, 0444); 69 #ifdef CONFIG_PNP 70 module_param_array(isapnp, bool, NULL, 0444); 71 MODULE_PARM_DESC(isapnp, "PnP detection for specified soundcard."); 72 #endif 63 73 MODULE_PARM_DESC(enable, "Enable " CRD_NAME " soundcard."); 64 74 module_param_array(port, long, NULL, 0444); … … 75 85 MODULE_PARM_DESC(dma8, "8-bit DMA # for " CRD_NAME " driver."); 76 86 87 #ifdef CONFIG_PNP 88 #define is_isapnp_selected(dev) isapnp[dev] 89 #else 90 #define is_isapnp_selected(dev) 0 91 #endif 92 77 93 static int __devinit snd_es1688_match(struct device *dev, unsigned int n) 78 94 { 79 return enable[n]; 80 } 81 82 static int __devinit snd_es1688_legacy_create(struct snd_card *card, 83 struct device *dev, unsigned int n, struct snd_es1688 **rchip) 84 { 95 return enable[n] && !is_isapnp_selected(n); 96 } 97 98 static int __devinit snd_es1688_legacy_create(struct snd_card *card, 99 struct device *dev, unsigned int n) 100 { 101 struct snd_es1688 *chip = card->private_data; 85 102 static long possible_ports[] = {0x220, 0x240, 0x260}; 86 103 static int possible_irqs[] = {5, 9, 10, 7, -1}; … … 105 122 106 123 if (port[n] != SNDRV_AUTO_PORT) 107 return snd_es1688_create(card, port[n], mpu_port[n], irq[n],108 mpu_irq[n], dma8[n], ES1688_HW_AUTO, rchip);124 return snd_es1688_create(card, chip, port[n], mpu_port[n], 125 irq[n], mpu_irq[n], dma8[n], ES1688_HW_AUTO); 109 126 110 127 i = 0; 111 128 do { 112 129 port[n] = possible_ports[i]; 113 error = snd_es1688_create(card, port[n], mpu_port[n], irq[n],114 mpu_irq[n], dma8[n], ES1688_HW_AUTO, rchip);130 error = snd_es1688_create(card, chip, port[n], mpu_port[n], 131 irq[n], mpu_irq[n], dma8[n], ES1688_HW_AUTO); 115 132 } while (error < 0 && ++i < ARRAY_SIZE(possible_ports)); 116 133 … … 118 135 } 119 136 120 static int __devinit snd_es1688_probe(struct device *dev, unsigned int n) 121 { 122 struct snd_card *card; 123 struct snd_es1688 *chip; 137 static int __devinit snd_es1688_probe(struct snd_card *card, unsigned int n) 138 { 139 struct snd_es1688 *chip = card->private_data; 124 140 struct snd_opl3 *opl3; 125 141 struct snd_pcm *pcm; 126 142 int error; 127 143 128 error = snd_card_create(index[n], id[n], THIS_MODULE, 0, &card); 129 if (error < 0) 130 return error; 131 132 error = snd_es1688_legacy_create(card, dev, n, &chip); 133 if (error < 0) 134 goto out; 135 136 error = snd_es1688_pcm(chip, 0, &pcm); 137 if (error < 0) 138 goto out; 139 140 error = snd_es1688_mixer(chip); 141 if (error < 0) 142 goto out; 143 144 strcpy(card->driver, "ES1688"); 145 strcpy(card->shortname, pcm->name); 146 sprintf(card->longname, "%s at 0x%lx, irq %i, dma %i", pcm->name, 147 chip->port, chip->irq, chip->dma8); 144 error = snd_es1688_pcm(card, chip, 0, &pcm); 145 if (error < 0) 146 return error; 147 148 error = snd_es1688_mixer(card, chip); 149 if (error < 0) 150 return error; 151 152 strlcpy(card->driver, "ES1688", sizeof(card->driver)); 153 strlcpy(card->shortname, pcm->name, sizeof(card->shortname)); 154 snprintf(card->longname, sizeof(card->longname), 155 "%s at 0x%lx, irq %i, dma %i", pcm->name, chip->port, 156 chip->irq, chip->dma8); 148 157 149 158 if (fm_port[n] == SNDRV_AUTO_PORT) … … 153 162 if (snd_opl3_create(card, fm_port[n], fm_port[n] + 2, 154 163 OPL3_HW_OPL3, 0, &opl3) < 0) 155 dev_warn( dev,164 dev_warn(card->dev, 156 165 "opl3 not detected at 0x%lx\n", fm_port[n]); 157 166 else { 158 167 error = snd_opl3_hwdep_new(opl3, 0, 1, NULL); 159 168 if (error < 0) 160 goto out;169 return error; 161 170 } 162 171 } … … 168 177 mpu_irq[n], IRQF_DISABLED, NULL); 169 178 if (error < 0) 170 goto out; 171 } 179 return error; 180 } 181 182 return snd_card_register(card); 183 } 184 185 static int __devinit snd_es1688_isa_probe(struct device *dev, unsigned int n) 186 { 187 struct snd_card *card; 188 int error; 189 190 error = snd_card_create(index[n], id[n], THIS_MODULE, 191 sizeof(struct snd_es1688), &card); 192 if (error < 0) 193 return error; 194 195 error = snd_es1688_legacy_create(card, dev, n); 196 if (error < 0) 197 goto out; 172 198 173 199 snd_card_set_dev(card, dev); 174 200 175 error = snd_ card_register(card);201 error = snd_es1688_probe(card, n); 176 202 if (error < 0) 177 203 goto out; 178 204 179 205 dev_set_drvdata(dev, card); 180 return 0; 181 182 out: snd_card_free(card); 206 207 return 0; 208 out: 209 snd_card_free(card); 183 210 return error; 184 211 } 185 212 186 static int __devexit snd_es1688_ remove(struct device *dev, unsigned int n)213 static int __devexit snd_es1688_isa_remove(struct device *dev, unsigned int n) 187 214 { 188 215 snd_card_free(dev_get_drvdata(dev)); … … 193 220 static struct isa_driver snd_es1688_driver = { 194 221 .match = snd_es1688_match, 195 .probe = snd_es1688_ probe,196 .remove = __devexit_p(snd_es1688_ remove),222 .probe = snd_es1688_isa_probe, 223 .remove = __devexit_p(snd_es1688_isa_remove), 197 224 #if 0 /* FIXME */ 198 225 .suspend = snd_es1688_suspend, … … 204 231 }; 205 232 233 static int snd_es968_pnp_is_probed; 234 235 #ifdef CONFIG_PNP 236 static int __devinit snd_card_es968_pnp(struct snd_card *card, unsigned int n, 237 struct pnp_card_link *pcard, 238 const struct pnp_card_device_id *pid) 239 { 240 struct snd_es1688 *chip = card->private_data; 241 struct pnp_dev *pdev; 242 int error; 243 244 pdev = pnp_request_card_device(pcard, pid->devs[0].id, NULL); 245 if (pdev == NULL) 246 return -ENODEV; 247 248 error = pnp_activate_dev(pdev); 249 if (error < 0) { 250 snd_printk(KERN_ERR "ES968 pnp configure failure\n"); 251 return error; 252 } 253 port[n] = pnp_port_start(pdev, 0); 254 dma8[n] = pnp_dma(pdev, 0); 255 irq[n] = pnp_irq(pdev, 0); 256 257 return snd_es1688_create(card, chip, port[n], mpu_port[n], irq[n], 258 mpu_irq[n], dma8[n], ES1688_HW_AUTO); 259 } 260 261 static int __devinit snd_es968_pnp_detect(struct pnp_card_link *pcard, 262 const struct pnp_card_device_id *pid) 263 { 264 struct snd_card *card; 265 static unsigned int dev; 266 int error; 267 struct snd_es1688 *chip; 268 269 if (snd_es968_pnp_is_probed) 270 return -EBUSY; 271 for ( ; dev < SNDRV_CARDS; dev++) { 272 if (enable[dev] && isapnp[dev]) 273 break; 274 } 275 if (dev == SNDRV_CARDS) 276 return -ENODEV; 277 278 error = snd_card_create(index[dev], id[dev], THIS_MODULE, 279 sizeof(struct snd_es1688), &card); 280 if (error < 0) 281 return error; 282 chip = card->private_data; 283 284 error = snd_card_es968_pnp(card, dev, pcard, pid); 285 if (error < 0) { 286 snd_card_free(card); 287 return error; 288 } 289 snd_card_set_dev(card, &pcard->card->dev); 290 error = snd_es1688_probe(card, dev); 291 if (error < 0) 292 return error; 293 pnp_set_card_drvdata(pcard, card); 294 snd_es968_pnp_is_probed = 1; 295 return 0; 296 } 297 298 static void __devexit snd_es968_pnp_remove(struct pnp_card_link * pcard) 299 { 300 snd_card_free(pnp_get_card_drvdata(pcard)); 301 pnp_set_card_drvdata(pcard, NULL); 302 snd_es968_pnp_is_probed = 0; 303 } 304 305 #ifdef CONFIG_PM 306 static int snd_es968_pnp_suspend(struct pnp_card_link *pcard, 307 pm_message_t state) 308 { 309 struct snd_card *card = pnp_get_card_drvdata(pcard); 310 struct snd_es1688 *chip = card->private_data; 311 312 snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); 313 snd_pcm_suspend_all(chip->pcm); 314 return 0; 315 } 316 317 static int snd_es968_pnp_resume(struct pnp_card_link *pcard) 318 { 319 struct snd_card *card = pnp_get_card_drvdata(pcard); 320 struct snd_es1688 *chip = card->private_data; 321 322 snd_es1688_reset(chip); 323 snd_power_change_state(card, SNDRV_CTL_POWER_D0); 324 return 0; 325 } 326 #endif 327 328 static struct pnp_card_device_id snd_es968_pnpids[] = { 329 { .id = "ESS0968", .devs = { { "@@@0968" }, } }, 330 { .id = "ESS0968", .devs = { { "ESS0968" }, } }, 331 { .id = "", } /* end */ 332 }; 333 334 MODULE_DEVICE_TABLE(pnp_card, snd_es968_pnpids); 335 336 static struct pnp_card_driver es968_pnpc_driver = { 337 .flags = PNP_DRIVER_RES_DISABLE, 338 .name = DEV_NAME " PnP", 339 .id_table = snd_es968_pnpids, 340 .probe = snd_es968_pnp_detect, 341 .remove = __devexit_p(snd_es968_pnp_remove), 342 #ifdef CONFIG_PM 343 .suspend = snd_es968_pnp_suspend, 344 .resume = snd_es968_pnp_resume, 345 #endif 346 }; 347 #endif 348 206 349 static int __init alsa_card_es1688_init(void) 207 350 { 351 #ifdef CONFIG_PNP 352 pnp_register_card_driver(&es968_pnpc_driver); 353 if (snd_es968_pnp_is_probed) 354 return 0; 355 pnp_unregister_card_driver(&es968_pnpc_driver); 356 #endif 208 357 return isa_register_driver(&snd_es1688_driver, SNDRV_CARDS); 209 358 } … … 211 360 static void __exit alsa_card_es1688_exit(void) 212 361 { 213 isa_unregister_driver(&snd_es1688_driver); 362 if (!snd_es968_pnp_is_probed) { 363 isa_unregister_driver(&snd_es1688_driver); 364 return; 365 } 366 #ifdef CONFIG_PNP 367 pnp_unregister_card_driver(&es968_pnpc_driver); 368 #endif 214 369 } 215 370 -
GPL/trunk/alsa-kernel/isa/es1688/es1688_lib.c
r426 r598 100 100 } 101 101 102 staticint snd_es1688_reset(struct snd_es1688 *chip)102 int snd_es1688_reset(struct snd_es1688 *chip) 103 103 { 104 104 int i; … … 116 116 return 0; 117 117 } 118 EXPORT_SYMBOL(snd_es1688_reset); 118 119 119 120 static int snd_es1688_probe(struct snd_es1688 *chip) … … 621 622 free_dma(chip->dma8); 622 623 } 623 kfree(chip);624 624 return 0; 625 625 } … … 639 639 640 640 int snd_es1688_create(struct snd_card *card, 641 struct snd_es1688 *chip, 641 642 unsigned long port, 642 643 unsigned long mpu_port, … … 644 645 int mpu_irq, 645 646 int dma8, 646 unsigned short hardware, 647 struct snd_es1688 **rchip) 647 unsigned short hardware) 648 648 { 649 649 static struct snd_device_ops ops = { … … 651 651 }; 652 652 653 struct snd_es1688 *chip;654 653 int err; 655 654 656 *rchip = NULL;657 chip = kzalloc(sizeof(*chip), GFP_KERNEL);658 655 if (chip == NULL) 659 656 return -ENOMEM; … … 663 660 if ((chip->res_port = request_region(port + 4, 12, "ES1688")) == NULL) { 664 661 snd_printk(KERN_ERR "es1688: can't grab port 0x%lx\n", port + 4); 665 snd_es1688_free(chip);666 662 return -EBUSY; 667 663 } 668 664 if (request_irq(irq, snd_es1688_interrupt, IRQF_DISABLED, "ES1688", (void *) chip)) { 669 665 snd_printk(KERN_ERR "es1688: can't grab IRQ %d\n", irq); 670 snd_es1688_free(chip);671 666 return -EBUSY; 672 667 } … … 674 669 if (request_dma(dma8, "ES1688")) { 675 670 snd_printk(KERN_ERR "es1688: can't grab DMA8 %d\n", dma8); 676 snd_es1688_free(chip);677 671 return -EBUSY; 678 672 } … … 681 675 spin_lock_init(&chip->reg_lock); 682 676 spin_lock_init(&chip->mixer_lock); 683 chip->card = card;684 677 chip->port = port; 685 678 mpu_port &= ~0x000f; … … 690 683 chip->hardware = hardware; 691 684 692 if ((err = snd_es1688_probe(chip)) < 0) {693 snd_es1688_free(chip);685 err = snd_es1688_probe(chip); 686 if (err < 0) 694 687 return err; 695 } 696 if ((err = snd_es1688_init(chip, 1)) < 0) {697 snd_es1688_free(chip);688 689 err = snd_es1688_init(chip, 1); 690 if (err < 0) 698 691 return err; 699 }700 692 701 693 /* Register device */ 702 if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops)) < 0) { 703 snd_es1688_free(chip); 704 return err; 705 } 706 707 *rchip = chip; 708 return 0; 694 return snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops); 709 695 } 710 696 … … 731 717 }; 732 718 733 int snd_es1688_pcm(struct snd_es1688 * chip, int device, struct snd_pcm ** rpcm) 719 int snd_es1688_pcm(struct snd_card *card, struct snd_es1688 *chip, 720 int device, struct snd_pcm **rpcm) 734 721 { 735 722 struct snd_pcm *pcm; 736 723 int err; 737 724 738 if ((err = snd_pcm_new(chip->card, "ESx688", device, 1, 1, &pcm)) < 0) 725 err = snd_pcm_new(card, "ESx688", device, 1, 1, &pcm); 726 if (err < 0) 739 727 return err; 740 728 … … 983 971 ES1688_DOUBLE("Mic Playback Volume", 0, ES1688_MIC_DEV, ES1688_MIC_DEV, 4, 0, 15, 0), 984 972 ES1688_DOUBLE("Aux Playback Volume", 0, ES1688_AUX_DEV, ES1688_AUX_DEV, 4, 0, 15, 0), 985 ES1688_SINGLE(" PC SpeakerPlayback Volume", 0, ES1688_SPEAKER_DEV, 0, 7, 0),973 ES1688_SINGLE("Beep Playback Volume", 0, ES1688_SPEAKER_DEV, 0, 7, 0), 986 974 ES1688_DOUBLE("Capture Volume", 0, ES1688_RECLEV_DEV, ES1688_RECLEV_DEV, 4, 0, 15, 0), 987 975 ES1688_SINGLE("Capture Switch", 0, ES1688_REC_DEV, 4, 1, 1), … … 1010 998 }; 1011 999 1012 int snd_es1688_mixer(struct snd_es1688 *chip) 1013 { 1014 struct snd_card *card; 1000 int snd_es1688_mixer(struct snd_card *card, struct snd_es1688 *chip) 1001 { 1015 1002 unsigned int idx; 1016 1003 int err; 1017 1004 unsigned char reg, val; 1018 1005 1019 if (snd_BUG_ON(!chip || !c hip->card))1006 if (snd_BUG_ON(!chip || !card)) 1020 1007 return -EINVAL; 1021 1022 card = chip->card;1023 1008 1024 1009 strcpy(card->mixername, snd_es1688_chip_id(chip)); -
GPL/trunk/alsa-kernel/isa/es18xx.c
r410 r598 81 81 #include <linux/err.h> 82 82 #include <linux/isa.h> 83 #include <linux/slab.h>84 83 #include <linux/pnp.h> 85 84 #include <linux/isapnp.h> … … 103 102 struct snd_es18xx { 104 103 unsigned long port; /* port of ESS chip */ 105 unsigned long mpu_port; /* MPU-401 port of ESS chip */106 unsigned long fm_port; /* FM port */107 104 unsigned long ctrl_port; /* Control port of ESS chip */ 108 105 struct resource *res_port; … … 117 114 118 115 unsigned short active; /* active channel mask */ 119 unsigned int dma1_size;120 unsigned int dma2_size;121 116 unsigned int dma1_shift; 122 117 unsigned int dma2_shift; 123 118 124 struct snd_card *card;125 119 struct snd_pcm *pcm; 126 120 struct snd_pcm_substream *playback_a_substream; … … 137 131 spinlock_t reg_lock; 138 132 spinlock_t mixer_lock; 139 spinlock_t ctrl_lock;140 133 #ifdef CONFIG_PM 141 134 unsigned char pm_reg; 142 135 #endif 143 };144 145 struct snd_audiodrive {146 struct snd_es18xx *chip;147 136 #ifdef CONFIG_PNP 148 137 struct pnp_dev *dev; … … 360 349 361 350 362 static int snd_es18xx_reset(struct snd_es18xx *chip)351 static int __devinit snd_es18xx_reset(struct snd_es18xx *chip) 363 352 { 364 353 int i; … … 495 484 unsigned int size = snd_pcm_lib_buffer_bytes(substream); 496 485 unsigned int count = snd_pcm_lib_period_bytes(substream); 497 498 chip->dma2_size = size;499 486 500 487 snd_es18xx_rate_set(chip, substream, DAC2); … … 597 584 unsigned int count = snd_pcm_lib_period_bytes(substream); 598 585 599 chip->dma1_size = size;600 601 586 snd_es18xx_reset_fifo(chip); 602 587 … … 665 650 unsigned int count = snd_pcm_lib_period_bytes(substream); 666 651 667 chip->dma1_size = size;668 669 652 snd_es18xx_reset_fifo(chip); 670 653 … … 756 739 static irqreturn_t snd_es18xx_interrupt(int irq, void *dev_id) 757 740 { 758 struct snd_es18xx *chip = dev_id; 741 struct snd_card *card = dev_id; 742 struct snd_es18xx *chip = card->private_data; 759 743 unsigned char status; 760 744 … … 806 790 if (chip->caps & ES18XX_HWV) { 807 791 split = snd_es18xx_mixer_read(chip, 0x64) & 0x80; 808 snd_ctl_notify(chip->card, SNDRV_CTL_EVENT_MASK_VALUE, &chip->hw_switch->id); 809 snd_ctl_notify(chip->card, SNDRV_CTL_EVENT_MASK_VALUE, &chip->hw_volume->id); 792 snd_ctl_notify(card, SNDRV_CTL_EVENT_MASK_VALUE, 793 &chip->hw_switch->id); 794 snd_ctl_notify(card, SNDRV_CTL_EVENT_MASK_VALUE, 795 &chip->hw_volume->id); 810 796 } 811 797 if (!split) { 812 snd_ctl_notify(chip->card, SNDRV_CTL_EVENT_MASK_VALUE, &chip->master_switch->id); 813 snd_ctl_notify(chip->card, SNDRV_CTL_EVENT_MASK_VALUE, &chip->master_volume->id); 798 snd_ctl_notify(card, SNDRV_CTL_EVENT_MASK_VALUE, 799 &chip->master_switch->id); 800 snd_ctl_notify(card, SNDRV_CTL_EVENT_MASK_VALUE, 801 &chip->master_volume->id); 814 802 } 815 803 /* ack interrupt */ … … 822 810 { 823 811 struct snd_es18xx *chip = snd_pcm_substream_chip(substream); 812 unsigned int size = snd_pcm_lib_buffer_bytes(substream); 824 813 int pos; 825 814 … … 827 816 if (!(chip->active & DAC2)) 828 817 return 0; 829 pos = snd_dma_pointer(chip->dma2, chip->dma2_size);818 pos = snd_dma_pointer(chip->dma2, size); 830 819 return pos >> chip->dma2_shift; 831 820 } else { 832 821 if (!(chip->active & DAC1)) 833 822 return 0; 834 pos = snd_dma_pointer(chip->dma1, chip->dma1_size);823 pos = snd_dma_pointer(chip->dma1, size); 835 824 return pos >> chip->dma1_shift; 836 825 } … … 840 829 { 841 830 struct snd_es18xx *chip = snd_pcm_substream_chip(substream); 831 unsigned int size = snd_pcm_lib_buffer_bytes(substream); 842 832 int pos; 843 833 844 834 if (!(chip->active & ADC1)) 845 835 return 0; 846 pos = snd_dma_pointer(chip->dma1, chip->dma1_size);836 pos = snd_dma_pointer(chip->dma1, size); 847 837 return pos >> chip->dma1_shift; 848 838 } … … 975 965 static int snd_es18xx_info_mux(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) 976 966 { 977 static char *texts4Source[4] = {978 "Mic", "CD", "Line", "Master"979 };980 967 static char *texts5Source[5] = { 981 968 "Mic", "CD", "Line", "Master", "Mix" … … 995 982 if (uinfo->value.enumerated.item > 3) 996 983 uinfo->value.enumerated.item = 3; 997 strcpy(uinfo->value.enumerated.name, texts4Source[uinfo->value.enumerated.item]); 984 strcpy(uinfo->value.enumerated.name, 985 texts5Source[uinfo->value.enumerated.item]); 998 986 break; 999 987 case 0x1887: … … 1314 1302 */ 1315 1303 static struct snd_kcontrol_new snd_es18xx_opt_speaker = 1316 ES18XX_SINGLE(" PC SpeakerPlayback Volume", 0, 0x3c, 0, 7, 0);1304 ES18XX_SINGLE("Beep Playback Volume", 0, 0x3c, 0, 7, 0); 1317 1305 1318 1306 static struct snd_kcontrol_new snd_es18xx_opt_1869[] = { … … 1379 1367 { 1380 1368 int data; 1381 unsigned long flags; 1382 spin_lock_irqsave(&chip->ctrl_lock, flags); 1369 1383 1370 outb(reg, chip->ctrl_port); 1384 1371 data = inb(chip->ctrl_port + 1); 1385 spin_unlock_irqrestore(&chip->ctrl_lock, flags);1386 1372 return data; 1387 1373 } … … 1399 1385 } 1400 1386 1401 static int __devinit snd_es18xx_initialize(struct snd_es18xx *chip) 1387 static int __devinit snd_es18xx_initialize(struct snd_es18xx *chip, 1388 unsigned long mpu_port, 1389 unsigned long fm_port) 1402 1390 { 1403 1391 int mask = 0; … … 1413 1401 /* Hardware volume IRQ */ 1414 1402 snd_es18xx_config_write(chip, 0x27, chip->irq); 1415 if ( chip->fm_port > 0 && chip->fm_port != SNDRV_AUTO_PORT) {1403 if (fm_port > 0 && fm_port != SNDRV_AUTO_PORT) { 1416 1404 /* FM I/O */ 1417 snd_es18xx_config_write(chip, 0x62, chip->fm_port >> 8);1418 snd_es18xx_config_write(chip, 0x63, chip->fm_port & 0xff);1405 snd_es18xx_config_write(chip, 0x62, fm_port >> 8); 1406 snd_es18xx_config_write(chip, 0x63, fm_port & 0xff); 1419 1407 } 1420 if ( chip->mpu_port > 0 && chip->mpu_port != SNDRV_AUTO_PORT) {1408 if (mpu_port > 0 && mpu_port != SNDRV_AUTO_PORT) { 1421 1409 /* MPU-401 I/O */ 1422 snd_es18xx_config_write(chip, 0x64, chip->mpu_port >> 8);1423 snd_es18xx_config_write(chip, 0x65, chip->mpu_port & 0xff);1410 snd_es18xx_config_write(chip, 0x64, mpu_port >> 8); 1411 snd_es18xx_config_write(chip, 0x65, mpu_port & 0xff); 1424 1412 /* MPU-401 IRQ */ 1425 1413 snd_es18xx_config_write(chip, 0x28, chip->irq); … … 1508 1496 /* Enable and set hardware volume interrupt */ 1509 1497 snd_es18xx_mixer_write(chip, 0x64, 0x06); 1510 if ( chip->mpu_port > 0 && chip->mpu_port != SNDRV_AUTO_PORT) {1498 if (mpu_port > 0 && mpu_port != SNDRV_AUTO_PORT) { 1511 1499 /* MPU401 share irq with audio 1512 1500 Joystick enabled 1513 1501 FM enabled */ 1514 snd_es18xx_mixer_write(chip, 0x40, 0x43 | (chip->mpu_port & 0xf0) >> 1); 1502 snd_es18xx_mixer_write(chip, 0x40, 1503 0x43 | (mpu_port & 0xf0) >> 1); 1515 1504 } 1516 1505 snd_es18xx_mixer_write(chip, 0x7f, ((irqmask + 1) << 1) | 0x01); … … 1630 1619 } 1631 1620 1632 static int __devinit snd_es18xx_probe(struct snd_es18xx *chip) 1621 static int __devinit snd_es18xx_probe(struct snd_es18xx *chip, 1622 unsigned long mpu_port, 1623 unsigned long fm_port) 1633 1624 { 1634 1625 if (snd_es18xx_identify(chip) < 0) { … … 1651 1642 break; 1652 1643 case 0x1887: 1653 chip->caps = ES18XX_PCM2 | ES18XX_RECMIX | ES18XX_AUXB | ES18XX_DUPLEX_SAME;1654 break;1655 1644 case 0x1888: 1656 1645 chip->caps = ES18XX_PCM2 | ES18XX_RECMIX | ES18XX_AUXB | ES18XX_DUPLEX_SAME; … … 1667 1656 chip->caps &= ~(ES18XX_PCM2 | ES18XX_DUPLEX_SAME); 1668 1657 1669 return snd_es18xx_initialize(chip);1658 return snd_es18xx_initialize(chip, mpu_port, fm_port); 1670 1659 } 1671 1660 … … 1692 1681 }; 1693 1682 1694 static int __devinit snd_es18xx_pcm(struct snd_es18xx *chip, int device, struct snd_pcm ** rpcm) 1695 { 1683 static int __devinit snd_es18xx_pcm(struct snd_card *card, int device, 1684 struct snd_pcm **rpcm) 1685 { 1686 struct snd_es18xx *chip = card->private_data; 1696 1687 struct snd_pcm *pcm; 1697 1688 char str[16]; … … 1702 1693 sprintf(str, "ES%x", chip->version); 1703 1694 if (chip->caps & ES18XX_PCM2) 1704 err = snd_pcm_new(c hip->card, str, device, 2, 1, &pcm);1695 err = snd_pcm_new(card, str, device, 2, 1, &pcm); 1705 1696 else 1706 err = snd_pcm_new(c hip->card, str, device, 1, 1, &pcm);1697 err = snd_pcm_new(card, str, device, 1, 1, &pcm); 1707 1698 if (err < 0) 1708 1699 return err; … … 1735 1726 static int snd_es18xx_suspend(struct snd_card *card, pm_message_t state) 1736 1727 { 1737 struct snd_audiodrive *acard = card->private_data; 1738 struct snd_es18xx *chip = acard->chip; 1739 1740 snd_power_change_state(chip->card, SNDRV_CTL_POWER_D3hot); 1728 struct snd_es18xx *chip = card->private_data; 1729 1730 snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); 1741 1731 1742 1732 snd_pcm_suspend_all(chip->pcm); … … 1753 1743 static int snd_es18xx_resume(struct snd_card *card) 1754 1744 { 1755 struct snd_audiodrive *acard = card->private_data; 1756 struct snd_es18xx *chip = acard->chip; 1745 struct snd_es18xx *chip = card->private_data; 1757 1746 1758 1747 /* restore PM register, we won't wake till (not 0x07) i/o activity though */ 1759 1748 snd_es18xx_write(chip, ES18XX_PM, chip->pm_reg ^= ES18XX_PM_FM); 1760 1749 1761 snd_power_change_state(c hip->card, SNDRV_CTL_POWER_D0);1750 snd_power_change_state(card, SNDRV_CTL_POWER_D0); 1762 1751 return 0; 1763 1752 } 1764 1753 #endif /* CONFIG_PM */ 1765 1754 1766 static int snd_es18xx_free(struct snd_es18xx *chip) 1767 { 1755 static int snd_es18xx_free(struct snd_card *card) 1756 { 1757 struct snd_es18xx *chip = card->private_data; 1758 1768 1759 release_and_free_resource(chip->res_port); 1769 1760 release_and_free_resource(chip->res_ctrl_port); 1770 1761 release_and_free_resource(chip->res_mpu_port); 1771 1762 if (chip->irq >= 0) 1772 free_irq(chip->irq, (void *) c hip);1763 free_irq(chip->irq, (void *) card); 1773 1764 if (chip->dma1 >= 0) { 1774 1765 disable_dma(chip->dma1); … … 1779 1770 free_dma(chip->dma2); 1780 1771 } 1781 kfree(chip);1782 1772 return 0; 1783 1773 } … … 1785 1775 static int snd_es18xx_dev_free(struct snd_device *device) 1786 1776 { 1787 struct snd_es18xx *chip = device->device_data; 1788 return snd_es18xx_free(chip); 1777 return snd_es18xx_free(device->card); 1789 1778 } 1790 1779 … … 1793 1782 unsigned long mpu_port, 1794 1783 unsigned long fm_port, 1795 int irq, int dma1, int dma2, 1796 struct snd_es18xx ** rchip) 1797 { 1798 struct snd_es18xx *chip; 1784 int irq, int dma1, int dma2) 1785 { 1786 struct snd_es18xx *chip = card->private_data; 1799 1787 static struct snd_device_ops ops = { 1800 1788 .dev_free = snd_es18xx_dev_free, … … 1802 1790 int err; 1803 1791 1804 *rchip = NULL;1805 chip = kzalloc(sizeof(*chip), GFP_KERNEL);1806 if (chip == NULL)1807 return -ENOMEM;1808 1792 spin_lock_init(&chip->reg_lock); 1809 1793 spin_lock_init(&chip->mixer_lock); 1810 spin_lock_init(&chip->ctrl_lock);1811 chip->card = card;1812 1794 chip->port = port; 1813 chip->mpu_port = mpu_port;1814 chip->fm_port = fm_port;1815 1795 chip->irq = -1; 1816 1796 chip->dma1 = -1; … … 1819 1799 chip->active = 0; 1820 1800 1821 if ((chip->res_port = request_region(port, 16, "ES18xx")) == NULL) { 1822 snd_es18xx_free(chip); 1801 chip->res_port = request_region(port, 16, "ES18xx"); 1802 if (chip->res_port == NULL) { 1803 snd_es18xx_free(card); 1823 1804 snd_printk(KERN_ERR PFX "unable to grap ports 0x%lx-0x%lx\n", port, port + 16 - 1); 1824 1805 return -EBUSY; 1825 1806 } 1826 1807 1827 if (request_irq(irq, snd_es18xx_interrupt, IRQF_DISABLED, "ES18xx", (void *) chip)) { 1828 snd_es18xx_free(chip); 1808 if (request_irq(irq, snd_es18xx_interrupt, IRQF_DISABLED, "ES18xx", 1809 (void *) card)) { 1810 snd_es18xx_free(card); 1829 1811 snd_printk(KERN_ERR PFX "unable to grap IRQ %d\n", irq); 1830 1812 return -EBUSY; … … 1833 1815 1834 1816 if (request_dma(dma1, "ES18xx DMA 1")) { 1835 snd_es18xx_free(c hip);1817 snd_es18xx_free(card); 1836 1818 snd_printk(KERN_ERR PFX "unable to grap DMA1 %d\n", dma1); 1837 1819 return -EBUSY; … … 1840 1822 1841 1823 if (dma2 != dma1 && request_dma(dma2, "ES18xx DMA 2")) { 1842 snd_es18xx_free(c hip);1824 snd_es18xx_free(card); 1843 1825 snd_printk(KERN_ERR PFX "unable to grap DMA2 %d\n", dma2); 1844 1826 return -EBUSY; … … 1846 1828 chip->dma2 = dma2; 1847 1829 1848 if (snd_es18xx_probe(chip) < 0) { 1849 snd_es18xx_free(chip); 1850 return -ENODEV; 1851 } 1852 if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops)) < 0) { 1853 snd_es18xx_free(chip); 1830 if (snd_es18xx_probe(chip, mpu_port, fm_port) < 0) { 1831 snd_es18xx_free(card); 1832 return -ENODEV; 1833 } 1834 err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops); 1835 if (err < 0) { 1836 snd_es18xx_free(card); 1854 1837 return err; 1855 1838 } 1856 *rchip = chip;1857 1839 return 0; 1858 1840 } 1859 1841 1860 static int __devinit snd_es18xx_mixer(struct snd_ es18xx *chip)1861 { 1862 struct snd_ card *card;1842 static int __devinit snd_es18xx_mixer(struct snd_card *card) 1843 { 1844 struct snd_es18xx *chip = card->private_data; 1863 1845 int err; 1864 1846 unsigned int idx; 1865 1866 card = chip->card;1867 1847 1868 1848 strcpy(card->mixername, chip->pcm->name); … … 1987 1967 static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_ISAPNP; /* Enable this card */ 1988 1968 #ifdef CONFIG_PNP 1989 static int isapnp[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 1};1969 static int isapnp[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_ISAPNP; 1990 1970 #endif 1991 1971 static long port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* 0x220,0x240,0x260,0x280 */ … … 2064 2044 } 2065 2045 2066 static int __devinit snd_audiodrive_pnp(int dev, struct snd_ audiodrive *acard,2046 static int __devinit snd_audiodrive_pnp(int dev, struct snd_es18xx *chip, 2067 2047 struct pnp_dev *pdev) 2068 2048 { 2069 acard->dev = pdev;2070 if (snd_audiodrive_pnp_init_main(dev, acard->dev) < 0)2049 chip->dev = pdev; 2050 if (snd_audiodrive_pnp_init_main(dev, chip->dev) < 0) 2071 2051 return -EBUSY; 2072 2052 return 0; … … 2094 2074 MODULE_DEVICE_TABLE(pnp_card, snd_audiodrive_pnpids); 2095 2075 2096 static int __devinit snd_audiodrive_pnpc(int dev, struct snd_ audiodrive *acard,2076 static int __devinit snd_audiodrive_pnpc(int dev, struct snd_es18xx *chip, 2097 2077 struct pnp_card_link *card, 2098 2078 const struct pnp_card_device_id *id) 2099 2079 { 2100 acard->dev = pnp_request_card_device(card, id->devs[0].id, NULL);2101 if ( acard->dev == NULL)2080 chip->dev = pnp_request_card_device(card, id->devs[0].id, NULL); 2081 if (chip->dev == NULL) 2102 2082 return -EBUSY; 2103 2083 2104 acard->devc = pnp_request_card_device(card, id->devs[1].id, NULL);2105 if ( acard->devc == NULL)2084 chip->devc = pnp_request_card_device(card, id->devs[1].id, NULL); 2085 if (chip->devc == NULL) 2106 2086 return -EBUSY; 2107 2087 2108 2088 /* Control port initialization */ 2109 if (pnp_activate_dev( acard->devc) < 0) {2089 if (pnp_activate_dev(chip->devc) < 0) { 2110 2090 snd_printk(KERN_ERR PFX "PnP control configure failure (out of resources?)\n"); 2111 2091 return -EAGAIN; 2112 2092 } 2113 2093 snd_printdd("pnp: port=0x%llx\n", 2114 (unsigned long long)pnp_port_start( acard->devc, 0));2115 if (snd_audiodrive_pnp_init_main(dev, acard->dev) < 0)2094 (unsigned long long)pnp_port_start(chip->devc, 0)); 2095 if (snd_audiodrive_pnp_init_main(dev, chip->dev) < 0) 2116 2096 return -EBUSY; 2117 2097 … … 2129 2109 { 2130 2110 return snd_card_create(index[dev], id[dev], THIS_MODULE, 2131 sizeof(struct snd_ audiodrive), cardp);2111 sizeof(struct snd_es18xx), cardp); 2132 2112 } 2133 2113 2134 2114 static int __devinit snd_audiodrive_probe(struct snd_card *card, int dev) 2135 2115 { 2136 struct snd_audiodrive *acard = card->private_data; 2137 struct snd_es18xx *chip; 2116 struct snd_es18xx *chip = card->private_data; 2138 2117 struct snd_opl3 *opl3; 2139 2118 int err; 2140 2119 2141 if ((err = snd_es18xx_new_device(card, 2142 port[dev], 2143 mpu_port[dev], 2144 fm_port[dev], 2145 irq[dev], dma1[dev], dma2[dev], 2146 &chip)) < 0) 2120 err = snd_es18xx_new_device(card, 2121 port[dev], mpu_port[dev], fm_port[dev], 2122 irq[dev], dma1[dev], dma2[dev]); 2123 if (err < 0) 2147 2124 return err; 2148 acard->chip = chip;2149 2125 2150 2126 sprintf(card->driver, "ES%x", chip->version); … … 2162 2138 irq[dev], dma1[dev]); 2163 2139 2164 if ((err = snd_es18xx_pcm(chip, 0, NULL)) < 0) 2140 err = snd_es18xx_pcm(card, 0, NULL); 2141 if (err < 0) 2165 2142 return err; 2166 2143 2167 if ((err = snd_es18xx_mixer(chip)) < 0) 2144 err = snd_es18xx_mixer(card); 2145 if (err < 0) 2168 2146 return err; 2169 2147 2170 2148 if (fm_port[dev] > 0 && fm_port[dev] != SNDRV_AUTO_PORT) { 2171 if (snd_opl3_create(card, chip->fm_port, chip->fm_port + 2, OPL3_HW_OPL3, 0, &opl3) < 0) { 2172 snd_printk(KERN_WARNING PFX "opl3 not detected at 0x%lx\n", chip->fm_port); 2149 if (snd_opl3_create(card, fm_port[dev], fm_port[dev] + 2, 2150 OPL3_HW_OPL3, 0, &opl3) < 0) { 2151 snd_printk(KERN_WARNING PFX 2152 "opl3 not detected at 0x%lx\n", 2153 fm_port[dev]); 2173 2154 } else { 2174 if ((err = snd_opl3_hwdep_new(opl3, 0, 1, NULL)) < 0) 2155 err = snd_opl3_hwdep_new(opl3, 0, 1, NULL); 2156 if (err < 0) 2175 2157 return err; 2176 2158 } … … 2178 2160 2179 2161 if (mpu_port[dev] > 0 && mpu_port[dev] != SNDRV_AUTO_PORT) { 2180 if ((err = snd_mpu401_uart_new(card, 0, MPU401_HW_ES18XX,2181 chip->mpu_port, 0,2182 irq[dev], 0,2183 &chip->rmidi))< 0)2162 err = snd_mpu401_uart_new(card, 0, MPU401_HW_ES18XX, 2163 mpu_port[dev], 0, 2164 irq[dev], 0, &chip->rmidi); 2165 if (err < 0) 2184 2166 return err; 2185 2167 } -
GPL/trunk/alsa-kernel/isa/gus/gus_mem.c
r305 r598 128 128 return NULL; 129 129 for (block = alloc->first; block; block = block->next) 130 if (!memcmp(share_id, block->share_id, sizeof(share_id))) 130 if (!memcmp(share_id, block->share_id, 131 sizeof(block->share_id))) 131 132 return block; 132 133 return NULL; -
GPL/trunk/alsa-kernel/isa/gus/gus_mem_proc.c
r305 r598 32 32 }; 33 33 34 static long snd_gf1_mem_proc_dump(struct snd_info_entry *entry, void *file_private_data, 35 struct file *file, char __user *buf, 36 unsigned long count, unsigned long pos) 34 static ssize_t snd_gf1_mem_proc_dump(struct snd_info_entry *entry, 35 void *file_private_data, 36 struct file *file, char __user *buf, 37 size_t count, loff_t pos) 37 38 { 38 long size;39 39 struct gus_proc_private *priv = entry->private_data; 40 40 struct snd_gus_card *gus = priv->gus; 41 41 int err; 42 42 43 size = count; 44 if (pos + size > priv->size) 45 size = (long)priv->size - pos; 46 if (size > 0) { 47 if ((err = snd_gus_dram_read(gus, buf, pos, size, priv->rom)) < 0) 48 return err; 49 return size; 50 } 51 return 0; 43 err = snd_gus_dram_read(gus, buf, pos, count, priv->rom); 44 if (err < 0) 45 return err; 46 return count; 52 47 } 53 54 static long long snd_gf1_mem_proc_llseek(struct snd_info_entry *entry,55 void *private_file_data,56 struct file *file,57 long long offset,58 int orig)59 {60 struct gus_proc_private *priv = entry->private_data;61 62 switch (orig) {63 case SEEK_SET:64 file->f_pos = offset;65 break;66 case SEEK_CUR:67 file->f_pos += offset;68 break;69 case SEEK_END: /* offset is negative */70 file->f_pos = priv->size + offset;71 break;72 default:73 return -EINVAL;74 }75 if (file->f_pos > priv->size)76 file->f_pos = priv->size;77 return file->f_pos;78 }79 48 80 49 static void snd_gf1_mem_proc_free(struct snd_info_entry *entry) … … 86 55 static struct snd_info_entry_ops snd_gf1_mem_proc_ops = { 87 56 .read = snd_gf1_mem_proc_dump, 88 .llseek = snd_gf1_mem_proc_llseek,89 57 }; 90 58 -
GPL/trunk/alsa-kernel/isa/gus/gusextreme.c
r464 r598 96 96 97 97 static int __devinit snd_gusextreme_es1688_create(struct snd_card *card, 98 struct device *dev, unsigned int n, struct snd_es1688 **rchip)98 struct snd_es1688 *chip, struct device *dev, unsigned int n) 99 99 { 100 100 static long possible_ports[] = {0x220, 0x240, 0x260}; … … 120 120 121 121 if (port[n] != SNDRV_AUTO_PORT) 122 return snd_es1688_create(card, port[n], mpu_port[n], irq[n],123 mpu_irq[n], dma8[n], ES1688_HW_1688, rchip);122 return snd_es1688_create(card, chip, port[n], mpu_port[n], 123 irq[n], mpu_irq[n], dma8[n], ES1688_HW_1688); 124 124 125 125 i = 0; 126 126 do { 127 127 port[n] = possible_ports[i]; 128 error = snd_es1688_create(card, port[n], mpu_port[n], irq[n],129 mpu_irq[n], dma8[n], ES1688_HW_1688, rchip);128 error = snd_es1688_create(card, chip, port[n], mpu_port[n], 129 irq[n], mpu_irq[n], dma8[n], ES1688_HW_1688); 130 130 } while (error < 0 && ++i < ARRAY_SIZE(possible_ports)); 131 131 … … 207 207 } 208 208 209 static int __devinit snd_gusextreme_mixer(struct snd_es1688 *chip) 210 { 211 struct snd_card *card = chip->card; 209 static int __devinit snd_gusextreme_mixer(struct snd_card *card) 210 { 212 211 struct snd_ctl_elem_id id1, id2; 213 212 int error; … … 242 241 int error; 243 242 244 error = snd_card_create(index[n], id[n], THIS_MODULE, 0, &card); 243 error = snd_card_create(index[n], id[n], THIS_MODULE, 244 sizeof(struct snd_es1688), &card); 245 245 if (error < 0) 246 246 return error; 247 248 es1688 = card->private_data; 247 249 248 250 if (mpu_port[n] == SNDRV_AUTO_PORT) … … 252 254 mpu_irq[n] = -1; 253 255 254 error = snd_gusextreme_es1688_create(card, dev, n, &es1688);256 error = snd_gusextreme_es1688_create(card, es1688, dev, n); 255 257 if (error < 0) 256 258 goto out; … … 281 283 gus->codec_flag = 1; 282 284 283 error = snd_es1688_pcm( es1688, 0, NULL);284 if (error < 0) 285 goto out; 286 287 error = snd_es1688_mixer( es1688);285 error = snd_es1688_pcm(card, es1688, 0, NULL); 286 if (error < 0) 287 goto out; 288 289 error = snd_es1688_mixer(card, es1688); 288 290 if (error < 0) 289 291 goto out; … … 301 303 goto out; 302 304 303 error = snd_gusextreme_mixer( es1688);305 error = snd_gusextreme_mixer(card); 304 306 if (error < 0) 305 307 goto out; -
GPL/trunk/alsa-kernel/isa/gus/gusmax.c
r410 r598 192 192 static void snd_gusmax_free(struct snd_card *card) 193 193 { 194 struct snd_gusmax *maxcard = (struct snd_gusmax *)card->private_data;194 struct snd_gusmax *maxcard = card->private_data; 195 195 196 196 if (maxcard == NULL) … … 220 220 return err; 221 221 card->private_free = snd_gusmax_free; 222 maxcard = (struct snd_gusmax *)card->private_data;222 maxcard = card->private_data; 223 223 maxcard->card = card; 224 224 maxcard->irq = -1; -
GPL/trunk/alsa-kernel/isa/gus/interwave.c
r426 r598 27 27 #include <linux/isa.h> 28 28 #include <linux/delay.h> 29 #include <linux/slab.h>30 29 #include <linux/pnp.h> 31 30 #include <linux/moduleparam.h> -
GPL/trunk/alsa-kernel/isa/opl3sa2.c
r426 r598 25 25 #include <linux/interrupt.h> 26 26 #include <linux/pm.h> 27 #include <linux/slab.h>28 27 #include <linux/pnp.h> 29 28 #include <linux/moduleparam.h> … … 270 269 return -ENODEV; 271 270 } 272 /* try if the MIC register is acces ible */271 /* try if the MIC register is accessible */ 273 272 tmp = snd_opl3sa2_read(chip, OPL3SA2_MIC); 274 273 snd_opl3sa2_write(chip, OPL3SA2_MIC, 0x8a); -
GPL/trunk/alsa-kernel/isa/opti9xx/opti92x-ad1848.c
r426 r598 28 28 #include <linux/isa.h> 29 29 #include <linux/delay.h> 30 #include <linux/slab.h>31 30 #include <linux/pnp.h> 32 31 #include <linux/moduleparam.h> … … 34 33 #include <asm/dma.h> 35 34 #include <sound/core.h> 35 #include <sound/tlv.h> 36 36 #include <sound/wss.h> 37 37 #include <sound/mpu401.h> … … 136 136 #ifdef OPTi93X 137 137 unsigned long mc_indir_index; 138 unsigned long mc_indir_size; 139 struct resource *res_mc_indir; 138 140 struct snd_wss *codec; 139 141 #endif /* OPTi93X */ … … 144 146 long wss_base; 145 147 int irq; 146 int dma1;147 int dma2;148 149 long fm_port;150 151 long mpu_port;152 int mpu_irq;153 154 #ifdef CONFIG_PNP155 struct pnp_dev *dev;156 struct pnp_dev *devmpu;157 #endif /* CONFIG_PNP */158 148 }; 159 149 … … 165 155 #ifndef OPTi93X 166 156 /* OPTi 82C924 */ 167 { .id = "OPT0924", .devs = { { "OPT0000" }, { "OPT0002" } }, .driver_data = 0x0924 }, 157 { .id = "OPT0924", 158 .devs = { { "OPT0000" }, { "OPT0002" }, { "OPT0005" } }, 159 .driver_data = 0x0924 }, 168 160 /* OPTi 82C925 */ 169 { .id = "OPT0925", .devs = { { "OPT9250" }, { "OPT0002" } }, .driver_data = 0x0925 }, 161 { .id = "OPT0925", 162 .devs = { { "OPT9250" }, { "OPT0002" }, { "OPT0005" } }, 163 .driver_data = 0x0925 }, 170 164 #else 171 165 /* OPTi 82C931/3 */ 172 { .id = "OPT0931", .devs = { { "OPT9310" }, { "OPT0002" } }, .driver_data = 0x0931 }, 166 { .id = "OPT0931", .devs = { { "OPT9310" }, { "OPT0002" } }, 167 .driver_data = 0x0931 }, 173 168 #endif /* OPTi93X */ 174 169 { .id = "" } … … 186 181 187 182 static char * snd_opti9xx_names[] = { 188 "unk own",183 "unknown", 189 184 "82C928", "82C929", 190 185 "82C924", "82C925", … … 213 208 strcpy(chip->name, snd_opti9xx_names[hardware]); 214 209 215 chip->mc_base_size = opti9xx_mc_size[hardware];216 217 210 spin_lock_init(&chip->lock); 218 211 219 chip->wss_base = -1;220 212 chip->irq = -1; 221 chip->dma1 = -1; 222 chip->dma2 = -1; 223 chip->fm_port = -1; 224 chip->mpu_port = -1; 225 chip->mpu_irq = -1; 213 214 #ifndef OPTi93X 215 #ifdef CONFIG_PNP 216 if (isapnp && chip->mc_base) 217 /* PnP resource gives the least 10 bits */ 218 chip->mc_base |= 0xc00; 219 else 220 #endif /* CONFIG_PNP */ 221 { 222 chip->mc_base = 0xf8c; 223 chip->mc_base_size = opti9xx_mc_size[hardware]; 224 } 225 #else 226 chip->mc_base_size = opti9xx_mc_size[hardware]; 227 #endif 226 228 227 229 switch (hardware) { … … 229 231 case OPTi9XX_HW_82C928: 230 232 case OPTi9XX_HW_82C929: 231 chip->mc_base = 0xf8c;232 233 chip->password = (hardware == OPTi9XX_HW_82C928) ? 0xe2 : 0xe3; 233 234 chip->pwd_reg = 3; … … 236 237 case OPTi9XX_HW_82C924: 237 238 case OPTi9XX_HW_82C925: 238 chip->mc_base = 0xf8c;239 239 chip->password = 0xe5; 240 240 chip->pwd_reg = 3; … … 246 246 case OPTi9XX_HW_82C933: 247 247 chip->mc_base = (hardware == OPTi9XX_HW_82C930) ? 0xf8f : 0xf8d; 248 chip->mc_indir_index = 0xe0e; 248 if (!chip->mc_indir_index) { 249 chip->mc_indir_index = 0xe0e; 250 chip->mc_indir_size = 2; 251 } 249 252 chip->password = 0xe4; 250 253 chip->pwd_reg = 0; … … 301 304 return retval; 302 305 } 303 306 304 307 static void snd_opti9xx_write(struct snd_opti9xx *chip, unsigned char reg, 305 308 unsigned char value) … … 349 352 350 353 351 static int __devinit snd_opti9xx_configure(struct snd_opti9xx *chip) 354 static int __devinit snd_opti9xx_configure(struct snd_opti9xx *chip, 355 long port, 356 int irq, int dma1, int dma2, 357 long mpu_port, int mpu_irq) 352 358 { 353 359 unsigned char wss_base_bits; … … 360 366 #ifndef OPTi93X 361 367 case OPTi9XX_HW_82C924: 368 /* opti 929 mode (?), OPL3 clock output, audio enable */ 362 369 snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(4), 0xf0, 0xfc); 370 /* enable wave audio */ 363 371 snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(6), 0x02, 0x02); 364 372 365 373 case OPTi9XX_HW_82C925: 374 /* enable WSS mode */ 366 375 snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(1), 0x80, 0x80); 376 /* OPL3 FM synthesis */ 367 377 snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(2), 0x00, 0x20); 378 /* disable Sound Blaster IRQ and DMA */ 368 379 snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(3), 0xf0, 0xff); 369 380 #ifdef CS4231 381 /* cs4231/4248 fix enabled */ 370 382 snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(5), 0x02, 0x02); 371 383 #else 384 /* cs4231/4248 fix disabled */ 372 385 snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(5), 0x00, 0x02); 373 386 #endif /* CS4231 */ … … 417 430 } 418 431 419 switch (chip->wss_base) { 420 case 0x530: 432 /* PnP resource says it decodes only 10 bits of address */ 433 switch (port & 0x3ff) { 434 case 0x130: 435 chip->wss_base = 0x530; 421 436 wss_base_bits = 0x00; 422 437 break; 423 case 0x604: 438 case 0x204: 439 chip->wss_base = 0x604; 424 440 wss_base_bits = 0x03; 425 441 break; 426 case 0xe80: 442 case 0x280: 443 chip->wss_base = 0xe80; 427 444 wss_base_bits = 0x01; 428 445 break; 429 case 0xf40: 446 case 0x340: 447 chip->wss_base = 0xf40; 430 448 wss_base_bits = 0x02; 431 449 break; 432 450 default: 433 snd_printk(KERN_WARNING "WSS port 0x%lx not valid\n", 434 chip->wss_base); 451 snd_printk(KERN_WARNING "WSS port 0x%lx not valid\n", port); 435 452 goto __skip_base; 436 453 } … … 438 455 439 456 __skip_base: 440 switch ( chip->irq) {457 switch (irq) { 441 458 //#ifdef OPTi93X 442 459 case 5: … … 457 474 break; 458 475 default: 459 snd_printk(KERN_WARNING "WSS irq # %d not valid\n", chip->irq);476 snd_printk(KERN_WARNING "WSS irq # %d not valid\n", irq); 460 477 goto __skip_resources; 461 478 } 462 479 463 switch ( chip->dma1) {480 switch (dma1) { 464 481 case 0: 465 482 dma_bits = 0x01; … … 472 489 break; 473 490 default: 474 snd_printk(KERN_WARNING "WSS dma1 # %d not valid\n", 475 chip->dma1); 491 snd_printk(KERN_WARNING "WSS dma1 # %d not valid\n", dma1); 476 492 goto __skip_resources; 477 493 } 478 494 479 495 #if defined(CS4231) || defined(OPTi93X) 480 if ( chip->dma1 == chip->dma2) {496 if (dma1 == dma2) { 481 497 snd_printk(KERN_ERR "don't want to share dmas\n"); 482 498 return -EBUSY; 483 499 } 484 500 485 switch ( chip->dma2) {501 switch (dma2) { 486 502 case 0: 487 503 case 1: 488 504 break; 489 505 default: 490 snd_printk(KERN_WARNING "WSS dma2 # %d not valid\n", 491 chip->dma2); 506 snd_printk(KERN_WARNING "WSS dma2 # %d not valid\n", dma2); 492 507 goto __skip_resources; 493 508 } … … 503 518 __skip_resources: 504 519 if (chip->hardware > OPTi9XX_HW_82C928) { 505 switch ( chip->mpu_port) {520 switch (mpu_port) { 506 521 case 0: 507 522 case -1: … … 521 536 default: 522 537 snd_printk(KERN_WARNING 523 "MPU-401 port 0x%lx not valid\n", 524 chip->mpu_port); 538 "MPU-401 port 0x%lx not valid\n", mpu_port); 525 539 goto __skip_mpu; 526 540 } 527 541 528 switch ( chip->mpu_irq) {542 switch (mpu_irq) { 529 543 case 5: 530 544 mpu_irq_bits = 0x02; … … 541 555 default: 542 556 snd_printk(KERN_WARNING "MPU-401 irq # %d not valid\n", 543 chip->mpu_irq);557 mpu_irq); 544 558 goto __skip_mpu; 545 559 } 546 560 547 561 snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(6), 548 ( chip->mpu_port <= 0) ? 0x00 :562 (mpu_port <= 0) ? 0x00 : 549 563 0x80 | mpu_port_bits << 5 | mpu_irq_bits << 3, 550 564 0xf8); … … 557 571 #ifdef OPTi93X 558 572 573 static const DECLARE_TLV_DB_SCALE(db_scale_5bit_3db_step, -9300, 300, 0); 574 static const DECLARE_TLV_DB_SCALE(db_scale_5bit, -4650, 150, 0); 575 static const DECLARE_TLV_DB_SCALE(db_scale_4bit_12db_max, -3300, 300, 0); 576 577 static struct snd_kcontrol_new snd_opti93x_controls[] = { 578 WSS_DOUBLE("Master Playback Switch", 0, 579 OPTi93X_OUT_LEFT, OPTi93X_OUT_RIGHT, 7, 7, 1, 1), 580 WSS_DOUBLE_TLV("Master Playback Volume", 0, 581 OPTi93X_OUT_LEFT, OPTi93X_OUT_RIGHT, 1, 1, 31, 1, 582 db_scale_5bit_3db_step), 583 WSS_DOUBLE_TLV("PCM Playback Volume", 0, 584 CS4231_LEFT_OUTPUT, CS4231_RIGHT_OUTPUT, 0, 0, 31, 1, 585 db_scale_5bit), 586 WSS_DOUBLE_TLV("FM Playback Volume", 0, 587 CS4231_AUX2_LEFT_INPUT, CS4231_AUX2_RIGHT_INPUT, 1, 1, 15, 1, 588 db_scale_4bit_12db_max), 589 WSS_DOUBLE("Line Playback Switch", 0, 590 CS4231_LEFT_LINE_IN, CS4231_RIGHT_LINE_IN, 7, 7, 1, 1), 591 WSS_DOUBLE_TLV("Line Playback Volume", 0, 592 CS4231_LEFT_LINE_IN, CS4231_RIGHT_LINE_IN, 0, 0, 15, 1, 593 db_scale_4bit_12db_max), 594 WSS_DOUBLE("Mic Playback Switch", 0, 595 OPTi93X_MIC_LEFT_INPUT, OPTi93X_MIC_RIGHT_INPUT, 7, 7, 1, 1), 596 WSS_DOUBLE_TLV("Mic Playback Volume", 0, 597 OPTi93X_MIC_LEFT_INPUT, OPTi93X_MIC_RIGHT_INPUT, 1, 1, 15, 1, 598 db_scale_4bit_12db_max), 599 WSS_DOUBLE_TLV("CD Playback Volume", 0, 600 CS4231_AUX1_LEFT_INPUT, CS4231_AUX1_RIGHT_INPUT, 1, 1, 15, 1, 601 db_scale_4bit_12db_max), 602 WSS_DOUBLE("Aux Playback Switch", 0, 603 OPTi931_AUX_LEFT_INPUT, OPTi931_AUX_RIGHT_INPUT, 7, 7, 1, 1), 604 WSS_DOUBLE_TLV("Aux Playback Volume", 0, 605 OPTi931_AUX_LEFT_INPUT, OPTi931_AUX_RIGHT_INPUT, 1, 1, 15, 1, 606 db_scale_4bit_12db_max), 607 }; 608 609 static int __devinit snd_opti93x_mixer(struct snd_wss *chip) 610 { 611 struct snd_card *card; 612 unsigned int idx; 613 struct snd_ctl_elem_id id1, id2; 614 int err; 615 616 if (snd_BUG_ON(!chip || !chip->pcm)) 617 return -EINVAL; 618 619 card = chip->card; 620 621 strcpy(card->mixername, chip->pcm->name); 622 623 memset(&id1, 0, sizeof(id1)); 624 memset(&id2, 0, sizeof(id2)); 625 id1.iface = id2.iface = SNDRV_CTL_ELEM_IFACE_MIXER; 626 /* reassign AUX0 switch to CD */ 627 strcpy(id1.name, "Aux Playback Switch"); 628 strcpy(id2.name, "CD Playback Switch"); 629 err = snd_ctl_rename_id(card, &id1, &id2); 630 if (err < 0) { 631 snd_printk(KERN_ERR "Cannot rename opti93x control\n"); 632 return err; 633 } 634 /* reassign AUX1 switch to FM */ 635 strcpy(id1.name, "Aux Playback Switch"); id1.index = 1; 636 strcpy(id2.name, "FM Playback Switch"); 637 err = snd_ctl_rename_id(card, &id1, &id2); 638 if (err < 0) { 639 snd_printk(KERN_ERR "Cannot rename opti93x control\n"); 640 return err; 641 } 642 /* remove AUX1 volume */ 643 strcpy(id1.name, "Aux Playback Volume"); id1.index = 1; 644 snd_ctl_remove_id(card, &id1); 645 646 /* Replace WSS volume controls with OPTi93x volume controls */ 647 id1.index = 0; 648 for (idx = 0; idx < ARRAY_SIZE(snd_opti93x_controls); idx++) { 649 strcpy(id1.name, snd_opti93x_controls[idx].name); 650 snd_ctl_remove_id(card, &id1); 651 652 err = snd_ctl_add(card, 653 snd_ctl_new1(&snd_opti93x_controls[idx], chip)); 654 if (err < 0) 655 return err; 656 } 657 return 0; 658 } 659 559 660 static irqreturn_t snd_opti93x_interrupt(int irq, void *dev_id) 560 661 { 561 struct snd_ wss *codec= dev_id;562 struct snd_ opti9xx *chip = codec->card->private_data;662 struct snd_opti9xx *chip = dev_id; 663 struct snd_wss *codec = chip->codec; 563 664 unsigned char status; 665 666 if (!codec) 667 return IRQ_HANDLED; 564 668 565 669 status = snd_opti9xx_read(chip, OPTi9XX_MC_REG(11)); … … 576 680 #endif /* OPTi93X */ 577 681 682 static int __devinit snd_opti9xx_read_check(struct snd_opti9xx *chip) 683 { 684 unsigned char value; 685 #ifdef OPTi93X 686 unsigned long flags; 687 #endif 688 689 chip->res_mc_base = request_region(chip->mc_base, chip->mc_base_size, 690 "OPTi9xx MC"); 691 if (chip->res_mc_base == NULL) 692 return -EBUSY; 693 #ifndef OPTi93X 694 value = snd_opti9xx_read(chip, OPTi9XX_MC_REG(1)); 695 if (value != 0xff && value != inb(chip->mc_base + OPTi9XX_MC_REG(1))) 696 if (value == snd_opti9xx_read(chip, OPTi9XX_MC_REG(1))) 697 return 0; 698 #else /* OPTi93X */ 699 chip->res_mc_indir = request_region(chip->mc_indir_index, 700 chip->mc_indir_size, 701 "OPTi93x MC"); 702 if (chip->res_mc_indir == NULL) 703 return -EBUSY; 704 705 spin_lock_irqsave(&chip->lock, flags); 706 outb(chip->password, chip->mc_base + chip->pwd_reg); 707 outb(((chip->mc_indir_index & 0x1f0) >> 4), chip->mc_base); 708 spin_unlock_irqrestore(&chip->lock, flags); 709 710 value = snd_opti9xx_read(chip, OPTi9XX_MC_REG(7)); 711 snd_opti9xx_write(chip, OPTi9XX_MC_REG(7), 0xff - value); 712 if (snd_opti9xx_read(chip, OPTi9XX_MC_REG(7)) == 0xff - value) 713 return 0; 714 715 release_and_free_resource(chip->res_mc_indir); 716 chip->res_mc_indir = NULL; 717 #endif /* OPTi93X */ 718 release_and_free_resource(chip->res_mc_base); 719 chip->res_mc_base = NULL; 720 721 return -ENODEV; 722 } 723 578 724 static int __devinit snd_card_opti9xx_detect(struct snd_card *card, 579 725 struct snd_opti9xx *chip) … … 583 729 #ifndef OPTi93X 584 730 for (i = OPTi9XX_HW_82C928; i < OPTi9XX_HW_82C930; i++) { 585 unsigned char value; 586 587 if ((err = snd_opti9xx_init(chip, i)) < 0) 731 #else 732 for (i = OPTi9XX_HW_82C931; i >= OPTi9XX_HW_82C930; i--) { 733 #endif 734 err = snd_opti9xx_init(chip, i); 735 if (err < 0) 588 736 return err; 589 737 590 if ((chip->res_mc_base = request_region(chip->mc_base, chip->mc_base_size, "OPTi9xx MC")) == NULL) 591 continue; 592 593 value = snd_opti9xx_read(chip, OPTi9XX_MC_REG(1)); 594 if ((value != 0xff) && (value != inb(chip->mc_base + 1))) 595 if (value == snd_opti9xx_read(chip, OPTi9XX_MC_REG(1))) 596 return 1; 597 598 release_and_free_resource(chip->res_mc_base); 599 chip->res_mc_base = NULL; 600 601 } 602 #else /* OPTi93X */ 603 for (i = OPTi9XX_HW_82C931; i >= OPTi9XX_HW_82C930; i--) { 604 unsigned long flags; 605 unsigned char value; 606 607 if ((err = snd_opti9xx_init(chip, i)) < 0) 608 return err; 609 610 if ((chip->res_mc_base = request_region(chip->mc_base, chip->mc_base_size, "OPTi9xx MC")) == NULL) 611 continue; 612 613 spin_lock_irqsave(&chip->lock, flags); 614 outb(chip->password, chip->mc_base + chip->pwd_reg); 615 outb(((chip->mc_indir_index & (1 << 8)) >> 4) | 616 ((chip->mc_indir_index & 0xf0) >> 4), chip->mc_base); 617 spin_unlock_irqrestore(&chip->lock, flags); 618 619 value = snd_opti9xx_read(chip, OPTi9XX_MC_REG(7)); 620 snd_opti9xx_write(chip, OPTi9XX_MC_REG(7), 0xff - value); 621 if (snd_opti9xx_read(chip, OPTi9XX_MC_REG(7)) == 0xff - value) 738 err = snd_opti9xx_read_check(chip); 739 if (err == 0) 622 740 return 1; 623 624 release_and_free_resource(chip->res_mc_base); 625 chip->res_mc_base = NULL; 626 } 627 #endif /* OPTi93X */ 628 741 #ifdef OPTi93X 742 chip->mc_indir_index = 0; 743 #endif 744 } 629 745 return -ENODEV; 630 746 } … … 637 753 struct pnp_dev *pdev; 638 754 int err; 639 640 chip->dev = pnp_request_card_device(card, pid->devs[0].id, NULL); 641 if (chip->dev == NULL) 755 struct pnp_dev *devmpu; 756 #ifndef OPTi93X 757 struct pnp_dev *devmc; 758 #endif 759 760 pdev = pnp_request_card_device(card, pid->devs[0].id, NULL); 761 if (pdev == NULL) 642 762 return -EBUSY; 643 644 chip->devmpu = pnp_request_card_device(card, pid->devs[1].id, NULL);645 646 pdev = chip->dev;647 763 648 764 err = pnp_activate_dev(pdev); … … 655 771 port = pnp_port_start(pdev, 0) - 4; 656 772 fm_port = pnp_port_start(pdev, 1) + 8; 773 chip->mc_indir_index = pnp_port_start(pdev, 3) + 2; 774 chip->mc_indir_size = pnp_port_len(pdev, 3) - 2; 657 775 #else 658 if (pid->driver_data != 0x0924) 659 port = pnp_port_start(pdev, 1); 776 devmc = pnp_request_card_device(card, pid->devs[2].id, NULL); 777 if (devmc == NULL) 778 return -EBUSY; 779 780 err = pnp_activate_dev(devmc); 781 if (err < 0) { 782 snd_printk(KERN_ERR "MC pnp configure failure: %d\n", err); 783 return err; 784 } 785 786 port = pnp_port_start(pdev, 1); 660 787 fm_port = pnp_port_start(pdev, 2) + 8; 788 /* 789 * The MC(0) is never accessed and card does not 790 * include it in the PnP resource range. OPTI93x include it. 791 */ 792 chip->mc_base = pnp_port_start(devmc, 0) - 1; 793 chip->mc_base_size = pnp_port_len(devmc, 0) + 1; 661 794 #endif /* OPTi93X */ 662 795 irq = pnp_irq(pdev, 0); … … 666 799 #endif /* CS4231 || OPTi93X */ 667 800 668 pdev = chip->devmpu; 669 if (pdev && mpu_port > 0) { 670 err = pnp_activate_dev(pdev); 801 devmpu = pnp_request_card_device(card, pid->devs[1].id, NULL); 802 803 if (devmpu && mpu_port > 0) { 804 err = pnp_activate_dev(devmpu); 671 805 if (err < 0) { 672 snd_printk(KERN_ERR " AUDIOpnp configure failure\n");806 snd_printk(KERN_ERR "MPU401 pnp configure failure\n"); 673 807 mpu_port = -1; 674 chip->devmpu = NULL;675 808 } else { 676 mpu_port = pnp_port_start( pdev, 0);677 mpu_irq = pnp_irq( pdev, 0);809 mpu_port = pnp_port_start(devmpu, 0); 810 mpu_irq = pnp_irq(devmpu, 0); 678 811 } 679 812 } … … 685 818 { 686 819 struct snd_opti9xx *chip = card->private_data; 687 820 688 821 if (chip) { 689 822 #ifdef OPTi93X 690 struct snd_wss *codec = chip->codec;691 if (codec && codec->irq > 0) {692 disable_irq(codec->irq);693 free_irq(codec->irq, codec);694 }823 if (chip->irq > 0) { 824 disable_irq(chip->irq); 825 free_irq(chip->irq, chip); 826 } 827 release_and_free_resource(chip->res_mc_indir); 695 828 #endif 696 829 release_and_free_resource(chip->res_mc_base); … … 702 835 static long possible_ports[] = {0x530, 0xe80, 0xf40, 0x604, -1}; 703 836 int error; 837 int xdma2; 704 838 struct snd_opti9xx *chip = card->private_data; 705 839 struct snd_wss *codec; … … 711 845 struct snd_hwdep *synth; 712 846 713 if (! chip->res_mc_base &&714 (chip->res_mc_base = request_region(chip->mc_base, chip->mc_base_size,715 "OPTi9xx MC")) == NULL)716 return -ENOMEM;717 718 chip->wss_base = port;719 chip->fm_port = fm_port;720 chip->mpu_port = mpu_port;721 chip->irq = irq;722 chip->mpu_irq = mpu_irq;723 chip->dma1 = dma1;724 847 #if defined(CS4231) || defined(OPTi93X) 725 chip->dma2 = dma2;848 xdma2 = dma2; 726 849 #else 727 chip->dma2 = -1;728 #endif 729 730 if ( chip->wss_base== SNDRV_AUTO_PORT) {731 chip->wss_base= snd_legacy_find_free_ioport(possible_ports, 4);732 if ( chip->wss_base< 0) {850 xdma2 = -1; 851 #endif 852 853 if (port == SNDRV_AUTO_PORT) { 854 port = snd_legacy_find_free_ioport(possible_ports, 4); 855 if (port < 0) { 733 856 snd_printk(KERN_ERR "unable to find a free WSS port\n"); 734 857 return -EBUSY; 735 858 } 736 859 } 737 error = snd_opti9xx_configure(chip); 860 error = snd_opti9xx_configure(chip, port, irq, dma1, xdma2, 861 mpu_port, mpu_irq); 738 862 if (error) 739 863 return error; 740 864 741 error = snd_wss_create(card, chip->wss_base + 4, -1, 742 chip->irq, chip->dma1, chip->dma2, 865 error = snd_wss_create(card, chip->wss_base + 4, -1, irq, dma1, xdma2, 743 866 #ifdef OPTi93X 744 867 WSS_HW_OPTI93X, WSS_HWSHARE_IRQ, … … 758 881 if (error < 0) 759 882 return error; 883 #ifdef OPTi93X 884 error = snd_opti93x_mixer(codec); 885 if (error < 0) 886 return error; 887 #endif 760 888 #ifdef CS4231 761 889 error = snd_wss_timer(codec, 0, &timer); … … 764 892 #endif 765 893 #ifdef OPTi93X 766 error = request_irq( chip->irq, snd_opti93x_interrupt,767 IRQF_DISABLED, DEV_NAME" - WSS", c odec);894 error = request_irq(irq, snd_opti93x_interrupt, 895 IRQF_DISABLED, DEV_NAME" - WSS", chip); 768 896 if (error < 0) { 769 snd_printk(KERN_ERR "opti9xx: can't grab IRQ %d\n", chip->irq); 770 return error; 771 } 772 #endif 897 snd_printk(KERN_ERR "opti9xx: can't grab IRQ %d\n", irq); 898 return error; 899 } 900 #endif 901 chip->irq = irq; 773 902 strcpy(card->driver, chip->name); 774 903 sprintf(card->shortname, "OPTi %s", card->driver); 775 904 #if defined(CS4231) || defined(OPTi93X) 776 905 sprintf(card->longname, "%s, %s at 0x%lx, irq %d, dma %d&%d", 777 card->shortname, pcm->name, chip->wss_base + 4,778 chip-> irq, chip->dma1, chip->dma2);906 card->shortname, pcm->name, 907 chip->wss_base + 4, irq, dma1, xdma2); 779 908 #else 780 909 sprintf(card->longname, "%s, %s at 0x%lx, irq %d, dma %d", 781 card->shortname, pcm->name, chip->wss_base + 4, 782 chip->irq, chip->dma1); 910 card->shortname, pcm->name, chip->wss_base + 4, irq, dma1); 783 911 #endif /* CS4231 || OPTi93X */ 784 912 785 if ( chip->mpu_port <= 0 || chip->mpu_port == SNDRV_AUTO_PORT)913 if (mpu_port <= 0 || mpu_port == SNDRV_AUTO_PORT) 786 914 rmidi = NULL; 787 else 788 if ((error = snd_mpu401_uart_new(card, 0, MPU401_HW_MPU401,789 chip->mpu_port, 0, chip->mpu_irq, IRQF_DISABLED,790 &rmidi)))915 else { 916 error = snd_mpu401_uart_new(card, 0, MPU401_HW_MPU401, 917 mpu_port, 0, mpu_irq, IRQF_DISABLED, &rmidi); 918 if (error) 791 919 snd_printk(KERN_WARNING "no MPU-401 device at 0x%lx?\n", 792 chip->mpu_port); 793 794 if (chip->fm_port > 0 && chip->fm_port != SNDRV_AUTO_PORT) { 920 mpu_port); 921 } 922 923 if (fm_port > 0 && fm_port != SNDRV_AUTO_PORT) { 795 924 struct snd_opl3 *opl3 = NULL; 796 925 #ifndef OPTi93X … … 802 931 snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(2), 803 932 0x20, 0x20); 804 if (snd_opl4_create(card, 805 chip->fm_port, 806 chip->fm_port - 8, 933 if (snd_opl4_create(card, fm_port, fm_port - 8, 807 934 2, &opl3, &opl4) < 0) { 808 935 /* no luck, use OPL3 instead */ … … 812 939 } 813 940 #endif /* !OPTi93X */ 814 if (!opl3 && snd_opl3_create(card, 815 chip->fm_port, 816 chip->fm_port + 2, 941 if (!opl3 && snd_opl3_create(card, fm_port, fm_port + 2, 817 942 OPL3_HW_AUTO, 0, &opl3) < 0) { 818 943 snd_printk(KERN_WARNING "no OPL device at 0x%lx-0x%lx\n", 819 chip->fm_port, chip->fm_port + 4 - 1);944 fm_port, fm_port + 4 - 1); 820 945 } 821 946 if (opl3) { … … 977 1102 return error; 978 1103 } 979 if (hw <= OPTi9XX_HW_82C930) 980 chip->mc_base -= 0x80; 1104 error = snd_opti9xx_read_check(chip); 1105 if (error) { 1106 snd_printk(KERN_ERR "OPTI chip not found\n"); 1107 snd_card_free(card); 1108 return error; 1109 } 981 1110 snd_card_set_dev(card, &pcard->card->dev); 982 1111 if ((error = snd_opti9xx_probe(card)) < 0) { -
GPL/trunk/alsa-kernel/isa/sb/emu8000.c
r399 r598 378 378 size_dram(struct snd_emu8000 *emu) 379 379 { 380 int i, size ;380 int i, size, detected_size; 381 381 382 382 if (emu->dram_checked) … … 384 384 385 385 size = 0; 386 detected_size = 0; 386 387 387 388 /* write out a magic number */ … … 415 416 EMU8000_SMLD_READ(emu); /* discard stale data */ 416 417 if (EMU8000_SMLD_READ(emu) != UNIQUE_ID2) 417 break; /* we must have wrapped around */ 418 break; /* no memory at this address */ 419 420 detected_size = size; 418 421 419 422 snd_emu8000_read_wait(emu); … … 443 446 444 447 snd_printdd("EMU8000 [0x%lx]: %d Kb on-board memory detected\n", 445 emu->port1, size/1024);446 447 emu->mem_size = size;448 emu->port1, detected_size/1024); 449 450 emu->mem_size = detected_size; 448 451 emu->dram_checked = 1; 449 452 } -
GPL/trunk/alsa-kernel/isa/sb/sb16.c
r410 r598 22 22 #include <asm/dma.h> 23 23 #include <linux/init.h> 24 #include <linux/slab.h>25 24 #include <linux/pnp.h> 26 25 #include <linux/err.h> -
GPL/trunk/alsa-kernel/isa/sb/sb8.c
r410 r598 23 23 #include <linux/err.h> 24 24 #include <linux/isa.h> 25 #include <linux/slab.h>26 25 #include <linux/ioport.h> 27 26 #include <linux/moduleparam.h> … … 74 73 static void snd_sb8_free(struct snd_card *card) 75 74 { 76 struct snd_sb8 *acard = (struct snd_sb8 *)card->private_data;75 struct snd_sb8 *acard = card->private_data; 77 76 78 77 if (acard == NULL) -
GPL/trunk/alsa-kernel/isa/sb/sb8_main.c
r399 r598 107 107 struct snd_pcm_runtime *runtime = substream->runtime; 108 108 unsigned int mixreg, rate, size, count; 109 unsigned char format; 110 unsigned char stereo = runtime->channels > 1; 111 int dma; 109 112 110 113 rate = runtime->rate; 111 114 switch (chip->hardware) { 115 case SB_HW_JAZZ16: 116 if (runtime->format == SNDRV_PCM_FORMAT_S16_LE) { 117 if (chip->mode & SB_MODE_CAPTURE_16) 118 return -EBUSY; 119 else 120 chip->mode |= SB_MODE_PLAYBACK_16; 121 } 122 chip->playback_format = SB_DSP_LO_OUTPUT_AUTO; 123 break; 112 124 case SB_HW_PRO: 113 125 if (runtime->channels > 1) { … … 134 146 return -EINVAL; 135 147 } 148 if (chip->mode & SB_MODE_PLAYBACK_16) { 149 format = stereo ? SB_DSP_STEREO_16BIT : SB_DSP_MONO_16BIT; 150 dma = chip->dma16; 151 } else { 152 format = stereo ? SB_DSP_STEREO_8BIT : SB_DSP_MONO_8BIT; 153 chip->mode |= SB_MODE_PLAYBACK_8; 154 dma = chip->dma8; 155 } 136 156 size = chip->p_dma_size = snd_pcm_lib_buffer_bytes(substream); 137 157 count = chip->p_period_size = snd_pcm_lib_period_bytes(substream); 138 158 spin_lock_irqsave(&chip->reg_lock, flags); 139 159 snd_sbdsp_command(chip, SB_DSP_SPEAKER_ON); 140 if (runtime->channels > 1) { 160 if (chip->hardware == SB_HW_JAZZ16) 161 snd_sbdsp_command(chip, format); 162 else if (stereo) { 141 163 /* set playback stereo mode */ 142 164 spin_lock(&chip->mixer_lock); … … 148 170 snd_sbdsp_command(chip, SB_DSP_DMA8_EXIT); 149 171 runtime->dma_area[0] = 0x80; 150 snd_dma_program( chip->dma8, runtime->dma_addr, 1, DMA_MODE_WRITE);172 snd_dma_program(dma, runtime->dma_addr, 1, DMA_MODE_WRITE); 151 173 /* force interrupt */ 152 chip->mode = SB_MODE_HALT;153 174 snd_sbdsp_command(chip, SB_DSP_OUTPUT); 154 175 snd_sbdsp_command(chip, 0); … … 156 177 } 157 178 snd_sbdsp_command(chip, SB_DSP_SAMPLE_RATE); 158 if ( runtime->channels > 1) {179 if (stereo) { 159 180 snd_sbdsp_command(chip, 256 - runtime->rate_den / 2); 160 181 spin_lock(&chip->mixer_lock); … … 169 190 } 170 191 if (chip->playback_format != SB_DSP_OUTPUT) { 192 if (chip->mode & SB_MODE_PLAYBACK_16) 193 count /= 2; 171 194 count--; 172 195 snd_sbdsp_command(chip, SB_DSP_BLOCK_SIZE); … … 175 198 } 176 199 spin_unlock_irqrestore(&chip->reg_lock, flags); 177 snd_dma_program( chip->dma8, runtime->dma_addr,200 snd_dma_program(dma, runtime->dma_addr, 178 201 size, DMA_MODE_WRITE | DMA_AUTOINIT); 179 202 return 0; … … 213 236 } 214 237 spin_unlock_irqrestore(&chip->reg_lock, flags); 215 chip->mode = (cmd == SNDRV_PCM_TRIGGER_START) ? SB_MODE_PLAYBACK_8 : SB_MODE_HALT;216 238 return 0; 217 239 } … … 235 257 struct snd_pcm_runtime *runtime = substream->runtime; 236 258 unsigned int mixreg, rate, size, count; 259 unsigned char format; 260 unsigned char stereo = runtime->channels > 1; 261 int dma; 237 262 238 263 rate = runtime->rate; 239 264 switch (chip->hardware) { 265 case SB_HW_JAZZ16: 266 if (runtime->format == SNDRV_PCM_FORMAT_S16_LE) { 267 if (chip->mode & SB_MODE_PLAYBACK_16) 268 return -EBUSY; 269 else 270 chip->mode |= SB_MODE_CAPTURE_16; 271 } 272 chip->capture_format = SB_DSP_LO_INPUT_AUTO; 273 break; 240 274 case SB_HW_PRO: 241 275 if (runtime->channels > 1) { … … 263 297 return -EINVAL; 264 298 } 299 if (chip->mode & SB_MODE_CAPTURE_16) { 300 format = stereo ? SB_DSP_STEREO_16BIT : SB_DSP_MONO_16BIT; 301 dma = chip->dma16; 302 } else { 303 format = stereo ? SB_DSP_STEREO_8BIT : SB_DSP_MONO_8BIT; 304 chip->mode |= SB_MODE_CAPTURE_8; 305 dma = chip->dma8; 306 } 265 307 size = chip->c_dma_size = snd_pcm_lib_buffer_bytes(substream); 266 308 count = chip->c_period_size = snd_pcm_lib_period_bytes(substream); 267 309 spin_lock_irqsave(&chip->reg_lock, flags); 268 310 snd_sbdsp_command(chip, SB_DSP_SPEAKER_OFF); 269 if (runtime->channels > 1) 311 if (chip->hardware == SB_HW_JAZZ16) 312 snd_sbdsp_command(chip, format); 313 else if (stereo) 270 314 snd_sbdsp_command(chip, SB_DSP_STEREO_8BIT); 271 315 snd_sbdsp_command(chip, SB_DSP_SAMPLE_RATE); 272 if ( runtime->channels > 1) {316 if (stereo) { 273 317 snd_sbdsp_command(chip, 256 - runtime->rate_den / 2); 274 318 spin_lock(&chip->mixer_lock); … … 283 327 } 284 328 if (chip->capture_format != SB_DSP_INPUT) { 329 if (chip->mode & SB_MODE_PLAYBACK_16) 330 count /= 2; 285 331 count--; 286 332 snd_sbdsp_command(chip, SB_DSP_BLOCK_SIZE); … … 289 335 } 290 336 spin_unlock_irqrestore(&chip->reg_lock, flags); 291 snd_dma_program( chip->dma8, runtime->dma_addr,337 snd_dma_program(dma, runtime->dma_addr, 292 338 size, DMA_MODE_READ | DMA_AUTOINIT); 293 339 return 0; … … 329 375 } 330 376 spin_unlock_irqrestore(&chip->reg_lock, flags); 331 chip->mode = (cmd == SNDRV_PCM_TRIGGER_START) ? SB_MODE_CAPTURE_8 : SB_MODE_HALT;332 377 return 0; 333 378 } … … 340 385 snd_sb_ack_8bit(chip); 341 386 switch (chip->mode) { 342 case SB_MODE_PLAYBACK_8: /* ok.. playback is active */ 387 case SB_MODE_PLAYBACK_16: /* ok.. playback is active */ 388 if (chip->hardware != SB_HW_JAZZ16) 389 break; 390 /* fallthru */ 391 case SB_MODE_PLAYBACK_8: 343 392 substream = chip->playback_substream; 344 393 runtime = substream->runtime; … … 347 396 snd_pcm_period_elapsed(substream); 348 397 break; 398 case SB_MODE_CAPTURE_16: 399 if (chip->hardware != SB_HW_JAZZ16) 400 break; 401 /* fallthru */ 349 402 case SB_MODE_CAPTURE_8: 350 403 substream = chip->capture_substream; … … 362 415 struct snd_sb *chip = snd_pcm_substream_chip(substream); 363 416 size_t ptr; 364 365 if (chip->mode != SB_MODE_PLAYBACK_8) 417 int dma; 418 419 if (chip->mode & SB_MODE_PLAYBACK_8) 420 dma = chip->dma8; 421 else if (chip->mode & SB_MODE_PLAYBACK_16) 422 dma = chip->dma16; 423 else 366 424 return 0; 367 ptr = snd_dma_pointer( chip->dma8, chip->p_dma_size);425 ptr = snd_dma_pointer(dma, chip->p_dma_size); 368 426 return bytes_to_frames(substream->runtime, ptr); 369 427 } … … 373 431 struct snd_sb *chip = snd_pcm_substream_chip(substream); 374 432 size_t ptr; 375 376 if (chip->mode != SB_MODE_CAPTURE_8) 433 int dma; 434 435 if (chip->mode & SB_MODE_CAPTURE_8) 436 dma = chip->dma8; 437 else if (chip->mode & SB_MODE_CAPTURE_16) 438 dma = chip->dma16; 439 else 377 440 return 0; 378 ptr = snd_dma_pointer( chip->dma8, chip->c_dma_size);441 ptr = snd_dma_pointer(dma, chip->c_dma_size); 379 442 return bytes_to_frames(substream->runtime, ptr); 380 443 } … … 447 510 } 448 511 switch (chip->hardware) { 512 case SB_HW_JAZZ16: 513 if (chip->dma16 == 5 || chip->dma16 == 7) 514 runtime->hw.formats |= SNDRV_PCM_FMTBIT_S16_LE; 515 runtime->hw.rates |= SNDRV_PCM_RATE_8000_48000; 516 runtime->hw.rate_min = 4000; 517 runtime->hw.rate_max = 50000; 518 runtime->hw.channels_max = 2; 519 break; 449 520 case SB_HW_PRO: 450 521 runtime->hw.rate_max = 44100; … … 469 540 snd_pcm_hw_constraint_ratnums(runtime, 0, SNDRV_PCM_HW_PARAM_RATE, 470 541 &hw_constraints_clock); 542 if (chip->dma8 > 3 || chip->dma16 >= 0) { 543 snd_pcm_hw_constraint_step(runtime, 0, 544 SNDRV_PCM_HW_PARAM_BUFFER_BYTES, 2); 545 snd_pcm_hw_constraint_step(runtime, 0, 546 SNDRV_PCM_HW_PARAM_PERIOD_BYTES, 2); 547 runtime->hw.buffer_bytes_max = 128 * 1024 * 1024; 548 runtime->hw.period_bytes_max = 128 * 1024 * 1024; 549 } 471 550 return 0; 472 551 } … … 481 560 spin_lock_irqsave(&chip->open_lock, flags); 482 561 chip->open &= ~SB_OPEN_PCM; 562 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) 563 chip->mode &= ~SB_MODE_PLAYBACK; 564 else 565 chip->mode &= ~SB_MODE_CAPTURE; 483 566 spin_unlock_irqrestore(&chip->open_lock, flags); 484 567 return 0; … … 516 599 struct snd_pcm *pcm; 517 600 int err; 601 size_t max_prealloc = 64 * 1024; 518 602 519 603 if (rpcm) … … 528 612 snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_sb8_capture_ops); 529 613 614 if (chip->dma8 > 3 || chip->dma16 >= 0) 615 max_prealloc = 128 * 1024; 530 616 snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, 531 617 snd_dma_isa_data(), 532 64*1024, 64*1024);618 64*1024, max_prealloc); 533 619 534 620 if (rpcm) -
GPL/trunk/alsa-kernel/isa/sb/sb_common.c
r399 r598 171 171 str = "16 (CS5530)"; 172 172 break; 173 case SB_HW_JAZZ16: 174 str = "Pro (Jazz16)"; 175 break; 173 176 default: 174 177 return -ENODEV; -
GPL/trunk/alsa-kernel/isa/sb/sb_mixer.c
r426 r598 529 529 */ 530 530 531 static struct sbmix_elem snd_sb20_ctl_master_play_vol = 532 SB_SINGLE("Master Playback Volume", SB_DSP20_MASTER_DEV, 1, 7); 533 static struct sbmix_elem snd_sb20_ctl_pcm_play_vol = 534 SB_SINGLE("PCM Playback Volume", SB_DSP20_PCM_DEV, 1, 3); 535 static struct sbmix_elem snd_sb20_ctl_synth_play_vol = 536 SB_SINGLE("Synth Playback Volume", SB_DSP20_FM_DEV, 1, 7); 537 static struct sbmix_elem snd_sb20_ctl_cd_play_vol = 538 SB_SINGLE("CD Playback Volume", SB_DSP20_CD_DEV, 1, 7); 539 540 static struct sbmix_elem *snd_sb20_controls[] = { 541 &snd_sb20_ctl_master_play_vol, 542 &snd_sb20_ctl_pcm_play_vol, 543 &snd_sb20_ctl_synth_play_vol, 544 &snd_sb20_ctl_cd_play_vol 531 static struct sbmix_elem snd_sb20_controls[] = { 532 SB_SINGLE("Master Playback Volume", SB_DSP20_MASTER_DEV, 1, 7), 533 SB_SINGLE("PCM Playback Volume", SB_DSP20_PCM_DEV, 1, 3), 534 SB_SINGLE("Synth Playback Volume", SB_DSP20_FM_DEV, 1, 7), 535 SB_SINGLE("CD Playback Volume", SB_DSP20_CD_DEV, 1, 7) 545 536 }; 546 537 … … 553 544 * SB Pro specific mixer elements 554 545 */ 555 static struct sbmix_elem snd_sbpro_ctl_master_play_vol = 556 SB_DOUBLE("Master Playback Volume", SB_DSP_MASTER_DEV, SB_DSP_MASTER_DEV, 5, 1, 7); 557 static struct sbmix_elem snd_sbpro_ctl_pcm_play_vol = 558 SB_DOUBLE("PCM Playback Volume", SB_DSP_PCM_DEV, SB_DSP_PCM_DEV, 5, 1, 7); 559 static struct sbmix_elem snd_sbpro_ctl_pcm_play_filter = 560 SB_SINGLE("PCM Playback Filter", SB_DSP_PLAYBACK_FILT, 5, 1); 561 static struct sbmix_elem snd_sbpro_ctl_synth_play_vol = 562 SB_DOUBLE("Synth Playback Volume", SB_DSP_FM_DEV, SB_DSP_FM_DEV, 5, 1, 7); 563 static struct sbmix_elem snd_sbpro_ctl_cd_play_vol = 564 SB_DOUBLE("CD Playback Volume", SB_DSP_CD_DEV, SB_DSP_CD_DEV, 5, 1, 7); 565 static struct sbmix_elem snd_sbpro_ctl_line_play_vol = 566 SB_DOUBLE("Line Playback Volume", SB_DSP_LINE_DEV, SB_DSP_LINE_DEV, 5, 1, 7); 567 static struct sbmix_elem snd_sbpro_ctl_mic_play_vol = 568 SB_SINGLE("Mic Playback Volume", SB_DSP_MIC_DEV, 1, 3); 569 static struct sbmix_elem snd_sbpro_ctl_capture_source = 546 static struct sbmix_elem snd_sbpro_controls[] = { 547 SB_DOUBLE("Master Playback Volume", 548 SB_DSP_MASTER_DEV, SB_DSP_MASTER_DEV, 5, 1, 7), 549 SB_DOUBLE("PCM Playback Volume", 550 SB_DSP_PCM_DEV, SB_DSP_PCM_DEV, 5, 1, 7), 551 SB_SINGLE("PCM Playback Filter", SB_DSP_PLAYBACK_FILT, 5, 1), 552 SB_DOUBLE("Synth Playback Volume", 553 SB_DSP_FM_DEV, SB_DSP_FM_DEV, 5, 1, 7), 554 SB_DOUBLE("CD Playback Volume", SB_DSP_CD_DEV, SB_DSP_CD_DEV, 5, 1, 7), 555 SB_DOUBLE("Line Playback Volume", 556 SB_DSP_LINE_DEV, SB_DSP_LINE_DEV, 5, 1, 7), 557 SB_SINGLE("Mic Playback Volume", SB_DSP_MIC_DEV, 1, 3), 570 558 { 571 559 .name = "Capture Source", 572 560 .type = SB_MIX_CAPTURE_PRO 573 }; 574 static struct sbmix_elem snd_sbpro_ctl_capture_filter = 575 SB_SINGLE("Capture Filter", SB_DSP_CAPTURE_FILT, 5, 1); 576 static struct sbmix_elem snd_sbpro_ctl_capture_low_filter = 577 SB_SINGLE("Capture Low-Pass Filter", SB_DSP_CAPTURE_FILT, 3, 1); 578 579 static struct sbmix_elem *snd_sbpro_controls[] = { 580 &snd_sbpro_ctl_master_play_vol, 581 &snd_sbpro_ctl_pcm_play_vol, 582 &snd_sbpro_ctl_pcm_play_filter, 583 &snd_sbpro_ctl_synth_play_vol, 584 &snd_sbpro_ctl_cd_play_vol, 585 &snd_sbpro_ctl_line_play_vol, 586 &snd_sbpro_ctl_mic_play_vol, 587 &snd_sbpro_ctl_capture_source, 588 &snd_sbpro_ctl_capture_filter, 589 &snd_sbpro_ctl_capture_low_filter 561 }, 562 SB_SINGLE("Capture Filter", SB_DSP_CAPTURE_FILT, 5, 1), 563 SB_SINGLE("Capture Low-Pass Filter", SB_DSP_CAPTURE_FILT, 3, 1) 590 564 }; 591 565 … … 599 573 * SB16 specific mixer elements 600 574 */ 601 static struct sbmix_elem snd_sb16_ctl_master_play_vol = 602 SB_DOUBLE("Master Playback Volume", SB_DSP4_MASTER_DEV, (SB_DSP4_MASTER_DEV + 1), 3, 3, 31); 603 static struct sbmix_elem snd_sb16_ctl_3d_enhance_switch = 604 SB_SINGLE("3D Enhancement Switch", SB_DSP4_3DSE, 0, 1); 605 static struct sbmix_elem snd_sb16_ctl_tone_bass = 606 SB_DOUBLE("Tone Control - Bass", SB_DSP4_BASS_DEV, (SB_DSP4_BASS_DEV + 1), 4, 4, 15); 607 static struct sbmix_elem snd_sb16_ctl_tone_treble = 608 SB_DOUBLE("Tone Control - Treble", SB_DSP4_TREBLE_DEV, (SB_DSP4_TREBLE_DEV + 1), 4, 4, 15); 609 static struct sbmix_elem snd_sb16_ctl_pcm_play_vol = 610 SB_DOUBLE("PCM Playback Volume", SB_DSP4_PCM_DEV, (SB_DSP4_PCM_DEV + 1), 3, 3, 31); 611 static struct sbmix_elem snd_sb16_ctl_synth_capture_route = 612 SB16_INPUT_SW("Synth Capture Route", SB_DSP4_INPUT_LEFT, SB_DSP4_INPUT_RIGHT, 6, 5); 613 static struct sbmix_elem snd_sb16_ctl_synth_play_vol = 614 SB_DOUBLE("Synth Playback Volume", SB_DSP4_SYNTH_DEV, (SB_DSP4_SYNTH_DEV + 1), 3, 3, 31); 615 static struct sbmix_elem snd_sb16_ctl_cd_capture_route = 616 SB16_INPUT_SW("CD Capture Route", SB_DSP4_INPUT_LEFT, SB_DSP4_INPUT_RIGHT, 2, 1); 617 static struct sbmix_elem snd_sb16_ctl_cd_play_switch = 618 SB_DOUBLE("CD Playback Switch", SB_DSP4_OUTPUT_SW, SB_DSP4_OUTPUT_SW, 2, 1, 1); 619 static struct sbmix_elem snd_sb16_ctl_cd_play_vol = 620 SB_DOUBLE("CD Playback Volume", SB_DSP4_CD_DEV, (SB_DSP4_CD_DEV + 1), 3, 3, 31); 621 static struct sbmix_elem snd_sb16_ctl_line_capture_route = 622 SB16_INPUT_SW("Line Capture Route", SB_DSP4_INPUT_LEFT, SB_DSP4_INPUT_RIGHT, 4, 3); 623 static struct sbmix_elem snd_sb16_ctl_line_play_switch = 624 SB_DOUBLE("Line Playback Switch", SB_DSP4_OUTPUT_SW, SB_DSP4_OUTPUT_SW, 4, 3, 1); 625 static struct sbmix_elem snd_sb16_ctl_line_play_vol = 626 SB_DOUBLE("Line Playback Volume", SB_DSP4_LINE_DEV, (SB_DSP4_LINE_DEV + 1), 3, 3, 31); 627 static struct sbmix_elem snd_sb16_ctl_mic_capture_route = 628 SB16_INPUT_SW("Mic Capture Route", SB_DSP4_INPUT_LEFT, SB_DSP4_INPUT_RIGHT, 0, 0); 629 static struct sbmix_elem snd_sb16_ctl_mic_play_switch = 630 SB_SINGLE("Mic Playback Switch", SB_DSP4_OUTPUT_SW, 0, 1); 631 static struct sbmix_elem snd_sb16_ctl_mic_play_vol = 632 SB_SINGLE("Mic Playback Volume", SB_DSP4_MIC_DEV, 3, 31); 633 static struct sbmix_elem snd_sb16_ctl_pc_speaker_vol = 634 SB_SINGLE("PC Speaker Volume", SB_DSP4_SPEAKER_DEV, 6, 3); 635 static struct sbmix_elem snd_sb16_ctl_capture_vol = 636 SB_DOUBLE("Capture Volume", SB_DSP4_IGAIN_DEV, (SB_DSP4_IGAIN_DEV + 1), 6, 6, 3); 637 static struct sbmix_elem snd_sb16_ctl_play_vol = 638 SB_DOUBLE("Playback Volume", SB_DSP4_OGAIN_DEV, (SB_DSP4_OGAIN_DEV + 1), 6, 6, 3); 639 static struct sbmix_elem snd_sb16_ctl_auto_mic_gain = 640 SB_SINGLE("Mic Auto Gain", SB_DSP4_MIC_AGC, 0, 1); 641 642 static struct sbmix_elem *snd_sb16_controls[] = { 643 &snd_sb16_ctl_master_play_vol, 644 &snd_sb16_ctl_3d_enhance_switch, 645 &snd_sb16_ctl_tone_bass, 646 &snd_sb16_ctl_tone_treble, 647 &snd_sb16_ctl_pcm_play_vol, 648 &snd_sb16_ctl_synth_capture_route, 649 &snd_sb16_ctl_synth_play_vol, 650 &snd_sb16_ctl_cd_capture_route, 651 &snd_sb16_ctl_cd_play_switch, 652 &snd_sb16_ctl_cd_play_vol, 653 &snd_sb16_ctl_line_capture_route, 654 &snd_sb16_ctl_line_play_switch, 655 &snd_sb16_ctl_line_play_vol, 656 &snd_sb16_ctl_mic_capture_route, 657 &snd_sb16_ctl_mic_play_switch, 658 &snd_sb16_ctl_mic_play_vol, 659 &snd_sb16_ctl_pc_speaker_vol, 660 &snd_sb16_ctl_capture_vol, 661 &snd_sb16_ctl_play_vol, 662 &snd_sb16_ctl_auto_mic_gain 575 static struct sbmix_elem snd_sb16_controls[] = { 576 SB_DOUBLE("Master Playback Volume", 577 SB_DSP4_MASTER_DEV, (SB_DSP4_MASTER_DEV + 1), 3, 3, 31), 578 SB_DOUBLE("PCM Playback Volume", 579 SB_DSP4_PCM_DEV, (SB_DSP4_PCM_DEV + 1), 3, 3, 31), 580 SB16_INPUT_SW("Synth Capture Route", 581 SB_DSP4_INPUT_LEFT, SB_DSP4_INPUT_RIGHT, 6, 5), 582 SB_DOUBLE("Synth Playback Volume", 583 SB_DSP4_SYNTH_DEV, (SB_DSP4_SYNTH_DEV + 1), 3, 3, 31), 584 SB16_INPUT_SW("CD Capture Route", 585 SB_DSP4_INPUT_LEFT, SB_DSP4_INPUT_RIGHT, 2, 1), 586 SB_DOUBLE("CD Playback Switch", 587 SB_DSP4_OUTPUT_SW, SB_DSP4_OUTPUT_SW, 2, 1, 1), 588 SB_DOUBLE("CD Playback Volume", 589 SB_DSP4_CD_DEV, (SB_DSP4_CD_DEV + 1), 3, 3, 31), 590 SB16_INPUT_SW("Mic Capture Route", 591 SB_DSP4_INPUT_LEFT, SB_DSP4_INPUT_RIGHT, 0, 0), 592 SB_SINGLE("Mic Playback Switch", SB_DSP4_OUTPUT_SW, 0, 1), 593 SB_SINGLE("Mic Playback Volume", SB_DSP4_MIC_DEV, 3, 31), 594 SB_SINGLE("Beep Volume", SB_DSP4_SPEAKER_DEV, 6, 3), 595 SB_DOUBLE("Capture Volume", 596 SB_DSP4_IGAIN_DEV, (SB_DSP4_IGAIN_DEV + 1), 6, 6, 3), 597 SB_DOUBLE("Playback Volume", 598 SB_DSP4_OGAIN_DEV, (SB_DSP4_OGAIN_DEV + 1), 6, 6, 3), 599 SB16_INPUT_SW("Line Capture Route", 600 SB_DSP4_INPUT_LEFT, SB_DSP4_INPUT_RIGHT, 4, 3), 601 SB_DOUBLE("Line Playback Switch", 602 SB_DSP4_OUTPUT_SW, SB_DSP4_OUTPUT_SW, 4, 3, 1), 603 SB_DOUBLE("Line Playback Volume", 604 SB_DSP4_LINE_DEV, (SB_DSP4_LINE_DEV + 1), 3, 3, 31), 605 SB_SINGLE("Mic Auto Gain", SB_DSP4_MIC_AGC, 0, 1), 606 SB_SINGLE("3D Enhancement Switch", SB_DSP4_3DSE, 0, 1), 607 SB_DOUBLE("Tone Control - Bass", 608 SB_DSP4_BASS_DEV, (SB_DSP4_BASS_DEV + 1), 4, 4, 15), 609 SB_DOUBLE("Tone Control - Treble", 610 SB_DSP4_TREBLE_DEV, (SB_DSP4_TREBLE_DEV + 1), 4, 4, 15) 663 611 }; 664 612 … … 679 627 * DT019x specific mixer elements 680 628 */ 681 static struct sbmix_elem snd_dt019x_ctl_master_play_vol = 682 SB_DOUBLE("Master Playback Volume", SB_DT019X_MASTER_DEV, SB_DT019X_MASTER_DEV, 4,0, 15); 683 static struct sbmix_elem snd_dt019x_ctl_pcm_play_vol = 684 SB_DOUBLE("PCM Playback Volume", SB_DT019X_PCM_DEV, SB_DT019X_PCM_DEV, 4,0, 15); 685 static struct sbmix_elem snd_dt019x_ctl_synth_play_vol = 686 SB_DOUBLE("Synth Playback Volume", SB_DT019X_SYNTH_DEV, SB_DT019X_SYNTH_DEV, 4,0, 15); 687 static struct sbmix_elem snd_dt019x_ctl_cd_play_vol = 688 SB_DOUBLE("CD Playback Volume", SB_DT019X_CD_DEV, SB_DT019X_CD_DEV, 4,0, 15); 689 static struct sbmix_elem snd_dt019x_ctl_mic_play_vol = 690 SB_SINGLE("Mic Playback Volume", SB_DT019X_MIC_DEV, 4, 7); 691 static struct sbmix_elem snd_dt019x_ctl_pc_speaker_vol = 692 SB_SINGLE("PC Speaker Volume", SB_DT019X_SPKR_DEV, 0, 7); 693 static struct sbmix_elem snd_dt019x_ctl_line_play_vol = 694 SB_DOUBLE("Line Playback Volume", SB_DT019X_LINE_DEV, SB_DT019X_LINE_DEV, 4,0, 15); 695 static struct sbmix_elem snd_dt019x_ctl_pcm_play_switch = 696 SB_DOUBLE("PCM Playback Switch", SB_DT019X_OUTPUT_SW2, SB_DT019X_OUTPUT_SW2, 2,1, 1); 697 static struct sbmix_elem snd_dt019x_ctl_synth_play_switch = 698 SB_DOUBLE("Synth Playback Switch", SB_DT019X_OUTPUT_SW2, SB_DT019X_OUTPUT_SW2, 4,3, 1); 699 static struct sbmix_elem snd_dt019x_ctl_capture_source = 629 static struct sbmix_elem snd_dt019x_controls[] = { 630 /* ALS4000 below has some parts which we might be lacking, 631 * e.g. snd_als4000_ctl_mono_playback_switch - check it! */ 632 SB_DOUBLE("Master Playback Volume", 633 SB_DT019X_MASTER_DEV, SB_DT019X_MASTER_DEV, 4, 0, 15), 634 SB_DOUBLE("PCM Playback Switch", 635 SB_DT019X_OUTPUT_SW2, SB_DT019X_OUTPUT_SW2, 2, 1, 1), 636 SB_DOUBLE("PCM Playback Volume", 637 SB_DT019X_PCM_DEV, SB_DT019X_PCM_DEV, 4, 0, 15), 638 SB_DOUBLE("Synth Playback Switch", 639 SB_DT019X_OUTPUT_SW2, SB_DT019X_OUTPUT_SW2, 4, 3, 1), 640 SB_DOUBLE("Synth Playback Volume", 641 SB_DT019X_SYNTH_DEV, SB_DT019X_SYNTH_DEV, 4, 0, 15), 642 SB_DOUBLE("CD Playback Switch", 643 SB_DSP4_OUTPUT_SW, SB_DSP4_OUTPUT_SW, 2, 1, 1), 644 SB_DOUBLE("CD Playback Volume", 645 SB_DT019X_CD_DEV, SB_DT019X_CD_DEV, 4, 0, 15), 646 SB_SINGLE("Mic Playback Switch", SB_DSP4_OUTPUT_SW, 0, 1), 647 SB_SINGLE("Mic Playback Volume", SB_DT019X_MIC_DEV, 4, 7), 648 SB_SINGLE("Beep Volume", SB_DT019X_SPKR_DEV, 0, 7), 649 SB_DOUBLE("Line Playback Switch", 650 SB_DSP4_OUTPUT_SW, SB_DSP4_OUTPUT_SW, 4, 3, 1), 651 SB_DOUBLE("Line Playback Volume", 652 SB_DT019X_LINE_DEV, SB_DT019X_LINE_DEV, 4, 0, 15), 700 653 { 701 654 .name = "Capture Source", 702 655 .type = SB_MIX_CAPTURE_DT019X 703 }; 704 705 static struct sbmix_elem *snd_dt019x_controls[] = { 706 /* ALS4000 below has some parts which we might be lacking, 707 * e.g. snd_als4000_ctl_mono_playback_switch - check it! */ 708 &snd_dt019x_ctl_master_play_vol, 709 &snd_dt019x_ctl_pcm_play_vol, 710 &snd_dt019x_ctl_synth_play_vol, 711 &snd_dt019x_ctl_cd_play_vol, 712 &snd_dt019x_ctl_mic_play_vol, 713 &snd_dt019x_ctl_pc_speaker_vol, 714 &snd_dt019x_ctl_line_play_vol, 715 &snd_sb16_ctl_mic_play_switch, 716 &snd_sb16_ctl_cd_play_switch, 717 &snd_sb16_ctl_line_play_switch, 718 &snd_dt019x_ctl_pcm_play_switch, 719 &snd_dt019x_ctl_synth_play_switch, 720 &snd_dt019x_ctl_capture_source 656 } 721 657 }; 722 658 … … 736 672 * ALS4000 specific mixer elements 737 673 */ 738 static struct sbmix_elem snd_als4000_ctl_master_mono_playback_switch = 739 SB_SINGLE("Master Mono Playback Switch", SB_ALS4000_MONO_IO_CTRL, 5, 1); 740 static struct sbmix_elem snd_als4k_ctl_master_mono_capture_route = { 674 static struct sbmix_elem snd_als4000_controls[] = { 675 SB_DOUBLE("PCM Playback Switch", 676 SB_DT019X_OUTPUT_SW2, SB_DT019X_OUTPUT_SW2, 2, 1, 1), 677 SB_DOUBLE("Synth Playback Switch", 678 SB_DT019X_OUTPUT_SW2, SB_DT019X_OUTPUT_SW2, 4, 3, 1), 679 SB_SINGLE("Mic Boost (+20dB)", SB_ALS4000_MIC_IN_GAIN, 0, 0x03), 680 SB_SINGLE("Master Mono Playback Switch", SB_ALS4000_MONO_IO_CTRL, 5, 1), 681 { 741 682 .name = "Master Mono Capture Route", 742 683 .type = SB_MIX_MONO_CAPTURE_ALS4K 743 }; 744 static struct sbmix_elem snd_als4000_ctl_mono_playback_switch = 745 SB_SINGLE("Mono Playback Switch", SB_DT019X_OUTPUT_SW2, 0, 1); 746 static struct sbmix_elem snd_als4000_ctl_mic_20db_boost = 747 SB_SINGLE("Mic Boost (+20dB)", SB_ALS4000_MIC_IN_GAIN, 0, 0x03); 748 static struct sbmix_elem snd_als4000_ctl_mixer_analog_loopback = 749 SB_SINGLE("Analog Loopback Switch", SB_ALS4000_MIC_IN_GAIN, 7, 0x01); 750 static struct sbmix_elem snd_als4000_ctl_mixer_digital_loopback = 684 }, 685 SB_SINGLE("Mono Playback Switch", SB_DT019X_OUTPUT_SW2, 0, 1), 686 SB_SINGLE("Analog Loopback Switch", SB_ALS4000_MIC_IN_GAIN, 7, 0x01), 687 SB_SINGLE("3D Control - Switch", SB_ALS4000_3D_SND_FX, 6, 0x01), 751 688 SB_SINGLE("Digital Loopback Switch", 752 SB_ALS4000_CR3_CONFIGURATION, 7, 0x01); 753 /* FIXME: functionality of 3D controls might be swapped, I didn't find 754 * a description of how to identify what is supposed to be what */ 755 static struct sbmix_elem snd_als4000_3d_control_switch = 756 SB_SINGLE("3D Control - Switch", SB_ALS4000_3D_SND_FX, 6, 0x01); 757 static struct sbmix_elem snd_als4000_3d_control_ratio = 758 SB_SINGLE("3D Control - Level", SB_ALS4000_3D_SND_FX, 0, 0x07); 759 static struct sbmix_elem snd_als4000_3d_control_freq = 689 SB_ALS4000_CR3_CONFIGURATION, 7, 0x01), 690 /* FIXME: functionality of 3D controls might be swapped, I didn't find 691 * a description of how to identify what is supposed to be what */ 692 SB_SINGLE("3D Control - Level", SB_ALS4000_3D_SND_FX, 0, 0x07), 760 693 /* FIXME: maybe there's actually some standard 3D ctrl name for it?? */ 761 SB_SINGLE("3D Control - Freq", SB_ALS4000_3D_SND_FX, 4, 0x03); 762 static struct sbmix_elem snd_als4000_3d_control_delay = 694 SB_SINGLE("3D Control - Freq", SB_ALS4000_3D_SND_FX, 4, 0x03), 763 695 /* FIXME: ALS4000a.pdf mentions BBD (Bucket Brigade Device) time delay, 764 696 * but what ALSA 3D attribute is that actually? "Center", "Depth", 765 697 * "Wide" or "Space" or even "Level"? Assuming "Wide" for now... */ 766 SB_SINGLE("3D Control - Wide", SB_ALS4000_3D_TIME_DELAY, 0, 0x0f); 767 static struct sbmix_elem snd_als4000_3d_control_poweroff_switch = 768 SB_SINGLE("3D PowerOff Switch", SB_ALS4000_3D_TIME_DELAY, 4, 0x01); 769 static struct sbmix_elem snd_als4000_ctl_3db_freq_control_switch = 698 SB_SINGLE("3D Control - Wide", SB_ALS4000_3D_TIME_DELAY, 0, 0x0f), 699 SB_SINGLE("3D PowerOff Switch", SB_ALS4000_3D_TIME_DELAY, 4, 0x01), 770 700 SB_SINGLE("Master Playback 8kHz / 20kHz LPF Switch", 771 SB_ALS4000_FMDAC, 5, 0x01) ;701 SB_ALS4000_FMDAC, 5, 0x01), 772 702 #ifdef NOT_AVAILABLE 773 static struct sbmix_elem snd_als4000_ctl_fmdac = 774 SB_SINGLE("FMDAC Switch (Option ?)", SB_ALS4000_FMDAC, 0, 0x01); 775 static struct sbmix_elem snd_als4000_ctl_qsound = 776 SB_SINGLE("QSound Mode", SB_ALS4000_QSOUND, 1, 0x1f); 777 #endif 778 779 static struct sbmix_elem *snd_als4000_controls[] = { 780 /* ALS4000a.PDF regs page */ 781 &snd_sb16_ctl_master_play_vol, /* MX30/31 12 */ 782 &snd_dt019x_ctl_pcm_play_switch, /* MX4C 16 */ 783 &snd_sb16_ctl_pcm_play_vol, /* MX32/33 12 */ 784 &snd_sb16_ctl_synth_capture_route, /* MX3D/3E 14 */ 785 &snd_dt019x_ctl_synth_play_switch, /* MX4C 16 */ 786 &snd_sb16_ctl_synth_play_vol, /* MX34/35 12/13 */ 787 &snd_sb16_ctl_cd_capture_route, /* MX3D/3E 14 */ 788 &snd_sb16_ctl_cd_play_switch, /* MX3C 14 */ 789 &snd_sb16_ctl_cd_play_vol, /* MX36/37 13 */ 790 &snd_sb16_ctl_line_capture_route, /* MX3D/3E 14 */ 791 &snd_sb16_ctl_line_play_switch, /* MX3C 14 */ 792 &snd_sb16_ctl_line_play_vol, /* MX38/39 13 */ 793 &snd_sb16_ctl_mic_capture_route, /* MX3D/3E 14 */ 794 &snd_als4000_ctl_mic_20db_boost, /* MX4D 16 */ 795 &snd_sb16_ctl_mic_play_switch, /* MX3C 14 */ 796 &snd_sb16_ctl_mic_play_vol, /* MX3A 13 */ 797 &snd_sb16_ctl_pc_speaker_vol, /* MX3B 14 */ 798 &snd_sb16_ctl_capture_vol, /* MX3F/40 15 */ 799 &snd_sb16_ctl_play_vol, /* MX41/42 15 */ 800 &snd_als4000_ctl_master_mono_playback_switch, /* MX4C 16 */ 801 &snd_als4k_ctl_master_mono_capture_route, /* MX4B 16 */ 802 &snd_als4000_ctl_mono_playback_switch, /* MX4C 16 */ 803 &snd_als4000_ctl_mixer_analog_loopback, /* MX4D 16 */ 804 &snd_als4000_ctl_mixer_digital_loopback, /* CR3 21 */ 805 &snd_als4000_3d_control_switch, /* MX50 17 */ 806 &snd_als4000_3d_control_ratio, /* MX50 17 */ 807 &snd_als4000_3d_control_freq, /* MX50 17 */ 808 &snd_als4000_3d_control_delay, /* MX51 18 */ 809 &snd_als4000_3d_control_poweroff_switch, /* MX51 18 */ 810 &snd_als4000_ctl_3db_freq_control_switch, /* MX4F 17 */ 811 #ifdef NOT_AVAILABLE 812 &snd_als4000_ctl_fmdac, 813 &snd_als4000_ctl_qsound, 703 SB_SINGLE("FMDAC Switch (Option ?)", SB_ALS4000_FMDAC, 0, 0x01), 704 SB_SINGLE("QSound Mode", SB_ALS4000_QSOUND, 1, 0x1f), 814 705 #endif 815 706 }; … … 830 721 }; 831 722 832 833 723 /* 834 724 */ 835 725 static int snd_sbmixer_init(struct snd_sb *chip, 836 struct sbmix_elem * *controls,726 struct sbmix_elem *controls, 837 727 int controls_count, 838 728 unsigned char map[][2], … … 857 747 858 748 for (idx = 0; idx < controls_count; idx++) { 859 if ((err = snd_sbmixer_add_ctl_elem(chip, controls[idx])) < 0) 749 err = snd_sbmixer_add_ctl_elem(chip, &controls[idx]); 750 if (err < 0) 860 751 return err; 861 752 } … … 889 780 break; 890 781 case SB_HW_PRO: 782 case SB_HW_JAZZ16: 891 783 if ((err = snd_sbmixer_init(chip, 892 784 snd_sbpro_controls, … … 909 801 break; 910 802 case SB_HW_ALS4000: 803 /* use only the first 16 controls from SB16 */ 804 err = snd_sbmixer_init(chip, 805 snd_sb16_controls, 806 16, 807 snd_sb16_init_values, 808 ARRAY_SIZE(snd_sb16_init_values), 809 "ALS4000"); 810 if (err < 0) 811 return err; 911 812 if ((err = snd_sbmixer_init(chip, 912 813 snd_als4000_controls, … … 1030 931 break; 1031 932 case SB_HW_PRO: 933 case SB_HW_JAZZ16: 1032 934 save_mixer(chip, sbpro_saved_regs, ARRAY_SIZE(sbpro_saved_regs)); 1033 935 break; … … 1056 958 break; 1057 959 case SB_HW_PRO: 960 case SB_HW_JAZZ16: 1058 961 restore_mixer(chip, sbpro_saved_regs, ARRAY_SIZE(sbpro_saved_regs)); 1059 962 break; -
GPL/trunk/alsa-kernel/isa/wavefront/wavefront.c
r426 r598 22 22 #include <linux/init.h> 23 23 #include <linux/interrupt.h> 24 #include <linux/slab.h>25 24 #include <linux/err.h> 26 25 #include <linux/isa.h> -
GPL/trunk/alsa-kernel/isa/wavefront/wavefront_fx.c
r479 r598 21 21 #include <linux/time.h> 22 22 #include <linux/wait.h> 23 #include <linux/slab.h> 23 24 #include <linux/firmware.h> 24 25 #include <sound/core.h> -
GPL/trunk/alsa-kernel/isa/wavefront/wavefront_synth.c
r426 r598 29 29 #include <linux/firmware.h> 30 30 #include <linux/moduleparam.h> 31 #include <linux/slab.h> 31 32 #include <sound/core.h> 32 33 #include <sound/snd_wavefront.h>
Note:
See TracChangeset
for help on using the changeset viewer.
