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 93C40C433F5 for ; Mon, 27 Dec 2021 15:41:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233003AbhL0Plx (ORCPT ); Mon, 27 Dec 2021 10:41:53 -0500 Received: from sin.source.kernel.org ([145.40.73.55]:41952 "EHLO sin.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239237AbhL0Pjf (ORCPT ); Mon, 27 Dec 2021 10:39:35 -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 sin.source.kernel.org (Postfix) with ESMTPS id 6EE46CE10CB; Mon, 27 Dec 2021 15:39:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3BC80C36AE7; Mon, 27 Dec 2021 15:39:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1640619571; bh=iJ8oCRrMcy9gwmWL+GWPkbD52C48gXdJjhfL3Z82dFQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EgKcmUoG5AlJFClKeR5MjBKoGB6ZhHR14FVUNlQQCSQfjaZp0vwvFu8LMGyIkz1J+ z8W954gVBGCi7VUo62yPJQzobjFEgkUI/y508LT0tJba99+icVnOSSFr1fDNtyimmt qJ/Ah+DHPppThAUbBlywZM3ds85zUT0PgNKF3L5U= 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.10 69/76] ASoC: rt5682: fix the wrong jack type detected Date: Mon, 27 Dec 2021 16:31:24 +0100 Message-Id: <20211227151327.076619444@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20211227151324.694661623@linuxfoundation.org> References: <20211227151324.694661623@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 @@ -924,6 +924,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); @@ -968,6 +970,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,