Lines Matching full:od
49 static void _add_clkdev(struct omap_device *od, const char *clk_alias, in _add_clkdev() argument
58 dev_dbg(&od->pdev->dev, "Creating %s -> %s\n", clk_alias, clk_name); in _add_clkdev()
60 r = clk_get_sys(dev_name(&od->pdev->dev), clk_alias); in _add_clkdev()
62 dev_dbg(&od->pdev->dev, in _add_clkdev()
78 dev_name(&od->pdev->dev)); in _add_clkdev()
80 rc = clk_add_alias(clk_alias, dev_name(&od->pdev->dev), in _add_clkdev()
86 dev_err(&od->pdev->dev, in _add_clkdev()
89 dev_err(&od->pdev->dev, in _add_clkdev()
97 * @od: struct omap_device *od
113 static void _add_hwmod_clocks_clkdev(struct omap_device *od, in _add_hwmod_clocks_clkdev() argument
118 _add_clkdev(od, "fck", oh->main_clk); in _add_hwmod_clocks_clkdev()
121 _add_clkdev(od, oh->opt_clks[i].role, oh->opt_clks[i].clk); in _add_hwmod_clocks_clkdev()
140 struct omap_device *od; in omap_device_build_from_dt() local
185 od = omap_device_alloc(pdev, hwmods, oh_cnt); in omap_device_build_from_dt()
186 if (IS_ERR(od)) { in omap_device_build_from_dt()
189 ret = PTR_ERR(od); in omap_device_build_from_dt()
223 struct omap_device *od; in _omap_device_notifier_call() local
228 if (pdev->archdata.od) in _omap_device_notifier_call()
229 omap_device_delete(pdev->archdata.od); 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()
241 od = to_omap_device(pdev); in _omap_device_notifier_call()
242 if (od && (od->_state == OMAP_DEVICE_STATE_ENABLED) && in _omap_device_notifier_call()
244 od->_driver_status = BUS_NOTIFY_BIND_DRIVER; in _omap_device_notifier_call()
254 od = to_omap_device(pdev); in _omap_device_notifier_call()
255 if (od) in _omap_device_notifier_call()
256 od->_driver_status = event; in _omap_device_notifier_call()
264 * @od: struct omap_device *od
268 static int _omap_device_enable_hwmods(struct omap_device *od) in _omap_device_enable_hwmods() argument
273 for (i = 0; i < od->hwmods_cnt; i++) in _omap_device_enable_hwmods()
274 ret |= omap_hwmod_enable(od->hwmods[i]); in _omap_device_enable_hwmods()
281 * @od: struct omap_device *od
285 static int _omap_device_idle_hwmods(struct omap_device *od) in _omap_device_idle_hwmods() argument
290 for (i = 0; i < od->hwmods_cnt; i++) in _omap_device_idle_hwmods()
291 ret |= omap_hwmod_idle(od->hwmods[i]); in _omap_device_idle_hwmods()
300 * @od: struct omap_device *
315 struct omap_device *od; in omap_device_get_context_loss_count() local
318 od = to_omap_device(pdev); in omap_device_get_context_loss_count()
320 if (od->hwmods_cnt) in omap_device_get_context_loss_count()
321 ret = omap_hwmod_get_context_loss_count(od->hwmods[0]); in omap_device_get_context_loss_count()
342 struct omap_device *od; in omap_device_alloc() local
346 od = kzalloc(sizeof(struct omap_device), GFP_KERNEL); in omap_device_alloc()
347 if (!od) { in omap_device_alloc()
351 od->hwmods_cnt = oh_cnt; in omap_device_alloc()
357 od->hwmods = hwmods; in omap_device_alloc()
358 od->pdev = pdev; in omap_device_alloc()
359 pdev->archdata.od = od; in omap_device_alloc()
362 hwmods[i]->od = od; in omap_device_alloc()
363 _add_hwmod_clocks_clkdev(od, hwmods[i]); in omap_device_alloc()
366 return od; in omap_device_alloc()
369 kfree(od); in omap_device_alloc()
376 void omap_device_delete(struct omap_device *od) in omap_device_delete() argument
378 if (!od) in omap_device_delete()
381 od->pdev->archdata.od = NULL; in omap_device_delete()
382 kfree(od->hwmods); in omap_device_delete()
383 kfree(od); in omap_device_delete()
407 if (!oh || !oh->od || !oh->od->pdev) in omap_device_copy_resources()
410 np = oh->od->pdev->dev.of_node; in omap_device_copy_resources()
492 struct omap_device *od; in omap_device_build() local
521 * Must be called before omap_device_alloc() as oh->od in omap_device_build()
529 od = omap_device_alloc(pdev, &oh, 1); in omap_device_build()
530 if (IS_ERR(od)) { in omap_device_build()
531 ret = PTR_ERR(od); in omap_device_build()
546 omap_device_delete(od); in omap_device_build()
601 struct omap_device *od = to_omap_device(pdev); in _od_suspend_noirq() local
605 if (od->_driver_status != BUS_NOTIFY_BOUND_DRIVER) in _od_suspend_noirq()
613 od->flags |= OMAP_DEVICE_SUSPENDED; in _od_suspend_noirq()
623 struct omap_device *od = to_omap_device(pdev); in _od_resume_noirq() local
625 if (od->flags & OMAP_DEVICE_SUSPENDED) { in _od_resume_noirq()
626 od->flags &= ~OMAP_DEVICE_SUSPENDED; in _od_resume_noirq()
657 * @od: struct omap_device * to register
676 * @od: struct omap_device * to activate
678 * Do whatever is necessary for the hwmods underlying omap_device @od
689 struct omap_device *od; in omap_device_enable() local
691 od = to_omap_device(pdev); in omap_device_enable()
693 if (od->_state == OMAP_DEVICE_STATE_ENABLED) { in omap_device_enable()
696 __func__, od->_state); in omap_device_enable()
700 ret = _omap_device_enable_hwmods(od); in omap_device_enable()
703 od->_state = OMAP_DEVICE_STATE_ENABLED; in omap_device_enable()
710 * @od: struct omap_device * to idle
712 * Idle omap_device @od. Device drivers call this function indirectly
720 struct omap_device *od; in omap_device_idle() local
722 od = to_omap_device(pdev); in omap_device_idle()
724 if (od->_state != OMAP_DEVICE_STATE_ENABLED) { in omap_device_idle()
727 __func__, od->_state); in omap_device_idle()
731 ret = _omap_device_idle_hwmods(od); in omap_device_idle()
734 od->_state = OMAP_DEVICE_STATE_IDLE; in omap_device_idle()
753 struct omap_device *od = to_omap_device(pdev); in omap_device_assert_hardreset() local
757 for (i = 0; i < od->hwmods_cnt; i++) { in omap_device_assert_hardreset()
758 ret = omap_hwmod_assert_hardreset(od->hwmods[i], name); in omap_device_assert_hardreset()
781 struct omap_device *od = to_omap_device(pdev); in omap_device_deassert_hardreset() local
785 for (i = 0; i < od->hwmods_cnt; i++) { in omap_device_deassert_hardreset()
786 ret = omap_hwmod_deassert_hardreset(od->hwmods[i], name); in omap_device_deassert_hardreset()
817 if (!oh->od) { in omap_device_get_by_hwmod_name()
823 return &oh->od->pdev->dev; in omap_device_get_by_hwmod_name()
848 struct omap_device *od = to_omap_device(pdev); in omap_device_late_idle() local
851 if (!od) in omap_device_late_idle()
863 for (i = 0; i < od->hwmods_cnt; i++) in omap_device_late_idle()
864 if (od->hwmods[i]->flags & HWMOD_INIT_NO_IDLE) in omap_device_late_idle()
867 if (od->_driver_status != BUS_NOTIFY_BOUND_DRIVER && in omap_device_late_idle()
868 od->_driver_status != BUS_NOTIFY_BIND_DRIVER) { in omap_device_late_idle()
869 if (od->_state == OMAP_DEVICE_STATE_ENABLED) { in omap_device_late_idle()