Lines Matching +full:precision +full:- +full:mode
3 * SPDX-License-Identifier: Apache-2.0
33 /* Clock options sorted from lowest to highest accuracy/precision */
36 uint16_t precision : 1; member
41 .precision = 0,
46 .precision = 0,
50 /* NRFS will request FLL16M use HFXO in bypass mode if SYNTH src is used */
52 .precision = 1,
73 k_timer_stop(&dev_data->timer); in clock_evt_handler()
75 if (p_evt->type == NRFS_CLOCK_EVT_REJECT) { in clock_evt_handler()
76 status = -ENXIO; in clock_evt_handler()
79 clock_config_update_end(&dev_data->clk_cfg, status); in clock_evt_handler()
87 clock_config_update_end(&dev_data->clk_cfg, -ETIMEDOUT); in lfclk_update_timeout_handler()
102 clock_config_update_end(&dev_data->clk_cfg, -EIO); in lfclk_work_handler()
104 k_timer_start(&dev_data->timer, NRFS_CLOCK_TIMEOUT, K_NO_WAIT); in lfclk_work_handler()
111 struct lfclk_dev_data *dev_data = dev->data; in lfclk_find_mgr()
112 const struct lfclk_dev_config *dev_config = dev->config; in lfclk_find_mgr()
116 return &dev_data->clk_cfg.onoff[0].mgr; in lfclk_find_mgr()
119 if (spec->frequency > dev_config->fixed_frequency) { in lfclk_find_mgr()
124 accuracy = spec->accuracy == NRF_CLOCK_CONTROL_ACCURACY_MAX in lfclk_find_mgr()
125 ? dev_data->max_accuracy in lfclk_find_mgr()
126 : spec->accuracy; in lfclk_find_mgr()
128 for (int i = 0; i < dev_data->clock_options_cnt; ++i) { in lfclk_find_mgr()
131 spec->precision > clock_options[i].precision) { in lfclk_find_mgr()
135 return &dev_data->clk_cfg.onoff[i].mgr; in lfclk_find_mgr()
138 LOG_ERR("invalid accuracy or precision"); in lfclk_find_mgr()
152 return -EINVAL; in api_request_lfclk()
164 return -EINVAL; in api_release_lfclk()
177 return -EINVAL; in api_cancel_or_release_lfclk()
186 const struct lfclk_dev_config *dev_config = dev->config; in api_get_rate_lfclk()
188 *rate = dev_config->fixed_frequency; in api_get_rate_lfclk()
195 struct lfclk_dev_data *dev_data = dev->data; in lfclk_init()
201 return -EIO; in lfclk_init()
204 dev_data->clock_options_cnt = LFCLK_DEF_OPTS; in lfclk_init()
210 dev_data->max_accuracy = LFCLK_HFXO_ACCURACY; in lfclk_init()
214 ret = lfosc_get_accuracy(&dev_data->max_accuracy); in lfclk_init()
222 clock_options[LFCLK_MAX_OPTS - 2].accuracy = dev_data->max_accuracy; in lfclk_init()
223 clock_options[LFCLK_MAX_OPTS - 2].precision = 0; in lfclk_init()
224 clock_options[LFCLK_MAX_OPTS - 2].src = NRFS_CLOCK_SRC_LFCLK_XO_PIERCE; in lfclk_init()
226 clock_options[LFCLK_MAX_OPTS - 1].accuracy = dev_data->max_accuracy; in lfclk_init()
227 clock_options[LFCLK_MAX_OPTS - 1].precision = 1; in lfclk_init()
228 clock_options[LFCLK_MAX_OPTS - 1].src = NRFS_CLOCK_SRC_LFCLK_XO_PIERCE_HP; in lfclk_init()
230 dev_data->clock_options_cnt += 2; in lfclk_init()
233 clock_options[LFCLK_MAX_OPTS - 2].accuracy = dev_data->max_accuracy; in lfclk_init()
234 clock_options[LFCLK_MAX_OPTS - 2].precision = 0; in lfclk_init()
235 clock_options[LFCLK_MAX_OPTS - 2].src = NRFS_CLOCK_SRC_LFCLK_XO_EXT_SINE; in lfclk_init()
237 clock_options[LFCLK_MAX_OPTS - 1].accuracy = dev_data->max_accuracy; in lfclk_init()
238 clock_options[LFCLK_MAX_OPTS - 1].precision = 1; in lfclk_init()
239 clock_options[LFCLK_MAX_OPTS - 1].src = NRFS_CLOCK_SRC_LFCLK_XO_EXT_SINE_HP; in lfclk_init()
241 dev_data->clock_options_cnt += 2; in lfclk_init()
244 clock_options[LFCLK_MAX_OPTS - 2].accuracy = dev_data->max_accuracy; in lfclk_init()
245 clock_options[LFCLK_MAX_OPTS - 2].precision = 0; in lfclk_init()
246 clock_options[LFCLK_MAX_OPTS - 2].src = NRFS_CLOCK_SRC_LFCLK_XO_EXT_SQUARE; in lfclk_init()
248 dev_data->clock_options_cnt += 1; in lfclk_init()
251 LOG_ERR("Unexpected LFOSC mode"); in lfclk_init()
252 return -EINVAL; in lfclk_init()
256 k_timer_init(&dev_data->timer, lfclk_update_timeout_handler, NULL); in lfclk_init()
258 return clock_config_init(&dev_data->clk_cfg, in lfclk_init()
259 ARRAY_SIZE(dev_data->clk_cfg.onoff), in lfclk_init()