Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* Restore default value for alc283
@ 2014-03-17  6:23 Kailang
  2014-03-17 10:13 ` Takashi Iwai
  0 siblings, 1 reply; 6+ messages in thread
From: Kailang @ 2014-03-17  6:23 UTC (permalink / raw)
  To: Kailang, Takashi Iwai; +Cc: alsa-devel

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

Hi Takashi,

Attachment is the patch for fix below issue.

Restore the registers to prevent the abnormal digital power supply
rising ratio/sequence to the codec and causing the incorrect default
codec register restoration during initialization.

Many Thanks.

BR,
Kailang

[-- Attachment #2: 0000-restore-default-for-alc283.patch --]
[-- Type: application/octet-stream, Size: 4123 bytes --]

>From 54cb00f4f0d73cfbb450e17e264c4a72de45912a Mon Sep 17 00:00:00 2001
From: Kailang Yang <kailang@realtek.com>
Date: Mon, 17 Mar 2014 13:51:27 +0800
Subject: [PATCH] ALSA: hda/realtek - Restore default value for ALC283

Restore the registers to prevent the abnormal digital power supply
rising ratio/sequence to the codec and causing the incorrect default
codec register restoration during initialization.

Signed-off-by: Kailang Yang <kailang@realtek.com>

diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 42b4f4d..56c7648 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -2787,6 +2787,89 @@ static void alc269_shutup(struct hda_codec *codec)
 	snd_hda_shutup_pins(codec);
 }
 
+static void alc283_restore_default_value(struct hda_codec *codec)
+{
+	int val;
+
+	/* Power Down Control */
+	alc_write_coef_idx(codec, 0x03, 0x0002);
+	/* FIFO and filter clock */
+	alc_write_coef_idx(codec, 0x05, 0x0700);
+	/* DMIC control */
+	alc_write_coef_idx(codec, 0x07, 0x0200);
+	/* Analog clock */
+	val = alc_read_coef_idx(codec, 0x06);
+	alc_write_coef_idx(codec, 0x06, (val & ~0x00f0) | 0x0);
+	/* JD */
+	val = alc_read_coef_idx(codec, 0x08);
+	alc_write_coef_idx(codec, 0x08, (val & ~0xfffc) | 0x0c2c);
+	/* JD offset1 */
+	alc_write_coef_idx(codec, 0x0a, 0xcccc);
+	/* JD offset2 */
+	alc_write_coef_idx(codec, 0x0b, 0xcccc);
+	/* LDO1/2/3, DAC/ADC */
+	alc_write_coef_idx(codec, 0x0e, 0x6fc0);
+	/* JD */
+	val = alc_read_coef_idx(codec, 0x0f);
+	alc_write_coef_idx(codec, 0x0f, (val & ~0xf800) | 0x1000);
+	/* Capless */
+	val = alc_read_coef_idx(codec, 0x10);
+	alc_write_coef_idx(codec, 0x10, (val & ~0xfc00) | 0x0c00);
+	/* Class D test 4 */
+	alc_write_coef_idx(codec, 0x3a, 0x0);
+	/* IO power down directly */
+	val = alc_read_coef_idx(codec, 0x0c);
+	alc_write_coef_idx(codec, 0x0c, (val & ~0xfe00) | 0x0);
+	/* ANC */
+	alc_write_coef_idx(codec, 0x22, 0xa0c0);
+	/* AGC MUX */
+	val = alc_read_coefex_idx(codec, 0x53, 0x01);
+	alc_write_coefex_idx(codec, 0x53, 0x01, (val & ~0x000f) | 0x0008 );
+	/* DAC simple content protection */
+	val = alc_read_coef_idx(codec, 0x1d);
+	alc_write_coef_idx(codec, 0x1d, (val & ~0x00e0) | 0x0);
+	/* ADC simple content protection */
+	val = alc_read_coef_idx(codec, 0x1f);
+	alc_write_coef_idx(codec, 0x1f, (val & ~0x00e0) | 0x0);
+	/* DAC ADC Zero Detection */
+	alc_write_coef_idx(codec, 0x21, 0x8804);
+	/* PLL */
+	alc_write_coef_idx(codec, 0x2e, 0x2902);
+	/* capless control 2 */
+	alc_write_coef_idx(codec, 0x33, 0xa080);
+	/* capless control 3 */
+	alc_write_coef_idx(codec, 0x34, 0x3400);
+	/* capless control 4 */
+	alc_write_coef_idx(codec, 0x35, 0x2f3e);
+	/* capless control 5 */
+	alc_write_coef_idx(codec, 0x36, 0x0);
+	/* class D test 2 */
+	val = alc_read_coef_idx(codec, 0x38);
+	alc_write_coef_idx(codec, 0x38, (val & ~0x0fff) | 0x0900);
+	/* class D test 3 */
+	alc_write_coef_idx(codec, 0x39, 0x110a);
+	/* class D test 5 */
+	val = alc_read_coef_idx(codec, 0x3b);
+	alc_write_coef_idx(codec, 0x3b, (val & ~0x00f8) | 0x00d8);
+	/* class D test 6 */
+	alc_write_coef_idx(codec, 0x3c, 0x0014);
+	/* classD OCP */
+	alc_write_coef_idx(codec, 0x3d, 0xc2ba);
+	/* classD pure DC test */
+	val = alc_read_coef_idx(codec, 0x42);
+	alc_write_coef_idx(codec, 0x42, (val & ~0x0f80) | 0x0);
+	/* test mode */
+	alc_write_coef_idx(codec, 0x49, 0x0);
+	/* Class D DC enable */
+	val = alc_read_coef_idx(codec, 0x40);
+	alc_write_coef_idx(codec, 0x40, (val & ~0xf800) | 0x9800);
+	/* DC offset */
+	val = alc_read_coef_idx(codec, 0x42);
+	alc_write_coef_idx(codec, 0x42, (val & ~0xf000) | 0x2000);
+	/* Class D amp control */
+	alc_write_coef_idx(codec, 0x37, 0xfc06);
+}
+
 static void alc283_init(struct hda_codec *codec)
 {
 	struct alc_spec *spec = codec->spec;
@@ -2794,6 +2877,8 @@ static void alc283_init(struct hda_codec *codec)
 	bool hp_pin_sense;
 	int val;
 
+	alc283_restore_default_value(codec);
+
 	if (!hp_pin)
 		return;
 	hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);

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



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

* Re: Restore default value for alc283
  2014-03-17  6:23 Restore default value for alc283 Kailang
@ 2014-03-17 10:13 ` Takashi Iwai
  2014-03-18  3:25   ` Kailang
  0 siblings, 1 reply; 6+ messages in thread
From: Takashi Iwai @ 2014-03-17 10:13 UTC (permalink / raw)
  To: Kailang; +Cc: alsa-devel

At Mon, 17 Mar 2014 14:23:24 +0800,
Kailang wrote:
> 
> Hi Takashi,
> 
> Attachment is the patch for fix below issue.
> 
> Restore the registers to prevent the abnormal digital power supply
> rising ratio/sequence to the codec and causing the incorrect default
> codec register restoration during initialization.

Thanks, applied.


Takashi

> 
> Many Thanks.
> 
> BR,
> Kailang
> [2 0000-restore-default-for-alc283.patch <application/octet-stream (quoted-printable)>]
> 

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

* Re: Restore default value for alc283
  2014-03-17 10:13 ` Takashi Iwai
