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
32 for (i = 0; i < factor->ftbl_cnt; i++) { in clk_factor_round_rate()
33 d = &factor->ftbl[i]; in clk_factor_round_rate()
37 do_div(rate, d->numerator * factor->masks->factor); in clk_factor_round_rate()
41 if ((i == 0) || (i == factor->ftbl_cnt)) { in clk_factor_round_rate()
54 struct mmp_clk_factor *factor = to_clk_factor(hw); in clk_factor_recalc_rate() local
55 struct mmp_clk_factor_masks *masks = factor->masks; in clk_factor_recalc_rate()
60 val = readl_relaxed(factor->base); in clk_factor_recalc_rate()
71 do_div(rate, d.numerator * 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()
88 for (i = 0; i < factor->ftbl_cnt; i++) { in clk_factor_set_rate()
89 d = &factor->ftbl[i]; in clk_factor_set_rate()
92 do_div(rate, d->numerator * factor->masks->factor); in clk_factor_set_rate()
96 d = i ? &factor->ftbl[i - 1] : &factor->ftbl[0]; 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()
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()
126 if (factor->lock) in clk_factor_init()
127 spin_lock_irqsave(factor->lock, flags); in clk_factor_init()
129 val = readl(factor->base); in clk_factor_init()
137 for (i = 0; i < factor->ftbl_cnt; i++) in clk_factor_init()
138 if (d.denominator == factor->ftbl[i].denominator && in clk_factor_init()
139 d.numerator == factor->ftbl[i].numerator) in clk_factor_init()
142 if (i >= factor->ftbl_cnt) { in clk_factor_init()
144 val |= (factor->ftbl[0].numerator & masks->num_mask) << masks->num_shift; in clk_factor_init()
147 val |= (factor->ftbl[0].denominator & masks->den_mask) << masks->den_shift; 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()
173 struct mmp_clk_factor *factor; in mmp_clk_register_factor() local
182 factor = kzalloc(sizeof(*factor), GFP_KERNEL); in mmp_clk_register_factor()
183 if (!factor) in mmp_clk_register_factor()
187 factor->base = base; in mmp_clk_register_factor()
188 factor->masks = masks; in mmp_clk_register_factor()
189 factor->ftbl = ftbl; in mmp_clk_register_factor()
190 factor->ftbl_cnt = ftbl_cnt; in mmp_clk_register_factor()
191 factor->hw.init = &init; in mmp_clk_register_factor()
192 factor->lock = lock; in mmp_clk_register_factor()
200 clk = clk_register(NULL, &factor->hw); in mmp_clk_register_factor()
202 kfree(factor); in mmp_clk_register_factor()