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=-3.6 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=no 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 14642C43215 for ; Wed, 27 Nov 2019 19:49:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D61E02084D for ; Wed, 27 Nov 2019 19:49:01 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="UHQm3Z4s" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727232AbfK0TtA (ORCPT ); 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-Google-Smtp-Source: APXvYqyED1U8iGKLv5Q8myGQWskAymaEmPDOweek/ULUMOk2izeVMnMgtOcUrHFsfo71UXovu5AJlOMgACDpkBnTwd4= 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 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=-3.5 required=3.0 tests=DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED autolearn=no 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 A7742C432C0 for ; Wed, 27 Nov 2019 19:49:03 +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 7E954205ED for ; Wed, 27 Nov 2019 19:49:03 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="coPHaZKM"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="UHQm3Z4s" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7E954205ED Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com 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:To:Subject:Message-ID:Date:From: In-Reply-To:References:MIME-Version:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=WsG62n5cRstS3f0cVxp7+SVF28TBjy1qjF9iAE6uCDM=; b=coPHaZKMu0zVtV KjZBREOU9q+SBQWauMZqSnR+X53vTl8GTdqqKVJn8TdWoeJrCQj0qxkPomcRRKdj3NNw5mcU+JDte qmWjd/G1cV1SHagJXPsGDVhuKYpH5dzsSBVhf1RcbrGCpV0nPEvO0Bue6MKQgUGzNZ2gybKQ4fuJS 4egtGrUv6jrYETmSRpxLp5Dg9LgDCm7RNfqxz23kEPgJxOi7sqA2cQKzyq09Ar09nwglVMz6eOb3e eKIeDw8E9beK74xp3vk4twtTFIfHB6GjYLOQN5YR3y4uGnZOK/jZI+2W6TrvZVGzbGXYL1v8m6JY3 6EHXjwtPlSc06T0f61NA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1ia3J9-0002v5-05; Wed, 27 Nov 2019 19:49:03 +0000 Received: from mail-oi1-x244.google.com ([2607:f8b0:4864:20::244]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1ia3J5-0002uU-4M for linux-arm-kernel@lists.infradead.org; Wed, 27 Nov 2019 19:49:00 +0000 Received: by mail-oi1-x244.google.com with SMTP id n14so21135553oie.13 for ; 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=XysGL3Kno0ttfmmYtX68nPonnuQ+wJGh5ueAa+D4j0Lbc3VAnTYhLOv3yq7pXYA1qq 7IWxR1Cf5ie+3yoR3NecqVji8054lOCf0P3hEkiGdMFFNTI1siddn/MaCt798Opxx6QT cEQX5vBZpAQck/RHcBU+rAynOHXgpaBKT1M494bbkIEAkgKFK0Nd4NiUfAlXqPPaPwns umJslcDdryfYa7uQ0RIir8HyXVSp+mHd5+2NHKJrr5BneGQoJxRyRcLIFgcDfLYgvTsa nZKaoplr0fIezmaYSHDytjUugdt3SJfM1gn8wA7e2xpXnnboUvQPnOhEu4jM2bXgq3sc 6sYA== X-Gm-Message-State: APjAAAWDIR5AzP6Gld1zum60+N8psP8N9ZTE5Vvsr8v0lxXkM6bxp7t7 2i5iwarouKc7UfO45Qh9QV2I0DbKpormTKkGw6g= X-Google-Smtp-Source: APXvYqyED1U8iGKLv5Q8myGQWskAymaEmPDOweek/ULUMOk2izeVMnMgtOcUrHFsfo71UXovu5AJlOMgACDpkBnTwd4= 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20191127_114859_175546_FE8DBADB X-CRM114-Status: GOOD ( 18.66 ) 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 , devicetree , Amit Kucheria , Linux PM , Greg Kroah-Hartman , Daniel Lezcano , Linux Kernel Mailing List , Maxime Ripard , Eduardo Valentin , Chen-Yu Tsai , Rob Herring , Mauro Carvalho Chehab , Zhang Rui , "David S. Miller" , Linux ARM Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.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 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel