servo: store the configuration in the servo data structure.
This will allow removing the code that passes configuration options via global variables. Signed-off-by: Richard Cochran <richardcochran@gmail.com>master
parent
a4329f7873
commit
bde8ef4360
4
clock.c
4
clock.c
|
@ -866,7 +866,7 @@ struct clock *clock_create(struct config *config, int phc_index,
|
||||||
the actual frequency of the clock. */
|
the actual frequency of the clock. */
|
||||||
clockadj_set_freq(c->clkid, fadj);
|
clockadj_set_freq(c->clkid, fadj);
|
||||||
}
|
}
|
||||||
c->servo = servo_create(servo, -fadj, max_adj, sw_ts);
|
c->servo = servo_create(c->config, servo, -fadj, max_adj, sw_ts);
|
||||||
if (!c->servo) {
|
if (!c->servo) {
|
||||||
pr_err("Failed to create clock servo");
|
pr_err("Failed to create clock servo");
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -1356,7 +1356,7 @@ int clock_switch_phc(struct clock *c, int phc_index)
|
||||||
}
|
}
|
||||||
fadj = (int) clockadj_get_freq(clkid);
|
fadj = (int) clockadj_get_freq(clkid);
|
||||||
clockadj_set_freq(clkid, fadj);
|
clockadj_set_freq(clkid, fadj);
|
||||||
servo = servo_create(c->servo_type, -fadj, max_adj, 0);
|
servo = servo_create(c->config, c->servo_type, -fadj, max_adj, 0);
|
||||||
if (!servo) {
|
if (!servo) {
|
||||||
pr_err("Switching PHC, failed to create clock servo");
|
pr_err("Switching PHC, failed to create clock servo");
|
||||||
phc_close(clkid);
|
phc_close(clkid);
|
||||||
|
|
|
@ -224,7 +224,8 @@ static struct clock *clock_add(struct node *node, char *device)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
c->servo = servo_create(node->servo_type, -ppb, max_ppb, 0);
|
c->servo = servo_create(&phc2sys_config, node->servo_type,
|
||||||
|
-ppb, max_ppb, 0);
|
||||||
servo_sync_interval(c->servo, node->phc_interval);
|
servo_sync_interval(c->servo, node->phc_interval);
|
||||||
|
|
||||||
if (clkid != CLOCK_REALTIME)
|
if (clkid != CLOCK_REALTIME)
|
||||||
|
|
3
servo.c
3
servo.c
|
@ -30,7 +30,8 @@ double servo_step_threshold = 0.0;
|
||||||
double servo_first_step_threshold = 0.00002; /* 20 microseconds */
|
double servo_first_step_threshold = 0.00002; /* 20 microseconds */
|
||||||
int servo_max_frequency = 900000000;
|
int servo_max_frequency = 900000000;
|
||||||
|
|
||||||
struct servo *servo_create(enum servo_type type, int fadj, int max_ppb, int sw_ts)
|
struct servo *servo_create(struct config *cfg, enum servo_type type,
|
||||||
|
int fadj, int max_ppb, int sw_ts)
|
||||||
{
|
{
|
||||||
struct servo *servo;
|
struct servo *servo;
|
||||||
|
|
||||||
|
|
5
servo.h
5
servo.h
|
@ -22,6 +22,8 @@
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
|
struct config;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* When set to a non-zero value, this variable controls the maximum allowed
|
* When set to a non-zero value, this variable controls the maximum allowed
|
||||||
* offset before a clock jump occurs instead of the default clock-slewing
|
* offset before a clock jump occurs instead of the default clock-slewing
|
||||||
|
@ -92,7 +94,8 @@ enum servo_state {
|
||||||
* and the servo should use more aggressive filtering.
|
* and the servo should use more aggressive filtering.
|
||||||
* @return A pointer to a new servo on success, NULL otherwise.
|
* @return A pointer to a new servo on success, NULL otherwise.
|
||||||
*/
|
*/
|
||||||
struct servo *servo_create(enum servo_type type, int fadj, int max_ppb, int sw_ts);
|
struct servo *servo_create(struct config *cfg, enum servo_type type,
|
||||||
|
int fadj, int max_ppb, int sw_ts);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Destroy an instance of a clock servo.
|
* Destroy an instance of a clock servo.
|
||||||
|
|
Loading…
Reference in New Issue