/* * Sort an associated group of pins according to their sequence numbers. * then store it to a pin array.
*/ staticvoid sort_pins_by_sequence(hda_nid_t *pins, struct auto_out_pin *list, int num_pins)
{ int i;
sort(list, num_pins, sizeof(list[0]), compare_seq, NULL); for (i = 0; i < num_pins; i++)
pins[i] = list[i].pin;
}
/* add the found input-pin to the cfg->inputs[] table */ staticvoid add_auto_cfg_input_pin(struct hda_codec *codec, struct auto_pin_cfg *cfg,
hda_nid_t nid, int type)
{ if (cfg->num_inputs < AUTO_CFG_MAX_INS) {
cfg->inputs[cfg->num_inputs].pin = nid;
cfg->inputs[cfg->num_inputs].type = type;
cfg->inputs[cfg->num_inputs].has_boost_on_pin =
nid_has_volume(codec, nid, HDA_INPUT);
cfg->num_inputs++;
}
}
/* If has both hs_mic and hp_mic, pick the hs_mic ahead of hp_mic. */ if (a->is_headset_mic && b->is_headphone_mic) return -1; /* don't swap */ elseif (a->is_headphone_mic && b->is_headset_mic) return 1; /* swap */
/* In case one has boost and the other one has not,
pick the one with boost first. */ if (a->has_boost_on_pin != b->has_boost_on_pin) return (int)(b->has_boost_on_pin - a->has_boost_on_pin);
/* Keep the original order */ return a->order - b->order;
}
/* Reorder the surround channels * ALSA sequence is front/surr/clfe/side * HDA sequence is: * 4-ch: front/surr => OK as it is * 6-ch: front/clfe/surr * 8-ch: front/clfe/rear/side|fc
*/ staticvoid reorder_outputs(unsignedint nums, hda_nid_t *pins)
{ switch (nums) { case 3: case 4:
swap(pins[1], pins[2]); break;
}
}
/* check whether the given pin has a proper pin I/O capability bit */ staticbool check_pincap_validity(struct hda_codec *codec, hda_nid_t pin, unsignedint dev)
{ unsignedint pincap = snd_hda_query_pin_caps(codec, pin);
/* some old hardware don't return the proper pincaps */ if (!pincap) returntrue;
switch (dev) { case AC_JACK_LINE_OUT: case AC_JACK_SPEAKER: case AC_JACK_HP_OUT: case AC_JACK_SPDIF_OUT: case AC_JACK_DIG_OTHER_OUT: return !!(pincap & AC_PINCAP_OUT); default: return !!(pincap & AC_PINCAP_IN);
}
}
staticbool can_be_headset_mic(struct hda_codec *codec, struct auto_pin_cfg_item *item, int seq_number)
{ int attr; unsignedint def_conf; if (item->type != AUTO_PIN_MIC) returnfalse;
if (item->is_headset_mic || item->is_headphone_mic) returnfalse; /* Already assigned */
if (seq_number >= 0) { int seq = get_defcfg_sequence(def_conf); if (seq != seq_number) returnfalse;
}
returntrue;
}
/* * Parse all pin widgets and store the useful pin nids to cfg * * The number of line-outs or any primary output is stored in line_outs, * and the corresponding output pins are assigned to line_out_pins[], * in the order of front, rear, CLFE, side, ... * * If more extra outputs (speaker and headphone) are found, the pins are * assisnged to hp_pins[] and speaker_pins[], respectively. If no line-out jack * is detected, one of speaker of HP pins is assigned as the primary * output, i.e. to line_out_pins[0]. So, line_outs is always positive * if any analog output exists. * * The analog input pins are assigned to inputs array. * The digital input/output pins are assigned to dig_in_pin and dig_out_pin, * respectively.
*/ int snd_hda_parse_pin_defcfg(struct hda_codec *codec, struct auto_pin_cfg *cfg, const hda_nid_t *ignore_nids, unsignedint cond_flags)
{
hda_nid_t nid; short seq, assoc_line_out; struct auto_out_pin line_out[ARRAY_SIZE(cfg->line_out_pins)]; struct auto_out_pin speaker_out[ARRAY_SIZE(cfg->speaker_pins)]; struct auto_out_pin hp_out[ARRAY_SIZE(cfg->hp_pins)]; int i;
if (!snd_hda_get_int_hint(codec, "parser_flags", &i))
cond_flags = i;
/* read all default configuration for pin complex */ if (wid_type != AC_WID_PIN) continue; /* ignore the given nids (e.g. pc-beep returns error) */ if (ignore_nids && is_in_nid_list(nid, ignore_nids)) continue;
def_conf = snd_hda_codec_get_pincfg(codec, nid);
conn = get_defcfg_connect(def_conf); if (conn == AC_JACK_PORT_NONE) continue;
loc = get_defcfg_location(def_conf);
dev = get_defcfg_device(def_conf);
/* workaround for buggy BIOS setups */ if (dev == AC_JACK_LINE_OUT) { if (conn == AC_JACK_PORT_FIXED ||
conn == AC_JACK_PORT_BOTH)
dev = AC_JACK_SPEAKER;
}
if (!check_pincap_validity(codec, nid, dev)) continue;
if (!(wid_caps & AC_WCAP_STEREO)) if (!cfg->mono_out_pin)
cfg->mono_out_pin = nid; if (!assoc) continue; if (!assoc_line_out)
assoc_line_out = assoc; elseif (assoc_line_out != assoc) {
codec_info(codec, "ignore pin 0x%x with mismatching assoc# 0x%x vs 0x%x\n",
nid, assoc, assoc_line_out); continue;
} if (cfg->line_outs >= ARRAY_SIZE(cfg->line_out_pins)) {
codec_info(codec, "ignore pin 0x%x, too many assigned pins\n",
nid); continue;
}
line_out[cfg->line_outs].pin = nid;
line_out[cfg->line_outs].seq = seq;
cfg->line_outs++; break; case AC_JACK_SPEAKER:
seq = get_defcfg_sequence(def_conf);
assoc = get_defcfg_association(def_conf); if (cfg->speaker_outs >= ARRAY_SIZE(cfg->speaker_pins)) {
codec_info(codec, "ignore pin 0x%x, too many assigned pins\n",
nid); continue;
}
speaker_out[cfg->speaker_outs].pin = nid;
speaker_out[cfg->speaker_outs].seq = (assoc << 4) | seq;
cfg->speaker_outs++; break; case AC_JACK_HP_OUT:
seq = get_defcfg_sequence(def_conf);
assoc = get_defcfg_association(def_conf); if (cfg->hp_outs >= ARRAY_SIZE(cfg->hp_pins)) {
codec_info(codec, "ignore pin 0x%x, too many assigned pins\n",
nid); continue;
}
hp_out[cfg->hp_outs].pin = nid;
hp_out[cfg->hp_outs].seq = (assoc << 4) | seq;
cfg->hp_outs++; break; case AC_JACK_MIC_IN:
add_auto_cfg_input_pin(codec, cfg, nid, AUTO_PIN_MIC); break; case AC_JACK_LINE_IN:
add_auto_cfg_input_pin(codec, cfg, nid, AUTO_PIN_LINE_IN); break; case AC_JACK_CD:
add_auto_cfg_input_pin(codec, cfg, nid, AUTO_PIN_CD); break; case AC_JACK_AUX:
add_auto_cfg_input_pin(codec, cfg, nid, AUTO_PIN_AUX); break; case AC_JACK_SPDIF_OUT: case AC_JACK_DIG_OTHER_OUT: if (cfg->dig_outs >= ARRAY_SIZE(cfg->dig_out_pins)) {
codec_info(codec, "ignore pin 0x%x, too many assigned pins\n",
nid); continue;
}
cfg->dig_out_pins[cfg->dig_outs] = nid;
cfg->dig_out_type[cfg->dig_outs] =
(loc == AC_JACK_LOC_HDMI) ?
HDA_PCM_TYPE_HDMI : HDA_PCM_TYPE_SPDIF;
cfg->dig_outs++; break; case AC_JACK_SPDIF_IN: case AC_JACK_DIG_OTHER_IN:
cfg->dig_in_pin = nid; if (loc == AC_JACK_LOC_HDMI)
cfg->dig_in_type = HDA_PCM_TYPE_HDMI; else
cfg->dig_in_type = HDA_PCM_TYPE_SPDIF; break;
}
}
/* Find a pin that could be a headset or headphone mic */ if (cond_flags & HDA_PINCFG_HEADSET_MIC || cond_flags & HDA_PINCFG_HEADPHONE_MIC) { bool hsmic = !!(cond_flags & HDA_PINCFG_HEADSET_MIC); bool hpmic = !!(cond_flags & HDA_PINCFG_HEADPHONE_MIC); for (i = 0; (hsmic || hpmic) && (i < cfg->num_inputs); i++) if (hsmic && can_be_headset_mic(codec, &cfg->inputs[i], 0xc)) {
cfg->inputs[i].is_headset_mic = 1;
hsmic = false;
} elseif (hpmic && can_be_headset_mic(codec, &cfg->inputs[i], 0xd)) {
cfg->inputs[i].is_headphone_mic = 1;
hpmic = false;
}
/* If we didn't find our sequence number mark, fall back to any sequence number */ for (i = 0; (hsmic || hpmic) && (i < cfg->num_inputs); i++) { if (!can_be_headset_mic(codec, &cfg->inputs[i], -1)) continue; if (hsmic) {
cfg->inputs[i].is_headset_mic = 1;
hsmic = false;
} elseif (hpmic) {
cfg->inputs[i].is_headphone_mic = 1;
hpmic = false;
}
}
if (hsmic)
codec_dbg(codec, "Told to look for a headset mic, but didn't find any.\n"); if (hpmic)
codec_dbg(codec, "Told to look for a headphone mic, but didn't find any.\n");
}
/* FIX-UP: * If no line-out is defined but multiple HPs are found, * some of them might be the real line-outs.
*/ if (!cfg->line_outs && cfg->hp_outs > 1 &&
!(cond_flags & HDA_PINCFG_NO_HP_FIXUP)) {
i = 0; while (i < cfg->hp_outs) { /* The real HPs should have the sequence 0x0f */ if ((hp_out[i].seq & 0x0f) == 0x0f) {
i++; continue;
} /* Move it to the line-out table */
line_out[cfg->line_outs++] = hp_out[i];
cfg->hp_outs--;
memmove(hp_out + i, hp_out + i + 1, sizeof(hp_out[0]) * (cfg->hp_outs - i));
}
memset(hp_out + cfg->hp_outs, 0, sizeof(hp_out[0]) * (AUTO_CFG_MAX_OUTS - cfg->hp_outs)); if (!cfg->hp_outs)
cfg->line_out_type = AUTO_PIN_HP_OUT;
/* sort inputs in the order of AUTO_PIN_* type */ for (i = 0; i < cfg->num_inputs; i++)
cfg->inputs[i].order = i;
sort(cfg->inputs, cfg->num_inputs, sizeof(cfg->inputs[0]),
compare_input_type, NULL);
/** * snd_hda_get_input_pin_attr - Get the input pin attribute from pin config * @def_conf: pin configuration value * * Guess the input pin attribute (INPUT_PIN_ATTR_XXX) from the given * default pin configuration value.
*/ int snd_hda_get_input_pin_attr(unsignedint def_conf)
{ unsignedint loc = get_defcfg_location(def_conf); unsignedint conn = get_defcfg_connect(def_conf); if (conn == AC_JACK_PORT_NONE) return INPUT_PIN_ATTR_UNUSED; /* Windows may claim the internal mic to be BOTH, too */ if (conn == AC_JACK_PORT_FIXED || conn == AC_JACK_PORT_BOTH) return INPUT_PIN_ATTR_INT; if ((loc & 0x30) == AC_JACK_LOC_INTERNAL) return INPUT_PIN_ATTR_INT; if ((loc & 0x30) == AC_JACK_LOC_SEPARATE) return INPUT_PIN_ATTR_DOCK; if (loc == AC_JACK_LOC_REAR) return INPUT_PIN_ATTR_REAR; if (loc == AC_JACK_LOC_FRONT) return INPUT_PIN_ATTR_FRONT; return INPUT_PIN_ATTR_NORMAL;
}
EXPORT_SYMBOL_GPL(snd_hda_get_input_pin_attr);
/** * hda_get_input_pin_label - Give a label for the given input pin * @codec: the HDA codec * @item: ping config item to refer * @pin: the pin NID * @check_location: flag to add the jack location prefix * * When @check_location is true, the function checks the pin location * for mic and line-in pins, and set an appropriate prefix like "Front", * "Rear", "Internal".
*/ staticconstchar *hda_get_input_pin_label(struct hda_codec *codec, conststruct auto_pin_cfg_item *item,
hda_nid_t pin, bool check_location)
{ unsignedint def_conf; staticconstchar * const mic_names[] = { "Internal Mic", "Dock Mic", "Mic", "Rear Mic", "Front Mic"
}; int attr;
def_conf = snd_hda_codec_get_pincfg(codec, pin);
switch (get_defcfg_device(def_conf)) { case AC_JACK_MIC_IN: if (item && item->is_headset_mic) return"Headset Mic"; if (item && item->is_headphone_mic) return"Headphone Mic"; if (!check_location) return"Mic";
attr = snd_hda_get_input_pin_attr(def_conf); if (!attr) return"None"; return mic_names[attr - 1]; case AC_JACK_LINE_IN: if (!check_location) return"Line";
attr = snd_hda_get_input_pin_attr(def_conf); if (!attr) return"None"; if (attr == INPUT_PIN_ATTR_DOCK) return"Dock Line"; return"Line"; case AC_JACK_AUX: return"Aux"; case AC_JACK_CD: return"CD"; case AC_JACK_SPDIF_IN: return"SPDIF In"; case AC_JACK_DIG_OTHER_IN: return"Digital In"; case AC_JACK_HP_OUT: return"Headphone Mic"; default: return"Misc";
}
}
/* Check whether the location prefix needs to be added to the label. * If all mic-jacks are in the same location (e.g. rear panel), we don't * have to put "Front" prefix to each label. In such a case, returns false.
*/ staticint check_mic_location_need(struct hda_codec *codec, conststruct auto_pin_cfg *cfg, int input)
{ unsignedint defc; int i, attr, attr2;
defc = snd_hda_codec_get_pincfg(codec, cfg->inputs[input].pin);
attr = snd_hda_get_input_pin_attr(defc); /* for internal or docking mics, we need locations */ if (attr <= INPUT_PIN_ATTR_NORMAL) return 1;
attr = 0; for (i = 0; i < cfg->num_inputs; i++) {
defc = snd_hda_codec_get_pincfg(codec, cfg->inputs[i].pin);
attr2 = snd_hda_get_input_pin_attr(defc); if (attr2 >= INPUT_PIN_ATTR_NORMAL) { if (attr && attr != attr2) return 1; /* different locations found */
attr = attr2;
}
} return 0;
}
/** * hda_get_autocfg_input_label - Get a label for the given input * @codec: the HDA codec * @cfg: the parsed pin configuration * @input: the input index number * * Get a label for the given input pin defined by the autocfg item. * Unlike hda_get_input_pin_label(), this function checks all inputs * defined in autocfg and avoids the redundant mic/line prefix as much as * possible.
*/ constchar *hda_get_autocfg_input_label(struct hda_codec *codec, conststruct auto_pin_cfg *cfg, int input)
{ int type = cfg->inputs[input].type; int has_multiple_pins = 0;
/* return the position of NID in the list, or -1 if not found */ staticint find_idx_in_nid_list(hda_nid_t nid, const hda_nid_t *list, int nums)
{ int i; for (i = 0; i < nums; i++) if (list[i] == nid) return i; return -1;
}
/* get a unique suffix or an index number */ staticconstchar *check_output_sfx(hda_nid_t nid, const hda_nid_t *pins, int num_pins, int *indexp)
{ staticconstchar * const channel_sfx[] = { " Front", " Surround", " CLFE", " Side"
}; int i;
i = find_idx_in_nid_list(nid, pins, num_pins); if (i < 0) return NULL; if (num_pins == 1) return""; if (num_pins > ARRAY_SIZE(channel_sfx)) { if (indexp)
*indexp = i; return"";
} return channel_sfx[i];
}
/* handle as a speaker if it's a fixed line-out */ if (!strcmp(name, "Line Out") && attr == INPUT_PIN_ATTR_INT)
name = "Speaker";
pfx = check_output_pfx(codec, nid);
if (cfg) { /* try to give a unique suffix if needed */
sfx = check_output_sfx(nid, cfg->line_out_pins, cfg->line_outs,
indexp); if (!sfx)
sfx = check_output_sfx(nid, cfg->speaker_pins, cfg->speaker_outs,
indexp); if (!sfx) { /* don't add channel suffix for Headphone controls */ int idx = get_hp_label_index(codec, nid, cfg->hp_pins,
cfg->hp_outs); if (idx >= 0 && indexp)
*indexp = idx;
sfx = "";
}
}
snprintf(label, maxlen, "%s%s%s", pfx, name, sfx); return 1;
}
/** * snd_hda_get_pin_label - Get a label for the given I/O pin * @codec: the HDA codec * @nid: pin NID * @cfg: the parsed pin configuration * @label: the string buffer to store * @maxlen: the max length of string buffer (including termination) * @indexp: the pointer to return the index number (for multiple ctls) * * Get a label for the given pin. This function works for both input and * output pins. When @cfg is given as non-NULL, the function tries to get * an optimized label using hda_get_autocfg_input_label(). * * This function tries to give a unique label string for the pin as much as * possible. For example, when the multiple line-outs are present, it adds * the channel suffix like "Front", "Surround", etc (only when @cfg is given). * If no unique name with a suffix is available and @indexp is non-NULL, the * index number is stored in the pointer.
*/ int snd_hda_get_pin_label(struct hda_codec *codec, hda_nid_t nid, conststruct auto_pin_cfg *cfg, char *label, int maxlen, int *indexp)
{ unsignedint def_conf = snd_hda_codec_get_pincfg(codec, nid); constchar *name = NULL; int i; bool hdmi;
if (indexp)
*indexp = 0; if (get_defcfg_connect(def_conf) == AC_JACK_PORT_NONE) return 0;
switch (get_defcfg_device(def_conf)) { case AC_JACK_LINE_OUT: return fill_audio_out_name(codec, nid, cfg, "Line Out",
label, maxlen, indexp); case AC_JACK_SPEAKER: return fill_audio_out_name(codec, nid, cfg, "Speaker",
label, maxlen, indexp); case AC_JACK_HP_OUT: return fill_audio_out_name(codec, nid, cfg, "Headphone",
label, maxlen, indexp); case AC_JACK_SPDIF_OUT: case AC_JACK_DIG_OTHER_OUT:
hdmi = is_hdmi_cfg(def_conf);
name = hdmi ? "HDMI" : "SPDIF"; if (cfg && indexp) for (i = 0; i < cfg->dig_outs; i++) {
hda_nid_t pin = cfg->dig_out_pins[i]; unsignedint c; if (pin == nid) break;
c = snd_hda_codec_get_pincfg(codec, pin); if (hdmi == is_hdmi_cfg(c))
(*indexp)++;
} break; default: if (cfg) { for (i = 0; i < cfg->num_inputs; i++) { if (cfg->inputs[i].pin != nid) continue;
name = hda_get_autocfg_input_label(codec, cfg, i); if (name) break;
}
} if (!name)
name = hda_get_input_pin_label(codec, NULL, nid, true); break;
} if (!name) return 0;
strscpy(label, name, maxlen); return 1;
}
EXPORT_SYMBOL_GPL(snd_hda_get_pin_label);
/** * snd_hda_add_verbs - Add verbs to the init list * @codec: the HDA codec * @list: zero-terminated verb list to add * * Append the given verb list to the execution list. The verbs will be * performed at init and resume time via snd_hda_apply_verbs().
*/ int snd_hda_add_verbs(struct hda_codec *codec, conststruct hda_verb *list)
{ conststruct hda_verb **v;
v = snd_array_new(&codec->verbs); if (!v) return -ENOMEM;
*v = list; return 0;
}
EXPORT_SYMBOL_GPL(snd_hda_add_verbs);
/** * snd_hda_apply_verbs - Execute the init verb lists * @codec: the HDA codec
*/ void snd_hda_apply_verbs(struct hda_codec *codec)
{ conststruct hda_verb **v; int i;
snd_array_for_each(&codec->verbs, i, v)
snd_hda_sequence_write(codec, *v);
}
EXPORT_SYMBOL_GPL(snd_hda_apply_verbs);
/** * snd_hda_apply_pincfgs - Set each pin config in the given list * @codec: the HDA codec * @cfg: NULL-terminated pin config table
*/ void snd_hda_apply_pincfgs(struct hda_codec *codec, conststruct hda_pintbl *cfg)
{ for (; cfg->nid; cfg++)
snd_hda_codec_set_pincfg(codec, cfg->nid, cfg->val);
}
EXPORT_SYMBOL_GPL(snd_hda_apply_pincfgs);
snd_array_for_each(&codec->init_pins, i, pin) {
hda_nid_t nid = pin->nid;
u32 cfg = pin->cfg; conststruct hda_pintbl *t_pins; int found;
t_pins = pins;
found = 0; for (; t_pins->nid; t_pins++) { if (t_pins->nid == nid) {
found = 1; if ((t_pins->val & IGNORE_SEQ_ASSOC) == (cfg & IGNORE_SEQ_ASSOC)) break; elseif ((cfg & 0xf0000000) == 0x40000000 && (t_pins->val & 0xf0000000) == 0x40000000) break; else returnfalse;
}
} if (match_all_pins &&
!found && (cfg & 0xf0000000) != 0x40000000) returnfalse;
}
returntrue;
}
/** * snd_hda_pick_pin_fixup - Pick up a fixup matching with the pin quirk list * @codec: the HDA codec * @pin_quirk: zero-terminated pin quirk list * @fixlist: the fixup list * @match_all_pins: all valid pins must match with the table entries
*/ void snd_hda_pick_pin_fixup(struct hda_codec *codec, conststruct snd_hda_pin_quirk *pin_quirk, conststruct hda_fixup *fixlist, bool match_all_pins)
{ conststruct snd_hda_pin_quirk *pq; constchar *name = NULL;
if (codec->fixup_id != HDA_FIXUP_ID_NOT_SET) return;
for (pq = pin_quirk; pq->subvendor; pq++) { if ((codec->core.subsystem_id & 0xffff0000) != (pq->subvendor << 16)) continue; if (codec->core.vendor_id != pq->codec) continue; if (pin_config_match(codec, pq->pins, match_all_pins)) {
codec->fixup_id = pq->value; #ifdef CONFIG_SND_DEBUG_VERBOSE
codec->fixup_name = pq->name;
name = pq->name; #endif
codec_info(codec, "%s: picked fixup %s (pin match)\n",
codec->core.chip_name, name ? name : "");
codec->fixup_list = fixlist; return;
}
}
}
EXPORT_SYMBOL_GPL(snd_hda_pick_pin_fixup);
/* check whether the given quirk entry matches with vendor/device pair */ staticbool hda_quirk_match(u16 vendor, u16 device, conststruct hda_quirk *q)
{ if (q->subvendor != vendor) returnfalse; return !q->subdevice ||
(device & q->subdevice_mask) == q->subdevice;
}
/* look through the quirk list and return the matching entry */ staticconststruct hda_quirk *
hda_quirk_lookup_id(u16 vendor, u16 device, conststruct hda_quirk *list)
{ conststruct hda_quirk *q;
for (q = list; q->subvendor || q->subdevice; q++) { if (hda_quirk_match(vendor, device, q)) return q;
} return NULL;
}
/** * snd_hda_pick_fixup - Pick up a fixup matching with PCI/codec SSID or model string * @codec: the HDA codec * @models: NULL-terminated model string list * @quirk: zero-terminated PCI/codec SSID quirk list * @fixlist: the fixup list * * Pick up a fixup entry matching with the given model string or SSID. * If a fixup was already set beforehand, the function doesn't do anything. * When a special model string "nofixup" is given, also no fixup is applied. * * The function tries to find the matching model name at first, if given. * If the model string contains the SSID alias, try to look up with the given * alias ID. * If nothing matched, try to look up the PCI SSID. * If still nothing matched, try to look up the codec SSID.
*/ void snd_hda_pick_fixup(struct hda_codec *codec, conststruct hda_model_fixup *models, conststruct hda_quirk *quirk, conststruct hda_fixup *fixlist)
{ conststruct hda_quirk *q; int id = HDA_FIXUP_ID_NOT_SET; constchar *name = NULL; constchar *type = NULL; unsignedint vendor, device;
u16 pci_vendor, pci_device;
u16 codec_vendor, codec_device;
if (codec->fixup_id != HDA_FIXUP_ID_NOT_SET) return;
/* when model=nofixup is given, don't pick up any fixups */ if (codec->modelname && !strcmp(codec->modelname, "nofixup")) {
id = HDA_FIXUP_ID_NO_FIXUP;
fixlist = NULL;
codec_info(codec, "%s: picked no fixup (nofixup specified)\n",
codec->core.chip_name); goto found;
}
/* match with the model name string */ if (codec->modelname && models) { while (models->name) { if (!strcmp(codec->modelname, models->name)) {
id = models->id;
name = models->name;
codec_info(codec, "%s: picked fixup %s (model specified)\n",
codec->core.chip_name, name); goto found;
}
models++;
}
}
if (!quirk) return;
if (codec->bus->pci) {
pci_vendor = codec->bus->pci->subsystem_vendor;
pci_device = codec->bus->pci->subsystem_device;
}
/* match with the SSID alias given by the model string "XXXX:YYYY" */ if (codec->modelname &&
sscanf(codec->modelname, "%04x:%04x", &vendor, &device) == 2) {
q = hda_quirk_lookup_id(vendor, device, quirk); if (q) {
type = "alias SSID"; goto found_device;
}
}
/* match primarily with the PCI SSID */ for (q = quirk; q->subvendor || q->subdevice; q++) { /* if the entry is specific to codec SSID, check with it */ if (!codec->bus->pci || q->match_codec_ssid) { if (hda_quirk_match(codec_vendor, codec_device, q)) {
type = "codec SSID"; goto found_device;
}
} else { if (hda_quirk_match(pci_vendor, pci_device, q)) {
type = "PCI SSID"; goto found_device;
}
}
}
/* match with the codec SSID */
q = hda_quirk_lookup_id(codec_vendor, codec_device, quirk); if (q) {
type = "codec SSID"; goto found_device;
}
return; /* no matching */
found_device:
id = q->value; #ifdef CONFIG_SND_DEBUG_VERBOSE
name = q->name; #endif
codec_info(codec, "%s: picked fixup %s for %s %04x:%04x\n",
codec->core.chip_name, name ? name : "",
type, q->subvendor, q->subdevice);
found:
codec->fixup_id = id;
codec->fixup_list = fixlist;
codec->fixup_name = name;
}
EXPORT_SYMBOL_GPL(snd_hda_pick_fixup);
Messung V0.5
¤ Dauer der Verarbeitung: 0.14 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.