video: drm: Add bpc to connector_state structure

Change-Id: Ib181191ceeae8a37f32d0ed31d4cd45efdefcd75
Signed-off-by: Jianqun Xu <jay.xu@rock-chips.com>
Signed-off-by: Wyon Bi <bivvy.bi@rock-chips.com>
This commit is contained in:
Jianqun Xu 2020-07-27 11:28:57 +08:00
parent 514da3912b
commit 2a74799b42
3 changed files with 29 additions and 22 deletions

View File

@ -20,7 +20,6 @@
#include "rockchip_display.h"
#include "rockchip_crtc.h"
#include "rockchip_connector.h"
#include "rockchip_panel.h"
#include "analogix_dp.h"
/**
@ -805,29 +804,11 @@ static int analogix_dp_connector_init(struct display_state *state)
{
struct connector_state *conn_state = &state->conn_state;
struct analogix_dp_device *dp = dev_get_priv(conn_state->dev);
struct video_info *video = &dp->video_info;
struct rockchip_panel *panel = state_get_panel(state);
conn_state->type = DRM_MODE_CONNECTOR_eDP;
conn_state->output_mode = ROCKCHIP_OUT_MODE_AAAA;
conn_state->color_space = V4L2_COLORSPACE_DEFAULT;
switch (panel->bpc) {
case 12:
video->color_depth = COLOR_12;
break;
case 10:
video->color_depth = COLOR_10;
break;
case 6:
video->color_depth = COLOR_6;
break;
case 8:
default:
video->color_depth = COLOR_8;
break;
}
/* eDP software reset request */
reset_assert(&dp->reset);
udelay(1);
@ -862,6 +843,7 @@ static int analogix_dp_connector_enable(struct display_state *state)
const struct rockchip_connector *connector = conn_state->connector;
const struct rockchip_dp_chip_data *pdata = connector->data;
struct analogix_dp_device *dp = dev_get_priv(conn_state->dev);
struct video_info *video = &dp->video_info;
u32 val;
int ret;
@ -874,6 +856,22 @@ static int analogix_dp_connector_enable(struct display_state *state)
writel(val, dp->grf + pdata->lcdsel_grf_reg);
}
switch (conn_state->bpc) {
case 12:
video->color_depth = COLOR_12;
break;
case 10:
video->color_depth = COLOR_10;
break;
case 6:
video->color_depth = COLOR_6;
break;
case 8:
default:
video->color_depth = COLOR_8;
break;
}
ret = analogix_dp_set_link_train(dp, dp->video_info.max_lane_count,
dp->video_info.max_link_rate);
if (ret) {

View File

@ -600,6 +600,8 @@ static int display_init(struct display_state *state)
if (panel_state->panel) {
ret = display_get_timing(state);
if (!ret)
conn_state->bpc = panel_state->panel->bpc;
#if defined(CONFIG_I2C_EDID)
if (ret < 0 && conn_funcs->get_edid) {
rockchip_panel_prepare(panel_state->panel);
@ -609,10 +611,12 @@ static int display_init(struct display_state *state)
ret = edid_get_drm_mode((void *)&conn_state->edid,
sizeof(conn_state->edid),
mode, &bpc);
if (!ret)
if (!ret) {
conn_state->bpc = bpc;
edid_print_info((void *)&conn_state->edid);
}
}
}
#endif
} else if (conn_state->bridge) {
ret = video_bridge_read_edid(conn_state->bridge->dev,
@ -621,8 +625,10 @@ static int display_init(struct display_state *state)
#if defined(CONFIG_I2C_EDID)
ret = edid_get_drm_mode(conn_state->edid, ret, mode,
&bpc);
if (!ret)
if (!ret) {
conn_state->bpc = bpc;
edid_print_info((void *)&conn_state->edid);
}
#endif
} else {
ret = video_bridge_get_timing(conn_state->bridge->dev);
@ -636,9 +642,11 @@ static int display_init(struct display_state *state)
ret = edid_get_drm_mode((void *)&conn_state->edid,
sizeof(conn_state->edid), mode,
&bpc);
if (!ret)
if (!ret) {
conn_state->bpc = bpc;
edid_print_info((void *)&conn_state->edid);
}
}
#endif
}

View File

@ -123,6 +123,7 @@ struct connector_state {
int type;
int output_type;
int color_space;
unsigned int bpc;
struct {
u32 *lut;