Received: by 10.223.185.116 with SMTP id b49csp7193315wrg; Thu, 1 Mar 2018 01:11:02 -0800 (PST) X-Google-Smtp-Source: AG47ELshmtr+f/nM0FfT5Y0BMFSw15em59aZSUjiGBccNaltU+wg2+4+c7R/d7PvNF0sewx3y2F8 X-Received: by 2002:a17:902:b185:: with SMTP id s5-v6mr1264973plr.109.1519895462516; Thu, 01 Mar 2018 01:11:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519895462; cv=none; d=google.com; s=arc-20160816; b=vR9LzVxP7Sz1nMeTsWyq4ri3SeuldkZz0bA6ohFc7s48Oa9QhdKMXAixO961dM6+Yk 4TMrBIVBUMv2Sa+EzLmDBf8DABm1nOCezMp90QYBRmvCsLN3ucrzjadQXWLsLBeQAfdt WomkL30AQCKx/7+l52hDnfLWZaSJ6CbVWwALylYpTHBszestiGO2utT74oyoTjTIHMv5 4nJUaOYolkFLw1rvYoLeO8W52g9ttRjcYh0PNU41sjLs2FEMbJNyfaIsw2OX//ytVPyY 6RJUS2FH69viI26gRLotTUr+Y/gau0FUB+Q07hJ/7g2W+JpPqhaLTia0xfdxvF/Ctxc9 5SHg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:in-reply-to :references:subject:cc:to:mime-version:user-agent:from:date :message-id:arc-authentication-results; bh=E294gLO2yun8ILSkdklhmYlPWxlXNIeEJNGbzb+or7c=; b=I2loI9Z/eoEkxe85Rl6TT0XIJCNE+/aQFMJ5nVPp79hJxs1KVVvjUW2AEBENKfLclK o6tDtDbe26UxDRn0jdVmUc+PrOHfQL0+4GMUWPN/fX005BORU1UPTobe5T4qRR9NtN5c WvxfH+X/5m1ZwZd8c57MEF894pNs0znrdzGtyOr11koHtX7MaC5OfD/Ui2zjf2Gb48h5 13ZoBnSrwDcUFU1RLBr3CfI6I1FDli+k68ad2Bmhs85itQTPsG2VKE2eatzdqwfbaXTS BHErXntyQN4yhhRXjso+SyxLSyiw5qkOZwg+ozbIzyp5H7CDWbBDIa1i+snIXx/vCBeq RJVw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n11si2231279pgu.96.2018.03.01.01.10.48; Thu, 01 Mar 2018 01:11:02 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S966712AbeCAJJw (ORCPT + 99 others); Thu, 1 Mar 2018 04:09:52 -0500 Received: from regular1.263xmail.com ([211.150.99.141]:36483 "EHLO regular1.263xmail.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S966648AbeCAJJq (ORCPT ); Thu, 1 Mar 2018 04:09:46 -0500 Received: from jeffy.chen?rock-chips.com (unknown [192.168.167.163]) by regular1.263xmail.com (Postfix) with ESMTP id DF80CC1; Thu, 1 Mar 2018 17:09:37 +0800 (CST) X-263anti-spam: KSV:0; X-MAIL-GRAY: 0 X-MAIL-DELIVERY: 1 X-KSVirus-check: 0 X-ABS-CHECKED: 4 Received: from [172.16.22.73] (localhost [127.0.0.1]) by smtp.263.net (Postfix) with ESMTPA id 7BA853F4; Thu, 1 Mar 2018 17:09:27 +0800 (CST) X-RL-SENDER: jeffy.chen@rock-chips.com X-FST-TO: geert@linux-m68k.org X-SENDER-IP: 103.29.142.67 X-LOGIN-NAME: jeffy.chen@rock-chips.com X-UNIQUE-TAG: X-ATTACHMENT-NUM: 0 X-SENDER: cjf@rock-chips.com X-DNS-TYPE: 0 Received: from [172.16.22.73] (unknown [103.29.142.67]) by smtp.263.net (Postfix) whith ESMTP id 12348SN7B0E; Thu, 01 Mar 2018 17:09:34 +0800 (CST) Message-ID: <5A97C345.3060205@rock-chips.com> Date: Thu, 01 Mar 2018 17:09:25 +0800 From: JeffyChen User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:19.0) Gecko/20130126 Thunderbird/19.0 MIME-Version: 1.0 To: Geert Uytterhoeven CC: Tomasz Figa , Linux Kernel Mailing List , Dmitry Torokhov , Robin Murphy , Heiko Stuebner , Caesar Wang , Elaine Zhang , "open list:ARM/Rockchip SoC..." , Geert Uytterhoeven , Linux ARM , Ulf Hansson Subject: Re: [PATCH] soc: rockchip: power-domain: remove PM clocks References: <20180228111113.13639-1-jeffy.chen@rock-chips.com> <5A977638.8010506@rock-chips.com> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Geert, Thanks for your reply. On 03/01/2018 04:33 PM, Geert Uytterhoeven wrote: >> >so maybe we can: >> >1/ let the device(dts) or driver decide which clock is PM clk, and add it >> >using*pm_clk_add* APIs (even of_pm_clk_add_clks() if all clocks are pm clk) >> > >> >2/ add support for critical PM clk, which would return error to the driver >> >if anything wrong >> > >> >3/ make sure PM clk always be controlled(otherwise it might be unexpected >> >disabled by other clocks under the same clk parent?): >> > a) make sure Runtime PM is always enabled. and as discussed, we can select >> >PM in ARCH_ROCKCHIP > On Renesas SoCs, we only add the device's module clock with pm_clk_add(). > Drivers that don't care about properties of the module clock just call > pm_runtime_*(). That way the same driver works on different SoCs using > the same device, with and without power and/or clock domains. well, i think we may need to check: 1/ so the driver might not know is the clock really enabled(currently): static void pm_clk_acquire(struct device *dev, struct pm_clock_entry *ce) { if (!ce->clk) ce->clk = clk_get(dev, ce->con_id); if (IS_ERR(ce->clk)) { ce->status = PCE_STATUS_ERROR; static inline void __pm_clk_enable(struct device *dev, struct pm_clock_entry *ce) { int ret; if (ce->status < PCE_STATUS_ERROR) { ret = clk_enable(ce->clk); if (!ret) ce->status = PCE_STATUS_ENABLED; it seems the status is private. 2/ the pm_clk_resume/suspend seems only be called in the domain's suspend/resume ops(or USE_PM_CLK_RUNTIME_OPS, or called directly in the drivers for example tegra-aconnect): # cgrep pm_clk_resume -w ./include/linux/pm_clock.h:50:extern int pm_clk_resume(struct device *dev); ./include/linux/pm_clock.h:83:#define pm_clk_resume NULL ./drivers/bus/tegra-aconnect.c:62: return pm_clk_resume(dev); ./drivers/dma/tegra210-adma.c:649: ret = pm_clk_resume(dev); ./drivers/base/power/clock_ops.c:421: * pm_clk_resume - Enable clocks in a device's PM clock list. ./drivers/base/power/clock_ops.c:424:int pm_clk_resume(struct device *dev) ./drivers/base/power/clock_ops.c:444:EXPORT_SYMBOL_GPL(pm_clk_resume); ./drivers/base/power/clock_ops.c:533: ret = pm_clk_resume(dev); ./drivers/base/power/domain.c:1685: genpd->dev_ops.start = pm_clk_resume; ./drivers/irqchip/irq-gic-pm.c:36: ret = pm_clk_resume(dev); so if the device doesn't have a power domain, the PM clks could be unmanaged right? by the way, the tegra drivers(tegra-aconnect/tegra210-adma) seems like good examples of using current PM clks... but anyway, force adding all clocks as PM clks in the rockchip power domain driver seems wrong... > > Drivers that care about properties of the module clock (mainly frequency) > can still use the clk_*() API for that. Other (optional) clocks must be > handled by the device driver itself. > > Gr{oetje,eeting}s, > > Geert > > -- > Geert Uytterhoeven -- There's lots of Linux beyond ia32 --geert@linux-m68k.org > > In personal conversations with technical people, I call myself a hacker. But > when I'm talking to journalists I just say "programmer" or something like that. > -- Linus Torvalds > > >