static ssize_t hdmi_common_wta_video_mode(struct device *dev,
        struct device_attribute *attr, const char *buf, size_t count)
{
    ssize_t ret = strnlen(buf, PAGE_SIZE);
    uint32 video_mode;
    const struct hdmi_disp_mode_timing_type *disp_mode;

    mutex_lock(&hdmi_common_state_hpd_mutex);
    if (!hdmi_common_state->hpd_state) {
        mutex_unlock(&hdmi_common_state_hpd_mutex);
        DEV_INFO("%s: FAILED: display off or cable disconnected\n",
                 __func__);
        return ret;
    }
    mutex_unlock(&hdmi_common_state_hpd_mutex);

    video_mode = atoi(buf)-1;
    disp_mode = hdmi_common_get_supported_mode(video_mode);
    if (!disp_mode) {
        DEV_INFO("%s: FAILED: mode not supported (%d)\n",
                 __func__, video_mode);
        return ret;
    }

    kobject_uevent(hdmi_common_state->uevent_kobj, KOBJ_OFFLINE);

    hdmi_common_state->disp_mode_list.num_of_elements = 1;
    hdmi_common_state->disp_mode_list.disp_mode_list[0] = video_mode;
    DEV_DBG("%s: 'mode=%d %s' successful (sending OFF/ONLINE)\n", __func__,
            video_mode, video_format_2string(video_mode));

    kobject_uevent(hdmi_common_state->uevent_kobj, KOBJ_ONLINE);
    return ret;
}
static ssize_t external_common_wta_video_mode(struct device *dev,
	struct device_attribute *attr, const char *buf, size_t count)
{
	ssize_t ret = strnlen(buf, PAGE_SIZE);
	uint32 video_mode;
#ifdef CONFIG_FB_MSM_HDMI_COMMON
	const struct hdmi_disp_mode_timing_type *disp_mode;
#endif
	mutex_lock(&external_common_state_hpd_mutex);
	if (!external_common_state->hpd_state) {
		mutex_unlock(&external_common_state_hpd_mutex);
		DEV_INFO("%s: FAILED: display off or cable disconnected\n",
			__func__);
		return ret;
	}
	mutex_unlock(&external_common_state_hpd_mutex);

	video_mode = atoi(buf)-1;
	kobject_uevent(external_common_state->uevent_kobj, KOBJ_OFFLINE);
#ifdef CONFIG_FB_MSM_HDMI_COMMON
	disp_mode = hdmi_common_get_supported_mode(video_mode);
	if (!disp_mode) {
		DEV_INFO("%s: FAILED: mode not supported (%d)\n",
			__func__, video_mode);
		return ret;
	}
	external_common_state->disp_mode_list.num_of_elements = 1;
	external_common_state->disp_mode_list.disp_mode_list[0] = video_mode;
#elif defined(CONFIG_FB_MSM_TVOUT)
	external_common_state->tvout_enable(0);
	external_common_state->video_resolution = video_mode;
	external_common_state->tvout_enable(1);
#endif
	DEV_DBG("%s: 'mode=%d %s' successful (sending OFF/ONLINE)\n", __func__,
		video_mode, video_format_2string(video_mode));
	kobject_uevent(external_common_state->uevent_kobj, KOBJ_ONLINE);
	return ret;
}