All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ALSA: HDA: cxt5066 - Use asus model for Asus U50F, select correct SPDIF output
@ 2011-01-24  6:59 Andy Robinson
  2011-01-24 13:16 ` Takashi Iwai
  0 siblings, 1 reply; 4+ messages in thread
From: Andy Robinson @ 2011-01-24  6:59 UTC (permalink / raw)
  To: ALSA Development Mailing List; +Cc: tiwai

[-- Attachment #1: Type: text/plain, Size: 240 bytes --]

The attached patch adds a quirk to use the newly-added asus model for
the Asus U50F. It also selects the correct digital outputs based on
the pin config instead of always using node 0x21, since the Asus U50F
uses node 0x12 for digital out.

[-- Attachment #2: 0001-ALSA-HDA-Use-asus-model-for-Asus-U50F-select-correct.patch --]
[-- Type: text/x-patch, Size: 3882 bytes --]

From b8d44308767f85a815e79fc55474672087f4dec9 Mon Sep 17 00:00:00 2001
From: Andy Robinson <ajr55555@gmail.com>
Date: Mon, 24 Jan 2011 01:19:23 -0500
Subject: [PATCH 1/1] ALSA: HDA: Use asus model for Asus U50F, select correct SPDIF output


Signed-off-by: Andy Robinson <ajr55555@gmail.com>

diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c
index 19f0daf..4402784 100644
--- a/sound/pci/hda/patch_conexant.c
+++ b/sound/pci/hda/patch_conexant.c
@@ -85,6 +85,7 @@ struct conexant_spec {
 	unsigned int auto_mic;
 	int auto_mic_ext;		/* autocfg.inputs[] index for ext mic */
 	unsigned int need_dac_fix;
+	hda_nid_t slave_dig_outs[2];
 
 	/* capture */
 	unsigned int num_adc_nids;
@@ -353,6 +354,9 @@ static int conexant_build_pcms(struct hda_codec *codec)
 			info->stream[SNDRV_PCM_STREAM_CAPTURE].nid =
 				spec->dig_in_nid;
 		}
+		if (spec->slave_dig_outs[0]) {
+			codec->slave_dig_outs = spec->slave_dig_outs;
+		}
 	}
 
 	return 0;
@@ -2101,7 +2105,7 @@ static int patch_cxt5051(struct hda_codec *codec)
 static hda_nid_t cxt5066_dac_nids[1] = { 0x10 };
 static hda_nid_t cxt5066_adc_nids[3] = { 0x14, 0x15, 0x16 };
 static hda_nid_t cxt5066_capsrc_nids[1] = { 0x17 };
-#define CXT5066_SPDIF_OUT	0x21
+static hda_nid_t cxt5066_digout_pin_nids[2] = { 0x20, 0x22 };
 
 /* OLPC's microphone port is DC coupled for use with external sensors,
  * therefore we use a 50% mic bias in order to center the input signal with
@@ -2623,6 +2627,27 @@ static void cxt5066_olpc_capture_cleanup(struct hda_codec *codec)
 	spec->recording = 0;
 }
 
+static void conexant_check_dig_outs(struct hda_codec *codec,
+				    hda_nid_t *dig_pins,
+				    int num_pins)
+{
+	struct conexant_spec *spec = codec->spec;
+	hda_nid_t *nid_loc = &spec->multiout.dig_out_nid;
+	int i;
+
+	for (i = 0; i < num_pins; i++) {
+		if (get_defcfg_connect(snd_hda_codec_get_pincfg(codec, *dig_pins)) != AC_JACK_PORT_NONE
+		    && snd_hda_get_connections(codec, *dig_pins, nid_loc, 1) == 1) {
+			if (spec->slave_dig_outs[0])
+				nid_loc++;
+			else
+				nid_loc = spec->slave_dig_outs;
+		}
+
+		dig_pins++;
+	}
+}
+
 static struct hda_input_mux cxt5066_capture_source = {
 	.num_items = 4,
 	.items = {
@@ -3085,8 +3110,9 @@ static struct snd_pci_quirk cxt5066_cfg_tbl[] = {
 	SND_PCI_QUIRK(0x1028, 0x0402, "Dell Vostro", CXT5066_DELL_VOSTRO),
 	SND_PCI_QUIRK(0x1028, 0x0408, "Dell Inspiron One 19T", CXT5066_IDEAPAD),
 	SND_PCI_QUIRK(0x103c, 0x360b, "HP G60", CXT5066_HP_LAPTOP),
-	SND_PCI_QUIRK(0x1043, 0x13f3, "Asus A52J", CXT5066_HP_LAPTOP),
+	SND_PCI_QUIRK(0x1043, 0x13f3, "Asus A52J", CXT5066_ASUS),
 	SND_PCI_QUIRK(0x1043, 0x1643, "Asus K52JU", CXT5066_ASUS),
+	SND_PCI_QUIRK(0x1043, 0x1993, "Asus U50F", CXT5066_ASUS),
 	SND_PCI_QUIRK(0x1179, 0xff1e, "Toshiba Satellite C650D", CXT5066_IDEAPAD),
 	SND_PCI_QUIRK(0x1179, 0xff50, "Toshiba Satellite P500-PSPGSC-01800T", CXT5066_OLPC_XO_1_5),
 	SND_PCI_QUIRK(0x1179, 0xffe0, "Toshiba Satellite Pro T130-15F", CXT5066_OLPC_XO_1_5),
@@ -3118,7 +3144,7 @@ static int patch_cxt5066(struct hda_codec *codec)
 	spec->multiout.max_channels = 2;
 	spec->multiout.num_dacs = ARRAY_SIZE(cxt5066_dac_nids);
 	spec->multiout.dac_nids = cxt5066_dac_nids;
-	spec->multiout.dig_out_nid = CXT5066_SPDIF_OUT;
+	conexant_check_dig_outs(codec, cxt5066_digout_pin_nids, ARRAY_SIZE(cxt5066_digout_pin_nids));
 	spec->num_adc_nids = 1;
 	spec->adc_nids = cxt5066_adc_nids;
 	spec->capsrc_nids = cxt5066_capsrc_nids;
@@ -3164,7 +3190,8 @@ static int patch_cxt5066(struct hda_codec *codec)
 		spec->mixers[spec->num_mixers++] = cxt5066_mixer_master;
 		spec->mixers[spec->num_mixers++] = cxt5066_mixers;
 		/* no S/PDIF out */
-		spec->multiout.dig_out_nid = 0;
+		if (board_config == CXT5066_HP_LAPTOP)
+			spec->multiout.dig_out_nid = 0;
 		/* input source automatically selected */
 		spec->input_mux = NULL;
 		spec->port_d_mode = 0;
-- 
1.7.1


[-- Attachment #3: Type: text/plain, Size: 160 bytes --]

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

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

* Re: [PATCH] ALSA: HDA: cxt5066 - Use asus model for Asus U50F, select correct SPDIF output
  2011-01-24  6:59 [PATCH] ALSA: HDA: cxt5066 - Use asus model for Asus U50F, select correct SPDIF output Andy Robinson
@ 2011-01-24 13:16 ` Takashi Iwai
  2011-01-24 15:53   ` Andy Robinson
  0 siblings, 1 reply; 4+ messages in thread
From: Takashi Iwai @ 2011-01-24 13:16 UTC (permalink / raw)
  To: Andy Robinson; +Cc: ALSA Development Mailing List

At Mon, 24 Jan 2011 01:59:52 -0500,
Andy Robinson wrote:
> 
> The attached patch adds a quirk to use the newly-added asus model for
> the Asus U50F. It also selects the correct digital outputs based on
> the pin config instead of always using node 0x21, since the Asus U50F
> uses node 0x12 for digital out.

The content changes look almost good to me.
Could you run checkpatch.pl and fix coding-style issues?

Also, put the comment like above into the git changelog itself.


thanks,

Takashi

> [2 0001-ALSA-HDA-Use-asus-model-for-Asus-U50F-select-correct.patch <text/x-patch; US-ASCII (base64)>]
> From b8d44308767f85a815e79fc55474672087f4dec9 Mon Sep 17 00:00:00 2001
> From: Andy Robinson <ajr55555@gmail.com>
> Date: Mon, 24 Jan 2011 01:19:23 -0500
> Subject: [PATCH 1/1] ALSA: HDA: Use asus model for Asus U50F, select correct SPDIF output
> 
> 
> Signed-off-by: Andy Robinson <ajr55555@gmail.com>
> 
> diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c
> index 19f0daf..4402784 100644
> --- a/sound/pci/hda/patch_conexant.c
> +++ b/sound/pci/hda/patch_conexant.c
> @@ -85,6 +85,7 @@ struct conexant_spec {
>  	unsigned int auto_mic;
>  	int auto_mic_ext;		/* autocfg.inputs[] index for ext mic */
>  	unsigned int need_dac_fix;
> +	hda_nid_t slave_dig_outs[2];
>  
>  	/* capture */
>  	unsigned int num_adc_nids;
> @@ -353,6 +354,9 @@ static int conexant_build_pcms(struct hda_codec *codec)
>  			info->stream[SNDRV_PCM_STREAM_CAPTURE].nid =
>  				spec->dig_in_nid;
>  		}
> +		if (spec->slave_dig_outs[0]) {
> +			codec->slave_dig_outs = spec->slave_dig_outs;
> +		}
>  	}
>  
>  	return 0;
> @@ -2101,7 +2105,7 @@ static int patch_cxt5051(struct hda_codec *codec)
>  static hda_nid_t cxt5066_dac_nids[1] = { 0x10 };
>  static hda_nid_t cxt5066_adc_nids[3] = { 0x14, 0x15, 0x16 };
>  static hda_nid_t cxt5066_capsrc_nids[1] = { 0x17 };
> -#define CXT5066_SPDIF_OUT	0x21
> +static hda_nid_t cxt5066_digout_pin_nids[2] = { 0x20, 0x22 };
>  
>  /* OLPC's microphone port is DC coupled for use with external sensors,
>   * therefore we use a 50% mic bias in order to center the input signal with
> @@ -2623,6 +2627,27 @@ static void cxt5066_olpc_capture_cleanup(struct hda_codec *codec)
>  	spec->recording = 0;
>  }
>  
> +static void conexant_check_dig_outs(struct hda_codec *codec,
> +				    hda_nid_t *dig_pins,
> +				    int num_pins)
> +{
> +	struct conexant_spec *spec = codec->spec;
> +	hda_nid_t *nid_loc = &spec->multiout.dig_out_nid;
> +	int i;
> +
> +	for (i = 0; i < num_pins; i++) {
> +		if (get_defcfg_connect(snd_hda_codec_get_pincfg(codec, *dig_pins)) != AC_JACK_PORT_NONE
> +		    && snd_hda_get_connections(codec, *dig_pins, nid_loc, 1) == 1) {
> +			if (spec->slave_dig_outs[0])
> +				nid_loc++;
> +			else
> +				nid_loc = spec->slave_dig_outs;
> +		}
> +
> +		dig_pins++;
> +	}
> +}
> +
>  static struct hda_input_mux cxt5066_capture_source = {
>  	.num_items = 4,
>  	.items = {
> @@ -3085,8 +3110,9 @@ static struct snd_pci_quirk cxt5066_cfg_tbl[] = {
>  	SND_PCI_QUIRK(0x1028, 0x0402, "Dell Vostro", CXT5066_DELL_VOSTRO),
>  	SND_PCI_QUIRK(0x1028, 0x0408, "Dell Inspiron One 19T", CXT5066_IDEAPAD),
>  	SND_PCI_QUIRK(0x103c, 0x360b, "HP G60", CXT5066_HP_LAPTOP),
> -	SND_PCI_QUIRK(0x1043, 0x13f3, "Asus A52J", CXT5066_HP_LAPTOP),
> +	SND_PCI_QUIRK(0x1043, 0x13f3, "Asus A52J", CXT5066_ASUS),
>  	SND_PCI_QUIRK(0x1043, 0x1643, "Asus K52JU", CXT5066_ASUS),
> +	SND_PCI_QUIRK(0x1043, 0x1993, "Asus U50F", CXT5066_ASUS),
>  	SND_PCI_QUIRK(0x1179, 0xff1e, "Toshiba Satellite C650D", CXT5066_IDEAPAD),
>  	SND_PCI_QUIRK(0x1179, 0xff50, "Toshiba Satellite P500-PSPGSC-01800T", CXT5066_OLPC_XO_1_5),
>  	SND_PCI_QUIRK(0x1179, 0xffe0, "Toshiba Satellite Pro T130-15F", CXT5066_OLPC_XO_1_5),
> @@ -3118,7 +3144,7 @@ static int patch_cxt5066(struct hda_codec *codec)
>  	spec->multiout.max_channels = 2;
>  	spec->multiout.num_dacs = ARRAY_SIZE(cxt5066_dac_nids);
>  	spec->multiout.dac_nids = cxt5066_dac_nids;
> -	spec->multiout.dig_out_nid = CXT5066_SPDIF_OUT;
> +	conexant_check_dig_outs(codec, cxt5066_digout_pin_nids, ARRAY_SIZE(cxt5066_digout_pin_nids));
>  	spec->num_adc_nids = 1;
>  	spec->adc_nids = cxt5066_adc_nids;
>  	spec->capsrc_nids = cxt5066_capsrc_nids;
> @@ -3164,7 +3190,8 @@ static int patch_cxt5066(struct hda_codec *codec)
>  		spec->mixers[spec->num_mixers++] = cxt5066_mixer_master;
>  		spec->mixers[spec->num_mixers++] = cxt5066_mixers;
>  		/* no S/PDIF out */
> -		spec->multiout.dig_out_nid = 0;
> +		if (board_config == CXT5066_HP_LAPTOP)
> +			spec->multiout.dig_out_nid = 0;
>  		/* input source automatically selected */
>  		spec->input_mux = NULL;
>  		spec->port_d_mode = 0;
> -- 
> 1.7.1
> 

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

* Re: [PATCH] ALSA: HDA: cxt5066 - Use asus model for Asus U50F, select correct SPDIF output
  2011-01-24 13:16 ` Takashi Iwai
