提交 2a39db01 编写于 作者: T Tobias Jakobi 提交者: Inki Dae

drm/exynos: mixer: simplify mixer_cfg_rgb_fmt()

Convert if-statements to switch statement. Removes
duplicated code.
Reviewed-by: NAndrzej Hajda <a.hajda@samsung.com>
Signed-off-by: NTobias Jakobi <tjakobi@math.uni-bielefeld.de>
Signed-off-by: NInki Dae <inki.dae@samsung.com>
上级 526b4d3e
...@@ -381,29 +381,14 @@ static void mixer_cfg_rgb_fmt(struct mixer_context *ctx, unsigned int height) ...@@ -381,29 +381,14 @@ static void mixer_cfg_rgb_fmt(struct mixer_context *ctx, unsigned int height)
struct mixer_resources *res = &ctx->mixer_res; struct mixer_resources *res = &ctx->mixer_res;
u32 val; u32 val;
if (height == 480) { switch (height) {
case 480:
case 576:
val = MXR_CFG_RGB601_0_255; val = MXR_CFG_RGB601_0_255;
} else if (height == 576) { break;
val = MXR_CFG_RGB601_0_255; case 720:
} else if (height == 720) { case 1080:
val = MXR_CFG_RGB709_16_235; default:
mixer_reg_write(res, MXR_CM_COEFF_Y,
(1 << 30) | (94 << 20) | (314 << 10) |
(32 << 0));
mixer_reg_write(res, MXR_CM_COEFF_CB,
(972 << 20) | (851 << 10) | (225 << 0));
mixer_reg_write(res, MXR_CM_COEFF_CR,
(225 << 20) | (820 << 10) | (1004 << 0));
} else if (height == 1080) {
val = MXR_CFG_RGB709_16_235;
mixer_reg_write(res, MXR_CM_COEFF_Y,
(1 << 30) | (94 << 20) | (314 << 10) |
(32 << 0));
mixer_reg_write(res, MXR_CM_COEFF_CB,
(972 << 20) | (851 << 10) | (225 << 0));
mixer_reg_write(res, MXR_CM_COEFF_CR,
(225 << 20) | (820 << 10) | (1004 << 0));
} else {
val = MXR_CFG_RGB709_16_235; val = MXR_CFG_RGB709_16_235;
mixer_reg_write(res, MXR_CM_COEFF_Y, mixer_reg_write(res, MXR_CM_COEFF_Y,
(1 << 30) | (94 << 20) | (314 << 10) | (1 << 30) | (94 << 20) | (314 << 10) |
...@@ -412,6 +397,7 @@ static void mixer_cfg_rgb_fmt(struct mixer_context *ctx, unsigned int height) ...@@ -412,6 +397,7 @@ static void mixer_cfg_rgb_fmt(struct mixer_context *ctx, unsigned int height)
(972 << 20) | (851 << 10) | (225 << 0)); (972 << 20) | (851 << 10) | (225 << 0));
mixer_reg_write(res, MXR_CM_COEFF_CR, mixer_reg_write(res, MXR_CM_COEFF_CR,
(225 << 20) | (820 << 10) | (1004 << 0)); (225 << 20) | (820 << 10) | (1004 << 0));
break;
} }
mixer_reg_writemask(res, MXR_CFG, val, MXR_CFG_RGB_FMT_MASK); mixer_reg_writemask(res, MXR_CFG, val, MXR_CFG_RGB_FMT_MASK);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册