Lines Matching refs:ce
147 static inline void __pm_clk_enable(struct device *dev, struct pm_clock_entry *ce) in __pm_clk_enable() argument
151 switch (ce->status) { in __pm_clk_enable()
153 ret = clk_prepare_enable(ce->clk); in __pm_clk_enable()
156 ret = clk_enable(ce->clk); in __pm_clk_enable()
162 ce->status = PCE_STATUS_ENABLED; in __pm_clk_enable()
165 __func__, ce->clk, ret); in __pm_clk_enable()
173 static void pm_clk_acquire(struct device *dev, struct pm_clock_entry *ce) in pm_clk_acquire() argument
175 if (!ce->clk) in pm_clk_acquire()
176 ce->clk = clk_get(dev, ce->con_id); in pm_clk_acquire()
177 if (IS_ERR(ce->clk)) { in pm_clk_acquire()
178 ce->status = PCE_STATUS_ERROR; in pm_clk_acquire()
180 } else if (clk_is_enabled_when_prepared(ce->clk)) { in pm_clk_acquire()
182 ce->status = PCE_STATUS_ACQUIRED; in pm_clk_acquire()
183 ce->enabled_when_prepared = true; in pm_clk_acquire()
184 } else if (clk_prepare(ce->clk)) { in pm_clk_acquire()
185 ce->status = PCE_STATUS_ERROR; in pm_clk_acquire()
189 ce->status = PCE_STATUS_PREPARED; in pm_clk_acquire()
192 ce->clk, ce->con_id); in pm_clk_acquire()
199 struct pm_clock_entry *ce; in __pm_clk_add() local
204 ce = kzalloc(sizeof(*ce), GFP_KERNEL); in __pm_clk_add()
205 if (!ce) in __pm_clk_add()
209 ce->con_id = kstrdup(con_id, GFP_KERNEL); in __pm_clk_add()
210 if (!ce->con_id) { in __pm_clk_add()
211 kfree(ce); in __pm_clk_add()
216 kfree(ce); in __pm_clk_add()
219 ce->clk = clk; in __pm_clk_add()
222 pm_clk_acquire(dev, ce); in __pm_clk_add()
225 list_add_tail(&ce->node, &psd->clock_list); in __pm_clk_add()
226 if (ce->enabled_when_prepared) in __pm_clk_add()
354 static void __pm_clk_remove(struct pm_clock_entry *ce) in __pm_clk_remove() argument
356 if (!ce) in __pm_clk_remove()
359 switch (ce->status) { in __pm_clk_remove()
361 clk_disable(ce->clk); in __pm_clk_remove()
364 clk_unprepare(ce->clk); in __pm_clk_remove()
368 if (!IS_ERR(ce->clk)) in __pm_clk_remove()
369 clk_put(ce->clk); in __pm_clk_remove()
375 kfree(ce->con_id); in __pm_clk_remove()
376 kfree(ce); in __pm_clk_remove()
390 struct pm_clock_entry *ce; in pm_clk_remove() local
397 list_for_each_entry(ce, &psd->clock_list, node) { in pm_clk_remove()
398 if (!con_id && !ce->con_id) in pm_clk_remove()
400 else if (!con_id || !ce->con_id) in pm_clk_remove()
402 else if (!strcmp(con_id, ce->con_id)) in pm_clk_remove()
410 list_del(&ce->node); in pm_clk_remove()
411 if (ce->enabled_when_prepared) in pm_clk_remove()
415 __pm_clk_remove(ce); in pm_clk_remove()
430 struct pm_clock_entry *ce; in pm_clk_remove_clk() local
437 list_for_each_entry(ce, &psd->clock_list, node) { in pm_clk_remove_clk()
438 if (clk == ce->clk) in pm_clk_remove_clk()
446 list_del(&ce->node); in pm_clk_remove_clk()
447 if (ce->enabled_when_prepared) in pm_clk_remove_clk()
451 __pm_clk_remove(ce); in pm_clk_remove_clk()
497 struct pm_clock_entry *ce, *c; in pm_clk_destroy() local
507 list_for_each_entry_safe_reverse(ce, c, &psd->clock_list, node) in pm_clk_destroy()
508 list_move(&ce->node, &list); in pm_clk_destroy()
515 list_for_each_entry_safe_reverse(ce, c, &list, node) { in pm_clk_destroy()
516 list_del(&ce->node); in pm_clk_destroy()
517 __pm_clk_remove(ce); in pm_clk_destroy()
546 struct pm_clock_entry *ce; in pm_clk_suspend() local
559 list_for_each_entry_reverse(ce, &psd->clock_list, node) { in pm_clk_suspend()
560 if (ce->status == PCE_STATUS_ENABLED) { in pm_clk_suspend()
561 if (ce->enabled_when_prepared) { in pm_clk_suspend()
562 clk_disable_unprepare(ce->clk); in pm_clk_suspend()
563 ce->status = PCE_STATUS_ACQUIRED; in pm_clk_suspend()
565 clk_disable(ce->clk); in pm_clk_suspend()
566 ce->status = PCE_STATUS_PREPARED; in pm_clk_suspend()
584 struct pm_clock_entry *ce; in pm_clk_resume() local
597 list_for_each_entry(ce, &psd->clock_list, node) in pm_clk_resume()
598 __pm_clk_enable(dev, ce); in pm_clk_resume()