/** * hsi_runtime_suspend - Prepare HSI for low power : device will not process data and will not communicate with the CPU * @dev - reference to the hsi device. * * Return value : -EBUSY or -EAGAIN if device is busy and still operational * */ int hsi_runtime_suspend(struct device *dev) { struct hsi_platform_data *pdata = dev_get_platdata(dev); struct platform_device *pd = to_platform_device(dev); struct hsi_dev *hsi_ctrl = platform_get_drvdata(pd); int i; dev_dbg(dev, "%s\n", __func__); if (!hsi_ctrl->clock_enabled) dev_warn(dev, "Warning: clock status mismatch vs runtime PM\n"); /* Save context */ hsi_save_ctx(hsi_ctrl); hsi_ctrl->clock_enabled = false; /* HSI is going to IDLE, it needs IO wakeup mechanism enabled */ if (device_may_wakeup(dev)) for (i = 0; i < hsi_ctrl->max_p; i++) pdata->wakeup_enable(hsi_ctrl->hsi_port[i].port_number); else for (i = 0; i < hsi_ctrl->max_p; i++) pdata->wakeup_disable( hsi_ctrl->hsi_port[i].port_number); /* HSI is now ready to be put in low power state */ return 0; }
/** * hsi_runtime_suspend - Prepare HSI for low power : device will not process data and will not communicate with the CPU * @dev - reference to the hsi device. * * Return value : -EBUSY or -EAGAIN if device is busy and still operational * */ int hsi_runtime_suspend(struct device *dev) { struct platform_device *pd = to_platform_device(dev); struct hsi_dev *hsi_ctrl = platform_get_drvdata(pd); struct hsi_platform_data *pdata = hsi_ctrl->dev->platform_data; int port; dev_dbg(dev, "%s\n", __func__); if (!hsi_ctrl->clock_enabled) dev_warn(dev, "Warning: clock status mismatch vs runtime PM\n"); /* Save context */ hsi_save_ctx(hsi_ctrl); hsi_ctrl->clock_enabled = false; /* Put HSR into SLEEP mode to force ACREADY to low while HSI is idle */ for (port = 1; port <= pdata->num_ports; port++) { hsi_outl_and(HSI_HSR_MODE_MODE_VAL_SLEEP, hsi_ctrl->base, HSI_HSR_MODE_REG(port)); } /* HSI is going to INA/RET/OFF, it needs IO wakeup mechanism enabled */ if (device_may_wakeup(dev)) pdata->wakeup_enable(0); else pdata->wakeup_disable(0); /* HSI is now ready to be put in low power state */ return 0; }
/** * hsi_runtime_suspend - Prepare HSI for low power : device will not process data and will not communicate with the CPU * @dev - reference to the hsi device. * * Return value : -EBUSY or -EAGAIN if device is busy and still operational * */ int hsi_runtime_suspend(struct device *dev) { struct platform_device *pd = to_platform_device(dev); struct hsi_dev *hsi_ctrl = platform_get_drvdata(pd); dev_dbg(dev, "%s\n", __func__); if (!hsi_ctrl->clock_enabled) dev_warn(dev, "Warning: clock status mismatch vs runtime PM\n"); /* Save context */ hsi_save_ctx(hsi_ctrl); hsi_ctrl->clock_enabled = false; /* HSI is now ready to be put in low power state */ return 0; }
static void hsi_clk_disable(struct clk *clk) { #ifdef OMAP_HSI_EXAMPLE_PWR_CODE struct hsi_internal_clk *hsi_clk = container_of(clk, struct hsi_internal_clk, clk); int i; if (!hsi_clk->rate_change) { hsi_save_mode(hsi_clk->pdev); hsi_set_mode(hsi_clk->pdev, HSI_MODE_SLEEP); } /* Save ctx in all ports */ hsi_save_ctx(hsi_clk->pdev); for (i = 0; i < hsi_clk->n_childs; i++) omap2_clk_disable(hsi_clk->childs[i]); #endif }