Skip to content
This repository was archived by the owner on Sep 18, 2022. It is now read-only.

Commit 4678078

Browse files
committed
drm/panel: s6e3fa5: Read panel orientation
The panel is mounted upside down on the OnePlus 5, so we need to handle this in the driver.
1 parent 70c1ef7 commit 4678078

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

drivers/gpu/drm/panel/panel-samsung-s6e3fa5.c

+11
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,14 @@
1313

1414
#include <video/mipi_display.h>
1515

16+
#include <drm/drm_connector.h>
1617
#include <drm/drm_mipi_dsi.h>
1718
#include <drm/drm_modes.h>
1819
#include <drm/drm_panel.h>
1920

2021
struct s6e3fa5 {
2122
struct drm_panel panel;
23+
enum drm_panel_orientation orientation;
2224
struct mipi_dsi_device *dsi;
2325
struct regulator *supply;
2426
struct gpio_desc *reset_gpio;
@@ -182,16 +184,19 @@ static int s6e3fa5_get_modes(struct drm_panel *panel,
182184
struct drm_connector *connector)
183185
{
184186
struct drm_display_mode *mode;
187+
struct s6e3fa5 *ctx;
185188

186189
mode = drm_mode_duplicate(connector->dev, &s6e3fa5_mode);
187190
if (!mode)
188191
return -ENOMEM;
192+
ctx = to_s6e3fa5_panel(panel);
189193

190194
drm_mode_set_name(mode);
191195

192196
mode->type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED;
193197
connector->display_info.width_mm = mode->width_mm;
194198
connector->display_info.height_mm = mode->height_mm;
199+
drm_connector_set_panel_orientation(connector, ctx->orientation);
195200
drm_mode_probed_add(connector, mode);
196201

197202
return 1;
@@ -287,6 +292,12 @@ static int s6e3fa5_probe(struct mipi_dsi_device *dsi)
287292
MIPI_DSI_MODE_EOT_PACKET |
288293
MIPI_DSI_CLOCK_NON_CONTINUOUS;
289294

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+
290301
drm_panel_init(&ctx->panel, dev, &s6e3fa5_panel_funcs,
291302
DRM_MODE_CONNECTOR_DSI);
292303

0 commit comments

Comments
 (0)