Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp5928660ybc; Wed, 27 Nov 2019 11:50:56 -0800 (PST) X-Google-Smtp-Source: APXvYqz7hoXlaeAVXvChThhF2fMWnYaW8PZ1wNOhJMZaZxZhUncY8q/VFilyxjcsMwZOpXJ3QDTt X-Received: by 2002:a17:906:3490:: with SMTP id g16mr52111135ejb.189.1574884256880; Wed, 27 Nov 2019 11:50:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574884256; cv=none; d=google.com; s=arc-20160816; b=sJF4vLBOgyhQ7I+sJInlkOC7R6i7Zav/DQqA1ojG+uBGFU33kDssSK4JY2jMqSU7Sc ssGZJgwkahryKTh+DgToBJG2tAr863BsvZZaHjdyGNPRLIFjFvq//pESsf85DSWJn5ex N9vJMC3GMFiPEWHCPrGQxs1xT4a0OK/RZUOMi4FCQBxuSLW9mwokKC2l+eLOMQY4C1vp CRTWjsHi6O2nEWEnXxJcDbWNtOBEWR1xW9p51H1hP/flSUw50ApJCP9Go73mQ0y3rVXm kJrgdkNflcIN0HLA847RF5vHxkRvu6CRhjBGlA4vZ2jMqTpTMmut/9EAag6iyhYK7McU 0krA== 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=hJQOsjHUQwGyDgldLtvmDQQC956sPZlhFuJn6q/Fye4=; b=mYz+Ac1wH1FtdE5ioGP6j8eFy9sR7OGkWcfA9TPKdbVgiw7V9rsq2Pr8oBTn05JPYS XvoXazlZCsvGf1JiZUJRoxARH27AAqEf/fjz45J1KnQPettUYK8WcGU5OonhHCJY/Nqc CfCkuCogGV6+TB3cTa+PS55rCSnGipWX9DQjIbjme5HHblyFfziqJGs6PTArmhh0g8xC FVMxngm7F1gxE1fAH3aMTf6u0oRI5cKpCofQ17qNfA6mR/SeHUh5cfG3Mi+kTTo9vaC4 NZqyK1TEeudxpexTN77GjrxRHKHWdA8eKgAi/05WWSHWaQD750gWybqZrnFr4OYnmb3U 4XtA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=UHQm3Z4s; 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 h13si1030747ejb.253.2019.11.27.11.50.32; Wed, 27 Nov 2019 11:50:56 -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=UHQm3Z4s; 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 S1727198AbfK0TtA (ORCPT + 99 others); Wed, 27 Nov 2019 14:49:00 -0500 Received: from mail-oi1-f196.google.com ([209.85.167.196]:34237 "EHLO mail-oi1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727126AbfK0Ts7 (ORCPT ); Wed, 27 Nov 2019 14:48:59 -0500 Received: by mail-oi1-f196.google.com with SMTP id l136so5577367oig.1; Wed, 27 Nov 2019 11:48:58 -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=hJQOsjHUQwGyDgldLtvmDQQC956sPZlhFuJn6q/Fye4=; b=UHQm3Z4sQErDpbdcFsI5LZbvUBE5BhMXUdsIzb7O41xb6Fspwq2A1/BPVDQTjXSLdr ikEI2AYLU+Ctu05Qf5u6bYWG5Lv63zshN411Mdsn1W+4fPFdDgMahME+EZCOJoU1CwJE 35v5Ycykph2Hq7xeEUKlTOBl/6E7kGL1nu5zSgrq7Xb8TN+sHbdlAw19oDeYA+AjLBgT uqu17Y9ld56yXwu9aHlpdmiTJDgzKXhhd9fayPZmR2GSNicg68x2CeUBNU6BukSF4B2/ Uwsg1kCy2nPtULkc6eJeqq+y+2aHS3iyXlg2wQC2DR7fcJBxqjd2FJ5aYi/hj+VnLm4B SzVQ== 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=hJQOsjHUQwGyDgldLtvmDQQC956sPZlhFuJn6q/Fye4=; b=QaHD+RerXlEbPYM4n6A8VwJ9OZVVK/RhJt+DqGmML2sko89/4xWurfwlDEMT2oUFE3 xYc5fX8hGfsP4IVIShKsvHQuj6sE+2Ox8nAu1Ap8GW744nGnEv6nz6uANZYBy+0piLDU +dDpy29jjPaSXHOFrAJ08PpRiggBdUpmHnhOOvqTu0aAiM/iasroqgL1memOTLt6h8fV Kb1n6aMcR4d37sVe7ylkNSim1hOI9fRrZbquZGYKOYtLnpbzLI9+V0T0i9v45iwn4ETF gdPdWtugEKZvtOT16dxlWrnfXXNTteIyY7y9xePEZLCVnGf9VKpIblOMZBmOnhwc78Cx 5K2Q== X-Gm-Message-State: APjAAAX+HR+/5qD/3xjvBwuQOSXccxsSz8xuDOAW2a6x5jXdd2WIR1qk rXBlG6wDRkXH63z/o19SBtEe0aLVMrw3xOmluwg= X-Received: by 2002:aca:5e03:: with SMTP id s3mr5733588oib.88.1574884137631; Wed, 27 Nov 2019 11:48:57 -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: From: Vasily Khoruzhick Date: Wed, 27 Nov 2019 11:48:32 -0800 Message-ID: Subject: Re: [PATCH v6 1/7] thermal: sun8i: add thermal driver for H6/H5/H3/A64/A83T/R40 To: Frank Lee Cc: Maxime Ripard , 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 On Wed, Nov 27, 2019 at 11:44 AM Frank Lee wrote: > > Hello Vasily, > > Thank you very much for your work on this. > This looks good to me. Thanks! > By the way, I would like to ask comments about adding the following code. Can we add it as follow up patch? I don't think that I have a device with working suspend to test it and I'm hesitant to add any code that I can't test. > > 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