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 DC406C433EF for ; Sun, 3 Oct 2021 14:47:27 +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 7A73F6124D for ; Sun, 3 Oct 2021 14:47:25 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 7A73F6124D 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 F3745167E; Sun, 3 Oct 2021 16:46:33 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz F3745167E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1633272444; bh=vnwEyWm6WKum8JUin2GaoA+cCXjEFFnWo2WXHpSD/pA=; h=Date:From:To:Subject:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=TAcA/hzC0vJBYaF9bvZxzEogcNjtSEJfDDgCsNxe3M2pOy/DPDCAEUuweWkGaSzPT 8YTOaGeDDr82HVKNlV9AsGy1MOYLjFhK7bfJvRCebxRywRx6m0j2qWm5BUyLYQBNSH +GCEBJbZ2vIut1ph+BMdffc93lXR5cFO82rA2F1c= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 6A819F80259; Sun, 3 Oct 2021 16:46:33 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id C1836F8027D; Sun, 3 Oct 2021 16:46:31 +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 1889BF800EF for ; Sun, 3 Oct 2021 16:46:26 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 1889BF800EF Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="jJ9/cbb6"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="0ZKlHs4w" Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id 6B87D22232; Sun, 3 Oct 2021 14:46:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1633272381; 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=4FKSJfh8aZCuJjapvhzXpZSBoEo6Kfm65JgcT+nUcJE=; b=jJ9/cbb6/UrOwaLjW3ZGMytrEUfWoxPtwgTZfMyozV8mHgiWk7t3nqbDlatp5/Oa71ic8J 3QOUPc1WABxv/hy4alv/dd0+k5AZ9kHb1iSYT/YsgCg+y18dEDiSDoS8o8qwEK3Weubio6 4C9JADVDlWSG+0Qw6wNOBQ/8yJ3ZK6U= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1633272381; 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=4FKSJfh8aZCuJjapvhzXpZSBoEo6Kfm65JgcT+nUcJE=; b=0ZKlHs4w6QucTQpclTPmZ/9Npr/Si5HD/nVCevyQzjbWxJVMBB0B5n5bx/gaERGXMmVPye yJCq2Pdzb1eMQRAQ== Received: from alsa1.suse.de (alsa1.suse.de [10.160.4.42]) by relay2.suse.de (Postfix) with ESMTP id 537A9A3B81; Sun, 3 Oct 2021 14:46:21 +0000 (UTC) Date: Sun, 03 Oct 2021 16:46:21 +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: References: 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 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? thanks, Takashi --- a/sound/soc/soc-dapm.c +++ b/sound/soc/soc-dapm.c @@ -2561,6 +2561,7 @@ static int snd_soc_dapm_set_pin(struct snd_soc_dapm_context *dapm, const char *pin, int status) { struct snd_soc_dapm_widget *w = dapm_find_widget(dapm, pin, true); + int ret = 0; dapm_assert_locked(dapm); @@ -2573,13 +2574,14 @@ static int snd_soc_dapm_set_pin(struct snd_soc_dapm_context *dapm, dapm_mark_dirty(w, "pin configuration"); dapm_widget_invalidate_input_paths(w); dapm_widget_invalidate_output_paths(w); + ret = 1; } w->connected = status; if (status == 0) w->force = 0; - return 0; + return ret; } /** @@ -3583,14 +3585,15 @@ int snd_soc_dapm_put_pin_switch(struct snd_kcontrol *kcontrol, { struct snd_soc_card *card = snd_kcontrol_chip(kcontrol); const char *pin = (const char *)kcontrol->private_value; + int ret; if (ucontrol->value.integer.value[0]) - snd_soc_dapm_enable_pin(&card->dapm, pin); + ret = snd_soc_dapm_enable_pin(&card->dapm, pin); else - snd_soc_dapm_disable_pin(&card->dapm, pin); + ret = snd_soc_dapm_disable_pin(&card->dapm, pin); snd_soc_dapm_sync(&card->dapm); - return 0; + return ret; } EXPORT_SYMBOL_GPL(snd_soc_dapm_put_pin_switch); @@ -4023,7 +4026,7 @@ static int snd_soc_dapm_dai_link_put(struct snd_kcontrol *kcontrol, rtd->params_select = ucontrol->value.enumerated.item[0]; - return 0; + return 1; } static void