aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2010-08-30 06:56:55 -0400
committerTakashi Iwai <tiwai@suse.de>2010-08-30 06:56:55 -0400
commit75e0eb24ee3ec3549c2e53707dcc87e5f7a2c791 (patch)
treea2720891a361714fd4e9a287f4f1a407e0345c1d
parentf3268512c3a5dea587cfe875b8bca98d9e164cd9 (diff)
ALSA: hda - Add inputs[] to auto_pin_cfg struct
Added the new fields to contain all input-pins to struct auto_pin_cfg. Unlike the existing input_pins[], this array contains all input pins even if the multiple pins are assigned for a single role (i.e. two front mics). The former input_pins[] still remains for a while, but will be removed in near future. Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r--sound/pci/hda/hda_codec.c40
-rw-r--r--sound/pci/hda/hda_local.h12
2 files changed, 40 insertions, 12 deletions
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c
index 3827092cc1d2..280a739c2a99 100644
--- a/sound/pci/hda/hda_codec.c
+++ b/sound/pci/hda/hda_codec.c
@@ -4372,6 +4372,17 @@ static void sort_pins_by_sequence(hda_nid_t *pins, short *sequences,
4372} 4372}
4373 4373
4374 4374
4375/* add the found input-pin to the cfg->inputs[] table */
4376static void add_auto_cfg_input_pin(struct auto_pin_cfg *cfg, hda_nid_t nid,
4377 int type)
4378{
4379 if (cfg->num_inputs < AUTO_CFG_MAX_INS) {
4380 cfg->inputs[cfg->num_inputs].pin = nid;
4381 cfg->inputs[cfg->num_inputs].type = type;
4382 cfg->num_inputs++;
4383 }
4384}
4385
4375/* 4386/*
4376 * Parse all pin widgets and store the useful pin nids to cfg 4387 * Parse all pin widgets and store the useful pin nids to cfg
4377 * 4388 *
@@ -4398,6 +4409,7 @@ int snd_hda_parse_pin_def_config(struct hda_codec *codec,
4398 short sequences_line_out[ARRAY_SIZE(cfg->line_out_pins)]; 4409 short sequences_line_out[ARRAY_SIZE(cfg->line_out_pins)];
4399 short sequences_speaker[ARRAY_SIZE(cfg->speaker_pins)]; 4410 short sequences_speaker[ARRAY_SIZE(cfg->speaker_pins)];
4400 short sequences_hp[ARRAY_SIZE(cfg->hp_pins)]; 4411 short sequences_hp[ARRAY_SIZE(cfg->hp_pins)];
4412 int i;
4401 4413
4402 memset(cfg, 0, sizeof(*cfg)); 4414 memset(cfg, 0, sizeof(*cfg));
4403 4415
@@ -4482,19 +4494,26 @@ int snd_hda_parse_pin_def_config(struct hda_codec *codec,
4482 cfg->input_pins[preferred] = nid; 4494 cfg->input_pins[preferred] = nid;
4483 else if (!cfg->input_pins[alt]) 4495 else if (!cfg->input_pins[alt])
4484 cfg->input_pins[alt] = nid; 4496 cfg->input_pins[alt] = nid;
4497 add_auto_cfg_input_pin(cfg, nid, preferred);
4485 break; 4498 break;
4486 } 4499 }
4487 case AC_JACK_LINE_IN: 4500 case AC_JACK_LINE_IN: {
4501 int type;
4488 if (loc == AC_JACK_LOC_FRONT) 4502 if (loc == AC_JACK_LOC_FRONT)
4489 cfg->input_pins[AUTO_PIN_FRONT_LINE] = nid; 4503 type = AUTO_PIN_FRONT_LINE;
4490 else 4504 else
4491 cfg->input_pins[AUTO_PIN_LINE] = nid; 4505 type = AUTO_PIN_LINE;
4506 cfg->input_pins[type] = nid;
4507 add_auto_cfg_input_pin(cfg, nid, type);
4492 break; 4508 break;
4509 }
4493 case AC_JACK_CD: 4510 case AC_JACK_CD:
4494 cfg->input_pins[AUTO_PIN_CD] = nid; 4511 cfg->input_pins[AUTO_PIN_CD] = nid;
4512 add_auto_cfg_input_pin(cfg, nid, AUTO_PIN_CD);
4495 break; 4513 break;
4496 case AC_JACK_AUX: 4514 case AC_JACK_AUX:
4497 cfg->input_pins[AUTO_PIN_AUX] = nid; 4515 cfg->input_pins[AUTO_PIN_AUX] = nid;
4516 add_auto_cfg_input_pin(cfg, nid, AUTO_PIN_AUX);
4498 break; 4517 break;
4499 case AC_JACK_SPDIF_OUT: 4518 case AC_JACK_SPDIF_OUT:
4500 case AC_JACK_DIG_OTHER_OUT: 4519 case AC_JACK_DIG_OTHER_OUT:
@@ -4621,14 +4640,13 @@ int snd_hda_parse_pin_def_config(struct hda_codec *codec,
4621 if (cfg->dig_outs) 4640 if (cfg->dig_outs)
4622 snd_printd(" dig-out=0x%x/0x%x\n", 4641 snd_printd(" dig-out=0x%x/0x%x\n",
4623 cfg->dig_out_pins[0], cfg->dig_out_pins[1]); 4642 cfg->dig_out_pins[0], cfg->dig_out_pins[1]);
4624 snd_printd(" inputs: mic=0x%x, fmic=0x%x, line=0x%x, fline=0x%x," 4643 snd_printd(" inputs:");
4625 " cd=0x%x, aux=0x%x\n", 4644 for (i = 0; i < cfg->num_inputs; i++) {
4626 cfg->input_pins[AUTO_PIN_MIC], 4645 snd_printdd(" %s=0x%x",
4627 cfg->input_pins[AUTO_PIN_FRONT_MIC], 4646 auto_pin_cfg_labels[cfg->inputs[i].type],
4628 cfg->input_pins[AUTO_PIN_LINE], 4647 cfg->inputs[i].pin);
4629 cfg->input_pins[AUTO_PIN_FRONT_LINE], 4648 }
4630 cfg->input_pins[AUTO_PIN_CD], 4649 snd_printd("\n");
4631 cfg->input_pins[AUTO_PIN_AUX]);
4632 if (cfg->dig_in_pin) 4650 if (cfg->dig_in_pin)
4633 snd_printd(" dig-in=0x%x\n", cfg->dig_in_pin); 4651 snd_printd(" dig-in=0x%x\n", cfg->dig_in_pin);
4634 4652
diff --git a/sound/pci/hda/hda_local.h b/sound/pci/hda/hda_local.h
index 28ab4aead48f..44c909445ba2 100644
--- a/sound/pci/hda/hda_local.h
+++ b/sound/pci/hda/hda_local.h
@@ -383,6 +383,14 @@ enum {
383extern const char *auto_pin_cfg_labels[AUTO_PIN_LAST]; 383extern const char *auto_pin_cfg_labels[AUTO_PIN_LAST];
384 384
385#define AUTO_CFG_MAX_OUTS 5 385#define AUTO_CFG_MAX_OUTS 5
386#define AUTO_CFG_MAX_INS 8
387
388struct auto_pin_cfg_item {
389 hda_nid_t pin;
390 int type;
391};
392
393struct auto_pin_cfg;
386 394
387struct auto_pin_cfg { 395struct auto_pin_cfg {
388 int line_outs; 396 int line_outs;
@@ -393,7 +401,9 @@ struct auto_pin_cfg {
393 int hp_outs; 401 int hp_outs;
394 int line_out_type; /* AUTO_PIN_XXX_OUT */ 402 int line_out_type; /* AUTO_PIN_XXX_OUT */
395 hda_nid_t hp_pins[AUTO_CFG_MAX_OUTS]; 403 hda_nid_t hp_pins[AUTO_CFG_MAX_OUTS];
396 hda_nid_t input_pins[AUTO_PIN_LAST]; 404 hda_nid_t input_pins[AUTO_PIN_LAST]; /* old config; to be deprecated */
405 int num_inputs;
406 struct auto_pin_cfg_item inputs[AUTO_CFG_MAX_INS];
397 int dig_outs; 407 int dig_outs;
398 hda_nid_t dig_out_pins[2]; 408 hda_nid_t dig_out_pins[2];
399 hda_nid_t dig_in_pin; 409 hda_nid_t dig_in_pin;