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=-11.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, MENTIONS_GIT_HOSTING,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS autolearn=unavailable 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 29640C31E40 for ; Mon, 12 Aug 2019 23:46:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E688720842 for ; Mon, 12 Aug 2019 23:46:56 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="fvfn+YRW" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726931AbfHLXqw (ORCPT ); Mon, 12 Aug 2019 19:46:52 -0400 Received: from mail-ot1-f68.google.com ([209.85.210.68]:40604 "EHLO mail-ot1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726296AbfHLXqw (ORCPT ); Mon, 12 Aug 2019 19:46:52 -0400 Received: by mail-ot1-f68.google.com with SMTP id c34so25720547otb.7; Mon, 12 Aug 2019 16:46:50 -0700 (PDT) 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=vEM0WhT9KiGV+XzQ8g0ACsk29KSJO4/VurYJJqZPp1s=; b=fvfn+YRWH317swlTo7hCPy+eX8eEw/abKK+fMBhLIYnM8OjH86td55IXA8ix7SQbF5 hvvGOEUBAhdjtfcpEf5pmVFoa1NtP4COg618jqD+zN1L0pDB8VjjcEuJwCc0iSLIe2Cb n+FuhOTWDugB5dRMhur5Ns2NX+syHET6SxeYowRsUaNElv6kVkop6c4o1W7Du4D6mB5q uTUoLELtMZ3fekQJuPNtEqr8mnsCtuRokYSI2NqZMAPtFUYYEeSJoOk5d6uw+JbnxC2x ZmvjPf7ES3PzdZNwPVG8iEIcjbDilYpXVVn3lnf9g2Q9tYKgi0KmhSA9ghx99su/HHsj Meuw== 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=vEM0WhT9KiGV+XzQ8g0ACsk29KSJO4/VurYJJqZPp1s=; b=Fsv/mi2/t3HNjIakCOW70wvA+hFd6NHabA6tr7jY+ZEYXaxXu9Gyav2904Qe7qUMSC WzqRpDr+fwUzdrr8+4rRw5nHT4zEu5DfA5un5OS1xmRyuz1KYOpBlsvApnLZ5SrkWoYo t3LQ/a7nE6FIZAuS/niDmwAFwQHdd8tPf2YSVKTjS671kPFqp1z2uqxUK3kaf+KZoqu3 LC6LORIcIMr4YR86DCymsa3mMECg4Eyf+JKprKV4mrgNuhfA0y378X9GhQEzsAvU0lJm Khu+rxLnQ/5u0Q7CeV/FOpMWorQjHml2JzSak4DKSeZKqW0kBTQ27GI8l2D0gspJgVsN w8KA== X-Gm-Message-State: APjAAAXk2T+2syyY9JvyahPohvkAXw1vdYZaCmB+Cwz1f2y6sRiHccTa vMHzdDDxH8ytyyikpvabX9WcImHMydC/Xzn7kro= X-Google-Smtp-Source: APXvYqxgnXw3/hTVBwv8iDNhwE1yPX+hGlamB9R+ygkZWpAtXLSQV6s2CpUv+ICng0kTSrIM+MBId9mZ5Wuia3348wE= X-Received: by 2002:a6b:f002:: with SMTP id w2mr257922ioc.104.1565653610461; Mon, 12 Aug 2019 16:46:50 -0700 (PDT) MIME-Version: 1.0 References: <20190810052829.6032-1-tiny.windzz@gmail.com> <20190810052829.6032-9-tiny.windzz@gmail.com> In-Reply-To: From: Frank Lee Date: Tue, 13 Aug 2019 07:46:39 +0800 Message-ID: Subject: Re: [PATCH v5 08/18] thermal: sun8i: support mod clocks To: Vasily Khoruzhick Cc: rui.zhang@intel.com, Eduardo Valentin , Daniel Lezcano , Rob Herring , Mark Rutland , Maxime Ripard , Chen-Yu Tsai , Mauro Carvalho Chehab , "David S. Miller" , Greg Kroah-Hartman , Jonathan.Cameron@huawei.com, Nicolas Ferre , devicetree , linux-kernel , arm-linux , Linux PM Content-Type: text/plain; charset="UTF-8" Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org HI Vasily, On Sat, Aug 10, 2019 at 2:17 PM Vasily Khoruzhick wrote: > > On Fri, Aug 9, 2019 at 10:31 PM Yangtao Li wrote: > > > > H3 has extra clock, so introduce something in ths_thermal_chip/ths_device > > and adds the process of the clock. > > > > This is pre-work for supprt it. > > > > Signed-off-by: Yangtao Li > > --- > > drivers/thermal/sun8i_thermal.c | 17 ++++++++++++++++- > > 1 file changed, 16 insertions(+), 1 deletion(-) > > > > diff --git a/drivers/thermal/sun8i_thermal.c b/drivers/thermal/sun8i_thermal.c > > index b934bc81eba7..6f4294c2aba7 100644 > > --- a/drivers/thermal/sun8i_thermal.c > > +++ b/drivers/thermal/sun8i_thermal.c > > @@ -54,6 +54,7 @@ struct tsensor { > > }; > > > > struct ths_thermal_chip { > > + bool has_mod_clk; > > int sensor_num; > > int offset; > > int scale; > > @@ -69,6 +70,7 @@ struct ths_device { > > struct regmap *regmap; > > struct reset_control *reset; > > struct clk *bus_clk; > > + struct clk *mod_clk; > > struct tsensor sensor[MAX_SENSOR_NUM]; > > }; > > > > @@ -274,6 +276,12 @@ static int sun8i_ths_resource_init(struct ths_device *tmdev) > > if (IS_ERR(tmdev->bus_clk)) > > return PTR_ERR(tmdev->bus_clk); > > > > + if (tmdev->chip->has_mod_clk) { > > + tmdev->mod_clk = devm_clk_get(&pdev->dev, "mod"); > > + if (IS_ERR(tmdev->mod_clk)) > > + return PTR_ERR(tmdev->mod_clk); > > + } > > + > > ret = reset_control_deassert(tmdev->reset); > > if (ret) > > return ret; > > @@ -282,12 +290,18 @@ static int sun8i_ths_resource_init(struct ths_device *tmdev) > > if (ret) > > goto assert_reset; > > > > - ret = sun50i_ths_calibrate(tmdev); > > + ret = clk_prepare_enable(tmdev->mod_clk); > > You have to set rate of modclk before enabling it since you can't rely > on whatever bootloader left for you. > > Also I found that parameters you're using for PC_TEMP_PERIOD, ACQ0 and > ACQ1 are too aggressive and may result in high interrupt rate to the > point when it may stall RCU. I changed driver a bit to use params from > Philipp Rossak's work (modclk set to 4MHz, PC_TEMP_PERIOD is 7, ACQ0 > is 255, ACQ1 is 63) and it fixed RCU stalls for me, see [1] for > details. Why is the RCU stall happening, is it caused by a deadlock? Can you provide log information and your configuration? I am a bit curious. Thx, Yangtao > > [1] https://github.com/anarsoul/linux-2.6/commit/46b8bb0fe2ccd1cd88fa9181a2ecbf79e8d513b2 > > > > if (ret) > > goto bus_disable; > > > > + ret = sun50i_ths_calibrate(tmdev); > > + if (ret) > > + goto mod_disable; > > + > > return 0; > > > > +mod_disable: > > + clk_disable_unprepare(tmdev->mod_clk); > > bus_disable: > > clk_disable_unprepare(tmdev->bus_clk); > > assert_reset: > > @@ -395,6 +409,7 @@ static int sun8i_ths_remove(struct platform_device *pdev) > > { > > struct ths_device *tmdev = platform_get_drvdata(pdev); > > > > + clk_disable_unprepare(tmdev->mod_clk); > > clk_disable_unprepare(tmdev->bus_clk); > > reset_control_assert(tmdev->reset); > > > > -- > > 2.17.1 > > > > > > _______________________________________________ > > linux-arm-kernel mailing list > > linux-arm-kernel@lists.infradead.org > > http://lists.infradead.org/mailman/listinfo/linux-arm-kernel