···5757a case, you can change the default method via `position_fix` option.58585959`position_fix=1` means to use LPIB method explicitly.6060-`position_fix=2` means to use the position-buffer. 0 is the default6161-value, the automatic check and fallback to LPIB as described in the6262-above. If you get a problem of repeated sounds, this option might6060+`position_fix=2` means to use the position-buffer.6161+`position_fix=3` means to use a combination of both methods, needed6262+for some VIA and ATI controllers. 0 is the default value for all other6363+controllers, the automatic check and fallback to LPIB as described in6464+the above. If you get a problem of repeated sounds, this option might6365help.64666567In addition to that, every controller is known to be broken regarding
···119119 snd-hda-codec-via.120120 This module is automatically loaded at probing.121121122122-config SND_HDA_CODEC_ATIHDMI123123- bool "Build ATI HDMI HD-audio codec support"124124- default y125125- help126126- Say Y here to include ATI HDMI HD-audio codec support in127127- snd-hda-intel driver, such as ATI RS600 HDMI.128128-129129- When the HD-audio driver is built as a module, the codec130130- support code is also built as another module,131131- snd-hda-codec-atihdmi.132132- This module is automatically loaded at probing.133133-134134-config SND_HDA_CODEC_NVHDMI135135- bool "Build NVIDIA HDMI HD-audio codec support"136136- default y137137- help138138- Say Y here to include NVIDIA HDMI HD-audio codec support in139139- snd-hda-intel driver, such as NVIDIA MCP78 HDMI.140140-141141- When the HD-audio driver is built as a module, the codec142142- support code is also built as another module,143143- snd-hda-codec-nvhdmi.144144- This module is automatically loaded at probing.145145-146146-config SND_HDA_CODEC_INTELHDMI147147- bool "Build INTEL HDMI HD-audio codec support"122122+config SND_HDA_CODEC_HDMI123123+ bool "Build HDMI/DisplayPort HD-audio codec support"148124 select SND_DYNAMIC_MINORS149125 default y150126 help151151- Say Y here to include INTEL HDMI HD-audio codec support in152152- snd-hda-intel driver, such as Eaglelake integrated HDMI.127127+ Say Y here to include HDMI and DisplayPort HD-audio codec128128+ support in snd-hda-intel driver. This includes all AMD/ATI,129129+ Intel and Nvidia HDMI/DisplayPort codecs.153130154131 When the HD-audio driver is built as a module, the codec155132 support code is also built as another module,156156- snd-hda-codec-intelhdmi.133133+ snd-hda-codec-hdmi.157134 This module is automatically loaded at probing.158158-159159-config SND_HDA_ELD160160- def_bool y161161- depends on SND_HDA_CODEC_INTELHDMI || SND_HDA_CODEC_NVHDMI162135163136config SND_HDA_CODEC_CIRRUS164137 bool "Build Cirrus Logic codec support"
+3-12
sound/pci/hda/Makefile
···33snd-hda-codec-y := hda_codec.o44snd-hda-codec-$(CONFIG_SND_HDA_GENERIC) += hda_generic.o55snd-hda-codec-$(CONFIG_PROC_FS) += hda_proc.o66-snd-hda-codec-$(CONFIG_SND_HDA_ELD) += hda_eld.o76snd-hda-codec-$(CONFIG_SND_HDA_HWDEP) += hda_hwdep.o87snd-hda-codec-$(CONFIG_SND_HDA_INPUT_BEEP) += hda_beep.o98···1112snd-hda-codec-analog-objs := patch_analog.o1213snd-hda-codec-idt-objs := patch_sigmatel.o1314snd-hda-codec-si3054-objs := patch_si3054.o1414-snd-hda-codec-atihdmi-objs := patch_atihdmi.o1515snd-hda-codec-cirrus-objs := patch_cirrus.o1616snd-hda-codec-ca0110-objs := patch_ca0110.o1717snd-hda-codec-conexant-objs := patch_conexant.o1818snd-hda-codec-via-objs := patch_via.o1919-snd-hda-codec-nvhdmi-objs := patch_nvhdmi.o2020-snd-hda-codec-intelhdmi-objs := patch_intelhdmi.o1919+snd-hda-codec-hdmi-objs := patch_hdmi.o hda_eld.o21202221# common driver2322obj-$(CONFIG_SND_HDA_INTEL) := snd-hda-codec.o···3639ifdef CONFIG_SND_HDA_CODEC_SI30543740obj-$(CONFIG_SND_HDA_INTEL) += snd-hda-codec-si3054.o3841endif3939-ifdef CONFIG_SND_HDA_CODEC_ATIHDMI4040-obj-$(CONFIG_SND_HDA_INTEL) += snd-hda-codec-atihdmi.o4141-endif4242ifdef CONFIG_SND_HDA_CODEC_CIRRUS4343obj-$(CONFIG_SND_HDA_INTEL) += snd-hda-codec-cirrus.o4444endif···4854ifdef CONFIG_SND_HDA_CODEC_VIA4955obj-$(CONFIG_SND_HDA_INTEL) += snd-hda-codec-via.o5056endif5151-ifdef CONFIG_SND_HDA_CODEC_NVHDMI5252-obj-$(CONFIG_SND_HDA_INTEL) += snd-hda-codec-nvhdmi.o5353-endif5454-ifdef CONFIG_SND_HDA_CODEC_INTELHDMI5555-obj-$(CONFIG_SND_HDA_INTEL) += snd-hda-codec-intelhdmi.o5757+ifdef CONFIG_SND_HDA_CODEC_HDMI5858+obj-$(CONFIG_SND_HDA_INTEL) += snd-hda-codec-hdmi.o5659endif57605861# this must be the last entry after codec drivers;
+216-55
sound/pci/hda/hda_codec.c
···12161216 struct hda_codec *c;12171217 struct hda_cvt_setup *p;12181218 unsigned int oldval, newval;12191219+ int type;12191220 int i;1220122112211222 if (!nid)···12551254 p->dirty = 0;1256125512571256 /* make other inactive cvts with the same stream-tag dirty */12571257+ type = get_wcaps_type(get_wcaps(codec, nid));12581258 list_for_each_entry(c, &codec->bus->codec_list, list) {12591259 for (i = 0; i < c->cvt_setups.used; i++) {12601260 p = snd_array_elem(&c->cvt_setups, i);12611261- if (!p->active && p->stream_tag == stream_tag)12611261+ if (!p->active && p->stream_tag == stream_tag &&12621262+ get_wcaps_type(get_wcaps(codec, p->nid)) == type)12621263 p->dirty = 1;12631264 }12641265 }···1283128012841281 if (!nid)12851282 return;12831283+12841284+ if (codec->no_sticky_stream)12851285+ do_now = 1;1286128612871287 snd_printdd("hda_codec_cleanup_stream: NID=0x%x\n", nid);12881288 p = get_hda_cvt_setup(codec, nid);···18371831 hda_nid_t nid = get_amp_nid(kcontrol);18381832 int dir = get_amp_direction(kcontrol);18391833 unsigned int ofs = get_amp_offset(kcontrol);18341834+ bool min_mute = get_amp_min_mute(kcontrol);18401835 u32 caps, val1, val2;1841183618421837 if (size < 4 * sizeof(unsigned int))···18481841 val1 = -((caps & AC_AMPCAP_OFFSET) >> AC_AMPCAP_OFFSET_SHIFT);18491842 val1 += ofs;18501843 val1 = ((int)val1) * ((int)val2);18441844+ if (min_mute)18451845+ val2 |= TLV_DB_SCALE_MUTE;18511846 if (put_user(SNDRV_CTL_TLVT_DB_SCALE, _tlv))18521847 return -EFAULT;18531848 if (put_user(2 * sizeof(unsigned int), _tlv + 1))···22372228 change |= snd_hda_codec_amp_update(codec, nid, 1, dir, idx,22382229 HDA_AMP_MUTE,22392230 *valp ? 0 : HDA_AMP_MUTE);22402240-#ifdef CONFIG_SND_HDA_POWER_SAVE22412241- if (codec->patch_ops.check_power_status)22422242- codec->patch_ops.check_power_status(codec, nid);22432243-#endif22312231+ hda_call_check_power_status(codec, nid);22442232 snd_hda_power_down(codec);22452233 return change;22462234}···43784372}437943734380437443754375+/* add the found input-pin to the cfg->inputs[] table */43764376+static void add_auto_cfg_input_pin(struct auto_pin_cfg *cfg, hda_nid_t nid,43774377+ int type)43784378+{43794379+ if (cfg->num_inputs < AUTO_CFG_MAX_INS) {43804380+ cfg->inputs[cfg->num_inputs].pin = nid;43814381+ cfg->inputs[cfg->num_inputs].type = type;43824382+ cfg->num_inputs++;43834383+ }43844384+}43854385+43864386+/* sort inputs in the order of AUTO_PIN_* type */43874387+static void sort_autocfg_input_pins(struct auto_pin_cfg *cfg)43884388+{43894389+ int i, j;43904390+43914391+ for (i = 0; i < cfg->num_inputs; i++) {43924392+ for (j = i + 1; j < cfg->num_inputs; j++) {43934393+ if (cfg->inputs[i].type > cfg->inputs[j].type) {43944394+ struct auto_pin_cfg_item tmp;43954395+ tmp = cfg->inputs[i];43964396+ cfg->inputs[i] = cfg->inputs[j];43974397+ cfg->inputs[j] = tmp;43984398+ }43994399+ }44004400+ }44014401+}44024402+43814403/*43824404 * Parse all pin widgets and store the useful pin nids to cfg43834405 *···44194385 * output, i.e. to line_out_pins[0]. So, line_outs is always positive44204386 * if any analog output exists.44214387 *44224422- * The analog input pins are assigned to input_pins array.43884388+ * The analog input pins are assigned to inputs array.44234389 * The digital input/output pins are assigned to dig_in_pin and dig_out_pin,44244390 * respectively.44254391 */···44324398 short sequences_line_out[ARRAY_SIZE(cfg->line_out_pins)];44334399 short sequences_speaker[ARRAY_SIZE(cfg->speaker_pins)];44344400 short sequences_hp[ARRAY_SIZE(cfg->hp_pins)];44014401+ int i;4435440244364403 memset(cfg, 0, sizeof(*cfg));44374404···45034468 sequences_hp[cfg->hp_outs] = (assoc << 4) | seq;45044469 cfg->hp_outs++;45054470 break;45064506- case AC_JACK_MIC_IN: {45074507- int preferred, alt;45084508- if (loc == AC_JACK_LOC_FRONT ||45094509- (loc & 0x30) == AC_JACK_LOC_INTERNAL) {45104510- preferred = AUTO_PIN_FRONT_MIC;45114511- alt = AUTO_PIN_MIC;45124512- } else {45134513- preferred = AUTO_PIN_MIC;45144514- alt = AUTO_PIN_FRONT_MIC;45154515- }45164516- if (!cfg->input_pins[preferred])45174517- cfg->input_pins[preferred] = nid;45184518- else if (!cfg->input_pins[alt])45194519- cfg->input_pins[alt] = nid;44714471+ case AC_JACK_MIC_IN:44724472+ add_auto_cfg_input_pin(cfg, nid, AUTO_PIN_MIC);45204473 break;45214521- }45224474 case AC_JACK_LINE_IN:45234523- if (loc == AC_JACK_LOC_FRONT)45244524- cfg->input_pins[AUTO_PIN_FRONT_LINE] = nid;45254525- else45264526- cfg->input_pins[AUTO_PIN_LINE] = nid;44754475+ add_auto_cfg_input_pin(cfg, nid, AUTO_PIN_LINE_IN);45274476 break;45284477 case AC_JACK_CD:45294529- cfg->input_pins[AUTO_PIN_CD] = nid;44784478+ add_auto_cfg_input_pin(cfg, nid, AUTO_PIN_CD);45304479 break;45314480 case AC_JACK_AUX:45324532- cfg->input_pins[AUTO_PIN_AUX] = nid;44814481+ add_auto_cfg_input_pin(cfg, nid, AUTO_PIN_AUX);45334482 break;45344483 case AC_JACK_SPDIF_OUT:45354484 case AC_JACK_DIG_OTHER_OUT:···45584539 memmove(sequences_hp + i, sequences_hp + i + 1,45594540 sizeof(sequences_hp[0]) * (cfg->hp_outs - i));45604541 }45424542+ memset(cfg->hp_pins + cfg->hp_outs, 0,45434543+ sizeof(hda_nid_t) * (AUTO_CFG_MAX_OUTS - cfg->hp_outs));45614544 }4562454545634546 /* sort by sequence */···45694548 cfg->speaker_outs);45704549 sort_pins_by_sequence(cfg->hp_pins, sequences_hp,45714550 cfg->hp_outs);45724572-45734573- /* if we have only one mic, make it AUTO_PIN_MIC */45744574- if (!cfg->input_pins[AUTO_PIN_MIC] &&45754575- cfg->input_pins[AUTO_PIN_FRONT_MIC]) {45764576- cfg->input_pins[AUTO_PIN_MIC] =45774577- cfg->input_pins[AUTO_PIN_FRONT_MIC];45784578- cfg->input_pins[AUTO_PIN_FRONT_MIC] = 0;45794579- }45804580- /* ditto for line-in */45814581- if (!cfg->input_pins[AUTO_PIN_LINE] &&45824582- cfg->input_pins[AUTO_PIN_FRONT_LINE]) {45834583- cfg->input_pins[AUTO_PIN_LINE] =45844584- cfg->input_pins[AUTO_PIN_FRONT_LINE];45854585- cfg->input_pins[AUTO_PIN_FRONT_LINE] = 0;45864586- }4587455145884552 /*45894553 * FIX-UP: if no line-outs are detected, try to use speaker or HP pin···46084602 break;46094603 }4610460446054605+ sort_autocfg_input_pins(cfg);46064606+46114607 /*46124608 * debug prints of the parsed results46134609 */···46294621 if (cfg->dig_outs)46304622 snd_printd(" dig-out=0x%x/0x%x\n",46314623 cfg->dig_out_pins[0], cfg->dig_out_pins[1]);46324632- snd_printd(" inputs: mic=0x%x, fmic=0x%x, line=0x%x, fline=0x%x,"46334633- " cd=0x%x, aux=0x%x\n",46344634- cfg->input_pins[AUTO_PIN_MIC],46354635- cfg->input_pins[AUTO_PIN_FRONT_MIC],46364636- cfg->input_pins[AUTO_PIN_LINE],46374637- cfg->input_pins[AUTO_PIN_FRONT_LINE],46384638- cfg->input_pins[AUTO_PIN_CD],46394639- cfg->input_pins[AUTO_PIN_AUX]);46244624+ snd_printd(" inputs:");46254625+ for (i = 0; i < cfg->num_inputs; i++) {46264626+ snd_printdd(" %s=0x%x",46274627+ hda_get_autocfg_input_label(codec, cfg, i),46284628+ cfg->inputs[i].pin);46294629+ }46304630+ snd_printd("\n");46404631 if (cfg->dig_in_pin)46414632 snd_printd(" dig-in=0x%x\n", cfg->dig_in_pin);46424633···46434636}46444637EXPORT_SYMBOL_HDA(snd_hda_parse_pin_def_config);4645463846464646-/* labels for input pins */46474647-const char *auto_pin_cfg_labels[AUTO_PIN_LAST] = {46484648- "Mic", "Front Mic", "Line", "Front Line", "CD", "Aux"46494649-};46504650-EXPORT_SYMBOL_HDA(auto_pin_cfg_labels);46394639+int snd_hda_get_input_pin_attr(unsigned int def_conf)46404640+{46414641+ unsigned int loc = get_defcfg_location(def_conf);46424642+ unsigned int conn = get_defcfg_connect(def_conf);46434643+ if (conn == AC_JACK_PORT_NONE)46444644+ return INPUT_PIN_ATTR_UNUSED;46454645+ /* Windows may claim the internal mic to be BOTH, too */46464646+ if (conn == AC_JACK_PORT_FIXED || conn == AC_JACK_PORT_BOTH)46474647+ return INPUT_PIN_ATTR_INT;46484648+ if ((loc & 0x30) == AC_JACK_LOC_INTERNAL)46494649+ return INPUT_PIN_ATTR_INT;46504650+ if ((loc & 0x30) == AC_JACK_LOC_SEPARATE)46514651+ return INPUT_PIN_ATTR_DOCK;46524652+ if (loc == AC_JACK_LOC_REAR)46534653+ return INPUT_PIN_ATTR_REAR;46544654+ if (loc == AC_JACK_LOC_FRONT)46554655+ return INPUT_PIN_ATTR_FRONT;46564656+ return INPUT_PIN_ATTR_NORMAL;46574657+}46584658+EXPORT_SYMBOL_HDA(snd_hda_get_input_pin_attr);46594659+46604660+/**46614661+ * hda_get_input_pin_label - Give a label for the given input pin46624662+ *46634663+ * When check_location is true, the function checks the pin location46644664+ * for mic and line-in pins, and set an appropriate prefix like "Front",46654665+ * "Rear", "Internal".46664666+ */46674667+46684668+const char *hda_get_input_pin_label(struct hda_codec *codec, hda_nid_t pin,46694669+ int check_location)46704670+{46714671+ unsigned int def_conf;46724672+ static const char *mic_names[] = {46734673+ "Internal Mic", "Dock Mic", "Mic", "Front Mic", "Rear Mic",46744674+ };46754675+ int attr;46764676+46774677+ def_conf = snd_hda_codec_get_pincfg(codec, pin);46784678+46794679+ switch (get_defcfg_device(def_conf)) {46804680+ case AC_JACK_MIC_IN:46814681+ if (!check_location)46824682+ return "Mic";46834683+ attr = snd_hda_get_input_pin_attr(def_conf);46844684+ if (!attr)46854685+ return "None";46864686+ return mic_names[attr - 1];46874687+ case AC_JACK_LINE_IN:46884688+ if (!check_location)46894689+ return "Line";46904690+ attr = snd_hda_get_input_pin_attr(def_conf);46914691+ if (!attr)46924692+ return "None";46934693+ if (attr == INPUT_PIN_ATTR_DOCK)46944694+ return "Dock Line";46954695+ return "Line";46964696+ case AC_JACK_AUX:46974697+ return "Aux";46984698+ case AC_JACK_CD:46994699+ return "CD";47004700+ case AC_JACK_SPDIF_IN:47014701+ return "SPDIF In";47024702+ case AC_JACK_DIG_OTHER_IN:47034703+ return "Digital In";47044704+ default:47054705+ return "Misc";47064706+ }47074707+}47084708+EXPORT_SYMBOL_HDA(hda_get_input_pin_label);47094709+47104710+/* Check whether the location prefix needs to be added to the label.47114711+ * If all mic-jacks are in the same location (e.g. rear panel), we don't47124712+ * have to put "Front" prefix to each label. In such a case, returns false.47134713+ */47144714+static int check_mic_location_need(struct hda_codec *codec,47154715+ const struct auto_pin_cfg *cfg,47164716+ int input)47174717+{47184718+ unsigned int defc;47194719+ int i, attr, attr2;47204720+47214721+ defc = snd_hda_codec_get_pincfg(codec, cfg->inputs[input].pin);47224722+ attr = snd_hda_get_input_pin_attr(defc);47234723+ /* for internal or docking mics, we need locations */47244724+ if (attr <= INPUT_PIN_ATTR_NORMAL)47254725+ return 1;47264726+47274727+ attr = 0;47284728+ for (i = 0; i < cfg->num_inputs; i++) {47294729+ defc = snd_hda_codec_get_pincfg(codec, cfg->inputs[i].pin);47304730+ attr2 = snd_hda_get_input_pin_attr(defc);47314731+ if (attr2 >= INPUT_PIN_ATTR_NORMAL) {47324732+ if (attr && attr != attr2)47334733+ return 1; /* different locations found */47344734+ attr = attr2;47354735+ }47364736+ }47374737+ return 0;47384738+}47394739+47404740+/**47414741+ * hda_get_autocfg_input_label - Get a label for the given input47424742+ *47434743+ * Get a label for the given input pin defined by the autocfg item.47444744+ * Unlike hda_get_input_pin_label(), this function checks all inputs47454745+ * defined in autocfg and avoids the redundant mic/line prefix as much as47464746+ * possible.47474747+ */47484748+const char *hda_get_autocfg_input_label(struct hda_codec *codec,47494749+ const struct auto_pin_cfg *cfg,47504750+ int input)47514751+{47524752+ int type = cfg->inputs[input].type;47534753+ int has_multiple_pins = 0;47544754+47554755+ if ((input > 0 && cfg->inputs[input - 1].type == type) ||47564756+ (input < cfg->num_inputs - 1 && cfg->inputs[input + 1].type == type))47574757+ has_multiple_pins = 1;47584758+ if (has_multiple_pins && type == AUTO_PIN_MIC)47594759+ has_multiple_pins &= check_mic_location_need(codec, cfg, input);47604760+ return hda_get_input_pin_label(codec, cfg->inputs[input].pin,47614761+ has_multiple_pins);47624762+}47634763+EXPORT_SYMBOL_HDA(hda_get_autocfg_input_label);47644764+47654765+/**47664766+ * snd_hda_add_imux_item - Add an item to input_mux47674767+ *47684768+ * When the same label is used already in the existing items, the number47694769+ * suffix is appended to the label. This label index number is stored47704770+ * to type_idx when non-NULL pointer is given.47714771+ */47724772+int snd_hda_add_imux_item(struct hda_input_mux *imux, const char *label,47734773+ int index, int *type_idx)47744774+{47754775+ int i, label_idx = 0;47764776+ if (imux->num_items >= HDA_MAX_NUM_INPUTS) {47774777+ snd_printd(KERN_ERR "hda_codec: Too many imux items!\n");47784778+ return -EINVAL;47794779+ }47804780+ for (i = 0; i < imux->num_items; i++) {47814781+ if (!strncmp(label, imux->items[i].label, strlen(label)))47824782+ label_idx++;47834783+ }47844784+ if (type_idx)47854785+ *type_idx = label_idx;47864786+ if (label_idx > 0)47874787+ snprintf(imux->items[imux->num_items].label,47884788+ sizeof(imux->items[imux->num_items].label),47894789+ "%s %d", label, label_idx);47904790+ else47914791+ strlcpy(imux->items[imux->num_items].label, label,47924792+ sizeof(imux->items[imux->num_items].label));47934793+ imux->items[imux->num_items].index = index;47944794+ imux->num_items++;47954795+ return 0;47964796+}47974797+EXPORT_SYMBOL_HDA(snd_hda_add_imux_item);465147984652479946534800#ifdef CONFIG_PM
+13
sound/pci/hda/hda_codec.h
···850850 unsigned int pin_amp_workaround:1; /* pin out-amp takes index851851 * (e.g. Conexant codecs)852852 */853853+ unsigned int no_sticky_stream:1; /* no sticky-PCM stream assignment */853854 unsigned int pins_shutup:1; /* pins are shut up */854855 unsigned int no_trigger_sense:1; /* don't trigger at pin-sensing */855856#ifdef CONFIG_SND_HDA_POWER_SAVE···988987#ifdef CONFIG_PM989988int snd_hda_suspend(struct hda_bus *bus);990989int snd_hda_resume(struct hda_bus *bus);990990+#endif991991+992992+#ifdef CONFIG_SND_HDA_POWER_SAVE993993+static inline994994+int hda_call_check_power_status(struct hda_codec *codec, hda_nid_t nid)995995+{996996+ if (codec->patch_ops.check_power_status)997997+ return codec->patch_ops.check_power_status(codec, nid);998998+ return 0;999999+}10001000+#else 10011001+#define hda_call_check_power_status(codec, nid) 09911002#endif99210039931004/*