clock: add APIs to access servo and servo_state

Make servo and it's current state available outside clock.c

Signed-off-by: Vedang Patel <vedang.patel@intel.com>
master
Vedang Patel 2019-03-28 20:32:29 -07:00 committed by Richard Cochran
parent 630ce719fc
commit 78b4b780da
2 changed files with 24 additions and 0 deletions

10
clock.c
View File

@ -1835,3 +1835,13 @@ double clock_rate_ratio(struct clock *c)
} }
return servo_rate_ratio(c->servo); return servo_rate_ratio(c->servo);
} }
struct servo *clock_servo(struct clock *c)
{
return c->servo;
}
enum servo_state clock_servo_state(struct clock *c)
{
return c->servo_state;
}

14
clock.h
View File

@ -253,6 +253,20 @@ void clock_set_sde(struct clock *c, int sde);
*/ */
int clock_poll(struct clock *c); int clock_poll(struct clock *c);
/**
* Obtain the servo struct.
* @param c The clock instance.
* @return A pointer to the clock's servo.
*/
struct servo *clock_servo(struct clock *c);
/**
* Obtain the current state of clock's servo.
* @param c The clock instance.
* @return The current state of the clock's servo.
*/
enum servo_state clock_servo_state(struct clock *c);
/** /**
* Obtain the slave-only flag from a clock's default data set. * Obtain the slave-only flag from a clock's default data set.
* @param c The clock instance. * @param c The clock instance.