Commit 28120302 authored by Laurent Pinchart's avatar Laurent Pinchart Committed by Tomi Valkeinen

drm/omap: Don't call .check_timings() operation recursively

The .check_timings() operation is called recursively from the display
device back to the output device. Most components just forward the
operation to the previous component in the chain, resulting in lots of
duplicated pass-through functions. To avoid that, iterate over the
components manually.
Signed-off-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: default avatarSebastian Reichel <sebastian.reichel@collabora.co.uk>
Signed-off-by: default avatarTomi Valkeinen <tomi.valkeinen@ti.com>
parent b4935e3a
......@@ -109,14 +109,6 @@ static void tvc_get_timings(struct omap_dss_device *dssdev,
*vm = ddata->vm;
}
static int tvc_check_timings(struct omap_dss_device *dssdev,
struct videomode *vm)
{
struct omap_dss_device *src = dssdev->src;
return src->ops->check_timings(src, vm);
}
static const struct omap_dss_device_ops tvc_ops = {
.connect = tvc_connect,
.disconnect = tvc_disconnect,
......@@ -126,7 +118,6 @@ static const struct omap_dss_device_ops tvc_ops = {
.set_timings = tvc_set_timings,
.get_timings = tvc_get_timings,
.check_timings = tvc_check_timings,
};
static int tvc_probe(struct platform_device *pdev)
......
......@@ -116,14 +116,6 @@ static void dvic_get_timings(struct omap_dss_device *dssdev,
*vm = ddata->vm;
}
static int dvic_check_timings(struct omap_dss_device *dssdev,
struct videomode *vm)
{
struct omap_dss_device *src = dssdev->src;
return src->ops->check_timings(src, vm);
}
static int dvic_ddc_read(struct i2c_adapter *adapter,
unsigned char *buf, u16 count, u8 offset)
{
......@@ -232,7 +224,6 @@ static const struct omap_dss_device_ops dvic_ops = {
.set_timings = dvic_set_timings,
.get_timings = dvic_get_timings,
.check_timings = dvic_check_timings,
.read_edid = dvic_read_edid,
.detect = dvic_detect,
......
......@@ -114,14 +114,6 @@ static void hdmic_get_timings(struct omap_dss_device *dssdev,
*vm = ddata->vm;
}
static int hdmic_check_timings(struct omap_dss_device *dssdev,
struct videomode *vm)
{
struct omap_dss_device *src = dssdev->src;
return src->ops->check_timings(src, vm);
}
static bool hdmic_detect(struct omap_dss_device *dssdev)
{
struct panel_drv_data *ddata = to_panel_data(dssdev);
......@@ -161,7 +153,6 @@ static const struct omap_dss_device_ops hdmic_ops = {
.set_timings = hdmic_set_timings,
.get_timings = hdmic_get_timings,
.check_timings = hdmic_check_timings,
.detect = hdmic_detect,
.register_hpd_cb = hdmic_register_hpd_cb,
......
......@@ -95,22 +95,11 @@ static void opa362_set_timings(struct omap_dss_device *dssdev,
src->ops->set_timings(src, vm);
}
static int opa362_check_timings(struct omap_dss_device *dssdev,
struct videomode *vm)
{
struct omap_dss_device *src = dssdev->src;
dev_dbg(dssdev->dev, "check_timings\n");
return src->ops->check_timings(src, vm);
}
static const struct omap_dss_device_ops opa362_ops = {
.connect = opa362_connect,
.disconnect = opa362_disconnect,
.enable = opa362_enable,
.disable = opa362_disable,
.check_timings = opa362_check_timings,
.set_timings = opa362_set_timings,
};
......
......@@ -84,20 +84,11 @@ static void tfp410_set_timings(struct omap_dss_device *dssdev,
src->ops->set_timings(src, vm);
}
static int tfp410_check_timings(struct omap_dss_device *dssdev,
struct videomode *vm)
{
struct omap_dss_device *src = dssdev->src;
return src->ops->check_timings(src, vm);
}
static const struct omap_dss_device_ops tfp410_ops = {
.connect = tfp410_connect,
.disconnect = tfp410_disconnect,
.enable = tfp410_enable,
.disable = tfp410_disable,
.check_timings = tfp410_check_timings,
.set_timings = tfp410_set_timings,
};
......
......@@ -99,14 +99,6 @@ static void tpd_set_timings(struct omap_dss_device *dssdev,
src->ops->set_timings(src, vm);
}
static int tpd_check_timings(struct omap_dss_device *dssdev,
struct videomode *vm)
{
struct omap_dss_device *src = dssdev->src;
return src->ops->check_timings(src, vm);
}
static bool tpd_detect(struct omap_dss_device *dssdev)
{
struct panel_drv_data *ddata = to_panel_data(dssdev);
......@@ -142,7 +134,6 @@ static const struct omap_dss_device_ops tpd_ops = {
.disconnect = tpd_disconnect,
.enable = tpd_enable,
.disable = tpd_disable,
.check_timings = tpd_check_timings,
.set_timings = tpd_set_timings,
.detect = tpd_detect,
.register_hpd_cb = tpd_register_hpd_cb,
......
......@@ -112,14 +112,6 @@ static void panel_dpi_get_timings(struct omap_dss_device *dssdev,
*vm = ddata->vm;
}
static int panel_dpi_check_timings(struct omap_dss_device *dssdev,
struct videomode *vm)
{
struct omap_dss_device *src = dssdev->src;
return src->ops->check_timings(src, vm);
}
static const struct omap_dss_device_ops panel_dpi_ops = {
.connect = panel_dpi_connect,
.disconnect = panel_dpi_disconnect,
......@@ -129,7 +121,6 @@ static const struct omap_dss_device_ops panel_dpi_ops = {
.set_timings = panel_dpi_set_timings,
.get_timings = panel_dpi_get_timings,
.check_timings = panel_dpi_check_timings,
};
static int panel_dpi_probe_of(struct platform_device *pdev)
......
......@@ -182,14 +182,6 @@ static void lb035q02_get_timings(struct omap_dss_device *dssdev,
*vm = ddata->vm;
}
static int lb035q02_check_timings(struct omap_dss_device *dssdev,
struct videomode *vm)
{
struct omap_dss_device *src = dssdev->src;
return src->ops->check_timings(src, vm);
}
static const struct omap_dss_device_ops lb035q02_ops = {
.connect = lb035q02_connect,
.disconnect = lb035q02_disconnect,
......@@ -199,7 +191,6 @@ static const struct omap_dss_device_ops lb035q02_ops = {
.set_timings = lb035q02_set_timings,
.get_timings = lb035q02_get_timings,
.check_timings = lb035q02_check_timings,
};
static int lb035q02_probe_of(struct spi_device *spi)
......
......@@ -175,14 +175,6 @@ static void nec_8048_get_timings(struct omap_dss_device *dssdev,
*vm = ddata->vm;
}
static int nec_8048_check_timings(struct omap_dss_device *dssdev,
struct videomode *vm)
{
struct omap_dss_device *src = dssdev->src;
return src->ops->check_timings(src, vm);
}
static const struct omap_dss_device_ops nec_8048_ops = {
.connect = nec_8048_connect,
.disconnect = nec_8048_disconnect,
......@@ -192,7 +184,6 @@ static const struct omap_dss_device_ops nec_8048_ops = {
.set_timings = nec_8048_set_timings,
.get_timings = nec_8048_get_timings,
.check_timings = nec_8048_check_timings,
};
static int nec_8048_probe(struct spi_device *spi)
......
......@@ -145,14 +145,6 @@ static void sharp_ls_get_timings(struct omap_dss_device *dssdev,
*vm = ddata->vm;
}
static int sharp_ls_check_timings(struct omap_dss_device *dssdev,
struct videomode *vm)
{
struct omap_dss_device *src = dssdev->src;
return src->ops->check_timings(src, vm);
}
static const struct omap_dss_device_ops sharp_ls_ops = {
.connect = sharp_ls_connect,
.disconnect = sharp_ls_disconnect,
......@@ -162,7 +154,6 @@ static const struct omap_dss_device_ops sharp_ls_ops = {
.set_timings = sharp_ls_set_timings,
.get_timings = sharp_ls_get_timings,
.check_timings = sharp_ls_check_timings,
};
static int sharp_ls_get_gpio_of(struct device *dev, int index, int val,
......
......@@ -648,14 +648,6 @@ static void acx565akm_get_timings(struct omap_dss_device *dssdev,
*vm = ddata->vm;
}
static int acx565akm_check_timings(struct omap_dss_device *dssdev,
struct videomode *vm)
{
struct omap_dss_device *src = dssdev->src;
return src->ops->check_timings(src, vm);
}
static const struct omap_dss_device_ops acx565akm_ops = {
.connect = acx565akm_connect,
.disconnect = acx565akm_disconnect,
......@@ -665,7 +657,6 @@ static const struct omap_dss_device_ops acx565akm_ops = {
.set_timings = acx565akm_set_timings,
.get_timings = acx565akm_get_timings,
.check_timings = acx565akm_check_timings,
};
static int acx565akm_probe(struct spi_device *spi)
......
......@@ -314,14 +314,6 @@ static void td028ttec1_panel_get_timings(struct omap_dss_device *dssdev,
*vm = ddata->vm;
}
static int td028ttec1_panel_check_timings(struct omap_dss_device *dssdev,
struct videomode *vm)
{
struct omap_dss_device *src = dssdev->src;
return src->ops->check_timings(src, vm);
}
static const struct omap_dss_device_ops td028ttec1_ops = {
.connect = td028ttec1_panel_connect,
.disconnect = td028ttec1_panel_disconnect,
......@@ -331,7 +323,6 @@ static const struct omap_dss_device_ops td028ttec1_ops = {
.set_timings = td028ttec1_panel_set_timings,
.get_timings = td028ttec1_panel_get_timings,
.check_timings = td028ttec1_panel_check_timings,
};
static int td028ttec1_panel_probe(struct spi_device *spi)
......
......@@ -388,14 +388,6 @@ static void tpo_td043_get_timings(struct omap_dss_device *dssdev,
*vm = ddata->vm;
}
static int tpo_td043_check_timings(struct omap_dss_device *dssdev,
struct videomode *vm)
{
struct omap_dss_device *src = dssdev->src;
return src->ops->check_timings(src, vm);
}
static const struct omap_dss_device_ops tpo_td043_ops = {
.connect = tpo_td043_connect,
.disconnect = tpo_td043_disconnect,
......@@ -405,7 +397,6 @@ static const struct omap_dss_device_ops tpo_td043_ops = {
.set_timings = tpo_td043_set_timings,
.get_timings = tpo_td043_get_timings,
.check_timings = tpo_td043_check_timings,
};
static int tpo_td043_probe(struct spi_device *spi)
......
......@@ -252,7 +252,7 @@ static int omap_connector_mode_valid(struct drm_connector *connector,
struct drm_display_mode *mode)
{
struct omap_connector *omap_connector = to_omap_connector(connector);
struct omap_dss_device *dssdev = omap_connector->display;
struct omap_dss_device *dssdev;
struct videomode vm = {0};
struct drm_device *dev = connector->dev;
struct drm_display_mode *new_mode;
......@@ -261,21 +261,27 @@ static int omap_connector_mode_valid(struct drm_connector *connector,
drm_display_mode_to_videomode(mode, &vm);
mode->vrefresh = drm_mode_vrefresh(mode);
r = dssdev->ops->check_timings(dssdev, &vm);
if (!r) {
/* check if vrefresh is still valid */
new_mode = drm_mode_duplicate(dev, mode);
if (!new_mode)
return MODE_BAD;
for (dssdev = omap_connector->output; dssdev; dssdev = dssdev->next) {
if (!dssdev->ops->check_timings)
continue;
new_mode->clock = vm.pixelclock / 1000;
new_mode->vrefresh = 0;
if (mode->vrefresh == drm_mode_vrefresh(new_mode))
ret = MODE_OK;
drm_mode_destroy(dev, new_mode);
r = dssdev->ops->check_timings(dssdev, &vm);
if (r)
goto done;
}
/* check if vrefresh is still valid */
new_mode = drm_mode_duplicate(dev, mode);
if (!new_mode)
return MODE_BAD;
new_mode->clock = vm.pixelclock / 1000;
new_mode->vrefresh = 0;
if (mode->vrefresh == drm_mode_vrefresh(new_mode))
ret = MODE_OK;
drm_mode_destroy(dev, new_mode);
done:
DBG("connector: mode %s: "
"%d:\"%s\" %d %d %d %d %d %d %d %d %d %d 0x%x 0x%x",
(ret == MODE_OK) ? "valid" : "invalid",
......
......@@ -98,17 +98,23 @@ static int omap_encoder_update(struct drm_encoder *encoder,
{
struct drm_device *dev = encoder->dev;
struct omap_encoder *omap_encoder = to_omap_encoder(encoder);
struct omap_dss_device *dssdev = omap_encoder->display;
struct omap_dss_device *display = omap_encoder->display;
struct omap_dss_device *dssdev;
int ret;
ret = dssdev->ops->check_timings(dssdev, vm);
if (ret) {
dev_err(dev->dev, "invalid timings: %d\n", ret);
return ret;
for (dssdev = omap_encoder->output; dssdev; dssdev = dssdev->next) {
if (!dssdev->ops->check_timings)
continue;
ret = dssdev->ops->check_timings(dssdev, vm);
if (ret) {
dev_err(dev->dev, "invalid timings: %d\n", ret);
return ret;
}
}
if (dssdev->ops->set_timings)
dssdev->ops->set_timings(dssdev, vm);
if (display->ops->set_timings)
display->ops->set_timings(display, vm);
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