Received: by 2002:a05:7412:a9a2:b0:e2:908c:2ebd with SMTP id o34csp2422656rdh; Sun, 29 Oct 2023 15:57:49 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFqWBvAj4E9/7BIcDF6D1Atf54QYWi/7G8sKhL5vAfFJU7H8ouapLq1ExaKqNHSa19/h163 X-Received: by 2002:a05:6a21:71c7:b0:17a:e79c:c5ab with SMTP id ay7-20020a056a2171c700b0017ae79cc5abmr5399782pzc.48.1698620269253; Sun, 29 Oct 2023 15:57:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698620269; cv=none; d=google.com; s=arc-20160816; b=pBOU1EgMqh4WIseG7U3jH0pjbI9MqR+XjQPsgvIwfph+rIDdknNuK7NFNH92ZJfZcC Zsb009Ga+4lCmy9n0LjGPwA3rpU1xi6MCHMvMps9YBwaoBiKM+3irvPS+gvBf0OLHHoq J9TnHKwjJp+Vjr7Fd8VcxZoxcRxGQgHy1+K7RomZk+YKm88iEVs2nUumQa9NPT0SDzH/ 5jRaf1UzkV+4l4waeyMhqfWRfdJtGFoD6evCL2Qlp/TXNVzMvbMtUza6T96hulmlw998 HcdMNcNazjn8psH98oQKZL9rfsb/zz5qTaLA4r4T46EEr+zPCsNyU4PB16jqG1ygsAyu MRzQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=jTVJF0GHf8mHXWNGC+DmKMfzCUv0ilUjGMxDz8ejhTQ=; fh=1GmlUxh2NcUymfGzSIEM7rCWl5gdfVg8LSj1k8VHww4=; b=NKGeS2i1imopOiJP3OF5P5kgRiJ655JOZLA2RVmqyd72NckoXKJm1E81JXe4+GMJar W14YWV+YIG6UQdKOTNnUUtKTjKDYSJph6GeIGp3ThjbtWdUmK2dbx2ObwCSgNTuFWVEn 49Bn3G7bvGqtk0Hj/pmp/c49E2g3+YepJPEF+nxOq9LfAT2Fz6Ud8rMZe6JftKmwSQCI GYVDwMjOX3JA6z20Z2tWYBpKLjqNLkyVza4y/1NdfXJ6OiFvDaZV+hgRUbEtC3RHAo7p ISwyPrJ0uO+bZMh9X1xUHCP14K2pSEsrjVAGH6cnnKG4YuCxVyUIgvSvxG86gUKuofd3 VcvA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="IbKWAu/Q"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id h18-20020a170902f55200b001cc54cc2fe3si35144plf.398.2023.10.29.15.57.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 29 Oct 2023 15:57:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="IbKWAu/Q"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 0E7DD80608FA; Sun, 29 Oct 2023 15:57:46 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231321AbjJ2W5h (ORCPT + 99 others); Sun, 29 Oct 2023 18:57:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40542 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230491AbjJ2W5d (ORCPT ); Sun, 29 Oct 2023 18:57:33 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 12CB02D75; Sun, 29 Oct 2023 15:56:11 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BEC49C43397; Sun, 29 Oct 2023 22:56:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1698620168; bh=YP/Bagg/FmJOMvQhIt3xBhDBmQHqsMT6vRhRKIcACBY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IbKWAu/Qc0Mg5kGqTfTYH6w2YCyhKwnv/fIZiFBTTy2IW1BZi5xcuyBpU56eo0Y8H 31gzECFAbH2jtQFCltuxJkXlvQCMvDOFB+8LGrW4Y9C8SjG92+1HFZeSkpyvYqwIaX KgyZEJ51Z+LMuJRF1sIOi1lQ9XDpsDIqIFOHpMW5Hd521UscsHNzfborkK+ix3m+Lh VBm4I0KL61Ks0KafE+OGZ8wLYcU/fVFztt2TtBzH6XyXiRTLCCRN4yMGAbeLjPmq8f DIf0uFgv88XGSFd/pHrBZX+AmBYBbvgpZl3VdLTzDwA3o5vVojZfELUf2Ng9MEhWld XAZgsfsn8PbWA== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: David Rau , Mark Brown , Sasha Levin , support.opensource@diasemi.com, lgirdwood@gmail.com, perex@perex.cz, tiwai@suse.com, alsa-devel@alsa-project.org Subject: [PATCH AUTOSEL 6.5 37/52] ASoC: da7219: Correct the process of setting up Gnd switch in AAD Date: Sun, 29 Oct 2023 18:53:24 -0400 Message-ID: <20231029225441.789781-37-sashal@kernel.org> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231029225441.789781-1-sashal@kernel.org> References: <20231029225441.789781-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore X-stable-base: Linux 6.5.9 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.7 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Sun, 29 Oct 2023 15:57:46 -0700 (PDT) From: David Rau [ Upstream commit e8ecffd9962fe051d53a0761921b26d653b3df6b ] Enable Gnd switch to improve stability when Jack insert event occurs, and then disable Gnd switch after Jack type detection is finished. Signed-off-by: David Rau Link: https://lore.kernel.org/r/20231017021258.5929-1-David.Rau.opensource@dm.renesas.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- sound/soc/codecs/da7219-aad.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/sound/soc/codecs/da7219-aad.c b/sound/soc/codecs/da7219-aad.c index 581b334a6631d..3bbe850916493 100644 --- a/sound/soc/codecs/da7219-aad.c +++ b/sound/soc/codecs/da7219-aad.c @@ -59,9 +59,6 @@ static void da7219_aad_btn_det_work(struct work_struct *work) bool micbias_up = false; int retries = 0; - /* Disable ground switch */ - snd_soc_component_update_bits(component, 0xFB, 0x01, 0x00); - /* Drive headphones/lineout */ snd_soc_component_update_bits(component, DA7219_HP_L_CTRL, DA7219_HP_L_AMP_OE_MASK, @@ -155,9 +152,6 @@ static void da7219_aad_hptest_work(struct work_struct *work) tonegen_freq_hptest = cpu_to_le16(DA7219_AAD_HPTEST_RAMP_FREQ_INT_OSC); } - /* Disable ground switch */ - snd_soc_component_update_bits(component, 0xFB, 0x01, 0x00); - /* Ensure gain ramping at fastest rate */ gain_ramp_ctrl = snd_soc_component_read(component, DA7219_GAIN_RAMP_CTRL); snd_soc_component_write(component, DA7219_GAIN_RAMP_CTRL, DA7219_GAIN_RAMP_RATE_X8); @@ -421,6 +415,11 @@ static irqreturn_t da7219_aad_irq_thread(int irq, void *data) * handle a removal, and we can check at the end of * hptest if we have a valid result or not. */ + + cancel_delayed_work_sync(&da7219_aad->jack_det_work); + /* Disable ground switch */ + snd_soc_component_update_bits(component, 0xFB, 0x01, 0x00); + if (statusa & DA7219_JACK_TYPE_STS_MASK) { report |= SND_JACK_HEADSET; mask |= SND_JACK_HEADSET | SND_JACK_LINEOUT; -- 2.42.0