aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2009-07-27 06:54:26 -0400
committerTakashi Iwai <tiwai@suse.de>2009-07-27 06:54:26 -0400
commita22d543a95e82e5ad0ee1a44aad54fd6b6bf52a8 (patch)
tree34ab56e73bd25338588a83e8e1b28e4ce94810b1
parenta3daf68931679dbd96342099e4d61a99ba98315c (diff)
ALSA: hda - Introduce get_wcaps_type() macro
Add a helper macro to retrieve the widget type from wiget cap bits. Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r--sound/pci/hda/hda_codec.c9
-rw-r--r--sound/pci/hda/hda_generic.c2
-rw-r--r--sound/pci/hda/hda_local.h3
-rw-r--r--sound/pci/hda/hda_proc.c3
-rw-r--r--sound/pci/hda/patch_ca0110.c3
-rw-r--r--sound/pci/hda/patch_realtek.c17
-rw-r--r--sound/pci/hda/patch_sigmatel.c8
-rw-r--r--sound/pci/hda/patch_via.c3
8 files changed, 21 insertions, 27 deletions
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c
index aa5540786111..b8c656c21feb 100644
--- a/sound/pci/hda/hda_codec.c
+++ b/sound/pci/hda/hda_codec.c
@@ -748,8 +748,7 @@ static int read_pin_defaults(struct hda_codec *codec)
748 for (i = 0; i < codec->num_nodes; i++, nid++) { 748 for (i = 0; i < codec->num_nodes; i++, nid++) {
749 struct hda_pincfg *pin; 749 struct hda_pincfg *pin;
750 unsigned int wcaps = get_wcaps(codec, nid); 750 unsigned int wcaps = get_wcaps(codec, nid);
751 unsigned int wid_type = (wcaps & AC_WCAP_TYPE) >> 751 unsigned int wid_type = get_wcaps_type(wcaps);
752 AC_WCAP_TYPE_SHIFT;
753 if (wid_type != AC_WID_PIN) 752 if (wid_type != AC_WID_PIN)
754 continue; 753 continue;
755 pin = snd_array_new(&codec->init_pins); 754 pin = snd_array_new(&codec->init_pins);
@@ -2386,8 +2385,7 @@ static void hda_set_power_state(struct hda_codec *codec, hda_nid_t fg,
2386 for (i = 0; i < codec->num_nodes; i++, nid++) { 2385 for (i = 0; i < codec->num_nodes; i++, nid++) {
2387 unsigned int wcaps = get_wcaps(codec, nid); 2386 unsigned int wcaps = get_wcaps(codec, nid);
2388 if (wcaps & AC_WCAP_POWER) { 2387 if (wcaps & AC_WCAP_POWER) {
2389 unsigned int wid_type = (wcaps & AC_WCAP_TYPE) >> 2388 unsigned int wid_type = get_wcaps_type(wcaps);
2390 AC_WCAP_TYPE_SHIFT;
2391 if (power_state == AC_PWRST_D3 && 2389 if (power_state == AC_PWRST_D3 &&
2392 wid_type == AC_WID_PIN) { 2390 wid_type == AC_WID_PIN) {
2393 unsigned int pincap; 2391 unsigned int pincap;
@@ -3678,8 +3676,7 @@ int snd_hda_parse_pin_def_config(struct hda_codec *codec,
3678 end_nid = codec->start_nid + codec->num_nodes; 3676 end_nid = codec->start_nid + codec->num_nodes;
3679 for (nid = codec->start_nid; nid < end_nid; nid++) { 3677 for (nid = codec->start_nid; nid < end_nid; nid++) {
3680 unsigned int wid_caps = get_wcaps(codec, nid); 3678 unsigned int wid_caps = get_wcaps(codec, nid);
3681 unsigned int wid_type = 3679 unsigned int wid_type = get_wcaps_type(wid_caps);
3682 (wid_caps & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
3683 unsigned int def_conf; 3680 unsigned int def_conf;
3684 short assoc, loc; 3681 short assoc, loc;
3685 3682
diff --git a/sound/pci/hda/hda_generic.c b/sound/pci/hda/hda_generic.c
index bccb62a643ca..b36f6c5a92df 100644
--- a/sound/pci/hda/hda_generic.c
+++ b/sound/pci/hda/hda_generic.c
@@ -122,7 +122,7 @@ static int add_new_node(struct hda_codec *codec, struct hda_gspec *spec, hda_nid
122 return -ENOMEM; 122 return -ENOMEM;
123 node->nid = nid; 123 node->nid = nid;
124 node->wid_caps = get_wcaps(codec, nid); 124 node->wid_caps = get_wcaps(codec, nid);
125 node->type = (node->wid_caps & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; 125 node->type = get_wcaps_type(node->wid_caps);
126 if (node->wid_caps & AC_WCAP_CONN_LIST) { 126 if (node->wid_caps & AC_WCAP_CONN_LIST) {
127 nconns = snd_hda_get_connections(codec, nid, conn_list, 127 nconns = snd_hda_get_connections(codec, nid, conn_list,
128 HDA_MAX_CONNECTIONS); 128 HDA_MAX_CONNECTIONS);
diff --git a/sound/pci/hda/hda_local.h b/sound/pci/hda/hda_local.h
index 75aa3785212f..fa57cb93b443 100644
--- a/sound/pci/hda/hda_local.h
+++ b/sound/pci/hda/hda_local.h
@@ -407,6 +407,9 @@ static inline u32 get_wcaps(struct hda_codec *codec, hda_nid_t nid)
407 return codec->wcaps[nid - codec->start_nid]; 407 return codec->wcaps[nid - codec->start_nid];
408} 408}
409 409
410/* get the widget type from widget capability bits */
411#define get_wcaps_type(wcaps) (((wcaps) & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT)
412
410u32 query_amp_caps(struct hda_codec *codec, hda_nid_t nid, int direction); 413u32 query_amp_caps(struct hda_codec *codec, hda_nid_t nid, int direction);
411int snd_hda_override_amp_caps(struct hda_codec *codec, hda_nid_t nid, int dir, 414int snd_hda_override_amp_caps(struct hda_codec *codec, hda_nid_t nid, int dir,
412 unsigned int caps); 415 unsigned int caps);
diff --git a/sound/pci/hda/hda_proc.c b/sound/pci/hda/hda_proc.c
index 418c5d1badaa..a721eb08a290 100644
--- a/sound/pci/hda/hda_proc.c
+++ b/sound/pci/hda/hda_proc.c
@@ -508,8 +508,7 @@ static void print_codec_info(struct snd_info_entry *entry,
508 unsigned int wid_caps = 508 unsigned int wid_caps =
509 snd_hda_param_read(codec, nid, 509 snd_hda_param_read(codec, nid,
510 AC_PAR_AUDIO_WIDGET_CAP); 510 AC_PAR_AUDIO_WIDGET_CAP);
511 unsigned int wid_type = 511 unsigned int wid_type = get_wcaps_type(wid_caps);
512 (wid_caps & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
513 hda_nid_t conn[HDA_MAX_CONNECTIONS]; 512 hda_nid_t conn[HDA_MAX_CONNECTIONS];
514 int conn_len = 0; 513 int conn_len = 0;
515 514
diff --git a/sound/pci/hda/patch_ca0110.c b/sound/pci/hda/patch_ca0110.c
index 019ca7cb56d7..d08353d3bb7f 100644
--- a/sound/pci/hda/patch_ca0110.c
+++ b/sound/pci/hda/patch_ca0110.c
@@ -459,8 +459,7 @@ static void parse_input(struct hda_codec *codec)
459 nid = codec->start_nid; 459 nid = codec->start_nid;
460 for (i = 0; i < codec->num_nodes; i++, nid++) { 460 for (i = 0; i < codec->num_nodes; i++, nid++) {
461 unsigned int wcaps = get_wcaps(codec, nid); 461 unsigned int wcaps = get_wcaps(codec, nid);
462 unsigned int type = (wcaps & AC_WCAP_TYPE) >> 462 unsigned int type = get_wcaps_type(wcaps);
463 AC_WCAP_TYPE_SHIFT;
464 if (type != AC_WID_AUD_IN) 463 if (type != AC_WID_AUD_IN)
465 continue; 464 continue;
466 if (snd_hda_get_connections(codec, nid, &pin, 1) != 1) 465 if (snd_hda_get_connections(codec, nid, &pin, 1) != 1)
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index e1563f48243f..df87c01e27dd 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -415,7 +415,7 @@ static int alc_mux_enum_put(struct snd_kcontrol *kcontrol,
415 mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx; 415 mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx;
416 imux = &spec->input_mux[mux_idx]; 416 imux = &spec->input_mux[mux_idx];
417 417
418 type = (get_wcaps(codec, nid) & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; 418 type = get_wcaps_type(get_wcaps(codec, nid));
419 if (type == AC_WID_AUD_MIX) { 419 if (type == AC_WID_AUD_MIX) {
420 /* Matrix-mixer style (e.g. ALC882) */ 420 /* Matrix-mixer style (e.g. ALC882) */
421 unsigned int *cur_val = &spec->cur_mux[adc_idx]; 421 unsigned int *cur_val = &spec->cur_mux[adc_idx];
@@ -4623,7 +4623,7 @@ static int patch_alc880(struct hda_codec *codec)
4623 /* check whether NID 0x07 is valid */ 4623 /* check whether NID 0x07 is valid */
4624 unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]); 4624 unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]);
4625 /* get type */ 4625 /* get type */
4626 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; 4626 wcap = get_wcaps_type(wcap);
4627 if (wcap != AC_WID_AUD_IN) { 4627 if (wcap != AC_WID_AUD_IN) {
4628 spec->adc_nids = alc880_adc_nids_alt; 4628 spec->adc_nids = alc880_adc_nids_alt;
4629 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt); 4629 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt);
@@ -6266,7 +6266,7 @@ static int patch_alc260(struct hda_codec *codec)
6266 if (!spec->adc_nids && spec->input_mux) { 6266 if (!spec->adc_nids && spec->input_mux) {
6267 /* check whether NID 0x04 is valid */ 6267 /* check whether NID 0x04 is valid */
6268 unsigned int wcap = get_wcaps(codec, 0x04); 6268 unsigned int wcap = get_wcaps(codec, 0x04);
6269 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; 6269 wcap = get_wcaps_type(wcap);
6270 /* get type */ 6270 /* get type */
6271 if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { 6271 if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
6272 spec->adc_nids = alc260_adc_nids_alt; 6272 spec->adc_nids = alc260_adc_nids_alt;
@@ -9460,7 +9460,7 @@ static int alc882_parse_auto_config(struct hda_codec *codec)
9460 spec->init_verbs[0] = alc883_auto_init_verbs; 9460 spec->init_verbs[0] = alc883_auto_init_verbs;
9461 /* if ADC 0x07 is available, initialize it, too */ 9461 /* if ADC 0x07 is available, initialize it, too */
9462 wcap = get_wcaps(codec, 0x07); 9462 wcap = get_wcaps(codec, 0x07);
9463 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; 9463 wcap = get_wcaps_type(wcap);
9464 if (wcap == AC_WID_AUD_IN) 9464 if (wcap == AC_WID_AUD_IN)
9465 add_verb(spec, alc882_adc1_init_verbs); 9465 add_verb(spec, alc882_adc1_init_verbs);
9466 9466
@@ -9577,7 +9577,7 @@ static int patch_alc882(struct hda_codec *codec)
9577 hda_nid_t nid = alc882_adc_nids[i]; 9577 hda_nid_t nid = alc882_adc_nids[i];
9578 unsigned int wcap = get_wcaps(codec, nid); 9578 unsigned int wcap = get_wcaps(codec, nid);
9579 /* get type */ 9579 /* get type */
9580 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; 9580 wcap = get_wcaps_type(wcap);
9581 if (wcap != AC_WID_AUD_IN) 9581 if (wcap != AC_WID_AUD_IN)
9582 continue; 9582 continue;
9583 spec->private_adc_nids[spec->num_adc_nids] = nid; 9583 spec->private_adc_nids[spec->num_adc_nids] = nid;
@@ -11460,7 +11460,7 @@ static int patch_alc262(struct hda_codec *codec)
11460 unsigned int wcap = get_wcaps(codec, 0x07); 11460 unsigned int wcap = get_wcaps(codec, 0x07);
11461 11461
11462 /* get type */ 11462 /* get type */
11463 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; 11463 wcap = get_wcaps_type(wcap);
11464 if (wcap != AC_WID_AUD_IN) { 11464 if (wcap != AC_WID_AUD_IN) {
11465 spec->adc_nids = alc262_adc_nids_alt; 11465 spec->adc_nids = alc262_adc_nids_alt;
11466 spec->num_adc_nids = 11466 spec->num_adc_nids =
@@ -12536,7 +12536,7 @@ static int patch_alc268(struct hda_codec *codec)
12536 int i; 12536 int i;
12537 12537
12538 /* get type */ 12538 /* get type */
12539 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; 12539 wcap = get_wcaps_type(wcap);
12540 if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { 12540 if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
12541 spec->adc_nids = alc268_adc_nids_alt; 12541 spec->adc_nids = alc268_adc_nids_alt;
12542 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt); 12542 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt);
@@ -13991,8 +13991,7 @@ static hda_nid_t alc861_look_for_dac(struct hda_codec *codec, hda_nid_t pin)
13991 return 0; 13991 return 0;
13992 for (i = 0; i < num; i++) { 13992 for (i = 0; i < num; i++) {
13993 unsigned int type; 13993 unsigned int type;
13994 type = (get_wcaps(codec, srcs[i]) & AC_WCAP_TYPE) 13994 type = get_wcaps_type(get_wcaps(codec, srcs[i]));
13995 >> AC_WCAP_TYPE_SHIFT;
13996 if (type != AC_WID_AUD_OUT) 13995 if (type != AC_WID_AUD_OUT)
13997 continue; 13996 continue;
13998 for (j = 0; j < spec->multiout.num_dacs; j++) 13997 for (j = 0; j < spec->multiout.num_dacs; j++)
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
index 8c48f868d993..9de97f306999 100644
--- a/sound/pci/hda/patch_sigmatel.c
+++ b/sound/pci/hda/patch_sigmatel.c
@@ -3058,7 +3058,7 @@ static hda_nid_t get_unassigned_dac(struct hda_codec *codec, hda_nid_t nid)
3058 HDA_MAX_CONNECTIONS); 3058 HDA_MAX_CONNECTIONS);
3059 for (j = 0; j < conn_len; j++) { 3059 for (j = 0; j < conn_len; j++) {
3060 wcaps = get_wcaps(codec, conn[j]); 3060 wcaps = get_wcaps(codec, conn[j]);
3061 wtype = (wcaps & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; 3061 wtype = get_wcaps_type(wcaps);
3062 /* we check only analog outputs */ 3062 /* we check only analog outputs */
3063 if (wtype != AC_WID_AUD_OUT || (wcaps & AC_WCAP_DIGITAL)) 3063 if (wtype != AC_WID_AUD_OUT || (wcaps & AC_WCAP_DIGITAL))
3064 continue; 3064 continue;
@@ -3746,8 +3746,7 @@ static int stac92xx_parse_auto_config(struct hda_codec *codec, hda_nid_t dig_out
3746 conn_list, 1) > 0) { 3746 conn_list, 1) > 0) {
3747 3747
3748 int wcaps = get_wcaps(codec, conn_list[0]); 3748 int wcaps = get_wcaps(codec, conn_list[0]);
3749 int wid_type = (wcaps & AC_WCAP_TYPE) 3749 int wid_type = get_wcaps_type(wcaps);
3750 >> AC_WCAP_TYPE_SHIFT;
3751 /* LR swap check, some stac925x have a mux that 3750 /* LR swap check, some stac925x have a mux that
3752 * changes the DACs output path instead of the 3751 * changes the DACs output path instead of the
3753 * mono-mux path. 3752 * mono-mux path.
@@ -4753,8 +4752,7 @@ static int stac92xx_suspend(struct hda_codec *codec, pm_message_t state)
4753 nid = codec->start_nid; 4752 nid = codec->start_nid;
4754 for (i = 0; i < codec->num_nodes; i++, nid++) { 4753 for (i = 0; i < codec->num_nodes; i++, nid++) {
4755 unsigned int wcaps = get_wcaps(codec, nid); 4754 unsigned int wcaps = get_wcaps(codec, nid);
4756 unsigned int wid_type = (wcaps & AC_WCAP_TYPE) >> 4755 unsigned int wid_type = get_wcaps_type(wcaps);
4757 AC_WCAP_TYPE_SHIFT;
4758 if (wid_type == AC_WID_PIN) 4756 if (wid_type == AC_WID_PIN)
4759 snd_hda_codec_read(codec, nid, 0, 4757 snd_hda_codec_read(codec, nid, 0,
4760 AC_VERB_SET_PIN_WIDGET_CONTROL, 0); 4758 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
diff --git a/sound/pci/hda/patch_via.c b/sound/pci/hda/patch_via.c
index 9008b4b013aa..ab90abb04ccd 100644
--- a/sound/pci/hda/patch_via.c
+++ b/sound/pci/hda/patch_via.c
@@ -1339,8 +1339,7 @@ static int get_mux_nids(struct hda_codec *codec)
1339 for (i = 0; i < spec->num_adc_nids; i++) { 1339 for (i = 0; i < spec->num_adc_nids; i++) {
1340 nid = spec->adc_nids[i]; 1340 nid = spec->adc_nids[i];
1341 while (nid) { 1341 while (nid) {
1342 type = (get_wcaps(codec, nid) & AC_WCAP_TYPE) 1342 type = get_wcaps_type(get_wcaps(codec, nid));
1343 >> AC_WCAP_TYPE_SHIFT;
1344 if (type == AC_WID_PIN) 1343 if (type == AC_WID_PIN)
1345 break; 1344 break;
1346 n = snd_hda_get_connections(codec, nid, conn, 1345 n = snd_hda_get_connections(codec, nid, conn,