video: rockchip: hdmi: support modify color mode and depth simultaneously
[firefly-linux-kernel-4.4.55.git] / drivers / video / rockchip / hdmi / rockchip-hdmi-sysfs.c
index 37162320b05a9ec651d8f0c7b3641870fee7a0e2..2f9147e461c8e4b05875071bf2addb749729b6a7 100644 (file)
@@ -237,10 +237,15 @@ static int hdmi_set_color(struct rk_display_device *device,
        if (!strncmp(buf, "mode", 4)) {
                if (sscanf(buf, "mode=%d", &value) == -1)
                        return -1;
-               pr_debug("current mode is %d input mode is %d\n",
+               pr_debug("current mode is %d input mode is %x\n",
                         hdmi->colormode, value);
-               if (hdmi->colormode != value)
-                       hdmi->colormode = value;
+               if (hdmi->colormode != (value & 0xff))
+                       hdmi->colormode = value & 0xff;
+               if (hdmi->colordepth != ((value >> 8) & 0xff)) {
+                       pr_debug("current depth is %d input mode is %d\n",
+                                hdmi->colordepth, ((value >> 8) & 0xff));
+                       hdmi->colordepth = ((value >> 8) & 0xff);
+               }
        } else if (!strncmp(buf, "depth", 5)) {
                if (sscanf(buf, "depth=%d", &value) == -1)
                        return -1;