From: Takashi Iwai <tiwai@suse.de>
To: "Joakim Zhang" <joakim.zhang@cixtech.com>
Cc: Takashi Iwai <tiwai@suse.de>, Kailang <kailang@realtek.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>,
Geans_chen <geans_chen@realsil.com.cn>
Subject: Re: [PATCH V1 4/4] ALSA: hda/realtek: fix mic jack detect failed on alc256
Date: Wed, 02 Jul 2025 16:27:10 +0200 [thread overview]
Message-ID: <87pleivfb5.wl-tiwai@suse.de> (raw)
In-Reply-To: <SEYPR06MB627805243BFA48D81FD58B158240A@SEYPR06MB6278.apcprd06.prod.outlook.com>
On Wed, 02 Jul 2025 03:59:54 +0200,
Joakim Zhang wrote:
>
>
> Hello,
>
> > > > -----Original Message-----
> > > > From: Takashi Iwai <tiwai@suse.de>
> > > > Sent: Tuesday, July 1, 2025 5:15 PM
> > > > To: Joakim Zhang <joakim.zhang@cixtech.com>
> > > > Cc: Takashi Iwai <tiwai@suse.de>; Kailang <kailang@realtek.com>;
> > > > perex@perex.cz; tiwai@suse.com; linux-sound@vger.kernel.org;
> > > > chris.chiu@canonical.com; Geans_chen <geans_chen@realsil.com.cn>
> > > > Subject: Re: [PATCH V1 4/4] ALSA: hda/realtek: fix mic jack detect
> > > > failed on
> > > > alc256
> > > >
> > > > EXTERNAL EMAIL
> > > >
> > > > CAUTION: Suspicious Email from unusual domain.
> > > >
> > > > On Tue, 01 Jul 2025 10:40:51 +0200,
> > > > Joakim Zhang wrote:
> > > > >
> > > > >
> > > > > Hello,
> > > > >
> > > > > > > > -----Original Message-----
> > > > > > > > From: Takashi Iwai <tiwai@suse.de>
> > > > > > > > Sent: Tuesday, July 1, 2025 2:43 PM
> > > > > > > > To: Joakim Zhang <joakim.zhang@cixtech.com>
> > > > > > > > Cc: Takashi Iwai <tiwai@suse.de>; Kailang
> > > > > > > > <kailang@realtek.com>; perex@perex.cz; tiwai@suse.com;
> > > > > > > > linux-sound@vger.kernel.org; chris.chiu@canonical.com;
> > > > > > > > Geans_chen <geans_chen@realsil.com.cn>
> > > > > > > > Subject: Re: [PATCH V1 4/4] ALSA: hda/realtek: fix mic jack
> > > > > > > > detect failed on
> > > > > > > > alc256
> > > > > > > >
> > > > > > > > EXTERNAL EMAIL
> > > > > > > >
> > > > > > > > CAUTION: Suspicious Email from unusual domain.
> > > > > > > >
> > > > > > > > On Tue, 01 Jul 2025 08:35:05 +0200, Joakim Zhang wrote:
> > > > > > > > >
> > > > > > > > >
> > > > > > > > > Hello Takashi,
> > > > > > > > >
> > > > > > > > > Thanks a lot for your help.
> > > > > > > > >
> > > > > > > > > > > Hello Kailang,
> > > > > > > > > > >
> > > > > > > > > > > I'd like to insert another question through this. That
> > > > > > > > > > > would be appreciated if
> > > > > > > > > > you could have a look.
> > > > > > > > > > >
> > > > > > > > > > > After system boot, we can see the default mixer status as
> > below:
> > > > > > > > > > >
> > > > > > > > > > > root@cix-localhost:~# amixer -c 0 contents
> > > > > > > > > > > numid=14,iface=CARD,name='Headphone Jack'
> > > > > > > > > > > ; type=BOOLEAN,access=r-------,values=1
> > > > > > > > > > > : values=on
> > > > > > > > > > > numid=12,iface=CARD,name='Internal Mic Phantom Jack'
> > > > > > > > > > > ; type=BOOLEAN,access=r-------,values=1
> > > > > > > > > > > : values=on
> > > > > > > > > > > numid=13,iface=CARD,name='Mic Jack'
> > > > > > > > > > > ; type=BOOLEAN,access=r-------,values=1
> > > > > > > > > > > : values=on
> > > > > > > > > > > numid=15,iface=CARD,name='Speaker Phantom Jack'
> > > > > > > > > > > ; type=BOOLEAN,access=r-------,values=1
> > > > > > > > > > > : values=on
> > > > > > > > > > > numid=11,iface=MIXER,name='Master Playback Switch'
> > > > > > > > > > > ; type=BOOLEAN,access=rw------,values=1
> > > > > > > > > > > : values=on
> > > > > > > > > > > numid=10,iface=MIXER,name='Master Playback Volume'
> > > > > > > > > > > ; type=INTEGER,access=rw---R--
> > ,values=1,min=0,max=87,step=0
> > > > > > > > > > > : values=60
> > > > > > > > > > > | dBscale-min=-65.25dB,step=0.75dB,mute=0
> > > > > > > > > > > numid=2,iface=MIXER,name='Headphone Playback Switch'
> > > > > > > > > > > ; type=BOOLEAN,access=rw------,values=2
> > > > > > > > > > > : values=on,on
> > > > > > > > > > > numid=1,iface=MIXER,name='Headphone Playback Volume'
> > > > > > > > > > > ; type=INTEGER,access=rw---R--
> > ,values=2,min=0,max=87,step=0
> > > > > > > > > > > : values=87,87
> > > > > > > > > > > | dBscale-min=-65.25dB,step=0.75dB,mute=0
> > > > > > > > > > > numid=9,iface=MIXER,name='Mic Boost Volume'
> > > > > > > > > > > ; type=INTEGER,access=rw---R--
> > ,values=2,min=0,max=3,step=0
> > > > > > > > > > > : values=0,0
> > > > > > > > > > > | dBscale-min=0.00dB,step=10.00dB,mute=0
> > > > > > > > > > > numid=7,iface=MIXER,name='Capture Switch'
> > > > > > > > > > > ; type=BOOLEAN,access=rw------,values=2
> > > > > > > > > > > : values=on,on
> > > > > > > > > > > numid=6,iface=MIXER,name='Capture Volume'
> > > > > > > > > > > ; type=INTEGER,access=rw---R--
> > ,values=2,min=0,max=63,step=0
> > > > > > > > > > > : values=39,39
> > > > > > > > > > > | dBscale-min=-17.25dB,step=0.75dB,mute=0
> > > > > > > > > > > numid=5,iface=MIXER,name='Auto-Mute Mode'
> > > > > > > > > > > ; type=ENUMERATED,access=rw------,values=1,items=2
> > > > > > > > > > > ; Item #0 'Disabled'
> > > > > > > > > > > ; Item #1 'Enabled'
> > > > > > > > > > > : values=1
> > > > > > > > > > > numid=8,iface=MIXER,name='Internal Mic Boost Volume'
> > > > > > > > > > > ; type=INTEGER,access=rw---R--
> > ,values=2,min=0,max=3,step=0
> > > > > > > > > > > : values=0,0
> > > > > > > > > > > | dBscale-min=0.00dB,step=10.00dB,mute=0
> > > > > > > > > > > numid=4,iface=MIXER,name='Speaker Playback Switch'
> > > > > > > > > > > ; type=BOOLEAN,access=rw------,values=2
> > > > > > > > > > > : values=off,off
> > > > > > > > > > > numid=3,iface=MIXER,name='Speaker Playback Volume'
> > > > > > > > > > > ; type=INTEGER,access=rw---R--
> > ,values=2,min=0,max=87,step=0
> > > > > > > > > > > : values=0,0
> > > > > > > > > > > | dBscale-min=-65.25dB,step=0.75dB,mute=0
> > > > > > > > > > > numid=17,iface=PCM,name='Capture Channel Map'
> > > > > > > > > > > ; type=INTEGER,access=r----R--
> > ,values=2,min=0,max=36,step=0
> > > > > > > > > > > : values=0,0
> > > > > > > > > > > | container
> > > > > > > > > > > | chmap-fixed=FL,FR
> > > > > > > > > > > numid=16,iface=PCM,name='Playback Channel Map'
> > > > > > > > > > > ; type=INTEGER,access=r----R--
> > ,values=2,min=0,max=36,step=0
> > > > > > > > > > > : values=0,0
> > > > > > > > > > > | container
> > > > > > > > > > > | chmap-fixed=FL,FR
> > > > > > > > > > >
> > > > > > > > > > > It can auto switch 'Headphone Playback
> > > > > > > > > > > Switch'/'Headphone Playback Volume' and 'Speaker
> > > > > > > > > > > Playback Switch'/'Speaker Playback Volume', when I
> > > > > > > > > > > plugin the headset or not, but I have not found the
> > > > > > > > > > > related logic, could you
> > > > > > > > > > please help clarify a bit?
> > > > > > > > > >
> > > > > > > > > > Isn't it "Auto-Mute Mode"? If it's set, the speaker is
> > > > > > > > > > muted automatically when the headphone/headset jack is
> > > > > > > > > > plugged by the kernel
> > > > > > > > driver itself.
> > > > > > > > >
> > > > > > > > > What strange is 'Auto-Mute Mode' would be disabled after
> > > > > > > > > headset
> > > > > > > > plugin/out several times, don' t know the reason....
> > > > > > > >
> > > > > > > > "Auto-Mute Mode" is a software switch, and it means some
> > > > > > > > program must have turned it off explicitly. e.g. the sound
> > > > > > > > server like pulseaudio or pipewire disables it.
> > > > > > > >
> > > > > > > > > However, it seems that speaker and headphone/headset still
> > > > > > > > > can auto
> > > > > > > > switch. Please see below mixer status.
> > > > > > > >
> > > > > > > > Usually pulseaudio/pipewire takes over and does the switching.
> > > > > > >
> > > > > > > OK, I see, I will dig into it, could you please tell me is
> > > > > > > there any other software
> > > > > > switches in the mixers?
> > > > > >
> > > > > > Any mixer program can change... But basically the auto-mute is
> > > > > > a task of the sound daemon.
> > > > >
> > > > > I disable both pulseaudio and pipewire from the Debian, and enable
> > > > > the
> > > > auto-mute, when the headset plugin but the switch not set correctly.
> > > > > 'Headphone Playback Switch'/'Headphone Playback Volume' not set,
> > > > > but
> > > > 'Speaker Playback Switch'/'Speaker Playback Volume' enabled.
> > > > > Are there any other possible reasons?
> > > >
> > > > The auto-mute doesn't change the mixer state. It switches
> > > > internally, either by adjusting the pin control or the amp.
> > >
> > > OK, is that means all mixers setting should done by users based on Jack
> > status?
> >
> > The mixer settings are exposed to user-space and user-space programs can
> > read or change them, sure. But it's not clear what is your exact purpose or
> > goal, so I can't answer much better than that.
> >
> > The auto-mute feature is implemented in the kernel driver level, so that the
> > automatic muting via jack plug can work without the sound daemon. The
> > auto-muted state isn't exposed to user-space via ALSA control API (mixer
> > elements), and it looks as if it were muted by the hardware. Actually there are
> > hardware that do the auto-muting in the hardware level, too.
>
> Takashi, thanks for your details, I think what I want to know is what did in the kernel driver level for hp automute and mic autoswitch.
>
> I am looking the code, it seems only update the pins and not update the mixer, right? So when the headset plugin, it will auto mute hp and auto switch to mic at the hardware level, users still need to update the mixer manually.
Users don't need to update the mixer -- that's the whole point of the
driver auto-mute stuff. When plugged, the speaker gets muted, and the
output is routed to the headphone jack with the formerly set headphone
volume and switch. Even if you change the speaker volume/switch, it
has no effect as long as the jack is plugged. When unplugged, the
headphone volume/switch can change but without any effect, too.
> Further, is there any place in the hda codec driver level to update the mixers? AFAIK, for the ASoC driver, codec driver level would update some mixers dynamically based on the routing.
The codec driver creates the mixer elements and handle them, yes.
Also, the virtual-master control influences on the volume of each
assigned output, too.
Takashi
next prev parent reply other threads:[~2025-07-02 14:27 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
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 [this message]
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=87pleivfb5.wl-tiwai@suse.de \
--to=tiwai@suse.de \
--cc=chris.chiu@canonical.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox