Lines Matching refs:nk
22 struct _ccu_nk *nk) in ccu_nk_find_best() argument
28 for (_k = nk->min_k; _k <= nk->max_k; _k++) { in ccu_nk_find_best()
29 for (_n = nk->min_n; _n <= nk->max_n; _n++) { in ccu_nk_find_best()
43 nk->k = best_k; in ccu_nk_find_best()
44 nk->n = best_n; in ccu_nk_find_best()
49 struct ccu_nk *nk = hw_to_ccu_nk(hw); in ccu_nk_disable() local
51 return ccu_gate_helper_disable(&nk->common, nk->enable); in ccu_nk_disable()
56 struct ccu_nk *nk = hw_to_ccu_nk(hw); in ccu_nk_enable() local
58 return ccu_gate_helper_enable(&nk->common, nk->enable); in ccu_nk_enable()
63 struct ccu_nk *nk = hw_to_ccu_nk(hw); in ccu_nk_is_enabled() local
65 return ccu_gate_helper_is_enabled(&nk->common, nk->enable); in ccu_nk_is_enabled()
71 struct ccu_nk *nk = hw_to_ccu_nk(hw); in ccu_nk_recalc_rate() local
75 reg = readl(nk->common.base + nk->common.reg); in ccu_nk_recalc_rate()
77 n = reg >> nk->n.shift; in ccu_nk_recalc_rate()
78 n &= (1 << nk->n.width) - 1; in ccu_nk_recalc_rate()
79 n += nk->n.offset; in ccu_nk_recalc_rate()
83 k = reg >> nk->k.shift; in ccu_nk_recalc_rate()
84 k &= (1 << nk->k.width) - 1; in ccu_nk_recalc_rate()
85 k += nk->k.offset; in ccu_nk_recalc_rate()
90 if (nk->common.features & CCU_FEATURE_FIXED_POSTDIV) in ccu_nk_recalc_rate()
91 rate /= nk->fixed_post_div; in ccu_nk_recalc_rate()
99 struct ccu_nk *nk = hw_to_ccu_nk(hw); in ccu_nk_round_rate() local
102 if (nk->common.features & CCU_FEATURE_FIXED_POSTDIV) in ccu_nk_round_rate()
103 rate *= nk->fixed_post_div; in ccu_nk_round_rate()
105 _nk.min_n = nk->n.min ?: 1; in ccu_nk_round_rate()
106 _nk.max_n = nk->n.max ?: 1 << nk->n.width; in ccu_nk_round_rate()
107 _nk.min_k = nk->k.min ?: 1; in ccu_nk_round_rate()
108 _nk.max_k = nk->k.max ?: 1 << nk->k.width; in ccu_nk_round_rate()
113 if (nk->common.features & CCU_FEATURE_FIXED_POSTDIV) in ccu_nk_round_rate()
114 rate = rate / nk->fixed_post_div; in ccu_nk_round_rate()
122 struct ccu_nk *nk = hw_to_ccu_nk(hw); in ccu_nk_set_rate() local
127 if (nk->common.features & CCU_FEATURE_FIXED_POSTDIV) in ccu_nk_set_rate()
128 rate = rate * nk->fixed_post_div; in ccu_nk_set_rate()
130 _nk.min_n = nk->n.min ?: 1; in ccu_nk_set_rate()
131 _nk.max_n = nk->n.max ?: 1 << nk->n.width; in ccu_nk_set_rate()
132 _nk.min_k = nk->k.min ?: 1; in ccu_nk_set_rate()
133 _nk.max_k = nk->k.max ?: 1 << nk->k.width; in ccu_nk_set_rate()
137 spin_lock_irqsave(nk->common.lock, flags); in ccu_nk_set_rate()
139 reg = readl(nk->common.base + nk->common.reg); in ccu_nk_set_rate()
140 reg &= ~GENMASK(nk->n.width + nk->n.shift - 1, nk->n.shift); in ccu_nk_set_rate()
141 reg &= ~GENMASK(nk->k.width + nk->k.shift - 1, nk->k.shift); in ccu_nk_set_rate()
143 reg |= (_nk.k - nk->k.offset) << nk->k.shift; in ccu_nk_set_rate()
144 reg |= (_nk.n - nk->n.offset) << nk->n.shift; in ccu_nk_set_rate()
145 writel(reg, nk->common.base + nk->common.reg); in ccu_nk_set_rate()
147 spin_unlock_irqrestore(nk->common.lock, flags); in ccu_nk_set_rate()
149 ccu_helper_wait_for_lock(&nk->common, nk->lock); in ccu_nk_set_rate()