All of lore.kernel.org
 help / color / mirror / Atom feed
* hda/cs8409: Fix internal speaker detection
@ 2021-12-31 13:12 ` Christian A. Ehrhardt
  0 siblings, 0 replies; 4+ messages in thread
From: Christian A. Ehrhardt @ 2021-12-31 13:12 UTC (permalink / raw)
  To: alsa-devel
  Cc: linux-kernel, Lucas Tanure, Stefan Binding, Vitaly Rodionov,
	Takashi Iwai, Jaroslav Kysela


Hi,

I have a DELL Inspirion 3501 laptop with a cirrus cs8904 HDA codec.
With more recent kernels the internal speakers stopped working.
I bisected the issue and tracked it down to this commit 

| commit c8b4f0865e82c14924c69c07d985af3ee9133316
| Author: Stefan Binding <sbinding@opensource.cirrus.com>
| Date:   Wed Aug 11 19:56:52 2021 +0100
|
|     ALSA: hda/cs8409: Remove unnecessary delays
        
After a bit of experimenting with the timeouts I came
up with the patch below that fixes the issue for me.

However, I don't have the specs for the chip, i.e. I don't
know what a theoretically correct value would be.

Suggested patch below, please consider inclusion.

     regards   Christian

From 9c796d221171c6d12fd84ae4f5c8315030c8c4ca Mon Sep 17 00:00:00 2001
From: "Christian A. Ehrhardt" <lk@c--e.de>
Date: Fri, 31 Dec 2021 10:33:19 +0100
Subject: [PATCH 1/2] ALSA: hda/cs8409: Increase delay during jack detection

Commit c8b4f0865e82 reduced delays related to cs42l42 jack
detection. However, the change was too aggressive. As a result
internal speakers on DELL Inspirion 3501 ac8b4f0865e82re not detected.

Increase the delay in cs42l42_run_jack_detect() a bit.

Fixes: c8b4f0865e82 ("ALSA: hda/cs8409: Remove unnecessary delays")
Signed-off-by: Christian A. Ehrhardt <lk@c--e.de>
---
 sound/pci/hda/patch_cs8409.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/pci/hda/patch_cs8409.c b/sound/pci/hda/patch_cs8409.c
index 039b9f2f8e94..bf5d7f0c6ba5 100644
--- a/sound/pci/hda/patch_cs8409.c
+++ b/sound/pci/hda/patch_cs8409.c
@@ -628,8 +628,8 @@ static void cs42l42_run_jack_detect(struct sub_codec *cs42l42)
 	cs8409_i2c_write(cs42l42, 0x1b74, 0x07);
 	cs8409_i2c_write(cs42l42, 0x131b, 0xFD);
 	cs8409_i2c_write(cs42l42, 0x1120, 0x80);
-	/* Wait ~100us*/
-	usleep_range(100, 200);
+	/* Wait ~20ms*/
+	usleep_range(20000, 25000);
 	cs8409_i2c_write(cs42l42, 0x111f, 0x77);
 	cs8409_i2c_write(cs42l42, 0x1120, 0xc0);
 }
-- 
2.32.0



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

* hda/cs8409: Fix internal speaker detection
@ 2021-12-31 13:12 ` Christian A. Ehrhardt
  0 siblings, 0 replies; 4+ messages in thread
From: Christian A. Ehrhardt @ 2021-12-31 13:12 UTC (permalink / raw)
  To: alsa-devel
  Cc: Stefan Binding, Lucas Tanure, Vitaly Rodionov, Takashi Iwai,
	linux-kernel


Hi,

I have a DELL Inspirion 3501 laptop with a cirrus cs8904 HDA codec.
With more recent kernels the internal speakers stopped working.
I bisected the issue and tracked it down to this commit 

| commit c8b4f0865e82c14924c69c07d985af3ee9133316
| Author: Stefan Binding <sbinding@opensource.cirrus.com>
| Date:   Wed Aug 11 19:56:52 2021 +0100
|
|     ALSA: hda/cs8409: Remove unnecessary delays
        
After a bit of experimenting with the timeouts I came
up with the patch below that fixes the issue for me.

However, I don't have the specs for the chip, i.e. I don't
know what a theoretically correct value would be.

Suggested patch below, please consider inclusion.

     regards   Christian

From 9c796d221171c6d12fd84ae4f5c8315030c8c4ca Mon Sep 17 00:00:00 2001
From: "Christian A. Ehrhardt" <lk@c--e.de>
Date: Fri, 31 Dec 2021 10:33:19 +0100
Subject: [PATCH 1/2] ALSA: hda/cs8409: Increase delay during jack detection

Commit c8b4f0865e82 reduced delays related to cs42l42 jack
detection. However, the change was too aggressive. As a result
internal speakers on DELL Inspirion 3501 ac8b4f0865e82re not detected.

Increase the delay in cs42l42_run_jack_detect() a bit.

Fixes: c8b4f0865e82 ("ALSA: hda/cs8409: Remove unnecessary delays")
Signed-off-by: Christian A. Ehrhardt <lk@c--e.de>
---
 sound/pci/hda/patch_cs8409.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/pci/hda/patch_cs8409.c b/sound/pci/hda/patch_cs8409.c
index 039b9f2f8e94..bf5d7f0c6ba5 100644
--- a/sound/pci/hda/patch_cs8409.c
+++ b/sound/pci/hda/patch_cs8409.c
@@ -628,8 +628,8 @@ static void cs42l42_run_jack_detect(struct sub_codec *cs42l42)
 	cs8409_i2c_write(cs42l42, 0x1b74, 0x07);
 	cs8409_i2c_write(cs42l42, 0x131b, 0xFD);
 	cs8409_i2c_write(cs42l42, 0x1120, 0x80);
-	/* Wait ~100us*/
-	usleep_range(100, 200);
+	/* Wait ~20ms*/
+	usleep_range(20000, 25000);
 	cs8409_i2c_write(cs42l42, 0x111f, 0x77);
 	cs8409_i2c_write(cs42l42, 0x1120, 0xc0);
 }
-- 
2.32.0



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

* Re: hda/cs8409: Fix internal speaker detection
  2021-12-31 13:12 ` Christian A. Ehrhardt
@ 2022-01-04 15:33   ` Takashi Iwai
  -1 siblings, 0 replies; 4+ messages in thread
From: Takashi Iwai @ 2022-01-04 15:33 UTC (permalink / raw)
  To: Christian A. Ehrhardt
  Cc: alsa-devel, linux-kernel, Lucas Tanure, Stefan Binding,
	Vitaly Rodionov, Takashi Iwai, Jaroslav Kysela

On Fri, 31 Dec 2021 14:12:21 +0100,
Christian A. Ehrhardt wrote:
> 
> 
> Hi,
> 
> I have a DELL Inspirion 3501 laptop with a cirrus cs8904 HDA codec.
> With more recent kernels the internal speakers stopped working.
> I bisected the issue and tracked it down to this commit 
> 
> | commit c8b4f0865e82c14924c69c07d985af3ee9133316
> | Author: Stefan Binding <sbinding@opensource.cirrus.com>
> | Date:   Wed Aug 11 19:56:52 2021 +0100
> |
> |     ALSA: hda/cs8409: Remove unnecessary delays
>         
> After a bit of experimenting with the timeouts I came
> up with the patch below that fixes the issue for me.
> 
> However, I don't have the specs for the chip, i.e. I don't
> know what a theoretically correct value would be.
> 
> Suggested patch below, please consider inclusion.
> 
>      regards   Christian
> 
> >From 9c796d221171c6d12fd84ae4f5c8315030c8c4ca Mon Sep 17 00:00:00 2001
> From: "Christian A. Ehrhardt" <lk@c--e.de>
> Date: Fri, 31 Dec 2021 10:33:19 +0100
> Subject: [PATCH 1/2] ALSA: hda/cs8409: Increase delay during jack detection
> 
> Commit c8b4f0865e82 reduced delays related to cs42l42 jack
> detection. However, the change was too aggressive. As a result
> internal speakers on DELL Inspirion 3501 ac8b4f0865e82re not detected.
> 
> Increase the delay in cs42l42_run_jack_detect() a bit.
> 
> Fixes: c8b4f0865e82 ("ALSA: hda/cs8409: Remove unnecessary delays")
> Signed-off-by: Christian A. Ehrhardt <lk@c--e.de>

Thanks, applied now.


Takashi

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

* Re: hda/cs8409: Fix internal speaker detection
@ 2022-01-04 15:33   ` Takashi Iwai
  0 siblings, 0 replies; 4+ messages in thread
From: Takashi Iwai @ 2022-01-04 15:33 UTC (permalink / raw)
  To: Christian A. Ehrhardt
  Cc: alsa-devel, Lucas Tanure, Vitaly Rodionov, Takashi Iwai,
	linux-kernel, Stefan Binding

On Fri, 31 Dec 2021 14:12:21 +0100,
Christian A. Ehrhardt wrote:
> 
> 
> Hi,
> 
> I have a DELL Inspirion 3501 laptop with a cirrus cs8904 HDA codec.
> With more recent kernels the internal speakers stopped working.
> I bisected the issue and tracked it down to this commit 
> 
> | commit c8b4f0865e82c14924c69c07d985af3ee9133316
> | Author: Stefan Binding <sbinding@opensource.cirrus.com>
> | Date:   Wed Aug 11 19:56:52 2021 +0100
> |
> |     ALSA: hda/cs8409: Remove unnecessary delays
>         
> After a bit of experimenting with the timeouts I came
> up with the patch below that fixes the issue for me.
> 
> However, I don't have the specs for the chip, i.e. I don't
> know what a theoretically correct value would be.
> 
> Suggested patch below, please consider inclusion.
> 
>      regards   Christian
> 
> >From 9c796d221171c6d12fd84ae4f5c8315030c8c4ca Mon Sep 17 00:00:00 2001
> From: "Christian A. Ehrhardt" <lk@c--e.de>
> Date: Fri, 31 Dec 2021 10:33:19 +0100
> Subject: [PATCH 1/2] ALSA: hda/cs8409: Increase delay during jack detection
> 
> Commit c8b4f0865e82 reduced delays related to cs42l42 jack
> detection. However, the change was too aggressive. As a result
> internal speakers on DELL Inspirion 3501 ac8b4f0865e82re not detected.
> 
> Increase the delay in cs42l42_run_jack_detect() a bit.
> 
> Fixes: c8b4f0865e82 ("ALSA: hda/cs8409: Remove unnecessary delays")
> Signed-off-by: Christian A. Ehrhardt <lk@c--e.de>

Thanks, applied now.


Takashi

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

end of thread, other threads:[~2022-01-04 15:34 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-31 13:12 hda/cs8409: Fix internal speaker detection Christian A. Ehrhardt
2021-12-31 13:12 ` Christian A. Ehrhardt
2022-01-04 15:33 ` Takashi Iwai
2022-01-04 15:33   ` 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.