* [PATCH 2/3] Fix headset auto detect fail in cx8070 and SN6140
[not found] <20231227071008.13665-1-bo.liu@senarytech.com>
@ 2023-12-27 7:10 ` bo liu
2023-12-27 7:10 ` [PATCH 3/3] " bo liu
2023-12-29 15:15 ` [PATCH 1/3] " Takashi Iwai
2 siblings, 0 replies; 3+ messages in thread
From: bo liu @ 2023-12-27 7:10 UTC (permalink / raw)
To: perex, tiwai; +Cc: linux-sound, linux-kernel, bo liu
CX8070 and SN6140 will get wrong headset type when use OMTP headset,
then the headset mic will not work.
Signed-off-by: bo liu <bo.liu@senarytech.com>
---
sound/pci/hda/patch_conexant.c | 35 +++++++++++++++++-----------------
1 file changed, 17 insertions(+), 18 deletions(-)
diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c
index 2d58595bfbdd..9ebc0709a202 100644
--- a/sound/pci/hda/patch_conexant.c
+++ b/sound/pci/hda/patch_conexant.c
@@ -184,11 +184,10 @@ static int cx_auto_init(struct hda_codec *codec)
snd_hda_codec_write(codec, 0x1c, 0, 0x4f0, 0x0eb);
/* fix reboot headset recognize fail issue */
mic_persent = snd_hda_codec_read(codec, 0x19, 0, 0xf09, 0x0);
- if (mic_persent&0x80000000) {
+ if (mic_persent&0x80000000)
snd_hda_codec_write(codec, 0x19, 0, 0x707, 0x24);
- } else {
+ else
snd_hda_codec_write(codec, 0x19, 0, 0x707, 0x20);
- }
break;
}
@@ -209,46 +208,46 @@ static void cx_auto_free(struct hda_codec *codec)
cx_auto_shutdown(codec);
snd_hda_gen_free(codec);
}
-
+
static int headset_present_flag;
static void cx_jack_unsol_event(struct hda_codec *codec, unsigned int res)
{
- unsigned int val,phone_present,mic_persent,phone_tag,mic_tag;
+ unsigned int val, phone_present, mic_persent,phone_tag, mic_tag;
unsigned int count=0;
-
+
switch (codec->core.vendor_id) {
case 0x14f11f86:
case 0x14f11f87:
/* check hp&mic tag to process headset pulgin&plugout */
phone_tag = snd_hda_codec_read(codec, 0x16, 0, 0xf08, 0x0);
mic_tag = snd_hda_codec_read(codec, 0x19, 0, 0xf08, 0x0);
- if((phone_tag&(res>>26)) || (mic_tag&(res>>26))) {
- //msleep(600);
+ if ((phone_tag&(res>>26)) || (mic_tag&(res>>26))) {
phone_present = snd_hda_codec_read(codec, 0x16, 0, 0xf09, 0x0);
- if(!(phone_present&0x80000000)) {/* headphone plugout */
+ if (!(phone_present&0x80000000)) {/* headphone plugout */
headset_present_flag = 0;
snd_hda_codec_write(codec, 0x19, 0, 0x707, 0x20);
break;
}
if (headset_present_flag == 0) {
headset_present_flag = 1;
- } else if(headset_present_flag == 1) {
+ } else if (headset_present_flag == 1) {
mic_persent = snd_hda_codec_read(codec, 0x19, 0, 0xf09, 0x0);
- if ((phone_present&0x80000000)&&(mic_persent&0x80000000)) {/* headset is present */
+ /* headset is present */
+ if ((phone_present&0x80000000) && (mic_persent&0x80000000)) {
/* wait headset detect done */
do {
- val = snd_hda_codec_read(codec, 0x1c, 0, 0xca0, 0x0);
- if(val&0x080) {
+ val = snd_hda_codec_read(codec, 0x1c,
+ 0, 0xca0, 0x0);
+ if (val&0x080)
break;
- }
- msleep(10);
+ msleep(20);
count += 1;
- } while(count > 5);
+ } while (count > 3);
val = snd_hda_codec_read(codec, 0x1c, 0, 0xcb0, 0x0);
- if(val&0x800) {
+ if (val&0x800) {
codec_dbg(codec, "headset plugin, type is CTIA\n");
snd_hda_codec_write(codec, 0x19, 0, 0x707, 0x24);
- } else if(val&0x400) {
+ } else if (val&0x400) {
codec_dbg(codec, "headset plugin, type is OMTP\n");
snd_hda_codec_write(codec, 0x19, 0, 0x707, 0x24);
} else {
--
2.34.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH 3/3] Fix headset auto detect fail in cx8070 and SN6140
[not found] <20231227071008.13665-1-bo.liu@senarytech.com>
2023-12-27 7:10 ` [PATCH 2/3] Fix headset auto detect fail in cx8070 and SN6140 bo liu
@ 2023-12-27 7:10 ` bo liu
2023-12-29 15:15 ` [PATCH 1/3] " Takashi Iwai
2 siblings, 0 replies; 3+ messages in thread
From: bo liu @ 2023-12-27 7:10 UTC (permalink / raw)
To: perex, tiwai; +Cc: linux-sound, linux-kernel, bo liu
CX8070 and SN6140 will get wrong headset type when use OMTP headset,
then the headset mic will not work.
Signed-off-by: bo liu <bo.liu@senarytech.com>
---
sound/pci/hda/patch_conexant.c | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c
index 9ebc0709a202..86e7241b4961 100644
--- a/sound/pci/hda/patch_conexant.c
+++ b/sound/pci/hda/patch_conexant.c
@@ -184,7 +184,7 @@ static int cx_auto_init(struct hda_codec *codec)
snd_hda_codec_write(codec, 0x1c, 0, 0x4f0, 0x0eb);
/* fix reboot headset recognize fail issue */
mic_persent = snd_hda_codec_read(codec, 0x19, 0, 0xf09, 0x0);
- if (mic_persent&0x80000000)
+ if (mic_persent&0x80000000)
snd_hda_codec_write(codec, 0x19, 0, 0x707, 0x24);
else
snd_hda_codec_write(codec, 0x19, 0, 0x707, 0x20);
@@ -212,7 +212,7 @@ static void cx_auto_free(struct hda_codec *codec)
static int headset_present_flag;
static void cx_jack_unsol_event(struct hda_codec *codec, unsigned int res)
{
- unsigned int val, phone_present, mic_persent,phone_tag, mic_tag;
+ unsigned int val, phone_present, mic_persent, phone_tag, mic_tag;
unsigned int count=0;
switch (codec->core.vendor_id) {
@@ -236,13 +236,11 @@ static void cx_jack_unsol_event(struct hda_codec *codec, unsigned int res)
if ((phone_present&0x80000000) && (mic_persent&0x80000000)) {
/* wait headset detect done */
do {
+ msleep(20);
val = snd_hda_codec_read(codec, 0x1c,
0, 0xca0, 0x0);
- if (val&0x080)
- break;
- msleep(20);
count += 1;
- } while (count > 3);
+ } while ((count > 3) || (val&0x080));
val = snd_hda_codec_read(codec, 0x1c, 0, 0xcb0, 0x0);
if (val&0x800) {
codec_dbg(codec, "headset plugin, type is CTIA\n");
--
2.34.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 1/3] Fix headset auto detect fail in cx8070 and SN6140
[not found] <20231227071008.13665-1-bo.liu@senarytech.com>
2023-12-27 7:10 ` [PATCH 2/3] Fix headset auto detect fail in cx8070 and SN6140 bo liu
2023-12-27 7:10 ` [PATCH 3/3] " bo liu
@ 2023-12-29 15:15 ` Takashi Iwai
2 siblings, 0 replies; 3+ messages in thread
From: Takashi Iwai @ 2023-12-29 15:15 UTC (permalink / raw)
To: bo liu; +Cc: perex, tiwai, linux-sound, linux-kernel
On Wed, 27 Dec 2023 08:10:06 +0100,
bo liu wrote:
>
> CX8070 and SN6140 will get wrong headset type when use OMTP headset, then the headset mic will not work.
>
> Signed-off-by: bo liu <bo.liu@senarytech.com>
Well, the patch series has a serious problem, unfortunately.
Basically the patch that is submitted to the upstream should be in the
final form. But this series puts the coding style errors and then
corrects multiple times in the series. This is absolutely no-go.
Create a "perfect patch", and submit it, instead.
For that, you'll need to give a bit more detailed patch description.
Currently it says nothing but the problem. It doesn't mention how and
what to be fixed / changed. Ideally speaking, the patch should have a
description that is self-explanatory.
Last but not least, please put the proper subject prefix.
In your case, it'd be like "ALSA: hda/conexant:".
Please try to address the above points and resubmit.
thanks,
Takashi
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-12-29 15:15 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20231227071008.13665-1-bo.liu@senarytech.com>
2023-12-27 7:10 ` [PATCH 2/3] Fix headset auto detect fail in cx8070 and SN6140 bo liu
2023-12-27 7:10 ` [PATCH 3/3] " bo liu
2023-12-29 15:15 ` [PATCH 1/3] " 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.