]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
drm/omap: dss: Make omap_dss_device_ops optional
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Wed, 26 Feb 2020 11:24:47 +0000 (13:24 +0200)
committerTomi Valkeinen <tomi.valkeinen@ti.com>
Wed, 26 Feb 2020 11:31:51 +0000 (13:31 +0200)
As part of the move to drm_bridge ops, the dssdev ops will become empty
for some of the internal encoders. Make them optional in the driver to
allow them to be removed completely, easing the transition.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Tested-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200226112514.12455-28-laurent.pinchart@ideasonboard.com
drivers/gpu/drm/omapdrm/dss/base.c
drivers/gpu/drm/omapdrm/dss/dss.c
drivers/gpu/drm/omapdrm/omap_connector.c
drivers/gpu/drm/omapdrm/omap_encoder.c

index 80d48936d177ef5f4412ed3daaf9553e88c74287..2db3bd2f19db1694a5782878b0e218be537f6e7b 100644 (file)
@@ -195,10 +195,12 @@ int omapdss_device_connect(struct dss_device *dss,
 
        dst->dss = dss;
 
-       ret = dst->ops->connect(src, dst);
-       if (ret < 0) {
-               dst->dss = NULL;
-               return ret;
+       if (dst->ops && dst->ops->connect) {
+               ret = dst->ops->connect(src, dst);
+               if (ret < 0) {
+                       dst->dss = NULL;
+                       return ret;
+               }
        }
 
        return 0;
@@ -226,7 +228,8 @@ void omapdss_device_disconnect(struct omap_dss_device *src,
 
        WARN_ON(dst->state != OMAP_DSS_DISPLAY_DISABLED);
 
-       dst->ops->disconnect(src, dst);
+       if (dst->ops && dst->ops->disconnect)
+               dst->ops->disconnect(src, dst);
        dst->dss = NULL;
 }
 EXPORT_SYMBOL_GPL(omapdss_device_disconnect);
@@ -238,7 +241,7 @@ void omapdss_device_pre_enable(struct omap_dss_device *dssdev)
 
        omapdss_device_pre_enable(dssdev->next);
 
-       if (dssdev->ops->pre_enable)
+       if (dssdev->ops && dssdev->ops->pre_enable)
                dssdev->ops->pre_enable(dssdev);
 }
 EXPORT_SYMBOL_GPL(omapdss_device_pre_enable);
@@ -248,7 +251,7 @@ void omapdss_device_enable(struct omap_dss_device *dssdev)
        if (!dssdev)
                return;
 
-       if (dssdev->ops->enable)
+       if (dssdev->ops && dssdev->ops->enable)
                dssdev->ops->enable(dssdev);
 
        omapdss_device_enable(dssdev->next);
@@ -264,7 +267,7 @@ void omapdss_device_disable(struct omap_dss_device *dssdev)
 
        omapdss_device_disable(dssdev->next);
 
-       if (dssdev->ops->disable)
+       if (dssdev->ops && dssdev->ops->disable)
                dssdev->ops->disable(dssdev);
 }
 EXPORT_SYMBOL_GPL(omapdss_device_disable);
@@ -274,7 +277,7 @@ void omapdss_device_post_disable(struct omap_dss_device *dssdev)
        if (!dssdev)
                return;
 
-       if (dssdev->ops->post_disable)
+       if (dssdev->ops && dssdev->ops->post_disable)
                dssdev->ops->post_disable(dssdev);
 
        omapdss_device_post_disable(dssdev->next);
index 67b92b5d8dd76da016841b142ac0ad9de7bf536b..b76fc2b562277909b4a2a3039fde737341b6e37c 100644 (file)
@@ -1552,7 +1552,8 @@ static void dss_shutdown(struct platform_device *pdev)
        DSSDBG("shutdown\n");
 
        for_each_dss_output(dssdev) {
-               if (dssdev->state == OMAP_DSS_DISPLAY_ACTIVE)
+               if (dssdev->state == OMAP_DSS_DISPLAY_ACTIVE &&
+                   dssdev->ops && dssdev->ops->disable)
                        dssdev->ops->disable(dssdev);
        }
 }
index b0cb2ecb30ab4fe399faf938acf009fbc3f01f74..a24cec4b0bb980b711b1d0b8cf41ec7886769717 100644 (file)
@@ -228,7 +228,7 @@ enum drm_mode_status omap_connector_mode_fixup(struct omap_dss_device *dssdev,
        drm_mode_copy(adjusted_mode, mode);
 
        for (; dssdev; dssdev = dssdev->next) {
-               if (!dssdev->ops->check_timings)
+               if (!dssdev->ops || !dssdev->ops->check_timings)
                        continue;
 
                ret = dssdev->ops->check_timings(dssdev, adjusted_mode);
index a270173a24118dc1901b6ab17f4504784ba4c5d3..b232acd3bc3d80e15268453899cd77ae2e9bfdd7 100644 (file)
@@ -77,10 +77,10 @@ static void omap_encoder_hdmi_mode_set(struct drm_connector *connector,
        struct omap_dss_device *dssdev = omap_encoder->output;
        bool hdmi_mode = connector->display_info.is_hdmi;
 
-       if (dssdev->ops->hdmi.set_hdmi_mode)
+       if (dssdev->ops && dssdev->ops->hdmi.set_hdmi_mode)
                dssdev->ops->hdmi.set_hdmi_mode(dssdev, hdmi_mode);
 
-       if (hdmi_mode && dssdev->ops->hdmi.set_infoframe) {
+       if (hdmi_mode && dssdev->ops && dssdev->ops->hdmi.set_infoframe) {
                struct hdmi_avi_infoframe avi;
                int r;
 
@@ -139,7 +139,7 @@ static void omap_encoder_mode_set(struct drm_encoder *encoder,
        dss_mgr_set_timings(output, &vm);
 
        for (dssdev = output; dssdev; dssdev = dssdev->next) {
-               if (dssdev->ops->set_timings)
+               if (dssdev->ops && dssdev->ops->set_timings)
                        dssdev->ops->set_timings(dssdev, adjusted_mode);
        }
 
@@ -168,7 +168,8 @@ static void omap_encoder_disable(struct drm_encoder *encoder)
         * flow where the pipeline output controls the encoder.
         */
        if (dssdev->type != OMAP_DISPLAY_TYPE_DSI) {
-               dssdev->ops->disable(dssdev);
+               if (dssdev->ops && dssdev->ops->disable)
+                       dssdev->ops->disable(dssdev);
                dssdev->state = OMAP_DSS_DISPLAY_DISABLED;
        }
 
@@ -196,7 +197,8 @@ static void omap_encoder_enable(struct drm_encoder *encoder)
         * flow where the pipeline output controls the encoder.
         */
        if (dssdev->type != OMAP_DISPLAY_TYPE_DSI) {
-               dssdev->ops->enable(dssdev);
+               if (dssdev->ops && dssdev->ops->enable)
+                       dssdev->ops->enable(dssdev);
                dssdev->state = OMAP_DSS_DISPLAY_ACTIVE;
        }