summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/rcar-du/rcar_du_encoder.c
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>2013-06-17 05:13:11 +0400
committerLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>2013-08-10 01:17:52 +0400
commitef67a902e946ad1ef51040cf287a45cc4714e2b5 (patch)
tree8539a95cefc69a1c2553ec8d987a40e6048feedd /drivers/gpu/drm/rcar-du/rcar_du_encoder.c
parent38b62fb3808e6b57dbd7728e897e4f7674d1c998 (diff)
downloadlinux-ef67a902e946ad1ef51040cf287a45cc4714e2b5.tar.xz
drm/rcar-du: Rework output routing support
Split the output routing specification between SoC-internal data, specified in the rcar_du_device_info structure, and board data, passed through platform data. The DU has 5 possible outputs (DPAD0/1, LVDS0/1, TCON). SoC-internal output routing data specify which output are valid, which CRTCs can be connected to the valid outputs, and the type of in-SoC encoder for the output. Platform data then specifies external encoders and the output they are connected to. Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Diffstat (limited to 'drivers/gpu/drm/rcar-du/rcar_du_encoder.c')
-rw-r--r--drivers/gpu/drm/rcar-du/rcar_du_encoder.c26
1 files changed, 21 insertions, 5 deletions
diff --git a/drivers/gpu/drm/rcar-du/rcar_du_encoder.c b/drivers/gpu/drm/rcar-du/rcar_du_encoder.c
index 0d0375c7ee44..2aac28d21f87 100644
--- a/drivers/gpu/drm/rcar-du/rcar_du_encoder.c
+++ b/drivers/gpu/drm/rcar-du/rcar_du_encoder.c
@@ -115,10 +115,12 @@ static const struct drm_encoder_funcs encoder_funcs = {
};
int rcar_du_encoder_init(struct rcar_du_device *rcdu,
- enum rcar_du_encoder_type type, unsigned int output,
+ enum rcar_du_encoder_type type,
+ enum rcar_du_output output,
const struct rcar_du_encoder_data *data)
{
struct rcar_du_encoder *renc;
+ unsigned int encoder_type;
int ret;
renc = devm_kzalloc(rcdu->dev, sizeof(*renc), GFP_KERNEL);
@@ -127,19 +129,33 @@ int rcar_du_encoder_init(struct rcar_du_device *rcdu,
renc->output = output;
+ switch (type) {
+ case RCAR_DU_ENCODER_VGA:
+ encoder_type = DRM_MODE_ENCODER_DAC;
+ break;
+ case RCAR_DU_ENCODER_LVDS:
+ encoder_type = DRM_MODE_ENCODER_LVDS;
+ break;
+ case RCAR_DU_ENCODER_NONE:
+ default:
+ /* No external encoder, use the internal encoder type. */
+ encoder_type = rcdu->info->routes[output].encoder_type;
+ break;
+ }
+
ret = drm_encoder_init(rcdu->ddev, &renc->encoder, &encoder_funcs,
- type);
+ encoder_type);
if (ret < 0)
return ret;
drm_encoder_helper_add(&renc->encoder, &encoder_helper_funcs);
- switch (type) {
- case RCAR_DU_ENCODER_LVDS:
+ switch (encoder_type) {
+ case DRM_MODE_ENCODER_LVDS:
return rcar_du_lvds_connector_init(rcdu, renc,
&data->connector.lvds.panel);
- case RCAR_DU_ENCODER_VGA:
+ case DRM_MODE_ENCODER_DAC:
return rcar_du_vga_connector_init(rcdu, renc);
default: