int hdmi_s_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
{
    struct hdmi_device *hdev = sd_to_hdmi_dev(sd);
    struct device *dev = hdev->dev;
    int ret = 0;

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

    switch (ctrl->id) {
    case V4L2_CID_TV_SET_DVI_MODE:
        hdev->dvi_mode = ctrl->value;
        break;
    case V4L2_CID_TV_SET_ASPECT_RATIO:
        hdev->aspect = ctrl->value;
        break;
    case V4L2_CID_TV_ENABLE_HDMI_AUDIO:
        mutex_lock(&hdev->mutex);
        hdev->audio_enable = !!ctrl->value;
        if (is_hdmi_streaming(hdev)) {
            hdmi_set_infoframe(hdev);
            hdmi_audio_enable(hdev, hdev->audio_enable);
        }
        mutex_unlock(&hdev->mutex);
        break;
    case V4L2_CID_TV_SET_NUM_CHANNELS:
        mutex_lock(&hdev->mutex);
        hdmi_audio_information(hdev, ctrl->value);
        if (is_hdmi_streaming(hdev)) {
            hdmi_audio_enable(hdev, 0);
            hdmi_set_infoframe(hdev);
            hdmi_reg_i2s_audio_init(hdev);
            hdmi_audio_enable(hdev, 1);
        }
        mutex_unlock(&hdev->mutex);
        break;
    case V4L2_CID_TV_SET_COLOR_RANGE:
        hdev->color_range = ctrl->value;
        break;
    case V4L2_CID_TV_HDCP_ENABLE:
        hdev->hdcp_info.hdcp_enable = ctrl->value;
        dev_dbg(hdev->dev, "HDCP %s\n",
                ctrl->value ? "enable" : "disable");
#ifdef CONFIG_SEC_MHL_HDCP
        hdev->hdcp_info.hdcp_enable = false;
        /*MHL8240 control the HDCP*/
        dev_dbg(hdev->dev, "MHL control the HDCP\n");
#endif
        break;
    default:
        dev_err(dev, "invalid control id\n");
        ret = -EINVAL;
        break;
    }

    return ret;
}
Пример #2
0
int hdmi_s_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
{
	struct hdmi_device *hdev = sd_to_hdmi_dev(sd);
	struct device *dev = hdev->dev;
	int ret = 0;

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

	switch (ctrl->id) {
	case V4L2_CID_TV_SET_DVI_MODE:
		hdev->dvi_mode = ctrl->value;
		break;
	case V4L2_CID_TV_SET_ASPECT_RATIO:
		hdev->aspect = ctrl->value;
		break;
	case V4L2_CID_TV_ENABLE_HDMI_AUDIO:
		mutex_lock(&hdev->mutex);
		hdev->audio_enable = !!ctrl->value;
		if (is_hdmi_streaming(hdev)) {
			hdmi_set_infoframe(hdev);
			hdmi_audio_enable(hdev, hdev->audio_enable);
		}
		mutex_unlock(&hdev->mutex);
		break;
	case V4L2_CID_TV_SET_NUM_CHANNELS:
		mutex_lock(&hdev->mutex);
		if ((ctrl->value == 2) || (ctrl->value == 6) ||
							(ctrl->value == 8)) {
			hdev->audio_channel_count = ctrl->value;
		} else {
			dev_err(dev, "invalid channel count\n");
			hdev->audio_channel_count = 2;
		}
		if (is_hdmi_streaming(hdev))
			hdmi_set_infoframe(hdev);
		mutex_unlock(&hdev->mutex);
		break;
	case V4L2_CID_TV_SET_COLOR_RANGE:
		hdev->color_range = ctrl->value;
		break;
	case V4L2_CID_TV_HDCP_ENABLE:
		hdev->hdcp_info.hdcp_enable = ctrl->value;
		dev_dbg(hdev->dev, "HDCP %s\n",
				ctrl->value ? "enable" : "disable");
		break;
	default:
		dev_err(dev, "invalid control id\n");
		ret = -EINVAL;
		break;
	}

	return ret;
}
Пример #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);
}