Lines Matching full:od

44 static void _add_clkdev(struct omap_device *od, const char *clk_alias,  in _add_clkdev()  argument
53 dev_dbg(&od->pdev->dev, "Creating %s -> %s\n", clk_alias, clk_name); in _add_clkdev()
55 r = clk_get_sys(dev_name(&od->pdev->dev), clk_alias); in _add_clkdev()
57 dev_dbg(&od->pdev->dev, in _add_clkdev()
73 dev_name(&od->pdev->dev)); in _add_clkdev()
75 rc = clk_add_alias(clk_alias, dev_name(&od->pdev->dev), in _add_clkdev()
81 dev_err(&od->pdev->dev, in _add_clkdev()
84 dev_err(&od->pdev->dev, in _add_clkdev()
92 * @od: struct omap_device *od
108 static void _add_hwmod_clocks_clkdev(struct omap_device *od, in _add_hwmod_clocks_clkdev() argument
113 _add_clkdev(od, "fck", oh->main_clk); in _add_hwmod_clocks_clkdev()
116 _add_clkdev(od, oh->opt_clks[i].role, oh->opt_clks[i].clk); in _add_hwmod_clocks_clkdev()
131 struct omap_device *od; in omap_device_build_from_dt() local
176 od = omap_device_alloc(pdev, hwmods, oh_cnt); in omap_device_build_from_dt()
177 if (IS_ERR(od)) { in omap_device_build_from_dt()
180 ret = PTR_ERR(od); in omap_device_build_from_dt()
214 struct omap_device *od; in _omap_device_notifier_call() local
219 if (pdev->archdata.od) in _omap_device_notifier_call()
220 omap_device_delete(pdev->archdata.od); in _omap_device_notifier_call()
223 od = to_omap_device(pdev); in _omap_device_notifier_call()
224 if (od && (od->_state == OMAP_DEVICE_STATE_ENABLED)) { in _omap_device_notifier_call()
232 od = to_omap_device(pdev); in _omap_device_notifier_call()
233 if (od && (od->_state == OMAP_DEVICE_STATE_ENABLED) && in _omap_device_notifier_call()
235 od->_driver_status = BUS_NOTIFY_BIND_DRIVER; in _omap_device_notifier_call()
245 od = to_omap_device(pdev); in _omap_device_notifier_call()
246 if (od) in _omap_device_notifier_call()
247 od->_driver_status = event; in _omap_device_notifier_call()
255 * @od: struct omap_device *od
259 static int _omap_device_enable_hwmods(struct omap_device *od) in _omap_device_enable_hwmods() argument
264 for (i = 0; i < od->hwmods_cnt; i++) in _omap_device_enable_hwmods()
265 ret |= omap_hwmod_enable(od->hwmods[i]); in _omap_device_enable_hwmods()
272 * @od: struct omap_device *od
276 static int _omap_device_idle_hwmods(struct omap_device *od) in _omap_device_idle_hwmods() argument
281 for (i = 0; i < od->hwmods_cnt; i++) in _omap_device_idle_hwmods()
282 ret |= omap_hwmod_idle(od->hwmods[i]); in _omap_device_idle_hwmods()
306 struct omap_device *od; in omap_device_get_context_loss_count() local
309 od = to_omap_device(pdev); in omap_device_get_context_loss_count()
311 if (od->hwmods_cnt) in omap_device_get_context_loss_count()
312 ret = omap_hwmod_get_context_loss_count(od->hwmods[0]); in omap_device_get_context_loss_count()
332 struct omap_device *od; in omap_device_alloc() local
336 od = kzalloc(sizeof(struct omap_device), GFP_KERNEL); in omap_device_alloc()
337 if (!od) { in omap_device_alloc()
341 od->hwmods_cnt = oh_cnt; in omap_device_alloc()
347 od->hwmods = hwmods; in omap_device_alloc()
348 od->pdev = pdev; in omap_device_alloc()
349 pdev->archdata.od = od; in omap_device_alloc()
352 hwmods[i]->od = od; in omap_device_alloc()
353 _add_hwmod_clocks_clkdev(od, hwmods[i]); in omap_device_alloc()
356 return od; in omap_device_alloc()
359 kfree(od); in omap_device_alloc()
366 void omap_device_delete(struct omap_device *od) in omap_device_delete() argument
368 if (!od) in omap_device_delete()
371 od->pdev->archdata.od = NULL; in omap_device_delete()
372 kfree(od->hwmods); in omap_device_delete()
373 kfree(od); in omap_device_delete()
421 struct omap_device *od = to_omap_device(pdev); in _od_suspend_noirq() local
425 if (od->_driver_status != BUS_NOTIFY_BOUND_DRIVER) in _od_suspend_noirq()
433 od->flags |= OMAP_DEVICE_SUSPENDED; in _od_suspend_noirq()
443 struct omap_device *od = to_omap_device(pdev); in _od_resume_noirq() local
445 if (od->flags & OMAP_DEVICE_SUSPENDED) { in _od_resume_noirq()
446 od->flags &= ~OMAP_DEVICE_SUSPENDED; in _od_resume_noirq()
498 * Do whatever is necessary for the hwmods underlying omap_device @od
509 struct omap_device *od; in omap_device_enable() local
511 od = to_omap_device(pdev); in omap_device_enable()
513 if (od->_state == OMAP_DEVICE_STATE_ENABLED) { in omap_device_enable()
516 __func__, od->_state); in omap_device_enable()
520 ret = _omap_device_enable_hwmods(od); in omap_device_enable()
523 od->_state = OMAP_DEVICE_STATE_ENABLED; in omap_device_enable()
532 * Idle omap_device @od. Device drivers call this function indirectly
540 struct omap_device *od; in omap_device_idle() local
542 od = to_omap_device(pdev); in omap_device_idle()
544 if (od->_state != OMAP_DEVICE_STATE_ENABLED) { in omap_device_idle()
547 __func__, od->_state); in omap_device_idle()
551 ret = _omap_device_idle_hwmods(od); in omap_device_idle()
554 od->_state = OMAP_DEVICE_STATE_IDLE; in omap_device_idle()
573 struct omap_device *od = to_omap_device(pdev); in omap_device_assert_hardreset() local
577 for (i = 0; i < od->hwmods_cnt; i++) { in omap_device_assert_hardreset()
578 ret = omap_hwmod_assert_hardreset(od->hwmods[i], name); in omap_device_assert_hardreset()
601 struct omap_device *od = to_omap_device(pdev); in omap_device_deassert_hardreset() local
605 for (i = 0; i < od->hwmods_cnt; i++) { in omap_device_deassert_hardreset()
606 ret = omap_hwmod_deassert_hardreset(od->hwmods[i], name); in omap_device_deassert_hardreset()
637 if (!oh->od) { in omap_device_get_by_hwmod_name()
643 return &oh->od->pdev->dev; in omap_device_get_by_hwmod_name()
668 struct omap_device *od = to_omap_device(pdev); in omap_device_late_idle() local
671 if (!od) in omap_device_late_idle()
683 for (i = 0; i < od->hwmods_cnt; i++) in omap_device_late_idle()
684 if (od->hwmods[i]->flags & HWMOD_INIT_NO_IDLE) in omap_device_late_idle()
687 if (od->_driver_status != BUS_NOTIFY_BOUND_DRIVER && in omap_device_late_idle()
688 od->_driver_status != BUS_NOTIFY_BIND_DRIVER) { in omap_device_late_idle()
689 if (od->_state == OMAP_DEVICE_STATE_ENABLED) { in omap_device_late_idle()