@ 2014-03-18  3:25   ` Kailang
  2014-03-18  6:17     ` Takashi Iwai
  0 siblings, 1 reply; 6+ messages in thread
From: Kailang @ 2014-03-18  3:25 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: alsa-devel

Hi Takashi,

Sorry!
I can't find the record in 
http://git.kernel.org/cgit/linux/kernel/git/tiwai/sound.git/log/.
Could you know why?

BR,
Kailang


> At Mon, 17 Mar 2014 14:23:24 +0800,
> Kailang wrote:
>>
>> Hi Takashi,
>>
>> Attachment is the patch for fix below issue.
>>
>> Restore the registers to prevent the abnormal digital power supply
>> rising ratio/sequence to the codec and causing the incorrect default
>> codec register restoration during initialization.
>
> Thanks, applied.
>
>
> Takashi
>
>>
>> Many Thanks.
>>
>> BR,
>> Kailang
>> [2 0000-restore-default-for-alc283.patch <application/octet-stream 
>> (quoted-printable)>]
>>
>
> ------Please consider the environment before printing this e-mail. 

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

* Re: Restore default value for alc283
  2014-03-18  3:25   ` Kailang
@ 2014-03-18  6:17     ` Takashi Iwai
  2014-03-18  6:29       ` Kailang
  0 siblings, 1 reply; 6+ messages in thread
From: Takashi Iwai @ 2014-03-18  6:17 UTC (permalink / raw)
  To: Kailang; +Cc: alsa-devel

At Tue, 18 Mar 2014 11:25:43 +0800,
Kailang wrote:
> 
> Hi Takashi,
> 
> Sorry!
> I can't find the record in 
> http://git.kernel.org/cgit/linux/kernel/git/tiwai/sound.git/log/.
> Could you know why?

I waited for the test result in bug 71861.
   https://bugzilla.kernel.org/show_bug.cgi?id=71861
Now it's pushed out.


thanks,

Takashi

> 
> BR,
> Kailang
> 
> 
> > At Mon, 17 Mar 2014 14:23:24 +0800,
> > Kailang wrote:
> >>
> >> Hi Takashi,
> >>
> >> Attachment is the patch for fix below issue.
> >>
> >> Restore the registers to prevent the abnormal digital power supply
> >> rising ratio/sequence to the codec and causing the incorrect default
> >> codec register restoration during initialization.
> >
> > Thanks, applied.
> >
> >
> > Takashi
> >
> >>
> >> Many Thanks.
> >>
> >> BR,
> >> Kailang
> >> [2 0000-restore-default-for-alc283.patch <application/octet-stream 
> >> (quoted-printable)>]
> >>
> >
> > ------Please consider the environment before printing this e-mail. 
> 
> _______________________________________________
> Alsa-devel mailing list
> Alsa-devel@alsa-project.org
> http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
> 

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

* Re: Restore default value for alc283
  2014-03-18  6:17     ` Takashi Iwai
@ 2014-03-18  6:29       ` Kailang
       [not found]         ` <s5hfvmgdmux.wl%tiwai@suse.de>
  0 siblings, 1 reply; 6+ messages in thread
From: Kailang @ 2014-03-18  6:29 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: alsa-devel

Hi Takashi,

alc282 had two fixed.
1. depop for D0/D3.
2. Restore default value for alc282

Could i create two patches or just merge in one patch?
Many Thanks.

BR,
Kailang

> At Tue, 18 Mar 2014 11:25:43 +0800,
> Kailang wrote:
>> 
>> Hi Takashi,
>> 
>> Sorry!
>> I can't find the record in 
>> http://git.kernel.org/cgit/linux/kernel/git/tiwai/sound.git/log/.
>> Could you know why?
> 
> I waited for the test result in bug 71861.
>   https://bugzilla.kernel.org/show_bug.cgi?id=71861
> Now it's pushed out.
> 
> 
> thanks,
> 
> Takashi
> 
>> 
>> BR,
>> Kailang
>> 
>> 
>> > At Mon, 17 Mar 2014 14:23:24 +0800,
>> > Kailang wrote:
>> >>
>> >> Hi Takashi,
>> >>
>> >> Attachment is the patch for fix below issue.
>> >>
>> >> Restore the registers to prevent the abnormal digital power supply
>> >> rising ratio/sequence to the codec and causing the incorrect default
>> >> codec register restoration during initialization.
>> >
>> > Thanks, applied.
>> >
>> >
>> > Takashi
>> >
>> >>
>> >> Many Thanks.
>> >>
>> >> BR,
>> >> Kailang
>> >> [2 0000-restore-default-for-alc283.patch <application/octet-stream 
>> >> (quoted-printable)>]
>> >>
>> >
>> > ------Please consider the environment before printing this e-mail. 
>> 
>> _______________________________________________
>> Alsa-devel mailing list
>> Alsa-devel@alsa-project.org
>> http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
>>

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

* Restore default value for alc282
       [not found]         ` <s5hfvmgdmux.wl%tiwai@suse.de>
@ 2014-03-18  8:51           ` Kailang
  0 siblings, 0 replies; 6+ messages in thread
From: Kailang @ 2014-03-18  8:51 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: alsa-devel

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

Hi Takashi,

Attachment is the patch for fix below issue for alc282.

Restore the registers to prevent the abnormal digital power supply
rising ratio/sequence to the codec and causing the incorrect default
codec register restoration during initialization.

Many Thanks.

BR,
Kailang

[-- Attachment #2: 0000-restore-default-for-alc282.patch --]
[-- Type: application/octet-stream, Size: 3741 bytes --]

>From 7c2b927faf20d0f8f01a9371d18e3b62d315e7b4 Mon Sep 17 00:00:00 2001
From: Kailang Yang <kailang@realtek.com>
Date: Tue, 18 Mar 2014 16:45:32 +0800
Subject: [PATCH] ALSA: hda/realtek - Restore default value for ALC282

Restore the registers to prevent the abnormal digital power supply
rising ratio/sequence to the codec and causing the incorrect default
codec register restoration during initialization.

diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 9dffed3..b0e25e5 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -2787,6 +2787,81 @@ static void alc269_shutup(struct hda_codec *codec)
 	snd_hda_shutup_pins(codec);
 }
 
