Commit 5bd785a8 authored by Raphael GALLAIS-POU - foss's avatar Raphael GALLAIS-POU - foss Committed by Sam Ravnborg

drm/panel: otm8009a: add a 60 fps mode

This patch adds a 60 fps mode to the Orisetech OTM8009A panel.
The 50 fps mode is left as preferred.
Signed-off-by: default avatarRaphael Gallais-Pou <raphael.gallais-pou@foss.st.com>
Signed-off-by: default avatarSam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20210902150351.3779-1-raphael.gallais-pou@foss.st.com
parent a9fc4315
...@@ -60,6 +60,9 @@ ...@@ -60,6 +60,9 @@
#define MCS_CMD2_ENA1 0xFF00 /* Enable Access Command2 "CMD2" */ #define MCS_CMD2_ENA1 0xFF00 /* Enable Access Command2 "CMD2" */
#define MCS_CMD2_ENA2 0xFF80 /* Enable Access Orise Command2 */ #define MCS_CMD2_ENA2 0xFF80 /* Enable Access Orise Command2 */
#define OTM8009A_HDISPLAY 480
#define OTM8009A_VDISPLAY 800
struct otm8009a { struct otm8009a {
struct device *dev; struct device *dev;
struct drm_panel panel; struct drm_panel panel;
...@@ -70,7 +73,8 @@ struct otm8009a { ...@@ -70,7 +73,8 @@ struct otm8009a {
bool enabled; bool enabled;
}; };
static const struct drm_display_mode default_mode = { static const struct drm_display_mode modes[] = {
{ /* 50 Hz, preferred */
.clock = 29700, .clock = 29700,
.hdisplay = 480, .hdisplay = 480,
.hsync_start = 480 + 98, .hsync_start = 480 + 98,
...@@ -80,9 +84,24 @@ static const struct drm_display_mode default_mode = { ...@@ -80,9 +84,24 @@ static const struct drm_display_mode default_mode = {
.vsync_start = 800 + 15, .vsync_start = 800 + 15,
.vsync_end = 800 + 15 + 10, .vsync_end = 800 + 15 + 10,
.vtotal = 800 + 15 + 10 + 14, .vtotal = 800 + 15 + 10 + 14,
.flags = 0, .flags = DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC,
.width_mm = 52, .width_mm = 52,
.height_mm = 86, .height_mm = 86,
},
{ /* 60 Hz */
.clock = 33000,
.hdisplay = 480,
.hsync_start = 480 + 70,
.hsync_end = 480 + 70 + 32,
.htotal = 480 + 70 + 32 + 72,
.vdisplay = 800,
.vsync_start = 800 + 15,
.vsync_end = 800 + 15 + 10,
.vtotal = 800 + 15 + 10 + 16,
.flags = DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC,
.width_mm = 52,
.height_mm = 86,
},
}; };
static inline struct otm8009a *panel_to_otm8009a(struct drm_panel *panel) static inline struct otm8009a *panel_to_otm8009a(struct drm_panel *panel)
...@@ -208,12 +227,11 @@ static int otm8009a_init_sequence(struct otm8009a *ctx) ...@@ -208,12 +227,11 @@ static int otm8009a_init_sequence(struct otm8009a *ctx)
/* Default portrait 480x800 rgb24 */ /* Default portrait 480x800 rgb24 */
dcs_write_seq(ctx, MIPI_DCS_SET_ADDRESS_MODE, 0x00); dcs_write_seq(ctx, MIPI_DCS_SET_ADDRESS_MODE, 0x00);
ret = mipi_dsi_dcs_set_column_address(dsi, 0, ret = mipi_dsi_dcs_set_column_address(dsi, 0, OTM8009A_HDISPLAY - 1);
default_mode.hdisplay - 1);
if (ret) if (ret)
return ret; return ret;
ret = mipi_dsi_dcs_set_page_address(dsi, 0, default_mode.vdisplay - 1); ret = mipi_dsi_dcs_set_page_address(dsi, 0, OTM8009A_VDISPLAY - 1);
if (ret) if (ret)
return ret; return ret;
...@@ -337,24 +355,33 @@ static int otm8009a_get_modes(struct drm_panel *panel, ...@@ -337,24 +355,33 @@ static int otm8009a_get_modes(struct drm_panel *panel,
struct drm_connector *connector) struct drm_connector *connector)
{ {
struct drm_display_mode *mode; struct drm_display_mode *mode;
unsigned int num_modes = ARRAY_SIZE(modes);
unsigned int i;
mode = drm_mode_duplicate(connector->dev, &default_mode); for (i = 0; i < num_modes; i++) {
mode = drm_mode_duplicate(connector->dev, &modes[i]);
if (!mode) { if (!mode) {
dev_err(panel->dev, "failed to add mode %ux%u@%u\n", dev_err(panel->dev, "failed to add mode %ux%u@%u\n",
default_mode.hdisplay, default_mode.vdisplay, modes[i].hdisplay,
drm_mode_vrefresh(&default_mode)); modes[i].vdisplay,
drm_mode_vrefresh(&modes[i]));
return -ENOMEM; return -ENOMEM;
} }
drm_mode_set_name(mode); mode->type = DRM_MODE_TYPE_DRIVER;
mode->type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED; /* Setting first mode as preferred */
if (!i)
mode->type |= DRM_MODE_TYPE_PREFERRED;
drm_mode_set_name(mode);
drm_mode_probed_add(connector, mode); drm_mode_probed_add(connector, mode);
}
connector->display_info.width_mm = mode->width_mm; connector->display_info.width_mm = mode->width_mm;
connector->display_info.height_mm = mode->height_mm; connector->display_info.height_mm = mode->height_mm;
return 1; return num_modes;
} }
static const struct drm_panel_funcs otm8009a_drm_funcs = { static const struct drm_panel_funcs otm8009a_drm_funcs = {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment