[PATCH 10/23] drm/omap: Don't call .check_timings() operation recursively
Laurent Pinchart
laurent.pinchart at ideasonboard.com
Fri Jun 8 16:29:13 UTC 2018
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 at ideasonboard.com>
---
.../gpu/drm/omapdrm/displays/connector-analog-tv.c | 9 ------
drivers/gpu/drm/omapdrm/displays/connector-dvi.c | 9 ------
drivers/gpu/drm/omapdrm/displays/connector-hdmi.c | 9 ------
drivers/gpu/drm/omapdrm/displays/encoder-opa362.c | 11 --------
drivers/gpu/drm/omapdrm/displays/encoder-tfp410.c | 9 ------
.../gpu/drm/omapdrm/displays/encoder-tpd12s015.c | 9 ------
drivers/gpu/drm/omapdrm/displays/panel-dpi.c | 9 ------
.../omapdrm/displays/panel-lgphilips-lb035q02.c | 9 ------
.../drm/omapdrm/displays/panel-nec-nl8048hl11.c | 9 ------
.../drm/omapdrm/displays/panel-sharp-ls037v7dw01.c | 9 ------
.../drm/omapdrm/displays/panel-sony-acx565akm.c | 9 ------
.../drm/omapdrm/displays/panel-tpo-td028ttec1.c | 9 ------
.../drm/omapdrm/displays/panel-tpo-td043mtea1.c | 9 ------
drivers/gpu/drm/omapdrm/omap_connector.c | 32 +++++++++++++---------
drivers/gpu/drm/omapdrm/omap_encoder.c | 20 +++++++++-----
15 files changed, 32 insertions(+), 139 deletions(-)
diff --git a/drivers/gpu/drm/omapdrm/displays/connector-analog-tv.c b/drivers/gpu/drm/omapdrm/displays/connector-analog-tv.c
index fb6d4fce1853..a9e2a366a851 100644
--- a/drivers/gpu/drm/omapdrm/displays/connector-analog-tv.c
+++ b/drivers/gpu/drm/omapdrm/displays/connector-analog-tv.c
@@ -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)
diff --git a/drivers/gpu/drm/omapdrm/displays/connector-dvi.c b/drivers/gpu/drm/omapdrm/displays/connector-dvi.c
index 5871872ae19b..a9e2f1181987 100644
--- a/drivers/gpu/drm/omapdrm/displays/connector-dvi.c
+++ b/drivers/gpu/drm/omapdrm/displays/connector-dvi.c
@@ -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,
diff --git a/drivers/gpu/drm/omapdrm/displays/connector-hdmi.c b/drivers/gpu/drm/omapdrm/displays/connector-hdmi.c
index 898eb583688f..7e449f8a9b5d 100644
--- a/drivers/gpu/drm/omapdrm/displays/connector-hdmi.c
+++ b/drivers/gpu/drm/omapdrm/displays/connector-hdmi.c
@@ -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,
diff --git a/drivers/gpu/drm/omapdrm/displays/encoder-opa362.c b/drivers/gpu/drm/omapdrm/displays/encoder-opa362.c
index db5763782199..0604169d8951 100644
--- a/drivers/gpu/drm/omapdrm/displays/encoder-opa362.c
+++ b/drivers/gpu/drm/omapdrm/displays/encoder-opa362.c
@@ -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,
};
diff --git a/drivers/gpu/drm/omapdrm/displays/encoder-tfp410.c b/drivers/gpu/drm/omapdrm/displays/encoder-tfp410.c
index 1317080ec5e6..dd810e7a824b 100644
--- a/drivers/gpu/drm/omapdrm/displays/encoder-tfp410.c
+++ b/drivers/gpu/drm/omapdrm/displays/encoder-tfp410.c
@@ -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,
};
diff --git a/drivers/gpu/drm/omapdrm/displays/encoder-tpd12s015.c b/drivers/gpu/drm/omapdrm/displays/encoder-tpd12s015.c
index 9c4eef73e4a0..f6c7ec548333 100644
--- a/drivers/gpu/drm/omapdrm/displays/encoder-tpd12s015.c
+++ b/drivers/gpu/drm/omapdrm/displays/encoder-tpd12s015.c
@@ -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,
diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dpi.c b/drivers/gpu/drm/omapdrm/displays/panel-dpi.c
index 32efed45a63c..e75600a33c37 100644
--- a/drivers/gpu/drm/omapdrm/displays/panel-dpi.c
+++ b/drivers/gpu/drm/omapdrm/displays/panel-dpi.c
@@ -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)
diff --git a/drivers/gpu/drm/omapdrm/displays/panel-lgphilips-lb035q02.c b/drivers/gpu/drm/omapdrm/displays/panel-lgphilips-lb035q02.c
index a211506506c0..3c221f7f0598 100644
--- a/drivers/gpu/drm/omapdrm/displays/panel-lgphilips-lb035q02.c
+++ b/drivers/gpu/drm/omapdrm/displays/panel-lgphilips-lb035q02.c
@@ -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)
diff --git a/drivers/gpu/drm/omapdrm/displays/panel-nec-nl8048hl11.c b/drivers/gpu/drm/omapdrm/displays/panel-nec-nl8048hl11.c
index 1b2f33d43bd9..78ff18c4eb46 100644
--- a/drivers/gpu/drm/omapdrm/displays/panel-nec-nl8048hl11.c
+++ b/drivers/gpu/drm/omapdrm/displays/panel-nec-nl8048hl11.c
@@ -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)
diff --git a/drivers/gpu/drm/omapdrm/displays/panel-sharp-ls037v7dw01.c b/drivers/gpu/drm/omapdrm/displays/panel-sharp-ls037v7dw01.c
index fbf88aaaaf56..47e97dbffc07 100644
--- a/drivers/gpu/drm/omapdrm/displays/panel-sharp-ls037v7dw01.c
+++ b/drivers/gpu/drm/omapdrm/displays/panel-sharp-ls037v7dw01.c
@@ -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,
diff --git a/drivers/gpu/drm/omapdrm/displays/panel-sony-acx565akm.c b/drivers/gpu/drm/omapdrm/displays/panel-sony-acx565akm.c
index e52fc23e6c35..82317376b229 100644
--- a/drivers/gpu/drm/omapdrm/displays/panel-sony-acx565akm.c
+++ b/drivers/gpu/drm/omapdrm/displays/panel-sony-acx565akm.c
@@ -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)
diff --git a/drivers/gpu/drm/omapdrm/displays/panel-tpo-td028ttec1.c b/drivers/gpu/drm/omapdrm/displays/panel-tpo-td028ttec1.c
index 144ceb49e64d..60b3fe376568 100644
--- a/drivers/gpu/drm/omapdrm/displays/panel-tpo-td028ttec1.c
+++ b/drivers/gpu/drm/omapdrm/displays/panel-tpo-td028ttec1.c
@@ -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)
diff --git a/drivers/gpu/drm/omapdrm/displays/panel-tpo-td043mtea1.c b/drivers/gpu/drm/omapdrm/displays/panel-tpo-td043mtea1.c
index ae7a40a1759a..513e846d52c4 100644
--- a/drivers/gpu/drm/omapdrm/displays/panel-tpo-td043mtea1.c
+++ b/drivers/gpu/drm/omapdrm/displays/panel-tpo-td043mtea1.c
@@ -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)
diff --git a/drivers/gpu/drm/omapdrm/omap_connector.c b/drivers/gpu/drm/omapdrm/omap_connector.c
index 4b155a500a5d..f4e75a546393 100644
--- a/drivers/gpu/drm/omapdrm/omap_connector.c
+++ b/drivers/gpu/drm/omapdrm/omap_connector.c
@@ -252,7 +252,7 @@ static int omap_connector_mode_valid(struct drm_connector *connector,
const 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;
@@ -262,21 +262,27 @@ static int omap_connector_mode_valid(struct drm_connector *connector,
drm_display_mode_to_videomode(mode, &vm);
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 (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 (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",
diff --git a/drivers/gpu/drm/omapdrm/omap_encoder.c b/drivers/gpu/drm/omapdrm/omap_encoder.c
index a6dce480b2cf..bb010c20d8b8 100644
--- a/drivers/gpu/drm/omapdrm/omap_encoder.c
+++ b/drivers/gpu/drm/omapdrm/omap_encoder.c
@@ -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;
}
--
Regards,
Laurent Pinchart
More information about the dri-devel
mailing list