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 X-Spam-Level: X-Spam-Status: No, score=-10.2 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8A7D4C433DB for ; Fri, 22 Jan 2021 11:09:05 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 186A4235DD for ; Fri, 22 Jan 2021 11:09:03 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 186A4235DD Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=opensource.cirrus.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org 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 9746E1AD8; Fri, 22 Jan 2021 12:08:10 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 9746E1AD8 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1611313740; bh=65zd3jhjpa9gd3TpsCv1MyKWeJ7jAHBzLPOyVm24Cio=; h=Date:From:To:Subject:References:In-Reply-To:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=MOraSUmL9oLdnRo4LvxUfwTnN5fclHcCEjkQeGQYXhqLtFebUPFxiEdv4K75DD8tb z0/G3y1MMDD22/acfwWHYLtRad1+vZayCHzE6aDOjq+8UGySuei38G1rUpgG+nVrU0 r4F99yXWwgR5zMXBhzQidpvlapd3L0y+Br7dQsag= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 0CD45F80166; Fri, 22 Jan 2021 12:08:10 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 3D48BF8016E; Fri, 22 Jan 2021 12:08:08 +0100 (CET) Received: from mx0b-001ae601.pphosted.com (mx0b-001ae601.pphosted.com [67.231.152.168]) (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 9D657F80129 for ; Fri, 22 Jan 2021 12:07:55 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 9D657F80129 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=cirrus.com header.i=@cirrus.com header.b="inSCE9ER" 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 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 Cc: Cezary Rojewski , alsa-devel@alsa-project.org, patches@opensource.cirrus.com, Jie Yang , Pierre-Louis Bossart , linux-kernel@vger.kernel.org, Liam Girdwood , Andy Shevchenko , Mark Brown , Lee Jones 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" 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 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 X-Spam-Level: X-Spam-Status: No, score=-10.2 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 018C9C433DB for ; Fri, 22 Jan 2021 11:15:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9A1A222DBF for ; Fri, 22 Jan 2021 11:15:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727969AbhAVLOe (ORCPT ); Fri, 22 Jan 2021 06:14:34 -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