Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp5952216ybc; Wed, 27 Nov 2019 12:16:07 -0800 (PST) X-Google-Smtp-Source: APXvYqwPCgruRu/PDBZVuU7Ys2h9ltQZcqRVbouLelJ5TXE6yNCPjLN0fHxyUtsBfWjEigDEIaIc X-Received: by 2002:a50:a7c5:: with SMTP id i63mr33706715edc.79.1574885767598; Wed, 27 Nov 2019 12:16:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574885767; cv=none; d=google.com; s=arc-20160816; b=A8ZlF5O/Z+p054qlu2ZYkLikDrjPOK14Q4+vTIHLslLVz4PkI9uSc8CIWWUeC1BHwx cemXV45K6xdgs8pL43axw+34IlK6spLsjEJ4YNzYTuwn8rYs6luNAYOuOSrzdhr4DsQ0 TCCDkGQThzv/RzeybF8gI02+CPhA44chUzSSAyrFw8T6RjruQW8oM/M4gqNeoV9m2qJr 6WPp/5SfhKjTOlzYfyO4Da2Iv0lmOWJ40SFSvaQoo6hKUD7oVNm9pips6oUZLnEQagsH BszCRKrTgcESeFsCqtnEbQWpRxtgd8lOtwGqEyIwQfIzgFD2ZNzMF0c9zLtzOP/2lGdW 9SVQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=JkBh9nZ4d1Mjj7D298qnbqHDDohOhtH9Rt6HWk+4d2k=; b=L3l9AWSGFBUy+t251HykUz1b5xxtwEDmT/S0XYlCJ0FnOAcMhhdqa7h/v+1Q6X4sBZ 5Q3n1mWn4Fm2bvxOOb7n10CJktfBdWdAxXCgap/CSI6Wo47uwcyAEu6bdV3I7ZOnlIq3 950OZmPoyNKwfooK0yeIlSdThMRhuL0oxtwhbsQK5h8RML2AhovmRbT1lahL/8GTJVKB kbKHn74jtZcrJ7eIwScDntWwAnnHn9Z0ai1m5I8VEpMR9rIHJQIXyl4r/mr5zE2WzBXO pT1boX6XibsuLBsQk1vCIN24PI9Al7GNeTXqGWtRb1erwSpjEIk1is5rzzWBFDU/V6d3 fpKQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=enZ5Rj6U; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s13si3353642ejd.39.2019.11.27.12.15.42; Wed, 27 Nov 2019 12:16:07 -0800 (PST) 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=@gmail.com header.s=20161025 header.b=enZ5Rj6U; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727286AbfK0Tov (ORCPT + 99 others); Wed, 27 Nov 2019 14:44:51 -0500 Received: from mail-io1-f65.google.com ([209.85.166.65]:38886 "EHLO mail-io1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726593AbfK0Tou (ORCPT ); Wed, 27 Nov 2019 14:44:50 -0500 Received: by mail-io1-f65.google.com with SMTP id u24so24478919iob.5; Wed, 27 Nov 2019 11:44:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=JkBh9nZ4d1Mjj7D298qnbqHDDohOhtH9Rt6HWk+4d2k=; b=enZ5Rj6U22Yrwy6nCsHHAVUtmWP2EhQStJL8ungoozR2CsEPcLMiwvAkfoBNbg//M0 mbG/S0zeNVmsWfQBJLz99X5LvVLrkY+ao4Klf/Y3mQn5Ik/Aj/IFoyXAamSxYR+FIKe/ 0Zl9VCDuoRSEqdGTV9A67DgYR7ltQ9rRPkQ11lg0+UDodVuRi8vH4NxNxnpTxIN0fm2B sok/dkOsRHBtamcEf9oYXqeTvz227dkonyTexdOGBjulPKjp0uq1kGcwukcUa0mgtxTZ GrOLRiKb39w0dqjUdO/0jPcwSYn1Gy0XAYdKgjVNl/zeVaVhvwBIk6llsOC9pVpw9SiD 77qA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=JkBh9nZ4d1Mjj7D298qnbqHDDohOhtH9Rt6HWk+4d2k=; b=L1qubfGCNXFv7SDTtREXCskzENip/ZUu0M7NHeZIJxsJwF8cCYhKXFLjVaWpTfUdSW y6N1U5nINZVyxQc619yIqCgu2ARqZQ2molIIYFb//6yDJGcEG7bZUlKXopdGyV4SiFeP OGptoLOY2gXYFxiks6prbDg6vaOx294oEfn70OmQbMd/rPa+YoFlHCtZg8Ljz9FaM8V2 QP9g433ER1cFG+dFkahK1OU6+raa5vLwYutIF5JZn6Cmu3KdAdazLJ7c/69XpVNM2Wvq y9WTTL40GH3FfCdaawDI1NNbbxn2ZjceVUpjgCG1BVitBdUXpb0P13bus9DDuhuH+LX2 QRfQ== X-Gm-Message-State: APjAAAX67gXcc9kDp3MqIcCOH9tn87BTKXhYF8ATEdqelgDy5kHr1YaL OOuPjFywHgubLG2fr9rv3h8wnT2Fj91Y12JoqlY= X-Received: by 2002:a02:3f60:: with SMTP id c32mr6155122jaf.30.1574883889954; Wed, 27 Nov 2019 11:44:49 -0800 (PST) MIME-Version: 1.0 References: <20191127052935.1719897-1-anarsoul@gmail.com> <20191127052935.1719897-2-anarsoul@gmail.com> <20191127111419.z5hfu5soxceiivg6@core.my.home> <20191127173547.ch3pcv3lxgdcrfnu@gilmour.lan> In-Reply-To: <20191127173547.ch3pcv3lxgdcrfnu@gilmour.lan> From: Frank Lee Date: Thu, 28 Nov 2019 03:44:38 +0800 Message-ID: Subject: Re: [PATCH v6 1/7] thermal: sun8i: add thermal driver for H6/H5/H3/A64/A83T/R40 To: Maxime Ripard Cc: Vasily Khoruzhick , Zhang Rui , Eduardo Valentin , Daniel Lezcano , Amit Kucheria , Rob Herring , Mark Rutland , Chen-Yu Tsai , Mauro Carvalho Chehab , "David S. Miller" , Greg Kroah-Hartman , Linux PM , devicetree , Linux ARM , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello Vasily, Thank you very much for your work on this. This looks good to me. By the way, I would like to ask comments about adding the following code. diff --git a/drivers/thermal/sun8i_thermal.c b/drivers/thermal/sun8i_thermal.c index c0ed60782b11..579dde5e0701 100644 --- a/drivers/thermal/sun8i_thermal.c +++ b/drivers/thermal/sun8i_thermal.c @@ -629,11 +629,63 @@ static const struct of_device_id of_ths_match[] = { }; MODULE_DEVICE_TABLE(of, of_ths_match); +static int __maybe_unused sun8i_thermal_suspend(struct device *dev) +{ + struct ths_device *tmdev; = dev_get_drvdata(dev); + + clk_disable(tmdev->mod_clk); + clk_disable(tmdev->bus_clk); + + reset_control_assert(tmdev->reset); + + return 0; +} + +static int __maybe_unused sun8i_thermal_resume(struct device *dev) +{ + struct ths_device *tmdev; = dev_get_drvdata(dev); + int error; + + error = reset_control_deassert(tmdev->reset); + if (error) + return error; + + error = clk_enable(tmdev->bus_clk); + if (error) + goto assert_reset; + + clk_set_rate(tmdev->mod_clk, 24000000); + error = clk_enable(tmdev->mod_clk); + if (error) + goto bus_disable; + + sun8i_ths_calibrate(tmdev); + + ret = tmdev->chip->init(tmdev); + if (ret) + goto mod_disable; + + return 0; + +mod_disable: + clk_disable(tmdev->mod_clk); +bus_disable: + clk_disable(tmdev->bus_clk); +assert_reset: + reset_control_assert(tmdev->reset); + + return 0; +} + +static SIMPLE_DEV_PM_OPS(sun8i_thermal_pm_ops, + sun8i_thermal_suspend, sun8i_thermal_resume); + static struct platform_driver ths_driver = { .probe = sun8i_ths_probe, .remove = sun8i_ths_remove, .driver = { .name = "sun8i-thermal", + .pm = &sun8i_thermal_pm_ops, .of_match_table = of_ths_match, }, }; Yangtao