提交 ede7714f 编写于 作者: L Laurent Pinchart

drm: rcar-du: Replace encoder mode_fixup with atomic_check

The encoder .mode_fixup() operation is legacy, atomic updates uses the
new .atomic_check() operation. Convert the encoders drivers.
Signed-off-by: NLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
上级 f3483232
...@@ -58,35 +58,24 @@ static void rcar_du_encoder_enable(struct drm_encoder *encoder) ...@@ -58,35 +58,24 @@ static void rcar_du_encoder_enable(struct drm_encoder *encoder)
rcar_du_lvdsenc_enable(renc->lvds, encoder->crtc, true); rcar_du_lvdsenc_enable(renc->lvds, encoder->crtc, true);
} }
static bool rcar_du_encoder_mode_fixup(struct drm_encoder *encoder, static int rcar_du_encoder_atomic_check(struct drm_encoder *encoder,
const struct drm_display_mode *mode, struct drm_crtc_state *crtc_state,
struct drm_display_mode *adjusted_mode) struct drm_connector_state *conn_state)
{ {
struct rcar_du_encoder *renc = to_rcar_encoder(encoder); struct rcar_du_encoder *renc = to_rcar_encoder(encoder);
struct drm_display_mode *adjusted_mode = &crtc_state->adjusted_mode;
const struct drm_display_mode *mode = &crtc_state->mode;
const struct drm_display_mode *panel_mode; const struct drm_display_mode *panel_mode;
struct drm_connector *connector = conn_state->connector;
struct drm_device *dev = encoder->dev; struct drm_device *dev = encoder->dev;
struct drm_connector *connector;
bool found = false;
/* DAC encoders have currently no restriction on the mode. */ /* DAC encoders have currently no restriction on the mode. */
if (encoder->encoder_type == DRM_MODE_ENCODER_DAC) if (encoder->encoder_type == DRM_MODE_ENCODER_DAC)
return true; return 0;
list_for_each_entry(connector, &dev->mode_config.connector_list, head) {
if (connector->encoder == encoder) {
found = true;
break;
}
}
if (!found) {
dev_dbg(dev->dev, "mode_fixup: no connector found\n");
return false;
}
if (list_empty(&connector->modes)) { if (list_empty(&connector->modes)) {
dev_dbg(dev->dev, "mode_fixup: empty modes list\n"); dev_dbg(dev->dev, "encoder: empty modes list\n");
return false; return -EINVAL;
} }
panel_mode = list_first_entry(&connector->modes, panel_mode = list_first_entry(&connector->modes,
...@@ -95,7 +84,7 @@ static bool rcar_du_encoder_mode_fixup(struct drm_encoder *encoder, ...@@ -95,7 +84,7 @@ static bool rcar_du_encoder_mode_fixup(struct drm_encoder *encoder,
/* We're not allowed to modify the resolution. */ /* We're not allowed to modify the resolution. */
if (mode->hdisplay != panel_mode->hdisplay || if (mode->hdisplay != panel_mode->hdisplay ||
mode->vdisplay != panel_mode->vdisplay) mode->vdisplay != panel_mode->vdisplay)
return false; return -EINVAL;
/* The flat panel mode is fixed, just copy it to the adjusted mode. */ /* The flat panel mode is fixed, just copy it to the adjusted mode. */
drm_mode_copy(adjusted_mode, panel_mode); drm_mode_copy(adjusted_mode, panel_mode);
...@@ -107,7 +96,7 @@ static bool rcar_du_encoder_mode_fixup(struct drm_encoder *encoder, ...@@ -107,7 +96,7 @@ static bool rcar_du_encoder_mode_fixup(struct drm_encoder *encoder,
adjusted_mode->clock = clamp(adjusted_mode->clock, adjusted_mode->clock = clamp(adjusted_mode->clock,
30000, 150000); 30000, 150000);
return true; return 0;
} }
static void rcar_du_encoder_mode_set(struct drm_encoder *encoder, static void rcar_du_encoder_mode_set(struct drm_encoder *encoder,
...@@ -120,10 +109,10 @@ static void rcar_du_encoder_mode_set(struct drm_encoder *encoder, ...@@ -120,10 +109,10 @@ static void rcar_du_encoder_mode_set(struct drm_encoder *encoder,
} }
static const struct drm_encoder_helper_funcs encoder_helper_funcs = { static const struct drm_encoder_helper_funcs encoder_helper_funcs = {
.mode_fixup = rcar_du_encoder_mode_fixup,
.mode_set = rcar_du_encoder_mode_set, .mode_set = rcar_du_encoder_mode_set,
.disable = rcar_du_encoder_disable, .disable = rcar_du_encoder_disable,
.enable = rcar_du_encoder_enable, .enable = rcar_du_encoder_enable,
.atomic_check = rcar_du_encoder_atomic_check,
}; };
static const struct drm_encoder_funcs encoder_funcs = { static const struct drm_encoder_funcs encoder_funcs = {
......
...@@ -62,12 +62,14 @@ static void rcar_du_hdmienc_enable(struct drm_encoder *encoder) ...@@ -62,12 +62,14 @@ static void rcar_du_hdmienc_enable(struct drm_encoder *encoder)
hdmienc->enabled = true; hdmienc->enabled = true;
} }
static bool rcar_du_hdmienc_mode_fixup(struct drm_encoder *encoder, static int rcar_du_hdmienc_atomic_check(struct drm_encoder *encoder,
const struct drm_display_mode *mode, struct drm_crtc_state *crtc_state,
struct drm_display_mode *adjusted_mode) struct drm_connector_state *conn_state)
{ {
struct rcar_du_hdmienc *hdmienc = to_rcar_hdmienc(encoder); struct rcar_du_hdmienc *hdmienc = to_rcar_hdmienc(encoder);
struct drm_encoder_slave_funcs *sfuncs = to_slave_funcs(encoder); struct drm_encoder_slave_funcs *sfuncs = to_slave_funcs(encoder);
struct drm_display_mode *adjusted_mode = &crtc_state->adjusted_mode;
const struct drm_display_mode *mode = &crtc_state->mode;
/* The internal LVDS encoder has a clock frequency operating range of /* The internal LVDS encoder has a clock frequency operating range of
* 30MHz to 150MHz. Clamp the clock accordingly. * 30MHz to 150MHz. Clamp the clock accordingly.
...@@ -77,9 +79,9 @@ static bool rcar_du_hdmienc_mode_fixup(struct drm_encoder *encoder, ...@@ -77,9 +79,9 @@ static bool rcar_du_hdmienc_mode_fixup(struct drm_encoder *encoder,
30000, 150000); 30000, 150000);
if (sfuncs->mode_fixup == NULL) if (sfuncs->mode_fixup == NULL)
return true; return 0;
return sfuncs->mode_fixup(encoder, mode, adjusted_mode); return sfuncs->mode_fixup(encoder, mode, adjusted_mode) ? 0 : -EINVAL;
} }
static void rcar_du_hdmienc_mode_set(struct drm_encoder *encoder, static void rcar_du_hdmienc_mode_set(struct drm_encoder *encoder,
...@@ -96,10 +98,10 @@ static void rcar_du_hdmienc_mode_set(struct drm_encoder *encoder, ...@@ -96,10 +98,10 @@ static void rcar_du_hdmienc_mode_set(struct drm_encoder *encoder,
} }
static const struct drm_encoder_helper_funcs encoder_helper_funcs = { static const struct drm_encoder_helper_funcs encoder_helper_funcs = {
.mode_fixup = rcar_du_hdmienc_mode_fixup,
.mode_set = rcar_du_hdmienc_mode_set, .mode_set = rcar_du_hdmienc_mode_set,
.disable = rcar_du_hdmienc_disable, .disable = rcar_du_hdmienc_disable,
.enable = rcar_du_hdmienc_enable, .enable = rcar_du_hdmienc_enable,
.atomic_check = rcar_du_hdmienc_atomic_check,
}; };
static void rcar_du_hdmienc_cleanup(struct drm_encoder *encoder) static void rcar_du_hdmienc_cleanup(struct drm_encoder *encoder)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册