+static void alc282_restore_default_value(struct hda_codec *codec)
+{
+	int val;
+
+	/* Power Down Control */
+	alc_write_coef_idx(codec, 0x03, 0x0002);
+	/* FIFO and filter clock */
+	alc_write_coef_idx(codec, 0x05, 0x0700);
+	/* DMIC control */
+	alc_write_coef_idx(codec, 0x07, 0x0200);
+	/* Analog clock */
+	val = alc_read_coef_idx(codec, 0x06);
+	alc_write_coef_idx(codec, 0x06, (val & ~0x00f0) | 0x0);
+	/* JD */
+	val = alc_read_coef_idx(codec, 0x08);
+	alc_write_coef_idx(codec, 0x08, (val & ~0xfffc) | 0x0c2c);
+	/* JD offset1 */
+	alc_write_coef_idx(codec, 0x0a, 0xcccc);
+	/* JD offset2 */
+	alc_write_coef_idx(codec, 0x0b, 0xcccc);
+	/* LDO1/2/3, DAC/ADC */
+	alc_write_coef_idx(codec, 0x0e, 0x6e00);
+	/* JD */
+	val = alc_read_coef_idx(codec, 0x0f);
+	alc_write_coef_idx(codec, 0x0f, (val & ~0xf800) | 0x1000);
+	/* Capless */
+	val = alc_read_coef_idx(codec, 0x10);
+	alc_write_coef_idx(codec, 0x10, (val & ~0xfc00) | 0x0c00);
+	/* Class D test 4 */
+	alc_write_coef_idx(codec, 0x6f, 0x0);
+	/* IO power down directly */
+	val = alc_read_coef_idx(codec, 0x0c);
+	alc_write_coef_idx(codec, 0x0c, (val & ~0xfe00) | 0x0);
+	/* ANC */
+	alc_write_coef_idx(codec, 0x34, 0xa0c0);
+	/* AGC MUX */
+	val = alc_read_coef_idx(codec, 0x16);
+	alc_write_coef_idx(codec, 0x16, (val & ~0x0008) | 0x0);
+	/* DAC simple content protection */
+	val = alc_read_coef_idx(codec, 0x1d);
+	alc_write_coef_idx(codec, 0x1d, (val & ~0x00e0) | 0x0);
+	/* ADC simple content protection */
+	val = alc_read_coef_idx(codec, 0x1f);
+	alc_write_coef_idx(codec, 0x1f, (val & ~0x00e0) | 0x0);
+	/* DAC ADC Zero Detection */
+	alc_write_coef_idx(codec, 0x21, 0x8804);
+	/* PLL */
+	alc_write_coef_idx(codec, 0x63, 0x2902);
+	/* capless control 2 */
+	alc_write_coef_idx(codec, 0x68, 0xa080);
+	/* capless control 3 */
+	alc_write_coef_idx(codec, 0x69, 0x3400);
+	/* capless control 4 */
+	alc_write_coef_idx(codec, 0x6a, 0x2f3e);
+	/* capless control 5 */
+	alc_write_coef_idx(codec, 0x6b, 0x0);
+	/* class D test 2 */
+	val = alc_read_coef_idx(codec, 0x6d);
+	alc_write_coef_idx(codec, 0x6d, (val & ~0x0fff) | 0x0900);
+	/* class D test 3 */
+	alc_write_coef_idx(codec, 0x6e, 0x110a);
+	/* class D test 5 */
+	val = alc_read_coef_idx(codec, 0x70);
+	alc_write_coef_idx(codec, 0x70, (val & ~0x00f8) | 0x00d8);
+	/* class D test 6 */
+	alc_write_coef_idx(codec, 0x71, 0x0014);
+	/* classD OCP */
+	alc_write_coef_idx(codec, 0x72, 0xc2ba);
+	/* classD pure DC test */
+	val = alc_read_coef_idx(codec, 0x77);
+	alc_write_coef_idx(codec, 0x77, (val & ~0x0f80) | 0x0);
+	/* Class D amp control */
+	alc_write_coef_idx(codec, 0x6c, 0xfc06);
+}
+
 static void alc282_init(struct hda_codec *codec)
 {
 	struct alc_spec *spec = codec->spec;
@@ -2794,6 +2869,8 @@ static void alc282_init(struct hda_codec *codec)
 	bool hp_pin_sense;
 	int coef78;
 
+	alc282_restore_default_value(codec);
+
 	if (!hp_pin)
 		return;
 	hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);

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



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

end of thread, other threads:[~2014-03-18  8:51 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-17  6:23 Restore default value for alc283 Kailang
2014-03-17 10:13 ` Takashi Iwai
2014-03-18  3:25   ` Kailang
2014-03-18  6:17     ` Takashi Iwai
2014-03-18  6:29       ` Kailang
     [not found]         ` <s5hfvmgdmux.wl%tiwai@suse.de>
2014-03-18  8:51           ` Restore default value for alc282 Kailang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox