static int hdmi_s_power(struct v4l2_subdev *sd, int on)
{
    struct hdmi_device *hdev = sd_to_hdmi_dev(sd);
    int ret = 0;

    /* If runtime PM is not implemented, hdmi_runtime_resume
     * and hdmi_runtime_suspend functions are directly called.
     */
    if (on) {
#ifdef CONFIG_PM_RUNTIME
        ret = pm_runtime_get_sync(hdev->dev);
#else
        hdmi_runtime_resume(hdev->dev);
#endif
    } else {
#ifdef CONFIG_PM_RUNTIME
        ret = pm_runtime_put_sync(hdev->dev);
#else
        hdmi_runtime_suspend(hdev->dev);
#endif
    }

    /* only values < 0 indicate errors */
    return IS_ERR_VALUE(ret) ? ret : 0;
}
Ejemplo n.º 2
0
static int hdmi_s_power(struct v4l2_subdev *sd, int on)
{
	struct hdmi_device *hdev = sd_to_hdmi_dev(sd);

	/* If runtime PM is not implemented, hdmi_runtime_resume
	 * and hdmi_runtime_suspend functions are directly called.
	 */
#ifdef CONFIG_PM_RUNTIME
	int ret;

	if (on) {
		clk_enable(hdev->res.hdmi);
		hdmi_hpd_enable(hdev, 1);
		ret = pm_runtime_get_sync(hdev->dev);
		set_internal_hpd_int(hdev);
	} else {
		hdmi_hpd_enable(hdev, 0);
		set_external_hpd_int(hdev);
		ret = pm_runtime_put_sync(hdev->dev);
		clk_disable(hdev->res.hdmi);
	}
	/* only values < 0 indicate errors */
	return IS_ERR_VALUE(ret) ? ret : 0;
#else
	if (on)
		hdmi_runtime_resume(hdev->dev);
	else
		hdmi_runtime_suspend(hdev->dev);
	return 0;
#endif
}
Ejemplo n.º 3
0
static int hdmi_s_power(struct v4l2_subdev *sd, int on)
{
	struct hdmi_device *hdev = sd_to_hdmi_dev(sd);
	int ret = 0;

	/* If runtime PM is not implemented, hdmi_runtime_resume
	 * and hdmi_runtime_suspend functions are directly called.
	 */

	if (on) {
		clk_enable(hdev->res.hdmi);

#ifdef CONFIG_PM_RUNTIME
		ret = pm_runtime_get_sync(hdev->dev);
#else
		hdmi_runtime_resume(hdev->dev);
#endif

		disable_irq(hdev->ext_irq);
		cancel_delayed_work_sync(&hdev->hpd_work_ext);

		s5p_v4l2_int_src_hdmi_hpd();
		hdmi_hpd_enable(hdev, 1);
		hdmi_hpd_clear_int(hdev);
		enable_irq(hdev->int_irq);

		dev_info(hdev->dev, "HDMI interrupt changed to internal\n");
	} else {
		cancel_work_sync(&hdev->work);
		hdmi_hpd_enable(hdev, 0);
		disable_irq(hdev->int_irq);
		cancel_work_sync(&hdev->hpd_work);

		s5p_v4l2_int_src_ext_hpd();
		enable_irq(hdev->ext_irq);
		dev_info(hdev->dev, "HDMI interrupt changed to external\n");

#ifdef CONFIG_PM_RUNTIME
		ret = pm_runtime_put_sync(hdev->dev);
#else
		hdmi_runtime_suspend(hdev->dev);
#endif

		clk_disable(hdev->res.hdmi);
	}

	/* only values < 0 indicate errors */
	return IS_ERR_VALUE(ret) ? ret : 0;
}
Ejemplo n.º 4
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);
}