drm/omap: Don't call .check_timings() operation recursively
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Tue, 5 Jun 2018 21:55:48 +0000 (00:55 +0300)
committerTomi Valkeinen <tomi.valkeinen@ti.com>
Mon, 3 Sep 2018 13:13:30 +0000 (16:13 +0300)
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: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
15 files changed:
drivers/gpu/drm/omapdrm/displays/connector-analog-tv.c
drivers/gpu/drm/omapdrm/displays/connector-dvi.c
drivers/gpu/drm/omapdrm/displays/connector-hdmi.c
drivers/gpu/drm/omapdrm/displays/encoder-opa362.c
drivers/gpu/drm/omapdrm/displays/encoder-tfp410.c
drivers/gpu/drm/omapdrm/displays/encoder-tpd12s015.c
drivers/gpu/drm/omapdrm/displays/panel-dpi.c
drivers/gpu/drm/omapdrm/displays/panel-lgphilips-lb035q02.c
drivers/gpu/drm/omapdrm/displays/panel-nec-nl8048hl11.c
drivers/gpu/drm/omapdrm/displays/panel-sharp-ls037v7dw01.c
drivers/gpu/drm/omapdrm/displays/panel-sony-acx565akm.c
drivers/gpu/drm/omapdrm/displays/panel-tpo-td028ttec1.c
drivers/gpu/drm/omapdrm/displays/panel-tpo-td043mtea1.c
drivers/gpu/drm/omapdrm/omap_connector.c
drivers/gpu/drm/omapdrm/omap_encoder.c

index fb6d4fce185334cecef4c914abfd7654b59dfa79..a9e2a366a8513ec08a9f49c6dc8bf5db9864dc95 100644 (file)
@@ -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)
index 5871872ae19bd12c464316f6a6a77b2abd162194..a9e2f1181987d0d23084c749d6e72de43e5500d3 100644 (file)
@@ -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,
index 898eb583688f14942013f5788ccc8800a7af4406..7e449f8a9b5d5f8e9da7a41bee8b19aca3f30ef7 100644 (file)
@@ -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,
index 05d12860071246fd28ab327597b99c4dca9dcd99..bdf79612313340256493ec7d6e7927d44e16a46a 100644 (file)
@@ -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,
 };
 
index 56b78cd38701f1d288fd7b9a160d4ecce4e8dfa9..c3ceee2d19d0179ac9066c13ced2790bf8de646e 100644 (file)
@@ -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,
 };
 
index 1e24559e0aa13696b79db98cd1637e848c720c4f..4598e5ca4238cd92ef24fd6817775b84ada98109 100644 (file)
@@ -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,
index 32efed45a63c1d591c61f35a8973a799e1c7b026..e75600a33c3727c40143dd4b09192236291e25d4 100644 (file)
@@ -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)
index a211506506c00eb3d939ccc3df0f100a65b76a89..3c221f7f0598c4069ace25af3e5863f4a46bc107 100644 (file)
@@ -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)
index 1b2f33d43bd963bc33a951995908ca27297d896d..78ff18c4eb4611fed070897b7ddd04430c582aa3 100644 (file)
@@ -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)
index fbf88aaaaf56a57e105bcf4e946d041d117a4b53..47e97dbffc0785f2b583739a62e3c377c3f4d83f 100644 (file)
@@ -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,
index 7e99d546132f2008420d520ec4140aa043b232f0..1ec3b1e2107cdd5b9fc300166337a14c3ff747a9 100644 (file)
@@ -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)
index e8c73ad48e0c4c5d00f513926370d2a42d34d2b2..cff1a1a68827ceb167c476fc5ad12d513b986c6a 100644 (file)
@@ -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)
index ae7a40a1759a3105f922baba2bbfce5d1bdef214..513e846d52c4f9e523602023d87c96b035798f9e 100644 (file)
@@ -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)
index b58d9a0bb53d0b79c8d201d9ab7a9a4851a72710..302f2ed245d0451a6bc515404f87da3f8ff3410a 100644 (file)
@@ -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",
index a6dce480b2cf6ae7e8879e0cdc8921e7e8ced9ea..bb010c20d8b890052669efd539fe052e2fd08d20 100644 (file)
@@ -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;
 }