Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp1381577yba; Thu, 4 Apr 2019 09:36:34 -0700 (PDT) X-Google-Smtp-Source: APXvYqwI2Y+++fApaQmpeiwFJUtEIUitdadDqPYJgNw7OJ7Xb3+ueJ71c/hW7iNulFaoHFb473Zx X-Received: by 2002:a65:5202:: with SMTP id o2mr6503440pgp.402.1554395794028; Thu, 04 Apr 2019 09:36:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554395794; cv=none; d=google.com; s=arc-20160816; b=ERQ2KdsIrItPvAy7HftfvLF1A3GvTcC76GT6CgX5hUhLNlYO9vvHNB5KjgzL3ovqTr DD1GC4RvNRQ5WUn4l7ppe4NGVEWRDZiGdpx7j1Xhpghv07BGPjrwMqp4csn0X62R5Rkw RAR/Pyh/OPUFo1Hu3XmlNKjVod7NcuSYIe/tP+lafvBfoLpvVDB6oj4NlJb3qKZUGfmf kmBkXOh+lnodUwqUuCTlySY1TpdEW0s+f99hV1P5jIfaUsmRKjUasRy5iqpBYCAk6sx1 GfUngERSpyL/ot+ELpQ9RuaY7uJh94pAjvFb8naZA/2fUWYkU5ayEBhrRuvo6WskP0/K MJvQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from; bh=4uUkCIh/K9dOhXiQ6F7lsgCH4u6wuUb55tSA2y9tMFA=; b=FhfTDddPPR1Ills3GHASb+AM5NsfZ5FqwF3dKqBpLlGG/qXO20xMgh4CuFQneWVYfK wRil+bVZQiP4Iw31m4NOGOCP+FcBRFKyAOneeTRC6S1wyZPTePi99K7MkfcV85Q9MCPS R/joqIYuVgVxV3UnLgAQu6zEGpI+ctWEnd5K7AxJyqgIgqC9qrYPyVLsbkq2hvF7Skms /+nQJ4IJuDrgE++APcMWl6hJQ22Tu+Tt7BwVP8l7xRoHp0IgGOMQc7OQDg4CmK8kmOYK 2gwIbi1PZB4ynwzGwclljg1U0ySWnnho9P/aa0EETi3nOjhGkyfNFSl+ldAxqUGXfQim uBPA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=cirrus.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q1si12772131pgh.396.2019.04.04.09.36.18; Thu, 04 Apr 2019 09:36:34 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=cirrus.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729474AbfDDQeD (ORCPT + 99 others); Thu, 4 Apr 2019 12:34:03 -0400 Received: from mx0a-001ae601.pphosted.com ([67.231.149.25]:50856 "EHLO mx0b-001ae601.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727339AbfDDQeC (ORCPT ); Thu, 4 Apr 2019 12:34:02 -0400 Received: from pps.filterd (m0077473.ppops.net [127.0.0.1]) by mx0a-001ae601.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x34GTFQA001940; Thu, 4 Apr 2019 11:33:58 -0500 Authentication-Results: ppops.net; spf=none smtp.mailfrom=ckeepax@opensource.cirrus.com Received: from mail4.cirrus.com ([87.246.98.35]) by mx0a-001ae601.pphosted.com with ESMTP id 2rm59s5btu-1; Thu, 04 Apr 2019 11:33:57 -0500 Received: from EX17.ad.cirrus.com (unknown [172.20.9.81]) by mail4.cirrus.com (Postfix) with ESMTP id 77FD0611C8BD; Thu, 4 Apr 2019 11:35:15 -0500 (CDT) Received: from ediswmail.ad.cirrus.com (198.61.86.93) by EX17.ad.cirrus.com (172.20.9.81) with Microsoft SMTP Server id 14.3.408.0; Thu, 4 Apr 2019 17:33:56 +0100 Received: from algalon.ad.cirrus.com (algalon.ad.cirrus.com [198.90.251.122]) by ediswmail.ad.cirrus.com (Postfix) with ESMTP id A1F5C2DB; Thu, 4 Apr 2019 17:33:56 +0100 (BST) From: Charles Keepax To: , CC: , Subject: [PATCH] extcon: arizona: Disable mic detect if running when driver is removed Date: Thu, 4 Apr 2019 17:33:56 +0100 Message-ID: <20190404163356.17773-1-ckeepax@opensource.cirrus.com> X-Mailer: git-send-email 2.11.0 MIME-Version: 1.0 Content-Type: text/plain X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1011 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=949 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1904040105 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Microphone detection provides the button detection features on the Arizona CODECs as such it will be running if the jack is currently inserted. If the driver is unbound whilst the jack is still inserted this will cause warnings from the regulator framework as the MICVDD regulator is put but was never disabled. Correct this by disabling microphone detection on driver removal and if the microphone detection was running disable the regulator and put the runtime reference that was currently held. Signed-off-by: Charles Keepax --- drivers/extcon/extcon-arizona.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/extcon/extcon-arizona.c b/drivers/extcon/extcon-arizona.c index da0e9bc4262fa..9327479c719c2 100644 --- a/drivers/extcon/extcon-arizona.c +++ b/drivers/extcon/extcon-arizona.c @@ -1726,6 +1726,16 @@ static int arizona_extcon_remove(struct platform_device *pdev) struct arizona_extcon_info *info = platform_get_drvdata(pdev); struct arizona *arizona = info->arizona; int jack_irq_rise, jack_irq_fall; + bool change; + + regmap_update_bits_check(arizona->regmap, ARIZONA_MIC_DETECT_1, + ARIZONA_MICD_ENA, 0, + &change); + + if (change) { + regulator_disable(info->micvdd); + pm_runtime_put(info->dev); + } gpiod_put(info->micd_pol_gpio); -- 2.11.0