From mboxrd@z Thu Jan 1 00:00:00 1970 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D569BC433EF for ; Mon, 27 Dec 2021 15:53:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233923AbhL0PxC (ORCPT ); Mon, 27 Dec 2021 10:53:02 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:46138 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238485AbhL0Ppx (ORCPT ); Mon, 27 Dec 2021 10:45:53 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 2C3B8B810CE; Mon, 27 Dec 2021 15:45:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 55D95C36AEA; Mon, 27 Dec 2021 15:45:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1640619950; bh=WiqZ50Y+70PeNI4SZs2fufpbgvV101vBrJdaG6Gn1CA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DlRQ+IT4xxzZZBcZZBw+DT8F7VSA6tk0H5y3FFoj0Wnkdv9zfhbuy5sXZLNkcMCSM SoQFO1x7n5JLFl/q1DFjmSdhn5fUePthEmGkjqXVydOYmg2T23syG0aeCsRKN98QWF IjF3Lqz2VnxT3WED0EyDZM1MxCYUkpgIE7X1VbjY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Derek Fang , Mark Brown Subject: [PATCH 5.15 119/128] ASoC: rt5682: fix the wrong jack type detected Date: Mon, 27 Dec 2021 16:31:34 +0100 Message-Id: <20211227151335.496955543@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20211227151331.502501367@linuxfoundation.org> References: <20211227151331.502501367@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Derek Fang commit 8deb34a90f06374fd26f722c2a79e15160f66be7 upstream. Some powers were changed during the jack insert detection and clk's enable/disable in CCF. If in parallel, the influence has a chance to detect the wrong jack type, so add a lock. Signed-off-by: Derek Fang Link: https://lore.kernel.org/r/20211214105033.471-1-derek.fang@realtek.com Signed-off-by: Mark Brown Signed-off-by: Greg Kroah-Hartman --- sound/soc/codecs/rt5682.c | 4 ++++ 1 file changed, 4 insertions(+) --- a/sound/soc/codecs/rt5682.c +++ b/sound/soc/codecs/rt5682.c @@ -927,6 +927,8 @@ int rt5682_headset_detect(struct snd_soc unsigned int val, count; if (jack_insert) { + snd_soc_dapm_mutex_lock(dapm); + snd_soc_component_update_bits(component, RT5682_PWR_ANLG_1, RT5682_PWR_VREF2 | RT5682_PWR_MB, RT5682_PWR_VREF2 | RT5682_PWR_MB); @@ -973,6 +975,8 @@ int rt5682_headset_detect(struct snd_soc snd_soc_component_update_bits(component, RT5682_MICBIAS_2, RT5682_PWR_CLK25M_MASK | RT5682_PWR_CLK1M_MASK, RT5682_PWR_CLK25M_PU | RT5682_PWR_CLK1M_PU); + + snd_soc_dapm_mutex_unlock(dapm); } else { rt5682_enable_push_button_irq(component, false); snd_soc_component_update_bits(component, RT5682_CBJ_CTRL_1,