Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp3128513ybi; Mon, 29 Jul 2019 01:22:32 -0700 (PDT) X-Google-Smtp-Source: APXvYqz85oizXmUF1BIasQX1BYwKOTjjyT9HdlKZc7TArythCTclQ/EblBb7UhUvKmrplxiUJjAX X-Received: by 2002:a17:902:29a7:: with SMTP id h36mr111431513plb.158.1564388552573; Mon, 29 Jul 2019 01:22:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564388552; cv=none; d=google.com; s=arc-20160816; b=I7RIyDubKZwgC/JzyTvY2gHdOqr6ZurXxpkkQzLjc8+w1fbIEJmh2EZhSVbDmxumWm pCHssMOa9h7zZM5W/J0JitOEqUj6/KmaSPJeA2OwMa/SsOdhv/rVFcReEtiO1DC/wWIr VEL7fACRxrPj9lRacoFBEWsmAQFv6SbsZhIzaTJ0DSta2ZPGILGpbnxAeN8ma60PygTD HY1Rv+BEHmR46qfUmj9VbCZ2yjS7AvADTE5bNQmpAtrZEuhWG1hxGaFukbeBHXHojr2B qhlwLSIQdeYAbOdi2NeQ4+G3xL3OxWVZngVjeJAD6lc/NyVZRpIbEPIomX8H8gb3QvmL K9AQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=/GtyA4hTy+Z6CIeFPu8Jc2fuAjyUXlpZXrRlkiyCwTY=; b=eJy+bkmoEtimWd3KVR0THbDXTSVXzdJY3ZBbAXf68VirH71QwCYG+GXsVRf9mQqr/G is5S4canaKyccsh/qBBle/tQynhJ27zVXyTaQngDhjDHr0xhzp6WYWwfr7pKlDZchkvq 0C5LbHD/9k+qgFwCzY93W6Jt0sLIkmHjlmVk3tVI7YJUKpr1nip3R7di4l8pjzSLSEVJ xDy+C9SO5jZl7e4YQb1GDSTeBVOeGwoBqpW9Q1zedyHXokMyzjB22sJ9SrgGt+pFKriW rqBzrLbIFKAPoFHb1OyKJ2EsTAkIAYKZwPhDaI8WZsJhetblSBxtHmemCp7Pw6SRF+bh 2kCw== ARC-Authentication-Results: i=1; mx.google.com; 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 v20si25313261pjn.27.2019.07.29.01.22.16; Mon, 29 Jul 2019 01:22:32 -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; 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 S1726988AbfG2IM0 (ORCPT + 99 others); Mon, 29 Jul 2019 04:12:26 -0400 Received: from honk.sigxcpu.org ([24.134.29.49]:48310 "EHLO honk.sigxcpu.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725988AbfG2IM0 (ORCPT ); Mon, 29 Jul 2019 04:12:26 -0400 Received: from localhost (localhost [127.0.0.1]) by honk.sigxcpu.org (Postfix) with ESMTP id 5FE39FB03; Mon, 29 Jul 2019 10:12:23 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at honk.sigxcpu.org Received: from honk.sigxcpu.org ([127.0.0.1]) by localhost (honk.sigxcpu.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 3avP_g3MYwj1; Mon, 29 Jul 2019 10:12:22 +0200 (CEST) Received: by bogon.sigxcpu.org (Postfix, from userid 1000) id 9C4E846BAF; Mon, 29 Jul 2019 10:12:21 +0200 (CEST) Date: Mon, 29 Jul 2019 10:12:21 +0200 From: Guido =?iso-8859-1?Q?G=FCnther?= To: Anson.Huang@nxp.com Cc: rui.zhang@intel.com, edubezval@gmail.com, daniel.lezcano@linaro.org, robh+dt@kernel.org, mark.rutland@arm.com, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, mturquette@baylibre.com, sboyd@kernel.org, l.stach@pengutronix.de, abel.vesa@nxp.com, andrew.smirnov@gmail.com, angus@akkea.ca, ccaione@baylibre.com, leonard.crestez@nxp.com, linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org, Linux-imx@nxp.com Subject: Re: [PATCH 4/6] thermal: qoriq: Add clock operations Message-ID: <20190729081221.GA2523@bogon.m.sigxcpu.org> References: <20190705045612.27665-1-Anson.Huang@nxp.com> <20190705045612.27665-4-Anson.Huang@nxp.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20190705045612.27665-4-Anson.Huang@nxp.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Anson, On Fri, Jul 05, 2019 at 12:56:10PM +0800, Anson.Huang@nxp.com wrote: > From: Anson Huang > > Some platforms like i.MX8MQ has clock control for this module, > need to add clock operations to make sure the driver is working > properly. > > Signed-off-by: Anson Huang > --- > drivers/thermal/qoriq_thermal.c | 24 ++++++++++++++++++++++++ > 1 file changed, 24 insertions(+) > > diff --git a/drivers/thermal/qoriq_thermal.c b/drivers/thermal/qoriq_thermal.c > index 2b2f79b..0813c1b 100644 > --- a/drivers/thermal/qoriq_thermal.c > +++ b/drivers/thermal/qoriq_thermal.c > @@ -2,6 +2,7 @@ > // > // Copyright 2016 Freescale Semiconductor, Inc. > > +#include > #include > #include > #include > @@ -72,6 +73,7 @@ struct qoriq_sensor { > > struct qoriq_tmu_data { > struct qoriq_tmu_regs __iomem *regs; > + struct clk *clk; > bool little_endian; > struct qoriq_sensor *sensor[SITES_MAX]; > }; > @@ -208,6 +210,19 @@ static int qoriq_tmu_probe(struct platform_device *pdev) > return PTR_ERR(data->regs); > } > > + data->clk = devm_clk_get(&pdev->dev, NULL); > + if (IS_ERR(data->clk)) { > + if (PTR_ERR(data->clk) == -EPROBE_DEFER) > + return -EPROBE_DEFER; > + data->clk = NULL; > + } Wouldn't devm_clk_get_optional make more sense? > + > + ret = clk_prepare_enable(data->clk); > + if (ret) { > + dev_err(&pdev->dev, "Failed to enable clock\n"); > + return ret; > + } > + > qoriq_tmu_init_device(data); /* TMU initialization */ > > ret = qoriq_tmu_calibration(pdev); /* TMU calibration */ > @@ -235,6 +250,8 @@ static int qoriq_tmu_remove(struct platform_device *pdev) > /* Disable monitoring */ > tmu_write(data, TMR_DISABLE, &data->regs->tmr); > > + clk_disable_unprepare(data->clk); > + > platform_set_drvdata(pdev, NULL); > > return 0; > @@ -250,14 +267,21 @@ static int __maybe_unused qoriq_tmu_suspend(struct device *dev) > tmr &= ~TMR_ME; > tmu_write(data, tmr, &data->regs->tmr); > > + clk_disable_unprepare(data->clk); > + > return 0; > } > > static int __maybe_unused qoriq_tmu_resume(struct device *dev) > { > u32 tmr; > + int ret; > struct qoriq_tmu_data *data = dev_get_drvdata(dev); > > + ret = clk_prepare_enable(data->clk); > + if (ret) > + return ret; > + > /* Enable monitoring */ > tmr = tmu_read(data, &data->regs->tmr); > tmr |= TMR_ME; Apart from that it looks like what Fabio sent and what i tested so Reviewed-by: Guido G?nther Cheers, -- Guido > -- > 2.7.4 > > > _______________________________________________ > linux-arm-kernel mailing list > linux-arm-kernel@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-arm-kernel >