From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.3 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BBBEBC433FF for ; Mon, 29 Jul 2019 08:21:15 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 8D71220644 for ; Mon, 29 Jul 2019 08:21:15 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="oSH7ghIA" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8D71220644 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=sigxcpu.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=+SmU3s8bxWHHDZe3RFwd+qXRf/0LefG5j/9fTuGyhL4=; b=oSH7ghIAeDMA2L eujaR5399jI6RXbwwRYXsQoaCbSCfc5y+zVazYG7cyh9d3BLbfkEfleQAyQkbyzR1TurPWJTeQtXz qqwD/w04LCzzdkR18ZUPDRTkkpm4X5/z27vj6hup8n6QmTk8pTrZCQs2SIN4zL4w5kSeKu4Jrj7c2 CBgdTWvMCr7nzr/QtRS7RgKZ78QUWbiKP9EWrbY1bABtjBv1qcjTa8OfGHxoR/npO+M59qH8TaiUp oEbyplKRVL+8QrphnvD/HHAyXw/MQ/g9HwG6YoLjk480KGLcQq1ulltC09+jeqh4gOCtalZgu1xlR gUJNsmjx+NTr9A5fvkgA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hs0u3-00057b-Js; Mon, 29 Jul 2019 08:21:07 +0000 Received: from honk.sigxcpu.org ([24.134.29.49]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hs0u0-000576-A1 for linux-arm-kernel@lists.infradead.org; Mon, 29 Jul 2019 08:21:06 +0000 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 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-Disposition: inline In-Reply-To: <20190705045612.27665-4-Anson.Huang@nxp.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190729_012104_672948_D439CCA5 X-CRM114-Status: GOOD ( 18.08 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: mark.rutland@arm.com, ccaione@baylibre.com, mturquette@baylibre.com, angus@akkea.ca, leonard.crestez@nxp.com, festevam@gmail.com, linux-clk@vger.kernel.org, abel.vesa@nxp.com, andrew.smirnov@gmail.com, daniel.lezcano@linaro.org, Linux-imx@nxp.com, rui.zhang@intel.com, devicetree@vger.kernel.org, linux-pm@vger.kernel.org, s.hauer@pengutronix.de, edubezval@gmail.com, robh+dt@kernel.org, linux-arm-kernel@lists.infradead.org, sboyd@kernel.org, linux-kernel@vger.kernel.org, kernel@pengutronix.de, shawnguo@kernel.org, l.stach@pengutronix.de Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.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_ther= mal.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 *p= dev) > return PTR_ERR(data->regs); > } > = > + data->clk =3D devm_clk_get(&pdev->dev, NULL); > + if (IS_ERR(data->clk)) { > + if (PTR_ERR(data->clk) =3D=3D -EPROBE_DEFER) > + return -EPROBE_DEFER; > + data->clk =3D NULL; > + } Wouldn't devm_clk_get_optional make more sense? > + > + ret =3D 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 =3D qoriq_tmu_calibration(pdev); /* TMU calibration */ > @@ -235,6 +250,8 @@ static int qoriq_tmu_remove(struct platform_device *p= dev) > /* 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 &=3D ~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 =3D dev_get_drvdata(dev); > = > + ret =3D clk_prepare_enable(data->clk); > + if (ret) > + return ret; > + > /* Enable monitoring */ > tmr =3D tmu_read(data, &data->regs->tmr); > tmr |=3D TMR_ME; Apart from that it looks like what Fabio sent and what i tested so Reviewed-by: Guido G=FCnther 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 > = _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel