Lines Matching refs:factor

30 	struct mmp_clk_factor *factor = to_clk_factor(hw);  in clk_factor_round_rate()  local
34 for (i = 0; i < factor->ftbl_cnt; i++) { in clk_factor_round_rate()
36 rate = (((*prate / 10000) * factor->ftbl[i].den) / in clk_factor_round_rate()
37 (factor->ftbl[i].num * factor->masks->factor)) * 10000; 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()
58 val = readl_relaxed(factor->base); in clk_factor_recalc_rate()
70 (num * factor->masks->factor)) * 10000; in clk_factor_recalc_rate()
77 struct mmp_clk_factor *factor = to_clk_factor(hw); in clk_factor_set_rate() local
78 struct mmp_clk_factor_masks *masks = factor->masks; in clk_factor_set_rate()
84 for (i = 0; i < factor->ftbl_cnt; i++) { in clk_factor_set_rate()
86 rate = (((prate / 10000) * factor->ftbl[i].den) / in clk_factor_set_rate()
87 (factor->ftbl[i].num * factor->masks->factor)) * 10000; in clk_factor_set_rate()
94 if (factor->lock) in clk_factor_set_rate()
95 spin_lock_irqsave(factor->lock, flags); in clk_factor_set_rate()
97 val = readl_relaxed(factor->base); in clk_factor_set_rate()
100 val |= (factor->ftbl[i].num & masks->num_mask) << masks->num_shift; in clk_factor_set_rate()
103 val |= (factor->ftbl[i].den & masks->den_mask) << masks->den_shift; in clk_factor_set_rate()
105 writel_relaxed(val, factor->base); in clk_factor_set_rate()
107 if (factor->lock) in clk_factor_set_rate()
108 spin_unlock_irqrestore(factor->lock, flags); in clk_factor_set_rate()
115 struct mmp_clk_factor *factor = to_clk_factor(hw); in clk_factor_init() local
116 struct mmp_clk_factor_masks *masks = factor->masks; in clk_factor_init()
121 if (factor->lock) in clk_factor_init()
122 spin_lock_irqsave(factor->lock, flags); in clk_factor_init()
124 val = readl(factor->base); in clk_factor_init()
132 for (i = 0; i < factor->ftbl_cnt; i++) in clk_factor_init()
133 if (den == factor->ftbl[i].den && num == factor->ftbl[i].num) in clk_factor_init()
136 if (i >= factor->ftbl_cnt) { in clk_factor_init()
138 val |= (factor->ftbl[0].num & masks->num_mask) << in clk_factor_init()
142 val |= (factor->ftbl[0].den & masks->den_mask) << in clk_factor_init()
145 writel(val, factor->base); in clk_factor_init()
148 if (factor->lock) in clk_factor_init()
149 spin_unlock_irqrestore(factor->lock, flags); in clk_factor_init()
165 struct mmp_clk_factor *factor; in mmp_clk_register_factor() local
174 factor = kzalloc(sizeof(*factor), GFP_KERNEL); in mmp_clk_register_factor()
175 if (!factor) { in mmp_clk_register_factor()
181 factor->base = base; in mmp_clk_register_factor()
182 factor->masks = masks; in mmp_clk_register_factor()
183 factor->ftbl = ftbl; in mmp_clk_register_factor()
184 factor->ftbl_cnt = ftbl_cnt; in mmp_clk_register_factor()
185 factor->hw.init = &init; in mmp_clk_register_factor()
186 factor->lock = lock; in mmp_clk_register_factor()
194 clk = clk_register(NULL, &factor->hw); in mmp_clk_register_factor()
196 kfree(factor); in mmp_clk_register_factor()