Commit bddabbe1 authored by Archit Taneja's avatar Archit Taneja Committed by Tomi Valkeinen

drm/omap: Make fixed resolution panels work

The omapdrm driver requires omapdss panel drivers to expose ops like detect,
set_timings and check_timings. These can be NULL for fixed panel DPI, DBI, DSI
and SDI drivers. At some places, there are no checks to see if the panel driver
has these ops or not, and that leads to a crash.

The following things are done to make fixed panels work:

- The omap_connector's detect function is modified such that it considers panel
  types which are generally fixed panels as always connected(provided the panel
  driver doesn't have a detect op). Hence, the connector corresponding to these
  panels is always in a 'connected' state.

- If a panel driver doesn't have a check_timings op, assume that it supports the
  mode passed to omap_connector_mode_valid(the 'mode_valid' drm helper function)

- The function omap_encoder_update shouldn't really do anything for fixed
  resolution panels, make sure that it calls set_timings only if the panel
  driver has one.
Signed-off-by: default avatarArchit Taneja <archit@ti.com>
Reviewed-by: default avatarRob Clark <robdclark@gmail.com>
Signed-off-by: default avatarTomi Valkeinen <tomi.valkeinen@ti.com>
parent 581382e3
...@@ -110,6 +110,11 @@ static enum drm_connector_status omap_connector_detect( ...@@ -110,6 +110,11 @@ static enum drm_connector_status omap_connector_detect(
ret = connector_status_connected; ret = connector_status_connected;
else else
ret = connector_status_disconnected; ret = connector_status_disconnected;
} else if (dssdev->type == OMAP_DISPLAY_TYPE_DPI ||
dssdev->type == OMAP_DISPLAY_TYPE_DBI ||
dssdev->type == OMAP_DISPLAY_TYPE_SDI ||
dssdev->type == OMAP_DISPLAY_TYPE_DSI) {
ret = connector_status_connected;
} else { } else {
ret = connector_status_unknown; ret = connector_status_unknown;
} }
...@@ -189,12 +194,30 @@ static int omap_connector_mode_valid(struct drm_connector *connector, ...@@ -189,12 +194,30 @@ static int omap_connector_mode_valid(struct drm_connector *connector,
struct omap_video_timings timings = {0}; struct omap_video_timings timings = {0};
struct drm_device *dev = connector->dev; struct drm_device *dev = connector->dev;
struct drm_display_mode *new_mode; struct drm_display_mode *new_mode;
int ret = MODE_BAD; int r, ret = MODE_BAD;
copy_timings_drm_to_omap(&timings, mode); copy_timings_drm_to_omap(&timings, mode);
mode->vrefresh = drm_mode_vrefresh(mode); mode->vrefresh = drm_mode_vrefresh(mode);
if (!dssdrv->check_timings(dssdev, &timings)) { /*
* if the panel driver doesn't have a check_timings, it's most likely
* a fixed resolution panel, check if the timings match with the
* panel's timings
*/
if (dssdrv->check_timings) {
r = dssdrv->check_timings(dssdev, &timings);
} else {
struct omap_video_timings t = {0};
dssdrv->get_timings(dssdev, &t);
if (memcmp(&timings, &t, sizeof(struct omap_video_timings)))
r = -EINVAL;
else
r = 0;
}
if (!r) {
/* check if vrefresh is still valid */ /* check if vrefresh is still valid */
new_mode = drm_mode_duplicate(dev, mode); new_mode = drm_mode_duplicate(dev, mode);
new_mode->clock = timings.pixel_clock; new_mode->clock = timings.pixel_clock;
......
...@@ -128,13 +128,26 @@ int omap_encoder_update(struct drm_encoder *encoder, ...@@ -128,13 +128,26 @@ int omap_encoder_update(struct drm_encoder *encoder,
dssdev->output->manager = mgr; dssdev->output->manager = mgr;
ret = dssdrv->check_timings(dssdev, timings); if (dssdrv->check_timings) {
ret = dssdrv->check_timings(dssdev, timings);
} else {
struct omap_video_timings t = {0};
dssdrv->get_timings(dssdev, &t);
if (memcmp(timings, &t, sizeof(struct omap_video_timings)))
ret = -EINVAL;
else
ret = 0;
}
if (ret) { if (ret) {
dev_err(dev->dev, "could not set timings: %d\n", ret); dev_err(dev->dev, "could not set timings: %d\n", ret);
return ret; return ret;
} }
dssdrv->set_timings(dssdev, timings); if (dssdrv->set_timings)
dssdrv->set_timings(dssdev, timings);
return 0; return 0;
} }
......
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