From: Stephen Boyd <sboyd@kernel.org> To: Maxime Ripard <maxime@cerno.tech> Cc: Daniel Vetter <daniel.vetter@intel.com>, David Airlie <airlied@linux.ie>, Maarten Lankhorst <maarten.lankhorst@linux.intel.com>, Mike Turquette <mturquette@baylibre.com>, Thomas Zimmermann <tzimmermann@suse.de>, dri-devel@lists.freedesktop.org, Jerome Brunet <jbrunet@baylibre.com>, linux-clk@vger.kernel.org, Dave Stevenson <dave.stevenson@raspberrypi.com>, Phil Elwell <phil@raspberrypi.com>, Tim Gover <tim.gover@raspberrypi.com>, Dom Cobley <dom@raspberrypi.com>, Emma Anholt <emma@anholt.net>, linux-kernel@vger.kernel.org, Russell King <linux@armlinux.org.uk> Subject: Re: [PATCH v2 1/3] clk: Introduce a clock request API Date: Fri, 14 Jan 2022 14:38:43 -0800 [thread overview] Message-ID: <20220114223844.E542EC36AE7@smtp.kernel.org> (raw) In-Reply-To: <20220114161556.vgxhetm4ccokik4b@houat> Quoting Maxime Ripard (2022-01-14 08:15:56) > On Thu, Jan 13, 2022 at 01:44:25PM -0800, Stephen Boyd wrote: > > > > > 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? > > 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: > > - 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. > > - How should we deal with a clk_set_rate call while we have a range? > Something like: > > 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); > > 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. > > 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? > 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.
WARNING: multiple messages have this Message-ID (diff)
From: Stephen Boyd <sboyd@kernel.org> To: Maxime Ripard <maxime@cerno.tech> Cc: Emma Anholt <emma@anholt.net>, Dom Cobley <dom@raspberrypi.com>, Tim Gover <tim.gover@raspberrypi.com>, Dave Stevenson <dave.stevenson@raspberrypi.com>, David Airlie <airlied@linux.ie>, Mike Turquette <mturquette@baylibre.com>, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Phil Elwell <phil@raspberrypi.com>, Thomas Zimmermann <tzimmermann@suse.de>, Daniel Vetter <daniel.vetter@intel.com>, linux-clk@vger.kernel.org, Russell King <linux@armlinux.org.uk>, Jerome Brunet <jbrunet@baylibre.com> Subject: Re: [PATCH v2 1/3] clk: Introduce a clock request API Date: Fri, 14 Jan 2022 14:38:43 -0800 [thread overview] Message-ID: <20220114223844.E542EC36AE7@smtp.kernel.org> (raw) In-Reply-To: <20220114161556.vgxhetm4ccokik4b@houat> Quoting Maxime Ripard (2022-01-14 08:15:56) > On Thu, Jan 13, 2022 at 01:44:25PM -0800, Stephen Boyd wrote: > > > > > 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? > > 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: > > - 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. > > - How should we deal with a clk_set_rate call while we have a range? > Something like: > > 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); > > 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. > > 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? > 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.
next prev parent reply other threads:[~2022-01-14 22:38 UTC|newest] Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-09-14 9:35 [PATCH v2 0/3] clk: Implement a clock request API Maxime Ripard 2021-09-14 9:35 ` [PATCH v2 1/3] clk: Introduce " Maxime Ripard 2022-01-12 3:37 ` Stephen Boyd 2022-01-12 3:37 ` Stephen Boyd 2022-01-12 11:46 ` Maxime Ripard 2022-01-12 11:46 ` Maxime Ripard 2022-01-13 21:44 ` Stephen Boyd 2022-01-13 21:44 ` Stephen Boyd 2022-01-14 16:15 ` Maxime Ripard 2022-01-14 16:15 ` Maxime Ripard 2022-01-14 22:38 ` Stephen Boyd [this message] 2022-01-14 22:38 ` Stephen Boyd 2022-01-14 22:41 ` Stephen Boyd 2022-01-14 22:41 ` Stephen Boyd 2021-09-14 9:35 ` [PATCH v2 2/3] drm/vc4: hdmi: Convert to the new " Maxime Ripard 2021-09-14 9:35 ` [PATCH v2 3/3] drm/vc4: hvs: " Maxime Ripard 2021-12-15 14:08 ` [PATCH v2 0/3] clk: Implement a " Maxime Ripard 2021-12-15 14:08 ` Maxime Ripard 2022-01-12 13:28 ` Dmitry Osipenko 2022-01-12 13:28 ` Dmitry Osipenko 2022-01-12 13:51 ` Maxime Ripard 2022-01-12 13:51 ` Maxime Ripard 2022-01-12 14:13 ` Dmitry Osipenko 2022-01-12 14:13 ` Dmitry Osipenko
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20220114223844.E542EC36AE7@smtp.kernel.org \ --to=sboyd@kernel.org \ --cc=airlied@linux.ie \ --cc=daniel.vetter@intel.com \ --cc=dave.stevenson@raspberrypi.com \ --cc=dom@raspberrypi.com \ --cc=dri-devel@lists.freedesktop.org \ --cc=emma@anholt.net \ --cc=jbrunet@baylibre.com \ --cc=linux-clk@vger.kernel.org \ --cc=linux-kernel@vger.kernel.org \ --cc=linux@armlinux.org.uk \ --cc=maarten.lankhorst@linux.intel.com \ --cc=maxime@cerno.tech \ --cc=mturquette@baylibre.com \ --cc=phil@raspberrypi.com \ --cc=tim.gover@raspberrypi.com \ --cc=tzimmermann@suse.de \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.