Re: [PATCH] alsa-mixer: Adding Jack of Front Headphone Front and Surround

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 2019-01-02 at 20:23 +0800, Hui Wang wrote:
> On 2018/12/31 下午9:46, Tanu Kaskinen wrote:
> > On Fri, 2018-12-21 at 11:05 +0800, Hui Wang wrote:
> > > We have 2 HP desktop models which have one front headphone Jack and
> > > one front headset Jack, in the Linux kernel, these two jacks are
> > > named "Front Headphone Front Jack" and "Front Headphone Surround
> > > Jack", now adding them into the pathes conf file.
> > How do the kcontrols map to physical connectors? Is there only one
> > physical connector or two? How do different kinds of devices
> > (headphones, headsets, stand-alone mics) change the state of the two
> > kcontrols?
> There are 2 physical connectors/jacks, one is the pure headphone jack, 
> the other is the headset jack (headphone + mic).
> 
> For the headphone jack, the kcontrols are:  'Front Headphone Surround 
> Jack' and 'Headphone Playback Volume' index 1
> 
> For the headset jack, the kcontrols are: 'Front Headphone Front Jack',  
> 'Headphone Playback Volume' index 0, 'Mic Jack' and 'Mic Boost Volume'

The jack kcontrol names are unfortunate. They don't really make sense.
"Surround" normally refers to particular channels in multichannel
setup, and similarly the second "Front" in "Front Headphone Front"
would normally refer to the front channels in multichannel setup. I'm
not familiar with the kernel driver code - in case you know better,
would it be feasible to get these jack kcontrols renamed? Or are we
doomed to live with nonsensical kcontrol names forever?

I'd like to change the jack kcontrols to simply "Front Headphone Jack"
(or even simpler "Headphone Jack", since the volume element doesn't use
the "Front" prefix either). The headphone jack would use index 1 like
is done with the volume element. Or alternatively use "Headphone2" with
the headphone volume and jack kcontrols (this would be easier to
support in PulseAudio).

PulseAudio doesn't currently support any mixer controls with non-zero
index, so currently the headphone output won't have hardware volume. If
you're interested in improving that, it should be relatively easy to
fix this shortcoming. We just need a new "index" option for the
[Element] sections in the configuration files, and alsa-mixer.c then
needs to use that index instead of hardcoding the index to 0 like it
does now. We probably need also a new "alsa-name" option for the
[Element] sections, because there's probably need to have two [Element]
sections in one configuration file with the same alsa name but
different identifier. Like this:

[Element Headphone_1]
alsa-name = Headphone
volume = ...
mute = ...

[Element Headphone_2]
alsa-name = Headphone
volume = ...
mute = ...


> If we plug a headphone in either of the two jacks, the 'Surround Jack' 
> or 'Front Jack' will be true. If we plug a headset in the headset jack, 
> the 'Front Jack' and 'Mic Jack' will be true.
> 
> This is not the Dell machine, most Dell machines can't detect mic of 
> headset, so we add headset-mic, headphone-mic for them.  This HP machine 
> can detect mic of headset jack, and it doesn't support stand-alone mics too.
> 
> 
> > I think at least the headset-mic path configuration in your patch is
> > incorrect, but I don't know how it should be configured before knowing
> > how the two kcontrols behave.
> 
> After reading your comments above,  I think you are right.  And I think 
> I shouldn't touch analog-input-headset-mic.conf in the patch, since this 
> is a HP machine, and the headset jack of this machine has capability to 
> detect the mic on the headset and the kcontrols are "Mic Jack" and 
> "Headphone Front Jack". It is different from the Dell machines.

Yes, it seems that headset-mic can be left alone.

Since there are two physical connectors, I don't think we can use
analog-output-headphone for both. With your original patch, if you plug
in headphones to the headphone connector, PulseAudio will enable the
analog-output-headphone port. PulseAudio will also think that the port
has hardware volume, because the "Headphone" volume element exists, but
PulseAudio will only control the element with index 0, which has no
effect on the headphone output - it only affects the headset output. We
should assign the "Front Headphone Surround" jack to the analog-output-
headphone-2 path. That way volume control works with both connectors.

-- 
Tanu

https://www.patreon.com/tanuk
https://liberapay.com/tanuk

_______________________________________________
pulseaudio-discuss mailing list
pulseaudio-discuss@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss




[Index of Archives]     [Linux Audio Users]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux