aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_output.c
diff options
context:
space:
mode:
authorBoris Brezillon <boris.brezillon@free-electrons.com>2016-01-06 05:14:15 -0500
committerBoris Brezillon <boris.brezillon@free-electrons.com>2016-04-14 03:17:27 -0400
commitaca63b766140f1abf14cbc22ccc5d7c7599b807c (patch)
treed2a0a8fc3317c4d34a0e57eaa4a1e1b86d50eb7d /drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_output.c
parent79a3fc2d98111e371bd4c49e6f2de26ef8deb03f (diff)
drm: atmel-hlcdc: move output mode selection in CRTC implementation
In order to support multiple outputs we need to move the output mode selection to the CRTC object, so that the output validity check can be done against the drm_atomic_state. If the connectors selected by a specific mode setting are requiring incompatible bus format the atomic operation is aborted (->atomic_check() returns -EINVAL). In order to implement that, we need to define our own CRTC state and overload default ->reset(), ->atomic_duplicate_state() and ->atomic_destroy_state() functions. Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com> Tested-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Diffstat (limited to 'drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_output.c')
-rw-r--r--drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_output.c46
1 files changed, 0 insertions, 46 deletions
diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_output.c b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_output.c
index 2255dc9ab349..75237b556c58 100644
--- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_output.c
+++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_output.c
@@ -27,16 +27,6 @@
27#include "atmel_hlcdc_dc.h" 27#include "atmel_hlcdc_dc.h"
28 28
29/** 29/**
30 * Atmel HLCDC RGB output mode
31 */
32enum atmel_hlcdc_connector_rgb_mode {
33 ATMEL_HLCDC_CONNECTOR_RGB444,
34 ATMEL_HLCDC_CONNECTOR_RGB565,
35 ATMEL_HLCDC_CONNECTOR_RGB666,
36 ATMEL_HLCDC_CONNECTOR_RGB888,
37};
38
39/**
40 * Atmel HLCDC RGB connector structure 30 * Atmel HLCDC RGB connector structure
41 * 31 *
42 * This structure stores RGB slave device information. 32 * This structure stores RGB slave device information.
@@ -89,7 +79,6 @@ static void atmel_hlcdc_panel_encoder_enable(struct drm_encoder *encoder)
89 struct atmel_hlcdc_rgb_output *rgb = 79 struct atmel_hlcdc_rgb_output *rgb =
90 drm_encoder_to_atmel_hlcdc_rgb_output(encoder); 80 drm_encoder_to_atmel_hlcdc_rgb_output(encoder);
91 struct atmel_hlcdc_panel *panel = atmel_hlcdc_rgb_output_to_panel(rgb); 81 struct atmel_hlcdc_panel *panel = atmel_hlcdc_rgb_output_to_panel(rgb);
92
93 drm_panel_enable(panel->panel); 82 drm_panel_enable(panel->panel);
94} 83}
95 84
@@ -102,42 +91,7 @@ static void atmel_hlcdc_panel_encoder_disable(struct drm_encoder *encoder)
102 drm_panel_disable(panel->panel); 91 drm_panel_disable(panel->panel);
103} 92}
104 93
105static void
106atmel_hlcdc_rgb_encoder_mode_set(struct drm_encoder *encoder,
107 struct drm_display_mode *mode,
108 struct drm_display_mode *adjusted)
109{
110 struct atmel_hlcdc_rgb_output *rgb =
111 drm_encoder_to_atmel_hlcdc_rgb_output(encoder);
112 struct drm_display_info *info = &rgb->connector.display_info;
113 unsigned int cfg;
114
115 cfg = 0;
116
117 if (info->num_bus_formats) {
118 switch (info->bus_formats[0]) {
119 case MEDIA_BUS_FMT_RGB565_1X16:
120 cfg |= ATMEL_HLCDC_CONNECTOR_RGB565 << 8;
121 break;
122 case MEDIA_BUS_FMT_RGB666_1X18:
123 cfg |= ATMEL_HLCDC_CONNECTOR_RGB666 << 8;
124 break;
125 case MEDIA_BUS_FMT_RGB888_1X24:
126 cfg |= ATMEL_HLCDC_CONNECTOR_RGB888 << 8;
127 break;
128 case MEDIA_BUS_FMT_RGB444_1X12:
129 default:
130 break;
131 }
132 }
133
134 regmap_update_bits(rgb->dc->hlcdc->regmap, ATMEL_HLCDC_CFG(5),
135 ATMEL_HLCDC_MODE_MASK,
136 cfg);
137}
138
139static const struct drm_encoder_helper_funcs atmel_hlcdc_panel_encoder_helper_funcs = { 94static const struct drm_encoder_helper_funcs atmel_hlcdc_panel_encoder_helper_funcs = {
140 .mode_set = atmel_hlcdc_rgb_encoder_mode_set,
141 .disable = atmel_hlcdc_panel_encoder_disable, 95 .disable = atmel_hlcdc_panel_encoder_disable,
142 .enable = atmel_hlcdc_panel_encoder_enable, 96 .enable = atmel_hlcdc_panel_encoder_enable,
143}; 97};