Skip to content

RFC: clock: add run reference counting

Darryl Green requested to merge github/fork/jeromebrunet/ref-count into master

Created by: jeromebrunet

Hi, I'm working on platform on which several agent might be using the same clock. In this configuration, it is crucial that a call to set_state() with MOD_CLOCK_STATE_STOPPED does not stop the clock if another agent still use the clock.

I have discussed this topic with Sudeep Holla by mail. He asked me to raise a bug but I gave it a shot a tried to implement something.

I have tested this on Juno by hacking Linux CCF to manually send set_state() request to the SCP firmware. It seems to work as expected:

  • Call to set_state() will increment or decrement the run_count depending on the requested state.
  • Calls to the underlying clock driver is only made when the run count transition from 0 to 1 or 1 to 0.

What is missing: On start, the initial clock state is check to intitialize the run_count to 0 or 1. This init does not support delayed response ATM. It will be added before the actual submission

But first, lets see if this proposal is going in the right direction :)

Signed-off-by: Jerome Brunet jbrunet@baylibre.com

Merge request reports