Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp335564ybl; Mon, 12 Aug 2019 17:29:58 -0700 (PDT) X-Google-Smtp-Source: APXvYqyXGV6yBIRDV4POnYFk8tdIqO+Zd06WJMYlVGckjkVCyguB70gknfbmZ4lkmYzJ6uqlns/d X-Received: by 2002:a62:f204:: with SMTP id m4mr13556056pfh.7.1565656198407; Mon, 12 Aug 2019 17:29:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565656198; cv=none; d=google.com; s=arc-20160816; b=qgmTRhNcdPDgxTfbr9dSrvhHouvQViPV1kyR9DdTi/+om4lgHzSv3EC5TqNfViuROJ 14fZedrnuKENK+uANcLknr/3LuVFI7ti+5Wp0D4aCB/znXfLCXmZfRfH5yn0XJXkG3nh sXxw7N10Y3tyAFQzaB5WcS8GtAWmxYII0BSsrse3KxCzDaplQh2GWn4WaG51wjTiu/wU Y/x4cHzjfjVbkz4IIwTdW5lVIvKf6hWxmxHHqIFJ7ODGLQQL8uJf3y7wYywn56QqD+O/ OP4FzvW9QHtDzxRyx517DHVtLcq7JjsRzY7+UFwMigAPDDX4phHq0ElL3JcIlRJ8HBtD 9NFQ== 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=vEM0WhT9KiGV+XzQ8g0ACsk29KSJO4/VurYJJqZPp1s=; b=pAFzBXJa55O9ivnN8nBmkDiBlBCRTKNyLeGGAM/OM1U9eN7S0dw2xXdNbCNipDY/kR bGIcOSPrzMKR40mAxFsT5zliCf+mBrVfTqu/cOgH0Zw/ztKb59mUHMqWAkq983LH2gzv Tvb62igB8M+6xJtWffaMbgcSkoHwfY1X7NbF2RL72MQ9ZRdtDP/AEggibmvM0OdHhZFJ MMXOmv3UeeaCnhJxgfc8YKbt4WTF5fwz5nxAcZdU22Ao3OA6Ri19oZjO7HWRPg2UZ66D 781qDIqtmP2PTskAOb6z41dogbUG0pkO6601uaVMglA4XzYm+ad2ZCsWNRDv/qWJjZXL yvuw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=fvfn+YRW; 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 a33si64975234pgl.436.2019.08.12.17.29.43; Mon, 12 Aug 2019 17:29:58 -0700 (PDT) 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=fvfn+YRW; 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 S1726949AbfHLXqw (ORCPT + 99 others); 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-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-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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