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

Instead of calling the .set_timings() operation recursively from the
display device backwards, iterate over the devices manually in the DRM
encoder code. This moves the complexity to a single central location and
simplifies the logic in omap_dss_device drivers.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
This commit is contained in:
Laurent Pinchart 2018-06-07 19:55:04 +03:00 committed by Tomi Valkeinen
parent d8dbe79143
commit 6ea4843095
19 changed files with 8 additions and 144 deletions

View File

@ -73,22 +73,12 @@ static void tvc_disable(struct omap_dss_device *dssdev)
dssdev->state = OMAP_DSS_DISPLAY_DISABLED;
}
static void tvc_set_timings(struct omap_dss_device *dssdev,
const struct videomode *vm)
{
struct omap_dss_device *src = dssdev->src;
src->ops->set_timings(src, vm);
}
static const struct omap_dss_device_ops tvc_ops = {
.connect = tvc_connect,
.disconnect = tvc_disconnect,
.enable = tvc_enable,
.disable = tvc_disable,
.set_timings = tvc_set_timings,
};
static int tvc_probe(struct platform_device *pdev)

View File

@ -78,14 +78,6 @@ static void dvic_disable(struct omap_dss_device *dssdev)
dssdev->state = OMAP_DSS_DISPLAY_DISABLED;
}
static void dvic_set_timings(struct omap_dss_device *dssdev,
const struct videomode *vm)
{
struct omap_dss_device *src = dssdev->src;
src->ops->set_timings(src, vm);
}
static int dvic_ddc_read(struct i2c_adapter *adapter,
unsigned char *buf, u16 count, u8 offset)
{
@ -192,8 +184,6 @@ static const struct omap_dss_device_ops dvic_ops = {
.enable = dvic_enable,
.disable = dvic_disable,
.set_timings = dvic_set_timings,
.read_edid = dvic_read_edid,
.detect = dvic_detect,

View File

@ -79,14 +79,6 @@ static void hdmic_disable(struct omap_dss_device *dssdev)
dssdev->state = OMAP_DSS_DISPLAY_DISABLED;
}
static void hdmic_set_timings(struct omap_dss_device *dssdev,
const struct videomode *vm)
{
struct omap_dss_device *src = dssdev->src;
src->ops->set_timings(src, vm);
}
static bool hdmic_detect(struct omap_dss_device *dssdev)
{
struct panel_drv_data *ddata = to_panel_data(dssdev);
@ -124,8 +116,6 @@ static const struct omap_dss_device_ops hdmic_ops = {
.enable = hdmic_enable,
.disable = hdmic_disable,
.set_timings = hdmic_set_timings,
.detect = hdmic_detect,
.register_hpd_cb = hdmic_register_hpd_cb,
.unregister_hpd_cb = hdmic_unregister_hpd_cb,

View File

@ -85,22 +85,11 @@ static void opa362_disable(struct omap_dss_device *dssdev)
dssdev->state = OMAP_DSS_DISPLAY_DISABLED;
}
static void opa362_set_timings(struct omap_dss_device *dssdev,
const struct videomode *vm)
{
struct omap_dss_device *src = dssdev->src;
dev_dbg(dssdev->dev, "set_timings\n");
src->ops->set_timings(src, vm);
}
static const struct omap_dss_device_ops opa362_ops = {
.connect = opa362_connect,
.disconnect = opa362_disconnect,
.enable = opa362_enable,
.disable = opa362_disable,
.set_timings = opa362_set_timings,
};
static int opa362_probe(struct platform_device *pdev)

View File

@ -76,20 +76,11 @@ static void tfp410_disable(struct omap_dss_device *dssdev)
dssdev->state = OMAP_DSS_DISPLAY_DISABLED;
}
static void tfp410_set_timings(struct omap_dss_device *dssdev,
const struct videomode *vm)
{
struct omap_dss_device *src = dssdev->src;
src->ops->set_timings(src, vm);
}
static const struct omap_dss_device_ops tfp410_ops = {
.connect = tfp410_connect,
.disconnect = tfp410_disconnect,
.enable = tfp410_enable,
.disable = tfp410_disable,
.set_timings = tfp410_set_timings,
};
static int tfp410_probe(struct platform_device *pdev)

View File

@ -91,14 +91,6 @@ static void tpd_disable(struct omap_dss_device *dssdev)
dssdev->state = OMAP_DSS_DISPLAY_DISABLED;
}
static void tpd_set_timings(struct omap_dss_device *dssdev,
const struct videomode *vm)
{
struct omap_dss_device *src = dssdev->src;
src->ops->set_timings(src, vm);
}
static bool tpd_detect(struct omap_dss_device *dssdev)
{
struct panel_drv_data *ddata = to_panel_data(dssdev);
@ -134,7 +126,6 @@ static const struct omap_dss_device_ops tpd_ops = {
.disconnect = tpd_disconnect,
.enable = tpd_enable,
.disable = tpd_disable,
.set_timings = tpd_set_timings,
.detect = tpd_detect,
.register_hpd_cb = tpd_register_hpd_cb,
.unregister_hpd_cb = tpd_unregister_hpd_cb,

View File

@ -93,14 +93,6 @@ static void panel_dpi_disable(struct omap_dss_device *dssdev)
dssdev->state = OMAP_DSS_DISPLAY_DISABLED;
}
static void panel_dpi_set_timings(struct omap_dss_device *dssdev,
const struct videomode *vm)
{
struct omap_dss_device *src = dssdev->src;
src->ops->set_timings(src, vm);
}
static void panel_dpi_get_timings(struct omap_dss_device *dssdev,
struct videomode *vm)
{
@ -116,7 +108,6 @@ static const struct omap_dss_device_ops panel_dpi_ops = {
.enable = panel_dpi_enable,
.disable = panel_dpi_disable,
.set_timings = panel_dpi_set_timings,
.get_timings = panel_dpi_get_timings,
};

View File

@ -163,14 +163,6 @@ static void lb035q02_disable(struct omap_dss_device *dssdev)
dssdev->state = OMAP_DSS_DISPLAY_DISABLED;
}
static void lb035q02_set_timings(struct omap_dss_device *dssdev,
const struct videomode *vm)
{
struct omap_dss_device *src = dssdev->src;
src->ops->set_timings(src, vm);
}
static void lb035q02_get_timings(struct omap_dss_device *dssdev,
struct videomode *vm)
{
@ -186,7 +178,6 @@ static const struct omap_dss_device_ops lb035q02_ops = {
.enable = lb035q02_enable,
.disable = lb035q02_disable,
.set_timings = lb035q02_set_timings,
.get_timings = lb035q02_get_timings,
};

View File

@ -156,14 +156,6 @@ static void nec_8048_disable(struct omap_dss_device *dssdev)
dssdev->state = OMAP_DSS_DISPLAY_DISABLED;
}
static void nec_8048_set_timings(struct omap_dss_device *dssdev,
const struct videomode *vm)
{
struct omap_dss_device *src = dssdev->src;
src->ops->set_timings(src, vm);
}
static void nec_8048_get_timings(struct omap_dss_device *dssdev,
struct videomode *vm)
{
@ -179,7 +171,6 @@ static const struct omap_dss_device_ops nec_8048_ops = {
.enable = nec_8048_enable,
.disable = nec_8048_disable,
.set_timings = nec_8048_set_timings,
.get_timings = nec_8048_get_timings,
};

View File

@ -126,14 +126,6 @@ static void sharp_ls_disable(struct omap_dss_device *dssdev)
dssdev->state = OMAP_DSS_DISPLAY_DISABLED;
}
static void sharp_ls_set_timings(struct omap_dss_device *dssdev,
const struct videomode *vm)
{
struct omap_dss_device *src = dssdev->src;
src->ops->set_timings(src, vm);
}
static void sharp_ls_get_timings(struct omap_dss_device *dssdev,
struct videomode *vm)
{
@ -149,7 +141,6 @@ static const struct omap_dss_device_ops sharp_ls_ops = {
.enable = sharp_ls_enable,
.disable = sharp_ls_disable,
.set_timings = sharp_ls_set_timings,
.get_timings = sharp_ls_get_timings,
};

View File

@ -629,14 +629,6 @@ static void acx565akm_disable(struct omap_dss_device *dssdev)
dssdev->state = OMAP_DSS_DISPLAY_DISABLED;
}
static void acx565akm_set_timings(struct omap_dss_device *dssdev,
const struct videomode *vm)
{
struct omap_dss_device *src = dssdev->src;
src->ops->set_timings(src, vm);
}
static void acx565akm_get_timings(struct omap_dss_device *dssdev,
struct videomode *vm)
{
@ -652,7 +644,6 @@ static const struct omap_dss_device_ops acx565akm_ops = {
.enable = acx565akm_enable,
.disable = acx565akm_disable,
.set_timings = acx565akm_set_timings,
.get_timings = acx565akm_get_timings,
};

View File

@ -295,14 +295,6 @@ static void td028ttec1_panel_disable(struct omap_dss_device *dssdev)
dssdev->state = OMAP_DSS_DISPLAY_DISABLED;
}
static void td028ttec1_panel_set_timings(struct omap_dss_device *dssdev,
const struct videomode *vm)
{
struct omap_dss_device *src = dssdev->src;
src->ops->set_timings(src, vm);
}
static void td028ttec1_panel_get_timings(struct omap_dss_device *dssdev,
struct videomode *vm)
{
@ -318,7 +310,6 @@ static const struct omap_dss_device_ops td028ttec1_ops = {
.enable = td028ttec1_panel_enable,
.disable = td028ttec1_panel_disable,
.set_timings = td028ttec1_panel_set_timings,
.get_timings = td028ttec1_panel_get_timings,
};

View File

@ -369,14 +369,6 @@ static void tpo_td043_disable(struct omap_dss_device *dssdev)
dssdev->state = OMAP_DSS_DISPLAY_DISABLED;
}
static void tpo_td043_set_timings(struct omap_dss_device *dssdev,
const struct videomode *vm)
{
struct omap_dss_device *src = dssdev->src;
src->ops->set_timings(src, vm);
}
static void tpo_td043_get_timings(struct omap_dss_device *dssdev,
struct videomode *vm)
{
@ -392,7 +384,6 @@ static const struct omap_dss_device_ops tpo_td043_ops = {
.enable = tpo_td043_enable,
.disable = tpo_td043_disable,
.set_timings = tpo_td043_set_timings,
.get_timings = tpo_td043_get_timings,
};

View File

@ -477,8 +477,6 @@ static void dpi_set_timings(struct omap_dss_device *dssdev,
dpi->vm = *vm;
dss_mgr_set_timings(&dpi->output, vm);
mutex_unlock(&dpi->lock);
}

View File

@ -259,8 +259,6 @@ static void hdmi_display_set_timings(struct omap_dss_device *dssdev,
dispc_set_tv_pclk(hdmi->dss->dispc, vm->pixelclock);
dss_mgr_set_timings(&hdmi->output, vm);
mutex_unlock(&hdmi->lock);
}

View File

@ -258,8 +258,6 @@ static void hdmi_display_set_timings(struct omap_dss_device *dssdev,
dispc_set_tv_pclk(hdmi->dss->dispc, vm->pixelclock);
dss_mgr_set_timings(&hdmi->output, vm);
mutex_unlock(&hdmi->lock);
}

View File

@ -218,8 +218,6 @@ static void sdi_set_timings(struct omap_dss_device *dssdev,
struct sdi_device *sdi = dssdev_to_sdi(dssdev);
sdi->vm = *vm;
dss_mgr_set_timings(&sdi->output, vm);
}
static int sdi_check_timings(struct omap_dss_device *dssdev,

View File

@ -593,8 +593,6 @@ static void venc_set_timings(struct omap_dss_device *dssdev,
dispc_set_tv_pclk(venc->dss->dispc, 13500000);
dss_mgr_set_timings(&venc->output, vm);
mutex_unlock(&venc->venc_lock);
}

View File

@ -58,7 +58,6 @@ static void omap_encoder_mode_set(struct drm_encoder *encoder,
{
struct drm_device *dev = encoder->dev;
struct omap_encoder *omap_encoder = to_omap_encoder(encoder);
struct omap_dss_device *display = omap_encoder->display;
struct drm_connector *connector;
struct omap_dss_device *dssdev;
struct videomode vm = { 0 };
@ -104,18 +103,15 @@ static void omap_encoder_mode_set(struct drm_encoder *encoder,
}
}
/*
* HACK: Call the .set_timings() operation if available, this will
* eventually store timings in the CRTC. Otherwise (for DSI outputs)
* store the timings directly.
*
* All outputs should be brought in sync to operate similarly.
*/
if (display->ops->set_timings)
display->ops->set_timings(display, &vm);
else
*omap_crtc_timings(encoder->crtc) = vm;
/* Set timings for all devices in the display pipeline. */
dss_mgr_set_timings(omap_encoder->output, &vm);
for (dssdev = omap_encoder->output; dssdev; dssdev = dssdev->next) {
if (dssdev->ops->set_timings)
dssdev->ops->set_timings(dssdev, &vm);
}
/* Set the HDMI mode and HDMI infoframe if applicable. */
hdmi_mode = false;
list_for_each_entry(connector, &dev->mode_config.connector_list, head) {
if (connector->encoder == encoder) {