Lines Matching full:cfg
55 /* add the found input-pin to the cfg->inputs[] table */
56 static void add_auto_cfg_input_pin(struct hda_codec *codec, struct auto_pin_cfg *cfg,
59 if (cfg->num_inputs < AUTO_CFG_MAX_INS) {
60 cfg->inputs[cfg->num_inputs].pin = nid;
61 cfg->inputs[cfg->num_inputs].type = type;
62 cfg->inputs[cfg->num_inputs].has_boost_on_pin =
64 cfg->num_inputs++;
156 * Parse all pin widgets and store the useful pin nids to cfg
173 struct auto_pin_cfg *cfg,
179 struct auto_out_pin line_out[ARRAY_SIZE(cfg->line_out_pins)];
180 struct auto_out_pin speaker_out[ARRAY_SIZE(cfg->speaker_pins)];
181 struct auto_out_pin hp_out[ARRAY_SIZE(cfg->hp_pins)];
187 memset(cfg, 0, sizeof(*cfg));
230 if (!cfg->mono_out_pin)
231 cfg->mono_out_pin = nid;
242 if (cfg->line_outs >= ARRAY_SIZE(cfg->line_out_pins)) {
248 line_out[cfg->line_outs].pin = nid;
249 line_out[cfg->line_outs].seq = seq;
250 cfg->line_outs++;
255 if (cfg->speaker_outs >= ARRAY_SIZE(cfg->speaker_pins)) {
261 speaker_out[cfg->speaker_outs].pin = nid;
262 speaker_out[cfg->speaker_outs].seq = (assoc << 4) | seq;
263 cfg->speaker_outs++;
268 if (cfg->hp_outs >= ARRAY_SIZE(cfg->hp_pins)) {
274 hp_out[cfg->hp_outs].pin = nid;
275 hp_out[cfg->hp_outs].seq = (assoc << 4) | seq;
276 cfg->hp_outs++;
279 add_auto_cfg_input_pin(codec, cfg, nid, AUTO_PIN_MIC);
282 add_auto_cfg_input_pin(codec, cfg, nid, AUTO_PIN_LINE_IN);
285 add_auto_cfg_input_pin(codec, cfg, nid, AUTO_PIN_CD);
288 add_auto_cfg_input_pin(codec, cfg, nid, AUTO_PIN_AUX);
292 if (cfg->dig_outs >= ARRAY_SIZE(cfg->dig_out_pins)) {
298 cfg->dig_out_pins[cfg->dig_outs] = nid;
299 cfg->dig_out_type[cfg->dig_outs] =
302 cfg->dig_outs++;
306 cfg->dig_in_pin = nid;
308 cfg->dig_in_type = HDA_PCM_TYPE_HDMI;
310 cfg->dig_in_type = HDA_PCM_TYPE_SPDIF;
319 for (i = 0; (hsmic || hpmic) && (i < cfg->num_inputs); i++)
320 if (hsmic && can_be_headset_mic(codec, &cfg->inputs[i], 0xc)) {
321 cfg->inputs[i].is_headset_mic = 1;
323 } else if (hpmic && can_be_headset_mic(codec, &cfg->inputs[i], 0xd)) {
324 cfg->inputs[i].is_headphone_mic = 1;
329 for (i = 0; (hsmic || hpmic) && (i < cfg->num_inputs); i++) {
330 if (!can_be_headset_mic(codec, &cfg->inputs[i], -1))
333 cfg->inputs[i].is_headset_mic = 1;
336 cfg->inputs[i].is_headphone_mic = 1;
351 if (!cfg->line_outs && cfg->hp_outs > 1 &&
354 while (i < cfg->hp_outs) {
361 line_out[cfg->line_outs++] = hp_out[i];
362 cfg->hp_outs--;
364 sizeof(hp_out[0]) * (cfg->hp_outs - i));
366 memset(hp_out + cfg->hp_outs, 0,
367 sizeof(hp_out[0]) * (AUTO_CFG_MAX_OUTS - cfg->hp_outs));
368 if (!cfg->hp_outs)
369 cfg->line_out_type = AUTO_PIN_HP_OUT;
374 sort_pins_by_sequence(cfg->line_out_pins, line_out, cfg->line_outs);
375 sort_pins_by_sequence(cfg->speaker_pins, speaker_out,
376 cfg->speaker_outs);
377 sort_pins_by_sequence(cfg->hp_pins, hp_out, cfg->hp_outs);
383 if (!cfg->line_outs &&
385 if (cfg->speaker_outs) {
386 cfg->line_outs = cfg->speaker_outs;
387 memcpy(cfg->line_out_pins, cfg->speaker_pins,
388 sizeof(cfg->speaker_pins));
389 cfg->speaker_outs = 0;
390 memset(cfg->speaker_pins, 0, sizeof(cfg->speaker_pins));
391 cfg->line_out_type = AUTO_PIN_SPEAKER_OUT;
392 } else if (cfg->hp_outs) {
393 cfg->line_outs = cfg->hp_outs;
394 memcpy(cfg->line_out_pins, cfg->hp_pins,
395 sizeof(cfg->hp_pins));
396 cfg->hp_outs = 0;
397 memset(cfg->hp_pins, 0, sizeof(cfg->hp_pins));
398 cfg->line_out_type = AUTO_PIN_HP_OUT;
402 reorder_outputs(cfg->line_outs, cfg->line_out_pins);
403 reorder_outputs(cfg->hp_outs, cfg->hp_pins);
404 reorder_outputs(cfg->speaker_outs, cfg->speaker_pins);
407 for (i = 0; i < cfg->num_inputs; i++)
408 cfg->inputs[i].order = i;
409 sort(cfg->inputs, cfg->num_inputs, sizeof(cfg->inputs[0]),
416 codec->core.chip_name, cfg->line_outs, cfg->line_out_pins[0],
417 cfg->line_out_pins[1], cfg->line_out_pins[2],
418 cfg->line_out_pins[3], cfg->line_out_pins[4],
419 cfg->line_out_type == AUTO_PIN_HP_OUT ? "hp" :
420 (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT ?
423 cfg->speaker_outs, cfg->speaker_pins[0],
424 cfg->speaker_pins[1], cfg->speaker_pins[2],
425 cfg->speaker_pins[3], cfg->speaker_pins[4]);
427 cfg->hp_outs, cfg->hp_pins[0],
428 cfg->hp_pins[1], cfg->hp_pins[2],
429 cfg->hp_pins[3], cfg->hp_pins[4]);
430 codec_info(codec, " mono: mono_out=0x%x\n", cfg->mono_out_pin);
431 if (cfg->dig_outs)
433 cfg->dig_out_pins[0], cfg->dig_out_pins[1]);
435 for (i = 0; i < cfg->num_inputs; i++) {
437 hda_get_autocfg_input_label(codec, cfg, i),
438 cfg->inputs[i].pin);
440 if (cfg->dig_in_pin)
441 codec_info(codec, " dig-in=0x%x\n", cfg->dig_in_pin);
539 const struct auto_pin_cfg *cfg,
545 defc = snd_hda_codec_get_pincfg(codec, cfg->inputs[input].pin);
552 for (i = 0; i < cfg->num_inputs; i++) {
553 defc = snd_hda_codec_get_pincfg(codec, cfg->inputs[i].pin);
567 * @cfg: the parsed pin configuration
576 const struct auto_pin_cfg *cfg,
579 int type = cfg->inputs[input].type;
582 if ((input > 0 && cfg->inputs[input - 1].type == type) ||
583 (input < cfg->num_inputs - 1 && cfg->inputs[input + 1].type == type))
586 has_multiple_pins &= check_mic_location_need(codec, cfg, input);
588 return hda_get_input_pin_label(codec, &cfg->inputs[input],
589 cfg->inputs[input].pin,
659 const struct auto_pin_cfg *cfg,
672 if (cfg) {
674 sfx = check_output_sfx(nid, cfg->line_out_pins, cfg->line_outs,
677 sfx = check_output_sfx(nid, cfg->speaker_pins, cfg->speaker_outs,
681 int idx = get_hp_label_index(codec, nid, cfg->hp_pins,
682 cfg->hp_outs);
699 * @cfg: the parsed pin configuration
705 * output pins. When @cfg is given as non-NULL, the function tries to get
710 * the channel suffix like "Front", "Surround", etc (only when @cfg is given).
715 const struct auto_pin_cfg *cfg,
730 return fill_audio_out_name(codec, nid, cfg, "Line Out",
733 return fill_audio_out_name(codec, nid, cfg, "Speaker",
736 return fill_audio_out_name(codec, nid, cfg, "Headphone",
742 if (cfg && indexp)
743 for (i = 0; i < cfg->dig_outs; i++) {
744 hda_nid_t pin = cfg->dig_out_pins[i];
754 if (cfg) {
755 for (i = 0; i < cfg->num_inputs; i++) {
756 if (cfg->inputs[i].pin != nid)
758 name = hda_get_autocfg_input_label(codec, cfg, i);
811 * @cfg: NULL-terminated pin config table
814 const struct hda_pintbl *cfg)
816 for (; cfg->nid; cfg++)
817 snd_hda_codec_set_pincfg(codec, cfg->nid, cfg->val);
822 const struct hda_pintbl *cfg)
824 for (; cfg->nid; cfg++)
825 snd_hda_set_pin_ctl_cache(codec, cfg->nid, cfg->val);
904 u32 cfg = pin->cfg;
913 if ((t_pins->val & IGNORE_SEQ_ASSOC) == (cfg & IGNORE_SEQ_ASSOC))
915 else if ((cfg & 0xf0000000) == 0x40000000 && (t_pins->val & 0xf0000000) == 0x40000000)
922 !found && (cfg & 0xf0000000) != 0x40000000)