Commit 7868e507 authored by Yannick Fertre's avatar Yannick Fertre Committed by Benjamin Gaignard

drm/stm: ltdc: filter mode pixel clock vs pad constraint

Filter the requested mode pixel clock frequency according
to the pad maximum supported frequency.
Signed-off-by: default avatarYannick Fertre <yannick.fertre@st.com>
Reviewed-by: default avatarPhilippe Cornu <philippe.cornu@st.com>
Tested-by: default avatarPhilippe Cornu <philippe.cornu@st.com>
Signed-off-by: default avatarBenjamin Gaignard <benjamin.gaignard@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/1530271342-5532-1-git-send-email-yannick.fertre@st.com
parent f8878bb2
...@@ -457,6 +457,14 @@ ltdc_crtc_mode_valid(struct drm_crtc *crtc, ...@@ -457,6 +457,14 @@ ltdc_crtc_mode_valid(struct drm_crtc *crtc,
int target_max = target + CLK_TOLERANCE_HZ; int target_max = target + CLK_TOLERANCE_HZ;
int result; int result;
result = clk_round_rate(ldev->pixel_clk, target);
DRM_DEBUG_DRIVER("clk rate target %d, available %d\n", target, result);
/* Filter modes according to the max frequency supported by the pads */
if (result > ldev->caps.pad_max_freq_hz)
return MODE_CLOCK_HIGH;
/* /*
* Accept all "preferred" modes: * Accept all "preferred" modes:
* - this is important for panels because panel clock tolerances are * - this is important for panels because panel clock tolerances are
...@@ -468,10 +476,6 @@ ltdc_crtc_mode_valid(struct drm_crtc *crtc, ...@@ -468,10 +476,6 @@ ltdc_crtc_mode_valid(struct drm_crtc *crtc,
if (mode->type & DRM_MODE_TYPE_PREFERRED) if (mode->type & DRM_MODE_TYPE_PREFERRED)
return MODE_OK; return MODE_OK;
result = clk_round_rate(ldev->pixel_clk, target);
DRM_DEBUG_DRIVER("clk rate target %d, available %d\n", target, result);
/* /*
* Filter modes according to the clock value, particularly useful for * Filter modes according to the clock value, particularly useful for
* hdmi modes that require precise pixel clocks. * hdmi modes that require precise pixel clocks.
...@@ -991,11 +995,15 @@ static int ltdc_get_caps(struct drm_device *ddev) ...@@ -991,11 +995,15 @@ static int ltdc_get_caps(struct drm_device *ddev)
* does not work on 2nd layer. * does not work on 2nd layer.
*/ */
ldev->caps.non_alpha_only_l1 = true; ldev->caps.non_alpha_only_l1 = true;
ldev->caps.pad_max_freq_hz = 90000000;
if (ldev->caps.hw_version == HWVER_10200)
ldev->caps.pad_max_freq_hz = 65000000;
break; break;
case HWVER_20101: case HWVER_20101:
ldev->caps.reg_ofs = REG_OFS_4; ldev->caps.reg_ofs = REG_OFS_4;
ldev->caps.pix_fmt_hw = ltdc_pix_fmt_a1; ldev->caps.pix_fmt_hw = ltdc_pix_fmt_a1;
ldev->caps.non_alpha_only_l1 = false; ldev->caps.non_alpha_only_l1 = false;
ldev->caps.pad_max_freq_hz = 150000000;
break; break;
default: default:
return -ENODEV; return -ENODEV;
......
...@@ -18,6 +18,7 @@ struct ltdc_caps { ...@@ -18,6 +18,7 @@ struct ltdc_caps {
u32 bus_width; /* bus width (32 or 64 bits) */ u32 bus_width; /* bus width (32 or 64 bits) */
const u32 *pix_fmt_hw; /* supported pixel formats */ const u32 *pix_fmt_hw; /* supported pixel formats */
bool non_alpha_only_l1; /* non-native no-alpha formats on layer 1 */ bool non_alpha_only_l1; /* non-native no-alpha formats on layer 1 */
int pad_max_freq_hz; /* max frequency supported by pad */
}; };
#define LTDC_MAX_LAYER 4 #define LTDC_MAX_LAYER 4
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment