Lines Matching full:factor
3 * mmp factor clock operation source file
19 * numerator/denominator = Fin / (Fout * factor)
27 struct mmp_clk_factor *factor = to_clk_factor(hw); in clk_factor_round_rate() local
31 for (i = 0; i < factor->ftbl_cnt; i++) { in clk_factor_round_rate()
34 rate *= factor->ftbl[i].den; in clk_factor_round_rate()
35 do_div(rate, factor->ftbl[i].num * factor->masks->factor); in clk_factor_round_rate()
40 if ((i == 0) || (i == factor->ftbl_cnt)) { in clk_factor_round_rate()
53 struct mmp_clk_factor *factor = to_clk_factor(hw); in clk_factor_recalc_rate() local
54 struct mmp_clk_factor_masks *masks = factor->masks; in clk_factor_recalc_rate()
58 val = readl_relaxed(factor->base); in clk_factor_recalc_rate()
71 do_div(rate, num * factor->masks->factor); in clk_factor_recalc_rate()
80 struct mmp_clk_factor *factor = to_clk_factor(hw); in clk_factor_set_rate() local
81 struct mmp_clk_factor_masks *masks = factor->masks; in clk_factor_set_rate()
87 for (i = 0; i < factor->ftbl_cnt; i++) { in clk_factor_set_rate()
89 rate *= factor->ftbl[i].den; in clk_factor_set_rate()
90 do_div(rate, factor->ftbl[i].num * factor->masks->factor); in clk_factor_set_rate()
98 if (factor->lock) in clk_factor_set_rate()
99 spin_lock_irqsave(factor->lock, flags); in clk_factor_set_rate()
101 val = readl_relaxed(factor->base); in clk_factor_set_rate()
104 val |= (factor->ftbl[i].num & masks->num_mask) << masks->num_shift; in clk_factor_set_rate()
107 val |= (factor->ftbl[i].den & masks->den_mask) << masks->den_shift; in clk_factor_set_rate()
109 writel_relaxed(val, factor->base); in clk_factor_set_rate()
111 if (factor->lock) in clk_factor_set_rate()
112 spin_unlock_irqrestore(factor->lock, flags); in clk_factor_set_rate()
119 struct mmp_clk_factor *factor = to_clk_factor(hw); in clk_factor_init() local
120 struct mmp_clk_factor_masks *masks = factor->masks; in clk_factor_init()
125 if (factor->lock) in clk_factor_init()
126 spin_lock_irqsave(factor->lock, flags); in clk_factor_init()
128 val = readl(factor->base); in clk_factor_init()
136 for (i = 0; i < factor->ftbl_cnt; i++) in clk_factor_init()
137 if (den == factor->ftbl[i].den && num == factor->ftbl[i].num) in clk_factor_init()
140 if (i >= factor->ftbl_cnt) { in clk_factor_init()
142 val |= (factor->ftbl[0].num & masks->num_mask) << in clk_factor_init()
146 val |= (factor->ftbl[0].den & masks->den_mask) << in clk_factor_init()
150 if (!(val & masks->enable_mask) || i >= factor->ftbl_cnt) { in clk_factor_init()
152 writel(val, factor->base); in clk_factor_init()
155 if (factor->lock) in clk_factor_init()
156 spin_unlock_irqrestore(factor->lock, flags); in clk_factor_init()
174 struct mmp_clk_factor *factor; in mmp_clk_register_factor() local
183 factor = kzalloc(sizeof(*factor), GFP_KERNEL); in mmp_clk_register_factor()
184 if (!factor) in mmp_clk_register_factor()
188 factor->base = base; in mmp_clk_register_factor()
189 factor->masks = masks; in mmp_clk_register_factor()
190 factor->ftbl = ftbl; in mmp_clk_register_factor()
191 factor->ftbl_cnt = ftbl_cnt; in mmp_clk_register_factor()
192 factor->hw.init = &init; in mmp_clk_register_factor()
193 factor->lock = lock; in mmp_clk_register_factor()
201 clk = clk_register(NULL, &factor->hw); in mmp_clk_register_factor()
203 kfree(factor); in mmp_clk_register_factor()