Lines Matching +full:autoidle +full:- +full:shift

1 // SPDX-License-Identifier: GPL-2.0-only
3 * TI clock autoidle support
7 * Tero Kristo <t-kristo@ti.com>
10 #include <linux/clk-provider.h>
21 u8 shift; member
32 * we have some non-atomic read/write
34 * take one lock for handling autoidle
41 if (clk->ops && clk->ops->deny_idle) { in _omap2_clk_deny_idle()
45 clk->autoidle_count++; in _omap2_clk_deny_idle()
46 if (clk->autoidle_count == 1) in _omap2_clk_deny_idle()
47 clk->ops->deny_idle(clk); in _omap2_clk_deny_idle()
56 if (clk->ops && clk->ops->allow_idle) { in _omap2_clk_allow_idle()
60 clk->autoidle_count--; in _omap2_clk_allow_idle()
61 if (clk->autoidle_count == 0) in _omap2_clk_allow_idle()
62 clk->ops->allow_idle(clk); in _omap2_clk_allow_idle()
70 * omap2_clk_deny_idle - disable autoidle on an OMAP clock
71 * @clk: struct clk * to disable autoidle for
73 * Disable autoidle on an OMAP clock.
80 return -EINVAL; in omap2_clk_deny_idle()
90 return -EINVAL; in omap2_clk_deny_idle()
94 * omap2_clk_allow_idle - enable autoidle on an OMAP clock
95 * @clk: struct clk * to enable autoidle for
97 * Enable autoidle on an OMAP clock.
104 return -EINVAL; in omap2_clk_allow_idle()
114 return -EINVAL; in omap2_clk_allow_idle()
121 val = ti_clk_ll_ops->clk_readl(&clk->reg); in _allow_autoidle()
123 if (clk->flags & AUTOIDLE_LOW) in _allow_autoidle()
124 val &= ~(1 << clk->shift); in _allow_autoidle()
126 val |= (1 << clk->shift); in _allow_autoidle()
128 ti_clk_ll_ops->clk_writel(val, &clk->reg); in _allow_autoidle()
135 val = ti_clk_ll_ops->clk_readl(&clk->reg); in _deny_autoidle()
137 if (clk->flags & AUTOIDLE_LOW) in _deny_autoidle()
138 val |= (1 << clk->shift); in _deny_autoidle()
140 val &= ~(1 << clk->shift); in _deny_autoidle()
142 ti_clk_ll_ops->clk_writel(val, &clk->reg); in _deny_autoidle()
146 * _clk_generic_allow_autoidle_all - enable autoidle for all clocks
148 * Enables hardware autoidle for all registered DT clocks, which have
160 * _clk_generic_deny_autoidle_all - disable autoidle for all clocks
162 * Disables hardware autoidle for all registered DT clocks, which have
174 * of_ti_clk_autoidle_setup - sets up hardware autoidle for a clock
177 * Checks if a clock has hardware autoidle support or not (check
178 * for presence of 'ti,autoidle-shift' property in the device tree
179 * node) and sets up the hardware autoidle feature for the clock
180 * if available. If autoidle is available, the clock is also added
181 * to the autoidle list for later processing. Returns 0 on success,
186 u32 shift; in of_ti_clk_autoidle_setup() local
190 /* Check if this clock has autoidle support or not */ in of_ti_clk_autoidle_setup()
191 if (of_property_read_u32(node, "ti,autoidle-shift", &shift)) in of_ti_clk_autoidle_setup()
197 return -ENOMEM; in of_ti_clk_autoidle_setup()
199 clk->shift = shift; in of_ti_clk_autoidle_setup()
200 clk->name = ti_dt_clk_name(node); in of_ti_clk_autoidle_setup()
201 ret = ti_clk_get_reg_addr(node, 0, &clk->reg); in of_ti_clk_autoidle_setup()
207 if (of_property_read_bool(node, "ti,invert-autoidle-bit")) in of_ti_clk_autoidle_setup()
208 clk->flags |= AUTOIDLE_LOW; in of_ti_clk_autoidle_setup()
210 list_add(&clk->node, &autoidle_clks); in of_ti_clk_autoidle_setup()
216 * omap2_clk_enable_autoidle_all - enable autoidle on all OMAP clocks that
219 * Enable clock autoidle on all OMAP clocks that have allow_idle
238 * omap2_clk_disable_autoidle_all - disable autoidle on all OMAP clocks that
241 * Disable clock autoidle on all OMAP clocks that have allow_idle