panel-nx: add drm orientation
This commit is contained in:
1 parent
2aa5b04a01
commit
3e090e8a5a
1 file changed
+21
-1
@@ -1,6 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2018 SwtcR <swtcr0@gmail.com>
|
* Copyright (C) 2018 SwtcR <swtcr0@gmail.com>
|
||||||
* Copyright (C) 2023-2024 Azkali <a.ffcc7@gmail.com>
|
* Copyright (C) 2023-2026 Azkali <a.ffcc7@gmail.com>
|
||||||
|
* Copyright (C) 2026 Thomas Makin <halorocker89@gmail.com>
|
||||||
*
|
*
|
||||||
* Based on Sharp ls043t1le01 panel driver by Werner Johansson <werner.johansson@sonymobile.com>
|
* Based on Sharp ls043t1le01 panel driver by Werner Johansson <werner.johansson@sonymobile.com>
|
||||||
*
|
*
|
||||||
@@ -27,6 +28,7 @@
|
|||||||
#include <video/mipi_display.h>
|
#include <video/mipi_display.h>
|
||||||
|
|
||||||
#include <drm/drm_mipi_dsi.h>
|
#include <drm/drm_mipi_dsi.h>
|
||||||
|
#include <drm/drm_of.h>
|
||||||
#include <drm/drm_crtc.h>
|
#include <drm/drm_crtc.h>
|
||||||
#include <drm/drm_panel.h>
|
#include <drm/drm_panel.h>
|
||||||
#include <drm/drm_modes.h>
|
#include <drm/drm_modes.h>
|
||||||
@@ -110,6 +112,7 @@ struct nx_panel {
|
|||||||
bool enabled;
|
bool enabled;
|
||||||
|
|
||||||
const struct drm_display_mode *mode;
|
const struct drm_display_mode *mode;
|
||||||
|
enum drm_panel_orientation orientation;
|
||||||
|
|
||||||
struct init_cmd *init_cmds;
|
struct init_cmd *init_cmds;
|
||||||
struct init_cmd *suspend_cmds;
|
struct init_cmd *suspend_cmds;
|
||||||
@@ -631,21 +634,32 @@ static int nx_panel_get_modes(struct drm_panel *panel,
|
|||||||
connector->display_info.height_mm = 137;
|
connector->display_info.height_mm = 137;
|
||||||
connector->display_info.bpc = 8;
|
connector->display_info.bpc = 8;
|
||||||
|
|
||||||
|
drm_connector_set_panel_orientation(connector, nx->orientation);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static enum drm_panel_orientation nx_panel_get_orientation(struct drm_panel *panel)
|
||||||
|
{
|
||||||
|
struct nx_panel *nx = to_nx_panel(panel);
|
||||||
|
|
||||||
|
return nx->orientation;
|
||||||
|
}
|
||||||
|
|
||||||
static const struct drm_panel_funcs nx_panel_funcs = {
|
static const struct drm_panel_funcs nx_panel_funcs = {
|
||||||
.prepare = nx_panel_prepare,
|
.prepare = nx_panel_prepare,
|
||||||
.unprepare = nx_panel_unprepare,
|
.unprepare = nx_panel_unprepare,
|
||||||
.enable = nx_panel_enable,
|
.enable = nx_panel_enable,
|
||||||
.disable = nx_panel_disable,
|
.disable = nx_panel_disable,
|
||||||
.get_modes = nx_panel_get_modes,
|
.get_modes = nx_panel_get_modes,
|
||||||
|
.get_orientation = nx_panel_get_orientation,
|
||||||
};
|
};
|
||||||
|
|
||||||
static int nx_panel_add(struct nx_panel *nx)
|
static int nx_panel_add(struct nx_panel *nx)
|
||||||
{
|
{
|
||||||
struct device *dev = &nx->dsi->dev;
|
struct device *dev = &nx->dsi->dev;
|
||||||
struct device_node *np;
|
struct device_node *np;
|
||||||
|
int ret;
|
||||||
|
|
||||||
nx->mode = &default_mode;
|
nx->mode = &default_mode;
|
||||||
|
|
||||||
@@ -677,6 +691,12 @@ static int nx_panel_add(struct nx_panel *nx)
|
|||||||
return -EPROBE_DEFER;
|
return -EPROBE_DEFER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ret = of_drm_get_panel_orientation(dev->of_node, &nx->orientation);
|
||||||
|
if (ret < 0) {
|
||||||
|
dev_err(dev, "Failed to get orientation %d\n", ret);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
drm_panel_init(&nx->base, &nx->dsi->dev, &nx_panel_funcs,
|
drm_panel_init(&nx->base, &nx->dsi->dev, &nx_panel_funcs,
|
||||||
DRM_MODE_CONNECTOR_DSI);
|
DRM_MODE_CONNECTOR_DSI);
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user