Lines Matching refs:ctx
92 struct system_pll_dev_ctx *ctx; in system_pll_set_rate() local
97 ctx = module_ctx.dev_ctx_table + fwk_id_get_element_idx(dev_id); in system_pll_set_rate()
99 if (ctx->current_state == MOD_CLOCK_STATE_STOPPED) in system_pll_set_rate()
103 if ((rate % ctx->config->min_step) > 0) { in system_pll_set_rate()
108 rounded_rate = FWK_ALIGN_PREVIOUS(rate, ctx->config->min_step); in system_pll_set_rate()
109 rounded_rate_alt = FWK_ALIGN_NEXT(rate, ctx->config->min_step); in system_pll_set_rate()
116 rounded_rate = FWK_ALIGN_PREVIOUS(rate, ctx->config->min_step); in system_pll_set_rate()
119 rounded_rate = FWK_ALIGN_NEXT(rate, ctx->config->min_step); in system_pll_set_rate()
127 if (rounded_rate < ctx->config->min_rate) in system_pll_set_rate()
129 if (rounded_rate > ctx->config->max_rate) in system_pll_set_rate()
137 *ctx->config->control_reg = picoseconds; in system_pll_set_rate()
139 if (ctx->config->status_reg != NULL) { in system_pll_set_rate()
141 while ((*ctx->config->status_reg & ctx->config->lock_flag_mask) == 0) in system_pll_set_rate()
145 ctx->current_rate = rounded_rate; in system_pll_set_rate()
152 struct system_pll_dev_ctx *ctx; in system_pll_get_rate() local
159 ctx = module_ctx.dev_ctx_table + fwk_id_get_element_idx(dev_id); in system_pll_get_rate()
160 *rate = ctx->current_rate; in system_pll_get_rate()
184 struct system_pll_dev_ctx *ctx; in system_pll_get_state() local
191 ctx = module_ctx.dev_ctx_table + fwk_id_get_element_idx(dev_id); in system_pll_get_state()
192 *state = ctx->current_state; in system_pll_get_state()
199 struct system_pll_dev_ctx *ctx; in system_pll_get_range() local
206 ctx = module_ctx.dev_ctx_table + fwk_id_get_element_idx(dev_id); in system_pll_get_range()
209 range->min = ctx->config->min_rate; in system_pll_get_range()
210 range->max = ctx->config->max_rate; in system_pll_get_range()
211 range->step = ctx->config->min_step; in system_pll_get_range()
221 struct system_pll_dev_ctx *ctx; in system_pll_power_state_change() local
223 ctx = module_ctx.dev_ctx_table + fwk_id_get_element_idx(dev_id); in system_pll_power_state_change()
228 ctx->current_state = MOD_CLOCK_STATE_RUNNING; in system_pll_power_state_change()
230 if (ctx->initialized) { in system_pll_power_state_change()
232 rate = ctx->current_rate; in system_pll_power_state_change()
235 ctx->initialized = true; in system_pll_power_state_change()
236 rate = ctx->config->initial_rate; in system_pll_power_state_change()
247 struct system_pll_dev_ctx *ctx; in system_pll_power_state_pending_change() local
249 ctx = module_ctx.dev_ctx_table + fwk_id_get_element_idx(dev_id); in system_pll_power_state_pending_change()
253 ctx->current_state = MOD_CLOCK_STATE_STOPPED; in system_pll_power_state_pending_change()
290 struct system_pll_dev_ctx *ctx; in system_pll_element_init() local
293 ctx = module_ctx.dev_ctx_table + fwk_id_get_element_idx(element_id); in system_pll_element_init()
295 ctx->config = dev_config; in system_pll_element_init()
297 if (ctx->config->defer_initialization) in system_pll_element_init()
300 ctx->initialized = true; in system_pll_element_init()
301 ctx->current_state = MOD_CLOCK_STATE_RUNNING; in system_pll_element_init()
302 return system_pll_set_rate(element_id, ctx->config->initial_rate, in system_pll_element_init()