Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp2426872ybi; Sun, 9 Jun 2019 11:30:14 -0700 (PDT) X-Google-Smtp-Source: APXvYqwoOmSO3dKrYYBuOXyYF131YZMZmorKaOw8+4wKYDDXpMxyoGSep1HPoQ9LyHaXEUxqG32h X-Received: by 2002:a65:42c3:: with SMTP id l3mr12494040pgp.372.1560105014460; Sun, 09 Jun 2019 11:30:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560105014; cv=none; d=google.com; s=arc-20160816; b=V23SD40Ryrtr3rpjFwrqIIHA8fFj4m2r3txA4/12r2DYzX1A57j6k94LU52EcwhRDl UR203uHZ1m76b+Hoxahx8JB2OQztoF/+aDo0coL/OtpkW1ZtWp/qXXDE6TNKANQYPNIK 6ukKC1wKK6lfC8FTnFAT+Sn9F1WOk2VZBS1bgGMdAO2nKy7F2Zwjit2HKUozvduhX+cu UmHlyu908g1rth6BFcO0VrEDbpHdMVjkT0cKMkvTZw7zE9JtBkGOctuXT0KInfUTH/nO CbX8CsSw6eLMZnUAURy/nwgrUrFrmXrvvJrf547yKs5TmncLzTh4885JShNGXNgWH7BL wDuA== 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=ewNfDlnjkaIbSTYNq/X22ljk3I9SQikLqZHaNZzutzA=; b=d1DasChHpVv6mJStyzevq4DFO41k3u2N/tO4uPrXVG0Q0J/flBpPOPkELumL1kYzFj Gu8Cnv3y4NybClCql4rCUKGoGtHd13f6iXbfhixeo0nBCe0G3OdBFbr23yXHf47D6z5F bl2exYEbksgBj7O+B6pjresthUu2QZZW2KG2ecjjbBz73aDDFxuXMK6+CisLQiQcJsvp H+bHoMazoPX2fxghdz8Lqo7Sxb9SKOgKz2tO4PUQAxBie4arwI2AbKc8FluiyOM9EbQz VVC3beywJzFXMdnF/g/YUff+zM8XOkOWHCAv5/BkWgAOR6gMdOh+nMoXN28GqBLSnWpa Xdng== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ujUO1S49; 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 t135si1915141pfc.251.2019.06.09.11.29.58; Sun, 09 Jun 2019 11:30:14 -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=ujUO1S49; 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 S2388598AbfFIRJX (ORCPT + 99 others); Sun, 9 Jun 2019 13:09:23 -0400 Received: from mail.kernel.org ([198.145.29.99]:42720 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388549AbfFIREF (ORCPT ); Sun, 9 Jun 2019 13:04:05 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 D9C14206C3; Sun, 9 Jun 2019 17:04:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1560099845; bh=dtCy8NxLywADGR3g1b1WIkbIHMEPVPieh+HB0Gs1iyI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ujUO1S49uyOhw49FcuIM11aU7ZDgKS57zUlaQl3YSDBPuAvDyS1Kwx3xiR4eBHQqJ 65RV4PN/86/CRNsOY/3OWLthGyMiUDqy3+JBOGoHx9jPubqft49jeRUvH1GyzZopVA weIc/xuSTHFqzLrgqShh1ItPzuSThZs22W0+fTK0= 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.4 142/241] extcon: arizona: Disable mic detect if running when driver is removed Date: Sun, 9 Jun 2019 18:41:24 +0200 Message-Id: <20190609164151.883673434@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190609164147.729157653@linuxfoundation.org> References: <20190609164147.729157653@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 e4890dd4fefd6..38fb212e58ee8 100644 --- a/drivers/extcon/extcon-arizona.c +++ b/drivers/extcon/extcon-arizona.c @@ -1616,6 +1616,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