no-OS
Public Attributes | List of all members
clk_ops Struct Reference

#include <xilinx_transceiver.h>

Public Attributes

int(* enable )(struct adxcvr *xcvr)
 
int(* disable )(struct adxcvr *xcvr)
 
unsigned long(* recalc_rate )(struct adxcvr *xcvr, unsigned long parent_rate)
 
long(* round_rate )(struct adxcvr *xcvr, unsigned long rate, unsigned long parent_rate)
 
int(* set_rate )(struct adxcvr *xcvr, unsigned long rate, unsigned long parent_rate)
 

Detailed Description

struct clk_ops - Callback operations for hardware clocks; these are to be provided by the clock implementation, and will be called by drivers through the clk_* api.

Parameters
enableEnable the clock atomically. This must not return until the clock is generating a valid clock signal, usable by consumer devices. Called with enable_lock held. This function must not sleep.
disableDisable the clock atomically. Called with enable_lock held. This function must not sleep.
recalc_rateRecalculate the rate of this clock, by querying hardware. The parent rate is an input parameter. It is up to the caller to ensure that the prepare_mutex is held across this call. Returns the calculated rate. Optional, but recommended - if this op is not set then clock rate will be initialized to 0.
round_rateGiven a target rate as input, returns the closest rate actually supported by the clock. The parent rate is an input/output parameter.
set_rateChange the rate of this clock. The requested rate is specified by the second argument, which should typically be the return of .round_rate call. The third argument gives the parent rate which is likely helpful for most .set_rate implementation. Returns 0 on success, -EERROR otherwise.

The clk_enable/clk_disable and clk_prepare/clk_unprepare pairs allow implementations to split any work between atomic (enable) and sleepable (prepare) contexts. If enabling a clock requires code that might sleep, this must be done in clk_prepare. Clock enable code that will never be called in a sleepable context may be implemented in clk_enable.

Typically, drivers will call clk_prepare when a clock may be needed later (eg. when a device is opened), and clk_enable when the clock is actually required (eg. from an interrupt). Note that clk_prepare MUST have been called before clk_enable.

Member Data Documentation

◆ disable

int(* clk_ops::disable) (struct adxcvr *xcvr)

◆ enable

int(* clk_ops::enable) (struct adxcvr *xcvr)

◆ recalc_rate

unsigned long(* clk_ops::recalc_rate) (struct adxcvr *xcvr, unsigned long parent_rate)

◆ round_rate

long(* clk_ops::round_rate) (struct adxcvr *xcvr, unsigned long rate, unsigned long parent_rate)

◆ set_rate

int(* clk_ops::set_rate) (struct adxcvr *xcvr, unsigned long rate, unsigned long parent_rate)

The documentation for this struct was generated from the following file: