Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp1251429pxa; Thu, 20 Aug 2020 06:48:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw9fTdthjAVYnV29qKJVwswS4aT1vVt5ICTicvHbxsvg0CCvyNnFhO9H3/7Q7UsuV/6D1AO X-Received: by 2002:a17:907:4303:: with SMTP id nh3mr3435374ejb.520.1597931297041; Thu, 20 Aug 2020 06:48:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597931297; cv=none; d=google.com; s=arc-20160816; b=xDMefU4LKUPqcyT5XV9trWfxmRMiTCvMzpOXQntzKZ63YUGmVfSgyN/GC0qca0B86o 95RMU6fUEihMgTN2qSYqB39OfQ4wz6XGq/A5ko1bwom0boH297paFfSB5Wr1VSEsLG8Y brzkBexxkiWmyQ61LQCs05QXCKydynbBPHMgxJLGYd8PACKA06yv10L4l4xDkk++jNLL XWCn3YZo9OsX4CNOE1ETBIIPtsc9+iPbQISgVJhixTfhmfGiW3A2EUU2klLDLZ/8w0o/ ocyaqq6wKpZBEPNfApLzbaWykaePjOg4VRXOQsvUVLNtmQ/aa/hDAMXmLeQAvSdmx4ym GC6g== 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=+Ka7cAZ+t7SNHdWAMQeMisG4uEzPfkoGJxziCTTilWM=; b=SVEqCaLiob5wUSBdXYx0aVsP5tO/2ZGgsjL3unxAa7cfUm+TnsqZPV5et3z3H6y+mm pzwi0Ier+NdtUzAL8ZWWV1QvcNLh1n520d/AtSkEtaETg3iLt9wn34Pqsh92jSGZnDVq opPjgYvcSqehLPZnss5ijC29iZ9KFO6/bneBVgjrpJAqqWK2mFzjnHcduii2637UI0Pq ysQeor6nEjX2ncxaa/f7nYGcJHBwhQY3JD4/F7fgqr8xSZmOV6WVbhnIREd1glGrN/ec qQEXD0E0NCfkmMNTkVbgJwMu3/ssldwPw3pYT8RfZrNJ43Y3ZcP+PhqDDIGIoi600vYG z36A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="atxz/zOU"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g17si1972154edj.109.2020.08.20.06.47.53; Thu, 20 Aug 2020 06:48:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="atxz/zOU"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730295AbgHTNor (ORCPT + 99 others); Thu, 20 Aug 2020 09:44:47 -0400 Received: from mail.kernel.org ([198.145.29.99]:39106 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727827AbgHTJ2x (ORCPT ); Thu, 20 Aug 2020 05:28:53 -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 D6F5E22D02; Thu, 20 Aug 2020 09:28:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597915733; bh=wMyosxFfoVepV2dxnPgQaTW3rLcoownAeqijonss+Ug=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=atxz/zOUVfhhHE29hBlO732lqVkDFp75NMIJ1Is1I3xPysFbvLksOOQb476Y6TAM6 K9FPMZm5Q/UiOi+DI0jqH6ReVIdqO6UK2hSk7HzTuOTd957fS2HWjOcveIT8LHA+cd 3g1A6TvmqxpgUKAvHE/HhC6nUsD7dG+hXRSOChS0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Charles Keepax , Lee Jones , Sasha Levin Subject: [PATCH 5.8 115/232] mfd: arizona: Ensure 32k clock is put on driver unbind and error Date: Thu, 20 Aug 2020 11:19:26 +0200 Message-Id: <20200820091618.379522695@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200820091612.692383444@linuxfoundation.org> References: <20200820091612.692383444@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 From: Charles Keepax [ Upstream commit ddff6c45b21d0437ce0c85f8ac35d7b5480513d7 ] Whilst it doesn't matter if the internal 32k clock register settings are cleaned up on exit, as the part will be turned off losing any settings, hence the driver hasn't historially bothered. The external clock should however be cleaned up, as it could cause clocks to be left on, and will at best generate a warning on unbind. Add clean up on both the probe error path and unbind for the 32k clock. Fixes: cdd8da8cc66b ("mfd: arizona: Add gating of external MCLKn clocks") Signed-off-by: Charles Keepax Signed-off-by: Lee Jones Signed-off-by: Sasha Levin --- drivers/mfd/arizona-core.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/drivers/mfd/arizona-core.c b/drivers/mfd/arizona-core.c index f73cf76d1373d..a5e443110fc3d 100644 --- a/drivers/mfd/arizona-core.c +++ b/drivers/mfd/arizona-core.c @@ -1426,6 +1426,15 @@ int arizona_dev_init(struct arizona *arizona) arizona_irq_exit(arizona); err_pm: pm_runtime_disable(arizona->dev); + + switch (arizona->pdata.clk32k_src) { + case ARIZONA_32KZ_MCLK1: + case ARIZONA_32KZ_MCLK2: + arizona_clk32k_disable(arizona); + break; + default: + break; + } err_reset: arizona_enable_reset(arizona); regulator_disable(arizona->dcvdd); @@ -1448,6 +1457,15 @@ int arizona_dev_exit(struct arizona *arizona) regulator_disable(arizona->dcvdd); regulator_put(arizona->dcvdd); + switch (arizona->pdata.clk32k_src) { + case ARIZONA_32KZ_MCLK1: + case ARIZONA_32KZ_MCLK2: + arizona_clk32k_disable(arizona); + break; + default: + break; + } + mfd_remove_devices(arizona->dev); arizona_free_irq(arizona, ARIZONA_IRQ_UNDERCLOCKED, arizona); arizona_free_irq(arizona, ARIZONA_IRQ_OVERCLOCKED, arizona); -- 2.25.1