/** * hsi_clocks_disable_channel - virtual wrapper for disabling HSI clocks for * a given channel * @dev - reference to the hsi device. * @channel_number - channel number which requests clock to be disabled * 0xFF means no particular channel * * Note : there is no real HW clock management per HSI channel, this is only * virtual to keep track of active channels and ease debug * * Function to be called with lock */ void hsi_clocks_disable_channel(struct device *dev, u8 channel_number, const char *s) { struct platform_device *pd = to_platform_device(dev); struct hsi_dev *hsi_ctrl = platform_get_drvdata(pd); if (channel_number != HSI_CH_NUMBER_NONE) dev_dbg(dev, "CLK: hsi_clocks_disable for " "channel %d: %s\n", channel_number, s); else dev_dbg(dev, "CLK: hsi_clocks_disable: %s\n", s); if (!hsi_ctrl->clock_enabled) { dev_dbg(dev, "Clocks already disabled, skipping...\n"); return; } if (hsi_is_hsi_controller_busy(hsi_ctrl)) { dev_dbg(dev, "Cannot disable clocks, HSI port busy\n"); return; } if (hsi_is_hst_controller_busy(hsi_ctrl)) dev_warn(dev, "Disabling clocks with HST FSM not IDLE !\n"); #ifndef USE_PM_RUNTIME_FOR_HSI hsi_runtime_suspend(dev); omap_device_idle(pd); #else /* HSI_TODO : this can probably be changed * to return pm_runtime_put(dev); */ pm_runtime_put_sync(dev); #endif }
/** * hsi_clocks_disable_channel - virtual wrapper for disabling HSI clocks for * a given channel * @dev - reference to the hsi device. * @channel_number - channel number which requests clock to be disabled * 0xFF means no particular channel * * Note : there is no real HW clock management per HSI channel, this is only * virtual to keep track of active channels and ease debug * * Function to be called with lock */ void hsi_clocks_disable_channel(struct device *dev, u8 channel_number, const char *s) { struct platform_device *pd = to_platform_device(dev); struct hsi_platform_data *pdata = dev_get_platdata(dev); struct hsi_dev *hsi_ctrl = platform_get_drvdata(pd); int ret; if (channel_number != HSI_CH_NUMBER_NONE) dev_dbg(dev, "CLK: hsi_clocks_disable for " "channel %d: %s\n", channel_number, s); else dev_dbg(dev, "CLK: hsi_clocks_disable: %s\n", s); if (!hsi_ctrl->clock_enabled) { dev_dbg(dev, "Clocks already disabled, skipping...\n"); return; } if (hsi_is_hsi_controller_busy(hsi_ctrl)) { dev_dbg(dev, "Cannot disable clocks, HSI port busy\n"); return; } if (hsi_is_hst_controller_busy(hsi_ctrl)) #if 1 dev_dbg(dev, "Disabling clocks with HST FSM not IDLE !\n"); #endif #ifdef CONFIG_PM /* Allow Fclk to change */ if (dpll_cascading_blocker_release(dev) < 0) dev_warn(dev, "Error releasing DPLL cascading constraint\n"); #endif /* CONFIG_PM */ #ifndef USE_PM_RUNTIME_FOR_HSI hsi_runtime_suspend(dev); ret = pdata->device_idle(pd); if (ret) dev_err(dev, "Failed to idle device: %s %d\n", s, ret); #else /* HSI_TODO : this can probably be changed * to return pm_runtime_put(dev); */ pm_runtime_put_sync(dev); #endif }
/** * omap_hsi_prepare_idle - Prepare HSI for idle to low power * * Return value : -ENODEV if HSI controller has not been found, else 0. * */ int omap_hsi_prepare_idle(void) { struct platform_device *pdev; struct hsi_dev *hsi_ctrl; pdev = hsi_get_hsi_platform_device(); hsi_ctrl = hsi_get_hsi_controller_data(pdev); if (!hsi_ctrl) return -ENODEV; /* If hsi_clocks_disable_channel() is used, it prevents board to */ /* enter sleep, due to the checks of HSI controller status. */ /* This is why we call directly the omap_device_xxx() function here */ hsi_runtime_suspend(hsi_ctrl->dev); omap_device_idle(pdev); return 0; }