Message ID | 20210503205231.167346-1-hdegoede@redhat.com |
---|---|
Headers | show |
Series | Add generic exception mechanism for non-standard control-names | expand |
Dne 03. 05. 21 v 22:52 Hans de Goede napsal(a): > Hi All, > > This series seems to have fallen through the cracks, > so here is a resend of it. > > Regards, Thank you, Hans. The problem with this implementation is that it's really card specific. Also, ASoC codec drivers have usually ID names based on registers so the mapping for the user is problematic anyway (the functionality is different from the name or not related to the name). I'm actually evaluating another solution which is more flexible: 1) add control remap plugin to allow the control ID remapping in the alsa-lib's control API, so we can mangle those identifiers there (already implemented) 2) add local and global alsa-lib configurations per UCM card specified in the UCM configuration files; the configurations may be for both control and PCM devices (restrict or set specific parameters) I will notify you when I finish my tests. Jaroslav > > Hans > > > Hans de Goede (5): > mixer: simple - Add generic exception mechanism for non-standard > control-names > mixer: simple - Move handling of 3D Control - Depth controls to the > exceptions list > mixer: simple - Add exceptions for non " Volume" suffixed capture > vol-ctls used in ASoC realtek codec drivers > mixer: simple - Add exceptions for some capture-vol-ctls which have a > " Volume" suffix > mixer: simple - Add exceptions for some Playback Switches with a " > Channel Switch" suffix > > src/mixer/simple_none.c | 74 +++++++++++++++++++++++++---------------- > 1 file changed, 46 insertions(+), 28 deletions(-) >
Hi Jaroslav, On 5/4/21 10:53 AM, Jaroslav Kysela wrote: > Dne 03. 05. 21 v 22:52 Hans de Goede napsal(a): >> Hi All, >> >> This series seems to have fallen through the cracks, >> so here is a resend of it. >> >> Regards, > > Thank you, Hans. The problem with this implementation is that it's really card > specific. Also, ASoC codec drivers have usually ID names based on registers so > the mapping for the user is problematic anyway (the functionality is different > from the name or not related to the name). I'm actually evaluating another > solution which is more flexible: > > 1) add control remap plugin to allow the control ID remapping in the > alsa-lib's control API, so we can mangle those identifiers there (already > implemented) > > 2) add local and global alsa-lib configurations per UCM card specified in the > UCM configuration files; the configurations may be for both control and PCM > devices (restrict or set specific parameters) Ok, thank you for working on this. > I will notify you when I finish my tests. Yes, please let me know when you've something ready to test, then I'll take a look at adding the necessary bits for the bycr-rt5640 and cht-bsw-rt567 UCM profiles, as some control renaming is necessary to make sure that the hw-volume control on these devices also correctly controls the hw mute controls (which in turn are necessary for both full muting and for mute LED control). Regards, Hans >> Hans de Goede (5): >> mixer: simple - Add generic exception mechanism for non-standard >> control-names >> mixer: simple - Move handling of 3D Control - Depth controls to the >> exceptions list >> mixer: simple - Add exceptions for non " Volume" suffixed capture >> vol-ctls used in ASoC realtek codec drivers >> mixer: simple - Add exceptions for some capture-vol-ctls which have a >> " Volume" suffix >> mixer: simple - Add exceptions for some Playback Switches with a " >> Channel Switch" suffix >> >> src/mixer/simple_none.c | 74 +++++++++++++++++++++++++---------------- >> 1 file changed, 46 insertions(+), 28 deletions(-) >> > >
Hi, On 5/4/21 10:53 AM, Jaroslav Kysela wrote: > Dne 03. 05. 21 v 22:52 Hans de Goede napsal(a): >> Hi All, >> >> This series seems to have fallen through the cracks, >> so here is a resend of it. >> >> Regards, > > Thank you, Hans. The problem with this implementation is that it's really card > specific. Also, ASoC codec drivers have usually ID names based on registers so > the mapping for the user is problematic anyway (the functionality is different > from the name or not related to the name). I'm actually evaluating another > solution which is more flexible: > > 1) add control remap plugin to allow the control ID remapping in the > alsa-lib's control API, so we can mangle those identifiers there (already > implemented) > > 2) add local and global alsa-lib configurations per UCM card specified in the > UCM configuration files; the configurations may be for both control and PCM > devices (restrict or set specific parameters) p.s. Note that the first patch in this series also fixes a regression, quoting from the commit message: This also fixes the "Capture Volume" and "Capture Switch" exceptions no longer working after commit 86b9c67774bc ("mixer: simple - Unify simple_none: base_len() exception handling") because they were moved to after the suffix checking, so they would be treated as CTL_GLOBAL_VOLUME resp. CTL_GLOBAL_SWITCH based on their suffix before the exception check has a chance to check for a match. In the first patch of this series fixing this regression is a side-effect of the changes made there. Since you don't want to take this series, I'll write a new patch fixing just the regression. Regards, Hans
Dne 04. 05. 21 v 17:47 Hans de Goede napsal(a): > Hi Jaroslav, > > On 5/4/21 10:53 AM, Jaroslav Kysela wrote: >> Dne 03. 05. 21 v 22:52 Hans de Goede napsal(a): >>> Hi All, >>> >>> This series seems to have fallen through the cracks, >>> so here is a resend of it. >>> >>> Regards, >> >> Thank you, Hans. The problem with this implementation is that it's really card >> specific. Also, ASoC codec drivers have usually ID names based on registers so >> the mapping for the user is problematic anyway (the functionality is different >> from the name or not related to the name). I'm actually evaluating another >> solution which is more flexible: >> >> 1) add control remap plugin to allow the control ID remapping in the >> alsa-lib's control API, so we can mangle those identifiers there (already >> implemented) >> >> 2) add local and global alsa-lib configurations per UCM card specified in the >> UCM configuration files; the configurations may be for both control and PCM >> devices (restrict or set specific parameters) > > Ok, thank you for working on this. > >> I will notify you when I finish my tests. > > Yes, please let me know when you've something ready to test, then I'll take > a look at adding the necessary bits for the bycr-rt5640 and cht-bsw-rt567 > UCM profiles, as some control renaming is necessary to make sure that > the hw-volume control on these devices also correctly controls the > hw mute controls (which in turn are necessary for both full muting and > for mute LED control). It seems that things started to work. I pushed everything to the repos (alsa-lib/alsa-utils/alsa-ucm-conf) and picked bits from your configs. If you can give a look and a test, it would be nice. The changes for the specific codecs are quite straight like: https://github.com/alsa-project/alsa-ucm-conf/commit/2072ab794b69cdf4f070db5467387d08a65c4309 The global alsa-lib's configuration does the redirects to the hw specific configs (if found) per card. UCM can store this "per card" configuration to /var/lib/alsa/card<NUMBER>.conf.d tree, which allows us to define the hw specific configuration. Both control and PCM devices can be (re)configured. UCM was extended to allow inline the alsa-lib's configuration which can be private to UCM or saved to a global config file (/var/lib/alsa tree for example). By default, I made the private alsa-lib's configuration for all UCM applications, so the users cannot break UCM with their configuration changes. Jaroslav
Hi Jaroslav, On 5/18/21 6:16 PM, Jaroslav Kysela wrote: > Dne 04. 05. 21 v 17:47 Hans de Goede napsal(a): >> Hi Jaroslav, >> >> On 5/4/21 10:53 AM, Jaroslav Kysela wrote: >>> Dne 03. 05. 21 v 22:52 Hans de Goede napsal(a): >>>> Hi All, >>>> >>>> This series seems to have fallen through the cracks, >>>> so here is a resend of it. >>>> >>>> Regards, >>> >>> Thank you, Hans. The problem with this implementation is that it's really card >>> specific. Also, ASoC codec drivers have usually ID names based on registers so >>> the mapping for the user is problematic anyway (the functionality is different >>> from the name or not related to the name). I'm actually evaluating another >>> solution which is more flexible: >>> >>> 1) add control remap plugin to allow the control ID remapping in the >>> alsa-lib's control API, so we can mangle those identifiers there (already >>> implemented) >>> >>> 2) add local and global alsa-lib configurations per UCM card specified in the >>> UCM configuration files; the configurations may be for both control and PCM >>> devices (restrict or set specific parameters) >> >> Ok, thank you for working on this. >> >>> I will notify you when I finish my tests. >> >> Yes, please let me know when you've something ready to test, then I'll take >> a look at adding the necessary bits for the bycr-rt5640 and cht-bsw-rt567 >> UCM profiles, as some control renaming is necessary to make sure that >> the hw-volume control on these devices also correctly controls the >> hw mute controls (which in turn are necessary for both full muting and >> for mute LED control). > > It seems that things started to work. I pushed everything to the repos > (alsa-lib/alsa-utils/alsa-ucm-conf) and picked bits from your configs. If you > can give a look and a test, it would be nice. The changes for the specific > codecs are quite straight like: > > https://github.com/alsa-project/alsa-ucm-conf/commit/2072ab794b69cdf4f070db5467387d08a65c4309 > > The global alsa-lib's configuration does the redirects to the hw specific > configs (if found) per card. UCM can store this "per card" configuration to > /var/lib/alsa/card<NUMBER>.conf.d tree, which allows us to define the hw > specific configuration. Both control and PCM devices can be (re)configured. > > UCM was extended to allow inline the alsa-lib's configuration which can be > private to UCM or saved to a global config file (/var/lib/alsa tree for example). > > By default, I made the private alsa-lib's configuration for all UCM > applications, so the users cannot break UCM with their configuration changes. Thank you for your work on this. I've been testing this on a HP x2 Bay Trail + rt5640 laptop, and I've found 2 issues: 1. After renaming there are now 2 "Speaker" and "Headphones" switches: "Speaker Playback Volume" stays "Speaker Playback Volume" "Speaker Channel Switch" becomes "Speaker Playback Switch" "Speaker Switch" stays "Speaker Switch" And then alsamixer only shows one of the 2 "Speaker [Playback] Switches" This can be worked around by changing the renames to e.g. : "name='HP Playback Volume'" "name='Headphones Playback Volume'" "name='HP Channel Switch'" "name='Headphones Playback Switch'" "name='Speaker Playback Volume'" "name='Speakers Playback Volume'" "name='Speaker Channel Switch'" "name='Speakers Playback Switch'" Or to: # Rename the 'Headphone Switch' DAPM PIN switch to avoid it getting # grouped with 'Headphone Playback Volume' "name='Headphone Switch'" "name='Headphone Output Switch'" "name='HP Playback Volume'" "name='Headphone Playback Volume'" "name='HP Channel Switch'" "name='Headphone Playback Switch'" # Idem for the 'Speaker Switch' "name='Speaker Switch'" "name='Speaker Output Switch'" "name='Speaker Channel Switch'" "name='Speaker Playback Switch'" So this is not really an issue. 2. PlaybackMixerElem statements don't take the renames into account, this means that muting the speakers or the headphones output the UCM (pipewire/pulse) level does not mute the 'Speaker Channel Switch' / 'HP Channel Switch' control, meaning that we are not muting things at the hw level, which in turn is causing the speaker mute LED on the HP X2 to not be turned on when muting. I guess the fix here would be to make the renames apply to PlaybackMixerElem ? Downside is that that would be a syntax change for the UCM conf language I guess (e.g. this would require update the PlaybackMixerElem from HP to Headphone in the rt5640 case) If you can steer me in the right direction for fixing this I can take a shot at fixing this. Or alternatively I would be happy to test any patches for this from you. Regards, Hans