alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] You guessed it, it's generic parser patches
@ 2013-01-18 14:43 David Henningsson
  2013-01-18 14:43 ` [PATCH 1/3] ALSA: hda - make sure there are enough input labels and paths David Henningsson
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: David Henningsson @ 2013-01-18 14:43 UTC (permalink / raw)
  To: tiwai, alsa-devel; +Cc: David Henningsson

The third one seems to apply to the regular sound tree too.

David Henningsson (3):
  ALSA: hda - make sure there are enough input labels and paths
  ALSA: hda - don't compare with yourself in fill_input_pin_labels
  ALSA: hda - Don't add unnecessary indices on HDMI and SPDIF

 sound/pci/hda/hda_auto_parser.c |   22 ++++++++++++----------
 sound/pci/hda/hda_generic.c     |    4 ++--
 sound/pci/hda/hda_generic.h     |    6 +++---
 3 files changed, 17 insertions(+), 15 deletions(-)

-- 
1.7.9.5

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/3] ALSA: hda - make sure there are enough input labels and paths
  2013-01-18 14:43 [PATCH 0/3] You guessed it, it's generic parser patches David Henningsson
@ 2013-01-18 14:43 ` David Henningsson
  2013-01-18 14:43 ` [PATCH 2/3] ALSA: hda - don't compare with yourself in fill_input_pin_labels David Henningsson
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: David Henningsson @ 2013-01-18 14:43 UTC (permalink / raw)
  To: tiwai, alsa-devel; +Cc: David Henningsson

I found a codec configuration which had six inputs, so the max of
five was not appropriate.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
---
 sound/pci/hda/hda_generic.c |    2 +-
 sound/pci/hda/hda_generic.h |    6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/sound/pci/hda/hda_generic.c b/sound/pci/hda/hda_generic.c
index cadfe65..13e13df 100644
--- a/sound/pci/hda/hda_generic.c
+++ b/sound/pci/hda/hda_generic.c
@@ -2649,7 +2649,7 @@ static struct nid_path *get_input_path(struct hda_codec *codec, int adc_idx, int
 	}
 	if (spec->dyn_adc_switch)
 		adc_idx = spec->dyn_adc_idx[imux_idx];
-	if (adc_idx < 0 || adc_idx >= AUTO_CFG_MAX_OUTS) {
+	if (adc_idx < 0 || adc_idx >= AUTO_CFG_MAX_INS) {
 		snd_BUG();
 		return NULL;
 	}
diff --git a/sound/pci/hda/hda_generic.h b/sound/pci/hda/hda_generic.h
index f6b88cd..94bf4bc 100644
--- a/sound/pci/hda/hda_generic.h
+++ b/sound/pci/hda/hda_generic.h
@@ -105,8 +105,8 @@ struct hda_gen_spec {
 	hda_nid_t adc_nids[AUTO_CFG_MAX_OUTS];
 	hda_nid_t dig_in_nid;		/* digital-in NID; optional */
 	hda_nid_t mixer_nid;		/* analog-mixer NID */
-	const char *input_labels[AUTO_CFG_MAX_OUTS];
-	int input_label_idxs[AUTO_CFG_MAX_OUTS];
+	const char *input_labels[AUTO_CFG_MAX_INS];
+	int input_label_idxs[AUTO_CFG_MAX_INS];
 
 	/* capture setup for dynamic dual-adc switch */
 	hda_nid_t cur_adc;
@@ -159,7 +159,7 @@ struct hda_gen_spec {
 	int speaker_paths[AUTO_CFG_MAX_OUTS];
 	int aamix_out_paths[3];
 	int digout_paths[AUTO_CFG_MAX_OUTS];
-	int input_paths[HDA_MAX_NUM_INPUTS][AUTO_CFG_MAX_OUTS];
+	int input_paths[HDA_MAX_NUM_INPUTS][AUTO_CFG_MAX_INS];
 	int loopback_paths[HDA_MAX_NUM_INPUTS];
 	int digin_path;
 
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/3] ALSA: hda - don't compare with yourself in fill_input_pin_labels
  2013-01-18 14:43 [PATCH 0/3] You guessed it, it's generic parser patches David Henningsson
  2013-01-18 14:43 ` [PATCH 1/3] ALSA: hda - make sure there are enough input labels and paths David Henningsson
@ 2013-01-18 14:43 ` David Henningsson
  2013-01-18 14:43 ` [PATCH 3/3] ALSA: hda - Don't add unnecessary indices on HDMI and SPDIF David Henningsson
  2013-01-18 15:31 ` [PATCH 0/3] You guessed it, it's generic parser patches Takashi Iwai
  3 siblings, 0 replies; 5+ messages in thread
From: David Henningsson @ 2013-01-18 14:43 UTC (permalink / raw)
  To: tiwai, alsa-devel; +Cc: David Henningsson

Just stumbled over this one while reading the code.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
---
 sound/pci/hda/hda_generic.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/pci/hda/hda_generic.c b/sound/pci/hda/hda_generic.c
index 13e13df..a5b87c5 100644
--- a/sound/pci/hda/hda_generic.c
+++ b/sound/pci/hda/hda_generic.c
@@ -2555,7 +2555,7 @@ static int fill_input_pin_labels(struct hda_codec *codec)
 
 		label = hda_get_autocfg_input_label(codec, cfg, i);
 		idx = 0;
-		for (j = i; j >= 0; j--) {
+		for (j = i-1; j >= 0; j--) {
 			if (spec->input_labels[j] &&
 			    !strcmp(spec->input_labels[j], label)) {
 				idx = spec->input_label_idxs[j] + 1;
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 3/3] ALSA: hda - Don't add unnecessary indices on HDMI and SPDIF
  2013-01-18 14:43 [PATCH 0/3] You guessed it, it's generic parser patches David Henningsson
  2013-01-18 14:43 ` [PATCH 1/3] ALSA: hda - make sure there are enough input labels and paths David Henningsson
  2013-01-18 14:43 ` [PATCH 2/3] ALSA: hda - don't compare with yourself in fill_input_pin_labels David Henningsson
@ 2013-01-18 14:43 ` David Henningsson
  2013-01-18 15:31 ` [PATCH 0/3] You guessed it, it's generic parser patches Takashi Iwai
  3 siblings, 0 replies; 5+ messages in thread
From: David Henningsson @ 2013-01-18 14:43 UTC (permalink / raw)
  To: tiwai, alsa-devel; +Cc: David Henningsson

If there's one each of HDMI and SPDIF, we should not add an index
on the one that comes second.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
---
 sound/pci/hda/hda_auto_parser.c |   22 ++++++++++++----------
 1 file changed, 12 insertions(+), 10 deletions(-)

diff --git a/sound/pci/hda/hda_auto_parser.c b/sound/pci/hda/hda_auto_parser.c
index a4810c7..dcb6575 100644
--- a/sound/pci/hda/hda_auto_parser.c
+++ b/sound/pci/hda/hda_auto_parser.c
@@ -603,6 +603,7 @@ int snd_hda_get_pin_label(struct hda_codec *codec, hda_nid_t nid,
 	unsigned int def_conf = snd_hda_codec_get_pincfg(codec, nid);
 	const char *name = NULL;
 	int i;
+	bool hdmi;
 
 	if (indexp)
 		*indexp = 0;
@@ -621,16 +622,17 @@ int snd_hda_get_pin_label(struct hda_codec *codec, hda_nid_t nid,
 					   label, maxlen, indexp);
 	case AC_JACK_SPDIF_OUT:
 	case AC_JACK_DIG_OTHER_OUT:
-		if (get_defcfg_location(def_conf) == AC_JACK_LOC_HDMI)
-			name = "HDMI";
-		else
-			name = "SPDIF";
-		if (cfg && indexp) {
-			i = find_idx_in_nid_list(nid, cfg->dig_out_pins,
-						 cfg->dig_outs);
-			if (i >= 0)
-				*indexp = i;
-		}
+		hdmi = get_defcfg_location(def_conf) == AC_JACK_LOC_HDMI;
+		name = hdmi ? "HDMI" : "SPDIF";
+		if (cfg && indexp)
+			for (i = 0; i < cfg->dig_outs; i++) {
+				unsigned int c;
+				if (cfg->dig_out_pins[i] == nid)
+					break;
+				c = snd_hda_codec_get_pincfg(codec, cfg->dig_out_pins[i]);
+				if (hdmi == (get_defcfg_location(c) == AC_JACK_LOC_HDMI))
+					(*indexp)++;
+			}
 		break;
 	default:
 		if (cfg) {
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 0/3] You guessed it, it's generic parser patches
  2013-01-18 14:43 [PATCH 0/3] You guessed it, it's generic parser patches David Henningsson
                   ` (2 preceding siblings ...)
  2013-01-18 14:43 ` [PATCH 3/3] ALSA: hda - Don't add unnecessary indices on HDMI and SPDIF David Henningsson
@ 2013-01-18 15:31 ` Takashi Iwai
  3 siblings, 0 replies; 5+ messages in thread
From: Takashi Iwai @ 2013-01-18 15:31 UTC (permalink / raw)
  To: David Henningsson; +Cc: alsa-devel

At Fri, 18 Jan 2013 15:43:00 +0100,
David Henningsson wrote:
> 
> The third one seems to apply to the regular sound tree too.
> 
> David Henningsson (3):
>   ALSA: hda - make sure there are enough input labels and paths
>   ALSA: hda - don't compare with yourself in fill_input_pin_labels
>   ALSA: hda - Don't add unnecessary indices on HDMI and SPDIF

Thanks, applied now (with a slight code refactoring in the third
patch).


Takashi

> 
>  sound/pci/hda/hda_auto_parser.c |   22 ++++++++++++----------
>  sound/pci/hda/hda_generic.c     |    4 ++--
>  sound/pci/hda/hda_generic.h     |    6 +++---
>  3 files changed, 17 insertions(+), 15 deletions(-)
> 
> -- 
> 1.7.9.5
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-01-18 15:31 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-18 14:43 [PATCH 0/3] You guessed it, it's generic parser patches David Henningsson
2013-01-18 14:43 ` [PATCH 1/3] ALSA: hda - make sure there are enough input labels and paths David Henningsson
2013-01-18 14:43 ` [PATCH 2/3] ALSA: hda - don't compare with yourself in fill_input_pin_labels David Henningsson
2013-01-18 14:43 ` [PATCH 3/3] ALSA: hda - Don't add unnecessary indices on HDMI and SPDIF David Henningsson
2013-01-18 15:31 ` [PATCH 0/3] You guessed it, it's generic parser patches Takashi Iwai

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).