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()
85 rate = (((prate / 10000) * factor->ftbl[i].den) / in clk_factor_set_rate()
86 (factor->ftbl[i].num * factor->masks->factor)) * 10000; in clk_factor_set_rate()
93 if (factor->lock) in clk_factor_set_rate()
94 spin_lock_irqsave(factor->lock, flags); in clk_factor_set_rate()
96 val = readl_relaxed(factor->base); in clk_factor_set_rate()
99 val |= (factor->ftbl[i].num & masks->num_mask) << masks->num_shift; in clk_factor_set_rate()
102 val |= (factor->ftbl[i].den & masks->den_mask) << masks->den_shift; in clk_factor_set_rate()
104 writel_relaxed(val, factor->base); in clk_factor_set_rate()
106 if (factor->lock) in clk_factor_set_rate()
107 spin_unlock_irqrestore(factor->lock, flags); in clk_factor_set_rate()
114 struct mmp_clk_factor *factor = to_clk_factor(hw); in clk_factor_init() local
115 struct mmp_clk_factor_masks *masks = factor->masks; in clk_factor_init()
120 if (factor->lock) in clk_factor_init()
121 spin_lock_irqsave(factor->lock, flags); in clk_factor_init()
123 val = readl(factor->base); in clk_factor_init()
131 for (i = 0; i < factor->ftbl_cnt; i++) in clk_factor_init()
132 if (den == factor->ftbl[i].den && num == factor->ftbl[i].num) in clk_factor_init()
135 if (i >= factor->ftbl_cnt) { in clk_factor_init()
137 val |= (factor->ftbl[0].num & masks->num_mask) << in clk_factor_init()
141 val |= (factor->ftbl[0].den & masks->den_mask) << in clk_factor_init()
144 writel(val, factor->base); in clk_factor_init()
147 if (factor->lock) in clk_factor_init()
148 spin_unlock_irqrestore(factor->lock, flags); in clk_factor_init()
164 struct mmp_clk_factor *factor; in mmp_clk_register_factor() local
173 factor = kzalloc(sizeof(*factor), GFP_KERNEL); in mmp_clk_register_factor()
174 if (!factor) in mmp_clk_register_factor()
178 factor->base = base; in mmp_clk_register_factor()
179 factor->masks = masks; in mmp_clk_register_factor()
180 factor->ftbl = ftbl; in mmp_clk_register_factor()
181 factor->ftbl_cnt = ftbl_cnt; in mmp_clk_register_factor()
182 factor->hw.init = &init; in mmp_clk_register_factor()
183 factor->lock = lock; in mmp_clk_register_factor()
191 clk = clk_register(NULL, &factor->hw); in mmp_clk_register_factor()
193 kfree(factor); in mmp_clk_register_factor()