📄 intel8x0.c
字号:
.hw_free = snd_intel8x0_hw_free, .prepare = snd_intel8x0_pcm_prepare, .trigger = snd_intel8x0_ali_trigger, .pointer = snd_intel8x0_pcm_pointer,};static struct snd_pcm_ops snd_intel8x0_ali_capture_ops = { .open = snd_intel8x0_capture_open, .close = snd_intel8x0_capture_close, .ioctl = snd_pcm_lib_ioctl, .hw_params = snd_intel8x0_hw_params, .hw_free = snd_intel8x0_hw_free, .prepare = snd_intel8x0_pcm_prepare, .trigger = snd_intel8x0_ali_trigger, .pointer = snd_intel8x0_pcm_pointer,};static struct snd_pcm_ops snd_intel8x0_ali_capture_mic_ops = { .open = snd_intel8x0_mic_open, .close = snd_intel8x0_mic_close, .ioctl = snd_pcm_lib_ioctl, .hw_params = snd_intel8x0_hw_params, .hw_free = snd_intel8x0_hw_free, .prepare = snd_intel8x0_pcm_prepare, .trigger = snd_intel8x0_ali_trigger, .pointer = snd_intel8x0_pcm_pointer,};static struct snd_pcm_ops snd_intel8x0_ali_ac97spdifout_ops = { .open = snd_intel8x0_ali_ac97spdifout_open, .close = snd_intel8x0_ali_ac97spdifout_close, .ioctl = snd_pcm_lib_ioctl, .hw_params = snd_intel8x0_hw_params, .hw_free = snd_intel8x0_hw_free, .prepare = snd_intel8x0_pcm_prepare, .trigger = snd_intel8x0_ali_trigger, .pointer = snd_intel8x0_pcm_pointer,};#if 0 // NYIstatic struct snd_pcm_ops snd_intel8x0_ali_spdifin_ops = { .open = snd_intel8x0_ali_spdifin_open, .close = snd_intel8x0_ali_spdifin_close, .ioctl = snd_pcm_lib_ioctl, .hw_params = snd_intel8x0_hw_params, .hw_free = snd_intel8x0_hw_free, .prepare = snd_intel8x0_pcm_prepare, .trigger = snd_intel8x0_pcm_trigger, .pointer = snd_intel8x0_pcm_pointer,};static struct snd_pcm_ops snd_intel8x0_ali_spdifout_ops = { .open = snd_intel8x0_ali_spdifout_open, .close = snd_intel8x0_ali_spdifout_close, .ioctl = snd_pcm_lib_ioctl, .hw_params = snd_intel8x0_hw_params, .hw_free = snd_intel8x0_hw_free, .prepare = snd_intel8x0_pcm_prepare, .trigger = snd_intel8x0_pcm_trigger, .pointer = snd_intel8x0_pcm_pointer,};#endif // NYIstruct ich_pcm_table { char *suffix; struct snd_pcm_ops *playback_ops; struct snd_pcm_ops *capture_ops; size_t prealloc_size; size_t prealloc_max_size; int ac97_idx;};static int __devinit snd_intel8x0_pcm1(struct intel8x0 *chip, int device, struct ich_pcm_table *rec){ struct snd_pcm *pcm; int err; char name[32]; if (rec->suffix) sprintf(name, "Intel ICH - %s", rec->suffix); else strcpy(name, "Intel ICH"); err = snd_pcm_new(chip->card, name, device, rec->playback_ops ? 1 : 0, rec->capture_ops ? 1 : 0, &pcm); if (err < 0) return err; if (rec->playback_ops) snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, rec->playback_ops); if (rec->capture_ops) snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, rec->capture_ops); pcm->private_data = chip; pcm->info_flags = 0; if (rec->suffix) sprintf(pcm->name, "%s - %s", chip->card->shortname, rec->suffix); else strcpy(pcm->name, chip->card->shortname); chip->pcm[device] = pcm; snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(chip->pci), rec->prealloc_size, rec->prealloc_max_size); return 0;}static struct ich_pcm_table intel_pcms[] __devinitdata = { { .playback_ops = &snd_intel8x0_playback_ops, .capture_ops = &snd_intel8x0_capture_ops, .prealloc_size = 64 * 1024, .prealloc_max_size = 128 * 1024, }, { .suffix = "MIC ADC", .capture_ops = &snd_intel8x0_capture_mic_ops, .prealloc_size = 0, .prealloc_max_size = 128 * 1024, .ac97_idx = ICHD_MIC, }, { .suffix = "MIC2 ADC", .capture_ops = &snd_intel8x0_capture_mic2_ops, .prealloc_size = 0, .prealloc_max_size = 128 * 1024, .ac97_idx = ICHD_MIC2, }, { .suffix = "ADC2", .capture_ops = &snd_intel8x0_capture2_ops, .prealloc_size = 0, .prealloc_max_size = 128 * 1024, .ac97_idx = ICHD_PCM2IN, }, { .suffix = "IEC958", .playback_ops = &snd_intel8x0_spdif_ops, .prealloc_size = 64 * 1024, .prealloc_max_size = 128 * 1024, .ac97_idx = ICHD_SPBAR, },};static struct ich_pcm_table nforce_pcms[] __devinitdata = { { .playback_ops = &snd_intel8x0_playback_ops, .capture_ops = &snd_intel8x0_capture_ops, .prealloc_size = 64 * 1024, .prealloc_max_size = 128 * 1024, }, { .suffix = "MIC ADC", .capture_ops = &snd_intel8x0_capture_mic_ops, .prealloc_size = 0, .prealloc_max_size = 128 * 1024, .ac97_idx = NVD_MIC, }, { .suffix = "IEC958", .playback_ops = &snd_intel8x0_spdif_ops, .prealloc_size = 64 * 1024, .prealloc_max_size = 128 * 1024, .ac97_idx = NVD_SPBAR, },};static struct ich_pcm_table ali_pcms[] __devinitdata = { { .playback_ops = &snd_intel8x0_ali_playback_ops, .capture_ops = &snd_intel8x0_ali_capture_ops, .prealloc_size = 64 * 1024, .prealloc_max_size = 128 * 1024, }, { .suffix = "MIC ADC", .capture_ops = &snd_intel8x0_ali_capture_mic_ops, .prealloc_size = 0, .prealloc_max_size = 128 * 1024, .ac97_idx = ALID_MIC, }, { .suffix = "IEC958", .playback_ops = &snd_intel8x0_ali_ac97spdifout_ops, /* .capture_ops = &snd_intel8x0_ali_spdifin_ops, */ .prealloc_size = 64 * 1024, .prealloc_max_size = 128 * 1024, .ac97_idx = ALID_AC97SPDIFOUT, },#if 0 // NYI { .suffix = "HW IEC958", .playback_ops = &snd_intel8x0_ali_spdifout_ops, .prealloc_size = 64 * 1024, .prealloc_max_size = 128 * 1024, },#endif};static int __devinit snd_intel8x0_pcm(struct intel8x0 *chip){ int i, tblsize, device, err; struct ich_pcm_table *tbl, *rec; switch (chip->device_type) { case DEVICE_INTEL_ICH4: tbl = intel_pcms; tblsize = ARRAY_SIZE(intel_pcms); if (spdif_aclink) tblsize--; break; case DEVICE_NFORCE: tbl = nforce_pcms; tblsize = ARRAY_SIZE(nforce_pcms); if (spdif_aclink) tblsize--; break; case DEVICE_ALI: tbl = ali_pcms; tblsize = ARRAY_SIZE(ali_pcms); break; default: tbl = intel_pcms; tblsize = 2; break; } device = 0; for (i = 0; i < tblsize; i++) { rec = tbl + i; if (i > 0 && rec->ac97_idx) { /* activate PCM only when associated AC'97 codec */ if (! chip->ichd[rec->ac97_idx].pcm) continue; } err = snd_intel8x0_pcm1(chip, device, rec); if (err < 0) return err; device++; } chip->pcm_devs = device; return 0;} /* * Mixer part */static void snd_intel8x0_mixer_free_ac97_bus(struct snd_ac97_bus *bus){ struct intel8x0 *chip = bus->private_data; chip->ac97_bus = NULL;}static void snd_intel8x0_mixer_free_ac97(struct snd_ac97 *ac97){ struct intel8x0 *chip = ac97->private_data; chip->ac97[ac97->num] = NULL;}static struct ac97_pcm ac97_pcm_defs[] __devinitdata = { /* front PCM */ { .exclusive = 1, .r = { { .slots = (1 << AC97_SLOT_PCM_LEFT) | (1 << AC97_SLOT_PCM_RIGHT) | (1 << AC97_SLOT_PCM_CENTER) | (1 << AC97_SLOT_PCM_SLEFT) | (1 << AC97_SLOT_PCM_SRIGHT) | (1 << AC97_SLOT_LFE) }, { .slots = (1 << AC97_SLOT_PCM_LEFT) | (1 << AC97_SLOT_PCM_RIGHT) | (1 << AC97_SLOT_PCM_LEFT_0) | (1 << AC97_SLOT_PCM_RIGHT_0) } } }, /* PCM IN #1 */ { .stream = 1, .exclusive = 1, .r = { { .slots = (1 << AC97_SLOT_PCM_LEFT) | (1 << AC97_SLOT_PCM_RIGHT) } } }, /* MIC IN #1 */ { .stream = 1, .exclusive = 1, .r = { { .slots = (1 << AC97_SLOT_MIC) } } }, /* S/PDIF PCM */ { .exclusive = 1, .spdif = 1, .r = { { .slots = (1 << AC97_SLOT_SPDIF_LEFT2) | (1 << AC97_SLOT_SPDIF_RIGHT2) } } }, /* PCM IN #2 */ { .stream = 1, .exclusive = 1, .r = { { .slots = (1 << AC97_SLOT_PCM_LEFT) | (1 << AC97_SLOT_PCM_RIGHT) } } }, /* MIC IN #2 */ { .stream = 1, .exclusive = 1, .r = { { .slots = (1 << AC97_SLOT_MIC) } } },};static struct ac97_quirk ac97_quirks[] __devinitdata = { { .subvendor = 0x0e11, .subdevice = 0x008a, .name = "Compaq Evo W4000", /* AD1885 */ .type = AC97_TUNE_HP_ONLY }, { .subvendor = 0x0e11, .subdevice = 0x00b8, .name = "Compaq Evo D510C", .type = AC97_TUNE_HP_ONLY }, { .subvendor = 0x0e11, .subdevice = 0x0860, .name = "HP/Compaq nx7010", .type = AC97_TUNE_MUTE_LED }, { .subvendor = 0x1014, .subdevice = 0x1f00, .name = "MS-9128", .type = AC97_TUNE_ALC_JACK }, { .subvendor = 0x1014, .subdevice = 0x0267, .name = "IBM NetVista A30p", /* AD1981B */ .type = AC97_TUNE_HP_ONLY }, { .subvendor = 0x1025, .subdevice = 0x0083, .name = "Acer Aspire 3003LCi", .type = AC97_TUNE_HP_ONLY }, { .subvendor = 0x1028, .subdevice = 0x00d8, .name = "Dell Precision 530", /* AD1885 */ .type = AC97_TUNE_HP_ONLY }, { .subvendor = 0x1028, .subdevice = 0x010d, .name = "Dell", /* which model? AD1885 */ .type = AC97_TUNE_HP_ONLY }, { .subvendor = 0x1028, .subdevice = 0x0126, .name = "Dell Optiplex GX260", /* AD1981A */ .type = AC97_TUNE_HP_ONLY }, { .subvendor = 0x1028, .subdevice = 0x012c, .name = "Dell Precision 650", /* AD1981A */ .type = AC97_TUNE_HP_ONLY }, { .subvendor = 0x1028, .subdevice = 0x012d, .name = "Dell Precision 450", /* AD1981B*/ .type = AC97_TUNE_HP_ONLY }, { .subvendor = 0x1028, .subdevice = 0x0147, .name = "Dell", /* which model? AD1981B*/ .type = AC97_TUNE_HP_ONLY }, { .subvendor = 0x1028, .subdevice = 0x0151, .name = "Dell Optiplex GX270", /* AD1981B */ .type = AC97_TUNE_HP_ONLY }, { .subvendor = 0x1028, .subdevice = 0x014e, .name = "Dell D800", /* STAC9750/51 */ .type = AC97_TUNE_HP_ONLY }, { .subvendor = 0x1028, .subdevice = 0x0163, .name = "Dell Unknown", /* STAC9750/51 */ .type = AC97_TUNE_HP_ONLY }, { .subvendor = 0x1028, .subdevice = 0x0186, .name = "Dell Latitude D810", /* cf. Malone #41015 */ .type = AC97_TUNE_HP_MUTE_LED }, { .subvendor = 0x1028, .subdevice = 0x0188, .name = "Dell Inspiron 6000", .type = AC97_TUNE_HP_MUTE_LED /* cf. Malone #41015 */ }, { .subvendor = 0x1028, .subdevice = 0x0191, .name = "Dell Inspiron 8600", .type = AC97_TUNE_HP_ONLY }, { .subvendor = 0x103c, .subdevice = 0x006d, .name = "HP zv5000", .type = AC97_TUNE_MUTE_LED /*AD1981B*/ }, { /* FIXME: which codec? */ .subvendor = 0x103c, .subdevice = 0x00c3, .name = "HP xw6000", .type = AC97_TUNE_HP_ONLY }, { .subvendor = 0x103c, .subdevice = 0x088c,
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -