video: rockchip: hdmi: support modify color mode and depth simultaneously
authorZheng Yang <zhengyang@rock-chips.com>
Fri, 25 Nov 2016 07:17:36 +0000 (15:17 +0800)
committerHuang, Tao <huangtao@rock-chips.com>
Wed, 15 Feb 2017 08:58:09 +0000 (16:58 +0800)
Use following command:

echo mode=<value> > /sys/class/display/HDMI/mode

<value> is decimal digits, lower 8bit is color mode, upper 8bit is depth.
For example:
value = 131 = 0x83 means YCbCr444 8bit output
value = 164 = 0xa4 means YCbCr422 10bit output
value = 0 means restore auto mode(8bit, priority YCbCr444)

Change-Id: I256906d91f7075defb4d785cfc15926ca5627093
Signed-off-by: Zheng Yang <zhengyang@rock-chips.com>
(cherry picked from commit c3620a88e55c3ade4a823adea08b0bb2acc4737e)

drivers/video/rockchip/hdmi/rockchip-hdmi-core.c
drivers/video/rockchip/hdmi/rockchip-hdmi-sysfs.c

index c3f396ddb898b2316d556a772e3bdcdf25575f18..fcd6ae99f9f57952ade3416100ae93d8addaa63d 100644 (file)
@@ -174,8 +174,7 @@ static void hdmi_wq_set_video(struct hdmi *hdmi)
                }
                if ((hdmi->property->feature & SUPPORT_DEEP_10BIT) &&
                    (deepcolor & HDMI_DEEP_COLOR_30BITS) &&
-                   (hdmi->colordepth == HDMI_DEPP_COLOR_AUTO ||
-                    hdmi->colordepth == 10))
+                    hdmi->colordepth == 10)
                        video->color_output_depth = 10;
        }
        pr_info("hdmi output corlor mode is %d\n", video->color_output);
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;