Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp773542pxb; Fri, 14 Jan 2022 16:20:19 -0800 (PST) X-Google-Smtp-Source: ABdhPJwHU5OgM3DZQuuxVoPqe1Erme5nWpLYF/bJXNo/Vtv8e9DyvZGK8eVr2TF+0PDiqVvIE2ze X-Received: by 2002:a05:6a00:1681:b0:4a8:2462:ba0a with SMTP id k1-20020a056a00168100b004a82462ba0amr11366263pfc.75.1642206019203; Fri, 14 Jan 2022 16:20:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1642206019; cv=none; d=google.com; s=arc-20160816; b=kl2g25nC6I4G7ZLyGhxQyTzB31LOr8mIHaiGu5Qj4KeAiVDlegdbPWpj+ojnaYpLV5 29n2HqN52zsIwXokZ7TOwXXRCdJ5SZhZJ4R2JzgQsrUR2YY/RvkVS+jCpXh0l1XT/s/W Pj4u/N33kGEmws0pRkSHTp8HaU5UexSSaSbk0pmxDN4OffkghWcJ0g/U731wj99usSm9 7+ODZWF18VcZZSunxSsqU1tt8tYYoeb5C4joT2AMkgqfijNJ/lWztTwW1TrHNN/ZIl9+ ch3l0g2Xw4LoiCWeewXzEC5ZBYhcyNoLw7MQbkE6qTe00lZs8WDJQrkJ1N9eNDqNDJYS bhwg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:user-agent:date:to:cc:from:subject :references:in-reply-to:content-transfer-encoding:mime-version :dkim-signature; bh=pn4byuB/uqtWsP2XFdRBwlfEaaY0jMqD3hfeCzWZjRk=; b=qzX2KHwTBnevI41qXpYckSZ++eh1fhuLDbzwF47+3UuwjkqTTQ/ShZ5YGq57KH9blv LYeilbDrjbt5jkPUKWjm1OYjxAF2RFViSYKjrqwi/b0uzlvkNSEEfYFIqX94jl+TRsOy PsEt32ZRAU/+Tqz+toSIGN/wcGD0De/+NIsN+pflj9ZL53GzsV24QS4B/FlUewr1a987 n1hpi1RqiHXKAhAQ3mn95u8DvprKaY/D0/P7HaIhQfJRb3LqzuMCe2/+X7J6W/AoCQOG KbBUI2OLvxeaTULMol4twn0cqylPzljCkbF6ju6WvQE3oyNuSR5z2f0bAyIa3pY4ql15 Hx3w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=P1UY4JGn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id j1si6565102plt.425.2022.01.14.16.20.06; Fri, 14 Jan 2022 16:20:19 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=P1UY4JGn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S230494AbiANWis (ORCPT + 99 others); Fri, 14 Jan 2022 17:38:48 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:42466 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229556AbiANWir (ORCPT ); Fri, 14 Jan 2022 17:38:47 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 3105AB82A0C; Fri, 14 Jan 2022 22:38:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E542EC36AE7; Fri, 14 Jan 2022 22:38:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1642199925; bh=WTst2NrV82dAikh+ViTGMOxgddkuhhc7SX52HrSKAEE=; h=In-Reply-To:References:Subject:From:Cc:To:Date:From; b=P1UY4JGng/j87dDRKNOnuO81kP74augA/pxUqJ0cOP4SfM3VDK8lxHJSGHJDLjrQo VxCftDStONzCsKpIiX65xWjsJsOZbaRxBv+9BhrOAuP1Mm44dlvsgO+6Jbafw1wuLt dHGBNCircKv2DR4zsEVX3PLU0xLxTThdrNhhTSw7z9q369ucWGLfB852v5oy8fdZc9 1PVVQI86XPj+13Y4QxgdAD6bLOEh+EhPwke6jUadjzk03jfgCZwTxLzO3cjxVYMqK/ HP1fu3h0adN6QDt7Kl8ShU00v1FH94Z8sdukueIWAbmJMBaGKONgWhaMwtW0rgoHYQ PHgjvD3N4YLQQ== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable In-Reply-To: <20220114161556.vgxhetm4ccokik4b@houat> References: <20210914093515.260031-1-maxime@cerno.tech> <20210914093515.260031-2-maxime@cerno.tech> <20220112033716.63631C36AEA@smtp.kernel.org> <20220112114652.hmfdcpqil5jg2vz6@houat> <20220113214426.95292C36AEA@smtp.kernel.org> <20220114161556.vgxhetm4ccokik4b@houat> Subject: Re: [PATCH v2 1/3] clk: Introduce a clock request API From: Stephen Boyd Cc: Daniel Vetter , David Airlie , Maarten Lankhorst , Mike Turquette , Thomas Zimmermann , dri-devel@lists.freedesktop.org, Jerome Brunet , linux-clk@vger.kernel.org, Dave Stevenson , Phil Elwell , Tim Gover , Dom Cobley , Emma Anholt , linux-kernel@vger.kernel.org, Russell King To: Maxime Ripard Date: Fri, 14 Jan 2022 14:38:43 -0800 User-Agent: alot/0.10 Message-Id: <20220114223844.E542EC36AE7@smtp.kernel.org> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Quoting Maxime Ripard (2022-01-14 08:15:56) > On Thu, Jan 13, 2022 at 01:44:25PM -0800, Stephen Boyd wrote: > > >=20 > > I don't see a problem with re-evaluating the rate every time we call > > clk_set_rate_range(). That's probably the bug that I can't recall. Can > > you fix the API so it works that way? >=20 > Yep, I'll work on it next week. I started to think about it this week, > and there's two things I'm not entirely sure about: >=20 > - Keeping the clock at its minimum rate is essentially policy. Do we > want to guard that behavior by a flag, and do we want to do the same > thing if we want to max it? The policy should be to re-evaluate the rate based on constraints each time the constraints or rate is changed. The clk provider can decide if it wants to max it out or keep it minimized in the determine_rate clk_op. If you're worried about breaking somebody, there's only one other user I see in the tree, Tegra, so the risk seems low. If Tegra is relying on the existing behavior (very possible) then we can hopefully change that clk provider to keep the rate where it is if it's within the constraints vs. round it down to the minimum acceptable. >=20 > - How should we deal with a clk_set_rate call while we have a range? > Something like: >=20 > clk_set_min_rate(hdmi1_clk, 1000); > clk_set_min_rate(hdmi2_clk, 2000) > clk_set_rate(hdmi1_clk, 3000); > clk_drop_range(hdmi2_clk); >=20 > If we just try to minimize the rate all the time, we'll set the rate > back to 1000Hz, but I think it would make more sense to keep the > rate at 3000? This assumes the rate after clk_set_rate() is 3000. It all depends on the provider what the rate actually is. >=20 > Maybe we can test if the range is still at the boundary we remove, > and only if it is, drop it to whatever boundary we have left? >=20 From the consumer API perspective it looks like hdmi1 is saying it can accept a frequency as low as 1000 but would like 3000. The clk provider will look at the constraints and decide to try to get close to 3000, or exceed 3000, or set it lower than 3000 but not lower than 2000. I don't want to enforce anything in the framework here. Let the clk provider decide what frequency it should set the rate to based on the constraints. When there are constraints mixed with a clk_set_rate() we should give the provider all the facts, i.e. the rate and the constraints and let it decide what to do.