alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: Gabriele Martino <g.martino@gmx.com>
To: alsa-devel@alsa-project.org
Subject: Re: Intel HDA / ca0132: support for Alienware 15 Creative Sound Core3D-EX
Date: Mon, 04 May 2015 01:53:37 +0200	[thread overview]
Message-ID: <5546B501.7050207@gmx.com> (raw)
In-Reply-To: <s5hvbge6u4x.wl-tiwai@suse.de>

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

On 30/04/2015 07:51, Takashi Iwai wrote:
> At Thu, 30 Apr 2015 01:40:30 +0200,
> Gabriele Martino wrote:
>> hdajacksensetest -c 1 -a
>> Pin 0x0b (Internal Speaker): present = Yes
>> Pin 0x0c (Not connected): present = No
>> Pin 0x0d (Not connected): present = No
>> Pin 0x0e (Not connected): present = No
>> Pin 0x0f (Not connected): present = Yes
>> Pin 0x10 (Not connected): present = No
>> Pin 0x11 (Black Line In, Left side): present = No
>> Pin 0x12 (Internal Mic, Mobile-In): present = No
>> Pin 0x13 (Not connected): present = No
>> Pin 0x18 (Not connected): present = No
>>
>> Pin 0x0f is still reported as not connected, but correctly detects the
>> jack if plugged.
>> If I turn off and on the "HP/Speaker Auto Detect" in alsamixer while
>> "HP/Speaker" is off, the correct output is detected.
>> If "HP/Speaker" is on, the behaviour is inconsistent.
>>
>> Is there a configuration file? Where can I find the metadata "Black Line
>> In, Left side"?
>> I don't know if it is related, but pavucontrol detects only the
>> "speakers" port.
>> On my previous laptop (with Creative Recon 3Di, another ca0132 card) I
>> could choose between "speakers and "headphones".
> It implies that the whole pin config BIOS provides is buggy.   The
> jack color, location, etc, all are parsed from 32bit pin configuration
> value for each pin.
>
> You need to correct the pin config and sets it statically in the
> driver.  hdajackretask can give you the map and reload it
> dynamically.
>
Finally got it.
I'm not sure about overriding the BIOS configuration: there is a new
version which fixes all the unconnected pins.
There is only a small issue: the internal speakers are now marked as
"Line out", which seems to mess up the "Ports" section in Pulseaudio.

Regards,
Gabriele

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: ca0132-quirks.patch --]
[-- Type: text/x-patch; name="ca0132-quirks.patch", Size: 3253 bytes --]

diff --git a/sound/pci/hda/patch_ca0132.c b/sound/pci/hda/patch_ca0132.c
index 4a4e7b2..04720ae 100644
--- a/sound/pci/hda/patch_ca0132.c
+++ b/sound/pci/hda/patch_ca0132.c
@@ -43,7 +43,7 @@
 #define FLOAT_TWO	0x40000000
 #define FLOAT_MINUS_5	0xc0a00000
 
-#define UNSOL_TAG_HP	0x10
+hda_nid_t UNSOL_TAG_HP = 0x10;
 #define UNSOL_TAG_AMIC1	0x12
 #define UNSOL_TAG_DSP	0x16
 
@@ -748,6 +748,7 @@ struct ca0132_spec {
 
 	struct hda_codec *codec;
 	struct delayed_work unsol_hp_work;
+	int quirk;
 
 #ifdef ENABLE_TUNING_CONTROLS
 	long cur_ctl_vals[TUNING_CTLS_COUNT];
@@ -755,6 +756,19 @@ struct ca0132_spec {
 };
 
 /*
+ * CA0132 quirks table
+ */
+enum {
+	QUIRK_NONE,
+	QUIRK_ALIENWARE,
+};
+
+static const struct snd_pci_quirk ca0132_quirks[] = {
+	SND_PCI_QUIRK(0x1028, 0x0685, "Alienware 15", QUIRK_ALIENWARE),
+	{}
+};
+
+/*
  * CA0132 codec access
  */
 static unsigned int codec_send_command(struct hda_codec *codec, hda_nid_t nid,
@@ -4479,8 +4493,19 @@ static struct hda_verb ca0132_init_verbs0[] = {
 	{}
 };
 
-static struct hda_verb ca0132_init_verbs1[] = {
-	{0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | UNSOL_TAG_HP},
+static struct hda_verb ca0132_init_verbs1_default[] = {
+	{0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x10}, /* UNSOL_TAG_HP is 0x10 */
+	{0x12, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | UNSOL_TAG_AMIC1},
+	/* config EAPD */
+	{0x0b, 0x78D, 0x00},
+	/*{0x0b, AC_VERB_SET_EAPD_BTLENABLE, 0x02},*/
+	/*{0x10, 0x78D, 0x02},*/
+	/*{0x10, AC_VERB_SET_EAPD_BTLENABLE, 0x02},*/
+	{}
+};
+
+static struct hda_verb ca0132_init_verbs1_alienware[] = {
+	{0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x0f}, /* UNSOL_TAG_HP is 0x0f */
 	{0x12, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | UNSOL_TAG_AMIC1},
 	/* config EAPD */
 	{0x0b, 0x78D, 0x00},
@@ -4617,7 +4642,13 @@ static void ca0132_config(struct hda_codec *codec)
 
 	spec->num_outputs = 2;
 	spec->out_pins[0] = 0x0b; /* speaker out */
-	spec->out_pins[1] = 0x10; /* headphone out */
+	if (spec->quirk == QUIRK_ALIENWARE) {
+		codec_dbg(codec, "ca0132_config: QUIRK_ALIENWARE applied.\n");
+		spec->out_pins[1] = 0x0f;
+	}
+	else{
+		spec->out_pins[1] = 0x10; /* headphone out */
+	}
 	spec->shared_out_nid = 0x2;
 
 	spec->num_inputs = 3;
@@ -4645,6 +4676,8 @@ static int patch_ca0132(struct hda_codec *codec)
 {
 	struct ca0132_spec *spec;
 	int err;
+	const struct snd_pci_quirk *quirk;
+	struct hda_verb *ca0132_init_verbs1;
 
 	codec_dbg(codec, "patch_ca0132\n");
 
@@ -4654,6 +4687,24 @@ static int patch_ca0132(struct hda_codec *codec)
 	codec->spec = spec;
 	spec->codec = codec;
 
+	quirk = snd_pci_quirk_lookup(codec->bus->pci, ca0132_quirks);
+	if (quirk) {
+		spec->quirk = quirk->value;
+	}
+	else{
+		spec->quirk = QUIRK_NONE;
+	}
+
+	/* Apply detected quirks */
+	if (spec->quirk == QUIRK_ALIENWARE) {
+		codec_dbg(codec, "patch_ca0132: QUIRK_ALIENWARE applied.\n");
+		UNSOL_TAG_HP = 0x0f;
+		ca0132_init_verbs1 = ca0132_init_verbs1_alienware;
+	}
+	else{
+		ca0132_init_verbs1 = ca0132_init_verbs1_default;
+	}
+
 	spec->dsp_state = DSP_DOWNLOAD_INIT;
 	spec->num_mixers = 1;
 	spec->mixers[0] = ca0132_mixer;

[-- Attachment #3: hda-jack-retask.fw --]
[-- Type: text/plain, Size: 216 bytes --]

[codec]
0x11020011 0x10280685 0

[pincfg]
0x0b 0x90174010
0x0c 0x014580f0
0x0d 0x014570f0
0x0e 0x01c530f0
0x0f 0x0221401f
0x10 0x02216011
0x11 0x02012014
0x12 0x37a791f0
0x13 0x908700f0
0x18 0x500000f0

[-- Attachment #4: Type: text/plain, Size: 0 bytes --]



  parent reply	other threads:[~2015-05-03 23:53 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-25  0:50 Intel HDA / ca0132: support for Alienware 15 Creative Sound Core3D-EX Gabriele Martino
2015-04-27  9:09 ` Takashi Iwai
2015-04-27 18:08   ` Gabriele Martino
2015-04-27 18:51     ` Takashi Iwai
2015-04-27 22:17       ` Gabriele Martino
2015-04-28  6:15         ` Takashi Iwai
2015-04-28 22:47           ` Gabriele Martino
2015-04-29 13:38             ` Takashi Iwai
2015-04-29 15:42               ` Gabriele Martino
2015-04-29 18:42                 ` Takashi Iwai
2015-04-29 23:40                   ` Gabriele Martino
2015-04-30  5:51                     ` Takashi Iwai
2015-05-01  0:36                       ` Gabriele Martino
2015-05-03 23:53                       ` Gabriele Martino [this message]
2015-05-04 12:30                         ` Takashi Iwai
2015-05-04 23:28                           ` Gabriele Martino
2015-05-11 20:17                           ` Gabriele Martino
2015-05-18  9:39                             ` Takashi Iwai
2015-05-18 19:15                               ` Gabriele Martino
2015-05-19  4:59                                 ` Takashi Iwai
2015-04-29 13:40             ` Takashi Iwai

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5546B501.7050207@gmx.com \
    --to=g.martino@gmx.com \
    --cc=alsa-devel@alsa-project.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).