@ 2011-01-24 15:53   ` Andy Robinson
  2011-01-24 16:45     ` Takashi Iwai
  0 siblings, 1 reply; 4+ messages in thread
From: Andy Robinson @ 2011-01-24 15:53 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: ALSA Development Mailing List

[-- Attachment #1: Type: text/plain, Size: 94 bytes --]

I have attached a revised version of the patch, for which checkpatch
reports no style issues.

[-- Attachment #2: 0001-ALSA-HDA-cxt5066-Use-asus-model-for-Asus-U50F-select.patch --]
[-- Type: text/x-patch, Size: 4291 bytes --]

From 2d8c97f5b69d721aec7dcacc4f8867530c1c572f Mon Sep 17 00:00:00 2001
From: Andy Robinson <ajr55555@gmail.com>
Date: Mon, 24 Jan 2011 10:12:37 -0500
Subject: [PATCH 1/1] ALSA: HDA: cxt5066 - Use asus model for Asus U50F, select correct SPDIF output
 Changed the Asus A52J quirk to use the asus model instead of the hp_laptop
 model, which fixes the external mic input. Added an Asus U50F quirk to use
 the asus model. For the cxt5066 codecs, added checking of the digital output
 pins to determine which digital output nodes to use instead of always using
 node 0x21, since some systems have node 0x12 connected to a SPDIF out jack.


Signed-off-by: Andy Robinson <ajr55555@gmail.com>

diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c
index 19f0daf..6bee262 100644
--- a/sound/pci/hda/patch_conexant.c
+++ b/sound/pci/hda/patch_conexant.c
@@ -85,6 +85,7 @@ struct conexant_spec {
 	unsigned int auto_mic;
 	int auto_mic_ext;		/* autocfg.inputs[] index for ext mic */
 	unsigned int need_dac_fix;
+	hda_nid_t slave_dig_outs[2];
 
 	/* capture */
 	unsigned int num_adc_nids;
@@ -353,6 +354,8 @@ static int conexant_build_pcms(struct hda_codec *codec)
 			info->stream[SNDRV_PCM_STREAM_CAPTURE].nid =
 				spec->dig_in_nid;
 		}
+		if (spec->slave_dig_outs[0])
+			codec->slave_dig_outs = spec->slave_dig_outs;
 	}
 
 	return 0;
@@ -2101,7 +2104,7 @@ static int patch_cxt5051(struct hda_codec *codec)
 static hda_nid_t cxt5066_dac_nids[1] = { 0x10 };
 static hda_nid_t cxt5066_adc_nids[3] = { 0x14, 0x15, 0x16 };
 static hda_nid_t cxt5066_capsrc_nids[1] = { 0x17 };
-#define CXT5066_SPDIF_OUT	0x21
+static hda_nid_t cxt5066_digout_pin_nids[2] = { 0x20, 0x22 };
 
 /* OLPC's microphone port is DC coupled for use with external sensors,
  * therefore we use a 50% mic bias in order to center the input signal with
@@ -2623,6 +2626,30 @@ static void cxt5066_olpc_capture_cleanup(struct hda_codec *codec)
 	spec->recording = 0;
 }
 
+static void conexant_check_dig_outs(struct hda_codec *codec,
+				    hda_nid_t *dig_pins,
+				    int num_pins)
+{
+	struct conexant_spec *spec = codec->spec;
+	hda_nid_t *nid_loc = &spec->multiout.dig_out_nid;
+	int i;
+
+	for (i = 0; i < num_pins; i++) {
+		if (get_defcfg_connect(
+		    snd_hda_codec_get_pincfg(codec, *dig_pins))
+			!= AC_JACK_PORT_NONE
+		    && snd_hda_get_connections(codec, *dig_pins, nid_loc, 1)
+			== 1) {
+			if (spec->slave_dig_outs[0])
+				nid_loc++;
+			else
+				nid_loc = spec->slave_dig_outs;
+		}
+
+		dig_pins++;
+	}
+}
+
 static struct hda_input_mux cxt5066_capture_source = {
 	.num_items = 4,
 	.items = {
@@ -3085,8 +3112,9 @@ static struct snd_pci_quirk cxt5066_cfg_tbl[] = {
 	SND_PCI_QUIRK(0x1028, 0x0402, "Dell Vostro", CXT5066_DELL_VOSTRO),
 	SND_PCI_QUIRK(0x1028, 0x0408, "Dell Inspiron One 19T", CXT5066_IDEAPAD),
 	SND_PCI_QUIRK(0x103c, 0x360b, "HP G60", CXT5066_HP_LAPTOP),
-	SND_PCI_QUIRK(0x1043, 0x13f3, "Asus A52J", CXT5066_HP_LAPTOP),
+	SND_PCI_QUIRK(0x1043, 0x13f3, "Asus A52J", CXT5066_ASUS),
 	SND_PCI_QUIRK(0x1043, 0x1643, "Asus K52JU", CXT5066_ASUS),
+	SND_PCI_QUIRK(0x1043, 0x1993, "Asus U50F", CXT5066_ASUS),
 	SND_PCI_QUIRK(0x1179, 0xff1e, "Toshiba Satellite C650D", CXT5066_IDEAPAD),
 	SND_PCI_QUIRK(0x1179, 0xff50, "Toshiba Satellite P500-PSPGSC-01800T", CXT5066_OLPC_XO_1_5),
 	SND_PCI_QUIRK(0x1179, 0xffe0, "Toshiba Satellite Pro T130-15F", CXT5066_OLPC_XO_1_5),
@@ -3118,7 +3146,8 @@ static int patch_cxt5066(struct hda_codec *codec)
 	spec->multiout.max_channels = 2;
 	spec->multiout.num_dacs = ARRAY_SIZE(cxt5066_dac_nids);
 	spec->multiout.dac_nids = cxt5066_dac_nids;
-	spec->multiout.dig_out_nid = CXT5066_SPDIF_OUT;
+	conexant_check_dig_outs(codec, cxt5066_digout_pin_nids,
+	    ARRAY_SIZE(cxt5066_digout_pin_nids));
 	spec->num_adc_nids = 1;
 	spec->adc_nids = cxt5066_adc_nids;
 	spec->capsrc_nids = cxt5066_capsrc_nids;
@@ -3164,7 +3193,8 @@ static int patch_cxt5066(struct hda_codec *codec)
 		spec->mixers[spec->num_mixers++] = cxt5066_mixer_master;
 		spec->mixers[spec->num_mixers++] = cxt5066_mixers;
 		/* no S/PDIF out */
-		spec->multiout.dig_out_nid = 0;
+		if (board_config == CXT5066_HP_LAPTOP)
+			spec->multiout.dig_out_nid = 0;
 		/* input source automatically selected */
 		spec->input_mux = NULL;
 		spec->port_d_mode = 0;
-- 
1.7.1


[-- Attachment #3: Type: text/plain, Size: 160 bytes --]

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

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

* Re: [PATCH] ALSA: HDA: cxt5066 - Use asus model for Asus U50F, select correct SPDIF output
  2011-01-24 15:53   ` Andy Robinson
@ 2011-01-24 16:45     ` Takashi Iwai
  0 siblings, 0 replies; 4+ messages in thread
From: Takashi Iwai @ 2011-01-24 16:45 UTC (permalink / raw)
  To: Andy Robinson; +Cc: ALSA Development Mailing List

At Mon, 24 Jan 2011 10:53:39 -0500,
Andy Robinson wrote:
> 
> I have attached a revised version of the patch, for which checkpatch
> reports no style issues.

Thanks!  I applied it now (with a minor code modification for a better
readability).


Takashi

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

end of thread, other threads:[~2011-01-24 16:45 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-24  6:59 [PATCH] ALSA: HDA: cxt5066 - Use asus model for Asus U50F, select correct SPDIF output Andy Robinson
2011-01-24 13:16 ` Takashi Iwai
2011-01-24 15:53   ` Andy Robinson
2011-01-24 16:45     ` Takashi Iwai

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.