public inbox for linux-clk@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 0/3] Add clk_poll_disable_unprepare()
@ 2024-03-18 11:08 Biju Das
  2024-03-18 11:08 ` [PATCH v3 1/3] clk: Update API documentation related to clock disable Biju Das
  2024-03-18 11:08 ` [PATCH v3 2/3] clk: Add clk_poll_disable_unprepare() Biju Das
  0 siblings, 2 replies; 15+ messages in thread
From: Biju Das @ 2024-03-18 11:08 UTC (permalink / raw)
  To: Michael Turquette, Stephen Boyd, Sakari Ailus, Laurent Pinchart,
	Mauro Carvalho Chehab, Hans Verkuil, Russell King
  Cc: Biju Das, linux-clk, Geert Uytterhoeven, Prabhakar Mahadev Lad,
	Biju Das, linux-media, linux-renesas-soc

Currently documentation related to disabling of clock do not state
it is synchronous or asynchronous clock gating. So, make it clear it is
driver dependent.

The clk_disable_unprepare() doesn't guarantee that a clock is gated after
the execution as it is driver dependent. The Renesas and most of the other
platforms don't wait until clock is stopped because of performance reason.
But these platforms wait while turning on the clock.

The normal case for shutting down the clock is unbind/close/suspend or
error paths in the driver. Not waiting for the shutting down the clock
will improve the suspend time.

But on RZ/G2L Camera Data Receiving Unit (CRU) IP, initially the vclk is
on. Before enabling link reception, we need to wait for vclk to be off
and after enabling reception, we need to turn the vlck on. Special cases
like this requires a sync API for clock gating.

Add clk_poll_disable_unprepare() to poll the clock gate operation that
guarantees gating of clk after the execution.

v2->v3:
 * Added WARN_ON(enable count non-zero) and return an error code (-EBUSY),
   if the user is not the sole user of the clock and the enable count is
   non-zero.
 * Returned an error if there's no is_enabled() callback.
RFC->v2:
 * Updated cover letter description and header.
 * Created patch#1 for updating existing documentation.
 * Renamed clk_disable_unprepare_sync()-->clk_poll_disable_unprepare()
 * Redesigned to make use of __clk_is_enabled() to poll the clock gating.

Biju Das (3):
  clk: Update API documentation related to clock disable
  clk: Add clk_poll_disable_unprepare()
  media: platform: rzg2l-cru: rzg2l-video: Use
    clk_poll_disable_unprepare()

 drivers/clk/clk.c                             | 32 +++++++++++-
 .../platform/renesas/rzg2l-cru/rzg2l-csi2.c   |  5 +-
 include/linux/clk-provider.h                  |  3 +-
 include/linux/clk.h                           | 49 ++++++++++++++++++-
 4 files changed, 85 insertions(+), 4 deletions(-)

-- 
2.25.1


^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2024-06-01  8:38 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-18 11:08 [PATCH v3 0/3] Add clk_poll_disable_unprepare() Biju Das
2024-03-18 11:08 ` [PATCH v3 1/3] clk: Update API documentation related to clock disable Biju Das
2024-03-18 18:29   ` Sakari Ailus
2024-06-01  8:14     ` Biju Das
2024-03-18 22:38   ` Laurent Pinchart
2024-06-01  8:38     ` Biju Das
2024-04-11  8:04   ` Stephen Boyd
2024-04-12 15:36   ` Russell King (Oracle)
2024-03-18 11:08 ` [PATCH v3 2/3] clk: Add clk_poll_disable_unprepare() Biju Das
2024-03-18 18:23   ` Sakari Ailus
2024-06-01  8:05     ` Biju Das
2024-03-18 22:55   ` Laurent Pinchart
2024-04-11  8:12     ` Stephen Boyd
2024-04-12 15:41   ` Russell King (Oracle)
2024-06-01  7:40     ` Biju Das

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox