From patchwork Mon May 30 13:22:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adam Thomson X-Patchwork-Id: 577850 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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 14843C433F5 for ; Mon, 30 May 2022 13:23:54 +0000 (UTC) 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 2C2001949; Mon, 30 May 2022 15:23:03 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 2C2001949 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1653917033; bh=YXty0/7z6ZrZUHicFDv5v5G4RXIzi2GkxPp9HpTszn8=; h=In-Reply-To:References:From:Date:Subject:To:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=RmZFyk+CnJcXgBURhjDPJiCEH3AwF35tk2tN9U0d9QZ8sN7Url4Nu7HpAkWh14EVh D5oe28dkLTZ+79ieeOMH9sGDoqdTLrUXYau4Bdr2Eb0VOl38wcdBemYG4u19zwBxLg k2i8T3Wol7YXfoWy5OCbk/VHcldYUFHIeCmgqf7M= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 4C9F4F804B4; Mon, 30 May 2022 15:22:35 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id B10CEF804BD; Mon, 30 May 2022 15:22:33 +0200 (CEST) Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on20617.outbound.protection.outlook.com [IPv6:2a01:111:f400:7d00::617]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id D97C6F800E5 for ; Mon, 30 May 2022 15:22:26 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz D97C6F800E5 Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=dialogsemiconductor.onmicrosoft.com header.i=@dialogsemiconductor.onmicrosoft.com header.b="zuui1emS" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Y8PE3TiWEaO8o2QIKbgsb4gBZ7ze6T/CPgVtv29HzdVrHdBbb181v0cnj4cjxya1KTIdCVGDz2RY1cco1uGGFFxdBFZOJxRhp+fSgTP6+A1cc84q2dRgoFWRrzZ6YzsfyplA1lukNY3Ig9zVa46FWT/HdQrmqG6P8GADF0IU8GU0zhVh4ztG/GGVMBoP9X3XZbV+WipBz9bshcjKWwWCjEmYrB0acup7ihYhINiR9K7KzK66wGtWocM/E9+M5fz75saA5aXjHUIiPQdo4y9lCJhj1ShQUns2IN8J0EcQ535QocT+FWeopkHtDyDLR9ZBsONCp/KmJX29vLRQhBbQGw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Z2dXRhO2zN4O/VMDv2A5cVohtgsMei5ctsybRNuD968=; b=PzVa329GJHYb8Emm/yKQziz//A6qVmdFyTCATPteVBg1MhT61Y91pLogdv4WVyh5lGUhSHfCc2fjPc99PAjIFEgm4yDKQXToO/RoluG4HvmMPOtwgWFmMCgxqcMxRKXVlzZYBguO7xOe+LDFvYY0C77ADTm+ImHI6DcqCymYAfVu/PquJEbyHdxXfIDiMNvDXQKTaYonfBeD8EnhyzLF0rXPAFvnyIE7xS8uuKK3EAQBvQsLSbpSibNc96UHHo1prAd+Z/neXiSN3s5stNDEO2D+RM2B+2yEfkDasnkwQh1pkyQYgCDACl2oGaRioek/GhfpBdxilQz5A+V1vDfAHw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=softfail (sender ip is 193.240.239.45) smtp.rcpttodomain=alsa-project.org smtp.mailfrom=diasemi.com; dmarc=fail (p=none sp=none pct=100) action=none header.from=dm.renesas.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dialogsemiconductor.onmicrosoft.com; s=selector1-dialogsemiconductor-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Z2dXRhO2zN4O/VMDv2A5cVohtgsMei5ctsybRNuD968=; b=zuui1emS/jiP6TGXumOfT+goC2jqxPgyMqaqlq7zUmjuhlUSPHMb8jFHcl7WK9mwMN2HHDTYS5MOBExVo874IumvVl5YbNc5hxoIYlpnGeE1fApR2luBua2Ew0dE6zt3UJwxSvTpJHVlWfV3RUk0k0oooP2O4NUuPkVrUO89/WA= Received: from AM6P195CA0037.EURP195.PROD.OUTLOOK.COM (2603:10a6:209:87::14) by AM0PR10MB2833.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:125::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5293.13; Mon, 30 May 2022 13:22:23 +0000 Received: from VE1EUR02FT103.eop-EUR02.prod.protection.outlook.com (2603:10a6:209:87:cafe::c9) by AM6P195CA0037.outlook.office365.com (2603:10a6:209:87::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5293.13 via Frontend Transport; Mon, 30 May 2022 13:22:23 +0000 X-MS-Exchange-Authentication-Results: spf=softfail (sender IP is 193.240.239.45) smtp.mailfrom=diasemi.com; dkim=none (message not signed) header.d=none;dmarc=fail action=none header.from=dm.renesas.com; Received-SPF: SoftFail (protection.outlook.com: domain of transitioning diasemi.com discourages use of 193.240.239.45 as permitted sender) Received: from mailrelay1.diasemi.com (193.240.239.45) by VE1EUR02FT103.mail.protection.outlook.com (10.152.13.38) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5293.13 via Frontend Transport; Mon, 30 May 2022 13:22:23 +0000 Received: from nbsrvex-01v.diasemi.com (10.1.17.243) by nbsrvex-01v.diasemi.com (10.1.17.243) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Mon, 30 May 2022 15:22:22 +0200 Received: from slsrvapps-01.diasemi.com (10.24.28.40) by nbsrvex-01v.diasemi.com (10.1.17.243) with Microsoft SMTP Server id 15.1.2176.2 via Frontend Transport; Mon, 30 May 2022 15:22:22 +0200 Received: by slsrvapps-01.diasemi.com (Postfix, from userid 22379) id CD1C580007F; Mon, 30 May 2022 13:22:22 +0000 (UTC) Message-ID: In-Reply-To: References: From: Adam Thomson Date: Mon, 30 May 2022 13:22:22 +0000 Subject: [PATCH 1/2] ASoC: da7219: Fix pole orientation detection on certain headsets To: Mark Brown , Liam Girdwood , Takashi Iwai , Jaroslav Kysela MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 7253d793-1107-4905-d7a9-08da423f6ed0 X-MS-TrafficTypeDiagnostic: AM0PR10MB2833:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 2 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: maFO8AoOl8J3f0+wKnQ80cxPaDWyuHi3jAyZKEM6aRSagia5UBjteYCeSG/fCWxhkH14vxenrxWPXIvfS/Nklx0WHEt2oW0rfMUGXApNJ9/hX8ReU5JYz1+K3vItOeV8MCqd5qBoAwo0hWv1Z1UJQ9E3MXwZvV948G490NzQcd5xwCBkGzhVBCW9WbPRZBKdiPHqWwy+mnKN7NMpqTrwF2aqeekQbxn0XndVbwKN9kMNLx6Cr1a6bHIdQDCLk0fTNRQaJhhjeb17Bt/NtGzG7Kg28HAv/NwdFw6iDF+u7XW8n9Xz+7fZWT1Ldbifl5ZuPDyybdRgBVhE1PrZh6A5TYp0YLXWX5+YfBNX97+9xSpSfLs0gppPSAn5AJHkvMDAeq+vCfHKc/bnra4COE5v/x0pofYUoKW9QbOHP0heaf5oZthteEuiNERWTipkZzxc7ypvIvAl1HqldaFTRs4DUZwab09d4Wi8jNUn3p71O1SHUpG8BLZxFKEZvvoJvFzZcRNbQeMzfUt44lxlMxhLH64Dr8yM6nake8MfhSTDxg9I/+aUYc7X3o/kI3oiOi4ukT3XXIyDE61nQHaVwJYIMD4xdrQlJE8OAFbgnM8TaOjTai+BvfuroFc7tztl5OQch29O+NbSuMsWM1jDhD8zm601jPh1Uke912GeVuvVUFkGf6IDiAgXPuh1tj6ac6gmFnt41471oboLguID74Z1iTuweu2atZ72IRnP9oEGLBOUpBBBEbLvgJO5n2n7pyyH X-Forefront-Antispam-Report: CIP:193.240.239.45; CTRY:GB; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mailrelay1.diasemi.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230001)(4636009)(136003)(346002)(376002)(396003)(39860400002)(40470700004)(46966006)(36840700001)(42882007)(42186006)(54906003)(70586007)(70206006)(110136005)(316002)(8936002)(186003)(336012)(82740400003)(5660300002)(40480700001)(2616005)(2906002)(508600001)(81166007)(6266002)(83380400001)(83170400001)(36860700001)(40460700003)(26005)(41300700001)(356005)(47076005)(82310400005)(4326008)(8676002)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: diasemi.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 May 2022 13:22:23.5118 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7253d793-1107-4905-d7a9-08da423f6ed0 X-MS-Exchange-CrossTenant-Id: 511e3c0e-ee96-486e-a2ec-e272ffa37b7c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=511e3c0e-ee96-486e-a2ec-e272ffa37b7c; Ip=[193.240.239.45]; Helo=[mailrelay1.diasemi.com] X-MS-Exchange-CrossTenant-AuthSource: VE1EUR02FT103.eop-EUR02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR10MB2833 Cc: alsa-devel@alsa-project.org, Support Opensource , linux-kernel@vger.kernel.org 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" It has been recently found that certain 'active' headsets can be mis-detected as OMTP instead of CTIA, causing obvious issus with audio quality. This relates to increased resistances which negatively impacts the pole detection circuitry within the device. To counter this, ground switches on both headphone channels are available to enable/disable and these allow for the detection process to operate as intended, even with active headsets. This commit adds control of the ground switches to the AAD logic. Signed-off-by: Adam Thomson --- sound/soc/codecs/da7219-aad.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/sound/soc/codecs/da7219-aad.c b/sound/soc/codecs/da7219-aad.c index 7998fdd3b378..e7d8c33e02cc 100644 --- a/sound/soc/codecs/da7219-aad.c +++ b/sound/soc/codecs/da7219-aad.c @@ -60,6 +60,9 @@ 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, @@ -153,6 +156,9 @@ 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); @@ -444,6 +450,9 @@ static irqreturn_t da7219_aad_irq_thread(int irq, void *data) snd_soc_dapm_disable_pin(dapm, "Mic Bias"); snd_soc_dapm_sync(dapm); + /* Enable ground switch */ + snd_soc_component_update_bits(component, 0xFB, 0x01, 0x01); + /* Cancel any pending work */ cancel_work_sync(&da7219_aad->btn_det_work); cancel_work_sync(&da7219_aad->hptest_work); @@ -899,6 +908,9 @@ int da7219_aad_init(struct snd_soc_component *component) snd_soc_component_update_bits(component, DA7219_ACCDET_CONFIG_1, DA7219_BUTTON_CONFIG_MASK, 0); + /* Enable ground switch */ + snd_soc_component_update_bits(component, 0xFB, 0x01, 0x01); + INIT_WORK(&da7219_aad->btn_det_work, da7219_aad_btn_det_work); INIT_WORK(&da7219_aad->hptest_work, da7219_aad_hptest_work); From patchwork Mon May 30 13:22:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adam Thomson X-Patchwork-Id: 577293 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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id F27A4C433EF for ; Mon, 30 May 2022 13:24:14 +0000 (UTC) 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 38F841ACE; Mon, 30 May 2022 15:23:23 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 38F841ACE DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1653917053; bh=n2a+VBlotDwS1w46jKFBa78Fu5F3v7YYimj6Bg0euEk=; h=In-Reply-To:References:From:Date:Subject:To:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=OxrJzenu2ttMyUUupo/2MbcsI7Em95S9asE3xtuDnnchRijG+voLHr2eHjj261cs2 AmlocwJawnfd3FnIthS+gpSdz/dGWMztp7ykFy4LVkiTPgT1GT0zDapSSfKQ3MQI/u HlfBi+AOu5zgGY/H9cYIsNN2GDRyhPdDnG/yTnZE= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 52BF9F8051E; Mon, 30 May 2022 15:22:44 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 1FDC9F800DE; Mon, 30 May 2022 15:22:38 +0200 (CEST) Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on20630.outbound.protection.outlook.com [IPv6:2a01:111:f400:7d00::630]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 4BF15F800DE for ; Mon, 30 May 2022 15:22:30 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 4BF15F800DE Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=dialogsemiconductor.onmicrosoft.com header.i=@dialogsemiconductor.onmicrosoft.com header.b="iaOzPl6D" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QbsJG4cPy0aVKFuKRAgC4uhCvLlcHPUyCVarDFkvQPG+TS+Ttk6xqLd6X7CYOp3CmTvXceBcGgjRdnEwqtyEshiwnElVk9d6gG8QzidTI6T5mO+QqIYCsC7+EVKrcbN9G8/UAKv0F2G3h3GzA7R0l9LUuaa/P3DHl8oSbTX6q7IRENcd2xQ/nKHGMFXNSwDVASdtz60S/WeFsFXzlXihPm9Ycn7eP3XroZJzRM6/kc+nJZsaEqRGys/BRWkpkLIkTBNLywKSKEL2bR+Rn6aZG98PF8zASulw5Wv1eCFkwAUFFi6GC4Y3rJhdedm6eDKGANpW4cs2JRgBFyJWQ7yEbg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=aSPIjFNdnRk4IR0W2usJZ+hjMggEmzmUzq/f11tyuVI=; b=PMUEi0wZIG0cqN9kVZg9mOE7h6xAIbki0rkgIG2SFQk9m8e3DTw6MXrhWtRRn0tR/mp0LI74GWJI59MRD1dCF2Oga6gFn+/ZaZMTkBzHvyykc1AYUvQuHWwwKmoFFjKx7w3VXETfoNnnxvaj0g8nVzOIPCoNkYFF26QdMoPeor3sNTFLtLmou2fr4ZCf98br7E0xgA0pM8bKzsDikMbWfhI1Vhv4gAOtmCqhU1kEHSK5s/OKRMUSgC1XlkwW7nNd0C3fLR2Mcbt2Wbb59VQz5rtYbil1b9jzSMA+x6bEJb8yaEF2sNJVN3WanhzyBc11pzQgpeXicrPINmQpEGcN2A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=softfail (sender ip is 193.240.239.45) smtp.rcpttodomain=alsa-project.org smtp.mailfrom=diasemi.com; dmarc=fail (p=none sp=none pct=100) action=none header.from=dm.renesas.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dialogsemiconductor.onmicrosoft.com; s=selector1-dialogsemiconductor-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=aSPIjFNdnRk4IR0W2usJZ+hjMggEmzmUzq/f11tyuVI=; b=iaOzPl6D74ZpiOmz/Cc2PQ4/tXDrtueA0hGcFfXhhhQcmq3EV9wJ1tZto25W9JdBf3LytBVCdTx7twU7idmvFLDL3FwM9pmwqZq9Mlmp4huVbe/eQY9Y4HT+pJEZ9XlaPfqwDjfatKH/9y7C56HteWKc8fJhxrz3Q9AMfF1gWUI= Received: from AS9PR06CA0501.eurprd06.prod.outlook.com (2603:10a6:20b:49b::26) by GV2PR10MB6138.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:150:ae::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5293.19; Mon, 30 May 2022 13:22:26 +0000 Received: from VE1EUR02FT057.eop-EUR02.prod.protection.outlook.com (2603:10a6:20b:49b:cafe::2a) by AS9PR06CA0501.outlook.office365.com (2603:10a6:20b:49b::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5293.13 via Frontend Transport; Mon, 30 May 2022 13:22:25 +0000 X-MS-Exchange-Authentication-Results: spf=softfail (sender IP is 193.240.239.45) smtp.mailfrom=diasemi.com; dkim=none (message not signed) header.d=none;dmarc=fail action=none header.from=dm.renesas.com; Received-SPF: SoftFail (protection.outlook.com: domain of transitioning diasemi.com discourages use of 193.240.239.45 as permitted sender) Received: from mailrelay1.diasemi.com (193.240.239.45) by VE1EUR02FT057.mail.protection.outlook.com (10.152.13.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5293.13 via Frontend Transport; Mon, 30 May 2022 13:22:24 +0000 Received: from nbsrvex-01v.diasemi.com (10.1.17.243) by nbsrvex-01v.diasemi.com (10.1.17.243) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Mon, 30 May 2022 15:22:24 +0200 Received: from slsrvapps-01.diasemi.com (10.24.28.40) by nbsrvex-01v.diasemi.com (10.1.17.243) with Microsoft SMTP Server id 15.1.2176.2 via Frontend Transport; Mon, 30 May 2022 15:22:23 +0200 Received: by slsrvapps-01.diasemi.com (Postfix, from userid 22379) id D212680007F; Mon, 30 May 2022 13:22:23 +0000 (UTC) Message-ID: In-Reply-To: References: From: Adam Thomson Date: Mon, 30 May 2022 13:22:23 +0000 Subject: [PATCH 2/2] ASoC: da7219: cancel AAD related work earlier for jack removal To: Mark Brown , Liam Girdwood , Takashi Iwai , Jaroslav Kysela MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ed6af9dd-19d0-428c-aeeb-08da423f6f6e X-MS-TrafficTypeDiagnostic: GV2PR10MB6138:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 2 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: BA22a3jbdbTcxXN1gqVBbo4Ia8Cw6uiZO8RzPSjGjHYZ2Oxqcy2cSsR10G6/AzyglkT0lJjmvukUhRlFkckNKij8GkKBI7ZcU82UntZd1Eb3B0BnBzn9EnTWwqiRgFzjbxGjZ4coIeUsxe0UR954RxbFfJIIzS+Zpcrr0/uNR9Yf+mJhMvANKmUgI2fqzqNfC1QnBTCq6NvkFykO+WQUXYY7nnUYFQXeBrOboPO8K3+rfYheSa+6DDWPETCKAA7qhECfBgDaoqJ9ZPTuR0l9GQJKU3ONcbCngPG+YSz+USc0J8i87aIMII9pPx1jqWEuWLjUoxselLh+Tg9QgGiTJ32iBFUV++vBHmGdIfdEBGv4DjzEkNS+XI7sRY+1XPyJoWU36hJ4a09+UphaGeI95y3DTbpMufzWVoPXYPKhfEyftnjDH26CyG9HliQRW/z6Lfnfs0Olrc5V+Ax4oZ3kHRRrPEejiFJeBNM81rSkYVt9LZAK4s3bZ8ONCVVcgZgzV9ut4M6CC2Y0XJIZFTzCsBHWmfqpuVEBcY94npH55J1Yq9+EJk/BleFxZoQg5OeBpaIeqXkZySQ4XBhvqsq8XLVsi5a13YxxZfK/cO5SN6RAKL9njVKn6N3vADTea7nZN7jpAmbMTiCcJ7t33qQEsMvSKRlFJG483QbwX9bYO0FmNU6LlTNpgNIvVDgyvMzT48OZQW9Tr4SbrsFrniK3qOBpWT/J3wwdSqxFDoEM3Tzx28ihrZvbDCs2Jbsu+rgY X-Forefront-Antispam-Report: CIP:193.240.239.45; CTRY:GB; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mailrelay1.diasemi.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230001)(4636009)(136003)(376002)(39860400002)(396003)(346002)(36840700001)(40470700004)(46966006)(6266002)(2906002)(26005)(83380400001)(82740400003)(40480700001)(81166007)(36860700001)(42882007)(186003)(83170400001)(2616005)(41300700001)(356005)(508600001)(42186006)(336012)(316002)(110136005)(8936002)(47076005)(54906003)(70206006)(4326008)(82310400005)(70586007)(8676002)(40460700003)(5660300002)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: diasemi.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 May 2022 13:22:24.5619 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ed6af9dd-19d0-428c-aeeb-08da423f6f6e X-MS-Exchange-CrossTenant-Id: 511e3c0e-ee96-486e-a2ec-e272ffa37b7c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=511e3c0e-ee96-486e-a2ec-e272ffa37b7c; Ip=[193.240.239.45]; Helo=[mailrelay1.diasemi.com] X-MS-Exchange-CrossTenant-AuthSource: VE1EUR02FT057.eop-EUR02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: GV2PR10MB6138 Cc: alsa-devel@alsa-project.org, Support Opensource , linux-kernel@vger.kernel.org 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" To avoid the unlikely possibility of register misalignment for headphones being ungrounded/driven after a jack has been removed, move the cancel_work_sync() call to the start of the jack removal handling in the IRQ thread. Signed-off-by: Adam Thomson --- sound/soc/codecs/da7219-aad.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sound/soc/codecs/da7219-aad.c b/sound/soc/codecs/da7219-aad.c index e7d8c33e02cc..bba73c44c219 100644 --- a/sound/soc/codecs/da7219-aad.c +++ b/sound/soc/codecs/da7219-aad.c @@ -434,6 +434,10 @@ static irqreturn_t da7219_aad_irq_thread(int irq, void *data) mask |= DA7219_AAD_REPORT_ALL_MASK; da7219_aad->jack_inserted = false; + /* Cancel any pending work */ + cancel_work_sync(&da7219_aad->btn_det_work); + cancel_work_sync(&da7219_aad->hptest_work); + /* Un-drive headphones/lineout */ snd_soc_component_update_bits(component, DA7219_HP_R_CTRL, DA7219_HP_R_AMP_OE_MASK, 0); @@ -452,10 +456,6 @@ static irqreturn_t da7219_aad_irq_thread(int irq, void *data) /* Enable ground switch */ snd_soc_component_update_bits(component, 0xFB, 0x01, 0x01); - - /* Cancel any pending work */ - cancel_work_sync(&da7219_aad->btn_det_work); - cancel_work_sync(&da7219_aad->hptest_work); } }