diff options
Diffstat (limited to 'drivers/gpu/drm/rcar-du/rcar_du_lvdscon.c')
-rw-r--r-- | drivers/gpu/drm/rcar-du/rcar_du_lvdscon.c | 45 |
1 files changed, 27 insertions, 18 deletions
diff --git a/drivers/gpu/drm/rcar-du/rcar_du_lvdscon.c b/drivers/gpu/drm/rcar-du/rcar_du_lvdscon.c index 21426bd234eb..115eed20db12 100644 --- a/drivers/gpu/drm/rcar-du/rcar_du_lvdscon.c +++ b/drivers/gpu/drm/rcar-du/rcar_du_lvdscon.c @@ -1,7 +1,7 @@ /* * rcar_du_lvdscon.c -- R-Car Display Unit LVDS Connector * - * Copyright (C) 2013 Renesas Corporation + * Copyright (C) 2013-2014 Renesas Electronics Corporation * * Contact: Laurent Pinchart (laurent.pinchart@ideasonboard.com) * @@ -15,6 +15,10 @@ #include <drm/drm_crtc.h> #include <drm/drm_crtc_helper.h> +#include <video/display_timing.h> +#include <video/of_display_timing.h> +#include <video/videomode.h> + #include "rcar_du_drv.h" #include "rcar_du_encoder.h" #include "rcar_du_kms.h" @@ -23,7 +27,7 @@ struct rcar_du_lvds_connector { struct rcar_du_connector connector; - const struct rcar_du_panel_data *panel; + struct rcar_du_panel_data panel; }; #define to_rcar_lvds_connector(c) \ @@ -40,18 +44,9 @@ static int rcar_du_lvds_connector_get_modes(struct drm_connector *connector) return 0; mode->type = DRM_MODE_TYPE_PREFERRED | DRM_MODE_TYPE_DRIVER; - mode->clock = lvdscon->panel->mode.clock; - mode->hdisplay = lvdscon->panel->mode.hdisplay; - mode->hsync_start = lvdscon->panel->mode.hsync_start; - mode->hsync_end = lvdscon->panel->mode.hsync_end; - mode->htotal = lvdscon->panel->mode.htotal; - mode->vdisplay = lvdscon->panel->mode.vdisplay; - mode->vsync_start = lvdscon->panel->mode.vsync_start; - mode->vsync_end = lvdscon->panel->mode.vsync_end; - mode->vtotal = lvdscon->panel->mode.vtotal; - mode->flags = lvdscon->panel->mode.flags; - - drm_mode_set_name(mode); + + drm_display_mode_from_videomode(&lvdscon->panel.mode, mode); + drm_mode_probed_add(connector, mode); return 1; @@ -83,7 +78,8 @@ static const struct drm_connector_funcs connector_funcs = { int rcar_du_lvds_connector_init(struct rcar_du_device *rcdu, struct rcar_du_encoder *renc, - const struct rcar_du_panel_data *panel) + const struct rcar_du_panel_data *panel, + /* TODO const */ struct device_node *np) { struct rcar_du_lvds_connector *lvdscon; struct drm_connector *connector; @@ -93,11 +89,24 @@ int rcar_du_lvds_connector_init(struct rcar_du_device *rcdu, if (lvdscon == NULL) return -ENOMEM; - lvdscon->panel = panel; + if (panel) { + lvdscon->panel = *panel; + } else { + struct display_timing timing; + + ret = of_get_display_timing(np, "panel-timing", &timing); + if (ret < 0) + return ret; + + videomode_from_timing(&timing, &lvdscon->panel.mode); + + of_property_read_u32(np, "width-mm", &lvdscon->panel.width_mm); + of_property_read_u32(np, "height-mm", &lvdscon->panel.height_mm); + } connector = &lvdscon->connector.connector; - connector->display_info.width_mm = panel->width_mm; - connector->display_info.height_mm = panel->height_mm; + connector->display_info.width_mm = lvdscon->panel.width_mm; + connector->display_info.height_mm = lvdscon->panel.height_mm; ret = drm_connector_init(rcdu->ddev, connector, &connector_funcs, DRM_MODE_CONNECTOR_LVDS); |