Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp250579ybi; Wed, 29 May 2019 20:39:19 -0700 (PDT) X-Google-Smtp-Source: APXvYqzH4oVoLOqpNeBXyrQggRO48vjtlineBoEt2okjwinzCz4Yr7PdRsy/x9ZrkC7Yi8Pxeq9d X-Received: by 2002:a17:90a:bb8b:: with SMTP id v11mr1661084pjr.68.1559187559205; Wed, 29 May 2019 20:39:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559187559; cv=none; d=google.com; s=arc-20160816; b=b9jZ4HWDZag2FHDZ0Q/dNVFf0u1Mk2robsMpj9ovVKHmMhBrbUmA1A2NrYftGngjst 8tvAwJRnxaY15IH2j7QvCDwBZNPJsZvX50cGcKHkoBBGz0l2GX+IuYFs8jKe3SoFRMrT GnY6+HzcuZy/5iScaIcriO+F4bsWiaMVeaoohB3GMcNCGNTFQg8C48dzgdr8v35M0DRp FBqDZ4pUDTbBwn33dIAeiiWHVdvbOsB0+wUv08YO1CNhZjbivsRnPatPKhkgYMRrWNSB 1m/1+aTFIzfOy3gwX1e7Iyjh0SD5iR8lCDoI/T5mkWpcR3E/1inDfc7YeOFRS2Rr+aqo PZTQ== 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=7p4FaiU6NXejJdsUHt/rTmMGyUJqlKbzguPDhr45rRQ=; b=VpnXkettZbWZm54uZcPRKli8Uxs/hG7HdoQVub3jQ/vRQH+it7i4ripT+w+qjGPowA wMnZ7AnbP4PbqPxhNzUZ/8b77Hv5hhhX7bSrJHKEJY5Fv8IR6bi600ghFtdmUiFN3o9/ NnRtxZcfHjxUFAzz3anN+SWlktgx0hpMmxLQf+h20VeffpNBw4jaqyJCMET5CQz7yorA zAipYyV00KqzhDyGaJQ7FtgljQuSLfR4paersCabSk9Xuh0eHNNYodiCTArCC4t5XS9v cwpBB7cVNAV9h8oAVFFagIpHDph6v/smvyhN1/7hZ+ycv7yteoEHufsCxeHGkN2CauQ9 8bNg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=zhNaxbB9; 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 i16si2216762pje.6.2019.05.29.20.39.01; Wed, 29 May 2019 20:39:19 -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=zhNaxbB9; 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 S1733095AbfE3DXm (ORCPT + 99 others); Wed, 29 May 2019 23:23:42 -0400 Received: from mail.kernel.org ([198.145.29.99]:47548 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730278AbfE3DRc (ORCPT ); Wed, 29 May 2019 23:17:32 -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 47E682469D; Thu, 30 May 2019 03:17:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1559186251; bh=W6hhyP4Sz0xsqJqXoWMUMQRgHBcyX134EWeoywxxvPQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zhNaxbB9pP/nVyNmA7ZxbjhqUcKgFS/ciAe2cU2Tr7E3apO3MM2SuGZeEv6mGcgMf rILnS13bMizxi7yuvu2CTSpKl1nkcCeHEx3eGBmSJ1yhsNINVi8I4rfyVbIGF/M6Hd 508wuh/nAoj5peOPy51iuY00cWzU3EvcwouUSYSY= 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.19 171/276] extcon: arizona: Disable mic detect if running when driver is removed Date: Wed, 29 May 2019 20:05:29 -0700 Message-Id: <20190530030536.069725414@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190530030523.133519668@linuxfoundation.org> References: <20190530030523.133519668@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 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.20.1