Lines Matching refs:od

46 static void _add_clkdev(struct omap_device *od, const char *clk_alias,  in _add_clkdev()  argument
55 dev_dbg(&od->pdev->dev, "Creating %s -> %s\n", clk_alias, clk_name); in _add_clkdev()
57 r = clk_get_sys(dev_name(&od->pdev->dev), clk_alias); in _add_clkdev()
59 dev_dbg(&od->pdev->dev, in _add_clkdev()
67 dev_err(&od->pdev->dev, in _add_clkdev()
72 l = clkdev_alloc(r, clk_alias, dev_name(&od->pdev->dev)); in _add_clkdev()
74 dev_err(&od->pdev->dev, in _add_clkdev()
101 static void _add_hwmod_clocks_clkdev(struct omap_device *od, in _add_hwmod_clocks_clkdev() argument
106 _add_clkdev(od, "fck", oh->main_clk); in _add_hwmod_clocks_clkdev()
109 _add_clkdev(od, oh->opt_clks[i].role, oh->opt_clks[i].clk); in _add_hwmod_clocks_clkdev()
128 struct omap_device *od; in omap_device_build_from_dt() local
161 od = omap_device_alloc(pdev, hwmods, oh_cnt); in omap_device_build_from_dt()
162 if (IS_ERR(od)) { in omap_device_build_from_dt()
165 ret = PTR_ERR(od); in omap_device_build_from_dt()
198 struct omap_device *od; in _omap_device_notifier_call() local
202 if (pdev->archdata.od) in _omap_device_notifier_call()
203 omap_device_delete(pdev->archdata.od); in _omap_device_notifier_call()
211 od = to_omap_device(pdev); in _omap_device_notifier_call()
212 if (od) in _omap_device_notifier_call()
213 od->_driver_status = event; in _omap_device_notifier_call()
225 static int _omap_device_enable_hwmods(struct omap_device *od) in _omap_device_enable_hwmods() argument
229 for (i = 0; i < od->hwmods_cnt; i++) in _omap_device_enable_hwmods()
230 omap_hwmod_enable(od->hwmods[i]); in _omap_device_enable_hwmods()
242 static int _omap_device_idle_hwmods(struct omap_device *od) in _omap_device_idle_hwmods() argument
246 for (i = 0; i < od->hwmods_cnt; i++) in _omap_device_idle_hwmods()
247 omap_hwmod_idle(od->hwmods[i]); in _omap_device_idle_hwmods()
272 struct omap_device *od; in omap_device_get_context_loss_count() local
275 od = to_omap_device(pdev); in omap_device_get_context_loss_count()
277 if (od->hwmods_cnt) in omap_device_get_context_loss_count()
278 ret = omap_hwmod_get_context_loss_count(od->hwmods[0]); in omap_device_get_context_loss_count()
293 static int omap_device_count_resources(struct omap_device *od, in omap_device_count_resources() argument
299 for (i = 0; i < od->hwmods_cnt; i++) in omap_device_count_resources()
300 c += omap_hwmod_count_resources(od->hwmods[i], flags); in omap_device_count_resources()
303 od->pdev->name, c, od->hwmods_cnt); in omap_device_count_resources()
325 static int omap_device_fill_resources(struct omap_device *od, in omap_device_fill_resources() argument
330 for (i = 0; i < od->hwmods_cnt; i++) { in omap_device_fill_resources()
331 r = omap_hwmod_fill_resources(od->hwmods[i], res); in omap_device_fill_resources()
352 static int _od_fill_dma_resources(struct omap_device *od, in _od_fill_dma_resources() argument
357 for (i = 0; i < od->hwmods_cnt; i++) { in _od_fill_dma_resources()
358 r = omap_hwmod_fill_dma_resources(od->hwmods[i], res); in _od_fill_dma_resources()
381 struct omap_device *od; in omap_device_alloc() local
386 od = kzalloc(sizeof(struct omap_device), GFP_KERNEL); in omap_device_alloc()
387 if (!od) { in omap_device_alloc()
391 od->hwmods_cnt = oh_cnt; in omap_device_alloc()
397 od->hwmods = hwmods; in omap_device_alloc()
398 od->pdev = pdev; in omap_device_alloc()
421 res_count = omap_device_count_resources(od, IORESOURCE_IRQ | in omap_device_alloc()
434 res_count = omap_device_count_resources(od, IORESOURCE_DMA); in omap_device_alloc()
450 omap_device_fill_resources(od, res); in omap_device_alloc()
457 _od_fill_dma_resources(od, &res[pdev->num_resources]); in omap_device_alloc()
467 pdev->archdata.od = od; in omap_device_alloc()
470 hwmods[i]->od = od; in omap_device_alloc()
471 _add_hwmod_clocks_clkdev(od, hwmods[i]); in omap_device_alloc()
474 return od; in omap_device_alloc()
479 kfree(od); in omap_device_alloc()
486 void omap_device_delete(struct omap_device *od) in omap_device_delete() argument
488 if (!od) in omap_device_delete()
491 od->pdev->archdata.od = NULL; in omap_device_delete()
492 kfree(od->hwmods); in omap_device_delete()
493 kfree(od); in omap_device_delete()
546 struct omap_device *od; in omap_device_build_ss() local
566 od = omap_device_alloc(pdev, ohs, oh_cnt); in omap_device_build_ss()
567 if (IS_ERR(od)) in omap_device_build_ss()
581 omap_device_delete(od); in omap_device_build_ss()
632 struct omap_device *od = to_omap_device(pdev); in _od_suspend_noirq() local
636 if (od->_driver_status != BUS_NOTIFY_BOUND_DRIVER) in _od_suspend_noirq()
645 od->flags |= OMAP_DEVICE_SUSPENDED; in _od_suspend_noirq()
655 struct omap_device *od = to_omap_device(pdev); in _od_resume_noirq() local
657 if (od->flags & OMAP_DEVICE_SUSPENDED) { in _od_resume_noirq()
658 od->flags &= ~OMAP_DEVICE_SUSPENDED; in _od_resume_noirq()
733 struct omap_device *od; in omap_device_enable() local
735 od = to_omap_device(pdev); in omap_device_enable()
737 if (od->_state == OMAP_DEVICE_STATE_ENABLED) { in omap_device_enable()
740 __func__, od->_state); in omap_device_enable()
744 ret = _omap_device_enable_hwmods(od); in omap_device_enable()
746 od->_state = OMAP_DEVICE_STATE_ENABLED; in omap_device_enable()
763 struct omap_device *od; in omap_device_idle() local
765 od = to_omap_device(pdev); in omap_device_idle()
767 if (od->_state != OMAP_DEVICE_STATE_ENABLED) { in omap_device_idle()
770 __func__, od->_state); in omap_device_idle()
774 ret = _omap_device_idle_hwmods(od); in omap_device_idle()
776 od->_state = OMAP_DEVICE_STATE_IDLE; in omap_device_idle()
795 struct omap_device *od = to_omap_device(pdev); in omap_device_assert_hardreset() local
799 for (i = 0; i < od->hwmods_cnt; i++) { in omap_device_assert_hardreset()
800 ret = omap_hwmod_assert_hardreset(od->hwmods[i], name); in omap_device_assert_hardreset()
823 struct omap_device *od = to_omap_device(pdev); in omap_device_deassert_hardreset() local
827 for (i = 0; i < od->hwmods_cnt; i++) { in omap_device_deassert_hardreset()
828 ret = omap_hwmod_deassert_hardreset(od->hwmods[i], name); in omap_device_deassert_hardreset()
859 if (!oh->od) { in omap_device_get_by_hwmod_name()
865 return &oh->od->pdev->dev; in omap_device_get_by_hwmod_name()
890 struct omap_device *od = to_omap_device(pdev); in omap_device_late_idle() local
893 if (!od) in omap_device_late_idle()
905 for (i = 0; i < od->hwmods_cnt; i++) in omap_device_late_idle()
906 if (od->hwmods[i]->flags & HWMOD_INIT_NO_IDLE) in omap_device_late_idle()
909 if (od->_driver_status != BUS_NOTIFY_BOUND_DRIVER) { in omap_device_late_idle()
910 if (od->_state == OMAP_DEVICE_STATE_ENABLED) { in omap_device_late_idle()