All of lore.kernel.org
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: "Joakim  Zhang" <joakim.zhang@cixtech.com>
Cc: Takashi Iwai <tiwai@suse.de>, "perex@perex.cz" <perex@perex.cz>,
	"tiwai@suse.com" <tiwai@suse.com>,
	"linux-sound@vger.kernel.org" <linux-sound@vger.kernel.org>,
	"chris.chiu@canonical.com" <chris.chiu@canonical.com>,
	"kailang@realtek.com" <kailang@realtek.com>,
	"geans_chen@realsil.com.cn" <geans_chen@realsil.com.cn>,
	cix-kernel-upstream <cix-kernel-upstream@cixtech.com>
Subject: Re: [PATCH V1 2/4] ALSA: hda: add no_pin_sense_update flag for jack detection
Date: Mon, 23 Jun 2025 15:11:12 +0200	[thread overview]
Message-ID: <87jz52mwlr.wl-tiwai@suse.de> (raw)
In-Reply-To: <SEYPR06MB627832E929730EFEA1FD7AED8279A@SEYPR06MB6278.apcprd06.prod.outlook.com>

On Mon, 23 Jun 2025 12:39:48 +0200,
Joakim  Zhang wrote:
> 
> Hello Takashi,
> 
> > -----Original Message-----
> > From: Joakim Zhang <joakim.zhang@cixtech.com>
> > Sent: Saturday, June 21, 2025 2:15 PM
> > To: Takashi Iwai <tiwai@suse.de>
> > Cc: perex@perex.cz; tiwai@suse.com; linux-sound@vger.kernel.org;
> > chris.chiu@canonical.com; kailang@realtek.com; geans_chen@realsil.com.cn;
> > cix-kernel-upstream <cix-kernel-upstream@cixtech.com>
> > Subject: 回复: [PATCH V1 2/4] ALSA: hda: add no_pin_sense_update flag for
> > jack detection
> >
> >
> > Hello Takashi,
> > ________________________________________
> > 发件人: Takashi Iwai <tiwai@suse.de>
> > 已发送: 2025 年 6 月 20 日 星期五 20:11
> > 收件人: Joakim  Zhang <joakim.zhang@cixtech.com>
> > 抄送: perex@perex.cz <perex@perex.cz>; tiwai@suse.com <tiwai@suse.com>;
> > linux-sound@vger.kernel.org <linux-sound@vger.kernel.org>;
> > chris.chiu@canonical.com <chris.chiu@canonical.com>; kailang@realtek.com
> > <kailang@realtek.com>; geans_chen@realsil.com.cn
> > <geans_chen@realsil.com.cn>; cix-kernel-upstream <cix-kernel-
> > upstream@cixtech.com>
> > 主题: Re: [PATCH V1 2/4] ALSA: hda: add no_pin_sense_update flag for jack
> > detection
> 
> [......]
> 
> > [Joakim] Let me take realtek alc256 as an example,
> > hda_call_codec_resume()
> >     1)codec->patch_ops.resume(codec) // alc269_resume()
> >         codec->patch_ops.init(codec) // alc_init()
> >             spec->init_hook(codec) // alc256_init()
> >             snd_hda_jack_detect(codec, hp_pin)
> >                     ....
> >                     snd_hda_jack_pin_sense()
> >                         jack_detect_update()
> >                             jack->pin_sense = read_pin_sense(codec, jack->nid, jack-
> > >dev_id);  // update jack->pin_sense here, but not report jack status
> >     2)hda_jackpoll_work(&codec->jackpoll_work.work)
> >             snd_hda_jack_poll_all(codec)
> >                  old_sense = get_jack_plug_state(jack->pin_sense);
> >                  jack_detect_update(codec, jack);
> >                  if (changes)
> >                       snd_hda_jack_report_sync(codec);
> >
> > If the headset is not plugin before system suspending, so the jack->pin_sense
> > = 0x0, plugin the headset when system in suspended state, system resume
> > back, the jack->pin_sense update to 0x80000000 from codec
> > patch_ops.init(), then jackpoll work get the old_sense = 0x80000000 (but
> > actually it is not old sense before system suspending), and the current jack-
> > >pin_sense also 0x80000000 when calling jack_detect_update(), as a result
> > there is no changes, finally not report the headset plugin event.
> >
> > Is it logical to report jack status immediately when updating the jack pin
> > sense? If not, the old pin sense can still be trusted?
> >
> > Please correct me if anything misunderstanding, thanks, as a hda newer may
> > not understood very deeply.
> 
> I confirm this issue exist in the original logic, but your PoC also fix this issue, I quite agree with your above point of view:
> "I believe we should simply call  snd_hda_jack_report_sync() unconditionally, then schedule the jackpoll work,  as done in my PoC patch."
> 
> With your PoC patch, three issues(patch 1/2/3) have been solved simultaneously, please feel free to add my tested tag:
>       Tested-by: Joakim Zhang <joakim.zhang@cixtech.com>

