Lines Matching defs:nk
19 struct _ccu_nk *nk)
25 for (_k = nk->min_k; _k <= nk->max_k; _k++) {
26 for (_n = nk->min_n; _n <= nk->max_n; _n++) {
40 nk->k = best_k;
41 nk->n = best_n;
48 struct ccu_nk *nk = hw_to_ccu_nk(hw);
50 return ccu_gate_helper_disable(&nk->common, nk->enable);
55 struct ccu_nk *nk = hw_to_ccu_nk(hw);
57 return ccu_gate_helper_enable(&nk->common, nk->enable);
62 struct ccu_nk *nk = hw_to_ccu_nk(hw);
64 return ccu_gate_helper_is_enabled(&nk->common, nk->enable);
70 struct ccu_nk *nk = hw_to_ccu_nk(hw);
74 reg = readl(nk->common.base + nk->common.reg);
76 n = reg >> nk->n.shift;
77 n &= (1 << nk->n.width) - 1;
78 n += nk->n.offset;
82 k = reg >> nk->k.shift;
83 k &= (1 << nk->k.width) - 1;
84 k += nk->k.offset;
89 if (nk->common.features & CCU_FEATURE_FIXED_POSTDIV)
90 rate /= nk->fixed_post_div;
98 struct ccu_nk *nk = hw_to_ccu_nk(hw);
101 if (nk->common.features & CCU_FEATURE_FIXED_POSTDIV)
102 rate *= nk->fixed_post_div;
104 _nk.min_n = nk->n.min ?: 1;
105 _nk.max_n = nk->n.max ?: 1 << nk->n.width;
106 _nk.min_k = nk->k.min ?: 1;
107 _nk.max_k = nk->k.max ?: 1 << nk->k.width;
111 if (nk->common.features & CCU_FEATURE_FIXED_POSTDIV)
112 rate = rate / nk->fixed_post_div;
120 struct ccu_nk *nk = hw_to_ccu_nk(hw);
125 if (nk->common.features & CCU_FEATURE_FIXED_POSTDIV)
126 rate = rate * nk->fixed_post_div;
128 _nk.min_n = nk->n.min ?: 1;
129 _nk.max_n = nk->n.max ?: 1 << nk->n.width;
130 _nk.min_k = nk->k.min ?: 1;
131 _nk.max_k = nk->k.max ?: 1 << nk->k.width;
135 spin_lock_irqsave(nk->common.lock, flags);
137 reg = readl(nk->common.base + nk->common.reg);
138 reg &= ~GENMASK(nk->n.width + nk->n.shift - 1, nk->n.shift);
139 reg &= ~GENMASK(nk->k.width + nk->k.shift - 1, nk->k.shift);
141 reg |= (_nk.k - nk->k.offset) << nk->k.shift;
142 reg |= (_nk.n - nk->n.offset) << nk->n.shift;
143 writel(reg, nk->common.base + nk->common.reg);
145 spin_unlock_irqrestore(nk->common.lock, flags);
147 ccu_helper_wait_for_lock(&nk->common, nk->lock);