mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-16 12:31:52 -04:00
drm/bridge: analogix_dp: Move &drm_bridge_funcs.mode_set to &drm_bridge_funcs.atomic_enable
According to the include/drm/drm_bridge.h, the callback &drm_bridge_funcs.mode_set is deprecated and it should be better to include the mode setting in the &drm_bridge_funcs.atomic_enable instead. Signed-off-by: Damon Ding <damon.ding@rock-chips.com> Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com> Tested-by: Marek Szyprowski <m.szyprowski@samsung.com> Reviewed-by: Luca Ceresoli <luca.ceresoli@bootlin.com> Tested-by: Heiko Stuebner <heiko@sntech.de> (on rk3588) Link: https://patch.msgid.link/20251217093321.3108939-4-damon.ding@rock-chips.com Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
This commit is contained in:
committed by
Luca Ceresoli
parent
10a2694fde
commit
cff3f89ffb
@@ -1177,12 +1177,88 @@ static int analogix_dp_set_bridge(struct analogix_dp_device *dp)
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void analogix_dp_bridge_mode_set(struct drm_bridge *bridge,
|
||||
const struct drm_display_mode *mode)
|
||||
{
|
||||
struct analogix_dp_device *dp = to_dp(bridge);
|
||||
struct drm_display_info *display_info = &dp->connector.display_info;
|
||||
struct video_info *video = &dp->video_info;
|
||||
struct device_node *dp_node = dp->dev->of_node;
|
||||
int vic;
|
||||
|
||||
/* Input video interlaces & hsync pol & vsync pol */
|
||||
video->interlaced = !!(mode->flags & DRM_MODE_FLAG_INTERLACE);
|
||||
video->v_sync_polarity = !!(mode->flags & DRM_MODE_FLAG_NVSYNC);
|
||||
video->h_sync_polarity = !!(mode->flags & DRM_MODE_FLAG_NHSYNC);
|
||||
|
||||
/* Input video dynamic_range & colorimetry */
|
||||
vic = drm_match_cea_mode(mode);
|
||||
if ((vic == 6) || (vic == 7) || (vic == 21) || (vic == 22) ||
|
||||
(vic == 2) || (vic == 3) || (vic == 17) || (vic == 18)) {
|
||||
video->dynamic_range = CEA;
|
||||
video->ycbcr_coeff = COLOR_YCBCR601;
|
||||
} else if (vic) {
|
||||
video->dynamic_range = CEA;
|
||||
video->ycbcr_coeff = COLOR_YCBCR709;
|
||||
} else {
|
||||
video->dynamic_range = VESA;
|
||||
video->ycbcr_coeff = COLOR_YCBCR709;
|
||||
}
|
||||
|
||||
/* Input vide bpc and color_formats */
|
||||
switch (display_info->bpc) {
|
||||
case 12:
|
||||
video->color_depth = COLOR_12;
|
||||
break;
|
||||
case 10:
|
||||
video->color_depth = COLOR_10;
|
||||
break;
|
||||
case 8:
|
||||
video->color_depth = COLOR_8;
|
||||
break;
|
||||
case 6:
|
||||
video->color_depth = COLOR_6;
|
||||
break;
|
||||
default:
|
||||
video->color_depth = COLOR_8;
|
||||
break;
|
||||
}
|
||||
if (display_info->color_formats & DRM_COLOR_FORMAT_YCBCR444)
|
||||
video->color_space = COLOR_YCBCR444;
|
||||
else if (display_info->color_formats & DRM_COLOR_FORMAT_YCBCR422)
|
||||
video->color_space = COLOR_YCBCR422;
|
||||
else
|
||||
video->color_space = COLOR_RGB;
|
||||
|
||||
/*
|
||||
* NOTE: those property parsing code is used for providing backward
|
||||
* compatibility for samsung platform.
|
||||
* Due to we used the "of_property_read_u32" interfaces, when this
|
||||
* property isn't present, the "video_info" can keep the original
|
||||
* values and wouldn't be modified.
|
||||
*/
|
||||
of_property_read_u32(dp_node, "samsung,color-space",
|
||||
&video->color_space);
|
||||
of_property_read_u32(dp_node, "samsung,dynamic-range",
|
||||
&video->dynamic_range);
|
||||
of_property_read_u32(dp_node, "samsung,ycbcr-coeff",
|
||||
&video->ycbcr_coeff);
|
||||
of_property_read_u32(dp_node, "samsung,color-depth",
|
||||
&video->color_depth);
|
||||
if (of_property_read_bool(dp_node, "hsync-active-high"))
|
||||
video->h_sync_polarity = true;
|
||||
if (of_property_read_bool(dp_node, "vsync-active-high"))
|
||||
video->v_sync_polarity = true;
|
||||
if (of_property_read_bool(dp_node, "interlaced"))
|
||||
video->interlaced = true;
|
||||
}
|
||||
|
||||
static void analogix_dp_bridge_atomic_enable(struct drm_bridge *bridge,
|
||||
struct drm_atomic_state *old_state)
|
||||
{
|
||||
struct analogix_dp_device *dp = to_dp(bridge);
|
||||
struct drm_crtc *crtc;
|
||||
struct drm_crtc_state *old_crtc_state;
|
||||
struct drm_crtc_state *old_crtc_state, *new_crtc_state;
|
||||
int timeout_loop = 0;
|
||||
int ret;
|
||||
|
||||
@@ -1190,6 +1266,11 @@ static void analogix_dp_bridge_atomic_enable(struct drm_bridge *bridge,
|
||||
if (!crtc)
|
||||
return;
|
||||
|
||||
new_crtc_state = drm_atomic_get_new_crtc_state(old_state, crtc);
|
||||
if (!new_crtc_state)
|
||||
return;
|
||||
analogix_dp_bridge_mode_set(bridge, &new_crtc_state->adjusted_mode);
|
||||
|
||||
old_crtc_state = drm_atomic_get_old_crtc_state(old_state, crtc);
|
||||
/* Not a full enable, just disable PSR and continue */
|
||||
if (old_crtc_state && old_crtc_state->self_refresh_active) {
|
||||
@@ -1296,83 +1377,6 @@ static void analogix_dp_bridge_atomic_post_disable(struct drm_bridge *bridge,
|
||||
DRM_ERROR("Failed to enable psr (%d)\n", ret);
|
||||
}
|
||||
|
||||
static void analogix_dp_bridge_mode_set(struct drm_bridge *bridge,
|
||||
const struct drm_display_mode *orig_mode,
|
||||
const struct drm_display_mode *mode)
|
||||
{
|
||||
struct analogix_dp_device *dp = to_dp(bridge);
|
||||
struct drm_display_info *display_info = &dp->connector.display_info;
|
||||
struct video_info *video = &dp->video_info;
|
||||
struct device_node *dp_node = dp->dev->of_node;
|
||||
int vic;
|
||||
|
||||
/* Input video interlaces & hsync pol & vsync pol */
|
||||
video->interlaced = !!(mode->flags & DRM_MODE_FLAG_INTERLACE);
|
||||
video->v_sync_polarity = !!(mode->flags & DRM_MODE_FLAG_NVSYNC);
|
||||
video->h_sync_polarity = !!(mode->flags & DRM_MODE_FLAG_NHSYNC);
|
||||
|
||||
/* Input video dynamic_range & colorimetry */
|
||||
vic = drm_match_cea_mode(mode);
|
||||
if ((vic == 6) || (vic == 7) || (vic == 21) || (vic == 22) ||
|
||||
(vic == 2) || (vic == 3) || (vic == 17) || (vic == 18)) {
|
||||
video->dynamic_range = CEA;
|
||||
video->ycbcr_coeff = COLOR_YCBCR601;
|
||||
} else if (vic) {
|
||||
video->dynamic_range = CEA;
|
||||
video->ycbcr_coeff = COLOR_YCBCR709;
|
||||
} else {
|
||||
video->dynamic_range = VESA;
|
||||
video->ycbcr_coeff = COLOR_YCBCR709;
|
||||
}
|
||||
|
||||
/* Input vide bpc and color_formats */
|
||||
switch (display_info->bpc) {
|
||||
case 12:
|
||||
video->color_depth = COLOR_12;
|
||||
break;
|
||||
case 10:
|
||||
video->color_depth = COLOR_10;
|
||||
break;
|
||||
case 8:
|
||||
video->color_depth = COLOR_8;
|
||||
break;
|
||||
case 6:
|
||||
video->color_depth = COLOR_6;
|
||||
break;
|
||||
default:
|
||||
video->color_depth = COLOR_8;
|
||||
break;
|
||||
}
|
||||
if (display_info->color_formats & DRM_COLOR_FORMAT_YCBCR444)
|
||||
video->color_space = COLOR_YCBCR444;
|
||||
else if (display_info->color_formats & DRM_COLOR_FORMAT_YCBCR422)
|
||||
video->color_space = COLOR_YCBCR422;
|
||||
else
|
||||
video->color_space = COLOR_RGB;
|
||||
|
||||
/*
|
||||
* NOTE: those property parsing code is used for providing backward
|
||||
* compatibility for samsung platform.
|
||||
* Due to we used the "of_property_read_u32" interfaces, when this
|
||||
* property isn't present, the "video_info" can keep the original
|
||||
* values and wouldn't be modified.
|
||||
*/
|
||||
of_property_read_u32(dp_node, "samsung,color-space",
|
||||
&video->color_space);
|
||||
of_property_read_u32(dp_node, "samsung,dynamic-range",
|
||||
&video->dynamic_range);
|
||||
of_property_read_u32(dp_node, "samsung,ycbcr-coeff",
|
||||
&video->ycbcr_coeff);
|
||||
of_property_read_u32(dp_node, "samsung,color-depth",
|
||||
&video->color_depth);
|
||||
if (of_property_read_bool(dp_node, "hsync-active-high"))
|
||||
video->h_sync_polarity = true;
|
||||
if (of_property_read_bool(dp_node, "vsync-active-high"))
|
||||
video->v_sync_polarity = true;
|
||||
if (of_property_read_bool(dp_node, "interlaced"))
|
||||
video->interlaced = true;
|
||||
}
|
||||
|
||||
static const struct drm_bridge_funcs analogix_dp_bridge_funcs = {
|
||||
.atomic_duplicate_state = drm_atomic_helper_bridge_duplicate_state,
|
||||
.atomic_destroy_state = drm_atomic_helper_bridge_destroy_state,
|
||||
@@ -1381,7 +1385,6 @@ static const struct drm_bridge_funcs analogix_dp_bridge_funcs = {
|
||||
.atomic_enable = analogix_dp_bridge_atomic_enable,
|
||||
.atomic_disable = analogix_dp_bridge_atomic_disable,
|
||||
.atomic_post_disable = analogix_dp_bridge_atomic_post_disable,
|
||||
.mode_set = analogix_dp_bridge_mode_set,
|
||||
.attach = analogix_dp_bridge_attach,
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user