Exemplo n.º 1
0
static int hdmi_runtime_suspend(struct device *dev)
{
	struct platform_device *pdev = to_platform_device(dev);
	struct s5p_hdmi_platdata *pdata = pdev->dev.platform_data;
	struct v4l2_subdev *sd = dev_get_drvdata(dev);
	struct hdmi_device *hdev = sd_to_hdmi_dev(sd);
	struct hdmi_resources *res = &hdev->res;

	dev_dbg(dev, "%s\n", __func__);

	if (hdev->probe_state == HDMI_PROBING) {
		hdev->probe_state = HDMI_PROBED;
		return 0;
	}

	/* HDMI PHY off sequence
	 * LINK off -> PHY off -> HDMI_PHY_CONTROL disable */

	if (is_ip_ver_5a || is_ip_ver_5s)
		hdmiphy_set_power(hdev, 0);

	/* turn clocks off */
	clk_disable(res->sclk_hdmi);

	if (is_ip_ver_5g)
		v4l2_subdev_call(hdev->phy_sd, core, s_power, 0);

	/* power-off hdmiphy */
	if (pdata->hdmiphy_enable)
		pdata->hdmiphy_enable(pdev, 0);

	return 0;
}
Exemplo n.º 2
0
static int hdmi_runtime_resume(struct device *dev)
{
	struct platform_device *pdev = to_platform_device(dev);
	struct s5p_hdmi_platdata *pdata = pdev->dev.platform_data;
	struct v4l2_subdev *sd = dev_get_drvdata(dev);
	struct hdmi_device *hdev = sd_to_hdmi_dev(sd);
	struct hdmi_resources *res = &hdev->res;
	int ret = 0;

	dev_dbg(dev, "%s\n", __func__);

	if (hdev->probe_state == HDMI_PROBING)
		return 0;

	/* power-on hdmiphy */
	if (pdata->hdmiphy_enable)
		pdata->hdmiphy_enable(pdev, 1);

	clk_enable(res->sclk_hdmi);

	if (is_ip_ver_5a || is_ip_ver_5s) {
		hdmiphy_set_power(hdev, 1);
	} else {
		ret = v4l2_subdev_call(hdev->phy_sd, core, s_power, 1);
		if (ret) {
			dev_err(dev, "failed to turn on hdmiphy\n");
			goto fail;
		}
	}

	hdmi_sw_reset(hdev);
	hdmi_phy_sw_reset(hdev);

	ret = hdmi_conf_apply(hdev);
	if (ret)
		goto fail;

	dev_dbg(dev, "poweron succeed\n");

	return 0;

fail:
	clk_disable(res->sclk_hdmi);
	v4l2_subdev_call(hdev->phy_sd, core, s_power, 0);
	if (pdata->hdmiphy_enable)
		pdata->hdmiphy_enable(pdev, 0);
	dev_err(dev, "poweron failed\n");

	return ret;
}
Exemplo n.º 3
0
static void hdmiphy_poweroff_work(struct work_struct *work)
{
	struct hdmi_device *hdev = container_of(work, struct hdmi_device,
						hdmi_probe_work.work);
	struct platform_device *pdev = to_platform_device(hdev->dev);
	struct s5p_hdmi_platdata *pdata = pdev->dev.platform_data;

	/*
	 * HDMI PHY power off
	 * HDMI PHY is on as default configuration
	 * So, HDMI PHY must be turned off if it's not used
	 */
	mutex_lock(&hdev->mutex);
	if (!is_hdmi_streaming(hdev)) {
		if (is_ip_ver_5a || is_ip_ver_5s) {
			hdev->probe_state = HDMI_PROBING;
#ifdef CONFIG_PM_RUNTIME
			pm_runtime_get_sync(hdev->dev);
#else
			hdmi_runtime_resume(hdev->dev);
#endif
			clk_enable(hdev->res.hdmi);
			hdmiphy_set_power(hdev, 0);
			clk_disable(hdev->res.hdmi);
#ifdef CONFIG_PM_RUNTIME
			pm_runtime_put_sync(hdev->dev);
#else
			hdmi_runtime_suspend(hdev->dev);
#endif
		} else if (is_ip_ver_5g) {
			if (pdata->hdmiphy_enable)
				pdata->hdmiphy_enable(pdev, 1);
			v4l2_subdev_call(hdev->phy_sd, core, s_power, 0);
			if (pdata->hdmiphy_enable)
				pdata->hdmiphy_enable(pdev, 0);
		}
	}
	mutex_unlock(&hdev->mutex);
}
static int hdmi_runtime_resume(struct device *dev)
{
    struct v4l2_subdev *sd = dev_get_drvdata(dev);
    struct hdmi_device *hdev = sd_to_hdmi_dev(sd);
    struct hdmi_resources *res = &hdev->res;
    int ret = 0;

    dev_dbg(dev, "%s\n", __func__);

    hdmiphy_set_isolation(hdev, 1);
    hdmiphy_set_conf(hdev, 1);

    clk_prepare_enable(res->hdmiphy);
    clk_prepare_enable(res->hdmi);

    hdmiphy_set_power(hdev, 1);

    hdmi_clock_set(hdev, 1);

    hdmi_sw_reset(hdev);
    hdmi_phy_sw_reset(hdev);

    ret = hdmi_conf_apply(hdev);
    if (ret)
        goto fail;

    dev_dbg(dev, "poweron succeed\n");

    return 0;

fail:
    clk_disable_unprepare(res->hdmi);
    clk_disable_unprepare(res->hdmiphy);
    hdmiphy_set_isolation(hdev, 0);
    dev_err(dev, "poweron failed\n");

    return ret;
}
static int hdmi_runtime_suspend(struct device *dev)
{
    struct v4l2_subdev *sd = dev_get_drvdata(dev);
    struct hdmi_device *hdev = sd_to_hdmi_dev(sd);
    struct hdmi_resources *res = &hdev->res;

    dev_dbg(dev, "%s\n", __func__);

    hdmi_clock_set(hdev, 0);

    /* HDMI PHY off sequence
     * LINK off -> PHY off -> isolation disable */
    hdmiphy_set_power(hdev, 0);

    /* turn clocks off */
    clk_disable_unprepare(res->hdmi);
    clk_disable_unprepare(res->hdmiphy);

    hdmiphy_set_conf(hdev, 0);
    hdmiphy_set_isolation(hdev, 0);

    return 0;
}