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()
342 od->hwmods_cnt = oh_cnt; in omap_device_alloc()
348 od->hwmods = hwmods; in omap_device_alloc()
349 od->pdev = pdev; in omap_device_alloc()
350 pdev->archdata.od = od; in omap_device_alloc()
353 hwmods[i]->od = od; in omap_device_alloc()
354 _add_hwmod_clocks_clkdev(od, hwmods[i]); in omap_device_alloc()
357 return od; in omap_device_alloc()
360 kfree(od); in omap_device_alloc()
367 void omap_device_delete(struct omap_device *od) in omap_device_delete() argument
369 if (!od) in omap_device_delete()
372 od->pdev->archdata.od = NULL; in omap_device_delete()
373 kfree(od->hwmods); in omap_device_delete()
374 kfree(od); in omap_device_delete()
422 struct omap_device *od = to_omap_device(pdev); in _od_suspend_noirq() local
426 if (od->_driver_status != BUS_NOTIFY_BOUND_DRIVER) in _od_suspend_noirq()
434 od->flags |= OMAP_DEVICE_SUSPENDED; in _od_suspend_noirq()
444 struct omap_device *od = to_omap_device(pdev); in _od_resume_noirq() local
446 if (od->flags & OMAP_DEVICE_SUSPENDED) { in _od_resume_noirq()
447 od->flags &= ~OMAP_DEVICE_SUSPENDED; in _od_resume_noirq()
510 struct omap_device *od; in omap_device_enable() local
512 od = to_omap_device(pdev); in omap_device_enable()
514 if (od->_state == OMAP_DEVICE_STATE_ENABLED) { in omap_device_enable()
517 __func__, od->_state); in omap_device_enable()
521 ret = _omap_device_enable_hwmods(od); in omap_device_enable()
524 od->_state = OMAP_DEVICE_STATE_ENABLED; in omap_device_enable()
541 struct omap_device *od; in omap_device_idle() local
543 od = to_omap_device(pdev); in omap_device_idle()
545 if (od->_state != OMAP_DEVICE_STATE_ENABLED) { in omap_device_idle()
548 __func__, od->_state); in omap_device_idle()
552 ret = _omap_device_idle_hwmods(od); in omap_device_idle()
555 od->_state = OMAP_DEVICE_STATE_IDLE; in omap_device_idle()
574 struct omap_device *od = to_omap_device(pdev); in omap_device_assert_hardreset() local
578 for (i = 0; i < od->hwmods_cnt; i++) { in omap_device_assert_hardreset()
579 ret = omap_hwmod_assert_hardreset(od->hwmods[i], name); in omap_device_assert_hardreset()
602 struct omap_device *od = to_omap_device(pdev); in omap_device_deassert_hardreset() local
606 for (i = 0; i < od->hwmods_cnt; i++) { in omap_device_deassert_hardreset()
607 ret = omap_hwmod_deassert_hardreset(od->hwmods[i], name); in omap_device_deassert_hardreset()
638 if (!oh->od) { in omap_device_get_by_hwmod_name()
644 return &oh->od->pdev->dev; in omap_device_get_by_hwmod_name()
669 struct omap_device *od = to_omap_device(pdev); in omap_device_late_idle() local
672 if (!od) in omap_device_late_idle()
684 for (i = 0; i < od->hwmods_cnt; i++) in omap_device_late_idle()
685 if (od->hwmods[i]->flags & HWMOD_INIT_NO_IDLE) in omap_device_late_idle()
688 if (od->_driver_status != BUS_NOTIFY_BOUND_DRIVER && in omap_device_late_idle()
689 od->_driver_status != BUS_NOTIFY_BIND_DRIVER) { in omap_device_late_idle()
690 if (od->_state == OMAP_DEVICE_STATE_ENABLED) { in omap_device_late_idle()