Lines Matching refs: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()
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) { in _omap_device_notifier_call()
234 od->_driver_status = BUS_NOTIFY_BIND_DRIVER; in _omap_device_notifier_call()
235 if (od->_state == OMAP_DEVICE_STATE_ENABLED && in _omap_device_notifier_call()
247 od = to_omap_device(pdev); in _omap_device_notifier_call()
248 if (od) in _omap_device_notifier_call()
249 od->_driver_status = event; in _omap_device_notifier_call()
261 static int _omap_device_enable_hwmods(struct omap_device *od) in _omap_device_enable_hwmods() argument
266 for (i = 0; i < od->hwmods_cnt; i++) in _omap_device_enable_hwmods()
267 ret |= omap_hwmod_enable(od->hwmods[i]); in _omap_device_enable_hwmods()
278 static int _omap_device_idle_hwmods(struct omap_device *od) in _omap_device_idle_hwmods() argument
283 for (i = 0; i < od->hwmods_cnt; i++) in _omap_device_idle_hwmods()
284 ret |= omap_hwmod_idle(od->hwmods[i]); in _omap_device_idle_hwmods()
308 struct omap_device *od; in omap_device_get_context_loss_count() local
311 od = to_omap_device(pdev); in omap_device_get_context_loss_count()
313 if (od->hwmods_cnt) in omap_device_get_context_loss_count()
314 ret = omap_hwmod_get_context_loss_count(od->hwmods[0]); in omap_device_get_context_loss_count()
334 struct omap_device *od; in omap_device_alloc() local
338 od = kzalloc(sizeof(struct omap_device), GFP_KERNEL); in omap_device_alloc()
339 if (!od) { in omap_device_alloc()
343 od->hwmods_cnt = oh_cnt; in omap_device_alloc()
349 od->hwmods = hwmods; in omap_device_alloc()
350 od->pdev = pdev; in omap_device_alloc()
351 pdev->archdata.od = od; in omap_device_alloc()
354 hwmods[i]->od = od; in omap_device_alloc()
355 _add_hwmod_clocks_clkdev(od, hwmods[i]); in omap_device_alloc()
358 return od; in omap_device_alloc()
361 kfree(od); in omap_device_alloc()
368 void omap_device_delete(struct omap_device *od) in omap_device_delete() argument
370 if (!od) in omap_device_delete()
373 od->pdev->archdata.od = NULL; in omap_device_delete()
374 kfree(od->hwmods); in omap_device_delete()
375 kfree(od); in omap_device_delete()
423 struct omap_device *od = to_omap_device(pdev); in _od_suspend_noirq() local
427 if (od->_driver_status != BUS_NOTIFY_BOUND_DRIVER) in _od_suspend_noirq()
435 od->flags |= OMAP_DEVICE_SUSPENDED; in _od_suspend_noirq()
445 struct omap_device *od = to_omap_device(pdev); in _od_resume_noirq() local
447 if (od->flags & OMAP_DEVICE_SUSPENDED) { in _od_resume_noirq()
448 od->flags &= ~OMAP_DEVICE_SUSPENDED; in _od_resume_noirq()
511 struct omap_device *od; in omap_device_enable() local
513 od = to_omap_device(pdev); in omap_device_enable()
515 if (od->_state == OMAP_DEVICE_STATE_ENABLED) { in omap_device_enable()
518 __func__, od->_state); in omap_device_enable()
522 ret = _omap_device_enable_hwmods(od); in omap_device_enable()
525 od->_state = OMAP_DEVICE_STATE_ENABLED; in omap_device_enable()
542 struct omap_device *od; in omap_device_idle() local
544 od = to_omap_device(pdev); in omap_device_idle()
546 if (od->_state != OMAP_DEVICE_STATE_ENABLED) { in omap_device_idle()
549 __func__, od->_state); in omap_device_idle()
553 ret = _omap_device_idle_hwmods(od); in omap_device_idle()
556 od->_state = OMAP_DEVICE_STATE_IDLE; in omap_device_idle()
575 struct omap_device *od = to_omap_device(pdev); in omap_device_assert_hardreset() local
579 for (i = 0; i < od->hwmods_cnt; i++) { in omap_device_assert_hardreset()
580 ret = omap_hwmod_assert_hardreset(od->hwmods[i], name); in omap_device_assert_hardreset()
603 struct omap_device *od = to_omap_device(pdev); in omap_device_deassert_hardreset() local
607 for (i = 0; i < od->hwmods_cnt; i++) { in omap_device_deassert_hardreset()
608 ret = omap_hwmod_deassert_hardreset(od->hwmods[i], name); in omap_device_deassert_hardreset()
639 if (!oh->od) { in omap_device_get_by_hwmod_name()
645 return &oh->od->pdev->dev; in omap_device_get_by_hwmod_name()
670 struct omap_device *od = to_omap_device(pdev); in omap_device_late_idle() local
673 if (!od) in omap_device_late_idle()
685 for (i = 0; i < od->hwmods_cnt; i++) in omap_device_late_idle()
686 if (od->hwmods[i]->flags & HWMOD_INIT_NO_IDLE) in omap_device_late_idle()
689 if (od->_driver_status != BUS_NOTIFY_BOUND_DRIVER && in omap_device_late_idle()
690 od->_driver_status != BUS_NOTIFY_BIND_DRIVER) { in omap_device_late_idle()
691 if (od->_state == OMAP_DEVICE_STATE_ENABLED) { in omap_device_late_idle()