Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8A9A0C433EF for ; Mon, 4 Oct 2021 06:44:28 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 170B4613A1 for ; Mon, 4 Oct 2021 06:44:26 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 170B4613A1 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=suse.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id E98B61688; Mon, 4 Oct 2021 08:43:34 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz E98B61688 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1633329865; bh=xAy8hyOqg6gy31ht1dGWfYzEttEhQaNKcQ7vkcQr9h4=; h=Date:From:To:Subject:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=HVCP7WTj+UcS+tDHkOPAZaunUNTjsq1fwzj3sZhsQGVa2QMCm7AXjSJ4cDzj6PmpK eOtCfPkM7AQXoQ22FIzj8zQG4VtBFpvyXpUDQv/1a8UG0siJo1lf/ytPNDunlODUgy ZSoo+gOuH/AcKYIscVSnJA8WET6twHeP3VwvXS+A= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 6C5D0F8010B; Mon, 4 Oct 2021 08:43:34 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 9F185F80240; Mon, 4 Oct 2021 08:43:30 +0200 (CEST) Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 8C0EDF8010B for ; Mon, 4 Oct 2021 08:43:18 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 8C0EDF8010B Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="uuR2ltT7"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="e7hutZCQ" Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id 90C172218A; Mon, 4 Oct 2021 06:43:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1633329798; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=fUyV+BMLGRRvw+mx8t2FV2t80P2CLpVqtdnj7oHsces=; b=uuR2ltT745cV8GDRH6Hw2rjrM9cxOdod9FdQYLCFTvVF4ypiphYthzsGxqWkMZxa8e+6uP Xoh+mhEzp66cqHRkuewRm7eNWsz4L3E8qUiwZ9ZEmYGCJEirYIud91JZreaFHX/aypoe4g a+0LHEOig7NkJahr77nHJVYuO9gen+4= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1633329798; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=fUyV+BMLGRRvw+mx8t2FV2t80P2CLpVqtdnj7oHsces=; b=e7hutZCQiCVE3woZsPae6uooQn/Nu/LSo6CiktbhtdHUTdE/E9n+Mu3KT3GzLKmKld17Jl 4wUdQSltnMwL9XDA== Received: from alsa1.suse.de (alsa1.suse.de [10.160.4.42]) by relay2.suse.de (Postfix) with ESMTP id 6660BA3B81; Mon, 4 Oct 2021 06:43:18 +0000 (UTC) Date: Mon, 04 Oct 2021 08:43:18 +0200 Message-ID: From: Takashi Iwai To: Hans de Goede Subject: Re: DAPM PIN switches do not update in alsamixer when changed through UCM profile In-Reply-To: <8e0a6491-bc87-0f9a-099f-3baff1fc0e0d@redhat.com> References: <8e0a6491-bc87-0f9a-099f-3baff1fc0e0d@redhat.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL/10.8 Emacs/25.3 (x86_64-suse-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Cc: "alsa-devel@alsa-project.org" , Mark Brown , Takashi Iwai X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" On Sun, 03 Oct 2021 18:32:13 +0200, Hans de Goede wrote: > > Hi Takashi, > > On 10/3/21 4:46 PM, Takashi Iwai wrote: > > On Sun, 03 Oct 2021 15:12:57 +0200, > > Hans de Goede wrote: > >> > >> Hi All, > >> > >> I notice that DAPM PIN switches, such as e.g. the "Headphone" > >> SOC_DAPM_PIN_SWITCH defined in: > >> sound/soc/intel/boards/cht_bsw_nau8824.c: > >> > >> static const struct snd_kcontrol_new cht_mc_controls[] = { > >> SOC_DAPM_PIN_SWITCH("Headphone"), > >> SOC_DAPM_PIN_SWITCH("Headset Mic"), > >> SOC_DAPM_PIN_SWITCH("Int Mic"), > >> SOC_DAPM_PIN_SWITCH("Ext Spk"), > >> }; > >> > >> Do not get updated to reflect state-changes when the output > >> is switched between e.g. Headphone / "Ext Spk" by > >> pulseaudio/pipewire through the UCM profile mechanism. > >> > >> If I exit alsa-mixer after changing the output and > >> start it again then the control does show the expect > >> value. So it seems that we are failing to send a change > >> event about this somewhere? > > > > Does the patch below work? > > Thank you for the quick response. > > This works for the "Speaker" DAPM PIN switch on a rt5640 > board: > > > static const struct snd_kcontrol_new byt_rt5640_controls[] = { > SOC_DAPM_PIN_SWITCH("Headphone"), > SOC_DAPM_PIN_SWITCH("Headset Mic"), > SOC_DAPM_PIN_SWITCH("Headset Mic 2"), > SOC_DAPM_PIN_SWITCH("Internal Mic"), > SOC_DAPM_PIN_SWITCH("Speaker"), > SOC_DAPM_PIN_SWITCH("Line Out"), > }; > > But it does not work for the "Headphone" and "Line Out" switches, > these are actually hooked up to jack-detect, so I guess that the > jack-detection is already flipping them and then when the UCM > profile changes them it is a no-op causing the UCM setting of > the control to not cause an event because it is not a change. > > Relevant jack-detect bits from sound/soc/intel/boards/bytcr_rt5640.c: > > > static struct snd_soc_jack_pin rt5640_pins[] = { > { > .pin = "Headphone", > .mask = SND_JACK_HEADPHONE, > }, > { > .pin = "Headset Mic", > .mask = SND_JACK_MICROPHONE, > }, > }; > > static struct snd_soc_jack_pin rt5640_pins2[] = { > { > /* The 2nd headset jack uses lineout with an external HP-amp */ > .pin = "Line Out", > .mask = SND_JACK_HEADPHONE, > }, > { > .pin = "Headset Mic 2", > .mask = SND_JACK_MICROPHONE, > }, > }; > > > ret = snd_soc_card_jack_new(card, "Headset", > SND_JACK_HEADSET | SND_JACK_BTN_0, > &priv->jack, rt5640_pins, > ARRAY_SIZE(rt5640_pins)); > > ret = snd_soc_card_jack_new(card, "Headset 2", > SND_JACK_HEADSET, > &priv->jack2, rt5640_pins2, > ARRAY_SIZE(rt5640_pins2)); Those controls are the pin jacks, and they give the jack plug states, hence the values must be irrelevant from what UCM profile is being used, per se, but reflecting only about the jack plug state. Or do you mean that a value isn't updated even when a jack is plugged? > I tried both jacks a HP Elitepad 1000G2 with dock (one on the tablet > and one on the dock). > > With your patch the SOC_DAPM_PIN_SWITCH("Speaker") control correctly > updates (which it did not do before). But the "Line Out" (used for > the second headset jack) and the "Headphone" controls do not update. > > (exiting alsa-mixer and starting it again does show the "Line Out" > and "Headphone" controls have changed. You can run "alsactl monitor" to see which controls get notified. Please check whether the corresponding control is notified or not. thanks, Takashi