|
13 | 13 |
|
14 | 14 | #include <video/mipi_display.h>
|
15 | 15 |
|
| 16 | +#include <drm/drm_connector.h> |
16 | 17 | #include <drm/drm_mipi_dsi.h>
|
17 | 18 | #include <drm/drm_modes.h>
|
18 | 19 | #include <drm/drm_panel.h>
|
19 | 20 |
|
20 | 21 | struct s6e3fa5 {
|
21 | 22 | struct drm_panel panel;
|
| 23 | + enum drm_panel_orientation orientation; |
22 | 24 | struct mipi_dsi_device *dsi;
|
23 | 25 | struct regulator *supply;
|
24 | 26 | struct gpio_desc *reset_gpio;
|
@@ -182,16 +184,19 @@ static int s6e3fa5_get_modes(struct drm_panel *panel,
|
182 | 184 | struct drm_connector *connector)
|
183 | 185 | {
|
184 | 186 | struct drm_display_mode *mode;
|
| 187 | + struct s6e3fa5 *ctx; |
185 | 188 |
|
186 | 189 | mode = drm_mode_duplicate(connector->dev, &s6e3fa5_mode);
|
187 | 190 | if (!mode)
|
188 | 191 | return -ENOMEM;
|
| 192 | + ctx = to_s6e3fa5_panel(panel); |
189 | 193 |
|
190 | 194 | drm_mode_set_name(mode);
|
191 | 195 |
|
192 | 196 | mode->type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED;
|
193 | 197 | connector->display_info.width_mm = mode->width_mm;
|
194 | 198 | connector->display_info.height_mm = mode->height_mm;
|
| 199 | + drm_connector_set_panel_orientation(connector, ctx->orientation); |
195 | 200 | drm_mode_probed_add(connector, mode);
|
196 | 201 |
|
197 | 202 | return 1;
|
@@ -287,6 +292,12 @@ static int s6e3fa5_probe(struct mipi_dsi_device *dsi)
|
287 | 292 | MIPI_DSI_MODE_EOT_PACKET |
|
288 | 293 | MIPI_DSI_CLOCK_NON_CONTINUOUS;
|
289 | 294 |
|
| 295 | + ret = of_drm_get_panel_orientation(dev->of_node, &ctx->orientation); |
| 296 | + if (ret < 0) { |
| 297 | + dev_err(dev, "Failed to parse rotation property: %d\n", ret); |
| 298 | + return ret; |
| 299 | + } |
| 300 | + |
290 | 301 | drm_panel_init(&ctx->panel, dev, &s6e3fa5_panel_funcs,
|
291 | 302 | DRM_MODE_CONNECTOR_DSI);
|
292 | 303 |
|
|
0 commit comments