Skip to content

Commit

Permalink
Merge pull request torvalds#229 from vamrs-feng/hdmi_resolution
Browse files Browse the repository at this point in the history
Changes:
  * Radxa CM3 IO: Set preferred resolution

Signed-off-by: Stephen Chen <stephen@radxa.com>
  • Loading branch information
RadxaStephen authored Oct 12, 2023
2 parents c57772b + a7d1d58 commit 425b075
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions arch/arm64/boot/dts/rockchip/rk3566-radxa-cm3-io.dts
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,9 @@

&hdmi {
status = "okay";
preset_max_hdisplay = <1920>;
preset_max_vdisplay = <1080>;
preset_as_preferred;
};

&hdmi_in_vp0 {
Expand Down
6 changes: 6 additions & 0 deletions drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,7 @@ struct dw_hdmi {

unsigned int preset_max_hdisplay;
unsigned int preset_max_vdisplay;
bool preset_as_preferred;
};

#define HDMI_IH_PHY_STAT0_RX_SENSE \
Expand Down Expand Up @@ -3086,6 +3087,9 @@ dw_hdmi_update_hdr_property(struct drm_connector *connector)
bool dw_hdmi_resolution_within_custom_limit(struct dw_hdmi *dw_hdmi,
unsigned int hdisplay, unsigned int vdisplay)
{
if (dw_hdmi->preset_as_preferred)
return true;

return !dw_hdmi->preset_max_hdisplay ||
!dw_hdmi->preset_max_vdisplay ||
hdisplay * vdisplay <= dw_hdmi->preset_max_hdisplay * dw_hdmi->preset_max_vdisplay;
Expand Down Expand Up @@ -3157,6 +3161,7 @@ static int dw_hdmi_connector_get_modes(struct drm_connector *connector)

if ((hdmi->preset_max_hdisplay) && (hdmi->preset_max_vdisplay)) {
list_for_each_entry(mode, &connector->probed_modes, head) {
mode->type &= ~DRM_MODE_TYPE_PREFERRED;
if (mode->hdisplay == hdmi->preset_max_hdisplay &&
mode->vdisplay == hdmi->preset_max_vdisplay) {
preferred_mode?:(preferred_mode = mode);
Expand Down Expand Up @@ -4782,6 +4787,7 @@ struct dw_hdmi *dw_hdmi_probe(struct platform_device *pdev,

of_property_read_u32(np, "preset_max_hdisplay", &hdmi->preset_max_hdisplay);
of_property_read_u32(np, "preset_max_vdisplay", &hdmi->preset_max_vdisplay);
hdmi->preset_as_preferred = of_property_read_bool(np, "preset_as_preferred");

ddc_node = of_parse_phandle(np, "ddc-i2c-bus", 0);
if (ddc_node) {
Expand Down

0 comments on commit 425b075

Please sign in to comment.