Lines Matching refs:nk
19 struct _ccu_nk *nk) in ccu_nk_find_best() argument
25 for (_k = nk->min_k; _k <= nk->max_k; _k++) { in ccu_nk_find_best()
26 for (_n = nk->min_n; _n <= nk->max_n; _n++) { in ccu_nk_find_best()
40 nk->k = best_k; in ccu_nk_find_best()
41 nk->n = best_n; in ccu_nk_find_best()
46 struct ccu_nk *nk = hw_to_ccu_nk(hw); in ccu_nk_disable() local
48 return ccu_gate_helper_disable(&nk->common, nk->enable); in ccu_nk_disable()
53 struct ccu_nk *nk = hw_to_ccu_nk(hw); in ccu_nk_enable() local
55 return ccu_gate_helper_enable(&nk->common, nk->enable); in ccu_nk_enable()
60 struct ccu_nk *nk = hw_to_ccu_nk(hw); in ccu_nk_is_enabled() local
62 return ccu_gate_helper_is_enabled(&nk->common, nk->enable); in ccu_nk_is_enabled()
68 struct ccu_nk *nk = hw_to_ccu_nk(hw); in ccu_nk_recalc_rate() local
72 reg = readl(nk->common.base + nk->common.reg); in ccu_nk_recalc_rate()
74 n = reg >> nk->n.shift; in ccu_nk_recalc_rate()
75 n &= (1 << nk->n.width) - 1; in ccu_nk_recalc_rate()
76 n += nk->n.offset; in ccu_nk_recalc_rate()
80 k = reg >> nk->k.shift; in ccu_nk_recalc_rate()
81 k &= (1 << nk->k.width) - 1; in ccu_nk_recalc_rate()
82 k += nk->k.offset; in ccu_nk_recalc_rate()
87 if (nk->common.features & CCU_FEATURE_FIXED_POSTDIV) in ccu_nk_recalc_rate()
88 rate /= nk->fixed_post_div; in ccu_nk_recalc_rate()
96 struct ccu_nk *nk = hw_to_ccu_nk(hw); in ccu_nk_round_rate() local
99 if (nk->common.features & CCU_FEATURE_FIXED_POSTDIV) in ccu_nk_round_rate()
100 rate *= nk->fixed_post_div; in ccu_nk_round_rate()
102 _nk.min_n = nk->n.min ?: 1; in ccu_nk_round_rate()
103 _nk.max_n = nk->n.max ?: 1 << nk->n.width; in ccu_nk_round_rate()
104 _nk.min_k = nk->k.min ?: 1; in ccu_nk_round_rate()
105 _nk.max_k = nk->k.max ?: 1 << nk->k.width; in ccu_nk_round_rate()
110 if (nk->common.features & CCU_FEATURE_FIXED_POSTDIV) in ccu_nk_round_rate()
111 rate = rate / nk->fixed_post_div; in ccu_nk_round_rate()
119 struct ccu_nk *nk = hw_to_ccu_nk(hw); in ccu_nk_set_rate() local
124 if (nk->common.features & CCU_FEATURE_FIXED_POSTDIV) in ccu_nk_set_rate()
125 rate = rate * nk->fixed_post_div; in ccu_nk_set_rate()
127 _nk.min_n = nk->n.min ?: 1; in ccu_nk_set_rate()
128 _nk.max_n = nk->n.max ?: 1 << nk->n.width; in ccu_nk_set_rate()
129 _nk.min_k = nk->k.min ?: 1; in ccu_nk_set_rate()
130 _nk.max_k = nk->k.max ?: 1 << nk->k.width; in ccu_nk_set_rate()
134 spin_lock_irqsave(nk->common.lock, flags); in ccu_nk_set_rate()
136 reg = readl(nk->common.base + nk->common.reg); in ccu_nk_set_rate()
137 reg &= ~GENMASK(nk->n.width + nk->n.shift - 1, nk->n.shift); in ccu_nk_set_rate()
138 reg &= ~GENMASK(nk->k.width + nk->k.shift - 1, nk->k.shift); in ccu_nk_set_rate()
140 reg |= (_nk.k - nk->k.offset) << nk->k.shift; in ccu_nk_set_rate()
141 reg |= (_nk.n - nk->n.offset) << nk->n.shift; in ccu_nk_set_rate()
142 writel(reg, nk->common.base + nk->common.reg); in ccu_nk_set_rate()
144 spin_unlock_irqrestore(nk->common.lock, flags); in ccu_nk_set_rate()
146 ccu_helper_wait_for_lock(&nk->common, nk->lock); in ccu_nk_set_rate()