Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp941822pxb; Fri, 22 Jan 2021 03:15:23 -0800 (PST) X-Google-Smtp-Source: ABdhPJystR/g9rtU9+q36OLZD5rQEYnnh7hamK5eZS7fmQv96NoAEyvqtdhHkfy+nqxao3Bxv65b X-Received: by 2002:a17:906:2695:: with SMTP id t21mr2754679ejc.287.1611314123275; Fri, 22 Jan 2021 03:15:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611314123; cv=none; d=google.com; s=arc-20160816; b=EQOyaVrNYgtWcj26NWnw9oC2PqnLKqHNL0wB+/8qkNX//4PRxFUIA9xFcgHiieFNU7 nssfDfrdoDNr1TN5XMdC86q+ivj2ywnQIf/PoJl1h7gcK9BN/aBNYgvHXW3ZBDsfNUmX U1p4Ie3Fh1XRv11enelNRcZYHDhKoANrPDDaAWX6hfShfHpw9GNJ7fJff/teMMZhXIih RapW+lzObEP9CxQQxRUrdq0xdOMY0e2whLE8l9TyhTA2lS/btXIV/4qqlIaZcUVAgYKR UAq0gTTjw3ANiolq6MwAGGnWyJI2y744QBGsxNWXGgK6mX/WCqa6eJmns0OmJv4ULNJW vu6w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=xpg9HQpwaknEm815/jkH3pctz/69T/ZbqgbwyYSv4aQ=; b=WLRnRUEwwFdPh4Z8kkYqFb4VN/pYlQTE1RKRmK/Smmp8Tl6LLdDUqMxJ291oSwxldx A7FtuhHVtQEs17rGpaO7aOYGxNJeDfXBo9E2w//aQSzcEIyYcrZ+WuZPcaTs7iFsXFP6 fR33BI0baVnrCikoRN9QjgmbHI/DH+gWYs1eEldMKHfUSRZa/W+wNksQZ+Ns3tFAzMps 2CunQy8uARxDHoMjcKrBXBVPoTTOJ9ASXYMXYZDiDem3tXhDicHTb5vhgno4UkvhyRmg oFyVbUpHZhGErIgmksyDcxml48Uj3Ch+SVakprC4nscAZ6clNwJasS5Z+44Zlc/a8c9t SZbA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cirrus.com header.s=PODMain02222019 header.b=inSCE9ER; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=cirrus.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o14si2948289ejb.361.2021.01.22.03.14.59; Fri, 22 Jan 2021 03:15:23 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@cirrus.com header.s=PODMain02222019 header.b=inSCE9ER; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=cirrus.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727891AbhAVLOL (ORCPT + 99 others); Fri, 22 Jan 2021 06:14:11 -0500 Received: from mx0b-001ae601.pphosted.com ([67.231.152.168]:7252 "EHLO mx0b-001ae601.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728151AbhAVLIw (ORCPT ); Fri, 22 Jan 2021 06:08:52 -0500 Received: from pps.filterd (m0077474.ppops.net [127.0.0.1]) by mx0b-001ae601.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 10MB7rsS030517; Fri, 22 Jan 2021 05:07:53 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cirrus.com; h=date : from : to : cc : subject : message-id : references : mime-version : content-type : in-reply-to; s=PODMain02222019; bh=xpg9HQpwaknEm815/jkH3pctz/69T/ZbqgbwyYSv4aQ=; b=inSCE9ERIZS61sBTmB+RJbsOU8LKoBdaVPU6h+zoQf2XL9TfeLIK/MjZWEZBhadEzUia jMsiZGkg3dmg+7Cz0OCV8ZHt6/ccZbqGFhdmDz0gNMC8cFKXZxS4+DOQbDDXoOfsHZWP JMilVrRi7Zj1qwUq4KOkHMpqFiDZIDwgmfERIjCbRhpJNB+j5umOUIuUtz03hRDCKDmD Hl4UfJ+ARkRv5nspr6aVEN5Gu6XxG6jg9Nkas2/r6zWL+6O9Vo18qEOEbVrQQ7j5EgWs ZOX4GZAAk8rpR2qMbEh5QYmtcyUYZyNnggBvsmXJcX13hkCfxLlMFEAgZO4cWmRtEdMw 1g== Received: from ediex01.ad.cirrus.com ([87.246.76.36]) by mx0b-001ae601.pphosted.com with ESMTP id 3668pdugda-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT); Fri, 22 Jan 2021 05:07:53 -0600 Received: from EDIEX01.ad.cirrus.com (198.61.84.80) by EDIEX01.ad.cirrus.com (198.61.84.80) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1913.5; Fri, 22 Jan 2021 11:07:52 +0000 Received: from ediswmail.ad.cirrus.com (198.61.86.93) by EDIEX01.ad.cirrus.com (198.61.84.80) with Microsoft SMTP Server id 15.1.1913.5 via Frontend Transport; Fri, 22 Jan 2021 11:07:52 +0000 Received: from ediswmail.ad.cirrus.com (ediswmail.ad.cirrus.com [198.61.86.93]) by ediswmail.ad.cirrus.com (Postfix) with ESMTP id F21BC11CB; Fri, 22 Jan 2021 11:07:51 +0000 (UTC) Date: Fri, 22 Jan 2021 11:07:51 +0000 From: Charles Keepax To: Hans de Goede CC: Lee Jones , Cezary Rojewski , Pierre-Louis Bossart , Liam Girdwood , Jie Yang , Mark Brown , , , Andy Shevchenko , Subject: Re: [PATCH v2 03/12] ASoC: arizona-jack: Fix some issues when HPDET IRQ fires after the jack has been unplugged Message-ID: <20210122110751.GF106851@ediswmail.ad.cirrus.com> References: <20210117160555.78376-1-hdegoede@redhat.com> <20210117160555.78376-4-hdegoede@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <20210117160555.78376-4-hdegoede@redhat.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 spamscore=0 malwarescore=0 adultscore=0 mlxscore=0 phishscore=0 impostorscore=0 lowpriorityscore=0 clxscore=1015 priorityscore=1501 mlxlogscore=999 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2101220061 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Jan 17, 2021 at 05:05:46PM +0100, Hans de Goede wrote: > When the jack is partially inserted and then removed again it may be > removed while the hpdet code is running. In this case the following > may happen: > > 1. The "JACKDET rise" or ""JACKDET fall" IRQ triggers > 2. arizona_jackdet runs and takes info->lock > 3. The "HPDET" IRQ triggers > 4. arizona_hpdet_irq runs, blocks on info->lock > 5. arizona_jackdet calls arizona_stop_mic() and clears info->hpdet_done > 6. arizona_jackdet releases info->lock > 7. arizona_hpdet_irq now can continue running and: > 7.1 Calls arizona_start_mic() (if a mic was detected) > 7.2 sets info->hpdet_done > > Step 7 is undesirable / a bug: > 7.1 causes the device to stay in a high power-state (with MICVDD enabled) > 7.2 causes hpdet to not run on the next jack insertion, which in turn > causes the EXTCON_JACK_HEADPHONE state to never get set > > This fixes both issues by skipping these 2 steps when arizona_hpdet_irq > runs after the jack has been unplugged. > > Reviewed-by: Andy Shevchenko > Signed-off-by: Hans de Goede > --- Acked-by: Charles Keepax Thanks, Charles