static int ti_sysc_shutdown_module(struct device *dev, const struct ti_sysc_cookie *cookie) { if (!cookie->data) return -EINVAL; return omap_hwmod_shutdown(cookie->data); }
int omap_rproc_deactivate(struct omap_device *od) { int i, ret = 0; struct rproc *rproc = platform_get_drvdata(&od->pdev); struct device *dev = rproc->dev; struct omap_rproc_pdata *pdata = dev->platform_data; struct omap_rproc_timers_info *timers = pdata->timers; #ifdef CONFIG_REMOTE_PROC_AUTOSUSPEND struct omap_rproc_priv *rpp = rproc->priv; #endif if (pdata->clkdm) clkdm_wakeup(pdata->clkdm); for (i = 0; i < od->hwmods_cnt; i++) { ret = omap_hwmod_shutdown(od->hwmods[i]); if (ret) goto err; } for (i = 0; i < pdata->timers_cnt; i++) omap_dm_timer_stop(timers[i].odt); #ifdef CONFIG_REMOTE_PROC_AUTOSUSPEND if (rpp->iommu) { iommu_put(rpp->iommu); rpp->iommu = NULL; } if (rpp->mbox) { omap_mbox_put(rpp->mbox, NULL); rpp->mbox = NULL; } #endif err: if (pdata->clkdm) clkdm_allow_idle(pdata->clkdm); return ret; }
/** * omap_device_shutdown - shut down an omap_device * @od: struct omap_device * to shut down * * Shut down omap_device @od by calling all .deactivate_func() entries * in the omap_device's pm_lats table and then shutting down all of * the underlying omap_hwmods. Used when a device is being "removed" * or a device driver is being unloaded. Returns -EINVAL if the * omap_device is not currently enabled or idle, or passes along the * return value of _omap_device_deactivate(). */ int omap_device_shutdown(struct platform_device *pdev) { int ret, i; struct omap_device *od; od = _find_by_pdev(pdev); if (od->_state != OMAP_DEVICE_STATE_ENABLED && od->_state != OMAP_DEVICE_STATE_IDLE) { WARN(1, "omap_device: %s.%d: %s() called from invalid state %d\n", od->pdev.name, od->pdev.id, __func__, od->_state); return -EINVAL; } ret = _omap_device_deactivate(od, IGNORE_WAKEUP_LAT); for (i = 0; i < od->hwmods_cnt; i++) omap_hwmod_shutdown(od->hwmods[i]); od->_state = OMAP_DEVICE_STATE_SHUTDOWN; return ret; }