Ubuntu

Headset jack support for ALC255

Reported by David Henningsson on 2013-11-07
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
HWE Next
Undecided
David Henningsson
linux (Ubuntu)
Undecided
David Henningsson

Bug Description

This bug is for tracking purposes, please do not triage.

Changed in linux (Ubuntu):
status: New → In Progress
assignee: nobody → David Henningsson (diwic)
Download full text (6.9 KiB)

From: Kailang Yang <email address hidden>

The new codec ALC255 needs its own set of verbs to enable
multifunction jacks.

(Context and whitespace adjustments by David Henningsson)

BugLink: https://bugs.launchpad.net/bugs/1248949
Tested-by: Doro Wu <email address hidden>
Signed-off-by: David Henningsson <email address hidden>
---
 sound/pci/hda/patch_realtek.c | 91 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 91 insertions(+)

diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index daf7205..ceadd65 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -588,6 +588,18 @@ static int alc_read_coef_idx(struct hda_codec *codec,
  return val;
 }

+static int alc_read_coefex_idx(struct hda_codec *codec,
+ hda_nid_t nid,
+ unsigned int coef_idx)
+{
+ unsigned int val;
+ snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_COEF_INDEX,
+ coef_idx);
+ val = snd_hda_codec_read(codec, nid, 0,
+ AC_VERB_GET_PROC_COEF, 0);
+ return val;
+}
+
 static void alc_write_coef_idx(struct hda_codec *codec, unsigned int coef_idx,
        unsigned int coef_val)
 {
@@ -597,6 +609,15 @@ static void alc_write_coef_idx(struct hda_codec *codec, unsigned int coef_idx,
        coef_val);
 }

