Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp7369245ybi; Wed, 5 Jun 2019 16:32:46 -0700 (PDT) X-Google-Smtp-Source: APXvYqwbUZPGGk6TZuONZFqYTN2iuAw7WX7FxyNPPPXxdXFrT/CxsbPMWI/8d92p7a4K/nL93aT2 X-Received: by 2002:a17:90a:3ae8:: with SMTP id b95mr11987624pjc.68.1559777566718; Wed, 05 Jun 2019 16:32:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559777566; cv=none; d=google.com; s=arc-20160816; b=srchQlsm5LqXuAcgs1PdSktxhxgEhahUtfXE005TDvT++2b/FTk1Dj7EfccsD3KYUH MfvFU9srKERWghPP1zeRt1L197pBI2Kg+2/00wihtAVkXQRPW/9iWcFKfC8nw1VHwOUP iTrZ6wMUy/gwYE/65SEsNfhIVVEx/g9P5OE11aJXGxvlIV3W6mg5cZ1mnPj8l4QuV/d1 amSGVE2nyT0GL9crN2zaW1ADZcY7Dk+5kel9KAipgHp7LeBEppMX9wvD7V3PWs9FpBIC FFmP3zZwJtDO4pH6T8DCE9lBLYLQCliA7ZVbBpECybNDn+BMllEQuy95hImA62Xs+luX d67A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:user-agent:subject:from :to:cc:references:in-reply-to:content-transfer-encoding:mime-version :dkim-signature; bh=oEpwnas0XtS/vLGSeVs61pl01Ri58VyEYayEZr92Fi0=; b=bP9KfKim1QxR5SfK18o6Ec28qUXPs9TVUsclLYBA+9Bz8+Ii6TvJyqajt0JFaHgFfa Y0aK9KPJ/OF/JbHFgS5CI6RMsdKm6/IeUJTq1sQ+doskX5ckdKjN00L1ANUCZacFNmeX 7LoLI+0vi01lM/O9cWbvHJMQ/18Z7n+7b0Id+731CxNE2wcP40VBMoqHbuarymmvxK9j WmnS3MLoz/vhlCFeq9wZk6uOBSjQTD2f0OKyuus5/d50evEM0GZ6m3QoPeHJqZg/uCU9 e/oNU+lh3wbDNQxOYCdtSfLIWcL3RD+X9zKbZoNtOOl1AAQCzmH8GNqT59EsqoUXLYXx DAJQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=mM5nhpZ3; 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=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j6si14042plk.120.2019.06.05.16.32.29; Wed, 05 Jun 2019 16:32:46 -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=@kernel.org header.s=default header.b=mM5nhpZ3; 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=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726674AbfFEXbZ (ORCPT + 99 others); Wed, 5 Jun 2019 19:31:25 -0400 Received: from mail.kernel.org ([198.145.29.99]:36830 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726543AbfFEXbY (ORCPT ); Wed, 5 Jun 2019 19:31:24 -0400 Received: from kernel.org (unknown [104.132.0.74]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id AC6DD2083E; Wed, 5 Jun 2019 23:31:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1559777483; bh=Gv90T7rcmE4D6Bw1Jj/m4qXdxlWX226iKT0AddgAoBM=; h=In-Reply-To:References:Cc:To:From:Subject:Date:From; b=mM5nhpZ30n+cxkI7tGpiNIXusTJq40P+ZToze2Ml4tuE1e8D3nnDJWADhN9un3TPo v5/nKmAeqfuuxIVQtsEYXWXH7zgGrtg+l7fV9B34O07X6PDhbdVXnJ9yb5picEb4+c m45rcdzn9aga9qLDnbJIJxCdOTFbpptCwNv8Si60= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable In-Reply-To: References: <1559084936-4610-1-git-send-email-skomatineni@nvidia.com> <1559084936-4610-4-git-send-email-skomatineni@nvidia.com> <20190529232810.14A5224366@mail.kernel.org> Cc: pdeschrijver@nvidia.com, pgaikwad@nvidia.com, linux-clk@vger.kernel.org, linux-gpio@vger.kernel.org, jckuo@nvidia.com, josephl@nvidia.com, talho@nvidia.com, linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org, mperttunen@nvidia.com, spatra@nvidia.com, robh+dt@kernel.org, devicetree@vger.kernel.org To: Sowjanya Komatineni , jason@lakedaemon.net, jonathanh@nvidia.com, linus.walleij@linaro.org, marc.zyngier@arm.com, mark.rutland@arm.com, stefan@agner.ch, tglx@linutronix.de, thierry.reding@gmail.com From: Stephen Boyd Subject: Re: [PATCH V2 03/12] clk: tegra: save and restore PLLs state for system User-Agent: alot/0.8.1 Date: Wed, 05 Jun 2019 16:31:22 -0700 Message-Id: <20190605233123.AC6DD2083E@mail.kernel.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Quoting Sowjanya Komatineni (2019-05-31 12:52:44) >=20 > On 5/29/19 4:28 PM, Stephen Boyd wrote: > > Quoting Sowjanya Komatineni (2019-05-28 16:08:47) > >> + WARN_ON(1); > >> + return; > >> + } > >> + > >> + parent_rate =3D clk_hw_get_rate(parent); > >> + > >> + if (clk_frac_div_set_rate(hw, rate, parent_rate) < 0) > >> + WARN_ON(1); > >> +} > >> +#endif > >> diff --git a/drivers/clk/tegra/clk.h b/drivers/clk/tegra/clk.h > >> index 09bccbb9640c..e4d124cc5657 100644 > >> --- a/drivers/clk/tegra/clk.h > >> +++ b/drivers/clk/tegra/clk.h > >> @@ -841,6 +841,15 @@ int tegra_pll_p_div_to_hw(struct tegra_clk_pll *p= ll, u8 p_div); > >> int div_frac_get(unsigned long rate, unsigned parent_rate, u8 width, > >> u8 frac_width, u8 flags); > >> =20 > >> +#ifdef CONFIG_PM_SLEEP > > Can you remove this ifdef? It just complicates compilation testing. > OK, Will fix in next version > >> +void tegra_clk_pll_resume(struct clk *c, unsigned long rate); > >> +void tegra_clk_divider_resume(struct clk_hw *hw, unsigned long rate); > >> +void tegra_clk_pll_out_resume(struct clk *clk, unsigned long rate); > >> +void tegra_clk_plle_tegra210_resume(struct clk *c); > >> +void tegra_clk_sync_state_pll(struct clk *c); > >> +void tegra_clk_sync_state_pll_out(struct clk *clk); > > Do these APIs need to operate on struct clk? Why can't they operate on > > clk_hw or why can't we drive the suspend/resume sequence from the clk > > provider driver itself? > > > Yes can change to use clk_hw. >=20 > By clk provider driver, are you referring to clk-tegra210? I guess so. >=20 > clk-terga210 driver has suspend/resume implementation. These API's are=20 > for corresponding clock specific implementations (clk-pll, clk-pll-out,=20 > clk-divider) for enabling and restoring to proper rate and are invoked=20 > during clk-tegra210 driver resume. Yes, so when the clk provider suspends it needs to do something? Our handling of clk rates and other state like enable/disable over suspend/resume isn't really well thought out or implemented so far. TI has some code to do some stuff, but otherwise I haven't seen drivers handling this. Ideally it would be something generic in the framework so that drivers don't have to work around stuff.