Commit 438c0f85 authored by Rahul Sharma's avatar Rahul Sharma Committed by Inki Dae

drm/exynos: add display-mode-check operation to exynos_mixer_ops struct

This patch adds the display mode check operation to exynos_mixer_ops
in drm-common-hdmi. In Exynos SoCs, mixer IP can put certain restrictions
on the proposed display modes. These restriction needs to be considered
during mode negotiation, which happens immediately after edid parsing.

Both, mixer check-mode and hdmi check-timing callbacks are called one after
another and ANDed result is returned back.
Signed-off-by: default avatarRahul Sharma <rahul.sharma@samsung.com>
Reviewed-by: default avatarSean Paul <seanpaul@chromium.org>
Signed-off-by: default avatarInki Dae <inki.dae@samsung.com>
parent 979c0c7e
...@@ -124,9 +124,21 @@ static struct edid *drm_hdmi_get_edid(struct device *dev, ...@@ -124,9 +124,21 @@ static struct edid *drm_hdmi_get_edid(struct device *dev,
static int drm_hdmi_check_timing(struct device *dev, void *timing) static int drm_hdmi_check_timing(struct device *dev, void *timing)
{ {
struct drm_hdmi_context *ctx = to_context(dev); struct drm_hdmi_context *ctx = to_context(dev);
int ret = 0;
DRM_DEBUG_KMS("%s\n", __FILE__); DRM_DEBUG_KMS("%s\n", __FILE__);
/*
* Both, mixer and hdmi should be able to handle the requested mode.
* If any of the two fails, return mode as BAD.
*/
if (mixer_ops && mixer_ops->check_timing)
ret = mixer_ops->check_timing(ctx->mixer_ctx->ctx, timing);
if (ret)
return ret;
if (hdmi_ops && hdmi_ops->check_timing) if (hdmi_ops && hdmi_ops->check_timing)
return hdmi_ops->check_timing(ctx->hdmi_ctx->ctx, timing); return hdmi_ops->check_timing(ctx->hdmi_ctx->ctx, timing);
......
...@@ -32,7 +32,7 @@ struct exynos_hdmi_ops { ...@@ -32,7 +32,7 @@ struct exynos_hdmi_ops {
bool (*is_connected)(void *ctx); bool (*is_connected)(void *ctx);
struct edid *(*get_edid)(void *ctx, struct edid *(*get_edid)(void *ctx,
struct drm_connector *connector); struct drm_connector *connector);
int (*check_timing)(void *ctx, void *timing); int (*check_timing)(void *ctx, struct fb_videomode *timing);
int (*power_on)(void *ctx, int mode); int (*power_on)(void *ctx, int mode);
/* manager */ /* manager */
...@@ -58,6 +58,9 @@ struct exynos_mixer_ops { ...@@ -58,6 +58,9 @@ struct exynos_mixer_ops {
void (*win_mode_set)(void *ctx, struct exynos_drm_overlay *overlay); void (*win_mode_set)(void *ctx, struct exynos_drm_overlay *overlay);
void (*win_commit)(void *ctx, int zpos); void (*win_commit)(void *ctx, int zpos);
void (*win_disable)(void *ctx, int zpos); void (*win_disable)(void *ctx, int zpos);
/* display */
int (*check_timing)(void *ctx, struct fb_videomode *timing);
}; };
void exynos_hdmi_drv_attach(struct exynos_drm_hdmi_context *ctx); void exynos_hdmi_drv_attach(struct exynos_drm_hdmi_context *ctx);
......
...@@ -1457,21 +1457,20 @@ static int hdmi_v14_check_timing(struct fb_videomode *check_timing) ...@@ -1457,21 +1457,20 @@ static int hdmi_v14_check_timing(struct fb_videomode *check_timing)
return -EINVAL; return -EINVAL;
} }
static int hdmi_check_timing(void *ctx, void *timing) static int hdmi_check_timing(void *ctx, struct fb_videomode *timing)
{ {
struct hdmi_context *hdata = ctx; struct hdmi_context *hdata = ctx;
struct fb_videomode *check_timing = timing;
DRM_DEBUG_KMS("[%d] %s\n", __LINE__, __func__); DRM_DEBUG_KMS("[%d] %s\n", __LINE__, __func__);
DRM_DEBUG_KMS("[%d]x[%d] [%d]Hz [%x]\n", check_timing->xres, DRM_DEBUG_KMS("[%d]x[%d] [%d]Hz [%x]\n", timing->xres,
check_timing->yres, check_timing->refresh, timing->yres, timing->refresh,
check_timing->vmode); timing->vmode);
if (hdata->type == HDMI_TYPE13) if (hdata->type == HDMI_TYPE13)
return hdmi_v13_check_timing(check_timing); return hdmi_v13_check_timing(timing);
else else
return hdmi_v14_check_timing(check_timing); return hdmi_v14_check_timing(timing);
} }
static void hdmi_set_acr(u32 freq, u8 *acr) static void hdmi_set_acr(u32 freq, u8 *acr)
......
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