Lines Matching full:duty

442 		lcko->def.freq, lcko->def.duty.num,  in litex_clk_print_params()
443 lcko->def.duty.den, lcko->def.phase); in litex_clk_print_params()
445 LOG_DBG("div: %u freq: %u duty: %u/%u phase: %d per_off: %u", in litex_clk_print_params()
447 lcko->ts_config.duty.num, lcko->ts_config.duty.den, in litex_clk_print_params()
450 LOG_DBG("div: %u freq: %u duty: %u/%u phase: %d per_off: %u", in litex_clk_print_params()
452 lcko->config.duty.num, lcko->config.duty.den, in litex_clk_print_params()
840 * Duty Cycle
843 /* Returns accurate duty ratio of given clkout*/
845 struct clk_duty *duty) in litex_clk_get_duty_cycle() argument
865 /* get duty 50% when divider is off or fractional is enabled */ in litex_clk_get_duty_cycle()
867 duty->num = 1; in litex_clk_get_duty_cycle()
868 duty->den = 2; in litex_clk_get_duty_cycle()
882 duty->num = high_time * 10 + edge * 5; in litex_clk_get_duty_cycle()
883 duty->den = (divider + edge) * 10; in litex_clk_get_duty_cycle()
888 /* Calculates duty cycle for given ratio in percent, 1% accuracy */
889 static inline uint8_t litex_clk_calc_duty_percent(struct clk_duty *duty) in litex_clk_calc_duty_percent() argument
893 ht = duty->num; in litex_clk_calc_duty_percent()
894 div = duty->den; in litex_clk_calc_duty_percent()
900 /* Calculate necessary values for setting duty cycle in normal mode */
904 struct clk_duty duty; in litex_clk_calc_duty_normal() local
912 duty = lcko->ts_config.duty; in litex_clk_calc_duty_normal()
914 err = litex_clk_get_duty_cycle(lcko, &duty); in litex_clk_calc_duty_normal()
920 high_duty = litex_clk_calc_duty_percent(&duty); in litex_clk_calc_duty_normal()
922 /* check if duty is available to set */ in litex_clk_calc_duty_normal()
945 lcko->config.duty.num = high_time_it * 100 + 50 in litex_clk_calc_duty_normal()
947 lcko->config.duty.den = divider * 100; in litex_clk_calc_duty_normal()
961 /* Calculates duty high_time for given divider and ratio */
962 static inline int litex_clk_calc_duty_high_time(struct clk_duty *duty, in litex_clk_calc_duty_high_time() argument
967 high_duty = litex_clk_calc_duty_percent(duty) * divider; in litex_clk_calc_duty_high_time()
972 /* Set duty cycle with given ratio */
974 struct clk_duty *duty) in litex_clk_set_duty_cycle() argument
981 high_duty = litex_clk_calc_duty_percent(duty), in litex_clk_set_duty_cycle()
985 lcko->ts_config.duty = *duty; in litex_clk_set_duty_cycle()
986 LOG_DBG("CLKOUT%d: setting duty: %u/%u", in litex_clk_set_duty_cycle()
987 lcko->id, duty->num, duty->den); in litex_clk_set_duty_cycle()
990 LOG_ERR("CLKOUT%d: cannot set %d%% duty cycle", in litex_clk_set_duty_cycle()
995 LOG_ERR("CLKOUT%d: cannot set duty cycle when fractional divider enabled", in litex_clk_set_duty_cycle()
1004 LOG_DBG("SET DUTY CYCLE: e:%u ht:%u lt:%u\nbitset1: 0x%x bitset2: 0x%x", in litex_clk_set_duty_cycle()
1013 LOG_INF("CLKOUT%d: set duty: %d%%", lcko->id, in litex_clk_set_duty_cycle()
1014 litex_clk_calc_duty_percent(&lcko->config.duty)); in litex_clk_set_duty_cycle()
1507 ret = litex_clk_set_duty_cycle(lcko, &lcko->def.duty); in litex_clk_set_def_clkout()
1551 struct clk_duty duty; in litex_clk_get_status() local
1558 ret = litex_clk_get_duty_cycle(lcko, &duty); in litex_clk_get_status()
1562 setup->duty = litex_clk_calc_duty_percent(&duty); in litex_clk_get_status()
1571 struct clk_duty duty; in litex_clk_on() local
1590 duty_perc = litex_clk_calc_duty_percent(&lcko->config.duty); in litex_clk_on()
1591 if (duty_perc != setup->duty) { in litex_clk_on()
1592 duty.num = setup->duty; in litex_clk_on()
1593 duty.den = 100; in litex_clk_on()
1594 ret = litex_clk_set_duty_cycle(lcko, &duty); in litex_clk_on()
1681 lcko->ts_config.duty = lcko->def.duty; in litex_clk_init_clkouts()