[PATCH 00/27] ASoC: Map missing jack kcontrols

From: Alper Nebi Yasak
Date: Wed Aug 02 2023 - 13:58:41 EST


This patchset adds missing jack kcontrols for each independently
detectable audio peripheral and maps jack pins to those kcontrols
accordingly, with the primary intent to enable/improve jack detection
handling in PulseAudio and PipeWire through JackControl UCM values.

Usually it's just splitting a joint anything-is-connected "Headset Jack"
kcontrol (from [1]) into those like "Headphone Jack" and "Headset Mic"
(similar to a previous series for Intel Chromebooks [2]). This split is
important to avoid automatically switching to a nonexistent external
microphone when a headphone-only device is connected.

When the underlying hardware seems to support it, this also adds a "Line
Out" kcontrol. This is important in case the hardware can actually
support a line-level connection via a different configuration (bypassing
output amplifiers?), or simply for userspace to display "Line Out"
instead of "Headphones" to the user for connected line-out devices.

Beyond the mappings, I had to add PIN_SWITCH card kcontrols and DAPM
widgets to avoid "unknown pin" errors on my devices, so tried to do them
for all. For Intel devices I saw a pattern of routing things to
"Platform Clock" and added to that as well. Looking at patch 5/7 of a
Mediatek-related series [3], I can only guess that routes could be
further improved, but don't know exactly how for each device. And one
more concern is I don't know if the names conflict with any controls
from codecs, although I tried to keep to names of existing widgets.

As far as I can tell, the root cause for most of why these are missing
originates to things being developed for ChromeOS, whose userspace reads
the jack input device and doesn't care for these kcontrols. There's
non-ChromeOS cases as well, maybe things got copy-pasted around and
people didn't need or couldn't figure out how to get more specific than
a single jack kcontrol. The secondary intent in this patchset is to fix
this *everywhere*, so future copy-pastes result in the right behaviour.

For more context also see:

[1] ASoC: soc-card: Create jack kcontrol without pins
https://lore.kernel.org/alsa-devel/20220408041114.6024-1-akihiko.odaki@xxxxxxxxx/

[2] ASoC: Intel: Chromebooks: remap jack pins
https://lore.kernel.org/alsa-devel/20220616214055.134943-1-pierre-louis.bossart@xxxxxxxxxxxxxxx/

[3] ASoC: mediatek: Allow separate handling of headphone and headset mic jack
https://lore.kernel.org/alsa-devel/20220922235951.252532-1-nfraprado@xxxxxxxxxxxxx/

[4] ASoC: rk3399_gru_sound: Add DAPM pins, kcontrols for jack detection
https://lore.kernel.org/alsa-devel/20200721182709.6895-1-alpernebiyasak@xxxxxxxxx/

This applies onto next-20230802. Unfortunately most of it is untested
except for a few Chromebooks I have (Kevin, Lick, Hana, Cozmo), because
I'm intentionally generalizing to everything.


Alper Nebi Yasak (27):
ASoC: amd: acp-da7219-max98357a: Map missing jack kcontrols
ASoC: amd: acp-rt5645: Map missing jack kcontrols
ASoC: amd: acp: Map missing jack kcontrols
ASoC: amd: acp3x-rt5682-max9836: Map missing jack kcontrols
ASoC: Intel: avs: da7219: Map missing jack kcontrols
ASoC: Intel: bxt_da7219_max98357a: Map missing Line Out jack kcontrol
ASoC: Intel: bytcr_wm5102: Map missing Line Out jack kcontrol
ASoC: Intel: kbl_da7219_max98357a: Map missing Line Out jack kcontrol
ASoC: Intel: kbl_da7219_max98927: Map missing Line Out jack kcontrol
ASoC: Intel: sof_da7219_max98373: Map missing Line Out jack kcontrol
ASoC: imx-es8328: Map missing jack kcontrols
ASoC: mediatek: mt8173-max98090: Configure jack as a Headset jack
ASoC: mediatek: mt8173-rt5650-rt5514: Map missing jack kcontrols
ASoC: mediatek: mt8173-rt5650-rt5676: Map missing jack kcontrols
ASoC: mediatek: mt8173-rt5650: Map missing jack kcontrols
ASoC: mediatek: mt8183-da7219-max98357: Map missing jack kcontrols
ASoC: mediatek: mt8183-mt6358-ts3a227-max98357: Map missing jack
kcontrols
ASoC: mediatek: mt8186-mt6366-da7219-max98357: Map missing jack
kcontrols
ASoC: qcom: apq8016_sbc: Map missing jack kcontrols
ASoC: qcom: sc7180: Map missing jack kcontrols
ASoC: qcom: sc7280: Map missing jack kcontrols
ASoC: qcom: sdm845: Map missing jack kcontrols
ASoC: rk3399-gru-sound: Map missing Line Out jack kcontrol
ASoC: rockchip: rockchip_rt5645: Map missing jack kcontrols
ASoC: samsung: littlemill: Map missing jack kcontrols
ASoC: samsung: lowland: Split Line Out jack kcontrol from Headphone
ASoC: samsung: midas_wm1811: Map missing jack kcontrols

sound/soc/amd/acp-da7219-max98357a.c | 41 +++-
sound/soc/amd/acp-rt5645.c | 22 +-
sound/soc/amd/acp/acp-mach-common.c | 226 ++++++++++++++----
sound/soc/amd/acp3x-rt5682-max9836.c | 23 +-
sound/soc/fsl/imx-es8328.c | 25 +-
sound/soc/intel/avs/boards/da7219.c | 34 ++-
sound/soc/intel/boards/bxt_da7219_max98357a.c | 7 +
sound/soc/intel/boards/bytcr_wm5102.c | 7 +
sound/soc/intel/boards/kbl_da7219_max98357a.c | 7 +
sound/soc/intel/boards/kbl_da7219_max98927.c | 7 +
sound/soc/intel/boards/sof_da7219_max98373.c | 10 +
sound/soc/mediatek/mt8173/mt8173-max98090.c | 2 +-
.../mediatek/mt8173/mt8173-rt5650-rt5514.c | 23 +-
.../mediatek/mt8173/mt8173-rt5650-rt5676.c | 23 +-
sound/soc/mediatek/mt8173/mt8173-rt5650.c | 23 +-
.../mediatek/mt8183/mt8183-da7219-max98357.c | 43 +++-
.../mt8183/mt8183-mt6358-ts3a227-max98357.c | 53 +++-
.../mt8186/mt8186-mt6366-da7219-max98357.c | 6 +
sound/soc/qcom/apq8016_sbc.c | 37 ++-
sound/soc/qcom/sc7180.c | 40 +++-
sound/soc/qcom/sc7280.c | 34 ++-
sound/soc/qcom/sdm845.c | 32 ++-
sound/soc/rockchip/rk3399_gru_sound.c | 7 +-
sound/soc/rockchip/rockchip_rt5645.c | 22 +-
sound/soc/samsung/littlemill.c | 27 ++-
sound/soc/samsung/lowland.c | 8 +-
sound/soc/samsung/midas_wm1811.c | 25 +-
27 files changed, 668 insertions(+), 146 deletions(-)


base-commit: 626c67169f9972fffcdf3bc3864de421f162ebf5
--
2.40.1