Good to hear!  I'm going to submit the proper patch set.


thanks,

Takashi

  reply	other threads:[~2025-06-23 13:11 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-19  2:08 [PATCH V1 0/4] ALSA: hda: jack detect fixes joakim.zhang
2025-06-19  2:08 ` [PATCH V1 1/4] ALSA: hda: fix controller cannot suspend when codec using jackpoll joakim.zhang
2025-06-20 12:00   ` Takashi Iwai
2025-06-21  6:12     ` 回复: " Joakim  Zhang
2025-06-19  2:08 ` [PATCH V1 2/4] ALSA: hda: add no_pin_sense_update flag for jack detection joakim.zhang
2025-06-20 12:11   ` Takashi Iwai
2025-06-21  6:14     ` 回复: " Joakim  Zhang
2025-06-23 10:39       ` Joakim  Zhang
2025-06-23 13:11         ` Takashi Iwai [this message]
2025-06-19  2:08 ` [PATCH V1 3/4] ALSA: hda: disable jackpoll_in_suspend when system shutdown joakim.zhang
2025-06-20 12:12   ` Takashi Iwai
2025-06-19  2:08 ` [PATCH V1 4/4] ALSA: hda/realtek: fix mic jack detect failed on alc256 joakim.zhang
2025-06-20 12:13   ` Takashi Iwai
2025-06-24  2:31     ` Kailang
2025-06-24  3:32       ` Joakim  Zhang
2025-06-24  6:17         ` Kailang
2025-06-25  1:32           ` Joakim  Zhang
2025-06-25  3:05             ` Kailang
2025-06-26  3:44               ` Joakim  Zhang
2025-06-26  5:51                 ` Kailang
2025-07-01  3:28                   ` Joakim  Zhang
2025-07-01  5:51                     ` Takashi Iwai
2025-07-01  6:35                       ` Joakim  Zhang
2025-07-01  6:42                         ` Takashi Iwai
2025-07-01  6:48                           ` Joakim  Zhang
2025-07-01  6:50                             ` Takashi Iwai
2025-07-01  8:40                               ` Joakim  Zhang
2025-07-01  9:14                                 ` Takashi Iwai
2025-07-01 10:27                                   ` Joakim  Zhang
2025-07-01 11:42                                     ` Takashi Iwai
2025-07-02  1:59                                       ` Joakim  Zhang
2025-07-02 14:27                                         ` Takashi Iwai
2025-07-03  1:39                                           ` Joakim  Zhang
2025-06-20 11:51 ` [PATCH V1 0/4] ALSA: hda: jack detect fixes 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=87jz52mwlr.wl-tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=chris.chiu@canonical.com \
    --cc=cix-kernel-upstream@cixtech.com \
    --cc=geans_chen@realsil.com.cn \
    --cc=joakim.zhang@cixtech.com \
    --cc=kailang@realtek.com \
    --cc=linux-sound@vger.kernel.org \
    --cc=perex@perex.cz \
    --cc=tiwai@suse.com \
    /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 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.