From 7be3c14ac0ffa6f1a62b4db6702b04fc04396f46 Mon Sep 17 00:00:00 2001 From: Huang Jiachai Date: Thu, 3 Dec 2015 11:23:52 +0800 Subject: [PATCH] video: rockchip: add more screen property for rockchip Change-Id: I0d4c552216f76ea7d8821a8dec38b4d2320b9f40 Signed-off-by: Huang Jiachai --- drivers/video/of_display_timing.c | 46 +++++++++++++++++++++++++++++++ include/video/display_timing.h | 14 ++++++++++ 2 files changed, 60 insertions(+) diff --git a/drivers/video/of_display_timing.c b/drivers/video/of_display_timing.c index 8a1076beecd3..6c2fc91aae0b 100644 --- a/drivers/video/of_display_timing.c +++ b/drivers/video/of_display_timing.c @@ -61,6 +61,10 @@ static int of_parse_display_timing(const struct device_node *np, { u32 val = 0; int ret = 0; +#if defined(CONFIG_FB_ROCKCHIP) + struct property *prop; + int length; +#endif memset(dt, 0, sizeof(*dt)); @@ -94,6 +98,48 @@ static int of_parse_display_timing(const struct device_node *np, dt->flags |= DISPLAY_FLAGS_DOUBLESCAN; if (of_property_read_bool(np, "doubleclk")) dt->flags |= DISPLAY_FLAGS_DOUBLECLK; +#if defined(CONFIG_FB_ROCKCHIP) + if (!of_property_read_u32(np, "swap-rg", &val)) + dt->flags |= val ? DISPLAY_FLAGS_SWAP_RG : 0; + if (!of_property_read_u32(np, "swap-gb", &val)) + dt->flags |= val ? DISPLAY_FLAGS_SWAP_GB : 0; + if (!of_property_read_u32(np, "swap-rb", &val)) + dt->flags |= val ? DISPLAY_FLAGS_SWAP_RB : 0; + if (!of_property_read_u32(np, "screen-type", &val)) + dt->screen_type = val; + if (!of_property_read_u32(np, "lvds-format", &val)) + dt->lvds_format = val; + if (!of_property_read_u32(np, "out-face", &val)) + dt->face = val; + if (!of_property_read_u32(np, "color-mode", &val)) + dt->color_mode = val; + prop = of_find_property(np, "dsp-lut", &length); + if (prop) { + dt->dsp_lut = kzalloc(length, GFP_KERNEL); + if (dt->dsp_lut) + ret = of_property_read_u32_array(np, + "dsp-lut", dt->dsp_lut, length >> 2); + } + prop = of_find_property(np, "cabc-lut", &length); + if (prop) { + dt->cabc_lut = kzalloc(length, GFP_KERNEL); + if (dt->cabc_lut) + ret = of_property_read_u32_array(np, + "cabc-lut", + dt->cabc_lut, + length >> 2); + } + + prop = of_find_property(np, "cabc-gamma-base", &length); + if (prop) { + dt->cabc_gamma_base = kzalloc(length, GFP_KERNEL); + if (dt->cabc_gamma_base) + ret = of_property_read_u32_array(np, + "cabc-gamma-base", + dt->cabc_gamma_base, + length >> 2); + } +#endif if (ret) { pr_err("%s: error reading timing properties\n", diff --git a/include/video/display_timing.h b/include/video/display_timing.h index 28d9d0d566ca..82e7adc68c89 100644 --- a/include/video/display_timing.h +++ b/include/video/display_timing.h @@ -28,6 +28,11 @@ enum display_flags { DISPLAY_FLAGS_INTERLACED = BIT(8), DISPLAY_FLAGS_DOUBLESCAN = BIT(9), DISPLAY_FLAGS_DOUBLECLK = BIT(10), +#if defined(CONFIG_FB_ROCKCHIP) + DISPLAY_FLAGS_SWAP_GB = BIT(16), + DISPLAY_FLAGS_SWAP_RG = BIT(17), + DISPLAY_FLAGS_SWAP_RB = BIT(18), +#endif }; /* @@ -71,6 +76,15 @@ struct display_timing { struct timing_entry vsync_len; /* ver. sync len */ enum display_flags flags; /* display flags */ +#if defined(CONFIG_FB_ROCKCHIP) + u16 screen_type; /*screen type*/ + u16 lvds_format; /*lvds data format*/ + u16 face; /*display output interface*/ + u16 color_mode; /*input color mode: RGB/YUV*/ + u32 *dsp_lut; + u32 *cabc_lut; + u32 *cabc_gamma_base; +#endif }; /* -- 2.34.1