Received: by 2002:a25:ef43:0:0:0:0:0 with SMTP id w3csp653653ybm; Fri, 29 May 2020 09:00:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzrqTcG88XYAFCOOFIErK2t6lUYtr3cRo/fkf1k1w9oxYW4sydV/5oW2XwbwcV3ZkobduA4 X-Received: by 2002:a05:6402:158b:: with SMTP id c11mr8869924edv.29.1590768028679; Fri, 29 May 2020 09:00:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590768028; cv=none; d=google.com; s=arc-20160816; b=JvXgzdjRnYmcB43euRBkb5MhKAGsV069Lk6nx7KbKFuRGW/DomzbKQvucp0zTpAgbD X4mk+VmYAkvdbNGpNc3zofe/eQKzJehS7DSwflJim9M1V9WtKYvb2YouSbDAnJranL9a KsD4rL0me5mu/6EjWoILOp6xsg1zp+MH3hdOmjX8VNpqtGFyygc8/XJoYDcyNsKfxb/c 3ZHeG4OGyKVF9fk0Kab3qAxVljV4em5+nfGwnNc3d/CU5VdggE0WD1Z2dPW5smgRgCq4 jqan1Harlz5WU4QVbw+tV6t3jqskxIUxN0Q1yHneKtJGyEcx8zY57O1xc5eo9Jo299Sc NRjw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=WfLjNL5bVp+lOGE39Fu4X5+n4lUcunif+j7e/Dk07YM=; b=gji96bpXmmIjzx7gta08hB0g69fbgsQYc9ridwMmX2zBhrdeS+2f6mWQIdsF1nEUWr p05MZyqSFSBdtZ25xElEOFTYmJzL0XTYc1r06iOGfM2eyZWi7eJ4dbRhVjIP1QGqwtdE odajE0RhbMOvirbvOTIH3zo4mwTxd3AzDIlnB4HaOgp2jvKkntF0iM2XtMTER8d+W11c SFpi8GtTX7c6UaA6VO6ALmHyvfw7pEh7cLbxHCOZg7EsOILalThWaaCinxS/KoRYJXr7 RUdlV/ibMVREPiaIVHGHgGCFQmQSrCMsD+w7TWSF5636HBRjvtvAoH2Zj9xSqAa4pdg1 tePw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cirrus.com header.s=PODMain02222019 header.b=FK4cXd8u; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=cirrus.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id qu8si5830793ejb.188.2020.05.29.09.00.04; Fri, 29 May 2020 09:00:28 -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=@cirrus.com header.s=PODMain02222019 header.b=FK4cXd8u; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=cirrus.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727922AbgE2P5x (ORCPT + 99 others); Fri, 29 May 2020 11:57:53 -0400 Received: from mx0b-001ae601.pphosted.com ([67.231.152.168]:39882 "EHLO mx0b-001ae601.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727889AbgE2P5u (ORCPT ); Fri, 29 May 2020 11:57:50 -0400 Received: from pps.filterd (m0077474.ppops.net [127.0.0.1]) by mx0b-001ae601.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 04TFgPUC032457; Fri, 29 May 2020 10:57:46 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cirrus.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=PODMain02222019; bh=WfLjNL5bVp+lOGE39Fu4X5+n4lUcunif+j7e/Dk07YM=; b=FK4cXd8u60YpgsX3pF3oLn3Xl0axqkcR5jeVIeFLdy7J/u8ZwtZngw8zgIfBqUFQ8Val Vfl7lpqEGoTDQKFZFLtZpqI/hynIrg4x1O3QbYVOIbt8Q+mcBNo9jYZbBA5DHyErBEuS CnRa82pdQTKG6gtINNwxFAH6rHRsT0MUPut4FVPM+Inaj8UOnhXcIOJqDRyiGGunShds bmXhBEwNfqOnqOvkEiEZ/5nTtcUjinkHC3KCAUPkwyiQYjcFrOPo+Zkx632Di5Oh+UcB dDu2cpKCmy6Hr/vr6/bvx0tRbyVV5GJTtbqUquVC0H9sfCjNGo1PpsbJ4oktb4o5Mfiv 6w== Authentication-Results: ppops.net; spf=fail smtp.mailfrom=ckeepax@opensource.cirrus.com Received: from ediex02.ad.cirrus.com ([87.246.76.36]) by mx0b-001ae601.pphosted.com with ESMTP id 31708q12u4-3 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT); Fri, 29 May 2020 10:57:46 -0500 Received: from EDIEX01.ad.cirrus.com (198.61.84.80) by EDIEX02.ad.cirrus.com (198.61.84.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1913.5; Fri, 29 May 2020 16:57:43 +0100 Received: from ediswmail.ad.cirrus.com (198.61.86.93) by EDIEX01.ad.cirrus.com (198.61.84.80) with Microsoft SMTP Server id 15.1.1913.5 via Frontend Transport; Fri, 29 May 2020 16:57:43 +0100 Received: from algalon.ad.cirrus.com (algalon.ad.cirrus.com [198.90.251.122]) by ediswmail.ad.cirrus.com (Postfix) with ESMTP id 1A9CF44A; Fri, 29 May 2020 15:57:43 +0000 (UTC) From: Charles Keepax To: CC: , , Subject: [PATCH 3/3] mfd: arizona: Ensure 32k clock is put on driver unbind and error Date: Fri, 29 May 2020 16:57:42 +0100 Message-ID: <20200529155742.18399-3-ckeepax@opensource.cirrus.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20200529155742.18399-1-ckeepax@opensource.cirrus.com> References: <20200529155742.18399-1-ckeepax@opensource.cirrus.com> MIME-Version: 1.0 Content-Type: text/plain X-Proofpoint-SPF-Result: fail X-Proofpoint-SPF-Record: v=spf1 include:spf-001ae601.pphosted.com include:spf.protection.outlook.com ip4:5.172.152.52 -all X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=3 phishscore=0 adultscore=0 bulkscore=0 malwarescore=0 lowpriorityscore=0 clxscore=1015 mlxscore=0 spamscore=0 mlxlogscore=999 cotscore=-2147483648 priorityscore=1501 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2004280000 definitions=main-2005290123 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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 19e0bc3c0683e..000cb82023e35 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.11.0