+static int edid_select_prop_value(struct hdmi *hdmi)
+{
+ struct edid_prop_value *prop_value = NULL;
+ int nstates = 0;
+ int i, vid, pid, sn, xres, yres, reboot = 0;
+
+ prop_value = hdmi->pvalue;
+ nstates = hdmi->nstates;
+
+ if (!prop_value) {
+ pr_info("%s:pvalue is NULL\n", __func__);
+ return -1;
+ }
+
+ vid = hdmi->edid.value.vid;
+ pid = hdmi->edid.value.pid;
+ sn = hdmi->edid.value.sn;
+ xres = hdmi->edid.value.xres;
+ yres = hdmi->edid.value.yres;
+
+ for (i = 0; i < nstates; i++) {
+ if ((prop_value[i].vid == vid) &&
+ (prop_value[i].pid == pid) &&
+ (prop_value[i].sn == sn) &&
+ (prop_value[i].xres == xres) &&
+ (prop_value[i].yres == yres)) {
+ hdmi->edid.value = prop_value[i];
+ hdmi->prop.value = prop_value[i];
+ if ((hdmi->prop.valid) &&
+ ((hdmi->prop.last_vid != vid) ||
+ (hdmi->prop.last_pid != pid) ||
+ (hdmi->prop.last_sn != sn) ||
+ (hdmi->prop.last_xres != xres) ||
+ (hdmi->prop.last_yres != yres))) {
+ reboot = 1;
+ } else {
+ reboot = 0;
+ }
+
+ hdmi->prop.last_vid = vid;
+ hdmi->prop.last_pid = pid;
+ hdmi->prop.last_sn = sn;
+ hdmi->prop.last_xres = xres;
+ hdmi->prop.last_yres = yres;
+ hdmi->prop.valid = 1;
+ pr_info("%s:i=%d reboot=%d,valid=%d\n",
+ __func__, i, reboot, hdmi->prop.valid);
+
+ break;
+ }
+ }
+
+ if (reboot) {
+ dev_info(hdmi->dev, "%s:kernel_restart\n", __func__);
+ kernel_restart(NULL);
+ }
+
+ return 0;
+}
+