- Timestamp:
- Jul 16, 2008, 11:53:49 AM (17 years ago)
- Location:
- GPL/branches/uniaud32-2.0
- Files:
-
- 2 added
- 89 edited
Legend:
- Unmodified
- Added
- Removed
-
GPL/branches/uniaud32-2.0/alsa-kernel/core/control.c
r318 r358 693 693 } 694 694 695 int snd_ctl_elem_read(struct snd_card *card, struct snd_ctl_elem_value *control) 695 static int snd_ctl_elem_read(struct snd_card *card, 696 struct snd_ctl_elem_value *control) 696 697 { 697 698 struct snd_kcontrol *kctl; … … 743 744 } 744 745 745 int snd_ctl_elem_write(struct snd_card *card, struct snd_ctl_file *file,746 746 static int snd_ctl_elem_write(struct snd_card *card, struct snd_ctl_file *file, 747 struct snd_ctl_elem_value *control) 747 748 { 748 749 struct snd_kcontrol *kctl; -
GPL/branches/uniaud32-2.0/alsa-kernel/core/info.c
r305 r358 572 572 struct proc_dir_entry *p; 573 573 574 p = snd_create_proc_entry("asound", S_IFDIR | S_IRUGO | S_IXUGO, &proc_root);574 p = snd_create_proc_entry("asound", S_IFDIR | S_IRUGO | S_IXUGO, NULL); 575 575 if (p == NULL) 576 576 return -ENOMEM; … … 622 622 snd_info_free_entry(snd_oss_root); 623 623 #endif 624 snd_remove_proc_entry( &proc_root, snd_proc_root);624 snd_remove_proc_entry(NULL, snd_proc_root); 625 625 } 626 626 return 0; -
GPL/branches/uniaud32-2.0/alsa-kernel/core/init.c
r318 r358 59 59 MODULE_PARM_DESC(slots, "Module names assigned to the slots."); 60 60 61 /* return non-zero if the given index is already reserved for another61 /* return non-zero if the given index is reserved for the given 62 62 * module via slots option 63 63 */ 64 static int module_slot_m ismatch(struct module *module, int idx)64 static int module_slot_match(struct module *module, int idx) 65 65 { 66 66 #ifndef TARGET_OS2 67 67 #ifdef MODULE 68 char *s1, *s2; 68 const char *s1, *s2; 69 70 int match = 1; 69 71 if (!module || !module->name || !slots[idx]) 70 72 return 0; 71 s1 = slots[idx]; 72 s2 = module->name; 73 s1 = module->name; 74 s2 = slots[idx]; 75 if (*s2 == '!') { 76 match = 0; /* negative match */ 77 s2++; 78 } 73 79 /* compare module name strings 74 80 * hyphens are handled as equivalent with underscore … … 82 88 c2 = '_'; 83 89 if (c1 != c2) 84 return 1;90 return !match; 85 91 if (!c1) 86 92 break; 87 93 } 88 #endif 89 #endif 90 return 0; 94 95 #endif /* MODULE */ 96 #else 97 int match = 1; 98 #endif 99 return match; 91 100 } 92 101 … … 144 153 { 145 154 struct snd_card *card; 146 int err ;155 int err, idx2; 147 156 148 157 if (extra_size < 0) … … 160 169 mutex_lock(&snd_card_mutex); 161 170 if (idx < 0) { 162 int idx2;163 171 for (idx2 = 0; idx2 < SNDRV_CARDS; idx2++) 164 172 /* idx == -1 == 0xffff means: take any free slot */ 165 173 if (~snd_cards_lock & idx & 1<<idx2) { 166 if (module_slot_mismatch(module, idx2)) 167 continue; 168 idx = idx2; 169 if (idx >= snd_ecards_limit) 170 snd_ecards_limit = idx + 1; 171 break; 174 if (module_slot_match(module, idx2)) { 175 idx = idx2; 176 break; 177 } 172 178 } 173 } else { 174 if (idx < snd_ecards_limit) { 175 if (snd_cards_lock & (1 << idx)) 176 err = -EBUSY; /* invalid */ 177 } else { 178 if (idx < SNDRV_CARDS) 179 snd_ecards_limit = idx + 1; /* increase the limit */ 180 else 181 err = -ENODEV; 182 } 183 } 184 if (idx < 0 || err < 0) { 179 } 180 if (idx < 0) { 181 for (idx2 = 0; idx2 < SNDRV_CARDS; idx2++) 182 /* idx == -1 == 0xffff means: take any free slot */ 183 if (~snd_cards_lock & idx & 1<<idx2) { 184 if (!slots[idx2] || !*slots[idx2]) { 185 idx = idx2; 186 break; 187 } 188 } 189 } 190 if (idx < 0) 191 err = -ENODEV; 192 else if (idx < snd_ecards_limit) { 193 if (snd_cards_lock & (1 << idx)) 194 err = -EBUSY; /* invalid */ 195 } else if (idx >= SNDRV_CARDS) 196 err = -ENODEV; 197 if (err < 0) { 185 198 mutex_unlock(&snd_card_mutex); 186 199 snd_printk(KERN_ERR "cannot find the slot for index %d (range 0-%i), error: %d\n", … … 189 202 } 190 203 snd_cards_lock |= 1 << idx; /* lock it */ 204 if (idx >= snd_ecards_limit) 205 snd_ecards_limit = idx + 1; /* increase the limit */ 191 206 mutex_unlock(&snd_card_mutex); 192 207 card->number = idx; … … 271 286 272 287 #ifndef TARGET_OS2 273 panic("%s(%p, %p) failed!", __ FUNCTION__, inode, file);288 panic("%s(%p, %p) failed!", __func__, inode, file); 274 289 #endif 275 290 } … … 347 362 int err; 348 363 364 if (!card) 365 return -EINVAL; 366 349 367 spin_lock(&card->files_lock); 350 368 if (card->shutdown) { … … 358 376 mutex_lock(&snd_card_mutex); 359 377 snd_cards[card->number] = NULL; 378 snd_cards_lock &= ~(1 << card->number); 360 379 mutex_unlock(&snd_card_mutex); 361 380 … … 396 415 397 416 snd_info_card_disconnect(card); 417 #ifndef CONFIG_SYSFS_DEPRECATED 418 if (card->card_dev) { 419 device_unregister(card->card_dev); 420 card->card_dev = NULL; 421 } 422 #endif 423 #ifdef CONFIG_PM 424 wake_up(&card->power_sleep); 425 #endif 398 426 return 0; 399 427 } … … 437 465 /* Not fatal error */ 438 466 } 439 #ifndef CONFIG_SYSFS_DEPRECATED440 if (card->card_dev)441 device_unregister(card->card_dev);442 #endif443 467 kfree(card); 444 468 return 0; 445 469 } 446 470 447 static int snd_card_free_prepare(struct snd_card *card)448 {449 if (card == NULL)450 return -EINVAL;451 (void) snd_card_disconnect(card);452 mutex_lock(&snd_card_mutex);453 snd_cards[card->number] = NULL;454 snd_cards_lock &= ~(1 << card->number);455 mutex_unlock(&snd_card_mutex);456 #ifdef CONFIG_PM457 wake_up(&card->power_sleep);458 #endif459 return 0;460 }461 462 471 int snd_card_free_when_closed(struct snd_card *card) 463 472 { 464 473 int free_now = 0; 465 int ret = snd_card_ free_prepare(card);474 int ret = snd_card_disconnect(card); 466 475 if (ret) 467 476 return ret; … … 483 492 int snd_card_free(struct snd_card *card) 484 493 { 485 int ret = snd_card_ free_prepare(card);494 int ret = snd_card_disconnect(card); 486 495 if (ret) 487 496 return ret; -
GPL/branches/uniaud32-2.0/alsa-kernel/core/makefile.os2
r333 r358 21 21 FILE6 = timer.obj 22 22 FILE7 = rtctimer.obj 23 FILE8 = hwdep.obj info.obj wrappers.obj misc_driver.obj 23 FILE8 = hwdep.obj info.obj wrappers.obj misc_driver.obj vmaster.obj 24 24 FILELAST = 25 25 FILES = $(FILE0) $(FILE1) $(FILE2) $(FILE3) $(FILE4) $(FILE5) $(FILE6) $(FILE7) $(FILE8) $(FILE9) $(FILE10) $(FILE11) $(FILE12) -
GPL/branches/uniaud32-2.0/alsa-kernel/core/memalloc.c
r351 r358 125 125 #endif 126 126 127 #if defined(__i386__)128 /*129 * A hack to allocate large buffers via dma_alloc_coherent()130 *131 * since dma_alloc_coherent always tries GFP_DMA when the requested132 * pci memory region is below 32bit, it happens quite often that even133 * 2 order of pages cannot be allocated.134 *135 * so in the following, we allocate at first without dma_mask, so that136 * allocation will be done without GFP_DMA. if the area doesn't match137 * with the requested region, then realloate with the original dma_mask138 * again.139 *140 * Really, we want to move this type of thing into dma_alloc_coherent()141 * so dma_mask doesn't have to be messed with.142 */143 144 static void *snd_dma_hack_alloc_coherent(struct device *dev, size_t size,145 dma_addr_t *dma_handle,146 gfp_t flags)147 {148 void *ret;149 u64 dma_mask, coherent_dma_mask;150 151 if (dev == NULL || !dev->dma_mask)152 return dma_alloc_coherent(dev, size, dma_handle, flags);153 dma_mask = *dev->dma_mask;154 coherent_dma_mask = dev->coherent_dma_mask;155 *dev->dma_mask = 0xffffffff; /* do without masking */156 dev->coherent_dma_mask = 0xffffffff; /* do without masking */157 ret = dma_alloc_coherent(dev, size, dma_handle, flags);158 *dev->dma_mask = dma_mask; /* restore */159 dev->coherent_dma_mask = coherent_dma_mask; /* restore */160 if (ret) {161 /* obtained address is out of range? */162 if (((unsigned long)*dma_handle + size - 1) & ~dma_mask) {163 /* reallocate with the proper mask */164 dma_free_coherent(dev, size, ret, *dma_handle);165 ret = dma_alloc_coherent(dev, size, dma_handle, flags);166 }167 } else {168 /* wish to success now with the proper mask... */169 if (dma_mask != 0xffffffffUL) {170 /* allocation with GFP_ATOMIC to avoid the long stall */171 flags &= ~GFP_KERNEL;172 flags |= GFP_ATOMIC;173 ret = dma_alloc_coherent(dev, size, dma_handle, flags);174 }175 }176 return ret;177 }178 179 /* redefine dma_alloc_coherent for some architectures */180 #undef dma_alloc_coherent181 #define dma_alloc_coherent snd_dma_hack_alloc_coherent182 183 #endif /* arch */184 127 185 128 /* … … 687 630 #ifdef CONFIG_PROC_FS 688 631 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0) 689 snd_mem_proc = create_proc_entry(SND_MEM_PROC_FILE, 0644, NULL); 690 if (snd_mem_proc) 691 snd_mem_proc->proc_fops = &snd_mem_proc_fops; 632 snd_mem_proc = proc_create(SND_MEM_PROC_FILE, 0644, NULL, 633 &snd_mem_proc_fops); 692 634 #endif 693 635 #endif -
GPL/branches/uniaud32-2.0/alsa-kernel/core/misc.c
r305 r358 40 40 va_list args; 41 41 42 if (format[0] == '<' && format[1] >= '0' && format[1] <= ' 9' && format[2] == '>') {42 if (format[0] == '<' && format[1] >= '0' && format[1] <= '7' && format[2] == '>') { 43 43 char tmp[] = "<0>"; 44 44 tmp[1] = format[1]; … … 61 61 va_list args; 62 62 63 if (format[0] == '<' && format[1] >= '0' && format[1] <= ' 9' && format[2] == '>') {63 if (format[0] == '<' && format[1] >= '0' && format[1] <= '7' && format[2] == '>') { 64 64 char tmp[] = "<0>"; 65 65 tmp[1] = format[1]; -
GPL/branches/uniaud32-2.0/alsa-kernel/core/pcm_native.c
r319 r358 27 27 #include <linux/slab.h> 28 28 #include <linux/time.h> 29 #include <linux/ latency.h>29 #include <linux/pm_qos_params.h> 30 30 #include <linux/uio.h> 31 31 #include <sound/core.h> … … 455 455 runtime->status->state = SNDRV_PCM_STATE_SETUP; 456 456 457 remove_acceptable_latency(substream->latency_id); 457 pm_qos_remove_requirement(PM_QOS_CPU_DMA_LATENCY, 458 substream->latency_id); 458 459 if ((usecs = period_to_usecs(runtime)) >= 0) 459 set_acceptable_latency(substream->latency_id, usecs); 460 pm_qos_add_requirement(PM_QOS_CPU_DMA_LATENCY, 461 substream->latency_id, usecs); 460 462 return 0; 461 463 _error: … … 517 519 result = substream->ops->hw_free(substream); 518 520 runtime->status->state = SNDRV_PCM_STATE_OPEN; 519 remove_acceptable_latency(substream->latency_id); 521 pm_qos_remove_requirement(PM_QOS_CPU_DMA_LATENCY, 522 substream->latency_id); 520 523 return result; 521 524 } -
GPL/branches/uniaud32-2.0/alsa-kernel/core/seq/oss/seq_oss_synth.c
r333 r358 250 250 if (info->nr_voices > 0) { 251 251 info->ch = kcalloc(info->nr_voices, sizeof(struct seq_oss_chinfo), GFP_KERNEL); 252 if (!info->ch) 253 BUG(); 252 if (!info->ch) { 253 snd_printk(KERN_ERR "Cannot malloc\n"); 254 rec->oper.close(&info->arg); 255 module_put(rec->oper.owner); 256 snd_use_lock_free(&rec->use_lock); 257 continue; 258 } 254 259 reset_channels(info); 255 260 } -
GPL/branches/uniaud32-2.0/alsa-kernel/core/seq/seq_clientmgr.c
r318 r358 153 153 } 154 154 spin_unlock_irqrestore(&clients_lock, flags); 155 #ifdef CONFIG_ KMOD156 if (!in_interrupt() && current->fs->root) {155 #ifdef CONFIG_MODULES 156 if (!in_interrupt()) { 157 157 static char client_requested[SNDRV_SEQ_GLOBAL_CLIENTS]; 158 158 static char card_requested[SNDRV_CARDS]; … … 160 160 int idx; 161 161 162 if (! client_requested[clientid] && current->fs->root) {162 if (!client_requested[clientid]) { 163 163 client_requested[clientid] = 1; 164 164 for (idx = 0; idx < 15; idx++) { -
GPL/branches/uniaud32-2.0/alsa-kernel/core/seq/seq_device.c
r305 r358 125 125 */ 126 126 127 #ifdef CONFIG_ KMOD127 #ifdef CONFIG_MODULES 128 128 /* avoid auto-loading during module_init() */ 129 129 static int snd_seq_in_init; … … 141 141 void snd_seq_device_load_drivers(void) 142 142 { 143 #ifdef CONFIG_ KMOD143 #ifdef CONFIG_MODULES 144 144 struct ops_list *ops; 145 145 … … 148 148 */ 149 149 if (snd_seq_in_init) 150 return;151 152 if (! current->fs->root)153 150 return; 154 151 … … 570 567 EXPORT_SYMBOL(snd_seq_device_register_driver); 571 568 EXPORT_SYMBOL(snd_seq_device_unregister_driver); 572 #ifdef CONFIG_KMOD573 569 EXPORT_SYMBOL(snd_seq_autoload_lock); 574 570 EXPORT_SYMBOL(snd_seq_autoload_unlock); 575 #endif -
GPL/branches/uniaud32-2.0/alsa-kernel/core/sound.c
r317 r358 61 61 static DEFINE_MUTEX(sound_mutex); 62 62 63 #ifdef CONFIG_ KMOD63 #ifdef CONFIG_MODULES 64 64 65 65 /** … … 68 68 * 69 69 * Tries to load the module "snd-card-X" for the given card number 70 * via KMOD. Returns immediately if already loaded.70 * via request_module. Returns immediately if already loaded. 71 71 */ 72 72 void snd_request_card(int card) 73 73 { 74 if (! current->fs->root)75 return;76 74 if (snd_card_locked(card)) 77 75 return; … … 87 85 char *str; 88 86 89 if (! current->fs->root)90 return;91 87 switch (minor) { 92 88 case SNDRV_MINOR_SEQUENCER: str = "snd-seq"; break; … … 97 93 } 98 94 99 #endif /* request_module support*/95 #endif /* modular kernel */ 100 96 101 97 /** … … 145 141 mptr = snd_minors[minor]; 146 142 if (mptr == NULL) { 147 #ifdef CONFIG_ KMOD143 #ifdef CONFIG_MODULES 148 144 int dev = SNDRV_MINOR_DEVICE(minor); 149 145 if (dev == SNDRV_MINOR_CONTROL) { … … 283 279 snd_minors[minor] = preg; 284 280 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 20) 285 preg->dev = device_create(sound_class, device, MKDEV(major, minor), 286 "%s", name); 281 preg->dev = device_create_drvdata(sound_class, device, 282 MKDEV(major, minor), 283 private_data, "%s", name); 287 284 if (IS_ERR(preg->dev)) { 288 285 snd_minors[minor] = NULL; … … 293 290 } 294 291 295 if (preg->dev)296 dev_set_drvdata(preg->dev, private_data);297 292 #elif defined(CONFIG_SND_HAVE_CLASS_SIMPLE) 298 293 class_simple_device_add((struct class_simple *)sound_class, -
GPL/branches/uniaud32-2.0/alsa-kernel/core/timer.c
r319 r358 151 151 } 152 152 153 #ifdef CONFIG_ KMOD153 #ifdef CONFIG_MODULES 154 154 155 155 static void snd_timer_request(struct snd_timer_id *tid) 156 156 { 157 if (! current->fs->root)158 return;159 157 switch (tid->dev_class) { 160 158 case SNDRV_TIMER_CLASS_GLOBAL: … … 266 264 mutex_lock(®ister_mutex); 267 265 timer = snd_timer_find(tid); 268 #ifdef CONFIG_ KMOD269 if ( timer == NULL) {266 #ifdef CONFIG_MODULES 267 if (!timer) { 270 268 mutex_unlock(®ister_mutex); 271 269 snd_timer_request(tid); -
GPL/branches/uniaud32-2.0/alsa-kernel/drivers/dummy.c
r339 r358 182 182 spinlock_t lock; 183 183 struct timer_list timer; 184 unsigned int pcm_ size;185 unsigned int pcm_ count;184 unsigned int pcm_buffer_size; 185 unsigned int pcm_period_size; 186 186 unsigned int pcm_bps; /* bytes per second */ 187 unsigned int pcm_ jiffie; /* bytes per one jiffie*/187 unsigned int pcm_hz; /* HZ */ 188 188 unsigned int pcm_irq_pos; /* IRQ position */ 189 189 unsigned int pcm_buf_pos; /* position in buffer */ … … 231 231 struct snd_pcm_runtime *runtime = substream->runtime; 232 232 struct snd_dummy_pcm *dpcm = runtime->private_data; 233 unsignedint bps;234 235 bps = runtime->rate * runtime->channels;236 bps *= snd_pcm_format_width(runtime->format);237 bps /= 8; 233 int bps; 234 235 bps = snd_pcm_format_width(runtime->format) * runtime->rate * 236 runtime->channels / 8; 237 238 238 if (bps <= 0) 239 239 return -EINVAL; 240 240 241 dpcm->pcm_bps = bps; 241 dpcm->pcm_ jiffie = bps /HZ;242 dpcm->pcm_ size = snd_pcm_lib_buffer_bytes(substream);243 dpcm->pcm_ count= snd_pcm_lib_period_bytes(substream);242 dpcm->pcm_hz = HZ; 243 dpcm->pcm_buffer_size = snd_pcm_lib_buffer_bytes(substream); 244 dpcm->pcm_period_size = snd_pcm_lib_period_bytes(substream); 244 245 dpcm->pcm_irq_pos = 0; 245 246 dpcm->pcm_buf_pos = 0; 247 248 snd_pcm_format_set_silence(runtime->format, runtime->dma_area, 249 bytes_to_samples(runtime, runtime->dma_bytes)); 250 246 251 return 0; 247 252 } … … 255 260 dpcm->timer.expires = 1 + jiffies; 256 261 add_timer(&dpcm->timer); 257 dpcm->pcm_irq_pos += dpcm->pcm_ jiffie;258 dpcm->pcm_buf_pos += dpcm->pcm_ jiffie;259 dpcm->pcm_buf_pos %= dpcm->pcm_ size;260 if (dpcm->pcm_irq_pos >= dpcm->pcm_ count) {261 dpcm->pcm_irq_pos %= dpcm->pcm_ count;262 dpcm->pcm_irq_pos += dpcm->pcm_bps; 263 dpcm->pcm_buf_pos += dpcm->pcm_bps; 264 dpcm->pcm_buf_pos %= dpcm->pcm_buffer_size * dpcm->pcm_hz; 265 if (dpcm->pcm_irq_pos >= dpcm->pcm_period_size * dpcm->pcm_hz) { 266 dpcm->pcm_irq_pos %= dpcm->pcm_period_size * dpcm->pcm_hz; 262 267 spin_unlock_irqrestore(&dpcm->lock, flags); 263 268 snd_pcm_period_elapsed(dpcm->substream); … … 271 276 struct snd_dummy_pcm *dpcm = runtime->private_data; 272 277 273 return bytes_to_frames(runtime, dpcm->pcm_buf_pos );278 return bytes_to_frames(runtime, dpcm->pcm_buf_pos / dpcm->pcm_hz); 274 279 } 275 280 -
GPL/branches/uniaud32-2.0/alsa-kernel/drivers/mpu401/mpu401_uart.c
r305 r358 50 50 */ 51 51 52 #define snd_mpu401_input_avail(mpu) (!(mpu->read(mpu, MPU401C(mpu)) & 0x80)) 53 #define snd_mpu401_output_ready(mpu) (!(mpu->read(mpu, MPU401C(mpu)) & 0x40)) 54 55 #define MPU401_RESET 0xff 56 #define MPU401_ENTER_UART 0x3f 57 #define MPU401_ACK 0xfe 52 #define snd_mpu401_input_avail(mpu) \ 53 (!(mpu->read(mpu, MPU401C(mpu)) & MPU401_RX_EMPTY)) 54 #define snd_mpu401_output_ready(mpu) \ 55 (!(mpu->read(mpu, MPU401C(mpu)) & MPU401_TX_FULL)) 58 56 59 57 /* Build in lowlevel io */ … … 246 244 } 247 245 mpu->write(mpu, cmd, MPU401C(mpu)); 248 if (ack ) {246 if (ack && !(mpu->info_flags & MPU401_INFO_NO_ACK)) { 249 247 ok = 0; 250 248 timeout = 10000; … … 426 424 { 427 425 unsigned char byte; 428 int max = 256 , timeout;426 int max = 256; 429 427 430 428 do { 431 429 if (snd_rawmidi_transmit_peek(mpu->substream_output, 432 430 &byte, 1) == 1) { 433 for (timeout = 100; timeout > 0; timeout--) { 434 if (snd_mpu401_output_ready(mpu)) 435 break; 436 } 437 if (timeout == 0) 431 /* 432 * Try twice because there is hardware that insists on 433 * setting the output busy bit after each write. 434 */ 435 if (!snd_mpu401_output_ready(mpu) && 436 !snd_mpu401_output_ready(mpu)) 438 437 break; /* Tx FIFO full - try again later */ 439 438 mpu->write(mpu, byte, MPU401D(mpu)); -
GPL/branches/uniaud32-2.0/alsa-kernel/include/sound/ac97_codec.h
r305 r358 398 398 #define AC97_HAS_NO_STD_PCM (1<<17) /* no standard AC97 PCM volume and mute */ 399 399 #define AC97_HAS_NO_AUX (1<<18) /* no standard AC97 AUX volume and mute */ 400 #define AC97_HAS_8CH (1<<19) /* supports 8-channel output */ 400 401 401 402 /* rates indexes */ … … 505 506 unsigned short codec_cfg[3]; // CODEC_CFG bits 506 507 unsigned char swap_mic_linein; // AD1986/AD1986A only 508 unsigned char lo_as_master; /* LO as master */ 507 509 } ad18xx; 508 510 unsigned int dev_flags; /* device specific */ -
GPL/branches/uniaud32-2.0/alsa-kernel/include/sound/ak4114.h
r305 r358 183 183 unsigned char rcs1; 184 184 struct delayed_work work; 185 unsigned int check_flags; 185 186 void *change_callback_private; 186 187 void (*change_callback)(struct ak4114 *ak4114, unsigned char c0, unsigned char c1); -
GPL/branches/uniaud32-2.0/alsa-kernel/include/sound/ak4xxx-adda.h
r305 r358 69 69 SND_AK4524, SND_AK4528, SND_AK4529, 70 70 SND_AK4355, SND_AK4358, SND_AK4381, 71 SND_AK5365 , NON_AKM71 SND_AK5365 72 72 } type; 73 73 -
GPL/branches/uniaud32-2.0/alsa-kernel/include/sound/asoundef.h
r305 r358 113 113 #define IEC958_AES3_CON_CLOCK_50PPM (1<<4) /* 50 ppm */ 114 114 #define IEC958_AES3_CON_CLOCK_VARIABLE (2<<4) /* variable pitch */ 115 #define IEC958_AES4_CON_MAX_WORDLEN_24 (1<<0) /* 0 = 20-bit, 1 = 24-bit */ 116 #define IEC958_AES4_CON_WORDLEN (7<<1) /* mask - sample word length */ 117 #define IEC958_AES4_CON_WORDLEN_NOTID (0<<1) /* not indicated */ 118 #define IEC958_AES4_CON_WORDLEN_20_16 (1<<1) /* 20-bit or 16-bit */ 119 #define IEC958_AES4_CON_WORDLEN_22_18 (2<<1) /* 22-bit or 18-bit */ 120 #define IEC958_AES4_CON_WORDLEN_23_19 (4<<1) /* 23-bit or 19-bit */ 121 #define IEC958_AES4_CON_WORDLEN_24_20 (5<<1) /* 24-bit or 20-bit */ 122 #define IEC958_AES4_CON_WORDLEN_21_17 (6<<1) /* 21-bit or 17-bit */ 115 123 116 124 /***************************************************************************** -
GPL/branches/uniaud32-2.0/alsa-kernel/include/sound/config.h
r351 r358 236 236 typedef enum sndrv_timer_global snd_timer_global_t; 237 237 #endif 238 239 /* redefine INIT_WORK() */ 240 static inline void snd_INIT_WORK(struct work_struct *w, void (*f)(struct work_struct *)) 241 { 242 INIT_WORK(w, (void(*)(void*))(f), w); 243 } 244 #undef INIT_WORK 245 #define INIT_WORK(w,f) snd_INIT_WORK(w,f) 238 246 239 247 #ifdef CONFIG_SND_DEBUG_MEMORY … … 598 606 void pci_iounmap(struct pci_dev *dev, void __iomem * addr); 599 607 608 #ifndef upper_32_bits 609 #define upper_32_bits(n) ((u32)(((n) >> 16) >> 16)) 610 #endif 611 612 #ifdef __SMP__ 613 #define smp_mb() mb() 614 #define smp_rmb() rmb() 615 #define smp_wmb() wmb() 616 #else 617 #define smp_mb() barrier() 618 #define smp_rmb() barrier() 619 #define smp_wmb() barrier() 620 #endif 621 600 622 #endif //__ALSA_CONFIG_H__ -
GPL/branches/uniaud32-2.0/alsa-kernel/include/sound/control.h
r305 r358 137 137 #endif 138 138 139 int snd_ctl_elem_read(struct snd_card *card, struct snd_ctl_elem_value *control);140 int snd_ctl_elem_write(struct snd_card *card, struct snd_ctl_file *file, struct snd_ctl_elem_value *control);141 142 139 static inline unsigned int snd_ctl_get_ioffnum(struct snd_kcontrol *kctl, struct snd_ctl_elem_id *id) 143 140 { … … 177 174 struct snd_ctl_elem_info *uinfo); 178 175 179 #endif /* __CONTROL_H */ 176 /* 177 * virtual master control 178 */ 179 struct snd_kcontrol *snd_ctl_make_virtual_master(char *name, 180 const unsigned int *tlv); 181 int snd_ctl_add_slave(struct snd_kcontrol *master, struct snd_kcontrol *slave); 182 183 #endif /* __SOUND_CONTROL_H */ 184 -
GPL/branches/uniaud32-2.0/alsa-kernel/include/sound/core.h
r351 r358 301 301 int snd_minor_info_oss_done(void); 302 302 #else 303 #define snd_minor_info_oss_init() /*NOP*/ 304 #define snd_minor_info_oss_done() /*NOP*/ 303 static inline int snd_minor_info_oss_init(void) { return 0; } 304 static inline int snd_minor_info_oss_done(void) { return 0; } 305 305 #endif 306 306 … … 334 334 335 335 #ifndef snd_card_set_dev 336 #define snd_card_set_dev(card, devptr) ((card)->dev = (devptr))336 #define snd_card_set_dev(card, devptr) ((card)->dev = (devptr)) 337 337 #endif 338 338 … … 401 401 * @fmt: format string 402 402 * 403 * Compiled only when Works like snd_printk() for debugging purpose.403 * Works like snd_printk() for debugging purposes. 404 404 * Ignored when CONFIG_SND_DEBUG is not set. 405 405 */ … … 452 452 #endif /* CONFIG_SND_DEBUG */ 453 453 454 #ifdef CONFIG_SND_DEBUG_ DETECT454 #ifdef CONFIG_SND_DEBUG_VERBOSE 455 455 /** 456 456 * snd_printdd - debug printk 457 457 * @format: format string 458 458 * 459 * Compiled only when Works like snd_printk() for debugging purpose.460 * Ignored when CONFIG_SND_DEBUG_ DETECTis not set.459 * Works like snd_printk() for debugging purposes. 460 * Ignored when CONFIG_SND_DEBUG_VERBOSE is not set. 461 461 */ 462 462 #ifndef TARGET_OS2 … … 490 490 unsigned short subdevice; /* PCI subdevice ID */ 491 491 int value; /* value */ 492 #ifdef CONFIG_SND_DEBUG_ DETECT492 #ifdef CONFIG_SND_DEBUG_VERBOSE 493 493 const char *name; /* name of the device (optional) */ 494 494 #endif … … 498 498 .subvendor = (vend), .subdevice = (dev) 499 499 #define SND_PCI_QUIRK_ID(vend,dev) {_SND_PCI_QUIRK_ID(vend, dev)} 500 #ifdef CONFIG_SND_DEBUG_ DETECT500 #ifdef CONFIG_SND_DEBUG_VERBOSE 501 501 #define SND_PCI_QUIRK(vend,dev,xname,val) \ 502 502 {_SND_PCI_QUIRK_ID(vend, dev), .value = (val), .name = (xname)} -
GPL/branches/uniaud32-2.0/alsa-kernel/include/sound/cs4231-regs.h
r305 r358 178 178 #define CS4236_VERSION 0x9c /* chip version and ID */ 179 179 180 /* definitions for extended registers - OPTI93X */ 181 #define OPTi931_AUX_LEFT_INPUT 0x10 182 #define OPTi931_AUX_RIGHT_INPUT 0x11 183 #define OPTi93X_MIC_LEFT_INPUT 0x14 184 #define OPTi93X_MIC_RIGHT_INPUT 0x15 185 #define OPTi93X_OUT_LEFT 0x16 186 #define OPTi93X_OUT_RIGHT 0x17 187 180 188 #endif /* __SOUND_CS4231_REGS_H */ -
GPL/branches/uniaud32-2.0/alsa-kernel/include/sound/cs4231.h
r305 r358 58 58 #define CS4231_HW_INTERWAVE 0x1000 /* InterWave chip */ 59 59 #define CS4231_HW_OPL3SA2 0x1101 /* OPL3-SA2 chip, similar to cs4231 */ 60 #define CS4231_HW_OPTI93X 0x1102 /* Opti 930/931/933 */ 60 61 61 62 /* defines for codec.hwshare */ … … 119 120 void snd_cs4231_mce_up(struct snd_cs4231 *chip); 120 121 void snd_cs4231_mce_down(struct snd_cs4231 *chip); 122 123 void snd_cs4231_overrange(struct snd_cs4231 *chip); 121 124 122 125 irqreturn_t snd_cs4231_interrupt(int irq, void *dev_id); -
GPL/branches/uniaud32-2.0/alsa-kernel/include/sound/emu10k1.h
r305 r358 1671 1671 unsigned char i2c_adc; /* I2C interface for ADC */ 1672 1672 unsigned char adc_1361t; /* Use Philips 1361T ADC */ 1673 unsigned char invert_shared_spdif; /* analog/digital switch inverted */ 1673 1674 const char *driver; 1674 1675 const char *name; -
GPL/branches/uniaud32-2.0/alsa-kernel/include/sound/mpu401.h
r305 r358 51 51 #define MPU401_INFO_MMIO (1 << 3) /* MMIO access */ 52 52 #define MPU401_INFO_TX_IRQ (1 << 4) /* independent TX irq */ 53 #define MPU401_INFO_NO_ACK (1 << 6) /* No ACK cmd needed */ 53 54 54 55 #define MPU401_MODE_BIT_INPUT 0 … … 104 105 105 106 /* 107 * control register bits 108 */ 109 /* read MPU401C() */ 110 #define MPU401_RX_EMPTY 0x80 111 #define MPU401_TX_FULL 0x40 112 113 /* write MPU401C() */ 114 #define MPU401_RESET 0xff 115 #define MPU401_ENTER_UART 0x3f 116 117 /* read MPU401D() */ 118 #define MPU401_ACK 0xfe 119 120 121 /* 106 122 107 123 */ -
GPL/branches/uniaud32-2.0/alsa-kernel/include/sound/seq_kernel.h
r305 r358 111 111 int snd_seq_event_port_detach(int client, int port); 112 112 113 #ifdef CONFIG_ KMOD113 #ifdef CONFIG_MODULES 114 114 void snd_seq_autoload_lock(void); 115 115 void snd_seq_autoload_unlock(void); -
GPL/branches/uniaud32-2.0/alsa-kernel/include/sound/soc-dapm.h
r305 r358 130 130 { .id = snd_soc_dapm_adc, .name = wname, .sname = stname, .reg = wreg, \ 131 131 .shift = wshift, .invert = winvert} 132 133 /* generic register modifier widget */ 134 #define SND_SOC_DAPM_REG(wid, wname, wreg, wshift, wmask, won_val, woff_val) \ 135 { .id = wid, .name = wname, .kcontrols = NULL, .num_kcontrols = 0, \ 136 .reg = -((wreg) + 1), .shift = wshift, .mask = wmask, \ 137 .on_val = won_val, .off_val = woff_val, .event = dapm_reg_event, \ 138 .event_flags = SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD} 132 139 133 140 /* dapm kcontrol types */ … … 194 201 struct snd_soc_dapm_path; 195 202 struct snd_soc_dapm_pin; 203 struct snd_soc_dapm_route; 196 204 197 205 /* dapm controls */ … … 206 214 int snd_soc_dapm_new_control(struct snd_soc_codec *codec, 207 215 const struct snd_soc_dapm_widget *widget); 216 int snd_soc_dapm_new_controls(struct snd_soc_codec *codec, 217 const struct snd_soc_dapm_widget *widget, 218 int num); 208 219 209 220 /* dapm path setup */ 210 int snd_soc_dapm_connect_input(struct snd_soc_codec *codec,221 int __deprecated snd_soc_dapm_connect_input(struct snd_soc_codec *codec, 211 222 const char *sink_name, const char *control_name, const char *src_name); 212 223 int snd_soc_dapm_new_widgets(struct snd_soc_codec *codec); 213 224 void snd_soc_dapm_free(struct snd_soc_device *socdev); 225 int snd_soc_dapm_add_routes(struct snd_soc_codec *codec, 226 const struct snd_soc_dapm_route *route, int num); 214 227 215 228 /* dapm events */ 216 229 int snd_soc_dapm_stream_event(struct snd_soc_codec *codec, char *stream, 217 230 int event); 218 int snd_soc_dapm_device_event(struct snd_soc_device *socdev, int event); 231 int snd_soc_dapm_set_bias_level(struct snd_soc_device *socdev, 232 enum snd_soc_bias_level level); 219 233 220 234 /* dapm sys fs - used by the core */ 221 235 int snd_soc_dapm_sys_add(struct device *dev); 222 236 223 /* dapm audio endpoint control */ 224 int snd_soc_dapm_set_endpoint(struct snd_soc_codec *codec, 225 char *pin, int status); 226 int snd_soc_dapm_sync_endpoints(struct snd_soc_codec *codec); 237 /* dapm audio pin control and status */ 238 int snd_soc_dapm_enable_pin(struct snd_soc_codec *codec, char *pin); 239 int snd_soc_dapm_disable_pin(struct snd_soc_codec *codec, char *pin); 240 int snd_soc_dapm_get_pin_status(struct snd_soc_codec *codec, char *pin); 241 int snd_soc_dapm_sync(struct snd_soc_codec *codec); 227 242 228 243 /* dapm widget types */ … … 246 261 }; 247 262 263 /* 264 * DAPM audio route definition. 265 * 266 * Defines an audio route originating at source via control and finishing 267 * at sink. 268 */ 269 struct snd_soc_dapm_route { 270 const char *sink; 271 const char *control; 272 const char *source; 273 }; 274 248 275 /* dapm audio path between two widgets */ 249 276 struct snd_soc_dapm_path { … … 278 305 unsigned int saved_value; /* widget saved value */ 279 306 unsigned int value; /* widget current value */ 307 unsigned int mask; /* non-shifted mask */ 308 unsigned int on_val; /* on state value */ 309 unsigned int off_val; /* off state value */ 280 310 unsigned char power:1; /* block power status */ 281 311 unsigned char invert:1; /* invert the power bit */ -
GPL/branches/uniaud32-2.0/alsa-kernel/include/sound/soc.h
r305 r358 74 74 .private_value = (reg_left) | ((shift) << 8) | \ 75 75 ((max) << 12) | ((invert) << 20) | ((reg_right) << 24) } 76 #define SOC_DOUBLE_S8_TLV(xname, reg, min, max, tlv_array) \ 77 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \ 78 .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ | \ 79 SNDRV_CTL_ELEM_ACCESS_READWRITE, \ 80 .tlv.p = (tlv_array), \ 81 .info = snd_soc_info_volsw_s8, .get = snd_soc_get_volsw_s8, \ 82 .put = snd_soc_put_volsw_s8, \ 83 .private_value = (reg) | (((signed char)max) << 16) | \ 84 (((signed char)min) << 24) } 76 85 #define SOC_ENUM_DOUBLE(xreg, xshift_l, xshift_r, xmask, xtexts) \ 77 86 { .reg = xreg, .shift_l = xshift_l, .shift_r = xshift_r, \ … … 92 101 .get = xhandler_get, .put = xhandler_put, \ 93 102 .private_value = SOC_SINGLE_VALUE(xreg, xshift, xmask, xinvert) } 103 #define SOC_SINGLE_EXT_TLV(xname, xreg, xshift, xmask, xinvert,\ 104 xhandler_get, xhandler_put, tlv_array) \ 105 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ 106 .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ |\ 107 SNDRV_CTL_ELEM_ACCESS_READWRITE,\ 108 .tlv.p = (tlv_array), \ 109 .info = snd_soc_info_volsw, \ 110 .get = xhandler_get, .put = xhandler_put, \ 111 .private_value = SOC_SINGLE_VALUE(xreg, xshift, xmask, xinvert) } 94 112 #define SOC_SINGLE_BOOL_EXT(xname, xdata, xhandler_get, xhandler_put) \ 95 113 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ … … 104 122 105 123 /* 124 * Bias levels 125 * 126 * @ON: Bias is fully on for audio playback and capture operations. 127 * @PREPARE: Prepare for audio operations. Called before DAPM switching for 128 * stream start and stop operations. 129 * @STANDBY: Low power standby state when no playback/capture operations are 130 * in progress. NOTE: The transition time between STANDBY and ON 131 * should be as fast as possible and no longer than 10ms. 132 * @OFF: Power Off. No restrictions on transition times. 133 */ 134 enum snd_soc_bias_level { 135 SND_SOC_BIAS_ON, 136 SND_SOC_BIAS_PREPARE, 137 SND_SOC_BIAS_STANDBY, 138 SND_SOC_BIAS_OFF, 139 }; 140 141 /* 106 142 * Digital Audio Interface (DAI) types 107 143 */ … … 186 222 struct snd_soc_dai_mode; 187 223 struct snd_soc_pcm_runtime; 188 struct snd_soc_codec_dai; 189 struct snd_soc_cpu_dai; 224 struct snd_soc_dai; 190 225 struct snd_soc_codec; 191 226 struct snd_soc_machine_config; … … 221 256 struct snd_ac97_bus_ops *ops, int num); 222 257 void snd_soc_free_ac97_codec(struct snd_soc_codec *codec); 258 259 /* Digital Audio Interface clocking API.*/ 260 int snd_soc_dai_set_sysclk(struct snd_soc_dai *dai, int clk_id, 261 unsigned int freq, int dir); 262 263 int snd_soc_dai_set_clkdiv(struct snd_soc_dai *dai, 264 int div_id, int div); 265 266 int snd_soc_dai_set_pll(struct snd_soc_dai *dai, 267 int pll_id, unsigned int freq_in, unsigned int freq_out); 268 269 /* Digital Audio interface formatting */ 270 int snd_soc_dai_set_fmt(struct snd_soc_dai *dai, unsigned int fmt); 271 272 int snd_soc_dai_set_tdm_slot(struct snd_soc_dai *dai, 273 unsigned int mask, int slots); 274 275 int snd_soc_dai_set_tristate(struct snd_soc_dai *dai, int tristate); 276 277 /* Digital Audio Interface mute */ 278 int snd_soc_dai_digital_mute(struct snd_soc_dai *dai, int mute); 223 279 224 280 /* … … 239 295 int snd_soc_info_volsw_ext(struct snd_kcontrol *kcontrol, 240 296 struct snd_ctl_elem_info *uinfo); 241 #define snd_soc_info_bool_ext snd_ctl_boolean_mono 297 #define snd_soc_info_bool_ext snd_ctl_boolean_mono_info 242 298 int snd_soc_get_volsw(struct snd_kcontrol *kcontrol, 243 299 struct snd_ctl_elem_value *ucontrol); … … 249 305 struct snd_ctl_elem_value *ucontrol); 250 306 int snd_soc_put_volsw_2r(struct snd_kcontrol *kcontrol, 307 struct snd_ctl_elem_value *ucontrol); 308 int snd_soc_info_volsw_s8(struct snd_kcontrol *kcontrol, 309 struct snd_ctl_elem_info *uinfo); 310 int snd_soc_get_volsw_s8(struct snd_kcontrol *kcontrol, 311 struct snd_ctl_elem_value *ucontrol); 312 int snd_soc_put_volsw_s8(struct snd_kcontrol *kcontrol, 251 313 struct snd_ctl_elem_value *ucontrol); 252 314 … … 273 335 }; 274 336 275 /* ASoC codecDAI ops */276 struct snd_soc_ codec_ops {277 /* codecDAI clocking configuration */278 int (*set_sysclk)(struct snd_soc_ codec_dai *codec_dai,337 /* ASoC DAI ops */ 338 struct snd_soc_dai_ops { 339 /* DAI clocking configuration */ 340 int (*set_sysclk)(struct snd_soc_dai *dai, 279 341 int clk_id, unsigned int freq, int dir); 280 int (*set_pll)(struct snd_soc_ codec_dai *codec_dai,342 int (*set_pll)(struct snd_soc_dai *dai, 281 343 int pll_id, unsigned int freq_in, unsigned int freq_out); 282 int (*set_clkdiv)(struct snd_soc_codec_dai *codec_dai, 283 int div_id, int div); 284 285 /* CPU DAI format configuration */ 286 int (*set_fmt)(struct snd_soc_codec_dai *codec_dai, 287 unsigned int fmt); 288 int (*set_tdm_slot)(struct snd_soc_codec_dai *codec_dai, 344 int (*set_clkdiv)(struct snd_soc_dai *dai, int div_id, int div); 345 346 /* DAI format configuration */ 347 int (*set_fmt)(struct snd_soc_dai *dai, unsigned int fmt); 348 int (*set_tdm_slot)(struct snd_soc_dai *dai, 289 349 unsigned int mask, int slots); 290 int (*set_tristate)(struct snd_soc_ codec_dai *, int tristate);350 int (*set_tristate)(struct snd_soc_dai *dai, int tristate); 291 351 292 352 /* digital mute */ 293 int (*digital_mute)(struct snd_soc_codec_dai *, int mute); 294 }; 295 296 /* ASoC cpu DAI ops */ 297 struct snd_soc_cpu_ops { 298 /* CPU DAI clocking configuration */ 299 int (*set_sysclk)(struct snd_soc_cpu_dai *cpu_dai, 300 int clk_id, unsigned int freq, int dir); 301 int (*set_clkdiv)(struct snd_soc_cpu_dai *cpu_dai, 302 int div_id, int div); 303 int (*set_pll)(struct snd_soc_cpu_dai *cpu_dai, 304 int pll_id, unsigned int freq_in, unsigned int freq_out); 305 306 /* CPU DAI format configuration */ 307 int (*set_fmt)(struct snd_soc_cpu_dai *cpu_dai, 308 unsigned int fmt); 309 int (*set_tdm_slot)(struct snd_soc_cpu_dai *cpu_dai, 310 unsigned int mask, int slots); 311 int (*set_tristate)(struct snd_soc_cpu_dai *, int tristate); 312 }; 313 314 /* SoC Codec DAI */ 315 struct snd_soc_codec_dai { 316 char *name; 317 int id; 318 unsigned char type; 319 320 /* DAI capabilities */ 321 struct snd_soc_pcm_stream playback; 322 struct snd_soc_pcm_stream capture; 323 324 /* DAI runtime info */ 325 struct snd_soc_codec *codec; 326 unsigned int active; 327 unsigned char pop_wait:1; 328 329 /* ops */ 330 struct snd_soc_ops ops; 331 struct snd_soc_codec_ops dai_ops; 332 333 /* DAI private data */ 334 void *private_data; 335 }; 336 337 /* SoC CPU DAI */ 338 struct snd_soc_cpu_dai { 339 353 int (*digital_mute)(struct snd_soc_dai *dai, int mute); 354 }; 355 356 /* SoC DAI (Digital Audio Interface) */ 357 struct snd_soc_dai { 340 358 /* DAI description */ 341 359 char *name; … … 344 362 345 363 /* DAI callbacks */ 346 int (*probe)(struct platform_device *pdev); 347 void (*remove)(struct platform_device *pdev); 364 int (*probe)(struct platform_device *pdev, 365 struct snd_soc_dai *dai); 366 void (*remove)(struct platform_device *pdev, 367 struct snd_soc_dai *dai); 348 368 int (*suspend)(struct platform_device *pdev, 349 struct snd_soc_ cpu_dai *cpu_dai);369 struct snd_soc_dai *dai); 350 370 int (*resume)(struct platform_device *pdev, 351 struct snd_soc_ cpu_dai *cpu_dai);371 struct snd_soc_dai *dai); 352 372 353 373 /* ops */ 354 374 struct snd_soc_ops ops; 355 struct snd_soc_ cpu_ops dai_ops;375 struct snd_soc_dai_ops dai_ops; 356 376 357 377 /* DAI capabilities */ … … 361 381 /* DAI runtime info */ 362 382 struct snd_pcm_runtime *runtime; 363 unsigned char active:1; 383 struct snd_soc_codec *codec; 384 unsigned int active; 385 unsigned char pop_wait:1; 364 386 void *dma_data; 365 387 … … 375 397 376 398 /* callbacks */ 377 int (*dapm_event)(struct snd_soc_codec *codec, int event); 399 int (*set_bias_level)(struct snd_soc_codec *, 400 enum snd_soc_bias_level level); 378 401 379 402 /* runtime */ … … 397 420 struct list_head dapm_widgets; 398 421 struct list_head dapm_paths; 399 unsigned int dapm_state;400 unsigned int suspend_dapm_state;422 enum snd_soc_bias_level bias_level; 423 enum snd_soc_bias_level suspend_bias_level; 401 424 struct delayed_work delayed_work; 402 425 403 426 /* codec DAI's */ 404 struct snd_soc_ codec_dai *dai;427 struct snd_soc_dai *dai; 405 428 unsigned int num_dai; 406 429 }; … … 421 444 int (*remove)(struct platform_device *pdev); 422 445 int (*suspend)(struct platform_device *pdev, 423 struct snd_soc_ cpu_dai *cpu_dai);446 struct snd_soc_dai *dai); 424 447 int (*resume)(struct platform_device *pdev, 425 struct snd_soc_ cpu_dai *cpu_dai);448 struct snd_soc_dai *dai); 426 449 427 450 /* pcm creation and destruction */ 428 int (*pcm_new)(struct snd_card *, struct snd_soc_ codec_dai *,451 int (*pcm_new)(struct snd_card *, struct snd_soc_dai *, 429 452 struct snd_pcm *); 430 453 void (*pcm_free)(struct snd_pcm *); … … 440 463 441 464 /* DAI */ 442 struct snd_soc_ codec_dai *codec_dai;443 struct snd_soc_ cpu_dai *cpu_dai;465 struct snd_soc_dai *codec_dai; 466 struct snd_soc_dai *cpu_dai; 444 467 445 468 /* machine stream operations */ … … 468 491 469 492 /* callbacks */ 470 int (*dapm_event)(struct snd_soc_machine *, int event); 493 int (*set_bias_level)(struct snd_soc_machine *, 494 enum snd_soc_bias_level level); 471 495 472 496 /* CPU <--> Codec DAI links */ … … 483 507 struct snd_soc_codec_device *codec_dev; 484 508 struct delayed_work delayed_work; 509 struct work_struct deferred_resume_work; 485 510 void *codec_data; 486 511 }; -
GPL/branches/uniaud32-2.0/alsa-kernel/include/sound/uda1341.h
r305 r358 15 15 * features support 16 16 */ 17 18 /* $Id: uda1341.h,v 1.8 2005/11/17 14:17:21 tiwai Exp $ */19 17 20 18 #define UDA1341_ALSA_NAME "snd-uda1341" -
GPL/branches/uniaud32-2.0/alsa-kernel/include/sound/version.h
r305 r358 6 6 #define __ALSA_VERSION_H__ 7 7 #define CONFIG_SND_DATE "" 8 #define CONFIG_SND_VERSION "1.0.1 6"8 #define CONFIG_SND_VERSION "1.0.17" 9 9 #endif //__ALSA_VERSION_H__ -
GPL/branches/uniaud32-2.0/alsa-kernel/isa/cs423x/cs4231_lib.c
r305 r358 118 118 0x00, /* 1e/30 - cbru */ 119 119 0x00, /* 1f/31 - cbrl */ 120 }; 121 122 static unsigned char snd_opti93x_original_image[32] = 123 { 124 0x00, /* 00/00 - l_mixout_outctrl */ 125 0x00, /* 01/01 - r_mixout_outctrl */ 126 0x88, /* 02/02 - l_cd_inctrl */ 127 0x88, /* 03/03 - r_cd_inctrl */ 128 0x88, /* 04/04 - l_a1/fm_inctrl */ 129 0x88, /* 05/05 - r_a1/fm_inctrl */ 130 0x80, /* 06/06 - l_dac_inctrl */ 131 0x80, /* 07/07 - r_dac_inctrl */ 132 0x00, /* 08/08 - ply_dataform_reg */ 133 0x00, /* 09/09 - if_conf */ 134 0x00, /* 0a/10 - pin_ctrl */ 135 0x00, /* 0b/11 - err_init_reg */ 136 0x0a, /* 0c/12 - id_reg */ 137 0x00, /* 0d/13 - reserved */ 138 0x00, /* 0e/14 - ply_upcount_reg */ 139 0x00, /* 0f/15 - ply_lowcount_reg */ 140 0x88, /* 10/16 - reserved/l_a1_inctrl */ 141 0x88, /* 11/17 - reserved/r_a1_inctrl */ 142 0x88, /* 12/18 - l_line_inctrl */ 143 0x88, /* 13/19 - r_line_inctrl */ 144 0x88, /* 14/20 - l_mic_inctrl */ 145 0x88, /* 15/21 - r_mic_inctrl */ 146 0x80, /* 16/22 - l_out_outctrl */ 147 0x80, /* 17/23 - r_out_outctrl */ 148 0x00, /* 18/24 - reserved */ 149 0x00, /* 19/25 - reserved */ 150 0x00, /* 1a/26 - reserved */ 151 0x00, /* 1b/27 - reserved */ 152 0x00, /* 1c/28 - cap_dataform_reg */ 153 0x00, /* 1d/29 - reserved */ 154 0x00, /* 1e/30 - cap_upcount_reg */ 155 0x00 /* 1f/31 - cap_lowcount_reg */ 120 156 }; 121 157 … … 896 932 } 897 933 898 staticvoid snd_cs4231_overrange(struct snd_cs4231 *chip)934 void snd_cs4231_overrange(struct snd_cs4231 *chip) 899 935 { 900 936 unsigned long flags; … … 1055 1091 (chip->image[CS4231_IFACE_CTRL] & ~CS4231_SINGLE_DMA) | 1056 1092 (chip->single_dma ? CS4231_SINGLE_DMA : 0); 1057 chip->image[CS4231_ALT_FEATURE_1] = 0x80; 1058 chip->image[CS4231_ALT_FEATURE_2] = chip->hardware == CS4231_HW_INTERWAVE ? 0xc2 : 0x01; 1093 if (chip->hardware != CS4231_HW_OPTI93X) { 1094 chip->image[CS4231_ALT_FEATURE_1] = 0x80; 1095 chip->image[CS4231_ALT_FEATURE_2] = 1096 chip->hardware == CS4231_HW_INTERWAVE ? 0xc2 : 0x01; 1097 } 1059 1098 ptr = (unsigned char *) &chip->image; 1060 1099 snd_cs4231_mce_down(chip); … … 1377 1416 case CS4231_HW_OPL3SA2: return chip->card->shortname; 1378 1417 case CS4231_HW_AD1845: return "AD1845"; 1418 case CS4231_HW_OPTI93X: return "OPTi 93x"; 1379 1419 default: return "???"; 1380 1420 } … … 1402 1442 chip->set_playback_format = snd_cs4231_playback_format; 1403 1443 chip->set_capture_format = snd_cs4231_capture_format; 1404 memcpy(&chip->image, &snd_cs4231_original_image, sizeof(snd_cs4231_original_image)); 1405 1444 if (chip->hardware == CS4231_HW_OPTI93X) 1445 memcpy(&chip->image, &snd_opti93x_original_image, 1446 sizeof(snd_opti93x_original_image)); 1447 else 1448 memcpy(&chip->image, &snd_cs4231_original_image, 1449 sizeof(snd_cs4231_original_image)); 1450 1406 1451 *rchip = chip; 1407 1452 return 0; … … 1791 1836 }; 1792 1837 1838 static struct snd_kcontrol_new snd_opti93x_controls[] = { 1839 CS4231_DOUBLE("Master Playback Switch", 0, 1840 OPTi93X_OUT_LEFT, OPTi93X_OUT_RIGHT, 7, 7, 1, 1), 1841 CS4231_DOUBLE("Master Playback Volume", 0, 1842 OPTi93X_OUT_LEFT, OPTi93X_OUT_RIGHT, 1, 1, 31, 1), 1843 CS4231_DOUBLE("PCM Playback Switch", 0, 1844 CS4231_LEFT_OUTPUT, CS4231_RIGHT_OUTPUT, 7, 7, 1, 1), 1845 CS4231_DOUBLE("PCM Playback Volume", 0, 1846 CS4231_LEFT_OUTPUT, CS4231_RIGHT_OUTPUT, 0, 0, 31, 1), 1847 CS4231_DOUBLE("FM Playback Switch", 0, 1848 CS4231_AUX2_LEFT_INPUT, CS4231_AUX2_RIGHT_INPUT, 7, 7, 1, 1), 1849 CS4231_DOUBLE("FM Playback Volume", 0, 1850 CS4231_AUX2_LEFT_INPUT, CS4231_AUX2_RIGHT_INPUT, 1, 1, 15, 1), 1851 CS4231_DOUBLE("Line Playback Switch", 0, 1852 CS4231_LEFT_LINE_IN, CS4231_RIGHT_LINE_IN, 7, 7, 1, 1), 1853 CS4231_DOUBLE("Line Playback Volume", 0, 1854 CS4231_LEFT_LINE_IN, CS4231_RIGHT_LINE_IN, 0, 0, 15, 1), 1855 CS4231_DOUBLE("Mic Playback Switch", 0, 1856 OPTi93X_MIC_LEFT_INPUT, OPTi93X_MIC_RIGHT_INPUT, 7, 7, 1, 1), 1857 CS4231_DOUBLE("Mic Playback Volume", 0, 1858 OPTi93X_MIC_LEFT_INPUT, OPTi93X_MIC_RIGHT_INPUT, 1, 1, 15, 1), 1859 CS4231_DOUBLE("Mic Boost", 0, 1860 CS4231_LEFT_INPUT, CS4231_RIGHT_INPUT, 5, 5, 1, 0), 1861 CS4231_DOUBLE("CD Playback Switch", 0, 1862 CS4231_AUX1_LEFT_INPUT, CS4231_AUX1_RIGHT_INPUT, 7, 7, 1, 1), 1863 CS4231_DOUBLE("CD Playback Volume", 0, 1864 CS4231_AUX1_LEFT_INPUT, CS4231_AUX1_RIGHT_INPUT, 1, 1, 15, 1), 1865 CS4231_DOUBLE("Aux Playback Switch", 0, 1866 OPTi931_AUX_LEFT_INPUT, OPTi931_AUX_RIGHT_INPUT, 7, 7, 1, 1), 1867 CS4231_DOUBLE("Aux Playback Volume", 0, 1868 OPTi931_AUX_LEFT_INPUT, OPTi931_AUX_RIGHT_INPUT, 1, 1, 15, 1), 1869 CS4231_DOUBLE("Capture Volume", 0, 1870 CS4231_LEFT_INPUT, CS4231_RIGHT_INPUT, 0, 0, 15, 0), 1871 { 1872 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 1873 .name = "Capture Source", 1874 .info = snd_cs4231_info_mux, 1875 .get = snd_cs4231_get_mux, 1876 .put = snd_cs4231_put_mux, 1877 } 1878 }; 1879 1793 1880 int snd_cs4231_mixer(struct snd_cs4231 *chip) 1794 1881 { … … 1803 1890 strcpy(card->mixername, chip->pcm->name); 1804 1891 1805 for (idx = 0; idx < ARRAY_SIZE(snd_cs4231_controls); idx++) { 1806 if ((err = snd_ctl_add(card, snd_ctl_new1(&snd_cs4231_controls[idx], chip))) < 0) 1807 return err; 1808 } 1892 if (chip->hardware == CS4231_HW_OPTI93X) 1893 for (idx = 0; idx < ARRAY_SIZE(snd_opti93x_controls); idx++) { 1894 err = snd_ctl_add(card, 1895 snd_ctl_new1(&snd_opti93x_controls[idx], 1896 chip)); 1897 if (err < 0) 1898 return err; 1899 } 1900 else 1901 for (idx = 0; idx < ARRAY_SIZE(snd_cs4231_controls); idx++) { 1902 err = snd_ctl_add(card, 1903 snd_ctl_new1(&snd_cs4231_controls[idx], 1904 chip)); 1905 if (err < 0) 1906 return err; 1907 } 1809 1908 return 0; 1810 1909 } … … 1816 1915 EXPORT_SYMBOL(snd_cs4231_mce_up); 1817 1916 EXPORT_SYMBOL(snd_cs4231_mce_down); 1917 EXPORT_SYMBOL(snd_cs4231_overrange); 1818 1918 EXPORT_SYMBOL(snd_cs4231_interrupt); 1819 1919 EXPORT_SYMBOL(snd_cs4231_chip_id); -
GPL/branches/uniaud32-2.0/alsa-kernel/isa/opti9xx/opti92x-ad1848.c
r305 r358 34 34 #include <asm/dma.h> 35 35 #include <sound/core.h> 36 #if def CS423136 #if defined(CS4231) || defined(OPTi93X) 37 37 #include <sound/cs4231.h> 38 38 #else 39 #ifndef OPTi93X40 39 #include <sound/ad1848.h> 41 #else42 #include <sound/control.h>43 #include <sound/pcm.h>44 #endif /* OPTi93X */45 40 #endif /* CS4231 */ 46 41 #include <sound/mpu401.h> … … 110 105 #endif /* CS4231 || OPTi93X */ 111 106 112 #define OPTi9XX_HW_DETECT 0113 107 #define OPTi9XX_HW_82C928 1 114 108 #define OPTi9XX_HW_82C929 2 … … 124 118 #ifdef OPTi93X 125 119 126 #define OPTi93X_INDEX 0x00127 #define OPTi93X_DATA 0x01128 120 #define OPTi93X_STATUS 0x02 129 #define OPTi93X_DDATA 0x03130 121 #define OPTi93X_PORT(chip, r) ((chip)->port + OPTi93X_##r) 131 132 #define OPTi93X_MIXOUT_LEFT 0x00133 #define OPTi93X_MIXOUT_RIGHT 0x01134 #define OPTi93X_CD_LEFT_INPUT 0x02135 #define OPTi93X_CD_RIGHT_INPUT 0x03136 #define OPTi930_AUX_LEFT_INPUT 0x04137 #define OPTi930_AUX_RIGHT_INPUT 0x05138 #define OPTi931_FM_LEFT_INPUT 0x04139 #define OPTi931_FM_RIGHT_INPUT 0x05140 #define OPTi93X_DAC_LEFT 0x06141 #define OPTi93X_DAC_RIGHT 0x07142 #define OPTi93X_PLAY_FORMAT 0x08143 #define OPTi93X_IFACE_CONF 0x09144 #define OPTi93X_PIN_CTRL 0x0a145 #define OPTi93X_ERR_INIT 0x0b146 #define OPTi93X_ID 0x0c147 #define OPTi93X_PLAY_UPR_CNT 0x0e148 #define OPTi93X_PLAY_LWR_CNT 0x0f149 #define OPTi931_AUX_LEFT_INPUT 0x10150 #define OPTi931_AUX_RIGHT_INPUT 0x11151 #define OPTi93X_LINE_LEFT_INPUT 0x12152 #define OPTi93X_LINE_RIGHT_INPUT 0x13153 #define OPTi93X_MIC_LEFT_INPUT 0x14154 #define OPTi93X_MIC_RIGHT_INPUT 0x15155 #define OPTi93X_OUT_LEFT 0x16156 #define OPTi93X_OUT_RIGHT 0x17157 #define OPTi93X_CAPT_FORMAT 0x1c158 #define OPTi93X_CAPT_UPR_CNT 0x1e159 #define OPTi93X_CAPT_LWR_CNT 0x1f160 161 #define OPTi93X_TRD 0x20162 #define OPTi93X_MCE 0x40163 #define OPTi93X_INIT 0x80164 165 #define OPTi93X_MIXOUT_MIC_GAIN 0x20166 #define OPTi93X_MIXOUT_LINE 0x00167 #define OPTi93X_MIXOUT_CD 0x40168 #define OPTi93X_MIXOUT_MIC 0x80169 #define OPTi93X_MIXOUT_MIXER 0xc0170 171 #define OPTi93X_STEREO 0x10172 #define OPTi93X_LINEAR_8 0x00173 #define OPTi93X_ULAW_8 0x20174 #define OPTi93X_LINEAR_16_LIT 0x40175 #define OPTi93X_ALAW_8 0x60176 #define OPTi93X_ADPCM_16 0xa0177 #define OPTi93X_LINEAR_16_BIG 0xc0178 179 #define OPTi93X_CAPTURE_PIO 0x80180 #define OPTi93X_PLAYBACK_PIO 0x40181 #define OPTi93X_AUTOCALIB 0x08182 #define OPTi93X_SINGLE_DMA 0x04183 #define OPTi93X_CAPTURE_ENABLE 0x02184 #define OPTi93X_PLAYBACK_ENABLE 0x01185 186 #define OPTi93X_IRQ_ENABLE 0x02187 188 #define OPTi93X_DMA_REQUEST 0x10189 #define OPTi93X_CALIB_IN_PROGRESS 0x20190 122 191 123 #define OPTi93X_IRQ_PLAYBACK 0x04 192 124 #define OPTi93X_IRQ_CAPTURE 0x08 193 194 195 struct snd_opti93x {196 unsigned long port;197 struct resource *res_port;198 int irq;199 int dma1;200 int dma2;201 202 struct snd_opti9xx *chip;203 unsigned short hardware;204 unsigned char image[32];205 206 unsigned char mce_bit;207 unsigned short mode;208 int mute;209 210 spinlock_t lock;211 212 struct snd_card *card;213 struct snd_pcm *pcm;214 struct snd_pcm_substream *playback_substream;215 struct snd_pcm_substream *capture_substream;216 unsigned int p_dma_size;217 unsigned int c_dma_size;218 };219 220 #define OPTi93X_MODE_NONE 0x00221 #define OPTi93X_MODE_PLAY 0x01222 #define OPTi93X_MODE_CAPTURE 0x02223 #define OPTi93X_MODE_OPEN (OPTi93X_MODE_PLAY | OPTi93X_MODE_CAPTURE)224 125 225 126 #endif /* OPTi93X */ … … 235 136 #ifdef OPTi93X 236 137 unsigned long mc_indir_index; 138 struct snd_cs4231 *codec; 237 139 #endif /* OPTi93X */ 238 140 unsigned long pwd_reg; … … 492 394 493 395 #else /* OPTi93X */ 494 case OPTi9XX_HW_82C930:495 396 case OPTi9XX_HW_82C931: 496 397 case OPTi9XX_HW_82C933: 497 snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(6), 0x02, 0x03); 498 snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(3), 0x00, 0xff); 499 snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(4), 0x10 | 500 (chip->hardware == OPTi9XX_HW_82C930 ? 0x00 : 0x04), 501 0x34); 502 snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(5), 0x20, 0xbf); 503 /* 398 /* 504 399 * The BTC 1817DW has QS1000 wavetable which is connected 505 400 * to the serial digital input of the OPTI931. … … 511 406 */ 512 407 snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(26), 0x01, 0x01); 408 case OPTi9XX_HW_82C930: /* FALL THROUGH */ 409 snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(6), 0x02, 0x03); 410 snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(3), 0x00, 0xff); 411 snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(4), 0x10 | 412 (chip->hardware == OPTi9XX_HW_82C930 ? 0x00 : 0x04), 413 0x34); 414 snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(5), 0x20, 0xbf); 513 415 break; 514 416 #endif /* OPTi93X */ … … 655 557 #ifdef OPTi93X 656 558 657 static unsigned char snd_opti93x_default_image[32] =658 {659 0x00, /* 00/00 - l_mixout_outctrl */660 0x00, /* 01/01 - r_mixout_outctrl */661 0x88, /* 02/02 - l_cd_inctrl */662 0x88, /* 03/03 - r_cd_inctrl */663 0x88, /* 04/04 - l_a1/fm_inctrl */664 0x88, /* 05/05 - r_a1/fm_inctrl */665 0x80, /* 06/06 - l_dac_inctrl */666 0x80, /* 07/07 - r_dac_inctrl */667 0x00, /* 08/08 - ply_dataform_reg */668 0x00, /* 09/09 - if_conf */669 0x00, /* 0a/10 - pin_ctrl */670 0x00, /* 0b/11 - err_init_reg */671 0x0a, /* 0c/12 - id_reg */672 0x00, /* 0d/13 - reserved */673 0x00, /* 0e/14 - ply_upcount_reg */674 0x00, /* 0f/15 - ply_lowcount_reg */675 0x88, /* 10/16 - reserved/l_a1_inctrl */676 0x88, /* 11/17 - reserved/r_a1_inctrl */677 0x88, /* 12/18 - l_line_inctrl */678 0x88, /* 13/19 - r_line_inctrl */679 0x88, /* 14/20 - l_mic_inctrl */680 0x88, /* 15/21 - r_mic_inctrl */681 0x80, /* 16/22 - l_out_outctrl */682 0x80, /* 17/23 - r_out_outctrl */683 0x00, /* 18/24 - reserved */684 0x00, /* 19/25 - reserved */685 0x00, /* 1a/26 - reserved */686 0x00, /* 1b/27 - reserved */687 0x00, /* 1c/28 - cap_dataform_reg */688 0x00, /* 1d/29 - reserved */689 0x00, /* 1e/30 - cap_upcount_reg */690 0x00 /* 1f/31 - cap_lowcount_reg */691 };692 693 694 static int snd_opti93x_busy_wait(struct snd_opti93x *chip)695 {696 int timeout;697 698 for (timeout = 250; timeout-- > 0; udelay(10))699 if (!(inb(OPTi93X_PORT(chip, INDEX)) & OPTi93X_INIT))700 return 0;701 702 snd_printk("chip still busy.\n");703 return -EBUSY;704 }705 706 static unsigned char snd_opti93x_in(struct snd_opti93x *chip, unsigned char reg)707 {708 snd_opti93x_busy_wait(chip);709 outb(chip->mce_bit | (reg & 0x1f), OPTi93X_PORT(chip, INDEX));710 return inb(OPTi93X_PORT(chip, DATA));711 }712 713 static void snd_opti93x_out(struct snd_opti93x *chip, unsigned char reg,714 unsigned char value)715 {716 snd_opti93x_busy_wait(chip);717 outb(chip->mce_bit | (reg & 0x1f), OPTi93X_PORT(chip, INDEX));718 outb(value, OPTi93X_PORT(chip, DATA));719 }720 721 static void snd_opti93x_out_image(struct snd_opti93x *chip, unsigned char reg,722 unsigned char value)723 {724 snd_opti93x_out(chip, reg, chip->image[reg] = value);725 }726 727 static void snd_opti93x_out_mask(struct snd_opti93x *chip, unsigned char reg,728 unsigned char mask, unsigned char value)729 {730 snd_opti93x_out_image(chip, reg,731 (chip->image[reg] & ~mask) | (value & mask));732 }733 734 735 static void snd_opti93x_mce_up(struct snd_opti93x *chip)736 {737 snd_opti93x_busy_wait(chip);738 739 chip->mce_bit = OPTi93X_MCE;740 if (!(inb(OPTi93X_PORT(chip, INDEX)) & OPTi93X_MCE))741 outb(chip->mce_bit, OPTi93X_PORT(chip, INDEX));742 }743 744 static void snd_opti93x_mce_down(struct snd_opti93x *chip)745 {746 snd_opti93x_busy_wait(chip);747 748 chip->mce_bit = 0;749 if (inb(OPTi93X_PORT(chip, INDEX)) & OPTi93X_MCE)750 outb(chip->mce_bit, OPTi93X_PORT(chip, INDEX));751 }752 753 #define snd_opti93x_mute_reg(chip, reg, mute) \754 snd_opti93x_out(chip, reg, mute ? 0x80 : chip->image[reg]);755 756 static void snd_opti93x_mute(struct snd_opti93x *chip, int mute)757 {758 mute = mute ? 1 : 0;759 if (chip->mute == mute)760 return;761 762 chip->mute = mute;763 764 snd_opti93x_mute_reg(chip, OPTi93X_CD_LEFT_INPUT, mute);765 snd_opti93x_mute_reg(chip, OPTi93X_CD_RIGHT_INPUT, mute);766 switch (chip->hardware) {767 case OPTi9XX_HW_82C930:768 snd_opti93x_mute_reg(chip, OPTi930_AUX_LEFT_INPUT, mute);769 snd_opti93x_mute_reg(chip, OPTi930_AUX_RIGHT_INPUT, mute);770 break;771 case OPTi9XX_HW_82C931:772 case OPTi9XX_HW_82C933:773 snd_opti93x_mute_reg(chip, OPTi931_FM_LEFT_INPUT, mute);774 snd_opti93x_mute_reg(chip, OPTi931_FM_RIGHT_INPUT, mute);775 snd_opti93x_mute_reg(chip, OPTi931_AUX_LEFT_INPUT, mute);776 snd_opti93x_mute_reg(chip, OPTi931_AUX_RIGHT_INPUT, mute);777 }778 snd_opti93x_mute_reg(chip, OPTi93X_DAC_LEFT, mute);779 snd_opti93x_mute_reg(chip, OPTi93X_DAC_RIGHT, mute);780 snd_opti93x_mute_reg(chip, OPTi93X_LINE_LEFT_INPUT, mute);781 snd_opti93x_mute_reg(chip, OPTi93X_LINE_RIGHT_INPUT, mute);782 snd_opti93x_mute_reg(chip, OPTi93X_MIC_LEFT_INPUT, mute);783 snd_opti93x_mute_reg(chip, OPTi93X_MIC_RIGHT_INPUT, mute);784 snd_opti93x_mute_reg(chip, OPTi93X_OUT_LEFT, mute);785 snd_opti93x_mute_reg(chip, OPTi93X_OUT_RIGHT, mute);786 }787 788 789 static unsigned int snd_opti93x_get_count(unsigned char format,790 unsigned int size)791 {792 switch (format & 0xe0) {793 case OPTi93X_LINEAR_16_LIT:794 case OPTi93X_LINEAR_16_BIG:795 size >>= 1;796 break;797 case OPTi93X_ADPCM_16:798 return size >> 2;799 }800 return (format & OPTi93X_STEREO) ? (size >> 1) : size;801 }802 803 static unsigned int rates[] = { 5512, 6615, 8000, 9600, 11025, 16000,804 18900, 22050, 27428, 32000, 33075, 37800,805 44100, 48000 };806 #define RATES ARRAY_SIZE(rates)807 808 static struct snd_pcm_hw_constraint_list hw_constraints_rates = {809 .count = RATES,810 .list = rates,811 .mask = 0,812 };813 814 static unsigned char bits[] = { 0x01, 0x0f, 0x00, 0x0e, 0x03, 0x02,815 0x05, 0x07, 0x04, 0x06, 0x0d, 0x09,816 0x0b, 0x0c};817 818 static unsigned char snd_opti93x_get_freq(unsigned int rate)819 {820 unsigned int i;821 822 for (i = 0; i < RATES; i++) {823 if (rate == rates[i])824 return bits[i];825 }826 snd_BUG();827 return bits[RATES-1];828 }829 830 static unsigned char snd_opti93x_get_format(struct snd_opti93x *chip,831 unsigned int format, int channels)832 {833 unsigned char retval = OPTi93X_LINEAR_8;834 835 switch (format) {836 case SNDRV_PCM_FORMAT_MU_LAW:837 retval = OPTi93X_ULAW_8;838 break;839 case SNDRV_PCM_FORMAT_A_LAW:840 retval = OPTi93X_ALAW_8;841 break;842 case SNDRV_PCM_FORMAT_S16_LE:843 retval = OPTi93X_LINEAR_16_LIT;844 break;845 case SNDRV_PCM_FORMAT_S16_BE:846 retval = OPTi93X_LINEAR_16_BIG;847 break;848 case SNDRV_PCM_FORMAT_IMA_ADPCM:849 retval = OPTi93X_ADPCM_16;850 }851 return (channels > 1) ? (retval | OPTi93X_STEREO) : retval;852 }853 854 855 static void snd_opti93x_playback_format(struct snd_opti93x *chip, unsigned char fmt)856 {857 unsigned char mask;858 859 snd_opti93x_mute(chip, 1);860 861 snd_opti93x_mce_up(chip);862 mask = (chip->mode & OPTi93X_MODE_CAPTURE) ? 0xf0 : 0xff;863 snd_opti93x_out_mask(chip, OPTi93X_PLAY_FORMAT, mask, fmt);864 snd_opti93x_mce_down(chip);865 866 snd_opti93x_mute(chip, 0);867 }868 869 static void snd_opti93x_capture_format(struct snd_opti93x *chip, unsigned char fmt)870 {871 snd_opti93x_mute(chip, 1);872 873 snd_opti93x_mce_up(chip);874 if (!(chip->mode & OPTi93X_MODE_PLAY))875 snd_opti93x_out_mask(chip, OPTi93X_PLAY_FORMAT, 0x0f, fmt);876 else877 fmt = chip->image[OPTi93X_PLAY_FORMAT] & 0xf0;878 snd_opti93x_out_image(chip, OPTi93X_CAPT_FORMAT, fmt);879 snd_opti93x_mce_down(chip);880 881 snd_opti93x_mute(chip, 0);882 }883 884 885 static int snd_opti93x_open(struct snd_opti93x *chip, unsigned int mode)886 {887 unsigned long flags;888 889 spin_lock_irqsave(&chip->lock, flags);890 891 if (chip->mode & mode) {892 spin_unlock_irqrestore(&chip->lock, flags);893 return -EAGAIN;894 }895 896 if (!(chip->mode & OPTi93X_MODE_OPEN)) {897 outb(0x00, OPTi93X_PORT(chip, STATUS));898 snd_opti93x_out_mask(chip, OPTi93X_PIN_CTRL,899 OPTi93X_IRQ_ENABLE, OPTi93X_IRQ_ENABLE);900 chip->mode = mode;901 }902 else903 chip->mode |= mode;904 905 spin_unlock_irqrestore(&chip->lock, flags);906 return 0;907 }908 909 static void snd_opti93x_close(struct snd_opti93x *chip, unsigned int mode)910 {911 unsigned long flags;912 913 spin_lock_irqsave(&chip->lock, flags);914 915 chip->mode &= ~mode;916 if (chip->mode & OPTi93X_MODE_OPEN) {917 spin_unlock_irqrestore(&chip->lock, flags);918 return;919 }920 921 snd_opti93x_mute(chip, 1);922 923 outb(0, OPTi93X_PORT(chip, STATUS));924 snd_opti93x_out_mask(chip, OPTi93X_PIN_CTRL, OPTi93X_IRQ_ENABLE,925 ~OPTi93X_IRQ_ENABLE);926 927 snd_opti93x_mce_up(chip);928 snd_opti93x_out_image(chip, OPTi93X_IFACE_CONF, 0x00);929 snd_opti93x_mce_down(chip);930 chip->mode = 0;931 932 snd_opti93x_mute(chip, 0);933 spin_unlock_irqrestore(&chip->lock, flags);934 }935 936 static int snd_opti93x_trigger(struct snd_pcm_substream *substream,937 unsigned char what, int cmd)938 {939 struct snd_opti93x *chip = snd_pcm_substream_chip(substream);940 941 switch (cmd) {942 case SNDRV_PCM_TRIGGER_START:943 case SNDRV_PCM_TRIGGER_STOP:944 {945 unsigned int what = 0;946 struct snd_pcm_substream *s;947 snd_pcm_group_for_each_entry(s, substream) {948 if (s == chip->playback_substream) {949 what |= OPTi93X_PLAYBACK_ENABLE;950 snd_pcm_trigger_done(s, substream);951 } else if (s == chip->capture_substream) {952 what |= OPTi93X_CAPTURE_ENABLE;953 snd_pcm_trigger_done(s, substream);954 }955 }956 spin_lock(&chip->lock);957 if (cmd == SNDRV_PCM_TRIGGER_START) {958 snd_opti93x_out_mask(chip, OPTi93X_IFACE_CONF, what, what);959 if (what & OPTi93X_CAPTURE_ENABLE)960 udelay(50);961 } else962 snd_opti93x_out_mask(chip, OPTi93X_IFACE_CONF, what, 0x00);963 spin_unlock(&chip->lock);964 break;965 }966 default:967 return -EINVAL;968 }969 return 0;970 }971 972 static int snd_opti93x_playback_trigger(struct snd_pcm_substream *substream, int cmd)973 {974 return snd_opti93x_trigger(substream,975 OPTi93X_PLAYBACK_ENABLE, cmd);976 }977 978 static int snd_opti93x_capture_trigger(struct snd_pcm_substream *substream, int cmd)979 {980 return snd_opti93x_trigger(substream,981 OPTi93X_CAPTURE_ENABLE, cmd);982 }983 984 static int snd_opti93x_hw_params(struct snd_pcm_substream *substream,985 struct snd_pcm_hw_params *hw_params)986 {987 return snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params));988 }989 990 991 static int snd_opti93x_hw_free(struct snd_pcm_substream *substream)992 {993 snd_pcm_lib_free_pages(substream);994 return 0;995 }996 997 998 static int snd_opti93x_playback_prepare(struct snd_pcm_substream *substream)999 {1000 struct snd_opti93x *chip = snd_pcm_substream_chip(substream);1001 struct snd_pcm_runtime *runtime = substream->runtime;1002 unsigned long flags;1003 unsigned char format;1004 unsigned int count = snd_pcm_lib_period_bytes(substream);1005 unsigned int size = snd_pcm_lib_buffer_bytes(substream);1006 1007 spin_lock_irqsave(&chip->lock, flags);1008 1009 chip->p_dma_size = size;1010 snd_opti93x_out_mask(chip, OPTi93X_IFACE_CONF,1011 OPTi93X_PLAYBACK_ENABLE | OPTi93X_PLAYBACK_PIO,1012 ~(OPTi93X_PLAYBACK_ENABLE | OPTi93X_PLAYBACK_PIO));1013 1014 snd_dma_program(chip->dma1, runtime->dma_addr, size,1015 DMA_MODE_WRITE | DMA_AUTOINIT);1016 1017 format = snd_opti93x_get_freq(runtime->rate);1018 format |= snd_opti93x_get_format(chip, runtime->format,1019 runtime->channels);1020 snd_opti93x_playback_format(chip, format);1021 format = chip->image[OPTi93X_PLAY_FORMAT];1022 1023 count = snd_opti93x_get_count(format, count) - 1;1024 snd_opti93x_out_image(chip, OPTi93X_PLAY_LWR_CNT, count);1025 snd_opti93x_out_image(chip, OPTi93X_PLAY_UPR_CNT, count >> 8);1026 1027 spin_unlock_irqrestore(&chip->lock, flags);1028 return 0;1029 }1030 1031 static int snd_opti93x_capture_prepare(struct snd_pcm_substream *substream)1032 {1033 struct snd_opti93x *chip = snd_pcm_substream_chip(substream);1034 struct snd_pcm_runtime *runtime = substream->runtime;1035 unsigned long flags;1036 unsigned char format;1037 unsigned int count = snd_pcm_lib_period_bytes(substream);1038 unsigned int size = snd_pcm_lib_buffer_bytes(substream);1039 1040 spin_lock_irqsave(&chip->lock, flags);1041 1042 chip->c_dma_size = size;1043 snd_opti93x_out_mask(chip, OPTi93X_IFACE_CONF,1044 OPTi93X_CAPTURE_ENABLE | OPTi93X_CAPTURE_PIO, 0);1045 1046 snd_dma_program(chip->dma2, runtime->dma_addr, size,1047 DMA_MODE_READ | DMA_AUTOINIT);1048 1049 format = snd_opti93x_get_freq(runtime->rate);1050 format |= snd_opti93x_get_format(chip, runtime->format,1051 runtime->channels);1052 snd_opti93x_capture_format(chip, format);1053 format = chip->image[OPTi93X_CAPT_FORMAT];1054 1055 count = snd_opti93x_get_count(format, count) - 1;1056 snd_opti93x_out_image(chip, OPTi93X_CAPT_LWR_CNT, count);1057 snd_opti93x_out_image(chip, OPTi93X_CAPT_UPR_CNT, count >> 8);1058 1059 spin_unlock_irqrestore(&chip->lock, flags);1060 return 0;1061 }1062 1063 static snd_pcm_uframes_t snd_opti93x_playback_pointer(struct snd_pcm_substream *substream)1064 {1065 struct snd_opti93x *chip = snd_pcm_substream_chip(substream);1066 size_t ptr;1067 1068 if (!(chip->image[OPTi93X_IFACE_CONF] & OPTi93X_PLAYBACK_ENABLE))1069 return 0;1070 1071 ptr = snd_dma_pointer(chip->dma1, chip->p_dma_size);1072 return bytes_to_frames(substream->runtime, ptr);1073 }1074 1075 static snd_pcm_uframes_t snd_opti93x_capture_pointer(struct snd_pcm_substream *substream)1076 {1077 struct snd_opti93x *chip = snd_pcm_substream_chip(substream);1078 size_t ptr;1079 1080 if (!(chip->image[OPTi93X_IFACE_CONF] & OPTi93X_CAPTURE_ENABLE))1081 return 0;1082 1083 ptr = snd_dma_pointer(chip->dma2, chip->c_dma_size);1084 return bytes_to_frames(substream->runtime, ptr);1085 }1086 1087 1088 static void snd_opti93x_overrange(struct snd_opti93x *chip)1089 {1090 unsigned long flags;1091 1092 spin_lock_irqsave(&chip->lock, flags);1093 1094 if (snd_opti93x_in(chip, OPTi93X_ERR_INIT) & (0x08 | 0x02))1095 chip->capture_substream->runtime->overrange++;1096 1097 spin_unlock_irqrestore(&chip->lock, flags);1098 }1099 1100 559 static irqreturn_t snd_opti93x_interrupt(int irq, void *dev_id) 1101 560 { 1102 struct snd_opti93x *codec = dev_id; 561 struct snd_cs4231 *codec = dev_id; 562 struct snd_opti9xx *chip = codec->card->private_data; 1103 563 unsigned char status; 1104 564 1105 status = snd_opti9xx_read(c odec->chip, OPTi9XX_MC_REG(11));565 status = snd_opti9xx_read(chip, OPTi9XX_MC_REG(11)); 1106 566 if ((status & OPTi93X_IRQ_PLAYBACK) && codec->playback_substream) 1107 567 snd_pcm_period_elapsed(codec->playback_substream); 1108 568 if ((status & OPTi93X_IRQ_CAPTURE) && codec->capture_substream) { 1109 snd_ opti93x_overrange(codec);569 snd_cs4231_overrange(codec); 1110 570 snd_pcm_period_elapsed(codec->capture_substream); 1111 571 } 1112 572 outb(0x00, OPTi93X_PORT(codec, STATUS)); 1113 573 return IRQ_HANDLED; 1114 }1115 1116 1117 static struct snd_pcm_hardware snd_opti93x_playback = {1118 .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED |1119 SNDRV_PCM_INFO_MMAP_VALID | SNDRV_PCM_INFO_SYNC_START),1120 .formats = (SNDRV_PCM_FMTBIT_MU_LAW | SNDRV_PCM_FMTBIT_A_LAW | SNDRV_PCM_FMTBIT_IMA_ADPCM |1121 SNDRV_PCM_FMTBIT_U8 | SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S16_BE),1122 .rates = SNDRV_PCM_RATE_KNOT | SNDRV_PCM_RATE_8000_48000,1123 .rate_min = 5512,1124 .rate_max = 48000,1125 .channels_min = 1,1126 .channels_max = 2,1127 .buffer_bytes_max = (128*1024),1128 .period_bytes_min = 64,1129 .period_bytes_max = (128*1024),1130 .periods_min = 1,1131 .periods_max = 1024,1132 .fifo_size = 0,1133 };1134 1135 static struct snd_pcm_hardware snd_opti93x_capture = {1136 .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED |1137 SNDRV_PCM_INFO_MMAP_VALID | SNDRV_PCM_INFO_SYNC_START),1138 .formats = (SNDRV_PCM_FMTBIT_MU_LAW | SNDRV_PCM_FMTBIT_A_LAW | SNDRV_PCM_FMTBIT_IMA_ADPCM |1139 SNDRV_PCM_FMTBIT_U8 | SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S16_BE),1140 .rates = SNDRV_PCM_RATE_8000_48000,1141 .rate_min = 5512,1142 .rate_max = 48000,1143 .channels_min = 1,1144 .channels_max = 2,1145 .buffer_bytes_max = (128*1024),1146 .period_bytes_min = 64,1147 .period_bytes_max = (128*1024),1148 .periods_min = 1,1149 .periods_max = 1024,1150 .fifo_size = 0,1151 };1152 1153 static int snd_opti93x_playback_open(struct snd_pcm_substream *substream)1154 {1155 int error;1156 struct snd_opti93x *chip = snd_pcm_substream_chip(substream);1157 struct snd_pcm_runtime *runtime = substream->runtime;1158 1159 if ((error = snd_opti93x_open(chip, OPTi93X_MODE_PLAY)) < 0)1160 return error;1161 snd_pcm_set_sync(substream);1162 chip->playback_substream = substream;1163 runtime->hw = snd_opti93x_playback;1164 snd_pcm_limit_isa_dma_size(chip->dma1, &runtime->hw.buffer_bytes_max);1165 snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_RATE, &hw_constraints_rates);1166 return error;1167 }1168 1169 static int snd_opti93x_capture_open(struct snd_pcm_substream *substream)1170 {1171 int error;1172 struct snd_opti93x *chip = snd_pcm_substream_chip(substream);1173 struct snd_pcm_runtime *runtime = substream->runtime;1174 1175 if ((error = snd_opti93x_open(chip, OPTi93X_MODE_CAPTURE)) < 0)1176 return error;1177 runtime->hw = snd_opti93x_capture;1178 snd_pcm_set_sync(substream);1179 chip->capture_substream = substream;1180 snd_pcm_limit_isa_dma_size(chip->dma2, &runtime->hw.buffer_bytes_max);1181 snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_RATE, &hw_constraints_rates);1182 return error;1183 }1184 1185 static int snd_opti93x_playback_close(struct snd_pcm_substream *substream)1186 {1187 struct snd_opti93x *chip = snd_pcm_substream_chip(substream);1188 1189 chip->playback_substream = NULL;1190 snd_opti93x_close(chip, OPTi93X_MODE_PLAY);1191 return 0;1192 }1193 1194 static int snd_opti93x_capture_close(struct snd_pcm_substream *substream)1195 {1196 struct snd_opti93x *chip = snd_pcm_substream_chip(substream);1197 1198 chip->capture_substream = NULL;1199 snd_opti93x_close(chip, OPTi93X_MODE_CAPTURE);1200 return 0;1201 }1202 1203 1204 static void snd_opti93x_init(struct snd_opti93x *chip)1205 {1206 unsigned long flags;1207 int i;1208 1209 spin_lock_irqsave(&chip->lock, flags);1210 snd_opti93x_mce_up(chip);1211 1212 for (i = 0; i < 32; i++)1213 snd_opti93x_out_image(chip, i, snd_opti93x_default_image[i]);1214 1215 snd_opti93x_mce_down(chip);1216 spin_unlock_irqrestore(&chip->lock, flags);1217 }1218 1219 static int snd_opti93x_probe(struct snd_opti93x *chip)1220 {1221 unsigned long flags;1222 unsigned char val;1223 1224 spin_lock_irqsave(&chip->lock, flags);1225 val = snd_opti93x_in(chip, OPTi93X_ID) & 0x0f;1226 spin_unlock_irqrestore(&chip->lock, flags);1227 1228 return (val == 0x0a) ? 0 : -ENODEV;1229 }1230 1231 static int snd_opti93x_free(struct snd_opti93x *chip)1232 {1233 release_and_free_resource(chip->res_port);1234 if (chip->dma1 >= 0) {1235 disable_dma(chip->dma1);1236 free_dma(chip->dma1);1237 }1238 if (chip->dma2 >= 0) {1239 disable_dma(chip->dma2);1240 free_dma(chip->dma2);1241 }1242 if (chip->irq >= 0) {1243 free_irq(chip->irq, chip);1244 }1245 kfree(chip);1246 return 0;1247 }1248 1249 static int snd_opti93x_dev_free(struct snd_device *device)1250 {1251 struct snd_opti93x *chip = device->device_data;1252 return snd_opti93x_free(chip);1253 }1254 1255 static const char *snd_opti93x_chip_id(struct snd_opti93x *codec)1256 {1257 switch (codec->hardware) {1258 case OPTi9XX_HW_82C930: return "82C930";1259 case OPTi9XX_HW_82C931: return "82C931";1260 case OPTi9XX_HW_82C933: return "82C933";1261 default: return "???";1262 }1263 }1264 1265 static int snd_opti93x_create(struct snd_card *card, struct snd_opti9xx *chip,1266 int dma1, int dma2,1267 struct snd_opti93x **rcodec)1268 {1269 static struct snd_device_ops ops = {1270 .dev_free = snd_opti93x_dev_free,1271 };1272 int error;1273 struct snd_opti93x *codec;1274 1275 *rcodec = NULL;1276 codec = kzalloc(sizeof(*codec), GFP_KERNEL);1277 if (codec == NULL)1278 return -ENOMEM;1279 codec->irq = -1;1280 codec->dma1 = -1;1281 codec->dma2 = -1;1282 1283 if ((codec->res_port = request_region(chip->wss_base + 4, 4, "OPTI93x CODEC")) == NULL) {1284 snd_printk(KERN_ERR "opti9xx: can't grab port 0x%lx\n", chip->wss_base + 4);1285 snd_opti93x_free(codec);1286 return -EBUSY;1287 }1288 if (request_dma(dma1, "OPTI93x - 1")) {1289 snd_printk(KERN_ERR "opti9xx: can't grab DMA1 %d\n", dma1);1290 snd_opti93x_free(codec);1291 return -EBUSY;1292 }1293 codec->dma1 = chip->dma1;1294 if (request_dma(dma2, "OPTI93x - 2")) {1295 snd_printk(KERN_ERR "opti9xx: can't grab DMA2 %d\n", dma2);1296 snd_opti93x_free(codec);1297 return -EBUSY;1298 }1299 codec->dma2 = chip->dma2;1300 1301 if (request_irq(chip->irq, snd_opti93x_interrupt, IRQF_DISABLED, DEV_NAME" - WSS", codec)) {1302 snd_printk(KERN_ERR "opti9xx: can't grab IRQ %d\n", chip->irq);1303 snd_opti93x_free(codec);1304 return -EBUSY;1305 }1306 1307 codec->card = card;1308 codec->port = chip->wss_base + 4;1309 codec->irq = chip->irq;1310 1311 spin_lock_init(&codec->lock);1312 codec->hardware = chip->hardware;1313 codec->chip = chip;1314 1315 if ((error = snd_opti93x_probe(codec))) {1316 snd_opti93x_free(codec);1317 return error;1318 }1319 1320 snd_opti93x_init(codec);1321 1322 /* Register device */1323 if ((error = snd_device_new(card, SNDRV_DEV_LOWLEVEL, codec, &ops)) < 0) {1324 snd_opti93x_free(codec);1325 return error;1326 }1327 1328 *rcodec = codec;1329 return 0;1330 }1331 1332 static struct snd_pcm_ops snd_opti93x_playback_ops = {1333 .open = snd_opti93x_playback_open,1334 .close = snd_opti93x_playback_close,1335 .ioctl = snd_pcm_lib_ioctl,1336 .hw_params = snd_opti93x_hw_params,1337 .hw_free = snd_opti93x_hw_free,1338 .prepare = snd_opti93x_playback_prepare,1339 .trigger = snd_opti93x_playback_trigger,1340 .pointer = snd_opti93x_playback_pointer,1341 };1342 1343 static struct snd_pcm_ops snd_opti93x_capture_ops = {1344 .open = snd_opti93x_capture_open,1345 .close = snd_opti93x_capture_close,1346 .ioctl = snd_pcm_lib_ioctl,1347 .hw_params = snd_opti93x_hw_params,1348 .hw_free = snd_opti93x_hw_free,1349 .prepare = snd_opti93x_capture_prepare,1350 .trigger = snd_opti93x_capture_trigger,1351 .pointer = snd_opti93x_capture_pointer,1352 };1353 1354 static int snd_opti93x_pcm(struct snd_opti93x *codec, int device, struct snd_pcm **rpcm)1355 {1356 int error;1357 struct snd_pcm *pcm;1358 1359 if ((error = snd_pcm_new(codec->card, "OPTi 82C93X", device, 1, 1, &pcm)) < 0)1360 return error;1361 1362 snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_opti93x_playback_ops);1363 snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_opti93x_capture_ops);1364 1365 pcm->private_data = codec;1366 pcm->info_flags = SNDRV_PCM_INFO_JOINT_DUPLEX;1367 1368 strcpy(pcm->name, snd_opti93x_chip_id(codec));1369 1370 snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV,1371 snd_dma_isa_data(),1372 64*1024, codec->dma1 > 3 || codec->dma2 > 3 ? 128*1024 : 64*1024);1373 1374 codec->pcm = pcm;1375 if (rpcm)1376 *rpcm = pcm;1377 return 0;1378 }1379 1380 /*1381 * MIXER part1382 */1383 1384 static int snd_opti93x_info_mux(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)1385 {1386 static char *texts[4] = {1387 "Line1", "Aux", "Mic", "Mix"1388 };1389 1390 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;1391 uinfo->count = 2;1392 uinfo->value.enumerated.items = 4;1393 if (uinfo->value.enumerated.item > 3)1394 uinfo->value.enumerated.item = 3;1395 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);1396 return 0;1397 }1398 1399 static int snd_opti93x_get_mux(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)1400 {1401 struct snd_opti93x *chip = snd_kcontrol_chip(kcontrol);1402 unsigned long flags;1403 1404 spin_lock_irqsave(&chip->lock, flags);1405 ucontrol->value.enumerated.item[0] = (chip->image[OPTi93X_MIXOUT_LEFT] & OPTi93X_MIXOUT_MIXER) >> 6;1406 ucontrol->value.enumerated.item[1] = (chip->image[OPTi93X_MIXOUT_RIGHT] & OPTi93X_MIXOUT_MIXER) >> 6;1407 spin_unlock_irqrestore(&chip->lock, flags);1408 return 0;1409 }1410 1411 static int snd_opti93x_put_mux(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)1412 {1413 struct snd_opti93x *chip = snd_kcontrol_chip(kcontrol);1414 unsigned long flags;1415 unsigned short left, right;1416 int change;1417 1418 if (ucontrol->value.enumerated.item[0] > 3 ||1419 ucontrol->value.enumerated.item[1] > 3)1420 return -EINVAL;1421 left = ucontrol->value.enumerated.item[0] << 6;1422 right = ucontrol->value.enumerated.item[1] << 6;1423 spin_lock_irqsave(&chip->lock, flags);1424 left = (chip->image[OPTi93X_MIXOUT_LEFT] & ~OPTi93X_MIXOUT_MIXER) | left;1425 right = (chip->image[OPTi93X_MIXOUT_RIGHT] & ~OPTi93X_MIXOUT_MIXER) | right;1426 change = left != chip->image[OPTi93X_MIXOUT_LEFT] ||1427 right != chip->image[OPTi93X_MIXOUT_RIGHT];1428 snd_opti93x_out_image(chip, OPTi93X_MIXOUT_LEFT, left);1429 snd_opti93x_out_image(chip, OPTi93X_MIXOUT_RIGHT, right);1430 spin_unlock_irqrestore(&chip->lock, flags);1431 return change;1432 }1433 1434 #if 01435 1436 #define OPTi93X_SINGLE(xname, xindex, reg, shift, mask, invert) \1437 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = xindex, \1438 .info = snd_opti93x_info_single, \1439 .get = snd_opti93x_get_single, .put = snd_opti93x_put_single, \1440 .private_value = reg | (shift << 8) | (mask << 16) | (invert << 24) }1441 1442 static int snd_opti93x_info_single(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)1443 {1444 int mask = (kcontrol->private_value >> 16) & 0xff;1445 1446 uinfo->type = mask == 1 ? SNDRV_CTL_ELEM_TYPE_BOOLEAN : SNDRV_CTL_ELEM_TYPE_INTEGER;1447 uinfo->count = 1;1448 uinfo->value.integer.min = 0;1449 uinfo->value.integer.max = mask;1450 return 0;1451 }1452 1453 static int snd_opti93x_get_single(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)1454 {1455 struct snd_opti93x *chip = snd_kcontrol_chip(kcontrol);1456 unsigned long flags;1457 int reg = kcontrol->private_value & 0xff;1458 int shift = (kcontrol->private_value >> 8) & 0xff;1459 int mask = (kcontrol->private_value >> 16) & 0xff;1460 int invert = (kcontrol->private_value >> 24) & 0xff;1461 1462 spin_lock_irqsave(&chip->lock, flags);1463 ucontrol->value.integer.value[0] = (chip->image[reg] >> shift) & mask;1464 spin_unlock_irqrestore(&chip->lock, flags);1465 if (invert)1466 ucontrol->value.integer.value[0] = mask - ucontrol->value.integer.value[0];1467 return 0;1468 }1469 1470 static int snd_opti93x_put_single(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)1471 {1472 struct snd_opti93x *chip = snd_kcontrol_chip(kcontrol);1473 unsigned long flags;1474 int reg = kcontrol->private_value & 0xff;1475 int shift = (kcontrol->private_value >> 8) & 0xff;1476 int mask = (kcontrol->private_value >> 16) & 0xff;1477 int invert = (kcontrol->private_value >> 24) & 0xff;1478 int change;1479 unsigned short val;1480 1481 val = (ucontrol->value.integer.value[0] & mask);1482 if (invert)1483 val = mask - val;1484 val <<= shift;1485 spin_lock_irqsave(&chip->lock, flags);1486 val = (chip->image[reg] & ~(mask << shift)) | val;1487 change = val != chip->image[reg];1488 snd_opti93x_out(chip, reg, val);1489 spin_unlock_irqrestore(&chip->lock, flags);1490 return change;1491 }1492 1493 #endif /* single */1494 1495 #define OPTi93X_DOUBLE(xname, xindex, left_reg, right_reg, shift_left, shift_right, mask, invert) \1496 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = xindex, \1497 .info = snd_opti93x_info_double, \1498 .get = snd_opti93x_get_double, .put = snd_opti93x_put_double, \1499 .private_value = left_reg | (right_reg << 8) | (shift_left << 16) | (shift_right << 19) | (mask << 24) | (invert << 22) }1500 1501 #define OPTi93X_DOUBLE_INVERT_INVERT(xctl) \1502 do { xctl.private_value ^= 22; } while (0)1503 #define OPTi93X_DOUBLE_CHANGE_REGS(xctl, left_reg, right_reg) \1504 do { xctl.private_value &= ~0x0000ffff; \1505 xctl.private_value |= left_reg | (right_reg << 8); } while (0)1506 1507 static int snd_opti93x_info_double(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)1508 {1509 int mask = (kcontrol->private_value >> 24) & 0xff;1510 1511 uinfo->type = mask == 1 ? SNDRV_CTL_ELEM_TYPE_BOOLEAN : SNDRV_CTL_ELEM_TYPE_INTEGER;1512 uinfo->count = 2;1513 uinfo->value.integer.min = 0;1514 uinfo->value.integer.max = mask;1515 return 0;1516 }1517 1518 static int snd_opti93x_get_double(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)1519 {1520 struct snd_opti93x *chip = snd_kcontrol_chip(kcontrol);1521 unsigned long flags;1522 int left_reg = kcontrol->private_value & 0xff;1523 int right_reg = (kcontrol->private_value >> 8) & 0xff;1524 int shift_left = (kcontrol->private_value >> 16) & 0x07;1525 int shift_right = (kcontrol->private_value >> 19) & 0x07;1526 int mask = (kcontrol->private_value >> 24) & 0xff;1527 int invert = (kcontrol->private_value >> 22) & 1;1528 1529 spin_lock_irqsave(&chip->lock, flags);1530 ucontrol->value.integer.value[0] = (chip->image[left_reg] >> shift_left) & mask;1531 ucontrol->value.integer.value[1] = (chip->image[right_reg] >> shift_right) & mask;1532 spin_unlock_irqrestore(&chip->lock, flags);1533 if (invert) {1534 ucontrol->value.integer.value[0] = mask - ucontrol->value.integer.value[0];1535 ucontrol->value.integer.value[1] = mask - ucontrol->value.integer.value[1];1536 }1537 return 0;1538 }1539 1540 static int snd_opti93x_put_double(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)1541 {1542 struct snd_opti93x *chip = snd_kcontrol_chip(kcontrol);1543 unsigned long flags;1544 int left_reg = kcontrol->private_value & 0xff;1545 int right_reg = (kcontrol->private_value >> 8) & 0xff;1546 int shift_left = (kcontrol->private_value >> 16) & 0x07;1547 int shift_right = (kcontrol->private_value >> 19) & 0x07;1548 int mask = (kcontrol->private_value >> 24) & 0xff;1549 int invert = (kcontrol->private_value >> 22) & 1;1550 int change;1551 unsigned short val1, val2;1552 1553 val1 = ucontrol->value.integer.value[0] & mask;1554 val2 = ucontrol->value.integer.value[1] & mask;1555 if (invert) {1556 val1 = mask - val1;1557 val2 = mask - val2;1558 }1559 val1 <<= shift_left;1560 val2 <<= shift_right;1561 spin_lock_irqsave(&chip->lock, flags);1562 val1 = (chip->image[left_reg] & ~(mask << shift_left)) | val1;1563 val2 = (chip->image[right_reg] & ~(mask << shift_right)) | val2;1564 change = val1 != chip->image[left_reg] || val2 != chip->image[right_reg];1565 snd_opti93x_out_image(chip, left_reg, val1);1566 snd_opti93x_out_image(chip, right_reg, val2);1567 spin_unlock_irqrestore(&chip->lock, flags);1568 return change;1569 }1570 1571 static struct snd_kcontrol_new snd_opti93x_controls[] __devinitdata = {1572 OPTi93X_DOUBLE("Master Playback Switch", 0, OPTi93X_OUT_LEFT, OPTi93X_OUT_RIGHT, 7, 7, 1, 1),1573 OPTi93X_DOUBLE("Master Playback Volume", 0, OPTi93X_OUT_LEFT, OPTi93X_OUT_RIGHT, 1, 1, 31, 1),1574 OPTi93X_DOUBLE("PCM Playback Switch", 0, OPTi93X_DAC_LEFT, OPTi93X_DAC_RIGHT, 7, 7, 1, 1),1575 OPTi93X_DOUBLE("PCM Playback Volume", 0, OPTi93X_DAC_LEFT, OPTi93X_DAC_RIGHT, 0, 0, 31, 1),1576 OPTi93X_DOUBLE("FM Playback Switch", 0, OPTi931_FM_LEFT_INPUT, OPTi931_FM_RIGHT_INPUT, 7, 7, 1, 1),1577 OPTi93X_DOUBLE("FM Playback Volume", 0, OPTi931_FM_LEFT_INPUT, OPTi931_FM_RIGHT_INPUT, 1, 1, 15, 1),1578 OPTi93X_DOUBLE("Line Playback Switch", 0, OPTi93X_LINE_LEFT_INPUT, OPTi93X_LINE_RIGHT_INPUT, 7, 7, 1, 1),1579 OPTi93X_DOUBLE("Line Playback Volume", 0, OPTi93X_LINE_LEFT_INPUT, OPTi93X_LINE_RIGHT_INPUT, 1, 1, 15, 1),1580 OPTi93X_DOUBLE("Mic Playback Switch", 0, OPTi93X_MIC_LEFT_INPUT, OPTi93X_MIC_RIGHT_INPUT, 7, 7, 1, 1),1581 OPTi93X_DOUBLE("Mic Playback Volume", 0, OPTi93X_MIC_LEFT_INPUT, OPTi93X_MIC_RIGHT_INPUT, 1, 1, 15, 1),1582 OPTi93X_DOUBLE("Mic Boost", 0, OPTi93X_MIXOUT_LEFT, OPTi93X_MIXOUT_RIGHT, 5, 5, 1, 1),1583 OPTi93X_DOUBLE("CD Playback Switch", 0, OPTi93X_CD_LEFT_INPUT, OPTi93X_CD_RIGHT_INPUT, 7, 7, 1, 1),1584 OPTi93X_DOUBLE("CD Playback Volume", 0, OPTi93X_CD_LEFT_INPUT, OPTi93X_CD_RIGHT_INPUT, 1, 1, 15, 1),1585 OPTi93X_DOUBLE("Aux Playback Switch", 0, OPTi931_AUX_LEFT_INPUT, OPTi931_AUX_RIGHT_INPUT, 7, 7, 1, 1),1586 OPTi93X_DOUBLE("Aux Playback Volume", 0, OPTi931_AUX_LEFT_INPUT, OPTi931_AUX_RIGHT_INPUT, 1, 1, 15, 1),1587 OPTi93X_DOUBLE("Capture Volume", 0, OPTi93X_MIXOUT_LEFT, OPTi93X_MIXOUT_RIGHT, 0, 0, 15, 0),1588 {1589 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,1590 .name = "Capture Source",1591 .info = snd_opti93x_info_mux,1592 .get = snd_opti93x_get_mux,1593 .put = snd_opti93x_put_mux,1594 }1595 };1596 1597 static int __devinit snd_opti93x_mixer(struct snd_opti93x *chip)1598 {1599 struct snd_card *card;1600 struct snd_kcontrol_new knew;1601 int err;1602 unsigned int idx;1603 1604 snd_assert(chip != NULL && chip->card != NULL, return -EINVAL);1605 1606 card = chip->card;1607 1608 strcpy(card->mixername, snd_opti93x_chip_id(chip));1609 1610 for (idx = 0; idx < ARRAY_SIZE(snd_opti93x_controls); idx++) {1611 knew = snd_opti93x_controls[idx];1612 if (chip->hardware == OPTi9XX_HW_82C930) {1613 if (strstr(knew.name, "FM")) /* skip FM controls */1614 continue;1615 else if (strcmp(knew.name, "Mic Playback Volume"))1616 OPTi93X_DOUBLE_INVERT_INVERT(knew);1617 else if (strstr(knew.name, "Aux"))1618 OPTi93X_DOUBLE_CHANGE_REGS(knew, OPTi930_AUX_LEFT_INPUT, OPTi930_AUX_RIGHT_INPUT);1619 else if (strcmp(knew.name, "PCM Playback Volume"))1620 OPTi93X_DOUBLE_INVERT_INVERT(knew);1621 else if (strcmp(knew.name, "Master Playback Volume"))1622 OPTi93X_DOUBLE_INVERT_INVERT(knew);1623 }1624 if ((err = snd_ctl_add(card, snd_ctl_new1(&snd_opti93x_controls[idx], chip))) < 0)1625 return err;1626 }1627 return 0;1628 574 } 1629 575 … … 1740 686 struct snd_opti9xx *chip = card->private_data; 1741 687 1742 if (chip) 688 if (chip) { 689 #ifdef OPTi93X 690 struct snd_cs4231 *codec = chip->codec; 691 if (codec->irq > 0) { 692 disable_irq(codec->irq); 693 free_irq(codec->irq, codec); 694 } 695 #endif 1743 696 release_and_free_resource(chip->res_mc_base); 697 } 1744 698 } 1745 699 … … 1749 703 int error; 1750 704 struct snd_opti9xx *chip = card->private_data; 1751 #if defined(OPTi93X) 1752 struct snd_opti93x *codec; 1753 #elif defined(CS4231) 705 #if defined(CS4231) || defined(OPTi93X) 1754 706 struct snd_cs4231 *codec; 707 #ifdef CS4231 1755 708 struct snd_timer *timer; 709 #endif 1756 710 #else 1757 711 struct snd_ad1848 *codec; … … 1785 739 return error; 1786 740 1787 #if defined(OPTi93X) 1788 if ((error = snd_opti93x_create(card, chip, chip->dma1, chip->dma2, &codec))) 1789 return error; 1790 if ((error = snd_opti93x_pcm(codec, 0, &pcm)) < 0) 1791 return error; 1792 if ((error = snd_opti93x_mixer(codec)) < 0) 1793 return error; 1794 #elif defined(CS4231) 741 #if defined(CS4231) || defined(OPTi93X) 1795 742 if ((error = snd_cs4231_create(card, chip->wss_base + 4, -1, 1796 743 chip->irq, chip->dma1, chip->dma2, 1797 CS4231_HW_DETECT, 1798 0, 744 #ifdef CS4231 745 CS4231_HW_DETECT, 0, 746 #else /* OPTi93x */ 747 CS4231_HW_OPTI93X, CS4231_HWSHARE_IRQ, 748 #endif 1799 749 &codec)) < 0) 1800 750 return error; 751 #ifdef OPTi93X 752 chip->codec = codec; 753 #endif 1801 754 if ((error = snd_cs4231_pcm(codec, 0, &pcm)) < 0) 1802 755 return error; 1803 756 if ((error = snd_cs4231_mixer(codec)) < 0) 1804 757 return error; 758 #ifdef CS4231 1805 759 if ((error = snd_cs4231_timer(codec, 0, &timer)) < 0) 1806 760 return error; 761 #else /* OPTI93X */ 762 error = request_irq(chip->irq, snd_opti93x_interrupt, 763 IRQF_DISABLED, DEV_NAME" - WSS", codec); 764 if (error < 0) { 765 snd_printk(KERN_ERR "opti9xx: can't grab IRQ %d\n", chip->irq); 766 return error; 767 } 768 #endif 1807 769 #else 1808 770 if ((error = snd_ad1848_create(card, chip->wss_base + 4, -
GPL/branches/uniaud32-2.0/alsa-kernel/isa/sb/sb16_csp.c
r305 r358 332 332 if ((file_h.name != RIFF_HEADER) || 333 333 (le32_to_cpu(file_h.len) >= SNDRV_SB_CSP_MAX_MICROCODE_FILE_SIZE - sizeof(file_h))) { 334 snd_printd("%s: Invalid RIFF header\n", __ FUNCTION__);334 snd_printd("%s: Invalid RIFF header\n", __func__); 335 335 return -EINVAL; 336 336 } … … 341 341 return -EFAULT; 342 342 if (item_type != CSP__HEADER) { 343 snd_printd("%s: Invalid RIFF file type\n", __ FUNCTION__);343 snd_printd("%s: Invalid RIFF file type\n", __func__); 344 344 return -EINVAL; 345 345 } … … 396 396 397 397 if (code_h.name != MAIN_HEADER) { 398 snd_printd("%s: Missing 'main' microcode\n", __ FUNCTION__);398 snd_printd("%s: Missing 'main' microcode\n", __func__); 399 399 return -EINVAL; 400 400 } … … 440 440 p->mode = 0; 441 441 snd_printd("%s: Unsupported CSP codec type: 0x%04x\n", 442 __ FUNCTION__,442 __func__, 443 443 le16_to_cpu(funcdesc_h.VOC_type)); 444 444 return -EINVAL; … … 459 459 } 460 460 } 461 snd_printd("%s: Function #%d not found\n", __ FUNCTION__, info.func_req);461 snd_printd("%s: Function #%d not found\n", __func__, info.func_req); 462 462 return -EINVAL; 463 463 } … … 613 613 { 614 614 if (p->version < 0x10 || p->version > 0x1f) { 615 snd_printd("%s: Invalid CSP version: 0x%x\n", __ FUNCTION__, p->version);615 snd_printd("%s: Invalid CSP version: 0x%x\n", __func__, p->version); 616 616 return 1; 617 617 } … … 632 632 snd_sbdsp_command(p->chip, 0x01); /* CSP download command */ 633 633 if (snd_sbdsp_get_byte(p->chip)) { 634 snd_printd("%s: Download command failed\n", __ FUNCTION__);634 snd_printd("%s: Download command failed\n", __func__); 635 635 goto __fail; 636 636 } … … 659 659 } 660 660 if (status != 0x55) { 661 snd_printd("%s: Microcode initialization failed\n", __ FUNCTION__);661 snd_printd("%s: Microcode initialization failed\n", __func__); 662 662 goto __fail; 663 663 } … … 825 825 826 826 if (!(p->running & (SNDRV_SB_CSP_ST_LOADED | SNDRV_SB_CSP_ST_AUTO))) { 827 snd_printd("%s: Microcode not loaded\n", __ FUNCTION__);827 snd_printd("%s: Microcode not loaded\n", __func__); 828 828 return -ENXIO; 829 829 } 830 830 if (p->running & SNDRV_SB_CSP_ST_RUNNING) { 831 snd_printd("%s: CSP already running\n", __ FUNCTION__);831 snd_printd("%s: CSP already running\n", __func__); 832 832 return -EBUSY; 833 833 } 834 834 if (!(sample_width & p->acc_width)) { 835 snd_printd("%s: Unsupported PCM sample width\n", __ FUNCTION__);835 snd_printd("%s: Unsupported PCM sample width\n", __func__); 836 836 return -EINVAL; 837 837 } 838 838 if (!(channels & p->acc_channels)) { 839 snd_printd("%s: Invalid number of channels\n", __ FUNCTION__);839 snd_printd("%s: Invalid number of channels\n", __func__); 840 840 return -EINVAL; 841 841 } … … 859 859 860 860 if (set_codec_parameter(p->chip, 0x81, s_type)) { 861 snd_printd("%s: Set sample type command failed\n", __ FUNCTION__);861 snd_printd("%s: Set sample type command failed\n", __func__); 862 862 goto __fail; 863 863 } 864 864 if (set_codec_parameter(p->chip, 0x80, 0x00)) { 865 snd_printd("%s: Codec start command failed\n", __ FUNCTION__);865 snd_printd("%s: Codec start command failed\n", __func__); 866 866 goto __fail; 867 867 } -
GPL/branches/uniaud32-2.0/alsa-kernel/isa/sb/sb8_main.c
r305 r358 278 278 snd_sbdsp_command(chip, 256 - runtime->rate_den); 279 279 } 280 if (chip->capture_format != SB_DSP_ OUTPUT) {280 if (chip->capture_format != SB_DSP_INPUT) { 281 281 count--; 282 282 snd_sbdsp_command(chip, SB_DSP_BLOCK_SIZE); -
GPL/branches/uniaud32-2.0/alsa-kernel/isa/sb/sb_common.c
r305 r358 52 52 return 1; 53 53 } 54 snd_printd("%s [0x%lx]: timeout (0x%x)\n", __ FUNCTION__, chip->port, val);54 snd_printd("%s [0x%lx]: timeout (0x%x)\n", __func__, chip->port, val); 55 55 return 0; 56 56 } … … 69 69 } 70 70 } 71 snd_printd("%s [0x%lx]: timeout\n", __ FUNCTION__, chip->port);71 snd_printd("%s [0x%lx]: timeout\n", __func__, chip->port); 72 72 return -ENODEV; 73 73 } … … 88 88 break; 89 89 } 90 snd_printdd("%s [0x%lx] failed...\n", __ FUNCTION__, chip->port);90 snd_printdd("%s [0x%lx] failed...\n", __func__, chip->port); 91 91 return -ENODEV; 92 92 } -
GPL/branches/uniaud32-2.0/alsa-kernel/isa/sb/sb_mixer.c
r305 r358 926 926 { 927 927 unsigned char *val = chip->saved_regs; 928 snd_assert(num_regs >ARRAY_SIZE(chip->saved_regs), return);928 snd_assert(num_regs <= ARRAY_SIZE(chip->saved_regs), return); 929 929 for (; num_regs; num_regs--) 930 930 *val++ = snd_sbmixer_read(chip, *regs++); … … 934 934 { 935 935 unsigned char *val = chip->saved_regs; 936 snd_assert(num_regs >ARRAY_SIZE(chip->saved_regs), return);936 snd_assert(num_regs <= ARRAY_SIZE(chip->saved_regs), return); 937 937 for (; num_regs; num_regs--) 938 938 snd_sbmixer_write(chip, *regs++, *val++); -
GPL/branches/uniaud32-2.0/alsa-kernel/isa/wavefront/wavefront_synth.c
r305 r358 1944 1944 1945 1945 { 1946 unsigned char *buf;1946 const unsigned char *buf; 1947 1947 int len, err; 1948 1948 int section_cnt_downloaded = 0; -
GPL/branches/uniaud32-2.0/alsa-kernel/pci/ac97/ac97_codec.c
r339 r358 50 50 #ifdef CONFIG_SND_AC97_POWER_SAVE 51 51 static int power_save = CONFIG_SND_AC97_POWER_SAVE_DEFAULT; 52 module_param(power_save, bool, 0644); 53 MODULE_PARM_DESC(power_save, "Enable AC97 power-saving control"); 52 module_param(power_save, int, 0644); 53 MODULE_PARM_DESC(power_save, "Automatic power-saving timeout " 54 "(in second, 0 = disable)."); 54 55 #endif 55 56 /* … … 2338 2339 snd_ac97_write(ac97, AC97_POWERDOWN, power); 2339 2340 udelay(100); 2340 power |= AC97_PD_PR2 | AC97_PD_PR3; /* Analog Mixer powerdown*/2341 power |= AC97_PD_PR2; /* Analog Mixer powerdown (Vref on) */ 2341 2342 snd_ac97_write(ac97, AC97_POWERDOWN, power); 2342 2343 if (ac97_is_power_save_mode(ac97)) { 2344 power |= AC97_PD_PR3; /* Analog Mixer powerdown */ 2345 snd_ac97_write(ac97, AC97_POWERDOWN, power); 2343 2346 udelay(100); 2344 2347 /* AC-link powerdown, internal Clk disable */ … … 2406 2409 */ 2407 2410 schedule_delayed_work(&ac97->power_work, 2408 msecs_to_jiffies( 2000));2411 msecs_to_jiffies(power_save * 1000)); 2409 2412 else { 2410 2413 cancel_delayed_work(&ac97->power_work); -
GPL/branches/uniaud32-2.0/alsa-kernel/pci/ac97/ac97_patch.c
r305 r358 115 115 static int ac97_channel_mode_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) 116 116 { 117 static const char *texts[] = { "2ch", "4ch", "6ch" }; 118 if (kcontrol->private_value) 119 return ac97_enum_text_info(kcontrol, uinfo, texts, 2); /* 4ch only */ 120 return ac97_enum_text_info(kcontrol, uinfo, texts, 3); 117 static const char *texts[] = { "2ch", "4ch", "6ch", "8ch" }; 118 return ac97_enum_text_info(kcontrol, uinfo, texts, 119 kcontrol->private_value); 121 120 } 122 121 … … 134 133 unsigned char mode = ucontrol->value.enumerated.item[0]; 135 134 136 if (kcontrol->private_value) { 137 if (mode >= 2) 138 return -EINVAL; 139 } else { 140 if (mode >= 3) 141 return -EINVAL; 142 } 135 if (mode >= kcontrol->private_value) 136 return -EINVAL; 143 137 144 138 if (mode != ac97->channel_mode) { … … 159 153 .put = ac97_surround_jack_mode_put, \ 160 154 } 155 /* 6ch */ 161 156 #define AC97_CHANNEL_MODE_CTL \ 162 157 { \ … … 166 161 .get = ac97_channel_mode_get, \ 167 162 .put = ac97_channel_mode_put, \ 163 .private_value = 3, \ 168 164 } 165 /* 4ch */ 169 166 #define AC97_CHANNEL_MODE_4CH_CTL \ 170 167 { \ … … 174 171 .get = ac97_channel_mode_get, \ 175 172 .put = ac97_channel_mode_put, \ 176 .private_value = 1, \ 173 .private_value = 2, \ 174 } 175 /* 8ch */ 176 #define AC97_CHANNEL_MODE_8CH_CTL \ 177 { \ 178 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ 179 .name = "Channel Mode", \ 180 .info = ac97_channel_mode_info, \ 181 .get = ac97_channel_mode_get, \ 182 .put = ac97_channel_mode_put, \ 183 .private_value = 4, \ 177 184 } 178 185 … … 211 218 } 212 219 220 static inline int alc850_is_aux_back_surround(struct snd_ac97 *ac97) 221 { 222 return is_surround_on(ac97); 223 } 213 224 214 225 /* The following snd_ac97_ymf753_... items added by David Shust (dshust@shustring.com) */ … … 659 670 AC97_SINGLE("Mic 20dB Boost Switch", AC97_MIC, 7, 1, 0), 660 671 672 AC97_SINGLE("Master Left Inv Switch", AC97_MASTER, 6, 1, 0), 661 673 AC97_SINGLE("Master ZC Switch", AC97_MASTER, 7, 1, 0), 662 674 AC97_SINGLE("Headphone ZC Switch", AC97_HEADPHONE, 7, 1, 0), … … 1961 1973 val = ac97->regs[AC97_AD_MISC]; 1962 1974 ucontrol->value.integer.value[0] = !(val & AC97_AD198X_LOSEL); 1975 if (ac97->spec.ad18xx.lo_as_master) 1976 ucontrol->value.integer.value[0] = 1977 !ucontrol->value.integer.value[0]; 1963 1978 return 0; 1964 1979 } … … 1969 1984 unsigned short val; 1970 1985 1971 val = !ucontrol->value.integer.value[0] 1972 ? (AC97_AD198X_LOSEL | AC97_AD198X_HPSEL) : 0; 1986 val = !ucontrol->value.integer.value[0]; 1987 if (ac97->spec.ad18xx.lo_as_master) 1988 val = !val; 1989 val = val ? (AC97_AD198X_LOSEL | AC97_AD198X_HPSEL) : 0; 1973 1990 return snd_ac97_update_bits(ac97, AC97_AD_MISC, 1974 1991 AC97_AD198X_LOSEL | AC97_AD198X_HPSEL, val); … … 2021 2038 unsigned short val = 0; 2022 2039 /* clear LODIS if shared jack is to be used for Surround out */ 2023 if ( is_shared_linein(ac97))2040 if (!ac97->spec.ad18xx.lo_as_master && is_shared_linein(ac97)) 2024 2041 val |= (1 << 12); 2025 2042 /* clear CLDIS if shared jack is to be used for C/LFE out */ … … 2057 2074 static int patch_ad1888_specific(struct snd_ac97 *ac97) 2058 2075 { 2059 /* rename 0x04 as "Master" and 0x02 as "Master Surround" */ 2060 snd_ac97_rename_vol_ctl(ac97, "Master Playback", "Master Surround Playback"); 2061 snd_ac97_rename_vol_ctl(ac97, "Headphone Playback", "Master Playback"); 2076 if (!ac97->spec.ad18xx.lo_as_master) { 2077 /* rename 0x04 as "Master" and 0x02 as "Master Surround" */ 2078 snd_ac97_rename_vol_ctl(ac97, "Master Playback", 2079 "Master Surround Playback"); 2080 snd_ac97_rename_vol_ctl(ac97, "Headphone Playback", 2081 "Master Playback"); 2082 } 2062 2083 return patch_build_controls(ac97, snd_ac97_ad1888_controls, ARRAY_SIZE(snd_ac97_ad1888_controls)); 2063 2084 } … … 2078 2099 patch_ad1881(ac97); 2079 2100 ac97->build_ops = &patch_ad1888_build_ops; 2080 /* Switch FRONT/SURROUND LINE-OUT/HP-OUT default connection */ 2081 /* it seems that most vendors connect line-out connector to headphone out of AC'97 */ 2101 2102 /* 2103 * LO can be used as a real line-out on some devices, 2104 * and we need to revert the front/surround mixer switches 2105 */ 2106 if (ac97->subsystem_vendor == 0x1043 && 2107 ac97->subsystem_device == 0x1193) /* ASUS A9T laptop */ 2108 ac97->spec.ad18xx.lo_as_master = 1; 2109 2110 misc = snd_ac97_read(ac97, AC97_AD_MISC); 2082 2111 /* AD-compatible mode */ 2083 2112 /* Stereo mutes enabled */ 2084 misc = snd_ac97_read(ac97, AC97_AD_MISC); 2085 snd_ac97_write_cache(ac97, AC97_AD_MISC, misc | 2086 AC97_AD198X_LOSEL | 2087 AC97_AD198X_HPSEL | 2088 AC97_AD198X_MSPLT | 2089 AC97_AD198X_AC97NC); 2113 misc |= AC97_AD198X_MSPLT | AC97_AD198X_AC97NC; 2114 if (!ac97->spec.ad18xx.lo_as_master) 2115 /* Switch FRONT/SURROUND LINE-OUT/HP-OUT default connection */ 2116 /* it seems that most vendors connect line-out connector to 2117 * headphone out of AC'97 2118 */ 2119 misc |= AC97_AD198X_LOSEL | AC97_AD198X_HPSEL; 2120 2121 snd_ac97_write_cache(ac97, AC97_AD_MISC, misc); 2090 2122 ac97->flags |= AC97_STEREO_MUTES; 2091 2123 return 0; … … 2817 2849 #define AC97_ALC850_JACK_SELECT 0x76 2818 2850 #define AC97_ALC850_MISC1 0x7a 2851 #define AC97_ALC850_MULTICH 0x6a 2819 2852 2820 2853 static void alc850_update_jacks(struct snd_ac97 *ac97) 2821 2854 { 2822 2855 int shared; 2856 int aux_is_back_surround; 2823 2857 2824 2858 /* shared Line-In / Surround Out */ … … 2838 2872 snd_ac97_update_bits(ac97, AC97_ALC850_JACK_SELECT, 7 << 4, 2839 2873 shared ? (5<<4) : (1<<4)); 2874 2875 aux_is_back_surround = alc850_is_aux_back_surround(ac97); 2876 /* Aux is Back Surround */ 2877 snd_ac97_update_bits(ac97, AC97_ALC850_MULTICH, 1 << 10, 2878 aux_is_back_surround ? (1<<10) : (0<<10)); 2840 2879 } 2841 2880 … … 2844 2883 AC97_SINGLE("Mic Front Input Switch", AC97_ALC850_JACK_SELECT, 15, 1, 1), 2845 2884 AC97_SURROUND_JACK_MODE_CTL, 2846 AC97_CHANNEL_MODE_ CTL,2885 AC97_CHANNEL_MODE_8CH_CTL, 2847 2886 }; 2848 2887 … … 2870 2909 2871 2910 ac97->spec.dev_flags = 0; /* for IEC958 playback route - ALC655 compatible */ 2911 ac97->flags |= AC97_HAS_8CH; 2872 2912 2873 2913 /* assume only page 0 for writing cache */ … … 2879 2919 center on mic off, surround on line-in off 2880 2920 duplicate front off 2921 NB default bit 10=0 = Aux is Capture, not Back Surround 2881 2922 */ 2882 2923 snd_ac97_write_cache(ac97, AC97_ALC650_MULTICH, 1<<15); … … 3313 3354 }; 3314 3355 3356 static const char *slave_vols_vt1616[] = { 3357 "Front Playback Volume", 3358 "Surround Playback Volume", 3359 "Center Playback Volume", 3360 "LFE Playback Volume", 3361 NULL 3362 }; 3363 3364 static const char *slave_sws_vt1616[] = { 3365 "Front Playback Switch", 3366 "Surround Playback Switch", 3367 "Center Playback Switch", 3368 "LFE Playback Switch", 3369 NULL 3370 }; 3371 3372 /* find a mixer control element with the given name */ 3373 static struct snd_kcontrol *snd_ac97_find_mixer_ctl(struct snd_ac97 *ac97, 3374 const char *name) 3375 { 3376 struct snd_ctl_elem_id id; 3377 memset(&id, 0, sizeof(id)); 3378 id.iface = SNDRV_CTL_ELEM_IFACE_MIXER; 3379 strcpy(id.name, name); 3380 return snd_ctl_find_id(ac97->bus->card, &id); 3381 } 3382 3383 /* create a virtual master control and add slaves */ 3384 int snd_ac97_add_vmaster(struct snd_ac97 *ac97, char *name, 3385 const unsigned int *tlv, const char **slaves) 3386 { 3387 struct snd_kcontrol *kctl; 3388 const char **s; 3389 int err; 3390 3391 kctl = snd_ctl_make_virtual_master(name, tlv); 3392 if (!kctl) 3393 return -ENOMEM; 3394 err = snd_ctl_add(ac97->bus->card, kctl); 3395 if (err < 0) 3396 return err; 3397 3398 for (s = slaves; *s; s++) { 3399 struct snd_kcontrol *sctl; 3400 3401 sctl = snd_ac97_find_mixer_ctl(ac97, *s); 3402 if (!sctl) { 3403 snd_printdd("Cannot find slave %s, skipped\n", *s); 3404 continue; 3405 } 3406 err = snd_ctl_add_slave(kctl, sctl); 3407 if (err < 0) 3408 return err; 3409 } 3410 return 0; 3411 } 3412 3315 3413 static int patch_vt1616_specific(struct snd_ac97 * ac97) 3316 3414 { 3415 struct snd_kcontrol *kctl; 3317 3416 int err; 3318 3417 … … 3322 3421 if ((err = patch_build_controls(ac97, &snd_ac97_controls_vt1616[1], ARRAY_SIZE(snd_ac97_controls_vt1616) - 1)) < 0) 3323 3422 return err; 3423 3424 /* There is already a misnamed master switch. Rename it. */ 3425 kctl = snd_ac97_find_mixer_ctl(ac97, "Master Playback Volume"); 3426 if (!kctl) 3427 return -EINVAL; 3428 3429 snd_ac97_rename_vol_ctl(ac97, "Master Playback", "Front Playback"); 3430 3431 err = snd_ac97_add_vmaster(ac97, "Master Playback Volume", 3432 kctl->tlv.p, slave_vols_vt1616); 3433 if (err < 0) 3434 return err; 3435 3436 err = snd_ac97_add_vmaster(ac97, "Master Playback Switch", 3437 NULL, slave_sws_vt1616); 3438 if (err < 0) 3439 return err; 3440 3324 3441 return 0; 3325 3442 } … … 3427 3544 { 3428 3545 int err = 0; 3546 int val; 3429 3547 3430 3548 /* we choose to not fail out at this point, but we tell the … … 3437 3555 * headphone amplifier, like WinXP driver for EPIA SP 3438 3556 */ 3439 snd_ac97_write_cache(ac97, 0x5c, 0x20); 3557 /* We need to check the bit before writing it. 3558 * On some (many?) hardwares, setting bit actually clears it! 3559 */ 3560 val = snd_ac97_read(ac97, 0x5c); 3561 if (!(val & 0x20)) 3562 snd_ac97_write_cache(ac97, 0x5c, 0x20); 3563 3440 3564 ac97->ext_id |= AC97_EI_SPDIF; /* force the detection of spdif */ 3441 3565 ac97->rates[AC97_RATES_SPDIF] = SNDRV_PCM_RATE_44100 | SNDRV_PCM_RATE_48000; … … 3587 3711 ac97->build_ops = &patch_ucb1400_ops; 3588 3712 /* enable headphone driver and smart low power mode by default */ 3589 snd_ac97_write (ac97, 0x6a, 0x0050);3590 snd_ac97_write (ac97, 0x6c, 0x0030);3591 return 0; 3592 } 3713 snd_ac97_write_cache(ac97, 0x6a, 0x0050); 3714 snd_ac97_write_cache(ac97, 0x6c, 0x0030); 3715 return 0; 3716 } -
GPL/branches/uniaud32-2.0/alsa-kernel/pci/ac97/ac97_pcm.c
r305 r358 575 575 bus = pcm->bus; 576 576 if (cfg == AC97_PCM_CFG_SPDIF) { 577 int err;578 577 for (cidx = 0; cidx < 4; cidx++) 579 578 if (bus->codec[cidx] && (bus->codec[cidx]->ext_id & AC97_EI_SPDIF)) { -
GPL/branches/uniaud32-2.0/alsa-kernel/pci/ali5451/ali5451.c
r325 r358 1820 1820 { 1821 1821 struct snd_ali *codec = kcontrol->private_data; 1822 unsigned int enable;1823 1824 enable = ucontrol->value.integer.value[0] ? 1 : 0;1822 unsigned int spdif_enable; 1823 1824 spdif_enable = ucontrol->value.integer.value[0] ? 1 : 0; 1825 1825 1826 1826 spin_lock_irq(&codec->reg_lock); 1827 1827 switch (kcontrol->private_value) { 1828 1828 case 0: 1829 enable = (codec->spdif_mask & 0x02) ? 1 : 0;1829 spdif_enable = (codec->spdif_mask & 0x02) ? 1 : 0; 1830 1830 break; 1831 1831 case 1: 1832 enable = ((codec->spdif_mask & 0x02) &&1832 spdif_enable = ((codec->spdif_mask & 0x02) && 1833 1833 (codec->spdif_mask & 0x04)) ? 1 : 0; 1834 1834 break; 1835 1835 case 2: 1836 enable = (codec->spdif_mask & 0x01) ? 1 : 0;1836 spdif_enable = (codec->spdif_mask & 0x01) ? 1 : 0; 1837 1837 break; 1838 1838 default: 1839 1839 break; 1840 1840 } 1841 ucontrol->value.integer.value[0] = enable;1841 ucontrol->value.integer.value[0] = spdif_enable; 1842 1842 spin_unlock_irq(&codec->reg_lock); 1843 1843 return 0; … … 1848 1848 { 1849 1849 struct snd_ali *codec = kcontrol->private_data; 1850 unsigned int change = 0, enable = 0;1851 1852 enable = ucontrol->value.integer.value[0] ? 1 : 0;1850 unsigned int change = 0, spdif_enable = 0; 1851 1852 spdif_enable = ucontrol->value.integer.value[0] ? 1 : 0; 1853 1853 1854 1854 spin_lock_irq(&codec->reg_lock); … … 1856 1856 case 0: 1857 1857 change = (codec->spdif_mask & 0x02) ? 1 : 0; 1858 change = change ^ enable;1858 change = change ^ spdif_enable; 1859 1859 if (change) { 1860 if ( enable) {1860 if (spdif_enable) { 1861 1861 codec->spdif_mask |= 0x02; 1862 1862 snd_ali_enable_spdif_out(codec); … … 1870 1870 case 1: 1871 1871 change = (codec->spdif_mask & 0x04) ? 1 : 0; 1872 change = change ^ enable;1872 change = change ^ spdif_enable; 1873 1873 if (change && (codec->spdif_mask & 0x02)) { 1874 if ( enable) {1874 if (spdif_enable) { 1875 1875 codec->spdif_mask |= 0x04; 1876 1876 snd_ali_enable_spdif_chnout(codec); … … 1883 1883 case 2: 1884 1884 change = (codec->spdif_mask & 0x01) ? 1 : 0; 1885 change = change ^ enable;1885 change = change ^ spdif_enable; 1886 1886 if (change) { 1887 if ( enable) {1887 if (spdif_enable) { 1888 1888 codec->spdif_mask |= 0x01; 1889 1889 snd_ali_enable_spdif_in(codec); … … 2058 2058 if (codec->hw_initialized) 2059 2059 snd_ali_disable_address_interrupt(codec); 2060 if (codec->irq >= 0) { 2061 synchronize_irq(codec->irq); 2060 if (codec->irq >= 0) 2062 2061 free_irq(codec->irq, codec); 2063 }2064 2062 if (codec->port) 2065 2063 pci_release_regions(codec->pci); -
GPL/branches/uniaud32-2.0/alsa-kernel/pci/atiixp.c
r305 r358 1556 1556 goto __hw_end; 1557 1557 snd_atiixp_chip_stop(chip); 1558 synchronize_irq(chip->irq); 1558 1559 1559 __hw_end: 1560 1560 if (chip->irq >= 0) -
GPL/branches/uniaud32-2.0/alsa-kernel/pci/au88x0/au88x0.c
r305 r358 127 127 vortex_core_shutdown(vortex); 128 128 // Take down PCI interface. 129 synchronize_irq(vortex->irq);130 129 free_irq(vortex->irq, vortex); 131 130 iounmap(vortex->mmio); … … 221 220 222 221 alloc_out: 223 synchronize_irq(chip->irq);224 222 free_irq(chip->irq, chip); 225 223 irq_out: -
GPL/branches/uniaud32-2.0/alsa-kernel/pci/au88x0/au88x0_game.c
r305 r358 1 1 /* 2 * $Id: au88x0_game.c,v 1.9 2003/09/22 03:51:28 mjander Exp $3 *4 2 * Manuel Jander. 5 3 * -
GPL/branches/uniaud32-2.0/alsa-kernel/pci/au88x0/au88x0_pcm.c
r305 r358 499 499 500 500 /* create a pcm device */ 501 static int __devinit snd_vortex_new_pcm(vortex_t * 501 static int __devinit snd_vortex_new_pcm(vortex_t *chip, int idx, int nr) 502 502 { 503 503 struct snd_pcm *pcm; … … 506 506 int err, nr_capt; 507 507 508 if ( (chip == 0) || (idx < 0) || (idx >= VORTEX_PCM_LAST))508 if (!chip || idx < 0 || idx >= VORTEX_PCM_LAST) 509 509 return -ENODEV; 510 510 … … 515 515 else 516 516 nr_capt = 0; 517 if ((err =518 snd_pcm_new(chip->card, vortex_pcm_prettyname[idx], idx, nr,519 nr_capt, &pcm))< 0)517 err = snd_pcm_new(chip->card, vortex_pcm_prettyname[idx], idx, nr, 518 nr_capt, &pcm); 519 if (err < 0) 520 520 return err; 521 521 strcpy(pcm->name, vortex_pcm_name[idx]); -
GPL/branches/uniaud32-2.0/alsa-kernel/pci/bt87x.c
r319 r358 690 690 static int snd_bt87x_free(struct snd_bt87x *chip) 691 691 { 692 if (chip->mmio) {692 if (chip->mmio) 693 693 snd_bt87x_stop(chip); 694 if (chip->irq >= 0)695 synchronize_irq(chip->irq);696 697 iounmap(chip->mmio);698 }699 694 if (chip->irq >= 0) 700 695 free_irq(chip->irq, chip); 696 if (chip->mmio) 697 iounmap(chip->mmio); 701 698 pci_release_regions(chip->pci); 702 699 pci_disable_device(chip->pci); -
GPL/branches/uniaud32-2.0/alsa-kernel/pci/ca0106/ca0106_main.c
r325 r358 250 250 .gpio_type = 2, 251 251 .i2c_adc = 1 } , 252 /* Another MSI K8N Diamond MB, which has apprently a different SSID */ 253 { .serial = 0x10091102, 254 .name = "MSI K8N Diamond MB", 255 .gpio_type = 2, 256 .i2c_adc = 1 } , 252 257 /* Shuttle XPC SD31P which has an onboard Creative Labs 253 258 * Sound Blaster Live! 24-bit EAX … … 436 441 { 437 442 unsigned long flags; 438 unsigned int enable;439 443 unsigned int intr_enable; 444 440 445 spin_lock_irqsave(&emu->emu_lock, flags); 441 enable = inl(emu->port + INTE) | intrenb;442 outl( enable, emu->port + INTE);446 intr_enable = inl(emu->port + INTE) | intrenb; 447 outl(intr_enable, emu->port + INTE); 443 448 spin_unlock_irqrestore(&emu->emu_lock, flags); 444 449 } … … 447 452 { 448 453 unsigned long flags; 449 unsigned int enable;450 454 unsigned int intr_enable; 455 451 456 spin_lock_irqsave(&emu->emu_lock, flags); 452 enable = inl(emu->port + INTE) & ~intrenb;453 outl( enable, emu->port + INTE);457 intr_enable = inl(emu->port + INTE) & ~intrenb; 458 outl(intr_enable, emu->port + INTE); 454 459 spin_unlock_irqrestore(&emu->emu_lock, flags); 455 460 } … … 1115 1120 */ 1116 1121 } 1122 if (chip->irq >= 0) 1123 free_irq(chip->irq, chip); 1117 1124 // release the data 1118 1125 #if 1 … … 1124 1131 release_and_free_resource(chip->res_port); 1125 1132 1126 // release the irq1127 if (chip->irq >= 0)1128 free_irq(chip->irq, chip);1129 1133 pci_disable_device(chip->pci); 1130 1134 kfree(chip); -
GPL/branches/uniaud32-2.0/alsa-kernel/pci/ca0106/ca0106_mixer.c
r305 r358 651 651 #define ADD_CTLS(emu, ctls) \ 652 652 do { \ 653 int i, err; \653 int i, _err; \ 654 654 for (i = 0; i < ARRAY_SIZE(ctls); i++) { \ 655 err = snd_ctl_add(card, snd_ctl_new1(&ctls[i], emu)); \656 if ( err < 0) \657 return err; \655 _err = snd_ctl_add(card, snd_ctl_new1(&ctls[i], emu)); \ 656 if (_err < 0) \ 657 return _err; \ 658 658 } \ 659 659 } while (0) 660 661 static __devinitdata 662 DECLARE_TLV_DB_SCALE(snd_ca0106_master_db_scale, -6375, 50, 1); 663 664 static char *slave_vols[] __devinitdata = { 665 "Analog Front Playback Volume", 666 "Analog Rear Playback Volume", 667 "Analog Center/LFE Playback Volume", 668 "Analog Side Playback Volume", 669 "IEC958 Front Playback Volume", 670 "IEC958 Rear Playback Volume", 671 "IEC958 Center/LFE Playback Volume", 672 "IEC958 Unknown Playback Volume", 673 "CAPTURE feedback Playback Volume", 674 NULL 675 }; 676 677 static char *slave_sws[] __devinitdata = { 678 "Analog Front Playback Switch", 679 "Analog Rear Playback Switch", 680 "Analog Center/LFE Playback Switch", 681 "Analog Side Playback Switch", 682 "IEC958 Playback Switch", 683 NULL 684 }; 685 686 static void __devinit add_slaves(struct snd_card *card, 687 struct snd_kcontrol *master, char **list) 688 { 689 for (; *list; list++) { 690 struct snd_kcontrol *slave = ctl_find(card, *list); 691 if (slave) 692 snd_ctl_add_slave(master, slave); 693 } 694 } 660 695 661 696 int __devinit snd_ca0106_mixer(struct snd_ca0106 *emu) … … 664 699 struct snd_card *card = emu->card; 665 700 char **c; 701 struct snd_kcontrol *vmaster; 666 702 static char *ca0106_remove_ctls[] = { 667 703 "Master Mono Playback Switch", … … 720 756 if (emu->details->spi_dac == 1) 721 757 ADD_CTLS(emu, snd_ca0106_volume_spi_dac_ctls); 758 759 /* Create virtual master controls */ 760 vmaster = snd_ctl_make_virtual_master("Master Playback Volume", 761 snd_ca0106_master_db_scale); 762 if (!vmaster) 763 return -ENOMEM; 764 add_slaves(card, vmaster, slave_vols); 765 766 if (emu->details->spi_dac == 1) { 767 vmaster = snd_ctl_make_virtual_master("Master Playback Switch", 768 NULL); 769 if (!vmaster) 770 return -ENOMEM; 771 add_slaves(card, vmaster, slave_sws); 772 } 722 773 return 0; 723 774 } -
GPL/branches/uniaud32-2.0/alsa-kernel/pci/cmipci.c
r310 r358 2761 2761 2762 2762 for (idx = 0; idx < CM_SAVED_MIXERS; idx++) { 2763 struct snd_ctl_elem_id id;2763 struct snd_ctl_elem_id elem_id; 2764 2764 struct snd_kcontrol *ctl; 2765 memset(&id, 0, sizeof(id)); 2766 id.iface = SNDRV_CTL_ELEM_IFACE_MIXER; 2767 strcpy(id.name, cm_saved_mixer[idx].name); 2768 if ((ctl = snd_ctl_find_id(cm->card, &id)) != NULL) 2765 memset(&elem_id, 0, sizeof(elem_id)); 2766 elem_id.iface = SNDRV_CTL_ELEM_IFACE_MIXER; 2767 strcpy(elem_id.name, cm_saved_mixer[idx].name); 2768 ctl = snd_ctl_find_id(cm->card, &elem_id); 2769 if (ctl) 2769 2770 cm->mixer_res_ctl[idx] = ctl; 2770 2771 } … … 2949 2950 snd_cmipci_mixer_write(cm, 0, 0); 2950 2951 2951 synchronize_irq(cm->irq);2952 2953 2952 free_irq(cm->irq, cm); 2954 2953 } -
GPL/branches/uniaud32-2.0/alsa-kernel/pci/cs46xx/cs46xx_lib.c
r305 r358 2773 2773 free_irq(chip->irq, chip); 2774 2774 2775 if (chip->active_ctrl) 2776 chip->active_ctrl(chip, -chip->amplifier); 2777 2775 2778 for (idx = 0; idx < 5; idx++) { 2776 2779 struct snd_cs46xx_region *region = &chip->region.idx[idx]; … … 2780 2783 } 2781 2784 2782 if (chip->active_ctrl)2783 chip->active_ctrl(chip, -chip->amplifier);2784 2785 2785 #ifdef CONFIG_SND_CS46XX_NEW_DSP 2786 2786 if (chip->dsp_spos_instance) { -
GPL/branches/uniaud32-2.0/alsa-kernel/pci/emu10k1/emu10k1_main.c
r325 r358 1253 1253 snd_emu10k1_fx8010_tram_setup(emu, 0); 1254 1254 snd_emu10k1_done(emu); 1255 /* remove reserved page */1256 if (emu->reserved_page) {1257 snd_emu10k1_synth_free(emu, (struct snd_util_memblk *)emu->reserved_page);1258 emu->reserved_page = NULL;1259 }1260 1255 snd_emu10k1_free_efx(emu); 1261 1256 } … … 1266 1261 if (emu->emu1010.firmware_thread) 1267 1262 kthread_stop(emu->emu1010.firmware_thread); 1263 if (emu->irq >= 0) 1264 free_irq(emu->irq, emu); 1265 /* remove reserved page */ 1266 if (emu->reserved_page) { 1267 snd_emu10k1_synth_free(emu, 1268 (struct snd_util_memblk *)emu->reserved_page); 1269 emu->reserved_page = NULL; 1270 } 1268 1271 if (emu->memhdr) 1269 1272 snd_util_memhdr_free(emu->memhdr); … … 1277 1280 free_pm_buffer(emu); 1278 1281 #endif 1279 if (emu->irq >= 0)1280 free_irq(emu->irq, emu);1281 1282 if (emu->port) 1282 1283 pci_release_regions(emu->pci); … … 1531 1532 .spk71 = 1, 1532 1533 .spdif_bug = 1, 1534 .invert_shared_spdif = 1, /* digital/analog switch swapped */ 1533 1535 .adc_1361t = 1, /* 24 bit capture instead of 16bit. Fixes ALSA bug#324 */ 1534 1536 .ac97_chip = 1} , … … 1825 1827 emu->port = pci_resource_start(pci, 0); 1826 1828 1827 if (request_irq(pci->irq, snd_emu10k1_interrupt, IRQF_SHARED,1828 "EMU10K1", emu)) {1829 err = -EBUSY;1830 goto error;1831 }1832 emu->irq = pci->irq;1833 1834 1829 emu->max_cache_pages = max_cache_bytes >> PAGE_SHIFT; 1835 1830 if (snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(pci), … … 1893 1888 emu->fx8010.etram_pages.area = NULL; 1894 1889 emu->fx8010.etram_pages.bytes = 0; 1890 1891 /* irq handler must be registered after I/O ports are activated */ 1892 if (request_irq(pci->irq, snd_emu10k1_interrupt, IRQF_SHARED, 1893 "EMU10K1", emu)) { 1894 err = -EBUSY; 1895 goto error; 1896 } 1897 emu->irq = pci->irq; 1895 1898 1896 1899 /* -
GPL/branches/uniaud32-2.0/alsa-kernel/pci/emu10k1/emu10k1x.c
r325 r358 328 328 { 329 329 unsigned long flags; 330 unsigned int enable;331 330 unsigned int intr_enable; 331 332 332 spin_lock_irqsave(&emu->emu_lock, flags); 333 enable = inl(emu->port + INTE) | intrenb;334 outl( enable, emu->port + INTE);333 intr_enable = inl(emu->port + INTE) | intrenb; 334 outl(intr_enable, emu->port + INTE); 335 335 spin_unlock_irqrestore(&emu->emu_lock, flags); 336 336 } … … 339 339 { 340 340 unsigned long flags; 341 unsigned int enable;342 341 unsigned int intr_enable; 342 343 343 spin_lock_irqsave(&emu->emu_lock, flags); 344 enable = inl(emu->port + INTE) & ~intrenb;345 outl( enable, emu->port + INTE);344 intr_enable = inl(emu->port + INTE) & ~intrenb; 345 outl(intr_enable, emu->port + INTE); 346 346 spin_unlock_irqrestore(&emu->emu_lock, flags); 347 347 } … … 755 755 outl(HCFG_LOCKSOUNDCACHE, chip->port + HCFG); 756 756 757 /* release the irq */ 758 if (chip->irq >= 0) 759 free_irq(chip->irq, chip); 760 757 761 // release the i/o port 758 762 release_and_free_resource(chip->res_port); 759 760 // release the irq761 if (chip->irq >= 0)762 free_irq(chip->irq, chip);763 763 764 764 // release the DMA … … 796 796 // capture interrupt 797 797 if (status & (IPR_CAP_0_LOOP | IPR_CAP_0_HALF_LOOP)) { 798 struct emu10k1x_voice * pvoice = &chip->capture_voice;799 if ( pvoice->use)800 snd_emu10k1x_pcm_interrupt(chip, pvoice);798 struct emu10k1x_voice *cap_voice = &chip->capture_voice; 799 if (cap_voice->use) 800 snd_emu10k1x_pcm_interrupt(chip, cap_voice); 801 801 else 802 802 snd_emu10k1x_intr_disable(chip, -
GPL/branches/uniaud32-2.0/alsa-kernel/pci/emu10k1/emumixer.c
r305 r358 1579 1579 else 1580 1580 ucontrol->value.integer.value[0] = inl(emu->port + HCFG) & HCFG_GPOUT0 ? 1 : 0; 1581 if (emu->card_capabilities->invert_shared_spdif) 1582 ucontrol->value.integer.value[0] = 1583 !ucontrol->value.integer.value[0]; 1584 1581 1585 return 0; 1582 1586 } … … 1587 1591 unsigned long flags; 1588 1592 struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol); 1589 unsigned int reg, val ;1593 unsigned int reg, val, sw; 1590 1594 int change = 0; 1591 1595 1596 sw = ucontrol->value.integer.value[0]; 1597 if (emu->card_capabilities->invert_shared_spdif) 1598 sw = !sw; 1592 1599 spin_lock_irqsave(&emu->reg_lock, flags); 1593 1600 if ( emu->card_capabilities->i2c_adc) { … … 1595 1602 } else if (emu->audigy) { 1596 1603 reg = inl(emu->port + A_IOCFG); 1597 val = ucontrol->value.integer.value[0]? A_IOCFG_GPOUT0 : 0;1604 val = sw ? A_IOCFG_GPOUT0 : 0; 1598 1605 change = (reg & A_IOCFG_GPOUT0) != val; 1599 1606 if (change) { … … 1604 1611 } 1605 1612 reg = inl(emu->port + HCFG); 1606 val = ucontrol->value.integer.value[0]? HCFG_GPOUT0 : 0;1613 val = sw ? HCFG_GPOUT0 : 0; 1607 1614 change |= (reg & HCFG_GPOUT0) != val; 1608 1615 if (change) { -
GPL/branches/uniaud32-2.0/alsa-kernel/pci/emu10k1/emuproc.c
r305 r358 413 413 { 414 414 struct snd_emu10k1 *emu = entry->private_data; 415 intvalue;415 u32 value; 416 416 unsigned long flags; 417 417 int i; -
GPL/branches/uniaud32-2.0/alsa-kernel/pci/emu10k1/memory.c
r305 r358 438 438 } 439 439 440 /* release allocated pages */ 441 static void __synth_free_pages(struct snd_emu10k1 *emu, int first_page, 442 int last_page) 443 { 444 int page; 445 446 for (page = first_page; page <= last_page; page++) { 447 free_page((unsigned long)emu->page_ptr_table[page]); 448 emu->page_addr_table[page] = 0; 449 emu->page_ptr_table[page] = NULL; 450 } 451 } 452 440 453 /* 441 454 * allocate kernel pages … … 444 457 { 445 458 int page, first_page, last_page; 446 struct snd_dma_buffer dmab;447 459 448 460 emu10k1_memblk_init(blk); … … 450 462 /* allocate kernel pages */ 451 463 for (page = first_page; page <= last_page; page++) { 452 if (snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(emu->pci), 453 PAGE_SIZE, &dmab) < 0) 454 goto __fail; 455 if (! is_valid_page(emu, dmab.addr)) { 456 snd_dma_free_pages(&dmab); 457 goto __fail; 458 } 459 emu->page_addr_table[page] = dmab.addr; 460 emu->page_ptr_table[page] = dmab.area; 464 /* first try to allocate from <4GB zone */ 465 struct page *p = alloc_page(GFP_KERNEL | GFP_DMA32 | 466 __GFP_NOWARN); 467 if (!p || (page_to_pfn(p) & ~(emu->dma_mask >> PAGE_SHIFT))) { 468 if (p) 469 __free_page(p); 470 /* try to allocate from <16MB zone */ 471 p = alloc_page(GFP_ATOMIC | GFP_DMA | 472 __GFP_NORETRY | /* no OOM-killer */ 473 __GFP_NOWARN); 474 } 475 if (!p) { 476 __synth_free_pages(emu, first_page, page - 1); 477 return -ENOMEM; 478 } 479 emu->page_addr_table[page] = page_to_phys(p); 480 emu->page_ptr_table[page] = page_address(p); 461 481 } 462 482 return 0; 463 464 __fail:465 /* release allocated pages */466 last_page = page - 1;467 for (page = first_page; page <= last_page; page++) {468 dmab.area = emu->page_ptr_table[page];469 dmab.addr = emu->page_addr_table[page];470 dmab.bytes = PAGE_SIZE;471 snd_dma_free_pages(&dmab);472 emu->page_addr_table[page] = 0;473 emu->page_ptr_table[page] = NULL;474 }475 476 return -ENOMEM;477 483 } 478 484 … … 482 488 static int synth_free_pages(struct snd_emu10k1 *emu, struct snd_emu10k1_memblk *blk) 483 489 { 484 int page, first_page, last_page; 485 struct snd_dma_buffer dmab; 490 int first_page, last_page; 486 491 487 492 get_single_page_range(emu->memhdr, blk, &first_page, &last_page); 488 dmab.dev.type = SNDRV_DMA_TYPE_DEV; 489 dmab.dev.dev = snd_dma_pci_data(emu->pci); 490 for (page = first_page; page <= last_page; page++) { 491 if (emu->page_ptr_table[page] == NULL) 492 continue; 493 dmab.area = emu->page_ptr_table[page]; 494 dmab.addr = emu->page_addr_table[page]; 495 dmab.bytes = PAGE_SIZE; 496 snd_dma_free_pages(&dmab); 497 emu->page_addr_table[page] = 0; 498 emu->page_ptr_table[page] = NULL; 499 } 500 493 __synth_free_pages(emu, first_page, last_page); 501 494 return 0; 502 495 } -
GPL/branches/uniaud32-2.0/alsa-kernel/pci/ens1370.c
r305 r358 1636 1636 (!has_spdif && es1371_quirk_lookup(ensoniq, es1371_spdif_present))) { 1637 1637 struct snd_kcontrol *kctl; 1638 int i, i ndex= 0;1638 int i, is_spdif = 0; 1639 1639 1640 1640 ensoniq->spdif_default = ensoniq->spdif_stream = … … 1643 1643 1644 1644 if (ensoniq->u.es1371.ac97->ext_id & AC97_EI_SPDIF) 1645 i ndex++;1645 is_spdif++; 1646 1646 1647 1647 for (i = 0; i < ARRAY_SIZE(snd_es1371_mixer_spdif); i++) { … … 1649 1649 if (!kctl) 1650 1650 return -ENOMEM; 1651 kctl->id.index = i ndex;1651 kctl->id.index = is_spdif; 1652 1652 err = snd_ctl_add(card, kctl); 1653 1653 if (err < 0) … … 1911 1911 outl(0, ES_REG(ensoniq, SERIAL)); /* clear serial interface */ 1912 1912 #endif 1913 synchronize_irq(ensoniq->irq); 1913 if (ensoniq->irq >= 0) 1914 synchronize_irq(ensoniq->irq); 1914 1915 pci_set_power_state(ensoniq->pci, 3); 1915 1916 __hw_end: -
GPL/branches/uniaud32-2.0/alsa-kernel/pci/es1938.c
r325 r358 1489 1489 outb(0x00, SLIO_REG(chip, IRQCONTROL)); /* disable irqs */ 1490 1490 if (chip->irq >= 0) { 1491 synchronize_irq(chip->irq);1492 1491 free_irq(chip->irq, chip); 1493 1492 chip->irq = -1; … … 1579 1578 snd_es1938_free_gameport(chip); 1580 1579 1581 if (chip->irq >= 0) { 1582 synchronize_irq(chip->irq); 1580 if (chip->irq >= 0) 1583 1581 free_irq(chip->irq, chip); 1584 }1585 1582 pci_release_regions(chip->pci); 1586 1583 pci_disable_device(chip->pci); -
GPL/branches/uniaud32-2.0/alsa-kernel/pci/es1968.c
r325 r358 627 627 } 628 628 629 static int snd_es1968_ac97_wait_poll(struct es1968 *chip) 630 { 631 int timeout = 100000; 632 633 while (timeout-- > 0) { 634 if (!(inb(chip->io_port + ESM_AC97_INDEX) & 1)) 635 return 0; 636 } 637 snd_printd("es1968: ac97 timeout\n"); 638 return 1; /* timeout */ 639 } 640 629 641 static void snd_es1968_ac97_write(struct snd_ac97 *ac97, unsigned short reg, unsigned short val) 630 642 { … … 655 667 /*msleep(1);*/ 656 668 657 if (! snd_es1968_ac97_wait(chip)) {669 if (!snd_es1968_ac97_wait_poll(chip)) { 658 670 data = inw(chip->io_port + ESM_AC97_DATA); 659 671 /*msleep(1);*/ … … 1824 1836 1825 1837 return 0; 1838 } 1839 /* 1840 * suppress jitter on some maestros when playing stereo 1841 */ 1842 static void snd_es1968_suppress_jitter(struct es1968 *chip, struct esschan *es) 1843 { 1844 unsigned int cp1; 1845 unsigned int cp2; 1846 unsigned int diff; 1847 1848 cp1 = __apu_get_register(chip, 0, 5); 1849 cp2 = __apu_get_register(chip, 1, 5); 1850 diff = (cp1 > cp2 ? cp1 - cp2 : cp2 - cp1); 1851 1852 if (diff > 1) 1853 __maestro_write(chip, IDR0_DATA_PORT, cp1); 1826 1854 } 1827 1855 … … 1946 1974 spin_lock(&chip->substream_lock); 1947 1975 list_for_each_entry(es, &chip->substream_list, list, struct esschan) { 1948 if (es->running) 1976 if (es->running) { 1949 1977 snd_es1968_update_pcm(chip, es); 1978 if (es->fmt & ESS_FMT_STEREO) 1979 snd_es1968_suppress_jitter(chip, es); 1980 } 1950 1981 } 1951 1982 spin_unlock(&chip->substream_lock); … … 1970 2001 struct snd_ac97_bus *pbus; 1971 2002 struct snd_ac97_template ac97; 1972 struct snd_ctl_elem_id id;2003 struct snd_ctl_elem_id elem_id; 1973 2004 int err; 1974 2005 static struct snd_ac97_bus_ops ops = { … … 1987 2018 1988 2019 /* attach master switch / volumes for h/w volume control */ 1989 memset(& id, 0, sizeof(id));1990 id.iface = SNDRV_CTL_ELEM_IFACE_MIXER;1991 strcpy( id.name, "Master Playback Switch");1992 chip->master_switch = snd_ctl_find_id(chip->card, & id);1993 memset(& id, 0, sizeof(id));1994 id.iface = SNDRV_CTL_ELEM_IFACE_MIXER;1995 strcpy( id.name, "Master Playback Volume");1996 chip->master_volume = snd_ctl_find_id(chip->card, & id);2020 memset(&elem_id, 0, sizeof(elem_id)); 2021 elem_id.iface = SNDRV_CTL_ELEM_IFACE_MIXER; 2022 strcpy(elem_id.name, "Master Playback Switch"); 2023 chip->master_switch = snd_ctl_find_id(chip->card, &elem_id); 2024 memset(&elem_id, 0, sizeof(elem_id)); 2025 elem_id.iface = SNDRV_CTL_ELEM_IFACE_MIXER; 2026 strcpy(elem_id.name, "Master Playback Volume"); 2027 chip->master_volume = snd_ctl_find_id(chip->card, &elem_id); 1997 2028 1998 2029 return 0; … … 2454 2485 { 2455 2486 if (chip->io_port) { 2456 synchronize_irq(chip->irq); 2487 if (chip->irq >= 0) 2488 synchronize_irq(chip->irq); 2457 2489 outw(1, chip->io_port + 0x04); /* clear WP interrupts */ 2458 2490 outw(0, chip->io_port + ESM_PORT_HOST_IRQ); /* disable IRQ */ -
GPL/branches/uniaud32-2.0/alsa-kernel/pci/fm801.c
r305 r358 1286 1286 static int snd_fm801_chip_init(struct fm801 *chip, int resume) 1287 1287 { 1288 int id;1289 1288 unsigned short cmdw; 1290 1289 … … 1311 1310 /* my card has the secondary codec */ 1312 1311 /* at address #3, so the loop is inverted */ 1313 for (id = 3; id > 0; id--) { 1314 if (! wait_for_codec(chip, id, AC97_VENDOR_ID1, 1312 int i; 1313 for (i = 3; i > 0; i--) { 1314 if (!wait_for_codec(chip, i, AC97_VENDOR_ID1, 1315 1315 msecs_to_jiffies(50))) { 1316 1316 cmdw = inw(FM801_REG(chip, AC97_DATA)); 1317 1317 if (cmdw != 0xffff && cmdw != 0) { 1318 1318 chip->secondary = 1; 1319 chip->secondary_addr = i d;1319 chip->secondary_addr = i; 1320 1320 break; 1321 1321 } -
GPL/branches/uniaud32-2.0/alsa-kernel/pci/hda/hda_codec.c
r339 r358 32 32 #include "hda_local.h" 33 33 #include <sound/hda_hwdep.h> 34 #include "hda_patch.h" /* codec presets */ 34 35 35 36 #ifdef CONFIG_SND_HDA_POWER_SAVE … … 52 53 /* codec vendor labels */ 53 54 static struct hda_vendor_id hda_vendor_ids[] = { 55 { 0x1002, "ATI" }, 56 { 0x1057, "Motorola" }, 57 { 0x1095, "Silicon Image" }, 54 58 { 0x10ec, "Realtek" }, 55 { 0x1057, "Motorola" },56 59 { 0x1106, "VIA" }, 57 60 { 0x111d, "IDT" }, 61 { 0x11c1, "LSI" }, 58 62 { 0x11d4, "Analog Devices" }, 59 63 { 0x13f6, "C-Media" }, 60 64 { 0x14f1, "Conexant" }, 65 { 0x17e8, "Chrontel" }, 66 { 0x1854, "LG" }, 61 67 { 0x434d, "C-Media" }, 62 68 { 0x8384, "SigmaTel" }, … … 64 70 }; 65 71 66 /* codec presets */ 67 #include "hda_patch.h" 68 72 static const struct hda_codec_preset *hda_preset_tables[] = { 73 #ifdef CONFIG_SND_HDA_CODEC_REALTEK 74 snd_hda_preset_realtek, 75 #endif 76 #ifdef CONFIG_SND_HDA_CODEC_CMEDIA 77 snd_hda_preset_cmedia, 78 #endif 79 #ifdef CONFIG_SND_HDA_CODEC_ANALOG 80 snd_hda_preset_analog, 81 #endif 82 #ifdef CONFIG_SND_HDA_CODEC_SIGMATEL 83 snd_hda_preset_sigmatel, 84 #endif 85 #ifdef CONFIG_SND_HDA_CODEC_SI3054 86 snd_hda_preset_si3054, 87 #endif 88 #ifdef CONFIG_SND_HDA_CODEC_ATIHDMI 89 snd_hda_preset_atihdmi, 90 #endif 91 #ifdef CONFIG_SND_HDA_CODEC_CONEXANT 92 snd_hda_preset_conexant, 93 #endif 94 #ifdef CONFIG_SND_HDA_CODEC_VIA 95 snd_hda_preset_via, 96 #endif 97 NULL 98 }; 69 99 70 100 #ifdef CONFIG_SND_HDA_POWER_SAVE … … 282 312 schedule_work(&unsol->work); 283 313 #endif 284 285 314 return 0; 286 315 } … … 696 725 msleep(1); 697 726 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_STREAM_FORMAT, format); 727 } 728 729 void snd_hda_codec_cleanup_stream(struct hda_codec *codec, hda_nid_t nid) 730 { 731 if (!nid) 732 return; 733 734 snd_printdd("hda_codec_cleanup_stream: NID=0x%x\n", nid); 735 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CHANNEL_STREAMID, 0); 736 #if 0 /* keep the format */ 737 msleep(1); 738 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_STREAM_FORMAT, 0); 739 #endif 698 740 } 699 741 … … 1071 1113 int err; 1072 1114 1115 for (s = slaves; *s && !snd_hda_find_mixer_ctl(codec, *s); s++) 1116 ; 1117 if (!*s) { 1118 snd_printdd("No slave found for %s\n", name); 1119 return 0; 1120 } 1073 1121 kctl = snd_ctl_make_virtual_master(name, tlv); 1074 1122 if (!kctl) … … 1213 1261 int err; 1214 1262 1263 mutex_lock(&codec->spdif_mutex); /* reuse spdif_mutex */ 1215 1264 c = (struct hda_bind_ctls *)kcontrol->private_value; 1216 mutex_lock(&codec->spdif_mutex); /* reuse spdif_mutex */1217 1265 kcontrol->private_value = *c->values; 1218 1266 err = c->ops->info(kcontrol, uinfo); … … 1229 1277 int err; 1230 1278 1279 mutex_lock(&codec->spdif_mutex); /* reuse spdif_mutex */ 1231 1280 c = (struct hda_bind_ctls *)kcontrol->private_value; 1232 mutex_lock(&codec->spdif_mutex); /* reuse spdif_mutex */1233 1281 kcontrol->private_value = *c->values; 1234 1282 err = c->ops->get(kcontrol, ucontrol); … … 1246 1294 int err = 0, change = 0; 1247 1295 1296 mutex_lock(&codec->spdif_mutex); /* reuse spdif_mutex */ 1248 1297 c = (struct hda_bind_ctls *)kcontrol->private_value; 1249 mutex_lock(&codec->spdif_mutex); /* reuse spdif_mutex */1250 1298 for (vals = c->values; *vals; vals++) { 1251 1299 kcontrol->private_value = *vals; … … 1267 1315 int err; 1268 1316 1317 mutex_lock(&codec->spdif_mutex); /* reuse spdif_mutex */ 1269 1318 c = (struct hda_bind_ctls *)kcontrol->private_value; 1270 mutex_lock(&codec->spdif_mutex); /* reuse spdif_mutex */1271 1319 kcontrol->private_value = *c->values; 1272 1320 err = c->ops->tlv(kcontrol, op_flag, size, tlv); … … 1532 1580 codec->spdif_status = convert_to_spdif_status(codec->spdif_ctls); 1533 1581 return 0; 1582 } 1583 1584 /* 1585 * SPDIF sharing with analog output 1586 */ 1587 static int spdif_share_sw_get(struct snd_kcontrol *kcontrol, 1588 struct snd_ctl_elem_value *ucontrol) 1589 { 1590 struct hda_multi_out *mout = snd_kcontrol_chip(kcontrol); 1591 ucontrol->value.integer.value[0] = mout->share_spdif; 1592 return 0; 1593 } 1594 1595 static int spdif_share_sw_put(struct snd_kcontrol *kcontrol, 1596 struct snd_ctl_elem_value *ucontrol) 1597 { 1598 struct hda_multi_out *mout = snd_kcontrol_chip(kcontrol); 1599 mout->share_spdif = !!ucontrol->value.integer.value[0]; 1600 return 0; 1601 } 1602 1603 static struct snd_kcontrol_new spdif_share_sw = { 1604 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 1605 .name = "IEC958 Default PCM Playback Switch", 1606 .info = snd_ctl_boolean_mono_info, 1607 .get = spdif_share_sw_get, 1608 .put = spdif_share_sw_put, 1609 }; 1610 1611 int snd_hda_create_spdif_share_sw(struct hda_codec *codec, 1612 struct hda_multi_out *mout) 1613 { 1614 if (!mout->dig_out_nid) 1615 return 0; 1616 /* ATTENTION: here mout is passed as private_data, instead of codec */ 1617 return snd_ctl_add(codec->bus->card, 1618 snd_ctl_new1(&spdif_share_sw, mout)); 1534 1619 } 1535 1620 … … 2139 2224 struct snd_pcm_substream *substream) 2140 2225 { 2141 snd_hda_codec_ setup_stream(codec, hinfo->nid, 0, 0, 0);2226 snd_hda_codec_cleanup_stream(codec, hinfo->nid); 2142 2227 return 0; 2143 2228 } … … 2257 2342 return -1; 2258 2343 if (tbl->value >= 0 && tbl->value < num_configs) { 2259 #ifdef CONFIG_SND_DEBUG_ DETECT2344 #ifdef CONFIG_SND_DEBUG_VERBOSE 2260 2345 char tmp[10]; 2261 2346 const char *model = NULL; … … 2524 2609 if (mout->dig_out_used == HDA_DIG_ANALOG_DUP) 2525 2610 /* already opened as analog dup; reset it once */ 2526 snd_hda_codec_ setup_stream(codec, mout->dig_out_nid, 0, 0, 0);2611 snd_hda_codec_cleanup_stream(codec, mout->dig_out_nid); 2527 2612 mout->dig_out_used = HDA_DIG_EXCLUSIVE; 2528 2613 mutex_unlock(&codec->spdif_mutex); … … 2559 2644 int snd_hda_multi_out_analog_open(struct hda_codec *codec, 2560 2645 struct hda_multi_out *mout, 2561 struct snd_pcm_substream *substream) 2562 { 2563 substream->runtime->hw.channels_max = mout->max_channels; 2646 struct snd_pcm_substream *substream, 2647 struct hda_pcm_stream *hinfo) 2648 { 2649 struct snd_pcm_runtime *runtime = substream->runtime; 2650 runtime->hw.channels_max = mout->max_channels; 2651 if (mout->dig_out_nid) { 2652 if (!mout->analog_rates) { 2653 mout->analog_rates = hinfo->rates; 2654 mout->analog_formats = hinfo->formats; 2655 mout->analog_maxbps = hinfo->maxbps; 2656 } else { 2657 runtime->hw.rates = mout->analog_rates; 2658 runtime->hw.formats = mout->analog_formats; 2659 hinfo->maxbps = mout->analog_maxbps; 2660 } 2661 if (!mout->spdif_rates) { 2662 snd_hda_query_supported_pcm(codec, mout->dig_out_nid, 2663 &mout->spdif_rates, 2664 &mout->spdif_formats, 2665 &mout->spdif_maxbps); 2666 } 2667 mutex_lock(&codec->spdif_mutex); 2668 if (mout->share_spdif) { 2669 runtime->hw.rates &= mout->spdif_rates; 2670 runtime->hw.formats &= mout->spdif_formats; 2671 if (mout->spdif_maxbps < hinfo->maxbps) 2672 hinfo->maxbps = mout->spdif_maxbps; 2673 } 2674 mutex_unlock(&codec->spdif_mutex); 2675 } 2564 2676 return snd_pcm_hw_constraint_step(substream->runtime, 0, 2565 2677 SNDRV_PCM_HW_PARAM_CHANNELS, 2); … … 2581 2693 2582 2694 mutex_lock(&codec->spdif_mutex); 2583 if (mout->dig_out_nid && mout->dig_out_used != HDA_DIG_EXCLUSIVE) { 2695 if (mout->dig_out_nid && mout->share_spdif && 2696 mout->dig_out_used != HDA_DIG_EXCLUSIVE) { 2584 2697 if (chs == 2 && 2585 2698 snd_hda_is_supported_format(codec, mout->dig_out_nid, … … 2591 2704 } else { 2592 2705 mout->dig_out_used = 0; 2593 snd_hda_codec_setup_stream(codec, mout->dig_out_nid, 2594 0, 0, 0); 2706 snd_hda_codec_cleanup_stream(codec, mout->dig_out_nid); 2595 2707 } 2596 2708 } … … 2634 2746 2635 2747 for (i = 0; i < mout->num_dacs; i++) 2636 snd_hda_codec_ setup_stream(codec, nids[i], 0, 0, 0);2748 snd_hda_codec_cleanup_stream(codec, nids[i]); 2637 2749 if (mout->hp_nid) 2638 snd_hda_codec_ setup_stream(codec, mout->hp_nid, 0, 0, 0);2750 snd_hda_codec_cleanup_stream(codec, mout->hp_nid); 2639 2751 for (i = 0; i < ARRAY_SIZE(mout->extra_out_nid); i++) 2640 2752 if (mout->extra_out_nid[i]) 2641 snd_hda_codec_setup_stream(codec, 2642 mout->extra_out_nid[i], 2643 0, 0, 0); 2753 snd_hda_codec_cleanup_stream(codec, 2754 mout->extra_out_nid[i]); 2644 2755 mutex_lock(&codec->spdif_mutex); 2645 2756 if (mout->dig_out_nid && mout->dig_out_used == HDA_DIG_ANALOG_DUP) { 2646 snd_hda_codec_ setup_stream(codec, mout->dig_out_nid, 0, 0, 0);2757 snd_hda_codec_cleanup_stream(codec, mout->dig_out_nid); 2647 2758 mout->dig_out_used = 0; 2648 2759 } … … 2823 2934 } 2824 2935 2936 /* FIX-UP: 2937 * If no line-out is defined but multiple HPs are found, 2938 * some of them might be the real line-outs. 2939 */ 2940 if (!cfg->line_outs && cfg->hp_outs > 1) { 2941 int i = 0; 2942 while (i < cfg->hp_outs) { 2943 /* The real HPs should have the sequence 0x0f */ 2944 if ((sequences_hp[i] & 0x0f) == 0x0f) { 2945 i++; 2946 continue; 2947 } 2948 /* Move it to the line-out table */ 2949 cfg->line_out_pins[cfg->line_outs] = cfg->hp_pins[i]; 2950 sequences_line_out[cfg->line_outs] = sequences_hp[i]; 2951 cfg->line_outs++; 2952 cfg->hp_outs--; 2953 memmove(cfg->hp_pins + i, cfg->hp_pins + i + 1, 2954 sizeof(cfg->hp_pins[0]) * (cfg->hp_outs - i)); 2955 memmove(sequences_hp + i - 1, sequences_hp + i, 2956 sizeof(sequences_hp[0]) * (cfg->hp_outs - i)); 2957 } 2958 } 2959 2825 2960 /* sort by sequence */ 2826 2961 sort_pins_by_sequence(cfg->line_out_pins, sequences_line_out, -
GPL/branches/uniaud32-2.0/alsa-kernel/pci/hda/hda_codec.h
r305 r358 79 79 #define AC_VERB_GET_EAPD_BTLENABLE 0x0f0c 80 80 #define AC_VERB_GET_DIGI_CONVERT_1 0x0f0d 81 #define AC_VERB_GET_DIGI_CONVERT_2 0x0f0e 81 #define AC_VERB_GET_DIGI_CONVERT_2 0x0f0e /* unused */ 82 82 #define AC_VERB_GET_VOLUME_KNOB_CONTROL 0x0f0f 83 83 /* f10-f1a: GPIO */ … … 501 501 struct hda_codec *caddr_tbl[HDA_MAX_CODEC_ADDRESS + 1]; 502 502 503 #ifndef TARGET_OS2 504 struct mutex cmd_mutex; 505 #else 503 506 struct semaphore cmd_mutex; 507 #endif 504 508 505 509 /* unsolicited event queue */ … … 591 595 }; 592 596 597 /* PCM types */ 598 enum { 599 HDA_PCM_TYPE_AUDIO, 600 HDA_PCM_TYPE_SPDIF, 601 HDA_PCM_TYPE_HDMI, 602 HDA_PCM_TYPE_MODEM, 603 HDA_PCM_NTYPES 604 }; 605 593 606 /* for PCM creation */ 594 607 struct hda_pcm { 595 608 char *name; 596 609 struct hda_pcm_stream stream[2]; 597 unsigned int is_modem; /* modem codec? */ 610 unsigned int pcm_type; /* HDA_PCM_TYPE_XXX */ 611 int device; /* assigned device number */ 598 612 }; 599 613 … … 633 647 struct hda_cache_rec cmd_cache; /* cache for other commands */ 634 648 649 #ifndef TARGET_OS2 650 struct mutex spdif_mutex; 651 #else 635 652 struct semaphore spdif_mutex; 653 #endif 636 654 unsigned int spdif_status; /* IEC958 status bits */ 637 655 unsigned short spdif_ctls; /* SPDIF control bits */ … … 713 731 u32 stream_tag, 714 732 int channel_id, int format); 733 void snd_hda_codec_cleanup_stream(struct hda_codec *codec, hda_nid_t nid); 715 734 unsigned int snd_hda_calc_stream_format(unsigned int rate, 716 735 unsigned int channels, -
GPL/branches/uniaud32-2.0/alsa-kernel/pci/hda/hda_generic.c
r305 r358 481 481 return "Aux"; 482 482 case AC_JACK_MIC_IN: 483 if (pinctl &&484 (node->pin_caps &485 (AC_PINCAP_VREF_80 << AC_PINCAP_VREF_SHIFT)))486 *pinctl |= AC_PINCTL_VREF_80;487 if ((location & 0x0f) == AC_JACK_LOC_FRONT)488 return "Front Mic";489 return "Mic";483 if (pinctl && 484 (node->pin_caps & 485 (AC_PINCAP_VREF_80 << AC_PINCAP_VREF_SHIFT))) 486 *pinctl |= AC_PINCTL_VREF_80; 487 if ((location & 0x0f) == AC_JACK_LOC_FRONT) 488 return "Front Mic"; 489 return "Mic"; 490 490 case AC_JACK_SPDIF_IN: 491 491 return "SPDIF"; … … 680 680 } 681 681 682 683 682 #ifdef CONFIG_SND_HDA_POWER_SAVE 684 683 static void add_input_loopback(struct hda_codec *codec, hda_nid_t nid, … … 728 727 knew.put = snd_hda_mixer_amp_switch_put; 729 728 knew.private_value = (node->nid | (3 << 16) | (HDA_INPUT << 18) | (index << 19)); 730 731 729 if (is_loopback) 732 730 add_input_loopback(codec, node->nid, HDA_INPUT, index); … … 773 771 (node->amp_out_caps & AC_AMPCAP_NUM_STEPS)) { 774 772 /*knew = (struct snd_kcontrol_new)HDA_CODEC_VOLUME(name, node->nid, 0, HDA_OUTPUT);*/ 775 knew.iface = SNDRV_CTL_ELEM_IFACE_MIXER;776 knew.name = name;777 knew.info = snd_hda_mixer_amp_volume_info;778 knew.get = snd_hda_mixer_amp_volume_get;779 knew.put = snd_hda_mixer_amp_volume_put;780 knew.private_value = (node->nid | (3 << 16) | (HDA_OUTPUT << 18) | (0 << 19));773 knew.iface = SNDRV_CTL_ELEM_IFACE_MIXER; 774 knew.name = name; 775 knew.info = snd_hda_mixer_amp_volume_info; 776 knew.get = snd_hda_mixer_amp_volume_get; 777 knew.put = snd_hda_mixer_amp_volume_put; 778 knew.private_value = (node->nid | (3 << 16) | (HDA_OUTPUT << 18) | (0 << 19)); 781 779 snd_printdd("[%s] NID=0x%x, DIR=OUT\n", name, node->nid); 782 780 if ((err = snd_ctl_add(codec->bus->card, snd_ctl_new1(&knew, codec))) < 0) … … 891 889 sprintf(name, "%s Capture Volume", 892 890 spec->input_mux.items[i].label); 893 /*knew = (struct snd_kcontrol_new)891 /* knew = (struct snd_kcontrol_new) 894 892 HDA_CODEC_VOLUME(name, adc_node->nid, 895 893 spec->input_mux.items[i].index, 896 894 HDA_INPUT);*/ 897 895 knew.iface = SNDRV_CTL_ELEM_IFACE_MIXER; 898 896 knew.name = name; … … 905 903 knew.tlv.c = snd_hda_mixer_amp_tlv, 906 904 knew.private_value = (adc_node->nid | (3 << 16) | (HDA_INPUT << 18) | (spec->input_mux.items[i].index << 19)); 907 908 905 if ((err = snd_ctl_add(codec->bus->card, 909 906 snd_ctl_new1(&knew, codec))) < 0) … … 1047 1044 struct hda_gspec *spec = codec->spec; 1048 1045 1049 snd_hda_codec_ setup_stream(codec, hinfo->nid, 0, 0, 0);1050 snd_hda_codec_ setup_stream(codec, spec->dac_node[1]->nid, 0, 0, 0);1046 snd_hda_codec_cleanup_stream(codec, hinfo->nid); 1047 snd_hda_codec_cleanup_stream(codec, spec->dac_node[1]->nid); 1051 1048 return 0; 1052 1049 } -
GPL/branches/uniaud32-2.0/alsa-kernel/pci/hda/hda_hwdep.c
r305 r358 22 22 #include <linux/slab.h> 23 23 #include <linux/pci.h> 24 #include <linux/compat.h> 24 25 #include <linux/mutex.h> 25 26 #include <sound/core.h> … … 88 89 static int hda_hwdep_open(struct snd_hwdep *hw, struct file *file) 89 90 { 90 #ifndef CONFIG_SND_DEBUG_ DETECT91 #ifndef CONFIG_SND_DEBUG_VERBOSE 91 92 if (!capable(CAP_SYS_RAWIO)) 92 93 return -EACCES; -
GPL/branches/uniaud32-2.0/alsa-kernel/pci/hda/hda_intel.c
r339 r358 40 40 #include <linux/kernel.h> 41 41 #include <linux/module.h> 42 #include <linux/dma-mapping.h> 42 43 #include <linux/moduleparam.h> 43 44 #include <linux/init.h> … … 56 57 static int position_fix[SNDRV_CARDS]; 57 58 #ifndef TARGET_OS2 59 static int bdl_pos_adj[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS-1)] = -1}; 58 60 static int probe_mask[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS-1)] = -1}; 59 61 #else 62 static int bdl_pos_adj[SNDRV_CARDS] = {-1}; 60 63 static int probe_mask[SNDRV_CARDS] = {-1}; 61 64 #endif … … 73 76 module_param_array(position_fix, int, NULL, 0444); 74 77 MODULE_PARM_DESC(position_fix, "Fix DMA pointer " 75 "(0 = auto, 1 = none, 2 = POSBUF, 3 = FIFO size)."); 78 "(0 = auto, 1 = none, 2 = POSBUF)."); 79 module_param_array(bdl_pos_adj, int, NULL, 0644); 80 MODULE_PARM_DESC(bdl_pos_adj, "BDL position adjustment offset."); 76 81 module_param_array(probe_mask, int, NULL, 0444); 77 82 MODULE_PARM_DESC(probe_mask, "Bitmask to probe codecs (default = -1)."); … … 190 195 /* max number of SDs */ 191 196 /* ICH, ATI and VIA have 4 playback and 4 capture */ 192 #define ICH6_CAPTURE_INDEX 0193 197 #define ICH6_NUM_CAPTURE 4 194 #define ICH6_PLAYBACK_INDEX 4195 198 #define ICH6_NUM_PLAYBACK 4 196 199 197 200 /* ULI has 6 playback and 5 capture */ 198 #define ULI_CAPTURE_INDEX 0199 201 #define ULI_NUM_CAPTURE 5 200 #define ULI_PLAYBACK_INDEX 5201 202 #define ULI_NUM_PLAYBACK 6 202 203 203 204 /* ATI HDMI has 1 playback and 0 capture */ 204 #define ATIHDMI_CAPTURE_INDEX 0205 205 #define ATIHDMI_NUM_CAPTURE 0 206 #define ATIHDMI_PLAYBACK_INDEX 0207 206 #define ATIHDMI_NUM_PLAYBACK 1 207 208 /* TERA has 4 playback and 3 capture */ 209 #define TERA_NUM_CAPTURE 3 210 #define TERA_NUM_PLAYBACK 4 208 211 209 212 /* this number is statically defined for simplicity */ … … 211 214 212 215 /* max number of fragments - we may use more if allocating more pages for BDL */ 213 #define BDL_SIZE PAGE_ALIGN(8192) 214 #define AZX_MAX_FRAG (BDL_SIZE / (MAX_AZX_DEV * 16)) 216 #define BDL_SIZE 4096 217 #define AZX_MAX_BDL_ENTRIES (BDL_SIZE / 16) 218 #define AZX_MAX_FRAG 32 215 219 /* max buffer size - no h/w limit, you can increase as you like */ 216 220 #define AZX_MAX_BUF_SIZE (1024*1024*1024) 217 221 /* max number of PCM devics per card */ 218 #define AZX_MAX_AUDIO_PCMS 6 219 #define AZX_MAX_MODEM_PCMS 2 220 #define AZX_MAX_PCMS (AZX_MAX_AUDIO_PCMS + AZX_MAX_MODEM_PCMS) 222 #define AZX_MAX_PCMS 8 221 223 222 224 /* RIRB int mask: overrun[2], response[0] */ … … 232 234 #define SD_CTL_STREAM_RESET 0x01 /* stream reset bit */ 233 235 #define SD_CTL_DMA_START 0x02 /* stream DMA start bit */ 236 #define SD_CTL_STRIPE (3 << 16) /* stripe control */ 237 #define SD_CTL_TRAFFIC_PRIO (1 << 18) /* traffic priority */ 238 #define SD_CTL_DIR (1 << 19) /* bi-directional stream */ 234 239 #define SD_CTL_STREAM_TAG_MASK (0xf << 20) 235 240 #define SD_CTL_STREAM_TAG_SHIFT 20 … … 267 272 enum { 268 273 POS_FIX_AUTO, 269 POS_FIX_ NONE,274 POS_FIX_LPIB, 270 275 POS_FIX_POSBUF, 271 POS_FIX_FIFO,272 276 }; 273 277 … … 289 293 290 294 struct azx_dev { 295 struct snd_dma_buffer bdl; /* BDL buffer */ 291 296 #ifdef TARGET_OS2 292 volatile u32 *bdl; /* virtual address of the BDL */293 dma_addr_t bdl_addr; /* physical address of the BDL */294 297 volatile u32 *posbuf; /* position buffer pointer */ 295 298 #else 296 u32 *bdl; /* virtual address of the BDL */297 dma_addr_t bdl_addr; /* physical address of the BDL */298 299 u32 *posbuf; /* position buffer pointer */ 299 300 #endif 300 301 301 unsigned int bufsize; /* size of the play buffer in bytes */ 302 unsigned int fragsize; /* size of eachperiod in bytes */302 unsigned int period_bytes; /* size of the period in bytes */ 303 303 unsigned int frags; /* number for period in the play buffer */ 304 304 unsigned int fifo_size; /* FIFO size */ … … 306 306 #ifdef TARGET_OS2 307 307 volatile void __iomem *sd_addr; /* stream descriptor pointer */ 308 #else /* !TARGET_OS2 */308 #else 309 309 void __iomem *sd_addr; /* stream descriptor pointer */ 310 #endif /* !TARGET_OS2 */310 #endif 311 311 312 312 u32 sd_int_sta_mask; /* stream int status mask */ … … 321 321 unsigned char stream_tag; /* assigned stream */ 322 322 unsigned char index; /* stream index */ 323 /* for sanity check of position buffer */324 unsigned int period_intr;325 323 326 324 unsigned int opened :1; 327 325 unsigned int running :1; 326 unsigned int irq_pending :1; 327 unsigned int irq_ignore :1; 328 328 }; 329 329 330 330 /* CORB/RIRB */ 331 331 struct azx_rb { 332 volatile u32 *buf; /* CORB/RIRB buffer 333 * Each CORB entry is 4byte, RIRB is 8byte 332 #ifdef TARGET_OS2 333 volatile u32 *buf; /* CORB/RIRB buffer */ 334 #else 335 u32 *buf; /* CORB/RIRB buffer */ 336 #endif 337 /* Each CORB entry is 4byte, RIRB is 8byte 334 338 */ 335 339 dma_addr_t addr; /* physical address of CORB/RIRB buffer */ … … 343 347 struct snd_card *card; 344 348 struct pci_dev *pci; 349 int dev_index; 345 350 346 351 /* chip type specific */ … … 369 374 370 375 /* PCM */ 371 unsigned int pcm_devs;372 376 struct snd_pcm *pcm[AZX_MAX_PCMS]; 373 377 … … 380 384 struct azx_rb rirb; 381 385 382 /* BDL, CORB/RIRB and position buffers */ 383 struct snd_dma_buffer bdl; 386 /* CORB/RIRB and position buffers */ 384 387 struct snd_dma_buffer rb; 385 388 struct snd_dma_buffer posbuf; … … 392 395 unsigned int polling_mode :1; 393 396 unsigned int msi :1; 397 unsigned int irq_pending_warned :1; 394 398 395 399 /* for debugging */ 396 400 unsigned int last_cmd; /* last issued command (to sync) */ 401 402 /* for pending irqs */ 403 struct work_struct irq_pending_work; 397 404 }; 398 405 … … 407 414 AZX_DRIVER_ULI, 408 415 AZX_DRIVER_NVIDIA, 416 AZX_DRIVER_TERA, 409 417 }; 410 418 … … 418 426 [AZX_DRIVER_ULI] = "HDA ULI M5461", 419 427 [AZX_DRIVER_NVIDIA] = "HDA NVidia", 428 [AZX_DRIVER_TERA] = "HDA Teradici", 420 429 }; 421 430 … … 452 461 #define get_azx_dev(substream) (substream->runtime->private_data) 453 462 454 /* Get the upper 32bit of the given dma_addr_t455 * Compiler should optimize and eliminate the code if dma_addr_t is 32bit456 */457 #define upper_32bit(addr) (sizeof(addr) > 4 ? (u32)(((unsigned long long)addr) >> 32) : (u32)0)458 459 463 static int azx_acquire_irq(struct azx *chip, int do_disconnect); 460 464 … … 487 491 chip->corb.buf = (u32 *)chip->rb.area; 488 492 azx_writel(chip, CORBLBASE, (u32)chip->corb.addr); 489 azx_writel(chip, CORBUBASE, upper_32 bit(chip->corb.addr));493 azx_writel(chip, CORBUBASE, upper_32_bits(chip->corb.addr)); 490 494 491 495 /* set the corb size to 256 entries (ULI requires explicitly) */ … … 502 506 chip->rirb.buf = (u32 *)(chip->rb.area + 2048); 503 507 azx_writel(chip, RIRBLBASE, (u32)chip->rirb.addr); 504 azx_writel(chip, RIRBUBASE, upper_32 bit(chip->rirb.addr));508 azx_writel(chip, RIRBUBASE, upper_32_bits(chip->rirb.addr)); 505 509 506 510 /* set the rirb size to 256 entries (ULI requires explicitly) */ … … 565 569 snd_hda_queue_unsol_event(chip->bus, res, res_ex); 566 570 else if (chip->rirb.cmds) { 571 chip->rirb.res = res; 572 smp_wmb(); 567 573 chip->rirb.cmds--; 568 chip->rirb.res = res;569 574 } 570 575 } … … 585 590 spin_unlock_irq(&chip->reg_lock); 586 591 } 587 if (!chip->rirb.cmds) 592 if (!chip->rirb.cmds) { 593 smp_rmb(); 588 594 return chip->rirb.res; /* the last value */ 595 } 589 596 if (time_after(jiffies, timeout)) 590 597 break; … … 870 877 /* program the position buffer */ 871 878 azx_writel(chip, DPLBASE, (u32)chip->posbuf.addr); 872 azx_writel(chip, DPUBASE, upper_32 bit(chip->posbuf.addr));879 azx_writel(chip, DPUBASE, upper_32_bits(chip->posbuf.addr)); 873 880 874 881 chip->initialized = 1; … … 931 938 932 939 940 static int azx_position_ok(struct azx *chip, struct azx_dev *azx_dev); 941 933 942 /* 934 943 * interrupt handler … … 953 962 if (status & azx_dev->sd_int_sta_mask) { 954 963 azx_sd_writeb(azx_dev, SD_STS, SD_INT_MASK); 955 if (azx_dev->substream && azx_dev->running) { 956 azx_dev->period_intr++; 964 if (!azx_dev->substream || !azx_dev->running) 965 continue; 966 /* ignore the first dummy IRQ (due to pos_adj) */ 967 if (azx_dev->irq_ignore) { 968 azx_dev->irq_ignore = 0; 969 continue; 970 } 971 /* check whether this IRQ is really acceptable */ 972 if (azx_position_ok(chip, azx_dev)) { 973 azx_dev->irq_pending = 0; 957 974 spin_unlock(&chip->reg_lock); 958 975 snd_pcm_period_elapsed(azx_dev->substream); 959 976 spin_lock(&chip->reg_lock); 977 } else { 978 /* bogus IRQ, process it later */ 979 azx_dev->irq_pending = 1; 980 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0) 981 schedule_work(&chip->irq_pending_work); 982 #endif 960 983 } 961 984 } … … 982 1005 983 1006 /* 1007 * set up a BDL entry 1008 */ 1009 static int setup_bdle(struct snd_pcm_substream *substream, 1010 struct azx_dev *azx_dev, u32 **bdlp, 1011 int ofs, int size, int with_ioc) 1012 { 1013 struct snd_sg_buf *sgbuf = snd_pcm_substream_sgbuf(substream); 1014 u32 *bdl = *bdlp; 1015 1016 while (size > 0) { 1017 dma_addr_t addr; 1018 int chunk; 1019 1020 if (azx_dev->frags >= AZX_MAX_BDL_ENTRIES) 1021 return -EINVAL; 1022 1023 addr = snd_pcm_sgbuf_get_addr(sgbuf, ofs); 1024 /* program the address field of the BDL entry */ 1025 bdl[0] = cpu_to_le32((u32)addr); 1026 bdl[1] = cpu_to_le32(upper_32_bits(addr)); 1027 /* program the size field of the BDL entry */ 1028 chunk = PAGE_SIZE - (ofs % PAGE_SIZE); 1029 if (size < chunk) 1030 chunk = size; 1031 bdl[2] = cpu_to_le32(chunk); 1032 /* program the IOC to enable interrupt 1033 * only when the whole fragment is processed 1034 */ 1035 size -= chunk; 1036 bdl[3] = (size || !with_ioc) ? 0 : cpu_to_le32(0x01); 1037 bdl += 4; 1038 azx_dev->frags++; 1039 ofs += chunk; 1040 } 1041 *bdlp = bdl; 1042 return ofs; 1043 } 1044 1045 /* 984 1046 * set up BDL entries 985 1047 */ 986 static void azx_setup_periods(struct azx_dev *azx_dev) 1048 static int azx_setup_periods(struct azx *chip, 1049 struct snd_pcm_substream *substream, 1050 struct azx_dev *azx_dev) 987 1051 { 988 1052 #ifdef TARGET_OS2 989 volatile u32 *bdl = azx_dev->bdl;990 #else /* !TARGET_OS2 */991 u32 *bdl = azx_dev->bdl;992 #endif /* !TARGET_OS2 */993 dma_addr_t dma_addr = azx_dev->substream->runtime->dma_addr;994 int idx;1053 volatile u32 *bdl; 1054 #else 1055 u32 *bdl; 1056 #endif 1057 int i, ofs, periods, period_bytes; 1058 int pos_adj; 995 1059 996 1060 /* reset BDL address */ … … 998 1062 azx_sd_writel(azx_dev, SD_BDLPU, 0); 999 1063 1064 period_bytes = snd_pcm_lib_period_bytes(substream); 1065 azx_dev->period_bytes = period_bytes; 1066 periods = azx_dev->bufsize / period_bytes; 1067 1000 1068 /* program the initial BDL entries */ 1001 for (idx = 0; idx < azx_dev->frags; idx++) { 1002 unsigned int off = idx << 2; /* 4 dword step */ 1003 dma_addr_t addr = dma_addr + idx * azx_dev->fragsize; 1004 /* program the address field of the BDL entry */ 1005 bdl[off] = cpu_to_le32((u32)addr); 1006 bdl[off+1] = cpu_to_le32(upper_32bit(addr)); 1007 1008 /* program the size field of the BDL entry */ 1009 bdl[off+2] = cpu_to_le32(azx_dev->fragsize); 1010 1011 /* program the IOC to enable interrupt when buffer completes */ 1012 bdl[off+3] = cpu_to_le32(0x01); 1013 } 1069 bdl = (u32 *)azx_dev->bdl.area; 1070 ofs = 0; 1071 azx_dev->frags = 0; 1072 azx_dev->irq_ignore = 0; 1073 pos_adj = bdl_pos_adj[chip->dev_index]; 1074 if (pos_adj > 0) { 1075 struct snd_pcm_runtime *runtime = substream->runtime; 1076 pos_adj = (pos_adj * runtime->rate + 47999) / 48000; 1077 if (!pos_adj) 1078 pos_adj = 1; 1079 pos_adj = frames_to_bytes(runtime, pos_adj); 1080 if (pos_adj >= period_bytes) { 1081 snd_printk(KERN_WARNING "Too big adjustment %d\n", 1082 bdl_pos_adj[chip->dev_index]); 1083 pos_adj = 0; 1084 } else { 1085 ofs = setup_bdle(substream, azx_dev, 1086 &bdl, ofs, pos_adj, 1); 1087 if (ofs < 0) 1088 goto error; 1089 azx_dev->irq_ignore = 1; 1090 } 1091 } else 1092 pos_adj = 0; 1093 for (i = 0; i < periods; i++) { 1094 if (i == periods - 1 && pos_adj) 1095 ofs = setup_bdle(substream, azx_dev, &bdl, ofs, 1096 period_bytes - pos_adj, 0); 1097 else 1098 ofs = setup_bdle(substream, azx_dev, &bdl, ofs, 1099 period_bytes, 1); 1100 if (ofs < 0) 1101 goto error; 1102 } 1103 return 0; 1104 1105 error: 1106 snd_printk(KERN_ERR "Too many BDL entries: buffer=%d, period=%d\n", 1107 azx_dev->bufsize, period_bytes); 1108 /* reset */ 1109 azx_sd_writel(azx_dev, SD_BDLPL, 0); 1110 azx_sd_writel(azx_dev, SD_BDLPU, 0); 1111 return -EINVAL; 1014 1112 } 1015 1113 … … 1060 1158 /* program the BDL address */ 1061 1159 /* lower BDL address */ 1062 azx_sd_writel(azx_dev, SD_BDLPL, (u32)azx_dev->bdl _addr);1160 azx_sd_writel(azx_dev, SD_BDLPL, (u32)azx_dev->bdl.addr); 1063 1161 /* upper BDL address */ 1064 azx_sd_writel(azx_dev, SD_BDLPU, upper_32 bit(azx_dev->bdl_addr));1162 azx_sd_writel(azx_dev, SD_BDLPU, upper_32_bits(azx_dev->bdl.addr)); 1065 1163 1066 1164 /* enable the position buffer */ 1067 if (!(azx_readl(chip, DPLBASE) & ICH6_DPLBASE_ENABLE)) 1068 azx_writel(chip, DPLBASE, 1069 (u32)chip->posbuf.addr |ICH6_DPLBASE_ENABLE); 1165 if (chip->position_fix == POS_FIX_POSBUF || 1166 chip->position_fix == POS_FIX_AUTO) { 1167 if (!(azx_readl(chip, DPLBASE) & ICH6_DPLBASE_ENABLE)) 1168 azx_writel(chip, DPLBASE, 1169 (u32)chip->posbuf.addr | ICH6_DPLBASE_ENABLE); 1170 } 1070 1171 1071 1172 /* set the interrupt enable bits in the descriptor control register */ … … 1082 1183 1083 1184 static unsigned int azx_max_codecs[] __devinitdata = { 1084 [AZX_DRIVER_ICH] = 3,1185 [AZX_DRIVER_ICH] = 4, /* Some ICH9 boards use SD3 */ 1085 1186 [AZX_DRIVER_SCH] = 3, 1086 1187 [AZX_DRIVER_ATI] = 4, … … 1090 1191 [AZX_DRIVER_ULI] = 3, /* FIXME: correct? */ 1091 1192 [AZX_DRIVER_NVIDIA] = 3, /* FIXME: correct? */ 1193 [AZX_DRIVER_TERA] = 1, 1092 1194 }; 1093 1195 … … 1180 1282 /* No full-resume yet implemented */ 1181 1283 /* SNDRV_PCM_INFO_RESUME |*/ 1182 SNDRV_PCM_INFO_PAUSE), 1284 SNDRV_PCM_INFO_PAUSE | 1285 SNDRV_PCM_INFO_SYNC_START), 1183 1286 .formats = SNDRV_PCM_FMTBIT_S16_LE, 1184 1287 .rates = SNDRV_PCM_RATE_48000, … … 1242 1345 1243 1346 runtime->private_data = azx_dev; 1347 snd_pcm_set_sync(substream); 1244 1348 mutex_unlock(&chip->open_mutex); 1245 1349 return 0; … … 1298 1402 1299 1403 azx_dev->bufsize = snd_pcm_lib_buffer_bytes(substream); 1300 azx_dev->fragsize = snd_pcm_lib_period_bytes(substream);1301 azx_dev->frags = azx_dev->bufsize / azx_dev->fragsize;1302 1404 azx_dev->format_val = snd_hda_calc_stream_format(runtime->rate, 1303 1405 runtime->channels, … … 1311 1413 } 1312 1414 1313 snd_printdd("azx_pcm_prepare: bufsize=0x%x, f ragsize=0x%x, "1314 "format=0x%x\n",1315 azx_dev->bufsize, azx_dev->fragsize, azx_dev->format_val);1316 azx_setup_periods(azx_dev);1415 snd_printdd("azx_pcm_prepare: bufsize=0x%x, format=0x%x\n", 1416 azx_dev->bufsize, azx_dev->format_val); 1417 if (azx_setup_periods(chip, substream, azx_dev) < 0) 1418 return -EINVAL; 1317 1419 azx_setup_controller(chip, azx_dev); 1318 1420 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) … … 1328 1430 { 1329 1431 struct azx_pcm *apcm = snd_pcm_substream_chip(substream); 1330 struct azx_dev *azx_dev = get_azx_dev(substream);1331 1432 struct azx *chip = apcm->chip; 1332 int err = 0; 1333 1334 spin_lock(&chip->reg_lock); 1433 struct azx_dev *azx_dev; 1434 struct snd_pcm_substream *s; 1435 int start, nsync = 0, sbits = 0; 1436 int nwait, timeout; 1437 1335 1438 switch (cmd) { 1336 1439 case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: 1337 1440 case SNDRV_PCM_TRIGGER_RESUME: 1338 1441 case SNDRV_PCM_TRIGGER_START: 1339 azx_stream_start(chip, azx_dev); 1340 azx_dev->running = 1; 1442 start = 1; 1341 1443 break; 1342 1444 case SNDRV_PCM_TRIGGER_PAUSE_PUSH: 1343 1445 case SNDRV_PCM_TRIGGER_SUSPEND: 1344 1446 case SNDRV_PCM_TRIGGER_STOP: 1345 azx_stream_stop(chip, azx_dev); 1346 azx_dev->running = 0; 1447 start = 0; 1347 1448 break; 1348 1449 default: 1349 err = -EINVAL; 1450 return -EINVAL; 1451 } 1452 1453 snd_pcm_group_for_each_entry(s, substream) { 1454 if (s->pcm->card != substream->pcm->card) 1455 continue; 1456 azx_dev = get_azx_dev(s); 1457 sbits |= 1 << azx_dev->index; 1458 nsync++; 1459 snd_pcm_trigger_done(s, substream); 1460 } 1461 1462 spin_lock(&chip->reg_lock); 1463 if (nsync > 1) { 1464 /* first, set SYNC bits of corresponding streams */ 1465 azx_writel(chip, SYNC, azx_readl(chip, SYNC) | sbits); 1466 } 1467 snd_pcm_group_for_each_entry(s, substream) { 1468 if (s->pcm->card != substream->pcm->card) 1469 continue; 1470 azx_dev = get_azx_dev(s); 1471 if (start) 1472 azx_stream_start(chip, azx_dev); 1473 else 1474 azx_stream_stop(chip, azx_dev); 1475 azx_dev->running = start; 1350 1476 } 1351 1477 spin_unlock(&chip->reg_lock); 1352 if (cmd == SNDRV_PCM_TRIGGER_PAUSE_PUSH || 1353 cmd == SNDRV_PCM_TRIGGER_SUSPEND || 1354 cmd == SNDRV_PCM_TRIGGER_STOP) { 1355 #ifndef TARGET_OS2 1356 int timeout = 5000; 1357 #else /* TARGET_OS2 */ 1358 int timeout = 100000; 1359 #endif /* TARGET_OS2 */ 1360 while ((azx_sd_readb(azx_dev, SD_CTL) & SD_CTL_DMA_START) && 1361 --timeout) 1362 ; 1363 } 1364 return err; 1365 } 1366 1367 static snd_pcm_uframes_t azx_pcm_pointer(struct snd_pcm_substream *substream) 1368 { 1369 struct azx_pcm *apcm = snd_pcm_substream_chip(substream); 1370 struct azx *chip = apcm->chip; 1371 struct azx_dev *azx_dev = get_azx_dev(substream); 1478 if (start) { 1479 if (nsync == 1) 1480 return 0; 1481 /* wait until all FIFOs get ready */ 1482 for (timeout = 5000; timeout; timeout--) { 1483 nwait = 0; 1484 snd_pcm_group_for_each_entry(s, substream) { 1485 if (s->pcm->card != substream->pcm->card) 1486 continue; 1487 azx_dev = get_azx_dev(s); 1488 if (!(azx_sd_readb(azx_dev, SD_STS) & 1489 SD_STS_FIFO_READY)) 1490 nwait++; 1491 } 1492 if (!nwait) 1493 break; 1494 cpu_relax(); 1495 } 1496 } else { 1497 /* wait until all RUN bits are cleared */ 1498 for (timeout = 5000; timeout; timeout--) { 1499 nwait = 0; 1500 snd_pcm_group_for_each_entry(s, substream) { 1501 if (s->pcm->card != substream->pcm->card) 1502 continue; 1503 azx_dev = get_azx_dev(s); 1504 if (azx_sd_readb(azx_dev, SD_CTL) & 1505 SD_CTL_DMA_START) 1506 nwait++; 1507 } 1508 if (!nwait) 1509 break; 1510 cpu_relax(); 1511 } 1512 } 1513 if (nsync > 1) { 1514 spin_lock(&chip->reg_lock); 1515 /* reset SYNC bits */ 1516 azx_writel(chip, SYNC, azx_readl(chip, SYNC) & ~sbits); 1517 spin_unlock(&chip->reg_lock); 1518 } 1519 return 0; 1520 } 1521 1522 static unsigned int azx_get_position(struct azx *chip, 1523 struct azx_dev *azx_dev) 1524 { 1372 1525 unsigned int pos; 1373 1526 … … 1376 1529 /* use the position buffer */ 1377 1530 pos = le32_to_cpu(*azx_dev->posbuf); 1378 if (chip->position_fix == POS_FIX_AUTO && 1379 azx_dev->period_intr == 1 && !pos) { 1531 } else { 1532 /* read LPIB */ 1533 pos = azx_sd_readl(azx_dev, SD_LPIB); 1534 } 1535 if (pos >= azx_dev->bufsize) 1536 pos = 0; 1537 return pos; 1538 } 1539 1540 static snd_pcm_uframes_t azx_pcm_pointer(struct snd_pcm_substream *substream) 1541 { 1542 struct azx_pcm *apcm = snd_pcm_substream_chip(substream); 1543 struct azx *chip = apcm->chip; 1544 struct azx_dev *azx_dev = get_azx_dev(substream); 1545 return bytes_to_frames(substream->runtime, 1546 azx_get_position(chip, azx_dev)); 1547 } 1548 1549 /* 1550 * Check whether the current DMA position is acceptable for updating 1551 * periods. Returns non-zero if it's OK. 1552 * 1553 * Many HD-audio controllers appear pretty inaccurate about 1554 * the update-IRQ timing. The IRQ is issued before actually the 1555 * data is processed. So, we need to process it afterwords in a 1556 * workqueue. 1557 */ 1558 static int azx_position_ok(struct azx *chip, struct azx_dev *azx_dev) 1559 { 1560 unsigned int pos; 1561 1562 pos = azx_get_position(chip, azx_dev); 1563 if (chip->position_fix == POS_FIX_AUTO) { 1564 if (!pos) { 1380 1565 printk(KERN_WARNING 1381 1566 "hda-intel: Invalid position buffer, " 1382 1567 "using LPIB read method instead.\n"); 1383 chip->position_fix = POS_FIX_NONE; 1384 goto read_lpib; 1568 chip->position_fix = POS_FIX_LPIB; 1569 pos = azx_get_position(chip, azx_dev); 1570 } else 1571 chip->position_fix = POS_FIX_POSBUF; 1572 } 1573 1574 if (pos % azx_dev->period_bytes > azx_dev->period_bytes / 2) 1575 return 0; /* NG - it's below the period boundary */ 1576 return 1; /* OK, it's fine */ 1577 } 1578 1579 /* 1580 * The work for pending PCM period updates. 1581 */ 1582 static void azx_irq_pending_work(struct work_struct *work) 1583 { 1584 struct azx *chip = container_of(work, struct azx, irq_pending_work); 1585 int i, pending; 1586 1587 if (!chip->irq_pending_warned) { 1588 printk(KERN_WARNING 1589 "hda-intel: IRQ timing workaround is activated " 1590 "for card #%d. Suggest a bigger bdl_pos_adj.\n", 1591 chip->card->number); 1592 chip->irq_pending_warned = 1; 1593 } 1594 1595 for (;;) { 1596 pending = 0; 1597 spin_lock_irq(&chip->reg_lock); 1598 for (i = 0; i < chip->num_streams; i++) { 1599 struct azx_dev *azx_dev = &chip->azx_dev[i]; 1600 if (!azx_dev->irq_pending || 1601 !azx_dev->substream || 1602 !azx_dev->running) 1603 continue; 1604 if (azx_position_ok(chip, azx_dev)) { 1605 azx_dev->irq_pending = 0; 1606 spin_unlock(&chip->reg_lock); 1607 snd_pcm_period_elapsed(azx_dev->substream); 1608 spin_lock(&chip->reg_lock); 1609 } else 1610 pending++; 1385 1611 } 1386 } else { 1387 read_lpib: 1388 /* read LPIB */ 1389 pos = azx_sd_readl(azx_dev, SD_LPIB); 1390 if (chip->position_fix == POS_FIX_FIFO) 1391 pos += azx_dev->fifo_size; 1392 } 1393 if (pos >= azx_dev->bufsize) 1394 pos = 0; 1395 return bytes_to_frames(substream->runtime, pos); 1612 spin_unlock_irq(&chip->reg_lock); 1613 if (!pending) 1614 return; 1615 cond_resched(); 1616 } 1617 } 1618 1619 /* clear irq_pending flags and assure no on-going workq */ 1620 static void azx_clear_irq_pending(struct azx *chip) 1621 { 1622 int i; 1623 1624 spin_lock_irq(&chip->reg_lock); 1625 for (i = 0; i < chip->num_streams; i++) 1626 chip->azx_dev[i].irq_pending = 0; 1627 spin_unlock_irq(&chip->reg_lock); 1628 flush_scheduled_work(); 1396 1629 } 1397 1630 … … 1405 1638 .trigger = azx_pcm_trigger, 1406 1639 .pointer = azx_pcm_pointer, 1640 .page = snd_pcm_sgbuf_ops_page, 1407 1641 }; 1408 1642 … … 1413 1647 1414 1648 static int __devinit create_codec_pcm(struct azx *chip, struct hda_codec *codec, 1415 struct hda_pcm *cpcm , int pcm_dev)1649 struct hda_pcm *cpcm) 1416 1650 { 1417 1651 int err; … … 1427 1661 snd_assert(cpcm->name, return -EINVAL); 1428 1662 1429 err = snd_pcm_new(chip->card, cpcm->name, pcm_dev,1663 err = snd_pcm_new(chip->card, cpcm->name, cpcm->device, 1430 1664 cpcm->stream[0].substreams, 1431 1665 cpcm->stream[1].substreams, … … 1447 1681 if (cpcm->stream[1].substreams) 1448 1682 snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &azx_pcm_ops); 1449 snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV ,1683 snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV_SG, 1450 1684 snd_dma_pci_data(chip->pci), 1451 1685 1024 * 64, 1024 * 1024); 1452 chip->pcm[pcm_dev] = pcm; 1453 if (chip->pcm_devs < pcm_dev + 1) 1454 chip->pcm_devs = pcm_dev + 1; 1455 1686 chip->pcm[cpcm->device] = pcm; 1456 1687 return 0; 1457 1688 } … … 1459 1690 static int __devinit azx_pcm_create(struct azx *chip) 1460 1691 { 1692 static const char *dev_name[HDA_PCM_NTYPES] = { 1693 "Audio", "SPDIF", "HDMI", "Modem" 1694 }; 1695 /* starting device index for each PCM type */ 1696 static int dev_idx[HDA_PCM_NTYPES] = { 1697 [HDA_PCM_TYPE_AUDIO] = 0, 1698 [HDA_PCM_TYPE_SPDIF] = 1, 1699 [HDA_PCM_TYPE_HDMI] = 3, 1700 [HDA_PCM_TYPE_MODEM] = 6 1701 }; 1702 /* normal audio device indices; not linear to keep compatibility */ 1703 static int audio_idx[4] = { 0, 2, 4, 5 }; 1461 1704 struct hda_codec *codec; 1462 1705 int c, err; 1463 int pcm_dev;1706 int num_devs[HDA_PCM_NTYPES]; 1464 1707 1465 1708 err = snd_hda_build_pcms(chip->bus); … … 1468 1711 1469 1712 /* create audio PCMs */ 1470 pcm_dev = 0;1713 memset(num_devs, 0, sizeof(num_devs)); 1471 1714 list_for_each_entry(codec, &chip->bus->codec_list, list, struct hda_codec) { 1472 1715 for (c = 0; c < codec->num_pcms; c++) { 1473 if (codec->pcm_info[c].is_modem) 1474 continue; /* create later */ 1475 if (pcm_dev >= AZX_MAX_AUDIO_PCMS) { 1476 snd_printk(KERN_ERR SFX 1477 "Too many audio PCMs\n"); 1478 return -EINVAL; 1716 struct hda_pcm *cpcm = &codec->pcm_info[c]; 1717 int type = cpcm->pcm_type; 1718 switch (type) { 1719 case HDA_PCM_TYPE_AUDIO: 1720 if (num_devs[type] >= ARRAY_SIZE(audio_idx)) { 1721 snd_printk(KERN_WARNING 1722 "Too many audio devices\n"); 1723 continue; 1724 } 1725 cpcm->device = audio_idx[num_devs[type]]; 1726 break; 1727 case HDA_PCM_TYPE_SPDIF: 1728 case HDA_PCM_TYPE_HDMI: 1729 case HDA_PCM_TYPE_MODEM: 1730 if (num_devs[type]) { 1731 snd_printk(KERN_WARNING 1732 "%s already defined\n", 1733 dev_name[type]); 1734 continue; 1735 } 1736 cpcm->device = dev_idx[type]; 1737 break; 1738 default: 1739 snd_printk(KERN_WARNING 1740 "Invalid PCM type %d\n", type); 1741 continue; 1479 1742 } 1480 err = create_codec_pcm(chip, codec,1481 &codec->pcm_info[c], pcm_dev);1743 num_devs[type]++; 1744 err = create_codec_pcm(chip, codec, cpcm); 1482 1745 if (err < 0) 1483 1746 return err; 1484 pcm_dev++;1485 }1486 }1487 1488 /* create modem PCMs */1489 pcm_dev = AZX_MAX_AUDIO_PCMS;1490 list_for_each_entry(codec, &chip->bus->codec_list, list, struct hda_codec) {1491 for (c = 0; c < codec->num_pcms; c++) {1492 if (!codec->pcm_info[c].is_modem)1493 continue; /* already created */1494 if (pcm_dev >= AZX_MAX_PCMS) {1495 snd_printk(KERN_ERR SFX1496 "Too many modem PCMs\n");1497 return -EINVAL;1498 }1499 err = create_codec_pcm(chip, codec,1500 &codec->pcm_info[c], pcm_dev);1501 if (err < 0)1502 return err;1503 chip->pcm[pcm_dev]->dev_class = SNDRV_PCM_CLASS_MODEM;1504 pcm_dev++;1505 1747 } 1506 1748 } … … 1529 1771 */ 1530 1772 for (i = 0; i < chip->num_streams; i++) { 1531 unsigned int off = sizeof(u32) * (i * AZX_MAX_FRAG * 4);1532 1773 struct azx_dev *azx_dev = &chip->azx_dev[i]; 1533 azx_dev->bdl = (u32 *)(chip->bdl.area + off);1534 azx_dev->bdl_addr = chip->bdl.addr + off;1535 1774 azx_dev->posbuf = (u32 __iomem *)(chip->posbuf.area + i * 8); 1536 1775 /* offset: SDI0=0x80, SDI1=0xa0, ... SDO3=0x160 */ … … 1553 1792 printk(KERN_ERR "hda-intel: unable to grab IRQ %d, " 1554 1793 "disabling device\n", chip->pci->irq); 1555 #ifndef TARGE T_OS21794 #ifndef TARGEt_OS2 1556 1795 if (do_disconnect) 1557 1796 snd_card_disconnect(chip->card); … … 1563 1802 return 0; 1564 1803 } 1804 1565 1805 1566 1806 static void azx_stop_chip(struct azx *chip) … … 1615 1855 1616 1856 snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); 1617 for (i = 0; i < chip->pcm_devs; i++) 1857 azx_clear_irq_pending(chip); 1858 for (i = 0; i < AZX_MAX_PCMS; i++) 1618 1859 snd_pcm_suspend_all(chip->pcm[i]); 1619 1860 if (chip->initialized) … … 1621 1862 azx_stop_chip(chip); 1622 1863 if (chip->irq >= 0) { 1623 synchronize_irq(chip->irq);1624 1864 free_irq(chip->irq, chip); 1625 1865 chip->irq = -1; … … 1669 1909 static int azx_free(struct azx *chip) 1670 1910 { 1911 int i; 1912 1671 1913 if (chip->initialized) { 1672 int i;1914 azx_clear_irq_pending(chip); 1673 1915 for (i = 0; i < chip->num_streams; i++) 1674 1916 azx_stream_stop(chip, &chip->azx_dev[i]); … … 1676 1918 } 1677 1919 1678 if (chip->irq >= 0) { 1679 synchronize_irq(chip->irq); 1920 if (chip->irq >= 0) 1680 1921 free_irq(chip->irq, (void*)chip); 1681 }1682 1922 if (chip->msi) 1683 1923 pci_disable_msi(chip->pci); … … 1685 1925 #ifdef TARGET_OS2 1686 1926 iounmap((void *)chip->remap_addr); 1687 #else /* !TARGET_OS2 */1927 #else 1688 1928 iounmap(chip->remap_addr); 1689 #endif /* !TARGET_OS2 */ 1690 1691 if (chip->bdl.area) 1692 snd_dma_free_pages(&chip->bdl); 1929 #endif 1930 if (chip->azx_dev) { 1931 for (i = 0; i < chip->num_streams; i++) 1932 if (chip->azx_dev[i].bdl.area) 1933 snd_dma_free_pages(&chip->azx_dev[i].bdl); 1934 } 1693 1935 if (chip->rb.area) 1694 1936 snd_dma_free_pages(&chip->rb); … … 1712 1954 */ 1713 1955 static struct snd_pci_quirk position_fix_list[] __devinitdata = { 1714 SND_PCI_QUIRK(0x1028, 0x01cc, "Dell D820", POS_FIX_NONE), 1715 SND_PCI_QUIRK(0x1028, 0x01de, "Dell Precision 390", POS_FIX_NONE), 1956 SND_PCI_QUIRK(0x1028, 0x01cc, "Dell D820", POS_FIX_LPIB), 1957 SND_PCI_QUIRK(0x1028, 0x01de, "Dell Precision 390", POS_FIX_LPIB), 1958 SND_PCI_QUIRK(0x1043, 0x813d, "ASUS P5AD2", POS_FIX_LPIB), 1716 1959 {0} 1717 1960 }; … … 1772 2015 { 1773 2016 struct azx *chip; 1774 int err;2017 int i, err; 1775 2018 unsigned short gcap; 1776 2019 static struct snd_device_ops ops = { … … 1798 2041 chip->driver_type = driver_type; 1799 2042 chip->msi = enable_msi; 2043 chip->dev_index = dev; 2044 INIT_WORK(&chip->irq_pending_work, azx_irq_pending_work); 1800 2045 1801 2046 chip->position_fix = check_position_fix(chip, position_fix[dev]); … … 1803 2048 1804 2049 chip->single_cmd = single_cmd; 2050 2051 if (bdl_pos_adj[dev] < 0) { 2052 switch (chip->driver_type) { 2053 case AZX_DRIVER_ICH: 2054 bdl_pos_adj[dev] = 1; 2055 break; 2056 default: 2057 bdl_pos_adj[dev] = 32; 2058 break; 2059 } 2060 } 1805 2061 1806 2062 #if BITS_PER_LONG != 64 … … 1844 2100 snd_printdd("chipset global capabilities = 0x%x\n", gcap); 1845 2101 1846 if (gcap) { 1847 /* read number of streams from GCAP register instead of using 1848 * hardcoded value 1849 */ 1850 chip->playback_streams = (gcap & (0xF << 12)) >> 12; 1851 chip->capture_streams = (gcap & (0xF << 8)) >> 8; 1852 chip->playback_index_offset = (gcap & (0xF << 12)) >> 12; 1853 chip->capture_index_offset = 0; 1854 } else { 2102 /* allow 64bit DMA address if supported by H/W */ 2103 if ((gcap & 0x01) && !pci_set_dma_mask(pci, DMA_64BIT_MASK)) 2104 pci_set_consistent_dma_mask(pci, DMA_64BIT_MASK); 2105 2106 /* read number of streams from GCAP register instead of using 2107 * hardcoded value 2108 */ 2109 chip->capture_streams = (gcap >> 8) & 0x0f; 2110 chip->playback_streams = (gcap >> 12) & 0x0f; 2111 if (!chip->playback_streams && !chip->capture_streams) { 1855 2112 /* gcap didn't give any info, switching to old method */ 1856 2113 … … 1859 2116 chip->playback_streams = ULI_NUM_PLAYBACK; 1860 2117 chip->capture_streams = ULI_NUM_CAPTURE; 1861 chip->playback_index_offset = ULI_PLAYBACK_INDEX;1862 chip->capture_index_offset = ULI_CAPTURE_INDEX;1863 2118 break; 1864 2119 case AZX_DRIVER_ATIHDMI: 1865 2120 chip->playback_streams = ATIHDMI_NUM_PLAYBACK; 1866 2121 chip->capture_streams = ATIHDMI_NUM_CAPTURE; 1867 chip->playback_index_offset = ATIHDMI_PLAYBACK_INDEX;1868 chip->capture_index_offset = ATIHDMI_CAPTURE_INDEX;1869 2122 break; 1870 2123 default: 1871 2124 chip->playback_streams = ICH6_NUM_PLAYBACK; 1872 2125 chip->capture_streams = ICH6_NUM_CAPTURE; 1873 chip->playback_index_offset = ICH6_PLAYBACK_INDEX;1874 chip->capture_index_offset = ICH6_CAPTURE_INDEX;1875 2126 break; 1876 2127 } 1877 2128 } 2129 chip->capture_index_offset = 0; 2130 chip->playback_index_offset = chip->capture_streams; 1878 2131 chip->num_streams = chip->playback_streams + chip->capture_streams; 1879 2132 chip->azx_dev = kcalloc(chip->num_streams, sizeof(*chip->azx_dev), … … 1884 2137 } 1885 2138 1886 /* allocate memory for the BDL for each stream */ 1887 err = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, 1888 snd_dma_pci_data(chip->pci), 1889 BDL_SIZE, &chip->bdl); 1890 if (err < 0) { 1891 snd_printk(KERN_ERR SFX "cannot allocate BDL\n"); 1892 goto errout; 2139 for (i = 0; i < chip->num_streams; i++) { 2140 /* allocate memory for the BDL for each stream */ 2141 err = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, 2142 snd_dma_pci_data(chip->pci), 2143 BDL_SIZE, &chip->azx_dev[i].bdl); 2144 if (err < 0) { 2145 snd_printk(KERN_ERR SFX "cannot allocate BDL\n"); 2146 goto errout; 2147 } 1893 2148 } 1894 2149 /* allocate memory for the position buffer */ … … 2026 2281 /* PCI IDs */ 2027 2282 static struct pci_device_id azx_ids[] = { 2028 { 0x8086, 0x2668, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_ICH }, /* ICH6 */ 2029 { 0x8086, 0x27d8, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_ICH }, /* ICH7 */ 2030 { 0x8086, 0x269a, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_ICH }, /* ESB2 */ 2031 { 0x8086, 0x284b, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_ICH }, /* ICH8 */ 2032 { 0x8086, 0x293e, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_ICH }, /* ICH9 */ 2033 { 0x8086, 0x293f, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_ICH }, /* ICH9 */ 2034 { 0x8086, 0x3a3e, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_ICH }, /* ICH10 */ 2035 { 0x8086, 0x3a6e, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_ICH }, /* ICH10 */ 2036 { 0x8086, 0x811b, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_SCH }, /* SCH*/ 2037 { 0x1002, 0x437b, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_ATI }, /* ATI SB450 */ 2038 { 0x1002, 0x4383, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_ATI }, /* ATI SB600 */ 2039 { 0x1002, 0x793b, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_ATIHDMI }, /* ATI RS600 HDMI */ 2040 { 0x1002, 0x7919, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_ATIHDMI }, /* ATI RS690 HDMI */ 2041 { 0x1002, 0x960f, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_ATIHDMI }, /* ATI RS780 HDMI */ 2042 { 0x1002, 0xaa00, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_ATIHDMI }, /* ATI R600 HDMI */ 2043 { 0x1002, 0xaa08, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_ATIHDMI }, /* ATI RV630 HDMI */ 2044 { 0x1002, 0xaa10, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_ATIHDMI }, /* ATI RV610 HDMI */ 2045 { 0x1002, 0xaa18, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_ATIHDMI }, /* ATI RV670 HDMI */ 2046 { 0x1002, 0xaa20, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_ATIHDMI }, /* ATI RV635 HDMI */ 2047 { 0x1002, 0xaa28, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_ATIHDMI }, /* ATI RV620 HDMI */ 2048 { 0x1002, 0xaa30, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_ATIHDMI }, /* ATI RV770 HDMI */ 2049 { 0x1106, 0x3288, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_VIA }, /* VIA VT8251/VT8237A */ 2050 { 0x1039, 0x7502, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_SIS }, /* SIS966 */ 2051 { 0x10b9, 0x5461, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_ULI }, /* ULI M5461 */ 2052 { 0x10de, 0x026c, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_NVIDIA }, /* NVIDIA MCP51 */ 2053 { 0x10de, 0x0371, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_NVIDIA }, /* NVIDIA MCP55 */ 2054 { 0x10de, 0x03e4, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_NVIDIA }, /* NVIDIA MCP61 */ 2055 { 0x10de, 0x03f0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_NVIDIA }, /* NVIDIA MCP61 */ 2056 { 0x10de, 0x044a, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_NVIDIA }, /* NVIDIA MCP65 */ 2057 { 0x10de, 0x044b, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_NVIDIA }, /* NVIDIA MCP65 */ 2058 { 0x10de, 0x055c, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_NVIDIA }, /* NVIDIA MCP67 */ 2059 { 0x10de, 0x055d, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_NVIDIA }, /* NVIDIA MCP67 */ 2060 { 0x10de, 0x07fc, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_NVIDIA }, /* NVIDIA MCP73 */ 2061 { 0x10de, 0x07fd, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_NVIDIA }, /* NVIDIA MCP73 */ 2062 { 0x10de, 0x0774, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_NVIDIA }, /* NVIDIA MCP77 */ 2063 { 0x10de, 0x0775, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_NVIDIA }, /* NVIDIA MCP77 */ 2064 { 0x10de, 0x0776, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_NVIDIA }, /* NVIDIA MCP77 */ 2065 { 0x10de, 0x0777, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_NVIDIA }, /* NVIDIA MCP77 */ 2066 { 0x10de, 0x0ac0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_NVIDIA }, /* NVIDIA MCP79 */ 2067 { 0x10de, 0x0ac1, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_NVIDIA }, /* NVIDIA MCP79 */ 2068 { 0x10de, 0x0ac2, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_NVIDIA }, /* NVIDIA MCP79 */ 2069 { 0x10de, 0x0ac3, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_NVIDIA }, /* NVIDIA MCP79 */ 2283 /* ICH 6..10 */ 2284 { PCI_DEVICE(0x8086, 0x2668), .driver_data = AZX_DRIVER_ICH }, 2285 { PCI_DEVICE(0x8086, 0x27d8), .driver_data = AZX_DRIVER_ICH }, 2286 { PCI_DEVICE(0x8086, 0x269a), .driver_data = AZX_DRIVER_ICH }, 2287 { PCI_DEVICE(0x8086, 0x284b), .driver_data = AZX_DRIVER_ICH }, 2288 { PCI_DEVICE(0x8086, 0x2911), .driver_data = AZX_DRIVER_ICH }, 2289 { PCI_DEVICE(0x8086, 0x293e), .driver_data = AZX_DRIVER_ICH }, 2290 { PCI_DEVICE(0x8086, 0x293f), .driver_data = AZX_DRIVER_ICH }, 2291 { PCI_DEVICE(0x8086, 0x3a3e), .driver_data = AZX_DRIVER_ICH }, 2292 { PCI_DEVICE(0x8086, 0x3a6e), .driver_data = AZX_DRIVER_ICH }, 2293 /* SCH */ 2294 { PCI_DEVICE(0x8086, 0x811b), .driver_data = AZX_DRIVER_SCH }, 2295 /* ATI SB 450/600 */ 2296 { PCI_DEVICE(0x1002, 0x437b), .driver_data = AZX_DRIVER_ATI }, 2297 { PCI_DEVICE(0x1002, 0x4383), .driver_data = AZX_DRIVER_ATI }, 2298 /* ATI HDMI */ 2299 { PCI_DEVICE(0x1002, 0x793b), .driver_data = AZX_DRIVER_ATIHDMI }, 2300 { PCI_DEVICE(0x1002, 0x7919), .driver_data = AZX_DRIVER_ATIHDMI }, 2301 { PCI_DEVICE(0x1002, 0x960f), .driver_data = AZX_DRIVER_ATIHDMI }, 2302 { PCI_DEVICE(0x1002, 0xaa00), .driver_data = AZX_DRIVER_ATIHDMI }, 2303 { PCI_DEVICE(0x1002, 0xaa08), .driver_data = AZX_DRIVER_ATIHDMI }, 2304 { PCI_DEVICE(0x1002, 0xaa10), .driver_data = AZX_DRIVER_ATIHDMI }, 2305 { PCI_DEVICE(0x1002, 0xaa18), .driver_data = AZX_DRIVER_ATIHDMI }, 2306 { PCI_DEVICE(0x1002, 0xaa20), .driver_data = AZX_DRIVER_ATIHDMI }, 2307 { PCI_DEVICE(0x1002, 0xaa28), .driver_data = AZX_DRIVER_ATIHDMI }, 2308 { PCI_DEVICE(0x1002, 0xaa30), .driver_data = AZX_DRIVER_ATIHDMI }, 2309 { PCI_DEVICE(0x1002, 0xaa38), .driver_data = AZX_DRIVER_ATIHDMI }, 2310 { PCI_DEVICE(0x1002, 0xaa40), .driver_data = AZX_DRIVER_ATIHDMI }, 2311 { PCI_DEVICE(0x1002, 0xaa48), .driver_data = AZX_DRIVER_ATIHDMI }, 2312 /* VIA VT8251/VT8237A */ 2313 { PCI_DEVICE(0x1106, 0x3288), .driver_data = AZX_DRIVER_VIA }, 2314 /* SIS966 */ 2315 { PCI_DEVICE(0x1039, 0x7502), .driver_data = AZX_DRIVER_SIS }, 2316 /* ULI M5461 */ 2317 { PCI_DEVICE(0x10b9, 0x5461), .driver_data = AZX_DRIVER_ULI }, 2318 /* NVIDIA MCP */ 2319 { PCI_DEVICE(0x10de, 0x026c), .driver_data = AZX_DRIVER_NVIDIA }, 2320 { PCI_DEVICE(0x10de, 0x0371), .driver_data = AZX_DRIVER_NVIDIA }, 2321 { PCI_DEVICE(0x10de, 0x03e4), .driver_data = AZX_DRIVER_NVIDIA }, 2322 { PCI_DEVICE(0x10de, 0x03f0), .driver_data = AZX_DRIVER_NVIDIA }, 2323 { PCI_DEVICE(0x10de, 0x044a), .driver_data = AZX_DRIVER_NVIDIA }, 2324 { PCI_DEVICE(0x10de, 0x044b), .driver_data = AZX_DRIVER_NVIDIA }, 2325 { PCI_DEVICE(0x10de, 0x055c), .driver_data = AZX_DRIVER_NVIDIA }, 2326 { PCI_DEVICE(0x10de, 0x055d), .driver_data = AZX_DRIVER_NVIDIA }, 2327 { PCI_DEVICE(0x10de, 0x0774), .driver_data = AZX_DRIVER_NVIDIA }, 2328 { PCI_DEVICE(0x10de, 0x0775), .driver_data = AZX_DRIVER_NVIDIA }, 2329 { PCI_DEVICE(0x10de, 0x0776), .driver_data = AZX_DRIVER_NVIDIA }, 2330 { PCI_DEVICE(0x10de, 0x0777), .driver_data = AZX_DRIVER_NVIDIA }, 2331 { PCI_DEVICE(0x10de, 0x07fc), .driver_data = AZX_DRIVER_NVIDIA }, 2332 { PCI_DEVICE(0x10de, 0x07fd), .driver_data = AZX_DRIVER_NVIDIA }, 2333 { PCI_DEVICE(0x10de, 0x0ac0), .driver_data = AZX_DRIVER_NVIDIA }, 2334 { PCI_DEVICE(0x10de, 0x0ac1), .driver_data = AZX_DRIVER_NVIDIA }, 2335 { PCI_DEVICE(0x10de, 0x0ac2), .driver_data = AZX_DRIVER_NVIDIA }, 2336 { PCI_DEVICE(0x10de, 0x0ac3), .driver_data = AZX_DRIVER_NVIDIA }, 2337 { PCI_DEVICE(0x10de, 0x0bd4), .driver_data = AZX_DRIVER_NVIDIA }, 2338 { PCI_DEVICE(0x10de, 0x0bd5), .driver_data = AZX_DRIVER_NVIDIA }, 2339 { PCI_DEVICE(0x10de, 0x0bd6), .driver_data = AZX_DRIVER_NVIDIA }, 2340 { PCI_DEVICE(0x10de, 0x0bd7), .driver_data = AZX_DRIVER_NVIDIA }, 2341 /* Teradici */ 2342 { PCI_DEVICE(0x6549, 0x1200), .driver_data = AZX_DRIVER_TERA }, 2070 2343 { 0, } 2071 2344 }; -
GPL/branches/uniaud32-2.0/alsa-kernel/pci/hda/hda_local.h
r315 r358 233 233 int dig_out_used; /* current usage of digital out (HDA_DIG_XXX) */ 234 234 int no_share_stream; /* don't share a stream with multiple pins */ 235 }; 236 235 int share_spdif; /* share SPDIF pin */ 236 /* PCM information for both analog and SPDIF DACs */ 237 unsigned int analog_rates; 238 unsigned int analog_maxbps; 239 u64 analog_formats; 240 unsigned int spdif_rates; 241 unsigned int spdif_maxbps; 242 u64 spdif_formats; 243 }; 244 245 int snd_hda_create_spdif_share_sw(struct hda_codec *codec, 246 struct hda_multi_out *mout); 237 247 int snd_hda_multi_out_dig_open(struct hda_codec *codec, 238 248 struct hda_multi_out *mout); … … 246 256 int snd_hda_multi_out_analog_open(struct hda_codec *codec, 247 257 struct hda_multi_out *mout, 248 struct snd_pcm_substream *substream); 258 struct snd_pcm_substream *substream, 259 struct hda_pcm_stream *hinfo); 249 260 int snd_hda_multi_out_analog_prepare(struct hda_codec *codec, 250 261 struct hda_multi_out *mout, … … 412 423 #endif /* CONFIG_SND_HDA_POWER_SAVE */ 413 424 414 /*415 * virtual master control416 */417 struct snd_kcontrol *snd_ctl_make_virtual_master(char *name,418 const unsigned int *tlv);419 int snd_ctl_add_slave(struct snd_kcontrol *master, struct snd_kcontrol *slave);420 421 425 #endif /* __SOUND_HDA_LOCAL_H */ -
GPL/branches/uniaud32-2.0/alsa-kernel/pci/hda/hda_patch.h
r305 r358 19 19 /* VIA codecs */ 20 20 extern struct hda_codec_preset snd_hda_preset_via[]; 21 22 static const struct hda_codec_preset *hda_preset_tables[] = {23 #ifdef CONFIG_SND_HDA_CODEC_REALTEK24 snd_hda_preset_realtek,25 #endif26 #ifdef CONFIG_SND_HDA_CODEC_CMEDIA27 snd_hda_preset_cmedia,28 #endif29 #ifdef CONFIG_SND_HDA_CODEC_ANALOG30 snd_hda_preset_analog,31 #endif32 #ifdef CONFIG_SND_HDA_CODEC_SIGMATEL33 snd_hda_preset_sigmatel,34 #endif35 #ifdef CONFIG_SND_HDA_CODEC_SI305436 snd_hda_preset_si3054,37 #endif38 #ifdef CONFIG_SND_HDA_CODEC_ATIHDMI39 snd_hda_preset_atihdmi,40 #endif41 #ifdef CONFIG_SND_HDA_CODEC_CONEXANT42 snd_hda_preset_conexant,43 #endif44 #ifdef CONFIG_SND_HDA_CODEC_VIA45 snd_hda_preset_via,46 #endif47 NULL48 }; -
GPL/branches/uniaud32-2.0/alsa-kernel/pci/hda/hda_proc.c
r305 r358 367 367 unsigned int digi1 = snd_hda_codec_read(codec, nid, 0, 368 368 AC_VERB_GET_DIGI_CONVERT_1, 0); 369 unsigned int digi2 = snd_hda_codec_read(codec, nid, 0,370 AC_VERB_GET_DIGI_CONVERT_2, 0);371 369 snd_iprintf(buffer, " Digital:"); 372 370 if (digi1 & AC_DIG1_ENABLE) … … 387 385 snd_iprintf(buffer, " GenLevel"); 388 386 snd_iprintf(buffer, "\n"); 389 snd_iprintf(buffer, " Digital category: 0x%x\n", digi2 & AC_DIG2_CC); 387 snd_iprintf(buffer, " Digital category: 0x%x\n", 388 (digi1 >> 8) & AC_DIG2_CC); 390 389 } 391 390 … … 585 584 snd_iprintf(buffer, " Amp-In vals: "); 586 585 print_amp_vals(buffer, codec, nid, HDA_INPUT, 587 wid_caps & AC_WCAP_STEREO, conn_len); 586 wid_caps & AC_WCAP_STEREO, 587 wid_type == AC_WID_PIN ? 1 : conn_len); 588 588 } 589 589 if (wid_caps & AC_WCAP_OUT_AMP) { -
GPL/branches/uniaud32-2.0/alsa-kernel/pci/hda/makefile.os2
r313 r358 2 2 AINCLUDES = $(DDK_BASE)\H 3 3 4 CDEFINES = -D__KERNEL__ -DMODULE -dTARGET_OS2 -dALSA_BUILD -D__ISAPNP__ -DCONFIG_ISAPNP -D__i386_ 4 CDEFINES = -D__KERNEL__ -DMODULE -dTARGET_OS2 -dALSA_BUILD -D__ISAPNP__ -DCONFIG_ISAPNP -D__i386_ 5 5 6 6 32BIT=1 … … 13 13 # 14 14 #=================================================================== 15 FILE1 = hda_intel.obj hda_codec.obj vmaster.obj hda_proc.obj hda_hwdep.obj hda_generic.obj patch_realtek.obj16 FILE2 = patch_ cmedia.obj patch_analog.obj patch_sigmatel.obj17 FILE3 = patch_si3054.obj patch_atihdmi.obj patch_conexant.obj 18 FILE4 = patch_via.obj19 FILE5 = 20 FILE6 = 21 FILE7 = 22 FILE8 = 15 FILE1 = hda_intel.obj hda_codec.obj hda_proc.obj hda_hwdep.obj hda_generic.obj 16 FILE2 = patch_realtek.obj patch_cmedia.obj patch_analog.obj patch_sigmatel.obj 17 FILE3 = patch_si3054.obj patch_atihdmi.obj patch_conexant.obj patch_via.obj 18 FILE4 = 19 FILE5 = 20 FILE6 = 21 FILE7 = 22 FILE8 = 23 23 FILELAST = 24 24 FILES = $(FILE0) $(FILE1) $(FILE2) $(FILE3) $(FILE4) $(FILE5) $(FILE6) $(FILE7) $(FILE8) $(FILE9) $(FILE10) $(FILE11) $(FILE12) … … 34 34 # 35 35 #=================================================================== 36 all: $(OBJDIR)\$(TARGET).lib 36 all: $(OBJDIR)\$(TARGET).lib 37 37 38 38 … … 43 43 $(OBJDIR)\$(TARGET).lib: $(LNKFILE) $(FILES) 44 44 $(LIB) $(OBJDIR)\$(TARGET).lib @$(LNKFILE) 45 copy $(OBJDIR)\$(TARGET).lib $(ALSA_LIB) 45 copy $(OBJDIR)\$(TARGET).lib $(ALSA_LIB) 46 46 47 47 clean: .SYMBOLIC … … 49 49 @cd $(OBJDIR) 50 50 -rm *.obj *.lnk *.sys *.sym *.lst *.map *.wmap *.lib 2>nul 51 @cd .. \..51 @cd ../.. -
GPL/branches/uniaud32-2.0/alsa-kernel/pci/hda/patch_analog.c
r305 r358 24 24 #include <linux/slab.h> 25 25 #include <linux/pci.h> 26 #include <linux/mutex.h>27 26 28 27 #include <sound/core.h> 29 28 #include "hda_codec.h" 30 29 #include "hda_local.h" 30 #include "hda_patch.h" 31 31 32 32 struct ad198x_spec { … … 64 64 struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */ 65 65 66 struct mutex amp_mutex; /* PCM volume/mute control mutex */67 66 unsigned int spdif_route; 68 67 … … 81 80 /* for virtual master */ 82 81 hda_nid_t vmaster_nid; 83 u32 vmaster_tlv[4];84 82 const char **slave_vols; 85 83 const char **slave_sws; … … 172 170 if (err < 0) 173 171 return err; 172 err = snd_hda_create_spdif_share_sw(codec, 173 &spec->multiout); 174 if (err < 0) 175 return err; 176 spec->multiout.share_spdif = 1; 174 177 } 175 178 if (spec->dig_in_nid) { … … 181 184 /* if we have no master control, let's create it */ 182 185 if (!snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) { 186 unsigned int vmaster_tlv[4]; 183 187 snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid, 184 HDA_OUTPUT, spec->vmaster_tlv);188 HDA_OUTPUT, vmaster_tlv); 185 189 err = snd_hda_add_vmaster(codec, "Master Playback Volume", 186 spec->vmaster_tlv,190 vmaster_tlv, 187 191 (spec->slave_vols ? 188 192 spec->slave_vols : ad_slave_vols)); … … 218 222 { 219 223 struct ad198x_spec *spec = codec->spec; 220 return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream); 224 return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream, 225 hinfo); 221 226 } 222 227 … … 290 295 { 291 296 struct ad198x_spec *spec = codec->spec; 292 snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number], 293 0, 0, 0); 297 snd_hda_codec_cleanup_stream(codec, spec->adc_nids[substream->number]); 294 298 return 0; 295 299 } … … 360 364 codec->num_pcms++; 361 365 info->name = "AD198x Digital"; 366 info->pcm_type = HDA_PCM_TYPE_SPDIF; 362 367 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = ad198x_pcm_digital_playback; 363 368 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid; … … 612 617 }; 613 618 619 static struct hda_input_mux ad1986a_automic_capture_source = { 620 .num_items = 2, 621 .items = { 622 { "Mic", 0x0 }, 623 { "Mix", 0x5 }, 624 }, 625 }; 626 614 627 static struct snd_kcontrol_new ad1986a_laptop_eapd_mixers[] = { 615 628 HDA_BIND_VOL("Master Playback Volume", &ad1986a_laptop_master_vol), … … 617 630 HDA_CODEC_VOLUME("PCM Playback Volume", 0x03, 0x0, HDA_OUTPUT), 618 631 HDA_CODEC_MUTE("PCM Playback Switch", 0x03, 0x0, HDA_OUTPUT), 619 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x17, 0x0, HDA_OUTPUT),620 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x17, 0x0, HDA_OUTPUT),621 632 HDA_CODEC_VOLUME("Mic Playback Volume", 0x13, 0x0, HDA_OUTPUT), 622 633 HDA_CODEC_MUTE("Mic Playback Switch", 0x13, 0x0, HDA_OUTPUT), … … 641 652 {0} /* end */ 642 653 }; 654 655 /* re-connect the mic boost input according to the jack sensing */ 656 static void ad1986a_automic(struct hda_codec *codec) 657 { 658 unsigned int present; 659 present = snd_hda_codec_read(codec, 0x1f, 0, AC_VERB_GET_PIN_SENSE, 0); 660 /* 0 = 0x1f, 2 = 0x1d, 4 = mixed */ 661 snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_CONNECT_SEL, 662 (present & AC_PINSENSE_PRESENCE) ? 0 : 2); 663 } 664 665 #define AD1986A_MIC_EVENT 0x36 666 667 static void ad1986a_automic_unsol_event(struct hda_codec *codec, 668 unsigned int res) 669 { 670 if ((res >> 26) != AD1986A_MIC_EVENT) 671 return; 672 ad1986a_automic(codec); 673 } 674 675 static int ad1986a_automic_init(struct hda_codec *codec) 676 { 677 ad198x_init(codec); 678 ad1986a_automic(codec); 679 return 0; 680 } 643 681 644 682 /* laptop-automute - 2ch only */ … … 810 848 /* Mic selector, mix C/LFE (backmic) and Mic (frontmic) */ 811 849 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x4 }, 812 { 0} /* end */850 {0} /* end */ 813 851 }; 814 852 … … 820 858 { 0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, 821 859 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x4 }, 822 { 0} /* end */860 {0} /* end */ 823 861 }; 824 862 … … 830 868 { 0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, 831 869 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x0 }, 832 { 0 } /* end */ 833 }; 834 870 {0} /* end */ 871 }; 835 872 836 873 static struct hda_channel_mode ad1986a_modes[3] = { … … 843 880 static struct hda_verb ad1986a_eapd_init_verbs[] = { 844 881 {0x1b, AC_VERB_SET_EAPD_BTLENABLE, 0x00 }, 882 {0} 883 }; 884 885 static struct hda_verb ad1986a_automic_verbs[] = { 886 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, 887 {0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, 888 /*{0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},*/ 889 {0x0f, AC_VERB_SET_CONNECT_SEL, 0x0}, 890 {0x1f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | AD1986A_MIC_EVENT}, 845 891 {0} 846 892 }; … … 869 915 AD1986A_3STACK, 870 916 AD1986A_LAPTOP, 871 917 AD1986A_LAPTOP_EAPD, 872 918 AD1986A_LAPTOP_AUTOMUTE, 873 919 AD1986A_ULTRA, 874 920 AD1986A_MODELS 875 921 }; … … 879 925 [AD1986A_3STACK] = "3stack", 880 926 [AD1986A_LAPTOP] = "laptop", 881 927 [AD1986A_LAPTOP_EAPD] = "laptop-eapd", 882 928 [AD1986A_LAPTOP_AUTOMUTE] = "laptop-automute", 883 929 [AD1986A_ULTRA] = "ultra", 884 930 }; 885 931 … … 988 1034 case AD1986A_LAPTOP_EAPD: 989 1035 spec->mixers[0] = ad1986a_laptop_eapd_mixers; 990 spec->num_init_verbs = 2;1036 spec->num_init_verbs = 3; 991 1037 spec->init_verbs[1] = ad1986a_eapd_init_verbs; 1038 spec->init_verbs[2] = ad1986a_automic_verbs; 992 1039 spec->multiout.max_channels = 2; 993 1040 spec->multiout.num_dacs = 1; … … 995 1042 if (!is_jack_available(codec, 0x25)) 996 1043 spec->multiout.dig_out_nid = 0; 997 spec->input_mux = &ad1986a_laptop_eapd_capture_source; 1044 spec->input_mux = &ad1986a_automic_capture_source; 1045 codec->patch_ops.unsol_event = ad1986a_automic_unsol_event; 1046 codec->patch_ops.init = ad1986a_automic_init; 998 1047 break; 999 1048 case AD1986A_LAPTOP_AUTOMUTE: … … 1022 1071 } 1023 1072 1024 return 0; 1073 /* AD1986A has a hardware problem that it can't share a stream 1074 * with multiple output pins. The copy of front to surrounds 1075 * causes noisy or silent outputs at a certain timing, e.g. 1076 * changing the volume. 1077 * So, let's disable the shared stream. 1078 */ 1079 spec->multiout.no_share_stream = 1; 1080 1081 return 0; 1025 1082 } 1026 1083 … … 1197 1254 spec->loopback.amplist = ad1983_loopbacks; 1198 1255 #endif 1256 spec->vmaster_nid = 0x05; 1199 1257 1200 1258 codec->patch_ops = ad198x_patch_ops; 1201 1202 /* AD1986A has a hardware problem that it can't share a stream1203 * with multiple output pins. The copy of front to surrounds1204 * causes noisy or silent outputs at a certain timing, e.g.1205 * changing the volume.1206 * So, let's disable the shared stream.1207 */1208 spec->multiout.no_share_stream = 1;1209 1259 1210 1260 return 0; … … 1366 1416 if (! ad198x_eapd_put(kcontrol, ucontrol)) 1367 1417 return 0; 1368 1418 /* change speaker pin appropriately */ 1419 snd_hda_codec_write(codec, 0x05, 0, 1420 AC_VERB_SET_PIN_WIDGET_CONTROL, 1421 spec->cur_eapd ? PIN_OUT : 0); 1369 1422 /* toggle HP mute appropriately */ 1370 1423 snd_hda_codec_amp_stereo(codec, 0x06, HDA_OUTPUT, 0, … … 1497 1550 {0x06, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | AD1981_HP_EVENT}, 1498 1551 {0x08, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | AD1981_MIC_EVENT}, 1499 { 0}1552 {0} 1500 1553 }; 1501 1554 … … 1503 1556 HDA_CODEC_VOLUME("Amp Volume", 0x1a, 0x0, HDA_OUTPUT), 1504 1557 HDA_CODEC_MUTE("Amp Switch", 0x1a, 0x0, HDA_OUTPUT), 1505 { 0}1558 {0} 1506 1559 }; 1507 1560 … … 1564 1617 static struct snd_pci_quirk ad1981_cfg_tbl[] = { 1565 1618 SND_PCI_QUIRK(0x1014, 0x0597, "Lenovo Z60", AD1981_THINKPAD), 1566 /* All HP models */ 1567 SND_PCI_QUIRK(0x103c, 0, "HP nx", AD1981_HP), 1619 SND_PCI_QUIRK(0x1014, 0x05b7, "Lenovo Z60m", AD1981_THINKPAD), 1620 /* All HP models */ 1621 SND_PCI_QUIRK(0x103c, 0, "HP nx", AD1981_HP), 1568 1622 SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba U205", AD1981_TOSHIBA), 1569 1570 1623 /* Lenovo Thinkpad T60/X60/Z6xx */ 1624 SND_PCI_QUIRK(0x17aa, 0, "Lenovo Thinkpad", AD1981_THINKPAD), 1571 1625 /* HP nx6320 (reversed SSID, H/W bug) */ 1572 1626 SND_PCI_QUIRK(0x30b0, 0x103c, "HP nx6320", AD1981_HP), … … 1779 1833 .num_items = 5, 1780 1834 .items = { 1781 { "Front Mic", 0x 0 },1782 { "Line", 0x 1 },1783 { "Mic", 0x4 }, 1835 { "Front Mic", 0x1 }, /* port-B */ 1836 { "Line", 0x2 }, /* port-C */ 1837 { "Mic", 0x4 }, /* port-E */ 1784 1838 { "CD", 0x5 }, 1785 1839 { "Mix", 0x9 }, … … 1790 1844 .num_items = 3, 1791 1845 .items = { 1792 { "Mic/Line", 0x 0 },1846 { "Mic/Line", 0x1 }, /* port-B */ 1793 1847 { "CD", 0x5 }, 1794 1848 { "Mix", 0x9 }, … … 2088 2142 }; 2089 2143 2144 static struct snd_kcontrol_new ad1989_spdif_out_mixers[] = { 2145 HDA_CODEC_VOLUME("IEC958 Playback Volume", 0x1b, 0x0, HDA_OUTPUT), 2146 {0} /* end */ 2147 }; 2090 2148 2091 2149 /* … … 2188 2246 }; 2189 2247 2248 /* AD1989 has no ADC -> SPDIF route */ 2249 static struct hda_verb ad1989_spdif_init_verbs[] = { 2250 /* SPDIF out pin */ 2251 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE | 0x27}, /* 0dB */ 2252 {0} 2253 }; 2254 2190 2255 /* 2191 2256 * verbs for 3stack (+dig) … … 2558 2623 struct ad198x_spec *spec = codec->spec; 2559 2624 hda_nid_t nid; 2560 int i dx, err;2625 int i, idx, err; 2561 2626 char name[32]; 2562 2627 … … 2566 2631 idx = ad1988_pin_idx(pin); 2567 2632 nid = ad1988_idx_to_dac(codec, idx); 2568 /* specify the DAC as the extra output */ 2569 if (! spec->multiout.hp_nid) 2570 spec->multiout.hp_nid = nid; 2571 else 2572 spec->multiout.extra_out_nid[0] = nid; 2573 /* control HP volume/switch on the output mixer amp */ 2574 sprintf(name, "%s Playback Volume", pfx); 2575 if ((err = add_control(spec, AD_CTL_WIDGET_VOL, name, 2576 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT))) < 0) 2577 return err; 2633 /* check whether the corresponding DAC was already taken */ 2634 for (i = 0; i < spec->autocfg.line_outs; i++) { 2635 hda_nid_t pin = spec->autocfg.line_out_pins[i]; 2636 hda_nid_t dac = ad1988_idx_to_dac(codec, ad1988_pin_idx(pin)); 2637 if (dac == nid) 2638 break; 2639 } 2640 if (i >= spec->autocfg.line_outs) { 2641 /* specify the DAC as the extra output */ 2642 if (!spec->multiout.hp_nid) 2643 spec->multiout.hp_nid = nid; 2644 else 2645 spec->multiout.extra_out_nid[0] = nid; 2646 /* control HP volume/switch on the output mixer amp */ 2647 sprintf(name, "%s Playback Volume", pfx); 2648 err = add_control(spec, AD_CTL_WIDGET_VOL, name, 2649 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); 2650 if (err < 0) 2651 return err; 2652 } 2578 2653 nid = ad1988_mixer_nids[idx]; 2579 2654 sprintf(name, "%s Playback Switch", pfx); … … 2792 2867 static struct snd_pci_quirk ad1988_cfg_tbl[] = { 2793 2868 SND_PCI_QUIRK(0x1043, 0x81ec, "Asus P5B-DLX", AD1988_6STACK_DIG), 2794 SND_PCI_QUIRK(0x1043, 0x81f6, "Asus M2N-SLI", AD1988_6STACK_DIG), 2869 SND_PCI_QUIRK(0x1043, 0x81f6, "Asus M2N-SLI", AD1988_6STACK_DIG), 2870 SND_PCI_QUIRK(0x1043, 0x8277, "Asus P5K-E/WIFI-AP", AD1988_6STACK_DIG), 2795 2871 {0} 2796 2872 }; … … 2895 2971 spec->init_verbs[spec->num_init_verbs++] = ad1988_capture_init_verbs; 2896 2972 if (spec->multiout.dig_out_nid) { 2897 spec->mixers[spec->num_mixers++] = ad1988_spdif_out_mixers; 2898 spec->init_verbs[spec->num_init_verbs++] = ad1988_spdif_init_verbs; 2973 if (codec->vendor_id >= 0x11d4989a) { 2974 spec->mixers[spec->num_mixers++] = 2975 ad1989_spdif_out_mixers; 2976 spec->init_verbs[spec->num_init_verbs++] = 2977 ad1989_spdif_init_verbs; 2978 } else { 2979 spec->mixers[spec->num_mixers++] = 2980 ad1988_spdif_out_mixers; 2981 spec->init_verbs[spec->num_init_verbs++] = 2982 ad1988_spdif_init_verbs; 2983 } 2899 2984 } 2900 if (spec->dig_in_nid )2985 if (spec->dig_in_nid && codec->vendor_id < 0x11d4989a) 2901 2986 spec->mixers[spec->num_mixers++] = ad1988_spdif_in_mixers; 2902 2987 … … 3009 3094 .put = ad1983_spdif_route_put, 3010 3095 }, 3011 { 0} /* end */3096 {0} /* end */ 3012 3097 }; 3013 3098 … … 3019 3104 HDA_CODEC_MUTE_IDX("Digital Mic Capture Switch", 1, 0x06, 0x0, 3020 3105 HDA_INPUT), 3021 { 0} /* end */3106 {0} /* end */ 3022 3107 }; 3023 3108 … … 3067 3152 {0x02, AC_VERB_SET_CONNECT_SEL, 0x0}, /* PCM */ 3068 3153 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE | 0x27}, /* 0dB */ 3069 { 0} /* end */3154 {0} /* end */ 3070 3155 }; 3071 3156 … … 3102 3187 return -ENOMEM; 3103 3188 3104 mutex_init(&spec->amp_mutex);3105 3189 codec->spec = spec; 3106 3190 … … 3134 3218 */ 3135 3219 static struct hda_input_mux ad1984_thinkpad_capture_source = { 3136 .num_items = 3,3220 .num_items = 4, 3137 3221 .items = { 3138 3222 { "Mic", 0x0 }, 3139 3223 { "Internal Mic", 0x1 }, 3140 3224 { "Mix", 0x3 }, 3225 { "Docking-Station", 0x4 }, 3141 3226 }, 3142 3227 }; … … 3198 3283 .put = ad1983_spdif_route_put, 3199 3284 }, 3200 { 0} /* end */3285 {0} /* end */ 3201 3286 }; 3202 3287 … … 3212 3297 /* enable EAPD bit */ 3213 3298 {0x12, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, 3214 { 0} /* end */3299 {0} /* end */ 3215 3300 }; 3216 3301 … … 3269 3354 struct snd_pcm_substream *substream) 3270 3355 { 3271 snd_hda_codec_setup_stream(codec, 0x05 + substream->number, 3272 0, 0, 0); 3356 snd_hda_codec_cleanup_stream(codec, 0x05 + substream->number); 3273 3357 return 0; 3274 3358 } … … 3306 3390 AD1984_BASIC, 3307 3391 AD1984_THINKPAD, 3308 3392 AD1984_DELL_DESKTOP, 3309 3393 AD1984_MODELS 3310 3394 }; … … 3313 3397 [AD1984_BASIC] = "basic", 3314 3398 [AD1984_THINKPAD] = "thinkpad", 3315 3399 [AD1984_DELL_DESKTOP] = "dell_desktop", 3316 3400 }; 3317 3401 … … 3319 3403 /* Lenovo Thinkpad T61/X61 */ 3320 3404 SND_PCI_QUIRK(0x17aa, 0, "Lenovo Thinkpad", AD1984_THINKPAD), 3321 3322 { 0}3405 SND_PCI_QUIRK(0x1028, 0x0214, "Dell T3400", AD1984_DELL_DESKTOP), 3406 {0} 3323 3407 }; 3324 3408 … … 3352 3436 break; 3353 3437 } 3438 return 0; 3439 } 3440 3441 3442 /* 3443 * AD1883 / AD1884A / AD1984A / AD1984B 3444 * 3445 * port-B (0x14) - front mic-in 3446 * port-E (0x1c) - rear mic-in 3447 * port-F (0x16) - CD / ext out 3448 * port-C (0x15) - rear line-in 3449 * port-D (0x12) - rear line-out 3450 * port-A (0x11) - front hp-out 3451 * 3452 * AD1984A = AD1884A + digital-mic 3453 * AD1883 = equivalent with AD1984A 3454 * AD1984B = AD1984A + extra SPDIF-out 3455 * 3456 * FIXME: 3457 * We share the single DAC for both HP and line-outs (see AD1884/1984). 3458 */ 3459 3460 static hda_nid_t ad1884a_dac_nids[1] = { 3461 0x03, 3462 }; 3463 3464 #define ad1884a_adc_nids ad1884_adc_nids 3465 #define ad1884a_capsrc_nids ad1884_capsrc_nids 3466 3467 #define AD1884A_SPDIF_OUT 0x02 3468 3469 static struct hda_input_mux ad1884a_capture_source = { 3470 .num_items = 5, 3471 .items = { 3472 { "Front Mic", 0x0 }, 3473 { "Mic", 0x4 }, 3474 { "Line", 0x1 }, 3475 { "CD", 0x2 }, 3476 { "Mix", 0x3 }, 3477 }, 3478 }; 3479 3480 static struct snd_kcontrol_new ad1884a_base_mixers[] = { 3481 HDA_CODEC_VOLUME("Master Playback Volume", 0x21, 0x0, HDA_OUTPUT), 3482 HDA_CODEC_MUTE("Master Playback Switch", 0x21, 0x0, HDA_OUTPUT), 3483 HDA_CODEC_MUTE("Headphone Playback Switch", 0x11, 0x0, HDA_OUTPUT), 3484 HDA_CODEC_MUTE("Front Playback Switch", 0x12, 0x0, HDA_OUTPUT), 3485 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x13, 1, 0x0, HDA_OUTPUT), 3486 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x13, 1, 0x0, HDA_OUTPUT), 3487 HDA_CODEC_VOLUME("PCM Playback Volume", 0x20, 0x5, HDA_INPUT), 3488 HDA_CODEC_MUTE("PCM Playback Switch", 0x20, 0x5, HDA_INPUT), 3489 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x20, 0x00, HDA_INPUT), 3490 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x20, 0x00, HDA_INPUT), 3491 HDA_CODEC_VOLUME("Line Playback Volume", 0x20, 0x01, HDA_INPUT), 3492 HDA_CODEC_MUTE("Line Playback Switch", 0x20, 0x01, HDA_INPUT), 3493 HDA_CODEC_VOLUME("Mic Playback Volume", 0x20, 0x04, HDA_INPUT), 3494 HDA_CODEC_MUTE("Mic Playback Switch", 0x20, 0x04, HDA_INPUT), 3495 HDA_CODEC_VOLUME("CD Playback Volume", 0x20, 0x02, HDA_INPUT), 3496 HDA_CODEC_MUTE("CD Playback Switch", 0x20, 0x02, HDA_INPUT), 3497 HDA_CODEC_VOLUME("Beep Playback Volume", 0x20, 0x03, HDA_INPUT), 3498 HDA_CODEC_MUTE("Beep Playback Switch", 0x20, 0x03, HDA_INPUT), 3499 HDA_CODEC_VOLUME("Front Mic Boost", 0x14, 0x0, HDA_INPUT), 3500 HDA_CODEC_VOLUME("Line Boost", 0x15, 0x0, HDA_INPUT), 3501 HDA_CODEC_VOLUME("Mic Boost", 0x25, 0x0, HDA_OUTPUT), 3502 HDA_CODEC_VOLUME("Capture Volume", 0x0c, 0x0, HDA_OUTPUT), 3503 HDA_CODEC_MUTE("Capture Switch", 0x0c, 0x0, HDA_OUTPUT), 3504 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x0d, 0x0, HDA_OUTPUT), 3505 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x0d, 0x0, HDA_OUTPUT), 3506 { 3507 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 3508 /* The multiple "Capture Source" controls confuse alsamixer 3509 * So call somewhat different.. 3510 */ 3511 /* .name = "Capture Source", */ 3512 .name = "Input Source", 3513 .count = 2, 3514 .info = ad198x_mux_enum_info, 3515 .get = ad198x_mux_enum_get, 3516 .put = ad198x_mux_enum_put, 3517 }, 3518 /* SPDIF controls */ 3519 HDA_CODEC_VOLUME("IEC958 Playback Volume", 0x1b, 0x0, HDA_OUTPUT), 3520 { 3521 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 3522 .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,NONE) "Source", 3523 /* identical with ad1983 */ 3524 .info = ad1983_spdif_route_info, 3525 .get = ad1983_spdif_route_get, 3526 .put = ad1983_spdif_route_put, 3527 }, 3528 {0} /* end */ 3529 }; 3530 3531 /* 3532 * initialization verbs 3533 */ 3534 static struct hda_verb ad1884a_init_verbs[] = { 3535 /* DACs; unmute as default */ 3536 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, 0x27}, /* 0dB */ 3537 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x27}, /* 0dB */ 3538 /* Port-A (HP) mixer - route only from analog mixer */ 3539 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, 3540 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 3541 /* Port-A pin */ 3542 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, 3543 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, 3544 /* Port-D (Line-out) mixer - route only from analog mixer */ 3545 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, 3546 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 3547 /* Port-D pin */ 3548 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, 3549 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, 3550 /* Mono-out mixer - route only from analog mixer */ 3551 {0x1e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, 3552 {0x1e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 3553 /* Mono-out pin */ 3554 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, 3555 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, 3556 /* Port-B (front mic) pin */ 3557 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, 3558 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, 3559 /* Port-C (rear line-in) pin */ 3560 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, 3561 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, 3562 /* Port-E (rear mic) pin */ 3563 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, 3564 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, 3565 {0x25, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, /* no boost */ 3566 /* Port-F (CD) pin */ 3567 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, 3568 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, 3569 /* Analog mixer; mute as default */ 3570 {0x20, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, 3571 {0x20, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, 3572 {0x20, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, 3573 {0x20, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, 3574 {0x20, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, /* aux */ 3575 {0x20, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, 3576 /* Analog Mix output amp */ 3577 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, 3578 /* capture sources */ 3579 {0x0c, AC_VERB_SET_CONNECT_SEL, 0x0}, 3580 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, 3581 {0x0d, AC_VERB_SET_CONNECT_SEL, 0x0}, 3582 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, 3583 /* SPDIF output amp */ 3584 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE | 0x27}, /* 0dB */ 3585 {0} /* end */ 3586 }; 3587 3588 #ifdef CONFIG_SND_HDA_POWER_SAVE 3589 static struct hda_amp_list ad1884a_loopbacks[] = { 3590 { 0x20, HDA_INPUT, 0 }, /* Front Mic */ 3591 { 0x20, HDA_INPUT, 1 }, /* Mic */ 3592 { 0x20, HDA_INPUT, 2 }, /* CD */ 3593 { 0x20, HDA_INPUT, 4 }, /* Docking */ 3594 {0} /* end */ 3595 }; 3596 #endif 3597 3598 /* 3599 * Laptop model 3600 * 3601 * Port A: Headphone jack 3602 * Port B: MIC jack 3603 * Port C: Internal MIC 3604 * Port D: Dock Line Out (if enabled) 3605 * Port E: Dock Line In (if enabled) 3606 * Port F: Internal speakers 3607 */ 3608 3609 static struct hda_input_mux ad1884a_laptop_capture_source = { 3610 .num_items = 4, 3611 .items = { 3612 { "Mic", 0x0 }, /* port-B */ 3613 { "Internal Mic", 0x1 }, /* port-C */ 3614 { "Dock Mic", 0x4 }, /* port-E */ 3615 { "Mix", 0x3 }, 3616 }, 3617 }; 3618 3619 static struct snd_kcontrol_new ad1884a_laptop_mixers[] = { 3620 HDA_CODEC_VOLUME("Master Playback Volume", 0x21, 0x0, HDA_OUTPUT), 3621 HDA_CODEC_MUTE("Master Playback Switch", 0x21, 0x0, HDA_OUTPUT), 3622 HDA_CODEC_MUTE("Dock Playback Switch", 0x12, 0x0, HDA_OUTPUT), 3623 HDA_CODEC_VOLUME("PCM Playback Volume", 0x20, 0x5, HDA_INPUT), 3624 HDA_CODEC_MUTE("PCM Playback Switch", 0x20, 0x5, HDA_INPUT), 3625 HDA_CODEC_VOLUME("Mic Playback Volume", 0x20, 0x00, HDA_INPUT), 3626 HDA_CODEC_MUTE("Mic Playback Switch", 0x20, 0x00, HDA_INPUT), 3627 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x20, 0x01, HDA_INPUT), 3628 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x20, 0x01, HDA_INPUT), 3629 HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x20, 0x04, HDA_INPUT), 3630 HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x20, 0x04, HDA_INPUT), 3631 HDA_CODEC_VOLUME("Beep Playback Volume", 0x20, 0x03, HDA_INPUT), 3632 HDA_CODEC_MUTE("Beep Playback Switch", 0x20, 0x03, HDA_INPUT), 3633 HDA_CODEC_VOLUME("Mic Boost", 0x14, 0x0, HDA_INPUT), 3634 HDA_CODEC_VOLUME("Internal Mic Boost", 0x15, 0x0, HDA_INPUT), 3635 HDA_CODEC_VOLUME("Dock Mic Boost", 0x25, 0x0, HDA_OUTPUT), 3636 HDA_CODEC_VOLUME("Capture Volume", 0x0c, 0x0, HDA_OUTPUT), 3637 HDA_CODEC_MUTE("Capture Switch", 0x0c, 0x0, HDA_OUTPUT), 3638 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x0d, 0x0, HDA_OUTPUT), 3639 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x0d, 0x0, HDA_OUTPUT), 3640 { 3641 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 3642 /* The multiple "Capture Source" controls confuse alsamixer 3643 * So call somewhat different.. 3644 */ 3645 /* .name = "Capture Source", */ 3646 .name = "Input Source", 3647 .count = 2, 3648 .info = ad198x_mux_enum_info, 3649 .get = ad198x_mux_enum_get, 3650 .put = ad198x_mux_enum_put, 3651 }, 3652 {0} /* end */ 3653 }; 3654 3655 static struct snd_kcontrol_new ad1884a_mobile_mixers[] = { 3656 HDA_CODEC_VOLUME("Master Playback Volume", 0x21, 0x0, HDA_OUTPUT), 3657 HDA_CODEC_MUTE("Master Playback Switch", 0x21, 0x0, HDA_OUTPUT), 3658 HDA_CODEC_VOLUME("PCM Playback Volume", 0x20, 0x5, HDA_INPUT), 3659 HDA_CODEC_MUTE("PCM Playback Switch", 0x20, 0x5, HDA_INPUT), 3660 HDA_CODEC_VOLUME("Beep Playback Volume", 0x20, 0x03, HDA_INPUT), 3661 HDA_CODEC_MUTE("Beep Playback Switch", 0x20, 0x03, HDA_INPUT), 3662 HDA_CODEC_VOLUME("Mic Capture Volume", 0x14, 0x0, HDA_INPUT), 3663 HDA_CODEC_VOLUME("Internal Mic Capture Volume", 0x15, 0x0, HDA_INPUT), 3664 HDA_CODEC_VOLUME("Capture Volume", 0x0c, 0x0, HDA_OUTPUT), 3665 HDA_CODEC_MUTE("Capture Switch", 0x0c, 0x0, HDA_OUTPUT), 3666 {0} /* end */ 3667 }; 3668 3669 /* mute internal speaker if HP is plugged */ 3670 static void ad1884a_hp_automute(struct hda_codec *codec) 3671 { 3672 unsigned int present; 3673 3674 present = snd_hda_codec_read(codec, 0x11, 0, 3675 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; 3676 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, 3677 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); 3678 snd_hda_codec_write(codec, 0x16, 0, AC_VERB_SET_EAPD_BTLENABLE, 3679 present ? 0x00 : 0x02); 3680 } 3681 3682 /* switch to external mic if plugged */ 3683 static void ad1884a_hp_automic(struct hda_codec *codec) 3684 { 3685 unsigned int present; 3686 3687 present = snd_hda_codec_read(codec, 0x14, 0, 3688 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; 3689 snd_hda_codec_write(codec, 0x0c, 0, AC_VERB_SET_CONNECT_SEL, 3690 present ? 0 : 1); 3691 } 3692 3693 #define AD1884A_HP_EVENT 0x37 3694 #define AD1884A_MIC_EVENT 0x36 3695 3696 /* unsolicited event for HP jack sensing */ 3697 static void ad1884a_hp_unsol_event(struct hda_codec *codec, unsigned int res) 3698 { 3699 switch (res >> 26) { 3700 case AD1884A_HP_EVENT: 3701 ad1884a_hp_automute(codec); 3702 break; 3703 case AD1884A_MIC_EVENT: 3704 ad1884a_hp_automic(codec); 3705 break; 3706 } 3707 } 3708 3709 /* initialize jack-sensing, too */ 3710 static int ad1884a_hp_init(struct hda_codec *codec) 3711 { 3712 ad198x_init(codec); 3713 ad1884a_hp_automute(codec); 3714 ad1884a_hp_automic(codec); 3715 return 0; 3716 } 3717 3718 /* additional verbs for laptop model */ 3719 static struct hda_verb ad1884a_laptop_verbs[] = { 3720 /* Port-A (HP) pin - always unmuted */ 3721 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 3722 /* Port-F (int speaker) mixer - route only from analog mixer */ 3723 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, 3724 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 3725 /* Port-F pin */ 3726 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, 3727 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, 3728 /* Port-C pin - internal mic-in */ 3729 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, 3730 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7002}, /* raise mic as default */ 3731 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x7002}, /* raise mic as default */ 3732 /* analog mix */ 3733 {0x20, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, 3734 /* unsolicited event for pin-sense */ 3735 {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | AD1884A_HP_EVENT}, 3736 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | AD1884A_MIC_EVENT}, 3737 {0} /* end */ 3738 }; 3739 3740 /* 3741 * Thinkpad X300 3742 * 0x11 - HP 3743 * 0x12 - speaker 3744 * 0x14 - mic-in 3745 * 0x17 - built-in mic 3746 */ 3747 3748 static struct hda_verb ad1984a_thinkpad_verbs[] = { 3749 /* HP unmute */ 3750 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 3751 /* analog mix */ 3752 {0x20, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, 3753 /* turn on EAPD */ 3754 {0x12, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, 3755 /* unsolicited event for pin-sense */ 3756 {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | AD1884A_HP_EVENT}, 3757 /* internal mic - dmic */ 3758 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, 3759 /* set magic COEFs for dmic */ 3760 {0x01, AC_VERB_SET_COEF_INDEX, 0x13f7}, 3761 {0x01, AC_VERB_SET_PROC_COEF, 0x08}, 3762 {0} /* end */ 3763 }; 3764 3765 static struct snd_kcontrol_new ad1984a_thinkpad_mixers[] = { 3766 HDA_CODEC_VOLUME("Master Playback Volume", 0x21, 0x0, HDA_OUTPUT), 3767 HDA_CODEC_MUTE("Master Playback Switch", 0x21, 0x0, HDA_OUTPUT), 3768 HDA_CODEC_VOLUME("PCM Playback Volume", 0x20, 0x5, HDA_INPUT), 3769 HDA_CODEC_MUTE("PCM Playback Switch", 0x20, 0x5, HDA_INPUT), 3770 HDA_CODEC_VOLUME("Mic Playback Volume", 0x20, 0x00, HDA_INPUT), 3771 HDA_CODEC_MUTE("Mic Playback Switch", 0x20, 0x00, HDA_INPUT), 3772 HDA_CODEC_VOLUME("Beep Playback Volume", 0x20, 0x03, HDA_INPUT), 3773 HDA_CODEC_MUTE("Beep Playback Switch", 0x20, 0x03, HDA_INPUT), 3774 HDA_CODEC_VOLUME("Mic Boost", 0x14, 0x0, HDA_INPUT), 3775 HDA_CODEC_VOLUME("Internal Mic Boost", 0x17, 0x0, HDA_INPUT), 3776 HDA_CODEC_VOLUME("Capture Volume", 0x0c, 0x0, HDA_OUTPUT), 3777 HDA_CODEC_MUTE("Capture Switch", 0x0c, 0x0, HDA_OUTPUT), 3778 { 3779 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 3780 .name = "Capture Source", 3781 .info = ad198x_mux_enum_info, 3782 .get = ad198x_mux_enum_get, 3783 .put = ad198x_mux_enum_put, 3784 }, 3785 {0} /* end */ 3786 }; 3787 3788 static struct hda_input_mux ad1984a_thinkpad_capture_source = { 3789 .num_items = 3, 3790 .items = { 3791 { "Mic", 0x0 }, 3792 { "Internal Mic", 0x5 }, 3793 { "Mix", 0x3 }, 3794 }, 3795 }; 3796 3797 /* mute internal speaker if HP is plugged */ 3798 static void ad1984a_thinkpad_automute(struct hda_codec *codec) 3799 { 3800 unsigned int present; 3801 3802 present = snd_hda_codec_read(codec, 0x11, 0, AC_VERB_GET_PIN_SENSE, 0) 3803 & AC_PINSENSE_PRESENCE; 3804 snd_hda_codec_amp_stereo(codec, 0x12, HDA_OUTPUT, 0, 3805 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); 3806 } 3807 3808 /* unsolicited event for HP jack sensing */ 3809 static void ad1984a_thinkpad_unsol_event(struct hda_codec *codec, 3810 unsigned int res) 3811 { 3812 if ((res >> 26) != AD1884A_HP_EVENT) 3813 return; 3814 ad1984a_thinkpad_automute(codec); 3815 } 3816 3817 /* initialize jack-sensing, too */ 3818 static int ad1984a_thinkpad_init(struct hda_codec *codec) 3819 { 3820 ad198x_init(codec); 3821 ad1984a_thinkpad_automute(codec); 3822 return 0; 3823 } 3824 3825 /* 3826 */ 3827 3828 enum { 3829 AD1884A_DESKTOP, 3830 AD1884A_LAPTOP, 3831 AD1884A_MOBILE, 3832 AD1884A_THINKPAD, 3833 AD1884A_MODELS 3834 }; 3835 3836 static const char *ad1884a_models[AD1884A_MODELS] = { 3837 [AD1884A_DESKTOP] = "desktop", 3838 [AD1884A_LAPTOP] = "laptop", 3839 [AD1884A_MOBILE] = "mobile", 3840 [AD1884A_THINKPAD] = "thinkpad", 3841 }; 3842 3843 static struct snd_pci_quirk ad1884a_cfg_tbl[] = { 3844 SND_PCI_QUIRK(0x103c, 0x3030, "HP", AD1884A_MOBILE), 3845 SND_PCI_QUIRK(0x17aa, 0x20ac, "Thinkpad X300", AD1884A_THINKPAD), 3846 {0} 3847 }; 3848 3849 static int patch_ad1884a(struct hda_codec *codec) 3850 { 3851 struct ad198x_spec *spec; 3852 int board_config; 3853 3854 spec = kzalloc(sizeof(*spec), GFP_KERNEL); 3855 if (spec == NULL) 3856 return -ENOMEM; 3857 3858 codec->spec = spec; 3859 3860 spec->multiout.max_channels = 2; 3861 spec->multiout.num_dacs = ARRAY_SIZE(ad1884a_dac_nids); 3862 spec->multiout.dac_nids = ad1884a_dac_nids; 3863 spec->multiout.dig_out_nid = AD1884A_SPDIF_OUT; 3864 spec->num_adc_nids = ARRAY_SIZE(ad1884a_adc_nids); 3865 spec->adc_nids = ad1884a_adc_nids; 3866 spec->capsrc_nids = ad1884a_capsrc_nids; 3867 spec->input_mux = &ad1884a_capture_source; 3868 spec->num_mixers = 1; 3869 spec->mixers[0] = ad1884a_base_mixers; 3870 spec->num_init_verbs = 1; 3871 spec->init_verbs[0] = ad1884a_init_verbs; 3872 spec->spdif_route = 0; 3873 #ifdef CONFIG_SND_HDA_POWER_SAVE 3874 spec->loopback.amplist = ad1884a_loopbacks; 3875 #endif 3876 codec->patch_ops = ad198x_patch_ops; 3877 3878 /* override some parameters */ 3879 board_config = snd_hda_check_board_config(codec, AD1884A_MODELS, 3880 ad1884a_models, 3881 ad1884a_cfg_tbl); 3882 switch (board_config) { 3883 case AD1884A_LAPTOP: 3884 spec->mixers[0] = ad1884a_laptop_mixers; 3885 spec->init_verbs[spec->num_init_verbs++] = ad1884a_laptop_verbs; 3886 spec->multiout.dig_out_nid = 0; 3887 spec->input_mux = &ad1884a_laptop_capture_source; 3888 codec->patch_ops.unsol_event = ad1884a_hp_unsol_event; 3889 codec->patch_ops.init = ad1884a_hp_init; 3890 break; 3891 case AD1884A_MOBILE: 3892 spec->mixers[0] = ad1884a_mobile_mixers; 3893 spec->init_verbs[spec->num_init_verbs++] = ad1884a_laptop_verbs; 3894 spec->multiout.dig_out_nid = 0; 3895 codec->patch_ops.unsol_event = ad1884a_hp_unsol_event; 3896 codec->patch_ops.init = ad1884a_hp_init; 3897 break; 3898 case AD1884A_THINKPAD: 3899 spec->mixers[0] = ad1984a_thinkpad_mixers; 3900 spec->init_verbs[spec->num_init_verbs++] = 3901 ad1984a_thinkpad_verbs; 3902 spec->multiout.dig_out_nid = 0; 3903 spec->input_mux = &ad1984a_thinkpad_capture_source; 3904 codec->patch_ops.unsol_event = ad1984a_thinkpad_unsol_event; 3905 codec->patch_ops.init = ad1984a_thinkpad_init; 3906 break; 3907 } 3908 3354 3909 return 0; 3355 3910 } … … 3605 4160 return -ENOMEM; 3606 4161 3607 mutex_init(&spec->amp_mutex);3608 4162 codec->spec = spec; 3609 4163 … … 3655 4209 */ 3656 4210 struct hda_codec_preset snd_hda_preset_analog[] = { 4211 { .id = 0x11d4184a, .name = "AD1884A", .patch = patch_ad1884a }, 3657 4212 { .id = 0x11d41882, .name = "AD1882", .patch = patch_ad1882 }, 4213 { .id = 0x11d41883, .name = "AD1883", .patch = patch_ad1884a }, 3658 4214 { .id = 0x11d41884, .name = "AD1884", .patch = patch_ad1884 }, 4215 { .id = 0x11d4194a, .name = "AD1984A", .patch = patch_ad1884a }, 4216 { .id = 0x11d4194b, .name = "AD1984B", .patch = patch_ad1884a }, 3659 4217 { .id = 0x11d41981, .name = "AD1981", .patch = patch_ad1981 }, 3660 4218 { .id = 0x11d41983, .name = "AD1983", .patch = patch_ad1983 }, … … 3663 4221 { .id = 0x11d41988, .name = "AD1988", .patch = patch_ad1988 }, 3664 4222 { .id = 0x11d4198b, .name = "AD1988B", .patch = patch_ad1988 }, 4223 { .id = 0x11d4989a, .name = "AD1989A", .patch = patch_ad1988 }, 4224 { .id = 0x11d4989b, .name = "AD1989B", .patch = patch_ad1988 }, 3665 4225 {0} /* terminator */ 3666 4226 }; -
GPL/branches/uniaud32-2.0/alsa-kernel/pci/hda/patch_atihdmi.c
r305 r358 28 28 #include "hda_codec.h" 29 29 #include "hda_local.h" 30 #include "hda_patch.h" 30 31 31 32 struct atihdmi_spec { … … 117 118 118 119 info->name = "ATI HDMI"; 120 info->pcm_type = HDA_PCM_TYPE_HDMI; 119 121 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = atihdmi_pcm_digital_playback; 120 122 … … 163 165 { .id = 0x1002791a, .name = "ATI RS690/780 HDMI", .patch = patch_atihdmi }, 164 166 { .id = 0x1002aa01, .name = "ATI R6xx HDMI", .patch = patch_atihdmi }, 165 { .id = 0x10951392, .name = "SI HDMI", .patch = patch_atihdmi }, 167 { .id = 0x10951392, .name = "SiI1392 HDMI", .patch = patch_atihdmi }, 168 { .id = 0x17e80047, .name = "Chrontel HDMI", .patch = patch_atihdmi }, 166 169 {0} /* terminator */ 167 170 }; -
GPL/branches/uniaud32-2.0/alsa-kernel/pci/hda/patch_cmedia.c
r305 r358 29 29 #include "hda_codec.h" 30 30 #include "hda_local.h" 31 #include "hda_patch.h" 31 32 #define NUM_PINS 11 32 33 … … 330 331 if (err < 0) 331 332 return err; 333 err = snd_hda_create_spdif_share_sw(codec, 334 &spec->multiout); 335 if (err < 0) 336 return err; 337 spec->multiout.share_spdif = 1; 332 338 } 333 339 if (spec->dig_in_nid) { … … 433 439 { 434 440 struct cmi_spec *spec = codec->spec; 435 return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream); 441 return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream, 442 hinfo); 436 443 } 437 444 … … 507 514 struct cmi_spec *spec = codec->spec; 508 515 509 snd_hda_codec_ setup_stream(codec, spec->adc_nids[substream->number], 0, 0, 0);516 snd_hda_codec_cleanup_stream(codec, spec->adc_nids[substream->number]); 510 517 return 0; 511 518 } … … 572 579 info++; 573 580 info->name = "CMI9880 Digital"; 581 info->pcm_type = HDA_PCM_TYPE_SPDIF; 574 582 if (spec->multiout.dig_out_nid) { 575 583 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = cmi9880_pcm_digital_playback; … … 604 612 static struct snd_pci_quirk cmi9880_cfg_tbl[] = { 605 613 SND_PCI_QUIRK(0x1043, 0x813d, "ASUS P5AD2", CMI_FULL_DIG), 614 SND_PCI_QUIRK(0x1854, 0x002b, "LG LS75", CMI_MINIMAL), 615 SND_PCI_QUIRK(0x1854, 0x0032, "LG", CMI_FULL_DIG), 606 616 {0} /* terminator */ 607 617 }; -
GPL/branches/uniaud32-2.0/alsa-kernel/pci/hda/patch_conexant.c
r305 r358 25 25 #include <linux/slab.h> 26 26 #include <linux/pci.h> 27 #include <linux/mutex.h>28 27 #include <sound/core.h> 29 28 #include "hda_codec.h" 30 29 #include "hda_local.h" 30 #include "hda_patch.h" 31 31 32 32 #define CXT_PIN_DIR_IN 0x00 … … 83 83 struct hda_pcm pcm_rec[2]; /* used in build_pcms() */ 84 84 85 struct mutex amp_mutex; /* PCM volume/mute control mutex */86 85 unsigned int spdif_route; 87 86 … … 100 99 { 101 100 struct conexant_spec *spec = codec->spec; 102 return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream); 101 return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream, 102 hinfo); 103 103 } 104 104 … … 174 174 { 175 175 struct conexant_spec *spec = codec->spec; 176 snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number], 177 0, 0, 0); 176 snd_hda_codec_cleanup_stream(codec, spec->adc_nids[substream->number]); 178 177 return 0; 179 178 } … … 243 242 { 244 243 struct conexant_spec *spec = codec->spec; 245 snd_hda_codec_ setup_stream(codec, spec->cur_adc, 0, 0, 0);244 snd_hda_codec_cleanup_stream(codec, spec->cur_adc); 246 245 spec->cur_adc = 0; 247 246 return 0; … … 286 285 codec->num_pcms++; 287 286 info->name = "Conexant Digital"; 287 info->pcm_type = HDA_PCM_TYPE_SPDIF; 288 288 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = 289 289 conexant_pcm_digital_playback; … … 373 373 if (err < 0) 374 374 return err; 375 err = snd_hda_create_spdif_share_sw(codec, 376 &spec->multiout); 377 if (err < 0) 378 return err; 379 spec->multiout.share_spdif = 1; 375 380 } 376 381 if (spec->dig_in_nid) { … … 510 515 { "ExtMic", 0x2 }, 511 516 { "LineIn", 0x3 }, 517 } 518 }; 519 520 static struct hda_input_mux cxt5045_capture_source_hp530 = { 521 .num_items = 2, 522 .items = { 523 { "ExtMic", 0x1 }, 524 { "IntMic", 0x2 }, 512 525 } 513 526 }; … … 641 654 }; 642 655 656 static struct snd_kcontrol_new cxt5045_mixers_hp530[] = { 657 { 658 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 659 .name = "Capture Source", 660 .info = conexant_mux_enum_info, 661 .get = conexant_mux_enum_get, 662 .put = conexant_mux_enum_put 663 }, 664 HDA_CODEC_VOLUME("Int Mic Capture Volume", 0x1a, 0x02, HDA_INPUT), 665 HDA_CODEC_MUTE("Int Mic Capture Switch", 0x1a, 0x02, HDA_INPUT), 666 HDA_CODEC_VOLUME("Ext Mic Capture Volume", 0x1a, 0x01, HDA_INPUT), 667 HDA_CODEC_MUTE("Ext Mic Capture Switch", 0x1a, 0x01, HDA_INPUT), 668 HDA_CODEC_VOLUME("PCM Playback Volume", 0x17, 0x0, HDA_INPUT), 669 HDA_CODEC_MUTE("PCM Playback Switch", 0x17, 0x0, HDA_INPUT), 670 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x17, 0x2, HDA_INPUT), 671 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x17, 0x2, HDA_INPUT), 672 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x17, 0x1, HDA_INPUT), 673 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x17, 0x1, HDA_INPUT), 674 HDA_BIND_VOL("Master Playback Volume", &cxt5045_hp_bind_master_vol), 675 { 676 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 677 .name = "Master Playback Switch", 678 .info = cxt_eapd_info, 679 .get = cxt_eapd_get, 680 .put = cxt5045_hp_master_sw_put, 681 .private_value = 0x10, 682 }, 683 684 {0} 685 }; 686 643 687 static struct hda_verb cxt5045_init_verbs[] = { 644 688 /* Line in, Mic */ 645 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },689 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN|AC_PINCTL_VREF_80 }, 646 690 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN|AC_PINCTL_VREF_80 }, 647 691 /* HP, Amp */ … … 660 704 AC_AMP_SET_INPUT|AC_AMP_SET_RIGHT|AC_AMP_SET_LEFT|0x17}, 661 705 /* SPDIF route: PCM */ 662 706 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, 663 707 { 0x13, AC_VERB_SET_CONNECT_SEL, 0x0 }, 664 708 /* EAPD */ … … 703 747 {0x12, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | CONEXANT_MIC_EVENT}, 704 748 {0} /* end */ 705 706 749 }; 707 750 … … 836 879 CXT5045_LAPTOP_HPMICSENSE, 837 880 CXT5045_BENQ, 881 CXT5045_LAPTOP_HP530, 838 882 #ifdef CONFIG_SND_DEBUG 839 883 CXT5045_TEST, … … 847 891 [CXT5045_LAPTOP_HPMICSENSE] = "laptop-hpmicsense", 848 892 [CXT5045_BENQ] = "benq", 893 [CXT5045_LAPTOP_HP530] = "laptop-hp530", 849 894 #ifdef CONFIG_SND_DEBUG 850 895 [CXT5045_TEST] = "test", … … 860 905 SND_PCI_QUIRK(0x103c, 0x30cd, "HP DV Series", CXT5045_LAPTOP_HPSENSE), 861 906 SND_PCI_QUIRK(0x103c, 0x30cf, "HP DV9533EG", CXT5045_LAPTOP_HPSENSE), 862 SND_PCI_QUIRK(0x103c, 0x30d5, "HP 530", CXT5045_LAPTOP_HP SENSE),907 SND_PCI_QUIRK(0x103c, 0x30d5, "HP 530", CXT5045_LAPTOP_HP530), 863 908 SND_PCI_QUIRK(0x103c, 0x30d9, "HP Spartan", CXT5045_LAPTOP_HPSENSE), 909 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba P105", CXT5045_LAPTOP_MICSENSE), 864 910 SND_PCI_QUIRK(0x152d, 0x0753, "Benq R55E", CXT5045_BENQ), 865 911 SND_PCI_QUIRK(0x1734, 0x10ad, "Fujitsu Si1520", CXT5045_LAPTOP_MICSENSE), 866 912 SND_PCI_QUIRK(0x1734, 0x10cb, "Fujitsu Si3515", CXT5045_LAPTOP_HPMICSENSE), 867 SND_PCI_QUIRK(0x1734, 0x110e, "Fujitsu V5505", CXT5045_LAPTOP_HPSENSE), 913 SND_PCI_QUIRK(0x1734, 0x110e, "Fujitsu V5505", 914 CXT5045_LAPTOP_HPMICSENSE), 868 915 SND_PCI_QUIRK(0x1509, 0x1e40, "FIC", CXT5045_LAPTOP_HPMICSENSE), 869 916 SND_PCI_QUIRK(0x1509, 0x2f05, "FIC", CXT5045_LAPTOP_HPMICSENSE), … … 883 930 if (!spec) 884 931 return -ENOMEM; 885 mutex_init(&spec->amp_mutex);886 932 codec->spec = spec; 887 933 … … 918 964 break; 919 965 case CXT5045_LAPTOP_MICSENSE: 966 codec->patch_ops.unsol_event = cxt5045_hp_unsol_event; 920 967 spec->input_mux = &cxt5045_capture_source; 921 968 spec->num_init_verbs = 2; … … 944 991 codec->patch_ops.init = cxt5045_init; 945 992 break; 993 case CXT5045_LAPTOP_HP530: 994 codec->patch_ops.unsol_event = cxt5045_hp_unsol_event; 995 spec->input_mux = &cxt5045_capture_source_hp530; 996 spec->num_init_verbs = 2; 997 spec->init_verbs[1] = cxt5045_hp_sense_init_verbs; 998 spec->mixers[0] = cxt5045_mixers_hp530; 999 codec->patch_ops.init = cxt5045_init; 1000 break; 946 1001 #ifdef CONFIG_SND_DEBUG 947 1002 case CXT5045_TEST: … … 954 1009 } 955 1010 956 /* 957 * Fix max PCM level to 0 dB 958 * (originall it has 0x2b steps with 0dB offset 0x14) 959 */ 960 snd_hda_override_amp_caps(codec, 0x17, HDA_INPUT, 961 (0x14 << AC_AMPCAP_OFFSET_SHIFT) | 962 (0x14 << AC_AMPCAP_NUM_STEPS_SHIFT) | 963 (0x05 << AC_AMPCAP_STEP_SIZE_SHIFT) | 964 (1 << AC_AMPCAP_MUTE_SHIFT)); 1011 switch (codec->subsystem_id >> 16) { 1012 case 0x103c: 1013 /* HP laptop has a really bad sound over 0dB on NID 0x17. 1014 * Fix max PCM level to 0 dB 1015 * (originall it has 0x2b steps with 0dB offset 0x14) 1016 */ 1017 snd_hda_override_amp_caps(codec, 0x17, HDA_INPUT, 1018 (0x14 << AC_AMPCAP_OFFSET_SHIFT) | 1019 (0x14 << AC_AMPCAP_NUM_STEPS_SHIFT) | 1020 (0x05 << AC_AMPCAP_STEP_SIZE_SHIFT) | 1021 (1 << AC_AMPCAP_MUTE_SHIFT)); 1022 break; 1023 } 965 1024 966 1025 return 0; … … 1233 1292 /* pin sensing on HP jack */ 1234 1293 {0x13, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | CONEXANT_HP_EVENT}, 1294 /* 0x13 is actually shared by both HP and speaker; 1295 * setting the connection to 0 (=0x19) makes the master volume control 1296 * working mysteriouslly... 1297 */ 1298 {0x13, AC_VERB_SET_CONNECT_SEL, 0x0}, 1235 1299 /* Record selector: Ext Mic */ 1236 1300 {0x12, AC_VERB_SET_CONNECT_SEL,0x03}, … … 1419 1483 if (!spec) 1420 1484 return -ENOMEM; 1421 mutex_init(&spec->amp_mutex);1422 1485 codec->spec = spec; 1423 1486 … … 1535 1598 if (spec->cur_adc && spec->cur_adc != new_adc) { 1536 1599 /* stream is running, let's swap the current ADC */ 1537 snd_hda_codec_ setup_stream(codec, spec->cur_adc, 0, 0, 0);1600 snd_hda_codec_cleanup_stream(codec, spec->cur_adc); 1538 1601 spec->cur_adc = new_adc; 1539 1602 snd_hda_codec_setup_stream(codec, new_adc, … … 1678 1741 if (!spec) 1679 1742 return -ENOMEM; 1680 mutex_init(&spec->amp_mutex);1681 1743 codec->spec = spec; 1682 1744 -
GPL/branches/uniaud32-2.0/alsa-kernel/pci/hda/patch_realtek.c
r305 r358 31 31 #include "hda_codec.h" 32 32 #include "hda_local.h" 33 #include "hda_patch.h" 33 34 34 35 #define ALC880_FRONT_EVENT 0x01 … … 60 61 ALC880_LG, 61 62 ALC880_LG_LW, 63 ALC880_MEDION_RIM, 62 64 #ifdef CONFIG_SND_DEBUG 63 65 ALC880_TEST, … … 98 100 ALC262_BENQ_T31, 99 101 ALC262_ULTRA, 102 ALC262_LENOVO_3000, 100 103 ALC262_AUTO, 101 104 ALC262_MODEL_LAST /* last tag */ … … 104 107 /* ALC268 models */ 105 108 enum { 109 ALC267_QUANTA_IL1, 106 110 ALC268_3ST, 107 111 ALC268_TOSHIBA, … … 160 164 ALC662_ASUS_EEEPC_P701, 161 165 ALC662_ASUS_EEEPC_EP20, 166 ALC663_ASUS_M51VA, 167 ALC663_ASUS_G71V, 168 ALC663_ASUS_H13, 169 ALC663_ASUS_G50V, 162 170 ALC662_AUTO, 163 171 ALC662_MODEL_LAST, … … 197 205 ALC888_LENOVO_MS7195_DIG, 198 206 ALC883_HAIER_W66, 199 ALC888_6ST_HP,200 207 ALC888_3ST_HP, 201 208 ALC888_6ST_DELL, 202 209 ALC883_MITAC, 210 ALC883_CLEVO_M720, 211 ALC883_FUJITSU_PI2515, 212 ALC883_3ST_6ch_INTEL, 203 213 ALC883_AUTO, 204 214 ALC883_MODEL_LAST, … … 239 249 unsigned int num_adc_nids; 240 250 hda_nid_t *adc_nids; 251 hda_nid_t *capsrc_nids; 241 252 hda_nid_t dig_in_nid; /* digital-in NID; optional */ 242 253 … … 272 283 /* for virtual master */ 273 284 hda_nid_t vmaster_nid; 274 u32 vmaster_tlv[4];275 285 #ifdef CONFIG_SND_HDA_POWER_SAVE 276 286 struct hda_loopback_check loopback; 277 287 #endif 288 289 /* for PLL fix */ 290 hda_nid_t pll_nid; 291 unsigned int pll_coef_idx, pll_coef_bit; 278 292 }; 279 293 … … 292 306 unsigned int num_adc_nids; 293 307 hda_nid_t *adc_nids; 308 hda_nid_t *capsrc_nids; 294 309 hda_nid_t dig_in_nid; 295 310 unsigned int num_channel_mode; … … 338 353 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); 339 354 unsigned int mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx; 355 hda_nid_t nid = spec->capsrc_nids ? 356 spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx]; 340 357 return snd_hda_input_mux_put(codec, &spec->input_mux[mux_idx], ucontrol, 341 spec->adc_nids[adc_idx], 342 &spec->cur_mux[adc_idx]); 358 nid, &spec->cur_mux[adc_idx]); 343 359 } 344 360 … … 709 725 spec->num_adc_nids = preset->num_adc_nids; 710 726 spec->adc_nids = preset->adc_nids; 727 spec->capsrc_nids = preset->capsrc_nids; 711 728 spec->dig_in_nid = preset->dig_in_nid; 712 729 … … 740 757 }; 741 758 759 /* 760 * Fix hardware PLL issue 761 * On some codecs, the analog PLL gating control must be off while 762 * the default value is 1. 763 */ 764 static void alc_fix_pll(struct hda_codec *codec) 765 { 766 struct alc_spec *spec = codec->spec; 767 unsigned int val; 768 769 if (!spec->pll_nid) 770 return; 771 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX, 772 spec->pll_coef_idx); 773 val = snd_hda_codec_read(codec, spec->pll_nid, 0, 774 AC_VERB_GET_PROC_COEF, 0); 775 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX, 776 spec->pll_coef_idx); 777 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_PROC_COEF, 778 val & ~(1 << spec->pll_coef_bit)); 779 } 780 781 static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid, 782 unsigned int coef_idx, unsigned int coef_bit) 783 { 784 struct alc_spec *spec = codec->spec; 785 spec->pll_nid = nid; 786 spec->pll_coef_idx = coef_idx; 787 spec->pll_coef_bit = coef_bit; 788 alc_fix_pll(codec); 789 } 790 742 791 static void alc_sku_automute(struct hda_codec *codec) 743 792 { 744 793 struct alc_spec *spec = codec->spec; 745 unsigned int mute;746 794 unsigned int present; 747 795 unsigned int hp_nid = spec->autocfg.hp_pins[0]; … … 753 801 AC_VERB_GET_PIN_SENSE, 0); 754 802 spec->jack_present = (present & 0x80000000) != 0; 755 if (spec->jack_present) { 756 /* mute internal speaker */ 757 snd_hda_codec_amp_stereo(codec, sp_nid, HDA_OUTPUT, 0, 758 HDA_AMP_MUTE, HDA_AMP_MUTE); 759 } else { 760 /* unmute internal speaker if necessary */ 761 mute = snd_hda_codec_amp_read(codec, hp_nid, 0, HDA_OUTPUT, 0); 762 snd_hda_codec_amp_stereo(codec, sp_nid, HDA_OUTPUT, 0, 763 HDA_AMP_MUTE, mute); 764 } 803 snd_hda_codec_write(codec, sp_nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, 804 spec->jack_present ? 0 : PIN_OUT); 765 805 } 766 806 … … 776 816 777 817 alc_sku_automute(codec); 818 } 819 820 /* additional initialization for ALC888 variants */ 821 static void alc888_coef_init(struct hda_codec *codec) 822 { 823 unsigned int tmp; 824 825 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0); 826 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); 827 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7); 828 if ((tmp & 0xf0) == 2) 829 /* alc888S-VC */ 830 snd_hda_codec_read(codec, 0x20, 0, 831 AC_VERB_SET_PROC_COEF, 0x830); 832 else 833 /* alc888-VB */ 834 snd_hda_codec_read(codec, 0x20, 0, 835 AC_VERB_SET_PROC_COEF, 0x3030); 778 836 } 779 837 … … 853 911 case 0x10ec0268: 854 912 case 0x10ec0269: 913 case 0x10ec0660: 914 case 0x10ec0662: 915 case 0x10ec0663: 855 916 case 0x10ec0862: 856 case 0x10ec0 662:917 case 0x10ec0889: 857 918 snd_hda_codec_write(codec, 0x14, 0, 858 919 AC_VERB_SET_EAPD_BTLENABLE, 2); … … 878 939 case 0x10ec0883: 879 940 case 0x10ec0885: 880 case 0x10ec088 8:941 case 0x10ec0889: 881 942 snd_hda_codec_write(codec, 0x20, 0, 882 943 AC_VERB_SET_COEF_INDEX, 7); … … 888 949 AC_VERB_SET_PROC_COEF, 889 950 tmp | 0x2010); 951 break; 952 case 0x10ec0888: 953 alc888_coef_init(codec); 890 954 break; 891 955 case 0x10ec0267: … … 942 1006 AC_USRSP_EN | ALC880_HP_EVENT); 943 1007 spec->unsol_event = alc_sku_unsol_event; 944 spec->init_hook = alc_sku_automute;945 1008 } 946 1009 … … 1321 1384 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), 1322 1385 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), 1323 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x 0, HDA_INPUT),1324 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x 0, HDA_INPUT),1386 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), 1387 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), 1325 1388 {0} /* end */ 1389 }; 1390 1391 static struct hda_input_mux alc880_f1734_capture_source = { 1392 .num_items = 2, 1393 .items = { 1394 { "Mic", 0x1 }, 1395 { "CD", 0x4 }, 1396 }, 1326 1397 }; 1327 1398 … … 1518 1589 if (err < 0) 1519 1590 return err; 1591 err = snd_hda_create_spdif_share_sw(codec, 1592 &spec->multiout); 1593 if (err < 0) 1594 return err; 1595 spec->multiout.share_spdif = 1; 1520 1596 } 1521 1597 if (spec->dig_in_nid) { … … 1527 1603 /* if we have no master control, let's create it */ 1528 1604 if (!snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) { 1605 unsigned int vmaster_tlv[4]; 1529 1606 snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid, 1530 HDA_OUTPUT, spec->vmaster_tlv);1607 HDA_OUTPUT, vmaster_tlv); 1531 1608 err = snd_hda_add_vmaster(codec, "Master Playback Volume", 1532 spec->vmaster_tlv, alc_slave_vols);1609 vmaster_tlv, alc_slave_vols); 1533 1610 if (err < 0) 1534 1611 return err; … … 1884 1961 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; 1885 1962 bits = present ? HDA_AMP_MUTE : 0; 1886 snd_hda_codec_amp_stereo(codec, 0x15, HDA_ INPUT, 0, HDA_AMP_MUTE, bits);1963 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, HDA_AMP_MUTE, bits); 1887 1964 } 1888 1965 … … 1917 1994 */ 1918 1995 static struct hda_verb alc880_pin_f1734_init_verbs[] = { 1996 {0x07, AC_VERB_SET_CONNECT_SEL, 0x01}, 1919 1997 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, 1920 1998 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, … … 1929 2007 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, 1930 2008 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, 1931 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF 80},2009 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, 1932 2010 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, 1933 2011 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, … … 1936 2014 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 1937 2015 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, 2016 2017 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, 2018 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT}, 1938 2019 1939 2020 {0} … … 2260 2341 } 2261 2342 2343 static struct snd_kcontrol_new alc880_medion_rim_mixer[] = { 2344 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), 2345 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), 2346 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), 2347 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), 2348 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), 2349 HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT), 2350 {0} /* end */ 2351 }; 2352 2353 static struct hda_input_mux alc880_medion_rim_capture_source = { 2354 .num_items = 2, 2355 .items = { 2356 { "Mic", 0x0 }, 2357 { "Internal Mic", 0x1 }, 2358 }, 2359 }; 2360 2361 static struct hda_verb alc880_medion_rim_init_verbs[] = { 2362 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ 2363 2364 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, 2365 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 2366 2367 /* Mic1 (rear panel) pin widget for input and vref at 80% */ 2368 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, 2369 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, 2370 /* Mic2 (as headphone out) for HP output */ 2371 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, 2372 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, 2373 /* Internal Speaker */ 2374 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, 2375 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 2376 2377 {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, 2378 {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, 2379 2380 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, 2381 {0} 2382 }; 2383 2384 /* toggle speaker-output according to the hp-jack state */ 2385 static void alc880_medion_rim_automute(struct hda_codec *codec) 2386 { 2387 unsigned int present; 2388 unsigned char bits; 2389 2390 present = snd_hda_codec_read(codec, 0x14, 0, 2391 AC_VERB_GET_PIN_SENSE, 0) 2392 & AC_PINSENSE_PRESENCE; 2393 bits = present ? HDA_AMP_MUTE : 0; 2394 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, 2395 HDA_AMP_MUTE, bits); 2396 if (present) 2397 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0); 2398 else 2399 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2); 2400 } 2401 2402 static void alc880_medion_rim_unsol_event(struct hda_codec *codec, 2403 unsigned int res) 2404 { 2405 /* Looks like the unsol event is incompatible with the standard 2406 * definition. 4bit tag is placed at 28 bit! 2407 */ 2408 if ((res >> 28) == ALC880_HP_EVENT) 2409 alc880_medion_rim_automute(codec); 2410 } 2411 2262 2412 #ifdef CONFIG_SND_HDA_POWER_SAVE 2263 2413 static struct hda_amp_list alc880_loopbacks[] = { … … 2287 2437 unsigned int i; 2288 2438 2439 alc_fix_pll(codec); 2440 2289 2441 for (i = 0; i < spec->num_init_verbs; i++) 2290 2442 snd_hda_sequence_write(codec, spec->init_verbs[i]); … … 2320 2472 { 2321 2473 struct alc_spec *spec = codec->spec; 2322 return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream); 2474 return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream, 2475 hinfo); 2323 2476 } 2324 2477 … … 2394 2547 struct alc_spec *spec = codec->spec; 2395 2548 2396 snd_hda_codec_ setup_stream(codec, spec->adc_nids[substream->number + 1],2397 0, 0, 0);2549 snd_hda_codec_cleanup_stream(codec, 2550 spec->adc_nids[substream->number + 1]); 2398 2551 return 0; 2399 2552 } … … 2500 2653 info = spec->pcm_rec + 1; 2501 2654 info->name = spec->stream_name_digital; 2655 info->pcm_type = HDA_PCM_TYPE_SPDIF; 2502 2656 if (spec->multiout.dig_out_nid && 2503 2657 spec->stream_digital_playback) { … … 2562 2716 } 2563 2717 kfree(spec); 2718 codec->spec = NULL; /* to be sure */ 2564 2719 } 2565 2720 … … 2864 3019 [ALC880_LG] = "lg", 2865 3020 [ALC880_LG_LW] = "lg-lw", 3021 [ALC880_MEDION_RIM] = "medion", 2866 3022 #ifdef CONFIG_SND_DEBUG 2867 3023 [ALC880_TEST] = "test", … … 2892 3048 SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG), 2893 3049 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG), 2894 SND_PCI_QUIRK(0x1043, 0x814e, "ASUS ", ALC880_ASUS),3050 SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG), 2895 3051 SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG), 2896 3052 SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST), … … 2915 3071 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53), 2916 3072 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810), 3073 SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM), 2917 3074 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG), 2918 3075 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG), 2919 3076 SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734), 3077 SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU), 2920 3078 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC", ALC880_UNIWILL), 2921 3079 SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU), … … 3059 3217 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), 3060 3218 .channel_mode = alc880_2_jack_modes, 3061 .input_mux = &alc880_capture_source, 3219 .input_mux = &alc880_f1734_capture_source, 3220 .unsol_event = alc880_uniwill_p53_unsol_event, 3221 .init_hook = alc880_uniwill_p53_hp_automute, 3062 3222 }, 3063 3223 [ALC880_ASUS] = { … … 3206 3366 .unsol_event = alc880_lg_lw_unsol_event, 3207 3367 .init_hook = alc880_lg_lw_automute, 3368 }, 3369 [ALC880_MEDION_RIM] = { 3370 .mixers = { alc880_medion_rim_mixer }, 3371 .init_verbs = { alc880_volume_init_verbs, 3372 alc880_medion_rim_init_verbs, 3373 alc_gpio2_init_verbs }, 3374 .num_dacs = ARRAY_SIZE(alc880_dac_nids), 3375 .dac_nids = alc880_dac_nids, 3376 .dig_out_nid = ALC880_DIGOUT_NID, 3377 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), 3378 .channel_mode = alc880_2_jack_modes, 3379 .input_mux = &alc880_medion_rim_capture_source, 3380 .unsol_event = alc880_medion_rim_unsol_event, 3381 .init_hook = alc880_medion_rim_automute, 3208 3382 }, 3209 3383 #ifdef CONFIG_SND_DEBUG … … 3469 3643 } 3470 3644 3645 static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid, 3646 unsigned int pin_type) 3647 { 3648 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, 3649 pin_type); 3650 /* unmute pin */ 3651 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, 3652 AMP_OUT_UNMUTE); 3653 } 3654 3471 3655 static void alc880_auto_set_output_and_unmute(struct hda_codec *codec, 3472 3656 hda_nid_t nid, int pin_type, 3473 3657 int dac_idx) 3474 3658 { 3475 /* set as output */ 3476 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, 3477 pin_type); 3478 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, 3479 AMP_OUT_UNMUTE); 3659 alc_set_pin_output(codec, nid, pin_type); 3480 3660 /* need the manual connection? */ 3481 3661 if (alc880_is_multi_pin(nid)) { … … 3599 3779 static void alc880_auto_init(struct hda_codec *codec) 3600 3780 { 3781 struct alc_spec *spec = codec->spec; 3601 3782 alc880_auto_init_multi_out(codec); 3602 3783 alc880_auto_init_extra_out(codec); 3603 3784 alc880_auto_init_analog_input(codec); 3785 if (spec->unsol_event) 3786 alc_sku_automute(codec); 3604 3787 } 3605 3788 … … 3975 4158 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT), 3976 4159 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT), 3977 HDA_CODEC_VOLUME(" InternalSpeaker Playback Volume", 0x09, 0x0, HDA_OUTPUT),3978 HDA_BIND_MUTE(" InternalSpeaker Playback Switch", 0x09, 2, HDA_INPUT),4160 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT), 4161 HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT), 3979 4162 {0} /* end */ 3980 4163 }; … … 4007 4190 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT), 4008 4191 ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT), 4009 HDA_CODEC_VOLUME_MONO(" MonoSpeaker Playback Volume", 0x0a, 1, 0x0,4192 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, 4010 4193 HDA_OUTPUT), 4011 HDA_BIND_MUTE_MONO(" MonoSpeaker Playback Switch", 0x0a, 1, 2,4194 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, 4012 4195 HDA_INPUT), 4013 4196 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), … … 4797 4980 int sel_idx) 4798 4981 { 4799 /* set as output */ 4800 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, 4801 pin_type); 4802 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, 4803 AMP_OUT_UNMUTE); 4982 alc_set_pin_output(codec, nid, pin_type); 4804 4983 /* need the manual connection? */ 4805 4984 if (nid >= 0x12) { … … 4931 5110 wcap = get_wcaps(codec, 0x04); 4932 5111 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; /* get type */ 4933 if (wcap != AC_WID_AUD_IN ) {5112 if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { 4934 5113 spec->adc_nids = alc260_adc_nids_alt; 4935 5114 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt); … … 4948 5127 static void alc260_auto_init(struct hda_codec *codec) 4949 5128 { 5129 struct alc_spec *spec = codec->spec; 4950 5130 alc260_auto_init_multi_out(codec); 4951 5131 alc260_auto_init_analog_input(codec); 5132 if (spec->unsol_event) 5133 alc_sku_automute(codec); 4952 5134 } 4953 5135 … … 4986 5168 SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_HP_3013), 4987 5169 SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013), 4988 SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP ),5170 SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013), 4989 5171 SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_3013), 4990 5172 SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013), … … 5206 5388 #define alc882_adc_nids_alt alc880_adc_nids_alt 5207 5389 5390 static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 }; 5391 static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 }; 5392 5208 5393 /* input MUX */ 5209 5394 /* FIXME: should be a matrix-type input source selection */ … … 5228 5413 const struct hda_input_mux *imux = spec->input_mux; 5229 5414 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); 5230 static hda_nid_t capture_mixers[3] = { 0x24, 0x23, 0x22 };5231 hda_nid_t nid = capture_mixers[adc_idx];5415 hda_nid_t nid = spec->capsrc_nids ? 5416 spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx]; 5232 5417 unsigned int *cur_val = &spec->cur_mux[adc_idx]; 5233 5418 unsigned int i, idx; … … 6009 6194 SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG), 6010 6195 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG), 6196 SND_PCI_QUIRK(0x106b, 0x00a0, "Apple iMac 24''", ALC885_IMAC24), 6011 6197 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG), 6012 6198 SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */ … … 6109 6295 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), 6110 6296 .adc_nids = alc882_adc_nids, 6297 .capsrc_nids = alc882_capsrc_nids, 6111 6298 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), 6112 6299 .channel_mode = alc882_3ST_6ch_modes, … … 6125 6312 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), 6126 6313 .adc_nids = alc882_adc_nids, 6314 .capsrc_nids = alc882_capsrc_nids, 6127 6315 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), 6128 6316 .channel_mode = alc882_3ST_6ch_modes, … … 6180 6368 int idx; 6181 6369 6370 alc_set_pin_output(codec, nid, pin_type); 6182 6371 if (spec->multiout.dac_nids[dac_idx] == 0x25) 6183 6372 idx = 4; 6184 6373 else 6185 6374 idx = spec->multiout.dac_nids[dac_idx] - 2; 6186 6187 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,6188 pin_type);6189 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,6190 AMP_OUT_UNMUTE);6191 6375 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); 6192 6376 … … 6217 6401 /* use dac 0 */ 6218 6402 alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); 6403 pin = spec->autocfg.speaker_pins[0]; 6404 if (pin) 6405 alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); 6219 6406 } 6220 6407 … … 6229 6416 for (i = 0; i < AUTO_PIN_LAST; i++) { 6230 6417 hda_nid_t nid = spec->autocfg.input_pins[i]; 6231 if (alc882_is_input_pin(nid)) { 6418 unsigned int vref; 6419 if (!nid) 6420 continue; 6421 vref = PIN_IN; 6422 if (1 /*i <= AUTO_PIN_FRONT_MIC*/) { 6423 unsigned int pincap; 6424 pincap = snd_hda_param_read(codec, nid, AC_PAR_PIN_CAP); 6425 if ((pincap >> AC_PINCAP_VREF_SHIFT) & 6426 AC_PINCAP_VREF_80) 6427 vref = PIN_VREF80; 6428 } 6429 snd_hda_codec_write(codec, nid, 0, 6430 AC_VERB_SET_PIN_WIDGET_CONTROL, vref); 6431 if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP) 6232 6432 snd_hda_codec_write(codec, nid, 0, 6233 AC_VERB_SET_PIN_WIDGET_CONTROL, 6234 i <= AUTO_PIN_FRONT_MIC ? 6235 PIN_VREF80 : PIN_IN); 6236 if (nid != ALC882_PIN_CD_NID) 6237 snd_hda_codec_write(codec, nid, 0, 6238 AC_VERB_SET_AMP_GAIN_MUTE, 6239 AMP_OUT_MUTE); 6240 } 6433 AC_VERB_SET_AMP_GAIN_MUTE, 6434 AMP_OUT_MUTE); 6241 6435 } 6242 6436 } … … 6292 6486 static void alc882_auto_init(struct hda_codec *codec) 6293 6487 { 6488 struct alc_spec *spec = codec->spec; 6294 6489 alc882_auto_init_multi_out(codec); 6295 6490 alc882_auto_init_hp_out(codec); 6296 6491 alc882_auto_init_analog_input(codec); 6297 } 6492 if (spec->unsol_event) 6493 alc_sku_automute(codec); 6494 } 6495 6496 static int patch_alc883(struct hda_codec *codec); /* called in patch_alc882() */ 6298 6497 6299 6498 static int patch_alc882(struct hda_codec *codec) … … 6321 6520 board_config = ALC885_IMAC24; 6322 6521 break; 6323 case 0x106b00a1: /* Macbook */6522 case 0x106b00a1: /* Macbook (might be wrong - PCI SSID?) */ 6324 6523 case 0x106b2c00: /* Macbook Pro rev3 */ 6524 case 0x106b3600: /* Macbook 3.1 */ 6325 6525 board_config = ALC885_MBP3; 6326 6526 break; 6327 6527 default: 6528 /* ALC889A is handled better as ALC888-compatible */ 6529 if (codec->revision_id == 0x100103) { 6530 alc_free(codec); 6531 return patch_alc883(codec); 6532 } 6328 6533 printk(KERN_INFO "hda_codec: Unknown model for ALC882, " 6329 6534 "trying auto-probe from BIOS...\n"); … … 6351 6556 setup_preset(spec, &alc882_presets[board_config]); 6352 6557 6353 spec->stream_name_analog = "ALC882 Analog"; 6558 if (codec->vendor_id == 0x10ec0885) { 6559 spec->stream_name_analog = "ALC885 Analog"; 6560 spec->stream_name_digital = "ALC885 Digital"; 6561 } else { 6562 spec->stream_name_analog = "ALC882 Analog"; 6563 spec->stream_name_digital = "ALC882 Digital"; 6564 } 6565 6354 6566 spec->stream_analog_playback = &alc882_pcm_analog_playback; 6355 6567 spec->stream_analog_capture = &alc882_pcm_analog_capture; … … 6358 6570 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture; 6359 6571 6360 spec->stream_name_digital = "ALC882 Digital";6361 6572 spec->stream_digital_playback = &alc882_pcm_digital_playback; 6362 6573 spec->stream_digital_capture = &alc882_pcm_digital_capture; … … 6370 6581 spec->adc_nids = alc882_adc_nids_alt; 6371 6582 spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids_alt); 6583 spec->capsrc_nids = alc882_capsrc_nids_alt; 6372 6584 spec->mixers[spec->num_mixers] = 6373 6585 alc882_capture_alt_mixer; … … 6376 6588 spec->adc_nids = alc882_adc_nids; 6377 6589 spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids); 6590 spec->capsrc_nids = alc882_capsrc_nids; 6378 6591 spec->mixers[spec->num_mixers] = alc882_capture_mixer; 6379 6592 spec->num_mixers++; … … 6410 6623 static hda_nid_t alc883_dac_nids[4] = { 6411 6624 /* front, rear, clfe, rear_surr */ 6412 0x02, 0x0 4, 0x03, 0x056625 0x02, 0x03, 0x04, 0x05 6413 6626 }; 6414 6627 … … 6417 6630 0x08, 0x09, 6418 6631 }; 6632 6633 static hda_nid_t alc883_capsrc_nids[2] = { 0x23, 0x22 }; 6419 6634 6420 6635 /* input MUX */ … … 6431 6646 }; 6432 6647 6648 static struct hda_input_mux alc883_3stack_6ch_intel = { 6649 .num_items = 4, 6650 .items = { 6651 { "Mic", 0x1 }, 6652 { "Front Mic", 0x0 }, 6653 { "Line", 0x2 }, 6654 { "CD", 0x4 }, 6655 }, 6656 }; 6657 6433 6658 static struct hda_input_mux alc883_lenovo_101e_capture_source = { 6434 6659 .num_items = 2, … … 6449 6674 }; 6450 6675 6676 static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = { 6677 .num_items = 2, 6678 .items = { 6679 { "Mic", 0x0 }, 6680 { "Int Mic", 0x1 }, 6681 }, 6682 }; 6683 6451 6684 #define alc883_mux_enum_info alc_mux_enum_info 6452 6685 #define alc883_mux_enum_get alc_mux_enum_get 6453 6454 static int alc883_mux_enum_put(struct snd_kcontrol *kcontrol, 6455 struct snd_ctl_elem_value *ucontrol) 6456 { 6457 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); 6458 struct alc_spec *spec = codec->spec; 6459 const struct hda_input_mux *imux = spec->input_mux; 6460 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); 6461 static hda_nid_t capture_mixers[3] = { 0x24, 0x23, 0x22 }; 6462 hda_nid_t nid = capture_mixers[adc_idx]; 6463 unsigned int *cur_val = &spec->cur_mux[adc_idx]; 6464 unsigned int i, idx; 6465 6466 idx = ucontrol->value.enumerated.item[0]; 6467 if (idx >= imux->num_items) 6468 idx = imux->num_items - 1; 6469 if (*cur_val == idx) 6470 return 0; 6471 for (i = 0; i < imux->num_items; i++) { 6472 unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE; 6473 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 6474 imux->items[i].index, 6475 HDA_AMP_MUTE, v); 6476 } 6477 *cur_val = idx; 6478 return 1; 6479 } 6686 /* ALC883 has the ALC882-type input selection */ 6687 #define alc883_mux_enum_put alc882_mux_enum_put 6480 6688 6481 6689 /* … … 6526 6734 { 4, alc883_3ST_ch4_init }, 6527 6735 { 6, alc883_3ST_ch6_init }, 6736 }; 6737 6738 /* 6739 * 2ch mode 6740 */ 6741 static struct hda_verb alc883_3ST_ch2_intel_init[] = { 6742 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, 6743 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, 6744 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, 6745 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, 6746 {0} /* end */ 6747 }; 6748 6749 /* 6750 * 4ch mode 6751 */ 6752 static struct hda_verb alc883_3ST_ch4_intel_init[] = { 6753 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, 6754 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, 6755 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, 6756 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, 6757 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, 6758 {0} /* end */ 6759 }; 6760 6761 /* 6762 * 6ch mode 6763 */ 6764 static struct hda_verb alc883_3ST_ch6_intel_init[] = { 6765 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, 6766 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, 6767 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 }, 6768 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, 6769 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, 6770 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, 6771 {0} /* end */ 6772 }; 6773 6774 static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = { 6775 { 2, alc883_3ST_ch2_intel_init }, 6776 { 4, alc883_3ST_ch4_intel_init }, 6777 { 6, alc883_3ST_ch6_intel_init }, 6528 6778 }; 6529 6779 … … 6636 6886 }; 6637 6887 6888 static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = { 6889 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), 6890 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), 6891 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), 6892 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), 6893 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), 6894 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), 6895 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), 6896 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), 6897 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), 6898 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), 6899 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), 6900 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), 6901 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), 6902 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), 6903 { 6904 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 6905 /* .name = "Capture Source", */ 6906 .name = "Input Source", 6907 .count = 2, 6908 .info = alc883_mux_enum_info, 6909 .get = alc883_mux_enum_get, 6910 .put = alc883_mux_enum_put, 6911 }, 6912 {0} /* end */ 6913 }; 6914 6915 static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = { 6916 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), 6917 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), 6918 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), 6919 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), 6920 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), 6921 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), 6922 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), 6923 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), 6924 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), 6925 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), 6926 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), 6927 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), 6928 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), 6929 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), 6930 { 6931 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 6932 /* .name = "Capture Source", */ 6933 .name = "Input Source", 6934 .count = 2, 6935 .info = alc883_mux_enum_info, 6936 .get = alc883_mux_enum_get, 6937 .put = alc883_mux_enum_put, 6938 }, 6939 {0} /* end */ 6940 }; 6941 6638 6942 static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = { 6639 6943 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), … … 6706 7010 }; 6707 7011 7012 static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = { 7013 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), 7014 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), 7015 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), 7016 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), 7017 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, 7018 HDA_OUTPUT), 7019 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), 7020 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), 7021 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), 7022 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), 7023 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), 7024 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), 7025 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), 7026 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), 7027 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), 7028 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT), 7029 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), 7030 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), 7031 HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT), 7032 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), 7033 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), 7034 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), 7035 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), 7036 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), 7037 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), 7038 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), 7039 { 7040 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 7041 /* .name = "Capture Source", */ 7042 .name = "Input Source", 7043 .count = 2, 7044 .info = alc883_mux_enum_info, 7045 .get = alc883_mux_enum_get, 7046 .put = alc883_mux_enum_put, 7047 }, 7048 {0} /* end */ 7049 }; 7050 6708 7051 static struct snd_kcontrol_new alc883_fivestack_mixer[] = { 6709 7052 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), 6710 HDA_ CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),7053 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), 6711 7054 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), 6712 HDA_ CODEC_MUTE("Surround Playback Switch", 0x15, 0x0, HDA_OUTPUT),7055 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), 6713 7056 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), 6714 7057 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), 6715 HDA_ CODEC_MUTE_MONO("Center Playback Switch", 0x16, 1, 0x0, HDA_OUTPUT),6716 HDA_ CODEC_MUTE_MONO("LFE Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),7058 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), 7059 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), 6717 7060 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), 6718 7061 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), … … 6785 7128 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), 6786 7129 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), 7130 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), 7131 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), 7132 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), 6787 7133 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), 6788 7134 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), … … 6875 7221 {0} /* end */ 6876 7222 }; 6877 6878 static struct snd_kcontrol_new alc888_6st_hp_mixer[] = {6879 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),6880 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),6881 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT),6882 HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT),6883 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT),6884 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),6885 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),6886 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),6887 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),6888 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),6889 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),6890 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),6891 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),6892 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),6893 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),6894 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),6895 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),6896 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),6897 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),6898 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),6899 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),6900 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),6901 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),6902 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),6903 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),6904 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),6905 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),6906 {6907 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,6908 /* .name = "Capture Source", */6909 .name = "Input Source",6910 .count = 2,6911 .info = alc883_mux_enum_info,6912 .get = alc883_mux_enum_get,6913 .put = alc883_mux_enum_put,6914 },6915 {0} /* end */6916 };6917 6918 static struct snd_kcontrol_new alc888_3st_hp_mixer[] = {6919 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),6920 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),6921 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT),6922 HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT),6923 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT),6924 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),6925 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),6926 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),6927 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),6928 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),6929 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),6930 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),6931 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),6932 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),6933 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),6934 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),6935 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),6936 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),6937 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),6938 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),6939 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),6940 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),6941 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),6942 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),6943 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),6944 {6945 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,6946 /* .name = "Capture Source", */6947 .name = "Input Source",6948 .count = 2,6949 .info = alc883_mux_enum_info,6950 .get = alc883_mux_enum_get,6951 .put = alc883_mux_enum_put,6952 },6953 {0} /* end */6954 };6955 6956 static struct snd_kcontrol_new alc888_6st_dell_mixer[] = {6957 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),6958 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),6959 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT),6960 HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT),6961 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT),6962 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),6963 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),6964 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),6965 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),6966 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),6967 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),6968 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),6969 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),6970 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),6971 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),6972 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),6973 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),6974 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),6975 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),6976 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),6977 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),6978 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),6979 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),6980 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),6981 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),6982 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),6983 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),6984 {6985 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,6986 /* .name = "Capture Source", */6987 .name = "Input Source",6988 .count = 2,6989 .info = alc883_mux_enum_info,6990 .get = alc883_mux_enum_get,6991 .put = alc883_mux_enum_put,6992 },6993 {0} /* end */6994 };6995 7223 6996 7224 static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = { … … 7169 7397 }; 7170 7398 7399 static struct hda_verb alc883_clevo_m720_verbs[] = { 7400 /* HP */ 7401 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, 7402 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, 7403 /* Int speaker */ 7404 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01}, 7405 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, 7406 7407 /* enable unsolicited event */ 7408 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, 7409 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, 7410 7411 {0} /* end */ 7412 }; 7413 7414 static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = { 7415 /* HP */ 7416 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, 7417 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, 7418 /* Subwoofer */ 7419 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, 7420 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, 7421 7422 /* enable unsolicited event */ 7423 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, 7424 7425 {0} /* end */ 7426 }; 7427 7171 7428 static struct hda_verb alc883_tagra_verbs[] = { 7172 7429 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, … … 7225 7482 }; 7226 7483 7227 static struct hda_verb alc888_6st_hp_verbs[] = {7228 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */7229 {0x15, AC_VERB_SET_CONNECT_SEL, 0x02}, /* Rear : output 2 (0x0e) */7230 {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* CLFE : output 1 (0x0d) */7231 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, /* Side : output 3 (0x0f) */7232 {0}7233 };7234 7235 7484 static struct hda_verb alc888_3st_hp_verbs[] = { 7236 7485 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */ 7237 {0x1 8, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */7238 {0x1 6, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */7486 {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */ 7487 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */ 7239 7488 {0} 7240 7489 }; 7241 7490 7242 7491 static struct hda_verb alc888_6st_dell_verbs[] = { 7243 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */7244 {0x15, AC_VERB_SET_CONNECT_SEL, 0x02}, /* Rear : output 1 (0x0e) */7245 {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* CLFE : output 2 (0x0d) */7246 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, /* Side : output 3 (0x0f) */7247 7492 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, 7248 7493 {0} … … 7350 7595 if ((res >> 26) == ALC880_HP_EVENT) 7351 7596 alc883_tagra_automute(codec); 7597 } 7598 7599 /* toggle speaker-output according to the hp-jack state */ 7600 static void alc883_clevo_m720_hp_automute(struct hda_codec *codec) 7601 { 7602 unsigned int present; 7603 unsigned char bits; 7604 7605 present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0) 7606 & AC_PINSENSE_PRESENCE; 7607 bits = present ? HDA_AMP_MUTE : 0; 7608 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, 7609 HDA_AMP_MUTE, bits); 7610 } 7611 7612 static void alc883_clevo_m720_mic_automute(struct hda_codec *codec) 7613 { 7614 unsigned int present; 7615 7616 present = snd_hda_codec_read(codec, 0x18, 0, 7617 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; 7618 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, 7619 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); 7620 } 7621 7622 static void alc883_clevo_m720_automute(struct hda_codec *codec) 7623 { 7624 alc883_clevo_m720_hp_automute(codec); 7625 alc883_clevo_m720_mic_automute(codec); 7626 } 7627 7628 static void alc883_clevo_m720_unsol_event(struct hda_codec *codec, 7629 unsigned int res) 7630 { 7631 switch (res >> 26) { 7632 case ALC880_HP_EVENT: 7633 alc883_clevo_m720_hp_automute(codec); 7634 break; 7635 case ALC880_MIC_EVENT: 7636 alc883_clevo_m720_mic_automute(codec); 7637 break; 7638 } 7639 } 7640 7641 /* toggle speaker-output according to the hp-jack state */ 7642 static void alc883_2ch_fujitsu_pi2515_automute(struct hda_codec *codec) 7643 { 7644 unsigned int present; 7645 unsigned char bits; 7646 7647 present = snd_hda_codec_read(codec, 0x14, 0, AC_VERB_GET_PIN_SENSE, 0) 7648 & AC_PINSENSE_PRESENCE; 7649 bits = present ? HDA_AMP_MUTE : 0; 7650 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, 7651 HDA_AMP_MUTE, bits); 7652 } 7653 7654 static void alc883_2ch_fujitsu_pi2515_unsol_event(struct hda_codec *codec, 7655 unsigned int res) 7656 { 7657 if ((res >> 26) == ALC880_HP_EVENT) 7658 alc883_2ch_fujitsu_pi2515_automute(codec); 7352 7659 } 7353 7660 … … 7585 7892 [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig", 7586 7893 [ALC883_HAIER_W66] = "haier-w66", 7587 [ALC888_6ST_HP] = "6stack-hp",7588 7894 [ALC888_3ST_HP] = "3stack-hp", 7589 7895 [ALC888_6ST_DELL] = "6stack-dell", 7590 7896 [ALC883_MITAC] = "mitac", 7897 [ALC883_CLEVO_M720] = "clevo-m720", 7898 [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515", 7899 [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel", 7591 7900 [ALC883_AUTO] = "auto", 7592 7901 }; … … 7602 7911 SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP), 7603 7912 SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP), 7604 SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC88 8_6ST_HP),7913 SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG), 7605 7914 SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG), 7915 SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG), 7606 7916 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC883_6ST_DIG), 7607 7917 SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC), … … 7612 7922 SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG), 7613 7923 SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG), 7924 SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC883_TARGA_2ch_DIG), 7614 7925 SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG), 7926 SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG), 7615 7927 SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG), 7616 7928 SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG), … … 7625 7937 SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG), 7626 7938 SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG), 7939 SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG), 7627 7940 SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG), 7628 7941 SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG), 7629 7942 SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG), 7630 7943 SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG), 7944 SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720), 7945 SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720), 7631 7946 SND_PCI_QUIRK(0x1558, 0, "Clevo laptop", ALC883_LAPTOP_EAPD), 7632 7947 SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch), 7633 7948 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION), 7949 SND_PCI_QUIRK(0x1734, 0x1108, "Fujitsu AMILO Pi2515", ALC883_FUJITSU_PI2515), 7634 7950 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch), 7635 7951 SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763), … … 7639 7955 SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG), 7640 7956 SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66), 7957 SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL), 7958 SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL), 7641 7959 SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch), 7642 7960 {0} … … 7650 7968 .dac_nids = alc883_dac_nids, 7651 7969 .dig_out_nid = ALC883_DIGOUT_NID, 7652 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),7653 .adc_nids = alc883_adc_nids,7654 7970 .dig_in_nid = ALC883_DIGIN_NID, 7655 7971 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), … … 7663 7979 .dac_nids = alc883_dac_nids, 7664 7980 .dig_out_nid = ALC883_DIGOUT_NID, 7665 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),7666 .adc_nids = alc883_adc_nids,7667 7981 .dig_in_nid = ALC883_DIGIN_NID, 7668 7982 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), … … 7676 7990 .num_dacs = ARRAY_SIZE(alc883_dac_nids), 7677 7991 .dac_nids = alc883_dac_nids, 7678 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),7679 .adc_nids = alc883_adc_nids,7680 7992 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), 7681 7993 .channel_mode = alc883_3ST_6ch_modes, 7682 7994 .need_dac_fix = 1, 7683 7995 .input_mux = &alc883_capture_source, 7996 }, 7997 [ALC883_3ST_6ch_INTEL] = { 7998 .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer }, 7999 .init_verbs = { alc883_init_verbs }, 8000 .num_dacs = ARRAY_SIZE(alc883_dac_nids), 8001 .dac_nids = alc883_dac_nids, 8002 .dig_out_nid = ALC883_DIGOUT_NID, 8003 .dig_in_nid = ALC883_DIGIN_NID, 8004 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes), 8005 .channel_mode = alc883_3ST_6ch_intel_modes, 8006 .need_dac_fix = 1, 8007 .input_mux = &alc883_3stack_6ch_intel, 7684 8008 }, 7685 8009 [ALC883_6ST_DIG] = { … … 7689 8013 .dac_nids = alc883_dac_nids, 7690 8014 .dig_out_nid = ALC883_DIGOUT_NID, 7691 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),7692 .adc_nids = alc883_adc_nids,7693 8015 .dig_in_nid = ALC883_DIGIN_NID, 7694 8016 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), … … 7702 8024 .dac_nids = alc883_dac_nids, 7703 8025 .dig_out_nid = ALC883_DIGOUT_NID, 7704 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),7705 .adc_nids = alc883_adc_nids,7706 8026 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), 7707 8027 .channel_mode = alc883_3ST_6ch_modes, … … 7717 8037 .dac_nids = alc883_dac_nids, 7718 8038 .dig_out_nid = ALC883_DIGOUT_NID, 7719 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),7720 .adc_nids = alc883_adc_nids,7721 8039 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), 7722 8040 .channel_mode = alc883_3ST_2ch_modes, … … 7735 8053 .num_dacs = ARRAY_SIZE(alc883_dac_nids), 7736 8054 .dac_nids = alc883_dac_nids, 7737 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),7738 .adc_nids = alc883_adc_nids,7739 8055 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), 7740 8056 .channel_mode = alc883_3ST_2ch_modes, … … 7747 8063 .dac_nids = alc883_dac_nids, 7748 8064 .dig_out_nid = ALC883_DIGOUT_NID, 7749 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),7750 .adc_nids = alc883_adc_nids,7751 8065 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), 7752 8066 .channel_mode = alc883_3ST_2ch_modes, … … 7762 8076 .num_dacs = ARRAY_SIZE(alc883_dac_nids), 7763 8077 .dac_nids = alc883_dac_nids, 7764 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),7765 .adc_nids = alc883_adc_nids,7766 8078 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), 7767 8079 .channel_mode = alc883_sixstack_modes, … … 7774 8086 .dac_nids = alc883_dac_nids, 7775 8087 .dig_out_nid = ALC883_DIGOUT_NID, 7776 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),7777 .adc_nids = alc883_adc_nids,7778 8088 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), 7779 8089 .channel_mode = alc883_3ST_2ch_modes, … … 7787 8097 .num_dacs = ARRAY_SIZE(alc883_dac_nids), 7788 8098 .dac_nids = alc883_dac_nids, 7789 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),7790 .adc_nids = alc883_adc_nids,7791 8099 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), 7792 8100 .channel_mode = alc883_3ST_2ch_modes, 7793 8101 .input_mux = &alc883_capture_source, 8102 }, 8103 [ALC883_CLEVO_M720] = { 8104 .mixers = { alc883_clevo_m720_mixer }, 8105 .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs }, 8106 .num_dacs = ARRAY_SIZE(alc883_dac_nids), 8107 .dac_nids = alc883_dac_nids, 8108 .dig_out_nid = ALC883_DIGOUT_NID, 8109 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), 8110 .channel_mode = alc883_3ST_2ch_modes, 8111 .input_mux = &alc883_capture_source, 8112 .unsol_event = alc883_clevo_m720_unsol_event, 8113 .init_hook = alc883_clevo_m720_automute, 7794 8114 }, 7795 8115 [ALC883_LENOVO_101E_2ch] = { … … 7798 8118 .num_dacs = ARRAY_SIZE(alc883_dac_nids), 7799 8119 .dac_nids = alc883_dac_nids, 7800 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),7801 .adc_nids = alc883_adc_nids,7802 8120 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), 7803 8121 .channel_mode = alc883_3ST_2ch_modes, … … 7811 8129 .num_dacs = ARRAY_SIZE(alc883_dac_nids), 7812 8130 .dac_nids = alc883_dac_nids, 7813 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),7814 .adc_nids = alc883_adc_nids,7815 8131 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), 7816 8132 .channel_mode = alc883_3ST_2ch_modes, … … 7826 8142 .dac_nids = alc883_dac_nids, 7827 8143 .dig_out_nid = ALC883_DIGOUT_NID, 7828 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),7829 .adc_nids = alc883_adc_nids,7830 8144 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), 7831 8145 .channel_mode = alc883_3ST_6ch_modes, … … 7841 8155 .dac_nids = alc883_dac_nids, 7842 8156 .dig_out_nid = ALC883_DIGOUT_NID, 7843 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),7844 .adc_nids = alc883_adc_nids,7845 8157 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), 7846 8158 .channel_mode = alc883_3ST_2ch_modes, … … 7848 8160 .unsol_event = alc883_haier_w66_unsol_event, 7849 8161 .init_hook = alc883_haier_w66_automute, 7850 },7851 [ALC888_6ST_HP] = {7852 .mixers = { alc888_6st_hp_mixer, alc883_chmode_mixer },7853 .init_verbs = { alc883_init_verbs, alc888_6st_hp_verbs },7854 .num_dacs = ARRAY_SIZE(alc883_dac_nids),7855 .dac_nids = alc883_dac_nids,7856 .dig_out_nid = ALC883_DIGOUT_NID,7857 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),7858 .adc_nids = alc883_adc_nids,7859 .dig_in_nid = ALC883_DIGIN_NID,7860 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),7861 .channel_mode = alc883_sixstack_modes,7862 .input_mux = &alc883_capture_source,7863 8162 }, 7864 8163 [ALC888_3ST_HP] = { 7865 .mixers = { alc88 8_3st_hp_mixer, alc883_chmode_mixer },8164 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, 7866 8165 .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs }, 7867 8166 .num_dacs = ARRAY_SIZE(alc883_dac_nids), 7868 8167 .dac_nids = alc883_dac_nids, 7869 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),7870 .adc_nids = alc883_adc_nids,7871 8168 .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes), 7872 8169 .channel_mode = alc888_3st_hp_modes, … … 7875 8172 }, 7876 8173 [ALC888_6ST_DELL] = { 7877 .mixers = { alc88 8_6st_dell_mixer, alc883_chmode_mixer },8174 .mixers = { alc883_base_mixer, alc883_chmode_mixer }, 7878 8175 .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs }, 7879 8176 .num_dacs = ARRAY_SIZE(alc883_dac_nids), 7880 8177 .dac_nids = alc883_dac_nids, 7881 8178 .dig_out_nid = ALC883_DIGOUT_NID, 7882 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),7883 .adc_nids = alc883_adc_nids,7884 8179 .dig_in_nid = ALC883_DIGIN_NID, 7885 8180 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), … … 7894 8189 .num_dacs = ARRAY_SIZE(alc883_dac_nids), 7895 8190 .dac_nids = alc883_dac_nids, 7896 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),7897 .adc_nids = alc883_adc_nids,7898 8191 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), 7899 8192 .channel_mode = alc883_3ST_2ch_modes, … … 7901 8194 .unsol_event = alc883_mitac_unsol_event, 7902 8195 .init_hook = alc883_mitac_automute, 8196 }, 8197 [ALC883_FUJITSU_PI2515] = { 8198 .mixers = { alc883_2ch_fujitsu_pi2515_mixer }, 8199 .init_verbs = { alc883_init_verbs, 8200 alc883_2ch_fujitsu_pi2515_verbs}, 8201 .num_dacs = ARRAY_SIZE(alc883_dac_nids), 8202 .dac_nids = alc883_dac_nids, 8203 .dig_out_nid = ALC883_DIGOUT_NID, 8204 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), 8205 .channel_mode = alc883_3ST_2ch_modes, 8206 .input_mux = &alc883_fujitsu_pi2515_capture_source, 8207 .unsol_event = alc883_2ch_fujitsu_pi2515_unsol_event, 8208 .init_hook = alc883_2ch_fujitsu_pi2515_automute, 7903 8209 }, 7904 8210 }; … … 7916 8222 int idx; 7917 8223 8224 alc_set_pin_output(codec, nid, pin_type); 7918 8225 if (spec->multiout.dac_nids[dac_idx] == 0x25) 7919 8226 idx = 4; 7920 8227 else 7921 8228 idx = spec->multiout.dac_nids[dac_idx] - 2; 7922 7923 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,7924 pin_type);7925 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,7926 AMP_OUT_UNMUTE);7927 8229 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); 7928 8230 … … 7953 8255 /* use dac 0 */ 7954 8256 alc883_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); 8257 pin = spec->autocfg.speaker_pins[0]; 8258 if (pin) 8259 alc883_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); 7955 8260 } 7956 8261 … … 8004 8309 static void alc883_auto_init(struct hda_codec *codec) 8005 8310 { 8311 struct alc_spec *spec = codec->spec; 8006 8312 alc883_auto_init_multi_out(codec); 8007 8313 alc883_auto_init_hp_out(codec); 8008 8314 alc883_auto_init_analog_input(codec); 8315 if (spec->unsol_event) 8316 alc_sku_automute(codec); 8009 8317 } 8010 8318 … … 8019 8327 8020 8328 codec->spec = spec; 8329 8330 alc_fix_pll_init(codec, 0x20, 0x0a, 10); 8021 8331 8022 8332 board_config = snd_hda_check_board_config(codec, ALC883_MODEL_LAST, … … 8046 8356 setup_preset(spec, &alc883_presets[board_config]); 8047 8357 8048 spec->stream_name_analog = "ALC883 Analog"; 8358 switch (codec->vendor_id) { 8359 case 0x10ec0888: 8360 spec->stream_name_analog = "ALC888 Analog"; 8361 spec->stream_name_digital = "ALC888 Digital"; 8362 break; 8363 case 0x10ec0889: 8364 spec->stream_name_analog = "ALC889 Analog"; 8365 spec->stream_name_digital = "ALC889 Digital"; 8366 break; 8367 default: 8368 spec->stream_name_analog = "ALC883 Analog"; 8369 spec->stream_name_digital = "ALC883 Digital"; 8370 break; 8371 } 8372 8049 8373 spec->stream_analog_playback = &alc883_pcm_analog_playback; 8050 8374 spec->stream_analog_capture = &alc883_pcm_analog_capture; 8051 8375 spec->stream_analog_alt_capture = &alc883_pcm_analog_alt_capture; 8052 8376 8053 spec->stream_name_digital = "ALC883 Digital";8054 8377 spec->stream_digital_playback = &alc883_pcm_digital_playback; 8055 8378 spec->stream_digital_capture = &alc883_pcm_digital_capture; 8056 8379 8057 if (!spec->adc_nids && spec->input_mux) { 8058 spec->adc_nids = alc883_adc_nids; 8059 spec->num_adc_nids = ARRAY_SIZE(alc883_adc_nids); 8060 } 8380 spec->num_adc_nids = ARRAY_SIZE(alc883_adc_nids); 8381 spec->adc_nids = alc883_adc_nids; 8382 spec->capsrc_nids = alc883_capsrc_nids; 8061 8383 8062 8384 spec->vmaster_nid = 0x0c; … … 8065 8387 if (board_config == ALC883_AUTO) 8066 8388 spec->init_hook = alc883_auto_init; 8389 else if (codec->vendor_id == 0x10ec0888) 8390 spec->init_hook = alc888_coef_init; 8391 8067 8392 #ifdef CONFIG_SND_HDA_POWER_SAVE 8068 8393 if (!spec->loopback.amplist) … … 8083 8408 #define alc262_adc_nids alc882_adc_nids 8084 8409 #define alc262_adc_nids_alt alc882_adc_nids_alt 8410 #define alc262_capsrc_nids alc882_capsrc_nids 8411 #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt 8085 8412 8086 8413 #define alc262_modes alc260_modes … … 8101 8428 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), 8102 8429 /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT), 8103 HDA_CODEC_MUTE("PC Bee lp Playback Switch", 0x0b, 0x05, HDA_INPUT), */8430 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), */ 8104 8431 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT), 8105 8432 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), … … 8123 8450 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), 8124 8451 /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT), 8125 HDA_CODEC_MUTE("PC Bee lp Playback Switch", 0x0b, 0x05, HDA_INPUT), */8452 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), */ 8126 8453 /*HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),*/ 8127 8454 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), … … 8516 8843 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, 8517 8844 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, 8845 {0} 8518 8846 }; 8519 8847 … … 8583 8911 /* 8584 8912 * fujitsu model 8585 * 0x14 = headphone/spdif-out, 0x15 = internal speaker 8913 * 0x14 = headphone/spdif-out, 0x15 = internal speaker, 8914 * 0x1b = port replicator headphone out 8586 8915 */ 8587 8916 … … 8591 8920 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, 8592 8921 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, 8922 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, 8923 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, 8924 {0} 8925 }; 8926 8927 static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = { 8928 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, 8929 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, 8593 8930 {0} 8594 8931 }; … … 8624 8961 }; 8625 8962 8626 /* mute/unmute internal speaker according to the hp jack and mute state */8963 /* mute/unmute internal speaker according to the hp jacks and mute state */ 8627 8964 static void alc262_fujitsu_automute(struct hda_codec *codec, int force) 8628 8965 { … … 8634 8971 /* need to execute and sync at first */ 8635 8972 snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0); 8973 /* check laptop HP jack */ 8636 8974 present = snd_hda_codec_read(codec, 0x14, 0, 8637 AC_VERB_GET_PIN_SENSE, 0); 8638 spec->jack_present = (present & 0x80000000) != 0; 8975 AC_VERB_GET_PIN_SENSE, 0); 8976 /* need to execute and sync at first */ 8977 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0); 8978 /* check docking HP jack */ 8979 present |= snd_hda_codec_read(codec, 0x1b, 0, 8980 AC_VERB_GET_PIN_SENSE, 0); 8981 if (present & AC_PINSENSE_PRESENCE) 8982 spec->jack_present = 1; 8983 else 8984 spec->jack_present = 0; 8639 8985 spec->sense_updated = 1; 8640 8986 } 8641 if (spec->jack_present) {8642 /* mute internal speaker */8643 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,8644 HDA_AMP_MUTE, HDA_AMP_MUTE);8645 } else {8646 /* unmute internal speaker if necessary */8987 /* unmute internal speaker only if both HPs are unplugged and 8988 * master switch is on 8989 */ 8990 if (spec->jack_present) 8991 mute = HDA_AMP_MUTE; 8992 else 8647 8993 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); 8648 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, 8649 HDA_AMP_MUTE, mute); 8650 } 8994 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, 8995 HDA_AMP_MUTE, mute); 8651 8996 } 8652 8997 … … 8657 9002 if ((res >> 26) != ALC_HP_EVENT) 8658 9003 return; 9004 alc262_fujitsu_automute(codec, 1); 9005 } 9006 9007 static void alc262_fujitsu_init_hook(struct hda_codec *codec) 9008 { 8659 9009 alc262_fujitsu_automute(codec, 1); 8660 9010 } … … 8670 9020 }; 8671 9021 9022 /* mute/unmute internal speaker according to the hp jack and mute state */ 9023 static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force) 9024 { 9025 struct alc_spec *spec = codec->spec; 9026 unsigned int mute; 9027 9028 if (force || !spec->sense_updated) { 9029 unsigned int present_int_hp; 9030 /* need to execute and sync at first */ 9031 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0); 9032 present_int_hp = snd_hda_codec_read(codec, 0x1b, 0, 9033 AC_VERB_GET_PIN_SENSE, 0); 9034 spec->jack_present = (present_int_hp & 0x80000000) != 0; 9035 spec->sense_updated = 1; 9036 } 9037 if (spec->jack_present) { 9038 /* mute internal speaker */ 9039 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, 9040 HDA_AMP_MUTE, HDA_AMP_MUTE); 9041 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, 9042 HDA_AMP_MUTE, HDA_AMP_MUTE); 9043 } else { 9044 /* unmute internal speaker if necessary */ 9045 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0); 9046 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, 9047 HDA_AMP_MUTE, mute); 9048 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, 9049 HDA_AMP_MUTE, mute); 9050 } 9051 } 9052 9053 /* unsolicited event for HP jack sensing */ 9054 static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec, 9055 unsigned int res) 9056 { 9057 if ((res >> 26) != ALC_HP_EVENT) 9058 return; 9059 alc262_lenovo_3000_automute(codec, 1); 9060 } 9061 8672 9062 /* bind hp and internal speaker mute (with plug check) */ 8673 9063 static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol, … … 8678 9068 int change; 8679 9069 8680 change = snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0, 8681 HDA_AMP_MUTE, 8682 valp[0] ? 0 : HDA_AMP_MUTE); 8683 change |= snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0, 8684 HDA_AMP_MUTE, 8685 valp[1] ? 0 : HDA_AMP_MUTE); 9070 change = snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, 9071 HDA_AMP_MUTE, 9072 valp ? 0 : HDA_AMP_MUTE); 9073 change |= snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, 9074 HDA_AMP_MUTE, 9075 valp ? 0 : HDA_AMP_MUTE); 9076 8686 9077 if (change) 8687 9078 alc262_fujitsu_automute(codec, 0); … … 8701 9092 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), 8702 9093 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), 9094 HDA_CODEC_VOLUME("PC Speaker Volume", 0x0b, 0x05, HDA_INPUT), 9095 HDA_CODEC_MUTE("PC Speaker Switch", 0x0b, 0x05, HDA_INPUT), 8703 9096 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), 8704 9097 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), … … 8710 9103 }; 8711 9104 9105 /* bind hp and internal speaker mute (with plug check) */ 9106 static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol, 9107 struct snd_ctl_elem_value *ucontrol) 9108 { 9109 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); 9110 long *valp = ucontrol->value.integer.value; 9111 int change; 9112 9113 change = snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, 9114 HDA_AMP_MUTE, 9115 valp ? 0 : HDA_AMP_MUTE); 9116 9117 if (change) 9118 alc262_lenovo_3000_automute(codec, 0); 9119 return change; 9120 } 9121 9122 static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = { 9123 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), 9124 { 9125 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 9126 .name = "Master Playback Switch", 9127 .info = snd_hda_mixer_amp_switch_info, 9128 .get = snd_hda_mixer_amp_switch_get, 9129 .put = alc262_lenovo_3000_master_sw_put, 9130 .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), 9131 }, 9132 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), 9133 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), 9134 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), 9135 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), 9136 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), 9137 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), 9138 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), 9139 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), 9140 {0} /* end */ 9141 }; 9142 8712 9143 /* additional init verbs for Benq laptops */ 8713 9144 static struct hda_verb alc262_EAPD_verbs[] = { … … 8728 9159 /* Samsung Q1 Ultra Vista model setup */ 8729 9160 static struct snd_kcontrol_new alc262_ultra_mixer[] = { 8730 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), 8731 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), 8732 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), 9161 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), 9162 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), 8733 9163 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), 8734 9164 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), 8735 9165 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT), 9166 HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT), 8736 9167 {0} /* end */ 8737 9168 }; 8738 9169 8739 9170 static struct hda_verb alc262_ultra_verbs[] = { 9171 /* output mixer */ 9172 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, 9173 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, 9174 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, 9175 /* speaker */ 9176 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, 9177 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, 9178 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 9179 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, 9180 /* HP */ 9181 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, 9182 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, 9183 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 9184 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, 8740 9185 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, 8741 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, 8742 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, 8743 /* Mic is on Node 0x19 */ 8744 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, 8745 {0x22, AC_VERB_SET_CONNECT_SEL, 0x01}, 8746 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, 8747 {0x23, AC_VERB_SET_CONNECT_SEL, 0x01}, 8748 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, 8749 {0x24, AC_VERB_SET_CONNECT_SEL, 0x01}, 8750 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, 9186 /* internal mic */ 9187 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, 9188 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, 9189 /* ADC, choose mic */ 9190 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, 9191 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, 9192 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 9193 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, 9194 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, 9195 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, 9196 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, 9197 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, 9198 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, 9199 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)}, 8751 9200 {0} 8752 };8753 8754 static struct hda_input_mux alc262_ultra_capture_source = {8755 .num_items = 1,8756 .items = {8757 { "Mic", 0x1 },8758 },8759 9201 }; 8760 9202 … … 8764 9206 struct alc_spec *spec = codec->spec; 8765 9207 unsigned int mute; 8766 unsigned int present; 8767 8768 /* need to execute and sync at first */ 8769 snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0); 8770 present = snd_hda_codec_read(codec, 0x15, 0, 8771 AC_VERB_GET_PIN_SENSE, 0); 8772 spec->jack_present = (present & 0x80000000) != 0; 8773 if (spec->jack_present) { 8774 /* mute internal speaker */ 8775 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, 8776 HDA_AMP_MUTE, HDA_AMP_MUTE); 8777 } else { 8778 /* unmute internal speaker if necessary */ 8779 mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0); 8780 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, 8781 HDA_AMP_MUTE, mute); 9208 9209 mute = 0; 9210 /* auto-mute only when HP is used as HP */ 9211 if (!spec->cur_mux[0]) { 9212 unsigned int present; 9213 /* need to execute and sync at first */ 9214 snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0); 9215 present = snd_hda_codec_read(codec, 0x15, 0, 9216 AC_VERB_GET_PIN_SENSE, 0); 9217 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; 9218 if (spec->jack_present) 9219 mute = HDA_AMP_MUTE; 8782 9220 } 9221 /* mute/unmute internal speaker */ 9222 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, 9223 HDA_AMP_MUTE, mute); 9224 /* mute/unmute HP */ 9225 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, 9226 HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE); 8783 9227 } 8784 9228 … … 8791 9235 alc262_ultra_automute(codec); 8792 9236 } 9237 9238 static struct hda_input_mux alc262_ultra_capture_source = { 9239 .num_items = 2, 9240 .items = { 9241 { "Mic", 0x1 }, 9242 { "Headphone", 0x7 }, 9243 }, 9244 }; 9245 9246 static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol, 9247 struct snd_ctl_elem_value *ucontrol) 9248 { 9249 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); 9250 struct alc_spec *spec = codec->spec; 9251 int ret; 9252 9253 ret = alc882_mux_enum_put(kcontrol, ucontrol); 9254 if (!ret) 9255 return 0; 9256 /* reprogram the HP pin as mic or HP according to the input source */ 9257 snd_hda_codec_write_cache(codec, 0x15, 0, 9258 AC_VERB_SET_PIN_WIDGET_CONTROL, 9259 spec->cur_mux[0] ? PIN_VREF80 : PIN_HP); 9260 alc262_ultra_automute(codec); /* mute/unmute HP */ 9261 return ret; 9262 } 9263 9264 static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = { 9265 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT), 9266 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT), 9267 { 9268 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 9269 .name = "Capture Source", 9270 .info = alc882_mux_enum_info, 9271 .get = alc882_mux_enum_get, 9272 .put = alc262_ultra_mux_enum_put, 9273 }, 9274 {0} /* end */ 9275 }; 8793 9276 8794 9277 /* add playback controls from the parsed DAC table */ … … 9183 9666 static void alc262_auto_init(struct hda_codec *codec) 9184 9667 { 9668 struct alc_spec *spec = codec->spec; 9185 9669 alc262_auto_init_multi_out(codec); 9186 9670 alc262_auto_init_hp_out(codec); 9187 9671 alc262_auto_init_analog_input(codec); 9672 if (spec->unsol_event) 9673 alc_sku_automute(codec); 9188 9674 } 9189 9675 … … 9204 9690 [ALC262_SONY_ASSAMD] = "sony-assamd", 9205 9691 [ALC262_ULTRA] = "ultra", 9692 [ALC262_LENOVO_3000] = "lenovo-3000", 9206 9693 [ALC262_AUTO] = "auto", 9207 9694 }; … … 9236 9723 SND_PCI_QUIRK(0x104d, 0x900e, "Sony ASSAMD", ALC262_SONY_ASSAMD), 9237 9724 SND_PCI_QUIRK(0x104d, 0x9015, "Sony 0x9015", ALC262_SONY_ASSAMD), 9725 SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1", 9726 ALC262_SONY_ASSAMD), 9238 9727 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU), 9728 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU), 9239 9729 SND_PCI_QUIRK(0x144d, 0xc032, "Samsung Q1 Ultra", ALC262_ULTRA), 9730 SND_PCI_QUIRK(0x144d, 0xc039, "Samsung Q1U EL", ALC262_ULTRA), 9731 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000), 9240 9732 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8), 9241 9733 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31), … … 9293 9785 .input_mux = &alc262_fujitsu_capture_source, 9294 9786 .unsol_event = alc262_fujitsu_unsol_event, 9787 .init_hook = alc262_fujitsu_init_hook, 9295 9788 }, 9296 9789 [ALC262_HP_BPC] = { … … 9387 9880 }, 9388 9881 [ALC262_ULTRA] = { 9389 .mixers = { alc262_ultra_mixer }, 9390 .init_verbs = { alc262_init_verbs, alc262_ultra_verbs }, 9882 .mixers = { alc262_ultra_mixer, alc262_ultra_capture_mixer }, 9883 .init_verbs = { alc262_ultra_verbs }, 9884 .num_dacs = ARRAY_SIZE(alc262_dac_nids), 9885 .dac_nids = alc262_dac_nids, 9886 .num_channel_mode = ARRAY_SIZE(alc262_modes), 9887 .channel_mode = alc262_modes, 9888 .input_mux = &alc262_ultra_capture_source, 9889 .adc_nids = alc262_adc_nids, /* ADC0 */ 9890 .capsrc_nids = alc262_capsrc_nids, 9891 .num_adc_nids = 1, /* single ADC */ 9892 .unsol_event = alc262_ultra_unsol_event, 9893 .init_hook = alc262_ultra_automute, 9894 }, 9895 [ALC262_LENOVO_3000] = { 9896 .mixers = { alc262_lenovo_3000_mixer }, 9897 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, 9898 alc262_lenovo_3000_unsol_verbs }, 9391 9899 .num_dacs = ARRAY_SIZE(alc262_dac_nids), 9392 9900 .dac_nids = alc262_dac_nids, … … 9395 9903 .num_channel_mode = ARRAY_SIZE(alc262_modes), 9396 9904 .channel_mode = alc262_modes, 9397 .input_mux = &alc262_ultra_capture_source, 9398 .unsol_event = alc262_ultra_unsol_event, 9399 .init_hook = alc262_ultra_automute, 9905 .input_mux = &alc262_fujitsu_capture_source, 9906 .unsol_event = alc262_lenovo_3000_unsol_event, 9400 9907 }, 9401 9908 }; … … 9425 9932 #endif 9426 9933 9934 alc_fix_pll_init(codec, 0x20, 0x0a, 10); 9935 9427 9936 board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST, 9428 9937 alc262_models, … … 9469 9978 spec->adc_nids = alc262_adc_nids_alt; 9470 9979 spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids_alt); 9980 spec->capsrc_nids = alc262_capsrc_nids_alt; 9471 9981 spec->mixers[spec->num_mixers] = 9472 9982 alc262_capture_alt_mixer; … … 9475 9985 spec->adc_nids = alc262_adc_nids; 9476 9986 spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids); 9987 spec->capsrc_nids = alc262_capsrc_nids; 9477 9988 spec->mixers[spec->num_mixers] = alc262_capture_mixer; 9478 9989 spec->num_mixers++; … … 9514 10025 }; 9515 10026 10027 static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 }; 10028 9516 10029 static struct snd_kcontrol_new alc268_base_mixer[] = { 9517 10030 /* output mixer control */ … … 9523 10036 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), 9524 10037 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), 10038 {0} 10039 }; 10040 10041 /* bind Beep switches of both NID 0x0f and 0x10 */ 10042 static struct hda_bind_ctls alc268_bind_beep_sw = { 10043 .ops = &snd_hda_bind_sw, 10044 .values = { 10045 HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT), 10046 HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT), 10047 0 10048 }, 10049 }; 10050 10051 static struct snd_kcontrol_new alc268_beep_mixer[] = { 10052 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT), 10053 HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw), 9525 10054 {0} 9526 10055 }; … … 9610 10139 9611 10140 static struct hda_verb alc268_acer_verbs[] = { 10141 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */ 10142 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, 9612 10143 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, 9613 10144 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, 10145 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, 10146 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, 9614 10147 9615 10148 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, … … 9681 10214 9682 10215 #define alc268_dell_init_hook alc268_dell_automute 10216 10217 static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = { 10218 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT), 10219 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), 10220 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), 10221 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), 10222 HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT), 10223 HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT), 10224 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), 10225 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), 10226 {0} 10227 }; 10228 10229 static struct hda_verb alc267_quanta_il1_verbs[] = { 10230 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, 10231 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, 10232 {0} 10233 }; 10234 10235 static void alc267_quanta_il1_hp_automute(struct hda_codec *codec) 10236 { 10237 unsigned int present; 10238 10239 present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0) 10240 & AC_PINSENSE_PRESENCE; 10241 snd_hda_codec_write(codec, 0x14, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, 10242 present ? 0 : PIN_OUT); 10243 } 10244 10245 static void alc267_quanta_il1_mic_automute(struct hda_codec *codec) 10246 { 10247 unsigned int present; 10248 10249 present = snd_hda_codec_read(codec, 0x18, 0, 10250 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; 10251 snd_hda_codec_write(codec, 0x23, 0, 10252 AC_VERB_SET_CONNECT_SEL, 10253 present ? 0x00 : 0x01); 10254 } 10255 10256 static void alc267_quanta_il1_automute(struct hda_codec *codec) 10257 { 10258 alc267_quanta_il1_hp_automute(codec); 10259 alc267_quanta_il1_mic_automute(codec); 10260 } 10261 10262 static void alc267_quanta_il1_unsol_event(struct hda_codec *codec, 10263 unsigned int res) 10264 { 10265 switch (res >> 26) { 10266 case ALC880_HP_EVENT: 10267 alc267_quanta_il1_hp_automute(codec); 10268 break; 10269 case ALC880_MIC_EVENT: 10270 alc267_quanta_il1_mic_automute(codec); 10271 break; 10272 } 10273 } 9683 10274 9684 10275 /* … … 9722 10313 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, 9723 10314 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, 9724 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, 10315 10316 /* set PCBEEP vol = 0, mute connections */ 10317 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 10318 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, 10319 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, 9725 10320 9726 10321 /* Unmute Selector 23h,24h and set the default input to mic-in */ … … 9761 10356 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, 9762 10357 9763 /* set PCBEEP vol = 0 */ 9764 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, (0xb000 | (0x00 << 8))}, 10358 /* set PCBEEP vol = 0, mute connections */ 10359 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 10360 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, 10361 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, 9765 10362 9766 10363 {0} … … 9769 10366 #define alc268_mux_enum_info alc_mux_enum_info 9770 10367 #define alc268_mux_enum_get alc_mux_enum_get 9771 9772 static int alc268_mux_enum_put(struct snd_kcontrol *kcontrol, 9773 struct snd_ctl_elem_value *ucontrol) 9774 { 9775 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); 9776 struct alc_spec *spec = codec->spec; 9777 9778 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); 9779 static hda_nid_t capture_mixers[3] = { 0x23, 0x24 }; 9780 hda_nid_t nid = capture_mixers[adc_idx]; 9781 9782 return snd_hda_input_mux_put(codec, spec->input_mux, ucontrol, 9783 nid, 9784 &spec->cur_mux[adc_idx]); 9785 } 10368 #define alc268_mux_enum_put alc_mux_enum_put 9786 10369 9787 10370 static struct snd_kcontrol_new alc268_capture_alt_mixer[] = { … … 9833 10416 }; 9834 10417 10418 static struct hda_input_mux alc268_acer_capture_source = { 10419 .num_items = 3, 10420 .items = { 10421 { "Mic", 0x0 }, 10422 { "Internal Mic", 0x6 }, 10423 { "Line", 0x2 }, 10424 }, 10425 }; 10426 9835 10427 #ifdef CONFIG_SND_DEBUG 9836 10428 static struct snd_kcontrol_new alc268_test_mixer[] = { 9837 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),9838 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),9839 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),9840 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),9841 9842 10429 /* Volume widgets */ 9843 10430 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT), … … 9978 10565 idx1 = 3; /* CD */ 9979 10566 break; 10567 case 0x12: 10568 case 0x13: 10569 idx1 = 6; /* digital mics */ 10570 break; 9980 10571 default: 9981 10572 continue; … … 10070 10661 spec->mixers[spec->num_mixers++] = spec->kctl_alloc; 10071 10662 10663 if (spec->autocfg.speaker_pins[0] != 0x1d) 10664 spec->mixers[spec->num_mixers++] = alc268_beep_mixer; 10665 10072 10666 spec->init_verbs[spec->num_init_verbs++] = alc268_volume_init_verbs; 10073 10667 spec->num_mux_defs = 1; … … 10088 10682 static void alc268_auto_init(struct hda_codec *codec) 10089 10683 { 10684 struct alc_spec *spec = codec->spec; 10090 10685 alc268_auto_init_multi_out(codec); 10091 10686 alc268_auto_init_hp_out(codec); 10092 10687 alc268_auto_init_mono_speaker_out(codec); 10093 10688 alc268_auto_init_analog_input(codec); 10689 if (spec->unsol_event) 10690 alc_sku_automute(codec); 10094 10691 } 10095 10692 … … 10098 10695 */ 10099 10696 static const char *alc268_models[ALC268_MODEL_LAST] = { 10697 [ALC267_QUANTA_IL1] = "quanta-il1", 10100 10698 [ALC268_3ST] = "3stack", 10101 10699 [ALC268_TOSHIBA] = "toshiba", … … 10110 10708 10111 10709 static struct snd_pci_quirk alc268_cfg_tbl[] = { 10710 SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER), 10112 10711 SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER), 10113 10712 SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER), … … 10119 10718 SND_PCI_QUIRK(0x1179, 0xff10, "TOSHIBA A205", ALC268_TOSHIBA), 10120 10719 SND_PCI_QUIRK(0x1179, 0xff50, "TOSHIBA A305", ALC268_TOSHIBA), 10720 SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA), 10121 10721 SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER), 10722 SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1), 10122 10723 SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO), 10123 10724 {0} … … 10125 10726 10126 10727 static struct alc_config_preset alc268_presets[] = { 10127 [ALC268_3ST] = { 10128 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer }, 10129 .init_verbs = { alc268_base_init_verbs }, 10130 .num_dacs = ARRAY_SIZE(alc268_dac_nids), 10131 .dac_nids = alc268_dac_nids, 10132 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), 10133 .adc_nids = alc268_adc_nids_alt, 10134 .hp_nid = 0x03, 10135 .dig_out_nid = ALC268_DIGOUT_NID, 10136 .num_channel_mode = ARRAY_SIZE(alc268_modes), 10137 .channel_mode = alc268_modes, 10138 .input_mux = &alc268_capture_source, 10139 }, 10140 [ALC268_TOSHIBA] = { 10141 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer }, 10728 [ALC267_QUANTA_IL1] = { 10729 .mixers = { alc267_quanta_il1_mixer }, 10142 10730 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, 10143 alc26 8_toshiba_verbs },10731 alc267_quanta_il1_verbs }, 10144 10732 .num_dacs = ARRAY_SIZE(alc268_dac_nids), 10145 10733 .dac_nids = alc268_dac_nids, … … 10150 10738 .channel_mode = alc268_modes, 10151 10739 .input_mux = &alc268_capture_source, 10740 .unsol_event = alc267_quanta_il1_unsol_event, 10741 .init_hook = alc267_quanta_il1_automute, 10742 }, 10743 [ALC268_3ST] = { 10744 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, 10745 alc268_beep_mixer }, 10746 .init_verbs = { alc268_base_init_verbs }, 10747 .num_dacs = ARRAY_SIZE(alc268_dac_nids), 10748 .dac_nids = alc268_dac_nids, 10749 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), 10750 .adc_nids = alc268_adc_nids_alt, 10751 .capsrc_nids = alc268_capsrc_nids, 10752 .hp_nid = 0x03, 10753 .dig_out_nid = ALC268_DIGOUT_NID, 10754 .num_channel_mode = ARRAY_SIZE(alc268_modes), 10755 .channel_mode = alc268_modes, 10756 .input_mux = &alc268_capture_source, 10757 }, 10758 [ALC268_TOSHIBA] = { 10759 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, 10760 alc268_beep_mixer }, 10761 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, 10762 alc268_toshiba_verbs }, 10763 .num_dacs = ARRAY_SIZE(alc268_dac_nids), 10764 .dac_nids = alc268_dac_nids, 10765 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), 10766 .adc_nids = alc268_adc_nids_alt, 10767 .capsrc_nids = alc268_capsrc_nids, 10768 .hp_nid = 0x03, 10769 .num_channel_mode = ARRAY_SIZE(alc268_modes), 10770 .channel_mode = alc268_modes, 10771 .input_mux = &alc268_capture_source, 10152 10772 .unsol_event = alc268_toshiba_unsol_event, 10153 10773 .init_hook = alc268_toshiba_automute, 10154 10774 }, 10155 10775 [ALC268_ACER] = { 10156 .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer }, 10776 .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer, 10777 alc268_beep_mixer }, 10157 10778 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, 10158 10779 alc268_acer_verbs }, … … 10161 10782 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), 10162 10783 .adc_nids = alc268_adc_nids_alt, 10784 .capsrc_nids = alc268_capsrc_nids, 10163 10785 .hp_nid = 0x02, 10164 10786 .num_channel_mode = ARRAY_SIZE(alc268_modes), 10165 10787 .channel_mode = alc268_modes, 10166 .input_mux = &alc268_ capture_source,10788 .input_mux = &alc268_acer_capture_source, 10167 10789 .unsol_event = alc268_acer_unsol_event, 10168 10790 .init_hook = alc268_acer_init_hook, 10169 10791 }, 10170 10792 [ALC268_DELL] = { 10171 .mixers = { alc268_dell_mixer },10793 .mixers = { alc268_dell_mixer, alc268_beep_mixer }, 10172 10794 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, 10173 10795 alc268_dell_verbs }, … … 10182 10804 }, 10183 10805 [ALC268_ZEPTO] = { 10184 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer }, 10806 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, 10807 alc268_beep_mixer }, 10185 10808 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, 10186 10809 alc268_toshiba_verbs }, … … 10189 10812 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), 10190 10813 .adc_nids = alc268_adc_nids_alt, 10814 .capsrc_nids = alc268_capsrc_nids, 10191 10815 .hp_nid = 0x03, 10192 10816 .dig_out_nid = ALC268_DIGOUT_NID, … … 10206 10830 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), 10207 10831 .adc_nids = alc268_adc_nids_alt, 10832 .capsrc_nids = alc268_capsrc_nids, 10208 10833 .hp_nid = 0x03, 10209 10834 .dig_out_nid = ALC268_DIGOUT_NID, … … 10254 10879 setup_preset(spec, &alc268_presets[board_config]); 10255 10880 10256 spec->stream_name_analog = "ALC268 Analog"; 10881 if (codec->vendor_id == 0x10ec0267) { 10882 spec->stream_name_analog = "ALC267 Analog"; 10883 spec->stream_name_digital = "ALC267 Digital"; 10884 } else { 10885 spec->stream_name_analog = "ALC268 Analog"; 10886 spec->stream_name_digital = "ALC268 Digital"; 10887 } 10888 10257 10889 spec->stream_analog_playback = &alc268_pcm_analog_playback; 10258 10890 spec->stream_analog_capture = &alc268_pcm_analog_capture; 10259 10891 spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture; 10260 10892 10261 spec->stream_name_digital = "ALC268 Digital";10262 10893 spec->stream_digital_playback = &alc268_pcm_digital_playback; 10894 10895 if (!query_amp_caps(codec, 0x1d, HDA_INPUT)) 10896 /* override the amp caps for beep generator */ 10897 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT, 10898 (0x0c << AC_AMPCAP_OFFSET_SHIFT) | 10899 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) | 10900 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) | 10901 (0 << AC_AMPCAP_MUTE_SHIFT)); 10263 10902 10264 10903 if (!spec->adc_nids && spec->input_mux) { 10265 10904 /* check whether NID 0x07 is valid */ 10266 10905 unsigned int wcap = get_wcaps(codec, 0x07); 10906 int i; 10267 10907 10268 10908 /* get type */ 10269 10909 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; 10270 if (wcap != AC_WID_AUD_IN ) {10910 if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { 10271 10911 spec->adc_nids = alc268_adc_nids_alt; 10272 10912 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt); … … 10281 10921 spec->num_mixers++; 10282 10922 } 10923 spec->capsrc_nids = alc268_capsrc_nids; 10924 /* set default input source */ 10925 for (i = 0; i < spec->num_adc_nids; i++) 10926 snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i], 10927 0, AC_VERB_SET_CONNECT_SEL, 10928 spec->input_mux->items[0].index); 10283 10929 } 10284 10930 … … 10554 11200 static void alc269_auto_init(struct hda_codec *codec) 10555 11201 { 11202 struct alc_spec *spec = codec->spec; 10556 11203 alc269_auto_init_multi_out(codec); 10557 11204 alc269_auto_init_hp_out(codec); 10558 11205 alc269_auto_init_analog_input(codec); 11206 if (spec->unsol_event) 11207 alc_sku_automute(codec); 10559 11208 } 10560 11209 … … 10594 11243 10595 11244 codec->spec = spec; 11245 11246 alc_fix_pll_init(codec, 0x20, 0x04, 15); 10596 11247 10597 11248 board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST, … … 11478 12129 int pin_type, int dac_idx) 11479 12130 { 11480 /* set as output */11481 11482 12131 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, 11483 12132 pin_type); 11484 12133 snd_hda_codec_write(codec, dac_idx, 0, AC_VERB_SET_AMP_GAIN_MUTE, 11485 12134 AMP_OUT_UNMUTE); 11486 11487 12135 } 11488 12136 … … 11511 12159 alc861_auto_set_output_and_unmute(codec, pin, PIN_HP, 11512 12160 spec->multiout.dac_nids[0]); 12161 pin = spec->autocfg.speaker_pins[0]; 12162 if (pin) 12163 alc861_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); 11513 12164 } 11514 12165 … … 11583 12234 static void alc861_auto_init(struct hda_codec *codec) 11584 12235 { 12236 struct alc_spec *spec = codec->spec; 11585 12237 alc861_auto_init_multi_out(codec); 11586 12238 alc861_auto_init_hp_out(codec); 11587 12239 alc861_auto_init_analog_input(codec); 12240 if (spec->unsol_event) 12241 alc_sku_automute(codec); 11588 12242 } 11589 12243 … … 11837 12491 }; 11838 12492 12493 static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 }; 12494 11839 12495 /* input MUX */ 11840 12496 /* FIXME: should be a matrix-type input source selection */ … … 11850 12506 11851 12507 static struct hda_input_mux alc861vd_dallas_capture_source = { 11852 .num_items = 3,12508 .num_items = 2, 11853 12509 .items = { 11854 { "Front Mic", 0x0 }, 11855 { "ATAPI Mic", 0x1 }, 11856 { "Line In", 0x5 }, 12510 { "Ext Mic", 0x0 }, 12511 { "Int Mic", 0x1 }, 11857 12512 }, 11858 12513 }; … … 11868 12523 #define alc861vd_mux_enum_info alc_mux_enum_info 11869 12524 #define alc861vd_mux_enum_get alc_mux_enum_get 11870 11871 static int alc861vd_mux_enum_put(struct snd_kcontrol *kcontrol, 11872 struct snd_ctl_elem_value *ucontrol) 11873 { 11874 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); 11875 struct alc_spec *spec = codec->spec; 11876 const struct hda_input_mux *imux = spec->input_mux; 11877 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); 11878 static hda_nid_t capture_mixers[1] = { 0x22 }; 11879 hda_nid_t nid = capture_mixers[adc_idx]; 11880 unsigned int *cur_val = &spec->cur_mux[adc_idx]; 11881 unsigned int i, idx; 11882 11883 idx = ucontrol->value.enumerated.item[0]; 11884 if (idx >= imux->num_items) 11885 idx = imux->num_items - 1; 11886 if (*cur_val == idx) 11887 return 0; 11888 for (i = 0; i < imux->num_items; i++) { 11889 unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE; 11890 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 11891 imux->items[i].index, 11892 HDA_AMP_MUTE, v); 11893 } 11894 *cur_val = idx; 11895 return 1; 11896 } 12525 /* ALC861VD has the ALC882-type input selection (but has only one ADC) */ 12526 #define alc861vd_mux_enum_put alc882_mux_enum_put 11897 12527 11898 12528 /* … … 12049 12679 }; 12050 12680 12051 /* Pin assignment: Front=0x14, HP = 0x15,12052 * Front Mic=0x18, ATAPI Mic = 0x19, Line In= 0x1d12681 /* Pin assignment: Speaker=0x14, HP = 0x15, 12682 * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d 12053 12683 */ 12054 12684 static struct snd_kcontrol_new alc861vd_dallas_mixer[] = { 12055 HDA_CODEC_VOLUME(" FrontPlayback Volume", 0x02, 0x0, HDA_OUTPUT),12056 HDA_BIND_MUTE(" FrontPlayback Switch", 0x0c, 2, HDA_INPUT),12685 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), 12686 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), 12057 12687 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), 12058 12688 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), 12059 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), 12060 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), 12061 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), 12062 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), 12063 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x05, HDA_INPUT), 12064 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x05, HDA_INPUT), 12689 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), 12690 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), 12691 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), 12692 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), 12693 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), 12694 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), 12695 HDA_CODEC_VOLUME("PC Beep Volume", 0x0b, 0x05, HDA_INPUT), 12696 HDA_CODEC_MUTE("PC Beep Switch", 0x0b, 0x05, HDA_INPUT), 12065 12697 {0} /* end */ 12066 12698 }; … … 12209 12841 static struct hda_verb alc861vd_eapd_verbs[] = { 12210 12842 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, 12843 {0} 12844 }; 12845 12846 static struct hda_verb alc660vd_eapd_verbs[] = { 12847 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, 12848 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, 12211 12849 {0} 12212 12850 }; … … 12363 13001 SND_PCI_QUIRK(0x1179, 0xff01, "DALLAS", ALC861VD_DALLAS), 12364 13002 SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO), 13003 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS), 12365 13004 SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG), 12366 13005 SND_PCI_QUIRK(0x17aa, 0x2066, "Lenovo", ALC861VD_LENOVO), 12367 13006 SND_PCI_QUIRK(0x17aa, 0x3802, "Lenovo 3000 C200", ALC861VD_LENOVO), 13007 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 N200", ALC861VD_LENOVO), 12368 13008 SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG), 12369 13009 {0} … … 12377 13017 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), 12378 13018 .dac_nids = alc660vd_dac_nids, 12379 .num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids),12380 .adc_nids = alc861vd_adc_nids,12381 13019 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), 12382 13020 .channel_mode = alc861vd_3stack_2ch_modes, … … 12390 13028 .dac_nids = alc660vd_dac_nids, 12391 13029 .dig_out_nid = ALC861VD_DIGOUT_NID, 12392 .num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids),12393 .adc_nids = alc861vd_adc_nids,12394 13030 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), 12395 13031 .channel_mode = alc861vd_3stack_2ch_modes, … … 12436 13072 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), 12437 13073 .dac_nids = alc660vd_dac_nids, 12438 .num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids),12439 .adc_nids = alc861vd_adc_nids,12440 13074 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), 12441 13075 .channel_mode = alc861vd_3stack_2ch_modes, … … 12449 13083 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), 12450 13084 .dac_nids = alc861vd_dac_nids, 12451 .num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids),12452 .adc_nids = alc861vd_adc_nids,12453 13085 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), 12454 13086 .channel_mode = alc861vd_3stack_2ch_modes, … … 12462 13094 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), 12463 13095 .dac_nids = alc861vd_dac_nids, 12464 .num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids),12465 13096 .dig_out_nid = ALC861VD_DIGOUT_NID, 12466 .adc_nids = alc861vd_adc_nids,12467 13097 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), 12468 13098 .channel_mode = alc861vd_3stack_2ch_modes, … … 12479 13109 hda_nid_t nid, int pin_type, int dac_idx) 12480 13110 { 12481 /* set as output */ 12482 snd_hda_codec_write(codec, nid, 0, 12483 AC_VERB_SET_PIN_WIDGET_CONTROL, pin_type); 12484 snd_hda_codec_write(codec, nid, 0, 12485 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE); 13111 alc_set_pin_output(codec, nid, pin_type); 12486 13112 } 12487 13113 … … 12510 13136 if (pin) /* connect to front and use dac 0 */ 12511 13137 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); 13138 pin = spec->autocfg.speaker_pins[0]; 13139 if (pin) 13140 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); 12512 13141 } 12513 13142 … … 12713 13342 static void alc861vd_auto_init(struct hda_codec *codec) 12714 13343 { 13344 struct alc_spec *spec = codec->spec; 12715 13345 alc861vd_auto_init_multi_out(codec); 12716 13346 alc861vd_auto_init_hp_out(codec); 12717 13347 alc861vd_auto_init_analog_input(codec); 13348 if (spec->unsol_event) 13349 alc_sku_automute(codec); 12718 13350 } 12719 13351 … … 12756 13388 setup_preset(spec, &alc861vd_presets[board_config]); 12757 13389 12758 spec->stream_name_analog = "ALC861VD Analog"; 13390 if (codec->vendor_id == 0x10ec0660) { 13391 spec->stream_name_analog = "ALC660-VD Analog"; 13392 spec->stream_name_digital = "ALC660-VD Digital"; 13393 /* always turn on EAPD */ 13394 spec->init_verbs[spec->num_init_verbs++] = alc660vd_eapd_verbs; 13395 } else { 13396 spec->stream_name_analog = "ALC861VD Analog"; 13397 spec->stream_name_digital = "ALC861VD Digital"; 13398 } 13399 12759 13400 spec->stream_analog_playback = &alc861vd_pcm_analog_playback; 12760 13401 spec->stream_analog_capture = &alc861vd_pcm_analog_capture; 12761 13402 12762 spec->stream_name_digital = "ALC861VD Digital";12763 13403 spec->stream_digital_playback = &alc861vd_pcm_digital_playback; 12764 13404 spec->stream_digital_capture = &alc861vd_pcm_digital_capture; … … 12766 13406 spec->adc_nids = alc861vd_adc_nids; 12767 13407 spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids); 13408 spec->capsrc_nids = alc861vd_capsrc_nids; 12768 13409 12769 13410 spec->mixers[spec->num_mixers] = alc861vd_capture_mixer; … … 12807 13448 0x09, 12808 13449 }; 13450 13451 static hda_nid_t alc662_capsrc_nids[1] = { 0x22 }; 13452 12809 13453 /* input MUX */ 12810 13454 /* FIXME: should be a matrix-type input source selection */ 12811 12812 13455 static struct hda_input_mux alc662_capture_source = { 12813 13456 .num_items = 4, … … 12836 13479 }; 12837 13480 13481 static struct hda_input_mux alc663_capture_source = { 13482 .num_items = 3, 13483 .items = { 13484 { "Mic", 0x0 }, 13485 { "Front Mic", 0x1 }, 13486 { "Line", 0x2 }, 13487 }, 13488 }; 13489 13490 static struct hda_input_mux alc663_m51va_capture_source = { 13491 .num_items = 2, 13492 .items = { 13493 { "Ext-Mic", 0x0 }, 13494 { "D-Mic", 0x9 }, 13495 }, 13496 }; 13497 12838 13498 #define alc662_mux_enum_info alc_mux_enum_info 12839 13499 #define alc662_mux_enum_get alc_mux_enum_get 12840 12841 static int alc662_mux_enum_put(struct snd_kcontrol *kcontrol, 12842 struct snd_ctl_elem_value *ucontrol) 12843 { 12844 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); 12845 struct alc_spec *spec = codec->spec; 12846 const struct hda_input_mux *imux = spec->input_mux; 12847 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); 12848 static hda_nid_t capture_mixers[2] = { 0x23, 0x22 }; 12849 hda_nid_t nid = capture_mixers[adc_idx]; 12850 unsigned int *cur_val = &spec->cur_mux[adc_idx]; 12851 unsigned int i, idx; 12852 12853 idx = ucontrol->value.enumerated.item[0]; 12854 if (idx >= imux->num_items) 12855 idx = imux->num_items - 1; 12856 if (*cur_val == idx) 12857 return 0; 12858 for (i = 0; i < imux->num_items; i++) { 12859 unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE; 12860 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 12861 imux->items[i].index, 12862 HDA_AMP_MUTE, v); 12863 } 12864 *cur_val = idx; 12865 return 1; 12866 } 13500 #define alc662_mux_enum_put alc882_mux_enum_put 13501 12867 13502 /* 12868 13503 * 2ch mode … … 12933 13568 /* output mixer control */ 12934 13569 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), 12935 HDA_CODEC_MUTE("Front Playback Switch", 0x0 2, 0x0, HDA_OUTPUT),13570 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), 12936 13571 HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT), 12937 HDA_CODEC_MUTE("Surround Playback Switch", 0x0 3, 0x0, HDA_OUTPUT),13572 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT), 12938 13573 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), 12939 13574 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT), 12940 HDA_ BIND_MUTE_MONO("Center Playback Switch", 0x04, 1, 2, HDA_INPUT),12941 HDA_ BIND_MUTE_MONO("LFE Playback Switch", 0x04, 2, 2, HDA_INPUT),13575 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT), 13576 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT), 12942 13577 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), 12943 13578 … … 12956 13591 static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = { 12957 13592 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), 12958 HDA_ BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT),13593 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), 12959 13594 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), 12960 13595 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), … … 12973 13608 static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = { 12974 13609 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), 12975 HDA_ BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT),13610 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), 12976 13611 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), 12977 HDA_ BIND_MUTE("Surround Playback Switch", 0x03, 2, HDA_INPUT),13612 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT), 12978 13613 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), 12979 13614 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT), 12980 HDA_ BIND_MUTE_MONO("Center Playback Switch", 0x04, 1, 2, HDA_INPUT),12981 HDA_ BIND_MUTE_MONO("LFE Playback Switch", 0x04, 2, 2, HDA_INPUT),13615 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT), 13616 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT), 12982 13617 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), 12983 13618 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), … … 13010 13645 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), 13011 13646 13012 HDA_CODEC_VOLUME("Line Out Playback Volume", 0x02, 0x0, HDA_OUTPUT),13013 HDA_CODEC_MUTE("Line Out Playback Switch", 0x1b, 0x0, HDA_OUTPUT),13647 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x02, 0x0, HDA_OUTPUT), 13648 HDA_CODEC_MUTE("Line-Out Playback Switch", 0x1b, 0x0, HDA_OUTPUT), 13014 13649 13015 13650 HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT), … … 13024 13659 13025 13660 static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = { 13026 HDA_CODEC_VOLUME("Line Out Playback Volume", 0x02, 0x0, HDA_OUTPUT),13027 HDA_CODEC_MUTE("Line Out Playback Switch", 0x14, 0x0, HDA_OUTPUT),13661 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x02, 0x0, HDA_OUTPUT), 13662 HDA_CODEC_MUTE("Line-Out Playback Switch", 0x14, 0x0, HDA_OUTPUT), 13028 13663 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), 13029 13664 HDA_BIND_MUTE("Surround Playback Switch", 0x03, 2, HDA_INPUT), … … 13038 13673 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), 13039 13674 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), 13675 {0} /* end */ 13676 }; 13677 13678 static struct snd_kcontrol_new alc663_m51va_mixer[] = { 13679 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), 13680 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), 13681 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), 13682 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), 13683 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), 13684 HDA_CODEC_MUTE("DMic Playback Switch", 0x23, 0x9, HDA_INPUT), 13685 {0} /* end */ 13686 }; 13687 13688 static struct snd_kcontrol_new alc663_g71v_mixer[] = { 13689 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), 13690 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), 13691 HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT), 13692 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), 13693 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), 13694 13695 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), 13696 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), 13697 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), 13698 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), 13699 {0} /* end */ 13700 }; 13701 13702 static struct snd_kcontrol_new alc663_g50v_mixer[] = { 13703 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), 13704 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), 13705 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), 13706 13707 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), 13708 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), 13709 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), 13710 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), 13711 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), 13712 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), 13040 13713 {0} /* end */ 13041 13714 }; … … 13111 13784 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, 13112 13785 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, 13786 13787 /* always trun on EAPD */ 13788 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, 13789 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, 13790 13113 13791 {0} 13114 13792 }; … … 13178 13856 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 13179 13857 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 13858 {0} 13859 }; 13860 13861 static struct hda_verb alc663_m51va_init_verbs[] = { 13862 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, 13863 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 13864 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ 13865 13866 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, 13867 13868 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, 13869 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, 13870 {0} 13871 }; 13872 13873 static struct hda_verb alc663_g71v_init_verbs[] = { 13874 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, 13875 /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */ 13876 /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */ 13877 13878 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, 13879 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 13880 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ 13881 13882 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, 13883 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT}, 13884 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, 13885 {0} 13886 }; 13887 13888 static struct hda_verb alc663_g50v_init_verbs[] = { 13889 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, 13890 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 13891 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ 13892 13893 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, 13894 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, 13180 13895 {0} 13181 13896 }; … … 13302 14017 } 13303 14018 14019 static void alc663_m51va_speaker_automute(struct hda_codec *codec) 14020 { 14021 unsigned int present; 14022 unsigned char bits; 14023 14024 present = snd_hda_codec_read(codec, 0x21, 0, 14025 AC_VERB_GET_PIN_SENSE, 0) 14026 & AC_PINSENSE_PRESENCE; 14027 bits = present ? HDA_AMP_MUTE : 0; 14028 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, 14029 HDA_AMP_MUTE, bits); 14030 } 14031 14032 static void alc663_m51va_mic_automute(struct hda_codec *codec) 14033 { 14034 unsigned int present; 14035 14036 present = snd_hda_codec_read(codec, 0x18, 0, 14037 AC_VERB_GET_PIN_SENSE, 0) 14038 & AC_PINSENSE_PRESENCE; 14039 snd_hda_codec_write_cache(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE, 14040 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); 14041 snd_hda_codec_write_cache(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, 14042 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); 14043 snd_hda_codec_write_cache(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE, 14044 0x7000 | (0x09 << 8) | (present ? 0x80 : 0)); 14045 snd_hda_codec_write_cache(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, 14046 0x7000 | (0x09 << 8) | (present ? 0x80 : 0)); 14047 } 14048 14049 static void alc663_m51va_unsol_event(struct hda_codec *codec, 14050 unsigned int res) 14051 { 14052 switch (res >> 26) { 14053 case ALC880_HP_EVENT: 14054 alc663_m51va_speaker_automute(codec); 14055 break; 14056 case ALC880_MIC_EVENT: 14057 alc663_m51va_mic_automute(codec); 14058 break; 14059 } 14060 } 14061 14062 static void alc663_m51va_inithook(struct hda_codec *codec) 14063 { 14064 alc663_m51va_speaker_automute(codec); 14065 alc663_m51va_mic_automute(codec); 14066 } 14067 14068 static void alc663_g71v_hp_automute(struct hda_codec *codec) 14069 { 14070 unsigned int present; 14071 unsigned char bits; 14072 14073 present = snd_hda_codec_read(codec, 0x21, 0, 14074 AC_VERB_GET_PIN_SENSE, 0) 14075 & AC_PINSENSE_PRESENCE; 14076 bits = present ? HDA_AMP_MUTE : 0; 14077 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, 14078 HDA_AMP_MUTE, bits); 14079 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, 14080 HDA_AMP_MUTE, bits); 14081 } 14082 14083 static void alc663_g71v_front_automute(struct hda_codec *codec) 14084 { 14085 unsigned int present; 14086 unsigned char bits; 14087 14088 present = snd_hda_codec_read(codec, 0x15, 0, 14089 AC_VERB_GET_PIN_SENSE, 0) 14090 & AC_PINSENSE_PRESENCE; 14091 bits = present ? HDA_AMP_MUTE : 0; 14092 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, 14093 HDA_AMP_MUTE, bits); 14094 } 14095 14096 static void alc663_g71v_unsol_event(struct hda_codec *codec, 14097 unsigned int res) 14098 { 14099 switch (res >> 26) { 14100 case ALC880_HP_EVENT: 14101 alc663_g71v_hp_automute(codec); 14102 break; 14103 case ALC880_FRONT_EVENT: 14104 alc663_g71v_front_automute(codec); 14105 break; 14106 case ALC880_MIC_EVENT: 14107 alc662_eeepc_mic_automute(codec); 14108 break; 14109 } 14110 } 14111 14112 static void alc663_g71v_inithook(struct hda_codec *codec) 14113 { 14114 alc663_g71v_front_automute(codec); 14115 alc663_g71v_hp_automute(codec); 14116 alc662_eeepc_mic_automute(codec); 14117 } 14118 14119 static void alc663_g50v_unsol_event(struct hda_codec *codec, 14120 unsigned int res) 14121 { 14122 switch (res >> 26) { 14123 case ALC880_HP_EVENT: 14124 alc663_m51va_speaker_automute(codec); 14125 break; 14126 case ALC880_MIC_EVENT: 14127 alc662_eeepc_mic_automute(codec); 14128 break; 14129 } 14130 } 14131 14132 static void alc663_g50v_inithook(struct hda_codec *codec) 14133 { 14134 alc663_m51va_speaker_automute(codec); 14135 alc662_eeepc_mic_automute(codec); 14136 } 14137 13304 14138 #ifdef CONFIG_SND_HDA_POWER_SAVE 13305 14139 #define alc662_loopbacks alc880_loopbacks … … 13324 14158 [ALC662_ASUS_EEEPC_P701] = "eeepc-p701", 13325 14159 [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20", 14160 [ALC663_ASUS_M51VA] = "m51va", 14161 [ALC663_ASUS_G71V] = "g71v", 14162 [ALC663_ASUS_H13] = "h13", 14163 [ALC663_ASUS_G50V] = "g50v", 13326 14164 [ALC662_AUTO] = "auto", 13327 14165 }; 13328 14166 13329 14167 static struct snd_pci_quirk alc662_cfg_tbl[] = { 14168 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS G71V", ALC663_ASUS_G71V), 14169 SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA), 14170 SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS M51VA", ALC663_ASUS_G50V), 14171 SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG), 13330 14172 SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701), 13331 14173 SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20), 13332 14174 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E), 14175 SND_PCI_QUIRK(0x1854, 0x2000, "ASUS H13-2000", ALC663_ASUS_H13), 14176 SND_PCI_QUIRK(0x1854, 0x2001, "ASUS H13-2001", ALC663_ASUS_H13), 14177 SND_PCI_QUIRK(0x1854, 0x2002, "ASUS H13-2002", ALC663_ASUS_H13), 13333 14178 {0} 13334 14179 }; … … 13341 14186 .dac_nids = alc662_dac_nids, 13342 14187 .dig_out_nid = ALC662_DIGOUT_NID, 13343 .num_adc_nids = ARRAY_SIZE(alc662_adc_nids),13344 .adc_nids = alc662_adc_nids,13345 14188 .dig_in_nid = ALC662_DIGIN_NID, 13346 14189 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), … … 13355 14198 .dac_nids = alc662_dac_nids, 13356 14199 .dig_out_nid = ALC662_DIGOUT_NID, 13357 .num_adc_nids = ARRAY_SIZE(alc662_adc_nids),13358 .adc_nids = alc662_adc_nids,13359 14200 .dig_in_nid = ALC662_DIGIN_NID, 13360 14201 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), … … 13369 14210 .num_dacs = ARRAY_SIZE(alc662_dac_nids), 13370 14211 .dac_nids = alc662_dac_nids, 13371 .num_adc_nids = ARRAY_SIZE(alc662_adc_nids),13372 .adc_nids = alc662_adc_nids,13373 14212 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), 13374 14213 .channel_mode = alc662_3ST_6ch_modes, … … 13383 14222 .dac_nids = alc662_dac_nids, 13384 14223 .dig_out_nid = ALC662_DIGOUT_NID, 13385 .num_adc_nids = ARRAY_SIZE(alc662_adc_nids),13386 .adc_nids = alc662_adc_nids,13387 14224 .dig_in_nid = ALC662_DIGIN_NID, 13388 14225 .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes), … … 13395 14232 .num_dacs = ARRAY_SIZE(alc662_dac_nids), 13396 14233 .dac_nids = alc662_dac_nids, 13397 .num_adc_nids = ARRAY_SIZE(alc662_adc_nids),13398 .adc_nids = alc662_adc_nids,13399 14234 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), 13400 14235 .channel_mode = alc662_3ST_2ch_modes, … … 13409 14244 .num_dacs = ARRAY_SIZE(alc662_dac_nids), 13410 14245 .dac_nids = alc662_dac_nids, 13411 .num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids),13412 .adc_nids = alc662_adc_nids,13413 14246 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), 13414 14247 .channel_mode = alc662_3ST_2ch_modes, … … 13424 14257 .num_dacs = ARRAY_SIZE(alc662_dac_nids), 13425 14258 .dac_nids = alc662_dac_nids, 13426 .num_adc_nids = ARRAY_SIZE(alc662_adc_nids),13427 .adc_nids = alc662_adc_nids,13428 14259 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), 13429 14260 .channel_mode = alc662_3ST_6ch_modes, … … 13432 14263 .init_hook = alc662_eeepc_ep20_inithook, 13433 14264 }, 13434 14265 [ALC663_ASUS_M51VA] = { 14266 .mixers = { alc663_m51va_mixer, alc662_capture_mixer}, 14267 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs }, 14268 .num_dacs = ARRAY_SIZE(alc662_dac_nids), 14269 .dac_nids = alc662_dac_nids, 14270 .dig_out_nid = ALC662_DIGOUT_NID, 14271 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), 14272 .channel_mode = alc662_3ST_2ch_modes, 14273 .input_mux = &alc663_m51va_capture_source, 14274 .unsol_event = alc663_m51va_unsol_event, 14275 .init_hook = alc663_m51va_inithook, 14276 }, 14277 [ALC663_ASUS_G71V] = { 14278 .mixers = { alc663_g71v_mixer, alc662_capture_mixer}, 14279 .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs }, 14280 .num_dacs = ARRAY_SIZE(alc662_dac_nids), 14281 .dac_nids = alc662_dac_nids, 14282 .dig_out_nid = ALC662_DIGOUT_NID, 14283 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), 14284 .channel_mode = alc662_3ST_2ch_modes, 14285 .input_mux = &alc662_eeepc_capture_source, 14286 .unsol_event = alc663_g71v_unsol_event, 14287 .init_hook = alc663_g71v_inithook, 14288 }, 14289 [ALC663_ASUS_H13] = { 14290 .mixers = { alc663_m51va_mixer, alc662_capture_mixer}, 14291 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs }, 14292 .num_dacs = ARRAY_SIZE(alc662_dac_nids), 14293 .dac_nids = alc662_dac_nids, 14294 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), 14295 .channel_mode = alc662_3ST_2ch_modes, 14296 .input_mux = &alc663_m51va_capture_source, 14297 .unsol_event = alc663_m51va_unsol_event, 14298 .init_hook = alc663_m51va_inithook, 14299 }, 14300 [ALC663_ASUS_G50V] = { 14301 .mixers = { alc663_g50v_mixer, alc662_capture_mixer}, 14302 .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs }, 14303 .num_dacs = ARRAY_SIZE(alc662_dac_nids), 14304 .dac_nids = alc662_dac_nids, 14305 .dig_out_nid = ALC662_DIGOUT_NID, 14306 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), 14307 .channel_mode = alc662_3ST_6ch_modes, 14308 .input_mux = &alc663_capture_source, 14309 .unsol_event = alc663_g50v_unsol_event, 14310 .init_hook = alc663_g50v_inithook, 14311 }, 13435 14312 }; 13436 14313 … … 13571 14448 int dac_idx) 13572 14449 { 13573 /* set as output */ 13574 snd_hda_codec_write(codec, nid, 0, 13575 AC_VERB_SET_PIN_WIDGET_CONTROL, pin_type); 13576 snd_hda_codec_write(codec, nid, 0, 13577 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE); 14450 alc_set_pin_output(codec, nid, pin_type); 13578 14451 /* need the manual connection? */ 13579 14452 if (alc880_is_multi_pin(nid)) { … … 13610 14483 /* use dac 0 */ 13611 14484 alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); 14485 pin = spec->autocfg.speaker_pins[0]; 14486 if (pin) 14487 alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); 13612 14488 } 13613 14489 … … 13687 14563 static void alc662_auto_init(struct hda_codec *codec) 13688 14564 { 14565 struct alc_spec *spec = codec->spec; 13689 14566 alc662_auto_init_multi_out(codec); 13690 14567 alc662_auto_init_hp_out(codec); 13691 14568 alc662_auto_init_analog_input(codec); 14569 if (spec->unsol_event) 14570 alc_sku_automute(codec); 13692 14571 } 13693 14572 … … 13702 14581 13703 14582 codec->spec = spec; 14583 14584 alc_fix_pll_init(codec, 0x20, 0x04, 15); 13704 14585 13705 14586 board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST, … … 13729 14610 setup_preset(spec, &alc662_presets[board_config]); 13730 14611 13731 spec->stream_name_analog = "ALC662 Analog"; 14612 if (codec->vendor_id == 0x10ec0663) { 14613 spec->stream_name_analog = "ALC663 Analog"; 14614 spec->stream_name_digital = "ALC663 Digital"; 14615 } else { 14616 spec->stream_name_analog = "ALC662 Analog"; 14617 spec->stream_name_digital = "ALC662 Digital"; 14618 } 14619 13732 14620 spec->stream_analog_playback = &alc662_pcm_analog_playback; 13733 14621 spec->stream_analog_capture = &alc662_pcm_analog_capture; 13734 14622 13735 spec->stream_name_digital = "ALC662 Digital";13736 14623 spec->stream_digital_playback = &alc662_pcm_digital_playback; 13737 14624 spec->stream_digital_capture = &alc662_pcm_digital_capture; 13738 14625 13739 if (!spec->adc_nids && spec->input_mux) { 13740 spec->adc_nids = alc662_adc_nids; 13741 spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids); 13742 } 14626 spec->adc_nids = alc662_adc_nids; 14627 spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids); 14628 spec->capsrc_nids = alc662_capsrc_nids; 13743 14629 13744 14630 spec->vmaster_nid = 0x02; … … 13773 14659 { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1", 13774 14660 .patch = patch_alc662 }, 14661 { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 }, 13775 14662 { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 }, 13776 14663 { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 }, 13777 14664 { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc883 }, 14665 { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A", 14666 .patch = patch_alc882 }, /* should be patch_alc883() in future */ 13778 14667 { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 }, 13779 14668 { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc883 }, -
GPL/branches/uniaud32-2.0/alsa-kernel/pci/hda/patch_si3054.c
r305 r358 29 29 #include "hda_codec.h" 30 30 #include "hda_local.h" 31 31 #include "hda_patch.h" 32 32 33 33 /* si3054 verbs */ … … 207 207 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = si3054_pcm; 208 208 info->stream[SNDRV_PCM_STREAM_CAPTURE] = si3054_pcm; 209 info-> is_modem = 1;209 info->pcm_type = HDA_PCM_TYPE_MODEM; 210 210 return 0; 211 211 } -
GPL/branches/uniaud32-2.0/alsa-kernel/pci/hda/patch_sigmatel.c
r305 r358 33 33 #include "hda_codec.h" 34 34 #include "hda_local.h" 35 #include "hda_patch.h" 35 36 36 37 #define NUM_CONTROL_ALLOC 32 … … 52 53 STAC_9200_DELL_M27, 53 54 STAC_9200_GATEWAY, 55 STAC_9200_PANASONIC, 54 56 STAC_9200_MODELS 55 57 }; … … 65 67 enum { 66 68 STAC_92HD73XX_REF, 69 STAC_DELL_M6, 67 70 STAC_92HD73XX_MODELS 68 71 }; … … 70 73 enum { 71 74 STAC_92HD71BXX_REF, 75 STAC_DELL_M4_1, 76 STAC_DELL_M4_2, 72 77 STAC_92HD71BXX_MODELS 73 78 }; … … 125 130 126 131 /* gpio lines */ 132 unsigned int eapd_mask; 127 133 unsigned int gpio_mask; 128 134 unsigned int gpio_dir; … … 137 143 unsigned int num_pwrs; 138 144 hda_nid_t *pwr_nids; 145 hda_nid_t *dac_list; 139 146 140 147 /* playback */ … … 175 182 unsigned int io_switch[2]; 176 183 unsigned int clfe_swap; 184 unsigned int hp_switch; 177 185 unsigned int aloopback; 178 186 … … 186 194 struct hda_input_mux private_imux; 187 195 struct hda_input_mux private_mono_mux; 188 189 /* virtual master */190 unsigned int vmaster_tlv[4];191 196 }; 192 197 … … 246 251 }; 247 252 248 static hda_nid_t stac92hd71bxx_dac_nids[ 2] = {253 static hda_nid_t stac92hd71bxx_dac_nids[1] = { 249 254 0x10, /*0x11, */ 250 255 }; … … 292 297 }; 293 298 299 static hda_nid_t stac927x_dac_nids[6] = { 300 0x02, 0x03, 0x04, 0x05, 0x06, 0 301 }; 302 294 303 static hda_nid_t stac927x_dmux_nids[1] = { 295 304 0x1b, … … 333 342 }; 334 343 335 static hda_nid_t stac92hd73xx_pin_nids[1 2] = {344 static hda_nid_t stac92hd73xx_pin_nids[13] = { 336 345 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 337 346 0x0f, 0x10, 0x11, 0x12, 0x13, 338 0x14, 0x 22347 0x14, 0x1e, 0x22 339 348 }; 340 349 … … 521 530 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, 522 531 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, 532 /* setup import muxs */ 533 { 0x28, AC_VERB_SET_CONNECT_SEL, 0x01}, 534 { 0x29, AC_VERB_SET_CONNECT_SEL, 0x01}, 535 { 0x2a, AC_VERB_SET_CONNECT_SEL, 0x01}, 536 { 0x2b, AC_VERB_SET_CONNECT_SEL, 0x00}, 537 {0} 538 }; 539 540 static struct hda_verb dell_eq_core_init[] = { 541 /* set master volume to max value without distortion 542 * and direct control */ 543 { 0x1f, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xec}, 544 /* setup audio connections */ 545 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00}, 546 { 0x0a, AC_VERB_SET_CONNECT_SEL, 0x01}, 547 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x02}, 548 /* setup adcs to point to mixer */ 549 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x0b}, 550 { 0x21, AC_VERB_SET_CONNECT_SEL, 0x0b}, 551 /* setup import muxs */ 552 { 0x28, AC_VERB_SET_CONNECT_SEL, 0x01}, 553 { 0x29, AC_VERB_SET_CONNECT_SEL, 0x01}, 554 { 0x2a, AC_VERB_SET_CONNECT_SEL, 0x01}, 555 { 0x2b, AC_VERB_SET_CONNECT_SEL, 0x00}, 556 {0} 557 }; 558 559 static struct hda_verb dell_m6_core_init[] = { 560 /* set master volume and direct control */ 561 { 0x1f, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff}, 562 /* setup audio connections */ 563 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00}, 564 { 0x0a, AC_VERB_SET_CONNECT_SEL, 0x01}, 565 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x02}, 566 /* setup adcs to point to mixer */ 567 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x0b}, 568 { 0x21, AC_VERB_SET_CONNECT_SEL, 0x0b}, 523 569 /* setup import muxs */ 524 570 { 0x28, AC_VERB_SET_CONNECT_SEL, 0x01}, … … 591 637 }; 592 638 639 #define HD_DISABLE_PORTF 3 593 640 static struct hda_verb stac92hd71bxx_analog_core_init[] = { 641 /* start of config #1 */ 642 643 /* connect port 0f to audio mixer */ 644 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x2}, 645 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Speaker */ 646 /* unmute right and left channels for node 0x0f */ 647 { 0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 648 /* start of config #2 */ 649 594 650 /* set master volume and direct control */ 595 651 { 0x28, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff}, 596 652 /* connect headphone jack to dac1 */ 597 653 { 0x0a, AC_VERB_SET_CONNECT_SEL, 0x01}, 598 /* connect port s 0d and 0fto audio mixer */654 /* connect port 0d to audio mixer */ 599 655 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x2}, 600 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x2},601 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Speaker */602 656 /* unmute dac0 input in audio mixer */ 603 657 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f}, 604 /* unmute right and left channels for nodes 0x0a, 0xd , 0x0f*/658 /* unmute right and left channels for nodes 0x0a, 0xd */ 605 659 { 0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 606 660 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 607 { 0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},608 661 {0} 609 662 }; … … 773 826 HDA_CODEC_VOLUME_IDX("Capture Mux Volume", 0x1, 0x1b, 0x0, HDA_OUTPUT), 774 827 828 HDA_CODEC_VOLUME("PC Beep Volume", 0x17, 0x2, HDA_INPUT), 829 HDA_CODEC_MUTE("PC Beep Switch", 0x17, 0x2, HDA_INPUT), 830 775 831 HDA_CODEC_MUTE("Analog Loopback 1", 0x17, 0x3, HDA_INPUT), 776 832 HDA_CODEC_MUTE("Analog Loopback 2", 0x17, 0x4, HDA_INPUT), … … 795 851 STAC_INPUT_SOURCE(1), 796 852 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0, HDA_OUTPUT), 797 HDA_CODEC_MUTE("Capture Switch", 0x 09, 0, HDA_OUTPUT),853 HDA_CODEC_MUTE("Capture Switch", 0x14, 0, HDA_OUTPUT), 798 854 HDA_CODEC_VOLUME("Capture Mux Volume", 0x0f, 0, HDA_OUTPUT), 799 855 {0} /* end */ … … 912 968 if (err < 0) 913 969 return err; 970 err = snd_hda_create_spdif_share_sw(codec, 971 &spec->multiout); 972 if (err < 0) 973 return err; 974 spec->multiout.share_spdif = 1; 914 975 } 915 976 if (spec->dig_in_nid) { … … 921 982 /* if we have no master control, let's create it */ 922 983 if (!snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) { 984 unsigned int vmaster_tlv[4]; 923 985 snd_hda_set_vmaster_tlv(codec, spec->multiout.dac_nids[0], 924 HDA_OUTPUT, spec->vmaster_tlv);986 HDA_OUTPUT, vmaster_tlv); 925 987 err = snd_hda_add_vmaster(codec, "Master Playback Volume", 926 spec->vmaster_tlv, slave_vols);988 vmaster_tlv, slave_vols); 927 989 if (err < 0) 928 990 return err; … … 1073 1135 [STAC_9200_DELL_M26] = dell9200_m26_pin_configs, 1074 1136 [STAC_9200_DELL_M27] = dell9200_m27_pin_configs, 1137 [STAC_9200_PANASONIC] = ref9200_pin_configs, 1075 1138 }; 1076 1139 … … 1089 1152 [STAC_9200_DELL_M27] = "dell-m27", 1090 1153 [STAC_9200_GATEWAY] = "gateway", 1154 [STAC_9200_PANASONIC] = "panasonic", 1091 1155 }; 1092 1156 … … 1155 1219 "unknown Dell", STAC_9200_DELL_M26), 1156 1220 /* Panasonic */ 1157 SND_PCI_QUIRK(0x10f7, 0x8338, "Panasonic CF-74", STAC_ REF),1221 SND_PCI_QUIRK(0x10f7, 0x8338, "Panasonic CF-74", STAC_9200_PANASONIC), 1158 1222 /* Gateway machines needs EAPD to be set on resume */ 1159 1223 SND_PCI_QUIRK(0x107b, 0x0205, "Gateway S-7110M", STAC_9200_GATEWAY), … … 1213 1277 }; 1214 1278 1215 static unsigned int ref92hd73xx_pin_configs[1 2] = {1279 static unsigned int ref92hd73xx_pin_configs[13] = { 1216 1280 0x02214030, 0x02a19040, 0x01a19020, 0x02214030, 1217 1281 0x0181302e, 0x01014010, 0x01014020, 0x01014030, 1218 1282 0x02319040, 0x90a000f0, 0x90a000f0, 0x01452050, 1283 0x01452050, 1284 }; 1285 1286 static unsigned int dell_m6_pin_configs[13] = { 1287 0x0321101f, 0x4f00000f, 0x4f0000f0, 0x90170110, 1288 0x03a11020, 0x0321101f, 0x4f0000f0, 0x4f0000f0, 1289 0x4f0000f0, 0x90a60160, 0x4f0000f0, 0x4f0000f0, 1290 0x4f0000f0, 1219 1291 }; 1220 1292 1221 1293 static unsigned int *stac92hd73xx_brd_tbl[STAC_92HD73XX_MODELS] = { 1222 [STAC_92HD73XX_REF] = ref92hd73xx_pin_configs, 1294 [STAC_92HD73XX_REF] = ref92hd73xx_pin_configs, 1295 [STAC_DELL_M6] = dell_m6_pin_configs, 1223 1296 }; 1224 1297 1225 1298 static const char *stac92hd73xx_models[STAC_92HD73XX_MODELS] = { 1226 1299 [STAC_92HD73XX_REF] = "ref", 1300 [STAC_DELL_M6] = "dell-m6", 1227 1301 }; 1228 1302 … … 1230 1304 /* SigmaTel reference board */ 1231 1305 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, 1232 "DFI LanParty", STAC_92HD73XX_REF), 1306 "DFI LanParty", STAC_92HD73XX_REF), 1307 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0254, 1308 "unknown Dell", STAC_DELL_M6), 1309 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0255, 1310 "unknown Dell", STAC_DELL_M6), 1311 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0256, 1312 "unknown Dell", STAC_DELL_M6), 1313 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0257, 1314 "unknown Dell", STAC_DELL_M6), 1315 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x025e, 1316 "unknown Dell", STAC_DELL_M6), 1317 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x025f, 1318 "unknown Dell", STAC_DELL_M6), 1319 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0271, 1320 "unknown Dell", STAC_DELL_M6), 1233 1321 {0} /* terminator */ 1234 1322 }; … … 1240 1328 }; 1241 1329 1330 static unsigned int dell_m4_1_pin_configs[10] = { 1331 0x0421101f, 0x04a11221, 0x40f000f0, 0x90170110, 1332 0x23a1902e, 0x23014250, 0x40f000f0, 0x90a000f0, 1333 0x40f000f0, 0x4f0000f0, 1334 }; 1335 1336 static unsigned int dell_m4_2_pin_configs[10] = { 1337 0x0421101f, 0x04a11221, 0x90a70330, 0x90170110, 1338 0x23a1902e, 0x23014250, 0x40f000f0, 0x40f000f0, 1339 0x40f000f0, 0x044413b0, 1340 }; 1341 1242 1342 static unsigned int *stac92hd71bxx_brd_tbl[STAC_92HD71BXX_MODELS] = { 1243 1343 [STAC_92HD71BXX_REF] = ref92hd71bxx_pin_configs, 1344 [STAC_DELL_M4_1] = dell_m4_1_pin_configs, 1345 [STAC_DELL_M4_2] = dell_m4_2_pin_configs, 1244 1346 }; 1245 1347 1246 1348 static const char *stac92hd71bxx_models[STAC_92HD71BXX_MODELS] = { 1247 1349 [STAC_92HD71BXX_REF] = "ref", 1350 [STAC_DELL_M4_1] = "dell-m4-1", 1351 [STAC_DELL_M4_2] = "dell-m4-2", 1248 1352 }; 1249 1353 … … 1252 1356 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, 1253 1357 "DFI LanParty", STAC_92HD71BXX_REF), 1358 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0233, 1359 "unknown Dell", STAC_DELL_M4_1), 1360 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0234, 1361 "unknown Dell", STAC_DELL_M4_1), 1362 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0250, 1363 "unknown Dell", STAC_DELL_M4_1), 1364 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x024f, 1365 "unknown Dell", STAC_DELL_M4_1), 1366 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x024d, 1367 "unknown Dell", STAC_DELL_M4_1), 1368 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0251, 1369 "unknown Dell", STAC_DELL_M4_1), 1370 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0277, 1371 "unknown Dell", STAC_DELL_M4_1), 1372 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0263, 1373 "unknown Dell", STAC_DELL_M4_2), 1374 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0265, 1375 "unknown Dell", STAC_DELL_M4_2), 1376 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0262, 1377 "unknown Dell", STAC_DELL_M4_2), 1378 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0264, 1379 "unknown Dell", STAC_DELL_M4_2), 1254 1380 {0} /* terminator */ 1255 1381 }; … … 1639 1765 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f8, 1640 1766 "Dell Precision", STAC_9205_DELL_M43), 1641 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x021c,1642 "Dell Precision", STAC_9205_DELL_M43),1643 1767 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f9, 1644 "Dell Precision", STAC_9205_DELL_M43),1645 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x021b,1646 1768 "Dell Precision", STAC_9205_DELL_M43), 1647 1769 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01fa, … … 1655 1777 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ff, 1656 1778 "Dell Precision M4300", STAC_9205_DELL_M43), 1779 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0204, 1780 "unknown Dell", STAC_9205_DELL_M42), 1657 1781 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0206, 1658 1782 "Dell Precision", STAC_9205_DELL_M43), 1659 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f1, 1660 "Dell Inspiron", STAC_9205_DELL_M44), 1661 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f2, 1662 "Dell Inspiron", STAC_9205_DELL_M44), 1663 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01fc, 1664 "Dell Inspiron", STAC_9205_DELL_M44), 1665 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01fd, 1666 "Dell Inspiron", STAC_9205_DELL_M44), 1667 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0204, 1668 "unknown Dell", STAC_9205_DELL_M42), 1783 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x021b, 1784 "Dell Precision", STAC_9205_DELL_M43), 1785 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x021c, 1786 "Dell Precision", STAC_9205_DELL_M43), 1669 1787 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x021f, 1670 1788 "Dell Inspiron", STAC_9205_DELL_M44), … … 1744 1862 { 1745 1863 struct sigmatel_spec *spec = codec->spec; 1746 return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream); 1864 return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream, 1865 hinfo); 1747 1866 } 1748 1867 … … 1818 1937 struct sigmatel_spec *spec = codec->spec; 1819 1938 1820 snd_hda_codec_ setup_stream(codec, spec->adc_nids[substream->number], 0, 0, 0);1939 snd_hda_codec_cleanup_stream(codec, spec->adc_nids[substream->number]); 1821 1940 return 0; 1822 1941 } … … 1900 2019 info++; 1901 2020 info->name = "STAC92xx Digital"; 2021 info->pcm_type = HDA_PCM_TYPE_SPDIF; 1902 2022 if (spec->multiout.dig_out_nid) { 1903 2023 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = stac92xx_pcm_digital_playback; … … 1936 2056 } 1937 2057 2058 #define stac92xx_hp_switch_info snd_ctl_boolean_mono_info 2059 2060 static int stac92xx_hp_switch_get(struct snd_kcontrol *kcontrol, 2061 struct snd_ctl_elem_value *ucontrol) 2062 { 2063 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); 2064 struct sigmatel_spec *spec = codec->spec; 2065 2066 ucontrol->value.integer.value[0] = spec->hp_switch; 2067 return 0; 2068 } 2069 2070 static int stac92xx_hp_switch_put(struct snd_kcontrol *kcontrol, 2071 struct snd_ctl_elem_value *ucontrol) 2072 { 2073 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); 2074 struct sigmatel_spec *spec = codec->spec; 2075 2076 spec->hp_switch = ucontrol->value.integer.value[0]; 2077 2078 /* check to be sure that the ports are upto date with 2079 * switch changes 2080 */ 2081 codec->patch_ops.unsol_event(codec, STAC_HP_EVENT << 26); 2082 2083 return 1; 2084 } 2085 1938 2086 #define stac92xx_io_switch_info snd_ctl_boolean_mono_info 1939 2087 … … 2006 2154 return 1; 2007 2155 } 2156 2157 #define STAC_CODEC_HP_SWITCH(xname) \ 2158 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ 2159 .name = xname, \ 2160 .index = 0, \ 2161 .info = stac92xx_hp_switch_info, \ 2162 .get = stac92xx_hp_switch_get, \ 2163 .put = stac92xx_hp_switch_put, \ 2164 } 2008 2165 2009 2166 #define STAC_CODEC_IO_SWITCH(xname, xpval) \ … … 2031 2188 STAC_CTL_WIDGET_MUTE, 2032 2189 STAC_CTL_WIDGET_MONO_MUX, 2190 STAC_CTL_WIDGET_HP_SWITCH, 2033 2191 STAC_CTL_WIDGET_IO_SWITCH, 2034 2192 STAC_CTL_WIDGET_CLFE_SWITCH … … 2039 2197 HDA_CODEC_MUTE(NULL, 0, 0, 0), 2040 2198 STAC_MONO_MUX, 2199 STAC_CODEC_HP_SWITCH(NULL), 2041 2200 STAC_CODEC_IO_SWITCH(NULL, 0), 2042 2201 STAC_CODEC_CLFE_SWITCH(NULL, 0), … … 2233 2392 } 2234 2393 2394 static int add_spec_dacs(struct sigmatel_spec *spec, hda_nid_t nid) 2395 { 2396 if (!spec->multiout.hp_nid) 2397 spec->multiout.hp_nid = nid; 2398 else if (spec->multiout.num_dacs > 4) { 2399 printk(KERN_WARNING "stac92xx: No space for DAC 0x%x\n", nid); 2400 return 1; 2401 } else { 2402 spec->multiout.dac_nids[spec->multiout.num_dacs] = nid; 2403 spec->multiout.num_dacs++; 2404 } 2405 return 0; 2406 } 2407 2408 static int check_in_dac_nids(struct sigmatel_spec *spec, hda_nid_t nid) 2409 { 2410 if (is_in_dac_nids(spec, nid)) 2411 return 1; 2412 if (spec->multiout.hp_nid == nid) 2413 return 1; 2414 return 0; 2415 } 2416 2235 2417 /* add playback controls from the parsed DAC table */ 2236 2418 static int stac92xx_auto_create_multi_out_ctls(struct hda_codec *codec, … … 2247 2429 2248 2430 2249 for (i = 0; i < cfg->line_outs ; i++) {2431 for (i = 0; i < cfg->line_outs && i < spec->multiout.num_dacs; i++) { 2250 2432 if (!spec->multiout.dac_nids[i]) 2251 2433 continue; … … 2278 2460 return err; 2279 2461 } 2462 } 2463 2464 if (cfg->hp_outs > 1) { 2465 err = stac92xx_add_control(spec, 2466 STAC_CTL_WIDGET_HP_SWITCH, 2467 "Headphone as Line Out Switch", 0); 2468 if (err < 0) 2469 return err; 2280 2470 } 2281 2471 … … 2295 2485 if (spec->mic_switch) { 2296 2486 unsigned int def_conf; 2297 nid = cfg->input_pins[AUTO_PIN_MIC]; 2487 unsigned int mic_pin = AUTO_PIN_MIC; 2488 again: 2489 nid = cfg->input_pins[mic_pin]; 2298 2490 def_conf = snd_hda_codec_read(codec, nid, 0, 2299 2491 AC_VERB_GET_CONFIG_DEFAULT, 0); 2300 2301 2492 /* some laptops have an internal analog microphone 2302 2493 * which can't be used as a output */ … … 2308 2499 STAC_CTL_WIDGET_IO_SWITCH, 2309 2500 "Mic as Output Switch", (nid << 8) | 1); 2501 nid = snd_hda_codec_read(codec, nid, 0, 2502 AC_VERB_GET_CONNECT_LIST, 0) & 0xff; 2503 if (!check_in_dac_nids(spec, nid)) 2504 add_spec_dacs(spec, nid); 2310 2505 if (err < 0) 2311 2506 return err; 2312 2507 } 2508 } else if (mic_pin == AUTO_PIN_MIC) { 2509 mic_pin = AUTO_PIN_FRONT_MIC; 2510 goto again; 2313 2511 } 2314 2512 } 2315 2513 2316 return 0;2317 }2318 2319 static int check_in_dac_nids(struct sigmatel_spec *spec, hda_nid_t nid)2320 {2321 if (is_in_dac_nids(spec, nid))2322 return 1;2323 if (spec->multiout.hp_nid == nid)2324 return 1;2325 return 0;2326 }2327 2328 static int add_spec_dacs(struct sigmatel_spec *spec, hda_nid_t nid)2329 {2330 if (!spec->multiout.hp_nid)2331 spec->multiout.hp_nid = nid;2332 else if (spec->multiout.num_dacs > 4) {2333 printk(KERN_WARNING "stac92xx: No space for DAC 0x%x\n", nid);2334 return 1;2335 } else {2336 spec->multiout.dac_nids[spec->multiout.num_dacs] = nid;2337 spec->multiout.num_dacs++;2338 }2339 2514 return 0; 2340 2515 } … … 2389 2564 } 2390 2565 if (spec->multiout.hp_nid) { 2391 const char *pfx; 2392 if (old_num_dacs == spec->multiout.num_dacs) 2393 pfx = "Master"; 2394 else 2395 pfx = "Headphone"; 2396 err = create_controls(spec, pfx, spec->multiout.hp_nid, 3); 2566 err = create_controls(spec, "Headphone", 2567 spec->multiout.hp_nid, 3); 2397 2568 if (err < 0) 2398 2569 return err; … … 2502 2673 return 0; 2503 2674 } 2504 2505 2675 2506 2676 /* create playback/capture controls for input pins */ … … 2757 2927 for (i = 0; i < spec->autocfg.speaker_outs && lfe_pin == 0x0; i++) { 2758 2928 hda_nid_t pin = spec->autocfg.speaker_pins[i]; 2759 unsigned longwcaps = get_wcaps(codec, pin);2929 unsigned int wcaps = get_wcaps(codec, pin); 2760 2930 wcaps &= (AC_WCAP_STEREO | AC_WCAP_OUT_AMP); 2761 2931 if (wcaps == AC_WCAP_OUT_AMP) … … 2768 2938 for (i = 0; i < spec->autocfg.line_outs && lfe_pin == 0x0; i++) { 2769 2939 hda_nid_t pin = spec->autocfg.line_out_pins[i]; 2770 unsigned longcfg;2771 cfg = snd_hda_codec_read(codec, pin, 0,2940 unsigned int defcfg; 2941 defcfg = snd_hda_codec_read(codec, pin, 0, 2772 2942 AC_VERB_GET_CONFIG_DEFAULT, 2773 2943 0x00); 2774 if (get_defcfg_device( cfg) == AC_JACK_SPEAKER) {2775 unsigned longwcaps = get_wcaps(codec, pin);2944 if (get_defcfg_device(defcfg) == AC_JACK_SPEAKER) { 2945 unsigned int wcaps = get_wcaps(codec, pin); 2776 2946 wcaps &= (AC_WCAP_STEREO | AC_WCAP_OUT_AMP); 2777 2947 if (wcaps == AC_WCAP_OUT_AMP) … … 2877 3047 return 0; /* nid is not a HP-Out */ 2878 3048 }; 3049 3050 static void stac92xx_power_down(struct hda_codec *codec) 3051 { 3052 struct sigmatel_spec *spec = codec->spec; 3053 3054 /* power down inactive DACs */ 3055 hda_nid_t *dac; 3056 for (dac = spec->dac_list; *dac; dac++) 3057 if (!is_in_dac_nids(spec, *dac) && 3058 spec->multiout.hp_nid != *dac) 3059 snd_hda_codec_write_cache(codec, *dac, 0, 3060 AC_VERB_SET_POWER_STATE, AC_PWRST_D3); 3061 } 2879 3062 2880 3063 static int stac92xx_init(struct hda_codec *codec) … … 2921 3104 int pinctl = snd_hda_codec_read(codec, spec->pwr_nids[i], 2922 3105 0, AC_VERB_GET_PIN_WIDGET_CONTROL, 0); 3106 int def_conf = snd_hda_codec_read(codec, spec->pwr_nids[i], 3107 0, AC_VERB_GET_CONFIG_DEFAULT, 0); 3108 def_conf = get_defcfg_connect(def_conf); 2923 3109 /* outputs are only ports capable of power management 2924 3110 * any attempts on powering down a input port cause the … … 2927 3113 if (pinctl & AC_PINCTL_IN_EN) 2928 3114 continue; 3115 /* skip any ports that don't have jacks since presence 3116 * detection is useless */ 3117 if (def_conf && def_conf != AC_JACK_PORT_FIXED) 3118 continue; 2929 3119 enable_pin_detect(codec, spec->pwr_nids[i], event | i); 2930 3120 codec->patch_ops.unsol_event(codec, (event | i) << 26); 2931 3121 } 2932 3122 if (spec->dac_list) 3123 stac92xx_power_down(codec); 2933 3124 if (cfg->dig_out_pin) 2934 3125 stac92xx_auto_set_pinctl(codec, cfg->dig_out_pin, … … 3026 3217 struct sigmatel_spec *spec = codec->spec; 3027 3218 struct auto_pin_cfg *cfg = &spec->autocfg; 3219 int nid = cfg->hp_pins[cfg->hp_outs - 1]; 3028 3220 int i, presence; 3029 3221 … … 3036 3228 if (presence) 3037 3229 break; 3230 if (spec->hp_switch && cfg->hp_pins[i] == nid) 3231 break; 3038 3232 presence = get_hp_pin_presence(codec, cfg->hp_pins[i]); 3039 3233 } … … 3041 3235 if (presence) { 3042 3236 /* disable lineouts, enable hp */ 3237 if (spec->hp_switch) 3238 stac92xx_reset_pinctl(codec, nid, AC_PINCTL_OUT_EN); 3043 3239 for (i = 0; i < cfg->line_outs; i++) 3044 3240 stac92xx_reset_pinctl(codec, cfg->line_out_pins[i], … … 3047 3243 stac92xx_reset_pinctl(codec, cfg->speaker_pins[i], 3048 3244 AC_PINCTL_OUT_EN); 3245 if (spec->eapd_mask) 3246 stac_gpio_set(codec, spec->gpio_mask, 3247 spec->gpio_dir, spec->gpio_data & 3248 ~spec->eapd_mask); 3049 3249 } else { 3050 3250 /* enable lineouts, disable hp */ 3251 if (spec->hp_switch) 3252 stac92xx_set_pinctl(codec, nid, AC_PINCTL_OUT_EN); 3051 3253 for (i = 0; i < cfg->line_outs; i++) 3052 3254 stac92xx_set_pinctl(codec, cfg->line_out_pins[i], … … 3055 3257 stac92xx_set_pinctl(codec, cfg->speaker_pins[i], 3056 3258 AC_PINCTL_OUT_EN); 3057 } 3259 if (spec->eapd_mask) 3260 stac_gpio_set(codec, spec->gpio_mask, 3261 spec->gpio_dir, spec->gpio_data | 3262 spec->eapd_mask); 3263 } 3264 if (!spec->hp_switch && cfg->hp_outs > 1 && presence) 3265 stac92xx_set_pinctl(codec, nid, AC_PINCTL_OUT_EN); 3058 3266 } 3059 3267 … … 3103 3311 snd_hda_codec_resume_amp(codec); 3104 3312 snd_hda_codec_resume_cache(codec); 3313 /* power down inactive DACs */ 3314 if (spec->dac_list) 3315 stac92xx_power_down(codec); 3105 3316 /* invoke unsolicited event to reset the HP state */ 3106 3317 if (spec->hp_detect) … … 3166 3377 spec->mixer = stac9200_mixer; 3167 3378 3379 if (spec->board_config == STAC_9200_PANASONIC) { 3380 spec->gpio_mask = spec->gpio_dir = 0x09; 3381 spec->gpio_data = 0x00; 3382 } 3383 3168 3384 err = stac9200_parse_auto_config(codec); 3169 3385 if (err < 0) { … … 3192 3408 stac925x_models, 3193 3409 stac925x_cfg_tbl); 3194 again:3410 again: 3195 3411 if (spec->board_config < 0) { 3196 3412 snd_printdd(KERN_INFO "hda_codec: Unknown model for STAC925x," … … 3306 3522 switch (spec->multiout.num_dacs) { 3307 3523 case 0x3: /* 6 Channel */ 3524 spec->multiout.hp_nid = 0x17; 3308 3525 spec->mixer = stac92hd73xx_6ch_mixer; 3309 3526 spec->init = stac92hd73xx_6ch_core_init; … … 3331 3548 spec->num_muxes = ARRAY_SIZE(stac92hd73xx_mux_nids); 3332 3549 spec->num_adcs = ARRAY_SIZE(stac92hd73xx_adc_nids); 3333 spec->num_dmics = STAC92HD73XX_NUM_DMICS;3334 3550 spec->num_dmuxes = ARRAY_SIZE(stac92hd73xx_dmux_nids); 3335 3551 spec->dinput_mux = &stac92hd73xx_dmux; 3336 3552 /* GPIO0 High = Enable EAPD */ 3337 spec-> gpio_mask = spec->gpio_dir = 0x1;3553 spec->eapd_mask = spec->gpio_mask = spec->gpio_dir = 0x1; 3338 3554 spec->gpio_data = 0x01; 3555 3556 switch (spec->board_config) { 3557 case STAC_DELL_M6: 3558 spec->init = dell_eq_core_init; 3559 switch (codec->subsystem_id) { 3560 case 0x1028025e: /* Analog Mics */ 3561 case 0x1028025f: 3562 stac92xx_set_config_reg(codec, 0x0b, 0x90A70170); 3563 spec->num_dmics = 0; 3564 break; 3565 case 0x10280271: /* Digital Mics */ 3566 case 0x10280272: 3567 spec->init = dell_m6_core_init; 3568 /* fall-through */ 3569 case 0x10280254: 3570 case 0x10280255: 3571 stac92xx_set_config_reg(codec, 0x13, 0x90A60160); 3572 spec->num_dmics = 1; 3573 break; 3574 case 0x10280256: /* Both */ 3575 case 0x10280057: 3576 stac92xx_set_config_reg(codec, 0x0b, 0x90A70170); 3577 stac92xx_set_config_reg(codec, 0x13, 0x90A60160); 3578 spec->num_dmics = 1; 3579 break; 3580 } 3581 break; 3582 default: 3583 spec->num_dmics = STAC92HD73XX_NUM_DMICS; 3584 } 3339 3585 3340 3586 spec->num_pwrs = ARRAY_SIZE(stac92hd73xx_pwr_nids); … … 3374 3620 codec->spec = spec; 3375 3621 spec->num_pins = ARRAY_SIZE(stac92hd71bxx_pin_nids); 3622 spec->num_pwrs = ARRAY_SIZE(stac92hd71bxx_pwr_nids); 3376 3623 spec->pin_nids = stac92hd71bxx_pin_nids; 3377 3624 spec->board_config = snd_hda_check_board_config(codec, … … 3402 3649 spec->init = stac92hd71bxx_core_init; 3403 3650 break; 3651 case 0x111d7608: /* 5 Port with Analog Mixer */ 3652 /* no output amps */ 3653 spec->num_pwrs = 0; 3654 spec->mixer = stac92hd71bxx_analog_mixer; 3655 3656 /* disable VSW */ 3657 spec->init = &stac92hd71bxx_analog_core_init[HD_DISABLE_PORTF]; 3658 stac92xx_set_config_reg(codec, 0xf, 0x40f000f0); 3659 break; 3660 case 0x111d7603: /* 6 Port with Analog Mixer */ 3661 /* no output amps */ 3662 spec->num_pwrs = 0; 3663 /* fallthru */ 3404 3664 default: 3405 3665 spec->mixer = stac92hd71bxx_analog_mixer; … … 3411 3671 3412 3672 /* GPIO0 High = EAPD */ 3413 spec->gpio_mask = spec->gpio_dir = spec->gpio_data = 0x1; 3673 spec->gpio_mask = 0x01; 3674 spec->gpio_dir = 0x01; 3675 spec->gpio_data = 0x01; 3414 3676 3415 3677 spec->mux_nids = stac92hd71bxx_mux_nids; … … 3417 3679 spec->dmic_nids = stac92hd71bxx_dmic_nids; 3418 3680 spec->dmux_nids = stac92hd71bxx_dmux_nids; 3681 spec->pwr_nids = stac92hd71bxx_pwr_nids; 3419 3682 3420 3683 spec->num_muxes = ARRAY_SIZE(stac92hd71bxx_mux_nids); … … 3423 3686 spec->num_dmuxes = ARRAY_SIZE(stac92hd71bxx_dmux_nids); 3424 3687 3425 spec->num_pwrs = ARRAY_SIZE(stac92hd71bxx_pwr_nids); 3426 spec->pwr_nids = stac92hd71bxx_pwr_nids; 3427 3428 spec->multiout.num_dacs = 2; 3688 spec->multiout.num_dacs = 1; 3429 3689 spec->multiout.hp_nid = 0x11; 3430 3690 spec->multiout.dac_nids = stac92hd71bxx_dac_nids; … … 3501 3761 } 3502 3762 3503 again:3763 again: 3504 3764 if (spec->board_config < 0) { 3505 3765 snd_printdd(KERN_INFO "hda_codec: Unknown model for STAC922x, " … … 3590 3850 spec->mux_nids = stac927x_mux_nids; 3591 3851 spec->num_muxes = ARRAY_SIZE(stac927x_mux_nids); 3852 spec->dac_list = stac927x_dac_nids; 3592 3853 spec->multiout.dac_nids = spec->dac_nids; 3593 3854 … … 3596 3857 case STAC_D965_5ST: 3597 3858 /* GPIO0 High = Enable EAPD */ 3598 spec-> gpio_mask = spec->gpio_dir = 0x01;3859 spec->eapd_mask = spec->gpio_mask = spec->gpio_dir = 0x01; 3599 3860 spec->gpio_data = 0x01; 3600 3861 spec->num_dmics = 0; … … 3604 3865 break; 3605 3866 case STAC_DELL_BIOS: 3867 switch (codec->subsystem_id) { 3868 case 0x10280209: 3869 case 0x1028022e: 3870 /* correct the device field to SPDIF out */ 3871 stac92xx_set_config_reg(codec, 0x21, 0x01442070); 3872 break; 3873 }; 3874 /* configure the analog microphone on some laptops */ 3875 stac92xx_set_config_reg(codec, 0x0c, 0x90a79130); 3606 3876 /* correct the front output jack as a hp out */ 3607 stac92xx_set_config_reg(codec, 0x0f, 0x0227011 0);3877 stac92xx_set_config_reg(codec, 0x0f, 0x0227011f); 3608 3878 /* correct the front input jack as a mic */ 3609 3879 stac92xx_set_config_reg(codec, 0x0e, 0x02a79130); … … 3611 3881 case STAC_DELL_3ST: 3612 3882 /* GPIO2 High = Enable EAPD */ 3613 spec-> gpio_mask = spec->gpio_dir = 0x04;3883 spec->eapd_mask = spec->gpio_mask = spec->gpio_dir = 0x04; 3614 3884 spec->gpio_data = 0x04; 3615 3885 spec->dmic_nids = stac927x_dmic_nids; … … 3623 3893 default: 3624 3894 /* GPIO0 High = Enable EAPD */ 3625 spec-> gpio_mask = spec->gpio_dir = 0x1;3895 spec->eapd_mask = spec->gpio_mask = spec->gpio_dir = 0x1; 3626 3896 spec->gpio_data = 0x01; 3627 3897 spec->num_dmics = 0; … … 3682 3952 stac9205_models, 3683 3953 stac9205_cfg_tbl); 3684 again:3954 again: 3685 3955 if (spec->board_config < 0) { 3686 3956 snd_printdd(KERN_INFO "hda_codec: Unknown model for STAC9205, using BIOS defaults\n"); … … 3727 3997 3728 3998 spec->gpio_dir = 0x0b; 3999 spec->eapd_mask = 0x01; 3729 4000 spec->gpio_mask = 0x1b; 3730 4001 spec->gpio_mute = 0x10; … … 3736 4007 default: 3737 4008 /* GPIO0 High = EAPD */ 3738 spec-> gpio_mask = spec->gpio_dir = 0x1;4009 spec->eapd_mask = spec->gpio_mask = spec->gpio_dir = 0x1; 3739 4010 spec->gpio_data = 0x01; 3740 4011 break; … … 4028 4299 { .id = 0x83847627, .name = "STAC9271D", .patch = patch_stac927x }, 4029 4300 { .id = 0x83847628, .name = "STAC9274X5NH", .patch = patch_stac927x }, 4030 { .id = 0x83847629, .name = "STAC9274D5NH", .patch = patch_stac927x },4301 { .id = 0x83847629, .name = "STAC9274D5NH", .patch = patch_stac927x }, 4031 4302 { .id = 0x83847632, .name = "STAC9202", .patch = patch_stac925x }, 4032 4303 { .id = 0x83847633, .name = "STAC9202D", .patch = patch_stac925x }, … … 4035 4306 { .id = 0x83847636, .name = "STAC9251", .patch = patch_stac925x }, 4036 4307 { .id = 0x83847637, .name = "STAC9250D", .patch = patch_stac925x }, 4308 { .id = 0x83847645, .name = "92HD206X", .patch = patch_stac927x }, 4309 { .id = 0x83847646, .name = "92HD206D", .patch = patch_stac927x }, 4037 4310 /* The following does not take into account .id=0x83847661 when subsys = 4038 4311 * 104D0C00 which is STAC9225s. Because of this, some SZ Notebooks are … … 4050 4323 { .id = 0x838476a6, .name = "STAC9254", .patch = patch_stac9205 }, 4051 4324 { .id = 0x838476a7, .name = "STAC9254D", .patch = patch_stac9205 }, 4325 { .id = 0x111d7603, .name = "92HD75B3X5", .patch = patch_stac92hd71bxx}, 4326 { .id = 0x111d7608, .name = "92HD75B2X5", .patch = patch_stac92hd71bxx}, 4052 4327 { .id = 0x111d7674, .name = "92HD73D1X5", .patch = patch_stac92hd73xx }, 4053 4328 { .id = 0x111d7675, .name = "92HD73C1X5", .patch = patch_stac92hd73xx }, 4054 4329 { .id = 0x111d7676, .name = "92HD73E1X5", .patch = patch_stac92hd73xx }, 4055 { .id = 0x111d7608, .name = "92HD71BXX", .patch = patch_stac92hd71bxx },4056 4330 { .id = 0x111d76b0, .name = "92HD71B8X", .patch = patch_stac92hd71bxx }, 4057 4331 { .id = 0x111d76b1, .name = "92HD71B8X", .patch = patch_stac92hd71bxx }, -
GPL/branches/uniaud32-2.0/alsa-kernel/pci/hda/patch_via.c
r305 r358 40 40 #include "hda_codec.h" 41 41 #include "hda_local.h" 42 42 #include "hda_patch.h" 43 43 44 44 /* amp values */ … … 358 358 { 359 359 struct via_spec *spec = codec->spec; 360 return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream); 360 return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream, 361 hinfo); 361 362 } 362 363 … … 431 432 { 432 433 struct via_spec *spec = codec->spec; 433 snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number], 434 0, 0, 0); 434 snd_hda_codec_cleanup_stream(codec, spec->adc_nids[substream->number]); 435 435 return 0; 436 436 } … … 448 448 }; 449 449 450 static struct hda_pcm_stream vt1708_pcm_analog_s16_playback = { 451 .substreams = 1, 452 .channels_min = 2, 453 .channels_max = 8, 454 .nid = 0x10, /* NID to query formats and rates */ 455 /* We got noisy outputs on the right channel on VT1708 when 456 * 24bit samples are used. Until any workaround is found, 457 * disable the 24bit format, so far. 458 */ 459 .formats = SNDRV_PCM_FMTBIT_S16_LE, 460 .ops = { 461 .open = via_playback_pcm_open, 462 .prepare = via_playback_pcm_prepare, 463 .cleanup = via_playback_pcm_cleanup 464 }, 465 }; 466 450 467 static struct hda_pcm_stream vt1708_pcm_analog_capture = { 451 468 .substreams = 2, … … 494 511 if (err < 0) 495 512 return err; 513 err = snd_hda_create_spdif_share_sw(codec, 514 &spec->multiout); 515 if (err < 0) 516 return err; 517 spec->multiout.share_spdif = 1; 496 518 } 497 519 if (spec->dig_in_nid) { … … 524 546 info++; 525 547 info->name = spec->stream_name_digital; 548 info->pcm_type = HDA_PCM_TYPE_SPDIF; 526 549 if (spec->multiout.dig_out_nid) { 527 550 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = … … 894 917 spec->stream_name_analog = "VT1708 Analog"; 895 918 spec->stream_analog_playback = &vt1708_pcm_analog_playback; 919 /* disable 32bit format on VT1708 */ 920 if (codec->vendor_id == 0x11061708) 921 spec->stream_analog_playback = &vt1708_pcm_analog_s16_playback; 896 922 spec->stream_analog_capture = &vt1708_pcm_analog_capture; 897 923 … … 1026 1052 .ops = { 1027 1053 .open = via_dig_playback_pcm_open, 1028 .close = via_dig_playback_pcm_close, 1029 .prepare = via_dig_playback_pcm_prepare 1054 .close = via_dig_playback_pcm_close 1030 1055 }, 1031 1056 }; -
GPL/branches/uniaud32-2.0/alsa-kernel/pci/intel8x0.c
r305 r358 158 158 #define ICH_PCM_SPDIF_1011 0xc0000000 /* s/pdif pcm on slots 10&11 */ 159 159 #define ICH_PCM_20BIT 0x00400000 /* 20-bit samples (ICH4) */ 160 #define ICH_PCM_246_MASK 0x00300000 /* 6 channels (not all chips) */ 160 #define ICH_PCM_246_MASK 0x00300000 /* chan mask (not all chips) */ 161 #define ICH_PCM_8 0x00300000 /* 8 channels (not all chips) */ 161 162 #define ICH_PCM_6 0x00200000 /* 6 channels (not all chips) */ 162 163 #define ICH_PCM_4 0x00100000 /* 4 channels (not all chips) */ … … 385 386 unsigned multi4: 1, 386 387 multi6: 1, 388 multi8 :1, 387 389 dra: 1, 388 390 smp20bit: 1; … … 713 715 { 714 716 size = (size + PAGE_SIZE - 1) >> PAGE_SHIFT; 715 change_page_attr(virt_to_page(buf), size, nocache ? PAGE_KERNEL_NOCACHE : PAGE_KERNEL); 716 global_flush_tlb(); 717 if (nocache) 718 set_pages_uc(virt_to_page(buf), size); 719 else 720 set_pages_wb(virt_to_page(buf), size); 717 721 } 718 722 #else 719 #define fill_nocache(buf, size,nocache)723 #define fill_nocache(buf, size, nocache) do { ; } while (0) 720 724 #endif 721 725 … … 998 1002 else if (runtime->channels == 6) 999 1003 cnt |= ICH_PCM_6; 1004 else if (runtime->channels == 8) 1005 cnt |= ICH_PCM_8; 1000 1006 if (chip->device_type == DEVICE_NFORCE) { 1001 1007 /* reset to 2ch once to keep the 6 channel data in alignment, … … 1107 1113 }; 1108 1114 1115 static unsigned int channels8[] = { 1116 2, 4, 6, 8, 1117 }; 1118 1119 static struct snd_pcm_hw_constraint_list hw_constraints_channels8 = { 1120 .count = ARRAY_SIZE(channels8), 1121 .list = channels8, 1122 .mask = 0, 1123 }; 1124 1109 1125 static int snd_intel8x0_pcm_open(struct snd_pcm_substream *substream, struct ichdev *ichdev) 1110 1126 { … … 1137 1153 return err; 1138 1154 1139 if (chip->multi6) { 1155 if (chip->multi8) { 1156 runtime->hw.channels_max = 8; 1157 snd_pcm_hw_constraint_list(runtime, 0, 1158 SNDRV_PCM_HW_PARAM_CHANNELS, 1159 &hw_constraints_channels8); 1160 } else if (chip->multi6) { 1140 1161 runtime->hw.channels_max = 6; 1141 1162 snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_CHANNELS, … … 1711 1732 1712 1733 static struct ac97_quirk ac97_quirks[] __devinitdata = { 1734 { 1735 .subvendor = 0x0e11, 1736 .subdevice = 0x000e, 1737 .name = "Compaq Deskpro EN", /* AD1885 */ 1738 .type = AC97_TUNE_HP_ONLY 1739 }, 1713 1740 { 1714 1741 .subvendor = 0x0e11, … … 2200 2227 if (pbus->pcms[0].r[0].slots & (1 << AC97_SLOT_PCM_SLEFT)) { 2201 2228 chip->multi4 = 1; 2202 if (pbus->pcms[0].r[0].slots & (1 << AC97_SLOT_LFE)) 2229 if (pbus->pcms[0].r[0].slots & (1 << AC97_SLOT_LFE)) { 2203 2230 chip->multi6 = 1; 2231 if (chip->ac97[0]->flags & AC97_HAS_8CH) 2232 chip->multi8 = 1; 2233 } 2204 2234 } 2205 2235 if (pbus->pcms[0].r[1].rslots[0]) { … … 2443 2473 } 2444 2474 /* --- */ 2445 synchronize_irq(chip->irq); 2475 2446 2476 __hw_end: 2447 2477 if (chip->irq >= 0) … … 2492 2522 2493 2523 if (chip->irq >= 0) { 2494 synchronize_irq(chip->irq);2495 2524 free_irq(chip->irq, chip); 2496 2525 chip->irq = -1; … … 2645 2674 t *= 1000000; 2646 2675 t += stop_time.tv_usec - start_time.tv_usec; 2647 printk(KERN_INFO "%s: measured %lu usecs\n", __ FUNCTION__, t);2676 printk(KERN_INFO "%s: measured %lu usecs\n", __func__, t); 2648 2677 if (t == 0) { 2649 2678 snd_printk(KERN_ERR "?? calculation error..\n"); -
GPL/branches/uniaud32-2.0/alsa-kernel/pci/korg1212/korg1212.c
r305 r358 2103 2103 2104 2104 if (korg1212->irq >= 0) { 2105 synchronize_irq(korg1212->irq);2106 2105 snd_korg1212_DisableCardInterrupts(korg1212); 2107 2106 free_irq(korg1212->irq, korg1212); -
GPL/branches/uniaud32-2.0/alsa-kernel/pci/maestro3.c
r325 r358 2073 2073 struct snd_ac97_bus *pbus; 2074 2074 struct snd_ac97_template ac97; 2075 struct snd_ctl_elem_id id;2075 struct snd_ctl_elem_id elem_id; 2076 2076 int err; 2077 2077 static struct snd_ac97_bus_ops ops = { … … 2093 2093 snd_ac97_write(chip->ac97, AC97_PCM, 0); 2094 2094 2095 memset(& id, 0, sizeof(id));2096 id.iface = SNDRV_CTL_ELEM_IFACE_MIXER;2097 strcpy( id.name, "Master Playback Switch");2098 chip->master_switch = snd_ctl_find_id(chip->card, & id);2099 memset(& id, 0, sizeof(id));2100 id.iface = SNDRV_CTL_ELEM_IFACE_MIXER;2101 strcpy( id.name, "Master Playback Volume");2102 chip->master_volume = snd_ctl_find_id(chip->card, & id);2095 memset(&elem_id, 0, sizeof(elem_id)); 2096 elem_id.iface = SNDRV_CTL_ELEM_IFACE_MIXER; 2097 strcpy(elem_id.name, "Master Playback Switch"); 2098 chip->master_switch = snd_ctl_find_id(chip->card, &elem_id); 2099 memset(&elem_id, 0, sizeof(elem_id)); 2100 elem_id.iface = SNDRV_CTL_ELEM_IFACE_MIXER; 2101 strcpy(elem_id.name, "Master Playback Volume"); 2102 chip->master_volume = snd_ctl_find_id(chip->card, &elem_id); 2103 2103 2104 2104 return 0; … … 2432 2432 } 2433 2433 2434 static void 2435 snd_m3_hv_init(struct snd_m3 *chip) 2436 { 2437 unsigned long io = chip->iobase; 2438 u16 val = GPI_VOL_DOWN | GPI_VOL_UP; 2439 2440 if (!chip->is_omnibook) 2441 return; 2442 2443 /* 2444 * Volume buttons on some HP OmniBook laptops 2445 * require some GPIO magic to work correctly. 2446 */ 2447 outw(0xffff, io + GPIO_MASK); 2448 outw(0x0000, io + GPIO_DATA); 2449 2450 outw(~val, io + GPIO_MASK); 2451 outw(inw(io + GPIO_DIRECTION) & ~val, io + GPIO_DIRECTION); 2452 outw(val, io + GPIO_MASK); 2453 2454 outw(0xffff, io + GPIO_MASK); 2455 } 2456 2434 2457 static int 2435 2458 snd_m3_chip_init(struct snd_m3 *chip) … … 2447 2470 pci_write_config_word(pcidev, PCI_LEGACY_AUDIO_CTRL, w); 2448 2471 2449 if (chip->is_omnibook) {2450 /*2451 * Volume buttons on some HP OmniBook laptops don't work2452 * correctly. This makes them work for the most part.2453 *2454 * Volume up and down buttons on the laptop side work.2455 * Fn+cursor_up (volme up) works.2456 * Fn+cursor_down (volume down) doesn't work.2457 * Fn+F7 (mute) works acts as volume up.2458 */2459 outw(~(GPI_VOL_DOWN|GPI_VOL_UP), io + GPIO_MASK);2460 outw(inw(io + GPIO_DIRECTION) & ~(GPI_VOL_DOWN|GPI_VOL_UP), io + GPIO_DIRECTION);2461 outw((GPI_VOL_DOWN|GPI_VOL_UP), io + GPIO_DATA);2462 outw(0xffff, io + GPIO_MASK);2463 }2464 2472 pci_read_config_dword(pcidev, PCI_ALLEGRO_CONFIG, &n); 2465 2473 n &= ~(HV_CTRL_ENABLE | REDUCED_DEBOUNCE | HV_BUTTON_FROM_GD); … … 2547 2555 #endif 2548 2556 2549 if (chip->irq >= 0) { 2550 synchronize_irq(chip->irq); 2557 if (chip->irq >= 0) 2551 2558 free_irq(chip->irq, chip); 2552 }2553 2559 2554 2560 if (chip->iobase) … … 2574 2580 struct snd_card *card = pci_get_drvdata(pci); 2575 2581 struct snd_m3 *chip = card->private_data; 2576 int i, index;2582 int i, dsp_index; 2577 2583 2578 2584 if (chip->suspend_mem == NULL) … … 2588 2594 2589 2595 /* save dsp image */ 2590 index = 0;2596 dsp_index = 0; 2591 2597 for (i = REV_B_CODE_MEMORY_BEGIN; i <= REV_B_CODE_MEMORY_END; i++) 2592 chip->suspend_mem[ index++] =2598 chip->suspend_mem[dsp_index++] = 2593 2599 snd_m3_assp_read(chip, MEMTYPE_INTERNAL_CODE, i); 2594 2600 for (i = REV_B_DATA_MEMORY_BEGIN ; i <= REV_B_DATA_MEMORY_END; i++) 2595 chip->suspend_mem[ index++] =2601 chip->suspend_mem[dsp_index++] = 2596 2602 snd_m3_assp_read(chip, MEMTYPE_INTERNAL_DATA, i); 2597 2603 … … 2606 2612 struct snd_card *card = pci_get_drvdata(pci); 2607 2613 struct snd_m3 *chip = card->private_data; 2608 int i, index;2614 int i, dsp_index; 2609 2615 2610 2616 if (chip->suspend_mem == NULL) … … 2630 2636 2631 2637 /* restore dsp image */ 2632 index = 0;2638 dsp_index = 0; 2633 2639 for (i = REV_B_CODE_MEMORY_BEGIN; i <= REV_B_CODE_MEMORY_END; i++) 2634 2640 snd_m3_assp_write(chip, MEMTYPE_INTERNAL_CODE, i, 2635 chip->suspend_mem[ index++]);2641 chip->suspend_mem[dsp_index++]); 2636 2642 for (i = REV_B_DATA_MEMORY_BEGIN ; i <= REV_B_DATA_MEMORY_END; i++) 2637 2643 snd_m3_assp_write(chip, MEMTYPE_INTERNAL_DATA, i, 2638 chip->suspend_mem[ index++]);2644 chip->suspend_mem[dsp_index++]); 2639 2645 2640 2646 /* tell the dma engine to restart itself */ … … 2648 2654 snd_m3_enable_ints(chip); 2649 2655 snd_m3_amp_enable(chip, 1); 2656 2657 snd_m3_hv_init(chip); 2650 2658 2651 2659 snd_power_change_state(card, SNDRV_CTL_POWER_D0); … … 2792 2800 snd_m3_amp_enable(chip, 1); 2793 2801 2802 snd_m3_hv_init(chip); 2803 2794 2804 tasklet_init(&chip->hwvol_tq, snd_m3_update_hw_volume, (unsigned long)chip); 2795 2805 -
GPL/branches/uniaud32-2.0/alsa-kernel/pci/nm256/nm256.c
r305 r358 1303 1303 }; 1304 1304 1305 chip->ac97_regs = kcalloc( sizeof(short),1306 ARRAY_SIZE(nm256_ac97_init_val), GFP_KERNEL);1305 chip->ac97_regs = kcalloc(ARRAY_SIZE(nm256_ac97_init_val), 1306 sizeof(short), GFP_KERNEL); 1307 1307 if (! chip->ac97_regs) 1308 1308 return -ENOMEM; … … 1440 1440 1441 1441 if (chip->irq >= 0) 1442 synchronize_irq(chip->irq);1442 free_irq(chip->irq, chip); 1443 1443 1444 1444 if (chip->cport) … … 1448 1448 release_and_free_resource(chip->res_cport); 1449 1449 release_and_free_resource(chip->res_buffer); 1450 if (chip->irq >= 0)1451 free_irq(chip->irq, chip);1452 1450 1453 1451 pci_disable_device(chip->pci); -
GPL/branches/uniaud32-2.0/alsa-kernel/pci/rme96.c
r305 r358 1560 1560 rme96->port = pci_resource_start(rme96->pci, 0); 1561 1561 1562 if ((rme96->iobase = ioremap_nocache(rme96->port, RME96_IO_SIZE)) == 0) { 1562 rme96->iobase = ioremap_nocache(rme96->port, RME96_IO_SIZE); 1563 if (!rme96->iobase) { 1563 1564 snd_printk(KERN_ERR "unable to remap memory region 0x%lx-0x%lx\n", rme96->port, rme96->port + RME96_IO_SIZE - 1); 1564 1565 return -ENOMEM; -
GPL/branches/uniaud32-2.0/alsa-kernel/pci/rme9652/hdsp.c
r305 r358 319 319 320 320 #define HDSP_spdifFrequencyMask (HDSP_spdifFrequency0|HDSP_spdifFrequency1|HDSP_spdifFrequency2) 321 #define HDSP_spdifFrequencyMask_9632 (HDSP_spdifFrequency0|\ 322 HDSP_spdifFrequency1|\ 323 HDSP_spdifFrequency2|\ 324 HDSP_spdifFrequency3) 321 325 322 326 #define HDSP_spdifFrequency32KHz (HDSP_spdifFrequency0) … … 329 333 330 334 /* This is for H9632 cards */ 331 #define HDSP_spdifFrequency128KHz HDSP_spdifFrequencyMask 335 #define HDSP_spdifFrequency128KHz (HDSP_spdifFrequency0|\ 336 HDSP_spdifFrequency1|\ 337 HDSP_spdifFrequency2) 332 338 #define HDSP_spdifFrequency176_4KHz HDSP_spdifFrequency3 333 339 #define HDSP_spdifFrequency192KHz (HDSP_spdifFrequency3|HDSP_spdifFrequency0) … … 886 892 } 887 893 888 static int hdsp_external_sample_rate (struct hdsp *hdsp) 894 static int hdsp_spdif_sample_rate(struct hdsp *hdsp) 895 { 896 unsigned int status = hdsp_read(hdsp, HDSP_statusRegister); 897 unsigned int rate_bits = (status & HDSP_spdifFrequencyMask); 898 899 /* For the 9632, the mask is different */ 900 if (hdsp->io_type == H9632) 901 rate_bits = (status & HDSP_spdifFrequencyMask_9632); 902 903 if (status & HDSP_SPDIFErrorFlag) 904 return 0; 905 906 switch (rate_bits) { 907 case HDSP_spdifFrequency32KHz: return 32000; 908 case HDSP_spdifFrequency44_1KHz: return 44100; 909 case HDSP_spdifFrequency48KHz: return 48000; 910 case HDSP_spdifFrequency64KHz: return 64000; 911 case HDSP_spdifFrequency88_2KHz: return 88200; 912 case HDSP_spdifFrequency96KHz: return 96000; 913 case HDSP_spdifFrequency128KHz: 914 if (hdsp->io_type == H9632) return 128000; 915 break; 916 case HDSP_spdifFrequency176_4KHz: 917 if (hdsp->io_type == H9632) return 176400; 918 break; 919 case HDSP_spdifFrequency192KHz: 920 if (hdsp->io_type == H9632) return 192000; 921 break; 922 default: 923 break; 924 } 925 snd_printk ("Hammerfall-DSP: unknown spdif frequency status; bits = 0x%x, status = 0x%x\n", rate_bits, status); 926 return 0; 927 } 928 929 static int hdsp_external_sample_rate(struct hdsp *hdsp) 889 930 { 890 931 unsigned int status2 = hdsp_read(hdsp, HDSP_status2Register); 891 932 unsigned int rate_bits = status2 & HDSP_systemFrequencyMask; 933 934 /* For the 9632 card, there seems to be no bit for indicating external 935 * sample rate greater than 96kHz. The card reports the corresponding 936 * single speed. So the best means seems to get spdif rate when 937 * autosync reference is spdif */ 938 if (hdsp->io_type == H9632 && 939 hdsp_autosync_ref(hdsp) == HDSP_AUTOSYNC_FROM_SPDIF) 940 return hdsp_spdif_sample_rate(hdsp); 892 941 893 942 switch (rate_bits) { … … 901 950 return 0; 902 951 } 903 }904 905 static int hdsp_spdif_sample_rate(struct hdsp *hdsp)906 {907 unsigned int status = hdsp_read(hdsp, HDSP_statusRegister);908 unsigned int rate_bits = (status & HDSP_spdifFrequencyMask);909 910 if (status & HDSP_SPDIFErrorFlag)911 return 0;912 913 switch (rate_bits) {914 case HDSP_spdifFrequency32KHz: return 32000;915 case HDSP_spdifFrequency44_1KHz: return 44100;916 case HDSP_spdifFrequency48KHz: return 48000;917 case HDSP_spdifFrequency64KHz: return 64000;918 case HDSP_spdifFrequency88_2KHz: return 88200;919 case HDSP_spdifFrequency96KHz: return 96000;920 case HDSP_spdifFrequency128KHz:921 if (hdsp->io_type == H9632) return 128000;922 break;923 case HDSP_spdifFrequency176_4KHz:924 if (hdsp->io_type == H9632) return 176400;925 break;926 case HDSP_spdifFrequency192KHz:927 if (hdsp->io_type == H9632) return 192000;928 break;929 default:930 break;931 }932 snd_printk ("Hammerfall-DSP: unknown spdif frequency status; bits = 0x%x, status = 0x%x\n", rate_bits, status);933 return 0;934 952 } 935 953 -
GPL/branches/uniaud32-2.0/alsa-kernel/pci/rme9652/hdspm.c
r305 r358 541 541 static inline int HDSPM_bit2freq(int n) 542 542 { 543 static int bit2freq_tab[] = { 0, 32000, 44100, 48000, 64000, 88200, 543 static const int bit2freq_tab[] = { 544 0, 32000, 44100, 48000, 64000, 88200, 544 545 96000, 128000, 176400, 192000 }; 545 546 if (n < 1 || n > 9) … … 583 584 } 584 585 585 static in line int hdspm_write_in_gain(struct hdspm *hdspm, unsigned int chan,586 static int hdspm_write_in_gain(struct hdspm *hdspm, unsigned int chan, 586 587 unsigned int in, unsigned short data) 587 588 { … … 596 597 } 597 598 598 static in line int hdspm_write_pb_gain(struct hdspm *hdspm, unsigned int chan,599 static int hdspm_write_pb_gain(struct hdspm *hdspm, unsigned int chan, 599 600 unsigned int pb, unsigned short data) 600 601 { … … 622 623 623 624 /* check if same process is writing and reading */ 624 static in line int snd_hdspm_use_is_exclusive(struct hdspm *hdspm)625 static int snd_hdspm_use_is_exclusive(struct hdspm *hdspm) 625 626 { 626 627 unsigned long flags; … … 637 638 638 639 /* check for external sample rate */ 639 static in line int hdspm_external_sample_rate(struct hdspm *hdspm)640 static int hdspm_external_sample_rate(struct hdspm *hdspm) 640 641 { 641 642 if (hdspm->is_aes32) { … … 788 789 789 790 /* should I silence all or only opened ones ? doit all for first even is 4MB*/ 790 static inline void hdspm_silence_playback(struct hdspm *hdspm)791 static void hdspm_silence_playback(struct hdspm *hdspm) 791 792 { 792 793 int i; … … 1029 1030 /* the hardware already does the relevant bit-mask with 0xff */ 1030 1031 if (id) 1031 returnhdspm_write(hdspm, HDSPM_midiDataOut1, val);1032 hdspm_write(hdspm, HDSPM_midiDataOut1, val); 1032 1033 else 1033 returnhdspm_write(hdspm, HDSPM_midiDataOut0, val);1034 hdspm_write(hdspm, HDSPM_midiDataOut0, val); 1034 1035 } 1035 1036 … … 1058 1059 } 1059 1060 1060 static inline void snd_hdspm_flush_midi_input(struct hdspm *hdspm, int id)1061 static void snd_hdspm_flush_midi_input(struct hdspm *hdspm, int id) 1061 1062 { 1062 1063 while (snd_hdspm_midi_input_available (hdspm, id)) -
GPL/branches/uniaud32-2.0/alsa-kernel/pci/trident/trident_main.c
r325 r358 1591 1591 if (trident->device != TRIDENT_DEVICE_ID_SI7018) { 1592 1592 outl(trident->spdif_pcm_bits, TRID_REG(trident, NX_SPCSTATUS)); 1593 outb(trident->spdif_pcm_ctrl, TRID_REG(trident, NX_SPCTRL_SPCSO + 3)); 1593 val = trident->spdif_pcm_ctrl; 1594 if (!go) 1595 val &= ~(0x28); 1596 outb(val, TRID_REG(trident, NX_SPCTRL_SPCSO + 3)); 1594 1597 } else { 1595 1598 outl(trident->spdif_pcm_bits, TRID_REG(trident, SI_SPDIF_CS)); … … 3677 3680 outl(0, TRID_REG(trident, SI_SERIAL_INTF_CTRL)); 3678 3681 } 3682 if (trident->irq >= 0) 3683 free_irq(trident->irq, trident); 3679 3684 if (trident->tlb.buffer.area) { 3680 3685 outl(0, TRID_REG(trident, NX_TLBC)); … … 3686 3691 snd_dma_free_pages(&trident->tlb.buffer); 3687 3692 } 3688 if (trident->irq >= 0)3689 free_irq(trident->irq, trident);3690 3693 pci_release_regions(trident->pci); 3691 3694 pci_disable_device(trident->pci); -
GPL/branches/uniaud32-2.0/alsa-kernel/pci/trident/trident_memory.c
r305 r358 311 311 return 0; 312 312 } 313 314 315 /*----------------------------------------------------------------316 * memory allocation using multiple pages (for synth)317 *----------------------------------------------------------------318 * Unlike the DMA allocation above, non-contiguous pages are319 * assigned to TLB.320 *----------------------------------------------------------------*/321 322 /*323 */324 static int synth_alloc_pages(struct snd_trident *hw, struct snd_util_memblk *blk);325 static int synth_free_pages(struct snd_trident *hw, struct snd_util_memblk *blk);326 327 /*328 * allocate a synth sample area329 */330 struct snd_util_memblk *331 snd_trident_synth_alloc(struct snd_trident *hw, unsigned int size)332 {333 struct snd_util_memblk *blk;334 struct snd_util_memhdr *hdr = hw->tlb.memhdr;335 336 mutex_lock(&hdr->block_mutex);337 blk = __snd_util_mem_alloc(hdr, size);338 if (blk == NULL) {339 mutex_unlock(&hdr->block_mutex);340 return NULL;341 }342 if (synth_alloc_pages(hw, blk)) {343 __snd_util_mem_free(hdr, blk);344 mutex_unlock(&hdr->block_mutex);345 return NULL;346 }347 mutex_unlock(&hdr->block_mutex);348 return blk;349 }350 351 EXPORT_SYMBOL(snd_trident_synth_alloc);352 353 /*354 * free a synth sample area355 */356 int357 snd_trident_synth_free(struct snd_trident *hw, struct snd_util_memblk *blk)358 {359 struct snd_util_memhdr *hdr = hw->tlb.memhdr;360 361 mutex_lock(&hdr->block_mutex);362 synth_free_pages(hw, blk);363 __snd_util_mem_free(hdr, blk);364 mutex_unlock(&hdr->block_mutex);365 return 0;366 }367 368 EXPORT_SYMBOL(snd_trident_synth_free);369 370 /*371 * reset TLB entry and free kernel page372 */373 static void clear_tlb(struct snd_trident *trident, int page)374 {375 void *ptr = page_to_ptr(trident, page);376 dma_addr_t addr = page_to_addr(trident, page);377 set_silent_tlb(trident, page);378 if (ptr) {379 struct snd_dma_buffer dmab;380 dmab.dev.type = SNDRV_DMA_TYPE_DEV;381 dmab.dev.dev = snd_dma_pci_data(trident->pci);382 dmab.area = ptr;383 dmab.addr = addr;384 dmab.bytes = ALIGN_PAGE_SIZE;385 snd_dma_free_pages(&dmab);386 }387 }388 389 /* check new allocation range */390 static void get_single_page_range(struct snd_util_memhdr *hdr,391 struct snd_util_memblk *blk,392 int *first_page_ret, int *last_page_ret)393 {394 struct list_head *p;395 struct snd_util_memblk *q;396 int first_page, last_page;397 first_page = firstpg(blk);398 if ((p = blk->list.prev) != &hdr->block) {399 q = list_entry(p, struct snd_util_memblk, list);400 if (lastpg(q) == first_page)401 first_page++; /* first page was already allocated */402 }403 last_page = lastpg(blk);404 if ((p = blk->list.next) != &hdr->block) {405 q = list_entry(p, struct snd_util_memblk, list);406 if (firstpg(q) == last_page)407 last_page--; /* last page was already allocated */408 }409 *first_page_ret = first_page;410 *last_page_ret = last_page;411 }412 413 /*414 * allocate kernel pages and assign them to TLB415 */416 static int synth_alloc_pages(struct snd_trident *hw, struct snd_util_memblk *blk)417 {418 int page, first_page, last_page;419 struct snd_dma_buffer dmab;420 421 firstpg(blk) = get_aligned_page(blk->offset);422 lastpg(blk) = get_aligned_page(blk->offset + blk->size - 1);423 get_single_page_range(hw->tlb.memhdr, blk, &first_page, &last_page);424 425 /* allocate a kernel page for each Trident page -426 * fortunately Trident page size and kernel PAGE_SIZE is identical!427 */428 for (page = first_page; page <= last_page; page++) {429 if (snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(hw->pci),430 ALIGN_PAGE_SIZE, &dmab) < 0)431 goto __fail;432 if (! is_valid_page(dmab.addr)) {433 snd_dma_free_pages(&dmab);434 goto __fail;435 }436 set_tlb_bus(hw, page, (unsigned long)dmab.area, dmab.addr);437 }438 return 0;439 440 __fail:441 /* release allocated pages */442 last_page = page - 1;443 for (page = first_page; page <= last_page; page++)444 clear_tlb(hw, page);445 446 return -ENOMEM;447 }448 449 /*450 * free pages451 */452 static int synth_free_pages(struct snd_trident *trident, struct snd_util_memblk *blk)453 {454 int page, first_page, last_page;455 456 get_single_page_range(trident->tlb.memhdr, blk, &first_page, &last_page);457 for (page = first_page; page <= last_page; page++)458 clear_tlb(trident, page);459 460 return 0;461 }462 463 /*464 * copy_from_user(blk + offset, data, size)465 */466 int snd_trident_synth_copy_from_user(struct snd_trident *trident,467 struct snd_util_memblk *blk,468 int offset, const char __user *data, int size)469 {470 int page, nextofs, end_offset, temp, temp1;471 472 offset += blk->offset;473 end_offset = offset + size;474 page = get_aligned_page(offset) + 1;475 do {476 nextofs = aligned_page_offset(page);477 temp = nextofs - offset;478 temp1 = end_offset - offset;479 if (temp1 < temp)480 temp = temp1;481 if (copy_from_user(offset_ptr(trident, offset), data, temp))482 return -EFAULT;483 offset = nextofs;484 data += temp;485 page++;486 } while (offset < end_offset);487 return 0;488 }489 490 EXPORT_SYMBOL(snd_trident_synth_copy_from_user); -
GPL/branches/uniaud32-2.0/alsa-kernel/pci/via82xx.c
r351 r358 1755 1755 .subdevice = 0x0a85, 1756 1756 .name = "ECS L7VMM2", 1757 .type = AC97_TUNE_HP_ONLY 1758 }, 1759 { 1760 .subvendor = 0x1019, 1761 .subdevice = 0x1841, 1762 .name = "ECS K7VTA3", 1757 1763 .type = AC97_TUNE_HP_ONLY 1758 1764 }, … … 2237 2243 for (i = 0; i < chip->num_devs; i++) 2238 2244 snd_via82xx_channel_reset(chip, &chip->devs[i]); 2239 synchronize_irq(chip->irq); 2245 2240 2246 if (chip->irq >= 0) 2241 2247 free_irq(chip->irq, chip); … … 2406 2412 w = snd_pci_quirk_lookup(pci, dxs_whitelist); 2407 2413 if (w) { 2414 #ifndef TARGET_OS2 2408 2415 snd_printdd(KERN_INFO "via82xx: DXS white list for %s found\n", 2409 2416 w->name); 2417 #endif 2410 2418 return w->value; 2411 2419 } -
GPL/branches/uniaud32-2.0/alsa-kernel/pci/ymfpci/ymfpci_main.c
r305 r358 2217 2217 snd_ymfpci_writel(chip, reg, 0); 2218 2218 snd_ymfpci_writel(chip, YDSXGR_NATIVEDACOUTVOL, 0x3fff3fff); 2219 snd_ymfpci_writel(chip, YDSXGR_BUF441OUTVOL, 0x3fff3fff); 2219 2220 snd_ymfpci_writel(chip, YDSXGR_ZVOUTVOL, 0x3fff3fff); 2220 2221 snd_ymfpci_writel(chip, YDSXGR_SPDIFOUTVOL, 0x3fff3fff); … … 2261 2262 vfree(chip->saved_regs); 2262 2263 #endif 2264 if (chip->irq >= 0) 2265 free_irq(chip->irq, chip); 2263 2266 release_and_free_resource(chip->mpu_res); 2264 2267 release_and_free_resource(chip->fm_res); … … 2269 2272 snd_dma_free_pages(&chip->work_ptr); 2270 2273 2271 if (chip->irq >= 0)2272 free_irq(chip->irq, chip);2273 2274 release_and_free_resource(chip->res_reg_area); 2274 2275 … … 2336 2337 chip->saved_ydsxgr_mode = snd_ymfpci_readl(chip, YDSXGR_MODE); 2337 2338 snd_ymfpci_writel(chip, YDSXGR_NATIVEDACOUTVOL, 0); 2339 snd_ymfpci_writel(chip, YDSXGR_BUF441OUTVOL, 0); 2338 2340 snd_ymfpci_disable_dsp(chip); 2339 2341 pci_disable_device(pci); -
GPL/branches/uniaud32-2.0/alsa-kernel/synth/emux/emux_synth.c
r305 r358 342 342 #ifdef SNDRV_EMUX_USE_RAW_EFFECT 343 343 /* FIXME: this is an emulation */ 344 snd_emux_send_effect(port, chan, EMUX_FX_CUTOFF, -160, 344 if (chan->control[type] >= 64) 345 snd_emux_send_effect(port, chan, EMUX_FX_CUTOFF, -160, 345 346 EMUX_FX_FLAG_ADD); 347 else 348 snd_emux_send_effect(port, chan, EMUX_FX_CUTOFF, 0, 349 EMUX_FX_FLAG_OFF); 346 350 #endif 347 351 break; -
GPL/branches/uniaud32-2.0/uniaud.inc
r357 r358 7 7 # BUILDVERSION must be 3 parts, and only numbers like 5.44.108 8 8 # It is best that 2'nd number is always 2 digits, eg at least 10 9 BUILDVERSION = 1.9. 49 BUILDVERSION = 1.9.5 10 10 11 11 # Fixpack version … … 13 13 # ex RC3 GA FIXPACK2 beta_47 14 14 # Comment out to avoid a fixpack line in bldlevel 15 FIXPACK = SVN r35 715 FIXPACK = SVN r358 16 16 17 17 # ALSA BUILD VERSION … … 20 20 # Leave empty or use MIXED 21 21 # STRING must be max X chars 22 ALSAVERSION = 1.0.1 622 ALSAVERSION = 1.0.17 23 23
Note:
See TracChangeset
for help on using the changeset viewer.