Lines Matching refs:ce

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