From: Laurent Pinchart Date: Fri, 18 Nov 2016 01:22:37 +0000 (+0200) Subject: drm: rcar-du: Use the DRM panel API X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=bf7149f34241dcd6c95ea76b2b5ab4ff33f1c9b9;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git drm: rcar-du: Use the DRM panel API Instead of parsing the panel device tree node manually, use the panel API to delegate panel handling to a panel driver. Signed-off-by: Laurent Pinchart --- diff --git a/drivers/gpu/drm/rcar-du/Kconfig b/drivers/gpu/drm/rcar-du/Kconfig index 4c2fd056dd6d..2bab449add76 100644 --- a/drivers/gpu/drm/rcar-du/Kconfig +++ b/drivers/gpu/drm/rcar-du/Kconfig @@ -20,6 +20,7 @@ config DRM_RCAR_HDMI config DRM_RCAR_LVDS bool "R-Car DU LVDS Encoder Support" depends on DRM_RCAR_DU + select DRM_PANEL help Enable support for the R-Car Display Unit embedded LVDS encoders. diff --git a/drivers/gpu/drm/rcar-du/rcar_du_encoder.c b/drivers/gpu/drm/rcar-du/rcar_du_encoder.c index 3974d9495f37..31f878ad099d 100644 --- a/drivers/gpu/drm/rcar-du/rcar_du_encoder.c +++ b/drivers/gpu/drm/rcar-du/rcar_du_encoder.c @@ -16,6 +16,7 @@ #include #include #include +#include #include "rcar_du_drv.h" #include "rcar_du_encoder.h" @@ -33,6 +34,11 @@ static void rcar_du_encoder_disable(struct drm_encoder *encoder) { struct rcar_du_encoder *renc = to_rcar_encoder(encoder); + if (renc->connector && renc->connector->panel) { + drm_panel_disable(renc->connector->panel); + drm_panel_unprepare(renc->connector->panel); + } + if (renc->lvds) rcar_du_lvdsenc_enable(renc->lvds, encoder->crtc, false); } @@ -43,6 +49,11 @@ static void rcar_du_encoder_enable(struct drm_encoder *encoder) if (renc->lvds) rcar_du_lvdsenc_enable(renc->lvds, encoder->crtc, true); + + if (renc->connector && renc->connector->panel) { + drm_panel_prepare(renc->connector->panel); + drm_panel_enable(renc->connector->panel); + } } static int rcar_du_encoder_atomic_check(struct drm_encoder *encoder, @@ -89,6 +100,17 @@ static void rcar_du_encoder_mode_set(struct drm_encoder *encoder, struct rcar_du_encoder *renc = to_rcar_encoder(encoder); rcar_du_crtc_route_output(crtc_state->crtc, renc->output); + + if (!renc->lvds) { + /* + * The DU driver creates connectors only for the outputs of the + * internal LVDS encoders. + */ + renc->connector = NULL; + return; + } + + renc->connector = to_rcar_connector(conn_state->connector); } static const struct drm_encoder_helper_funcs encoder_helper_funcs = { diff --git a/drivers/gpu/drm/rcar-du/rcar_du_encoder.h b/drivers/gpu/drm/rcar-du/rcar_du_encoder.h index a050a3699857..b79b2f075a74 100644 --- a/drivers/gpu/drm/rcar-du/rcar_du_encoder.h +++ b/drivers/gpu/drm/rcar-du/rcar_du_encoder.h @@ -17,6 +17,7 @@ #include #include +struct drm_panel; struct rcar_du_device; struct rcar_du_hdmienc; struct rcar_du_lvdsenc; @@ -32,6 +33,7 @@ enum rcar_du_encoder_type { struct rcar_du_encoder { struct drm_encoder base; enum rcar_du_output output; + struct rcar_du_connector *connector; struct rcar_du_hdmienc *hdmi; struct rcar_du_lvdsenc *lvds; }; @@ -44,6 +46,7 @@ struct rcar_du_encoder { struct rcar_du_connector { struct drm_connector connector; struct rcar_du_encoder *encoder; + struct drm_panel *panel; }; #define to_rcar_connector(c) \ diff --git a/drivers/gpu/drm/rcar-du/rcar_du_lvdscon.c b/drivers/gpu/drm/rcar-du/rcar_du_lvdscon.c index 3bcfd161c53f..ee91481131ad 100644 --- a/drivers/gpu/drm/rcar-du/rcar_du_lvdscon.c +++ b/drivers/gpu/drm/rcar-du/rcar_du_lvdscon.c @@ -15,6 +15,7 @@ #include #include #include +#include #include