+static void alc_write_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
+ unsigned int coef_idx, unsigned int coef_val)
+{
+ snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_COEF_INDEX,
+ coef_idx);
+ snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PROC_COEF,
+ coef_val);
+}
+
 /* a special bypass for COEF 0; read the cached value at the second time */
 static unsigned int alc_get_coef0(struct hda_codec *codec)
 {
@@ -3109,6 +3130,14 @@ static void alc_headset_mode_unplugged(struct hda_codec *codec)
  int val;

  switch (codec->vendor_id) {
+ case 0x10ec0255:
+ alc_write_coef_idx(codec, 0x1b, 0x0c0b);
+ alc_write_coef_idx(codec, 0x45, 0xd089);
+ val = alc_read_coefex_idx(codec, 0x57, 0x05);
+ alc_write_coefex_idx(codec, 0x57, 0x05, val & ~(1<<14));
+ alc_write_coef_idx(codec, 0x06, 0x6104);
+ alc_write_coefex_idx(codec, 0x57, 0x03, 0x8aa6);
+ break;
  case 0x10ec0283:
   alc_write_coef_idx(codec, 0x1b, 0x0c0b);
   alc_write_coef_idx(codec, 0x45, 0xc429);
@@ -3140,6 +3169,13 @@ static void alc_headset_mode_mic_in(struct hda_codec *codec, hda_nid_t hp_pin,
  int val;

  switch (codec->vendor_id) {
+ case 0x10ec0255:
+ alc_write_coef_idx(codec, 0x45, 0xc489);
+ snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
+ alc_write_coefex_idx(codec, 0x57, 0x03, 0x8aa6);
+ alc_write_coef_idx(codec, 0x06, 0x6100);
+ snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
+ break;
  case 0x10ec0283:
   alc_write_coef_idx(codec, 0x45, 0xc429);
   snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
@@ -3171,6 +3207,12 @@ static void alc_headset_mode_mic_in(struct hda_codec *codec, hda_nid_t hp_pin,
 static void alc_headset_mode_default(struct hda_codec *codec)
 {
  switch (codec->vendor_id) {
+ case 0x10ec0255:
+ alc_write_coef_idx(codec, 0x45, 0xc089);
+ alc_write_coef_idx(codec, 0x45, 0xc489);
+ alc_write_coefex_idx(codec, 0x57, 0x03, 0x8ea6);
+ alc_write_coef_idx(codec, 0x49, 0x0049);
+ b...

Read more...

Takashi Iwai (tiwai) wrote :

At Thu, 7 Nov 2013 14:08:41 +0100,
David Henningsson wrote:
>
> From: Kailang Yang <email address hidden>
>
> The new codec ALC255 needs its own set of verbs to enable
> multifunction jacks.
>
> (Context and whitespace adjustments by David Henningsson)
>
> BugLink: https://bugs.launchpad.net/bugs/1248949
> Tested-by: Doro Wu <email address hidden>
> Signed-off-by: David Henningsson <email address hidden>
> ---
> sound/pci/hda/patch_realtek.c | 91 +++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 91 insertions(+)
>
> diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
> index daf7205..ceadd65 100644
> --- a/sound/pci/hda/patch_realtek.c
> +++ b/sound/pci/hda/patch_realtek.c
> @@ -588,6 +588,18 @@ static int alc_read_coef_idx(struct hda_codec *codec,
> return val;
> }
>
> +static int alc_read_coefex_idx(struct hda_codec *codec,
> + hda_nid_t nid,
> + unsigned int coef_idx)
> +{
> + unsigned int val;
> + snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_COEF_INDEX,
> + coef_idx);
> + val = snd_hda_codec_read(codec, nid, 0,
> + AC_VERB_GET_PROC_COEF, 0);
> + return val;
> +}

Rewrite alc_read_coef_idx() using this new function, too, e.g.

#define alc_write_coef_idx(codec, idx, val) \
 alc_read_coefex_idx(codec, 0x20, idx, val)

> static void alc_write_coef_idx(struct hda_codec *codec, unsigned int coef_idx,
> unsigned int coef_val)
> {
> @@ -597,6 +609,15 @@ static void alc_write_coef_idx(struct hda_codec *codec, unsigned int coef_idx,
> coef_val);
> }
>
> +static void alc_write_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
> + unsigned int coef_idx, unsigned int coef_val)
> +{
> + snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_COEF_INDEX,
> + coef_idx);
> + snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PROC_COEF,
> + coef_val);
> +}

Ditto.

> +
> /* a special bypass for COEF 0; read the cached value at the second time */
> static unsigned int alc_get_coef0(struct hda_codec *codec)
> {
> @@ -3109,6 +3130,14 @@ static void alc_headset_mode_unplugged(struct hda_codec *codec)
> int val;
>
> switch (codec->vendor_id) {
> + case 0x10ec0255:
> + alc_write_coef_idx(codec, 0x1b, 0x0c0b);
> + alc_write_coef_idx(codec, 0x45, 0xd089);
> + val = alc_read_coefex_idx(codec, 0x57, 0x05);
> + alc_write_coefex_idx(codec, 0x57, 0x05, val & ~(1<<14));
> + alc_write_coef_idx(codec, 0x06, 0x6104);
> + alc_write_coefex_idx(codec, 0x57, 0x03, 0x8aa6);

Try to comment what these actually do. Not necessarily too detailed,
but we need to have some ideas.

I regret to have merged the former Realtek headset patches that have
lots of such verbs without certain comments.

thanks,

Takashi

David Henningsson (diwic) wrote :
Download full text (3.2 KiB)

Hi,

I can certainly rewrite coef_idx to use coefef_idx (I think that's a
good idea), but for the comments, I know as little as you do about these
verbs.

Kailang, is it possible for you to add more comments to your patch so it
can be applied upstream?

Thanks,
  David

On 11/07/2013 02:22 PM, Takashi Iwai wrote:
> At Thu, 7 Nov 2013 14:08:41 +0100,
> David Henningsson wrote:
>>
>> From: Kailang Yang <email address hidden>
>>
>> The new codec ALC255 needs its own set of verbs to enable
>> multifunction jacks.
>>
>> (Context and whitespace adjustments by David Henningsson)
>>
>> BugLink: https://bugs.launchpad.net/bugs/1248949
>> Tested-by: Doro Wu <email address hidden>
>> Signed-off-by: David Henningsson <email address hidden>
>> ---
>> sound/pci/hda/patch_realtek.c | 91 +++++++++++++++++++++++++++++++++++++++++
>> 1 file changed, 91 insertions(+)
>>
>> diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
>> index daf7205..ceadd65 100644
>> --- a/sound/pci/hda/patch_realtek.c
>> +++ b/sound/pci/hda/patch_realtek.c
>> @@ -588,6 +588,18 @@ static int alc_read_coef_idx(struct hda_codec *codec,
>> return val;
>> }
>>
>> +static int alc_read_coefex_idx(struct hda_codec *codec,
>> + hda_nid_t nid,
>> + unsigned int coef_idx)
>> +{
>> + unsigned int val;
>> + snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_COEF_INDEX,
>> + coef_idx);
>> + val = snd_hda_codec_read(codec, nid, 0,
>> + AC_VERB_GET_PROC_COEF, 0);
>> + return val;
>> +}
>
> Rewrite alc_read_coef_idx() using this new function, too, e.g.
>
> #define alc_write_coef_idx(codec, idx, val) \
> alc_read_coefex_idx(codec, 0x20, idx, val)
>
>> static void alc_write_coef_idx(struct hda_codec *codec, unsigned int coef_idx,
>> unsigned int coef_val)
>> {
>> @@ -597,6 +609,15 @@ static void alc_write_coef_idx(struct hda_codec *codec, unsigned int coef_idx,
>> coef_val);
>> }
>>
>> +static void alc_write_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
>> + unsigned int coef_idx, unsigned int coef_val)
>> +{
>> + snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_COEF_INDEX,
>> + coef_idx);
>> + snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PROC_COEF,
>> + coef_val);
>> +}
>
> Ditto.
>
>> +
>> /* a special bypass for COEF 0; read the cached value at the second time */
>> static unsigned int alc_get_coef0(struct hda_codec *codec)
>> {
>> @@ -3109,6 +3130,14 @@ static void alc_headset_mode_unplugged(struct hda_codec *codec)
>> int val;
>>
>> switch (codec->vendor_id) {
>> + case 0x10ec0255:
>> + alc_write_coef_idx(codec, 0x1b, 0x0c0b);
>> + alc_write_coef_idx(codec, 0x45, 0xd089);
>> + val = alc_read_coefex_idx(codec, 0x57, 0x05);
>> + alc_write_coefex_idx(codec, 0x57, 0x05, val & ~(1<<14));
>> + alc_write_coef_idx(codec, 0x06, 0x6104);
>> + alc_write_coefex_idx(codec, 0x57, 0x03, 0x8aa6);
>
> Try to comment what these actually do. Not necessarily too detailed,
> but we need to have some ideas.
>
> I regret to have merged the former Realtek headset patches that have
> lots of such verbs without certain comments.
>
>
> thanks,
>
> Takashi
>

--
David Henningsson, Canonical Ltd.
h...

Read more...

tags: added: blocks-hwcert-enablement
David Henningsson (diwic) wrote :
Download full text (3.8 KiB)

Hi Kailang,

It does not matter. Choose what works best for you and I'll sort it out
before sending to Takashi.

// David

On 11/08/2013 06:48 AM, Kailang wrote:
> Hi David,
>
> Could I add commemts for belowing context?
> Or I create new patch for it.
>
> BR,
> Kailang
>
>> Hi,
>>
>> I can certainly rewrite coef_idx to use coefef_idx (I think that's a
>> good idea), but for the comments, I know as little as you do about these
>> verbs.
>>
>> Kailang, is it possible for you to add more comments to your patch so it
>> can be applied upstream?
>>
>> Thanks,
>> David
>>
>> On 11/07/2013 02:22 PM, Takashi Iwai wrote:
>>> At Thu, 7 Nov 2013 14:08:41 +0100,
>>> David Henningsson wrote:
>>>>
>>>> From: Kailang Yang <email address hidden>
>>>>
>>>> The new codec ALC255 needs its own set of verbs to enable
>>>> multifunction jacks.
>>>>
>>>> (Context and whitespace adjustments by David Henningsson)
>>>>
>>>> BugLink: https://bugs.launchpad.net/bugs/1248949
>>>> Tested-by: Doro Wu <email address hidden>
>>>> Signed-off-by: David Henningsson <email address hidden>
>>>> ---
>>>> sound/pci/hda/patch_realtek.c | 91
>>>> +++++++++++++++++++++++++++++++++++++++++
>>>> 1 file changed, 91 insertions(+)
>>>>
>>>> diff --git a/sound/pci/hda/patch_realtek.c
>>>> b/sound/pci/hda/patch_realtek.c
>>>> index daf7205..ceadd65 100644
>>>> --- a/sound/pci/hda/patch_realtek.c
>>>> +++ b/sound/pci/hda/patch_realtek.c
>>>> @@ -588,6 +588,18 @@ static int alc_read_coef_idx(struct hda_codec
>>>> *codec,
>>>> return val;
>>>> }
>>>>
>>>> +static int alc_read_coefex_idx(struct hda_codec *codec,
>>>> + hda_nid_t nid,
>>>> + unsigned int coef_idx)
>>>> +{
>>>> + unsigned int val;
>>>> + snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_COEF_INDEX,
>>>> + coef_idx);
>>>> + val = snd_hda_codec_read(codec, nid, 0,
>>>> + AC_VERB_GET_PROC_COEF, 0);
>>>> + return val;
>>>> +}
>>>
>>> Rewrite alc_read_coef_idx() using this new function, too, e.g.
>>>
>>> #define alc_write_coef_idx(codec, idx, val) \
>>> alc_read_coefex_idx(codec, 0x20, idx, val)
>>>
>>>> static void alc_write_coef_idx(struct hda_codec *codec, unsigned
>>>> int coef_idx,
>>>> unsigned int coef_val)
>>>> {
>>>> @@ -597,6 +609,15 @@ static void alc_write_coef_idx(struct hda_codec
>>>> *codec, unsigned int coef_idx,
>>>> coef_val);
>>>> }
>>>>
>>>> +static void alc_write_coefex_idx(struct hda_codec *codec, hda_nid_t
>>>> nid,
>>>> + unsigned int coef_idx, unsigned int coef_val)
>>>> +{
>>>> + snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_COEF_INDEX,
>>>> + coef_idx);
>>>> + snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PROC_COEF,
>>>> + coef_val);
>>>> +}
>>>
>>> Ditto.
>>>
>>>> +
>>>> /* a special bypass for COEF 0; read the cached value at the second
>>>> time */
>>>> static unsigned int alc_get_coef0(struct hda_codec *codec)
>>>> {
>>>> @@ -3109,6 +3130,14 @@ static void alc_headset_mode_unplugged(struct
>>>> hda_codec *codec)
>>>> int val;
>>>>
>>>> switch (codec->vendor_id) {
>>>> + case 0x10ec0255:
>>>> + alc_write_coef_idx(codec, 0x1b, 0x0c0b);
>>>> + alc_write_coef_idx(codec, 0x45, 0xd089);
>>>> + val = alc_read_coefex_idx(codec, 0x57, 0x05);
>>>> + alc_write_coefex_i...

Read more...

David Henningsson (diwic) wrote :
Download full text (4.3 KiB)

On 11/08/2013 09:19 AM, Kailang wrote:
> Hi David,
>
> I modified as attach patch.
> It included coef_idx to use coefex_idx.
>
> BR,
> Kailang

Thanks!

@Takashi, does this new patch look good enough for you?

>
>
>> Hi Kailang,
>>
>> It does not matter. Choose what works best for you and I'll sort it out
>> before sending to Takashi.
>>
>> // David
>>
>> On 11/08/2013 06:48 AM, Kailang wrote:
>>> Hi David,
>>>
>>> Could I add commemts for belowing context?
>>> Or I create new patch for it.
>>>
>>> BR,
>>> Kailang
>>>
>>>> Hi,
>>>>
>>>> I can certainly rewrite coef_idx to use coefef_idx (I think that's a
>>>> good idea), but for the comments, I know as little as you do about
>>>> these
>>>> verbs.
>>>>
>>>> Kailang, is it possible for you to add more comments to your patch
>>>> so it
>>>> can be applied upstream?
>>>>
>>>> Thanks,
>>>> David
>>>>
>>>> On 11/07/2013 02:22 PM, Takashi Iwai wrote:
>>>>> At Thu, 7 Nov 2013 14:08:41 +0100,
>>>>> David Henningsson wrote:
>>>>>>
>>>>>> From: Kailang Yang <email address hidden>
>>>>>>
>>>>>> The new codec ALC255 needs its own set of verbs to enable
>>>>>> multifunction jacks.
>>>>>>
>>>>>> (Context and whitespace adjustments by David Henningsson)
>>>>>>
>>>>>> BugLink: https://bugs.launchpad.net/bugs/1248949
>>>>>> Tested-by: Doro Wu <email address hidden>
>>>>>> Signed-off-by: David Henningsson <email address hidden>
>>>>>> ---
>>>>>> sound/pci/hda/patch_realtek.c | 91
>>>>>> +++++++++++++++++++++++++++++++++++++++++
>>>>>> 1 file changed, 91 insertions(+)
>>>>>>
>>>>>> diff --git a/sound/pci/hda/patch_realtek.c
>>>>>> b/sound/pci/hda/patch_realtek.c
>>>>>> index daf7205..ceadd65 100644
>>>>>> --- a/sound/pci/hda/patch_realtek.c
>>>>>> +++ b/sound/pci/hda/patch_realtek.c
>>>>>> @@ -588,6 +588,18 @@ static int alc_read_coef_idx(struct hda_codec
>>>>>> *codec,
>>>>>> return val;
>>>>>> }
>>>>>>
>>>>>> +static int alc_read_coefex_idx(struct hda_codec *codec,
>>>>>> + hda_nid_t nid,
>>>>>> + unsigned int coef_idx)
>>>>>> +{
>>>>>> + unsigned int val;
>>>>>> + snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_COEF_INDEX,
>>>>>> + coef_idx);
>>>>>> + val = snd_hda_codec_read(codec, nid, 0,
>>>>>> + AC_VERB_GET_PROC_COEF, 0);
>>>>>> + return val;
>>>>>> +}
>>>>>
>>>>> Rewrite alc_read_coef_idx() using this new function, too, e.g.
>>>>>
>>>>> #define alc_write_coef_idx(codec, idx, val) \
>>>>> alc_read_coefex_idx(codec, 0x20, idx, val)
>>>>>
>>>>>> static void alc_write_coef_idx(struct hda_codec *codec, unsigned
>>>>>> int coef_idx,
>>>>>> unsigned int coef_val)
>>>>>> {
>>>>>> @@ -597,6 +609,15 @@ static void alc_write_coef_idx(struct hda_codec
>>>>>> *codec, unsigned int coef_idx,
>>>>>> coef_val);
>>>>>> }
>>>>>>
>>>>>> +static void alc_write_coefex_idx(struct hda_codec *codec, hda_nid_t
>>>>>> nid,
>>>>>> + unsigned int coef_idx, unsigned int coef_val)
>>>>>> +{
>>>>>> + snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_COEF_INDEX,
>>>>>> + coef_idx);
>>>>>> + snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PROC_COEF,
>>>>>> + coef_val);
>>>>>> +}
>>>>>
>>>>> Ditto.
>>>>>
>>>>>> +
>>>>>> /* a special bypass for COEF 0; read the cached value at the second
>>>>>> time...

Read more...

Takashi Iwai (tiwai) wrote :

At Fri, 08 Nov 2013 11:10:48 +0100,
David Henningsson wrote:
>
> On 11/08/2013 09:19 AM, Kailang wrote:
> > Hi David,
> >
> > I modified as attach patch.
> > It included coef_idx to use coefex_idx.
> >
> > BR,
> > Kailang
>
> Thanks!
>
> @Takashi, does this new patch look good enough for you?

Yes, I applied it now (although more comments wouldn't be bad :)
Thanks.

Takashi

Changed in linux (Ubuntu):
status: In Progress → Fix Committed
Changed in hwe-next:
assignee: nobody → David Henningsson (diwic)
status: New → Fix Committed
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers