Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp255251ybi; Wed, 29 May 2019 20:45:17 -0700 (PDT) X-Google-Smtp-Source: APXvYqzAwqatuJlRt87xJYktOjNi9ykR6VEhx5xxSmExEiwdjLhOtLh+CN1a4ZVmXI0O9m1I6Gqr X-Received: by 2002:a17:90a:7184:: with SMTP id i4mr1498936pjk.49.1559187917864; Wed, 29 May 2019 20:45:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559187917; cv=none; d=google.com; s=arc-20160816; b=Yf5iANeQ4aV+Knskgwukbz3U1duGnwgNLft0kiRogIVBOhCDCe4Kcg+kJlCq0k6SJK 1tRWlN5q5q2UseYqH4fOccswLYsTxDx3NNIH3VTimgrzGI9oiiODKzX+XNzyBom0ncl0 xHbdrQfrIVHG4eRE6vdG3RH2ntLAOR6YeeCWeyt8ty1rpSM9mfkEh9JczuUpcEH2fkj4 Uw+Tj++HyuCJ3QfeeP8ovqYHVHYAG1DTbNcHNmgIahhuBkTt2G8lu7cgTo8kN5jbFT21 qUC3SVcJ6lvF4k4pBLLNrqoePohdWUnpBJfsJR54CHZlUD0vHRKMvxrAexu0v9N+sEEC mUtg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=SFTovYVegSvguiEKpffHzOiNFJhzvtT/QRoWcY5NFUY=; b=DqmlFGPuPJWJZFx6taFRAPj0HLs/7h9tcP34YbqdTvL5C7t2QtC4vCBXHJVeK/SxTq sZVOkkA6+F8PGGGatsD4J9kPHDG6iW6w28gCPhHnC0QijH4trG7xBDYGd5F5+ODPclp8 UO0oL2VCcDl2XKoaAB8kzYStgm6ezwXmzDgQ+X3KTaUW/YW+SW7tMaTCnlLgr71+fJYo 06WTjJ8LTNtFNkC+iKeEk5nzlrg1ASedBLiom6y09RJFXdqEs7Rf+j+FVpWqQUC1HRxt V2trsWBQtYYtrXZhe96AOuARjAcjGefNc5n6rkVrWrHmgz7Jh/GJ8ONhG42W0clhi3M4 y8JQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=EJ88WhOF; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m6si1986495pgq.275.2019.05.29.20.45.01; Wed, 29 May 2019 20:45:17 -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; dkim=pass header.i=@kernel.org header.s=default header.b=EJ88WhOF; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732701AbfE3Dmk (ORCPT + 99 others); Wed, 29 May 2019 23:42:40 -0400 Received: from mail.kernel.org ([198.145.29.99]:60994 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732451AbfE3DVH (ORCPT ); Wed, 29 May 2019 23:21:07 -0400 Received: from localhost (ip67-88-213-2.z213-88-67.customer.algx.net [67.88.213.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 5438C24987; Thu, 30 May 2019 03:21:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1559186466; bh=nI1hJSSzPMF0V+a9RjsHDvr2N4Iii0c5mwQkd5roz+k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EJ88WhOF4zZTRpaaMpGywPjLGxvWyd3bYRpHZ4rBRh4b63qbOMLpHkkKqOFKKMGd/ nAW2gzF8+dIYHirZnWMsq6qpdx/ymmpZbXtjm4xB2emMiSMR3bZu7MJsC5QcMRga9g /gKpTLIFBGSW2yqtoDgjwkTmm+qenhSNAy5OCCPg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Charles Keepax , Chanwoo Choi , Sasha Levin Subject: [PATCH 4.9 083/128] extcon: arizona: Disable mic detect if running when driver is removed Date: Wed, 29 May 2019 20:06:55 -0700 Message-Id: <20190530030449.707847284@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190530030432.977908967@linuxfoundation.org> References: <20190530030432.977908967@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [ Upstream commit 00053de52231117ddc154042549f2256183ffb86 ] 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 Signed-off-by: Chanwoo Choi Signed-off-by: Sasha Levin --- 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 56e6c4c7c60d2..4c0b6df8b5ddb 100644 --- a/drivers/extcon/extcon-arizona.c +++ b/drivers/extcon/extcon-arizona.c @@ -1684,6 +1684,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.20.1