drm/omap: simplify DSI manual update code
authorSebastian Reichel <sebastian.reichel@collabora.com>
Tue, 15 Dec 2020 10:46:20 +0000 (12:46 +0200)
committerTomi Valkeinen <tomi.valkeinen@ti.com>
Tue, 15 Dec 2020 14:08:26 +0000 (16:08 +0200)
Move dsi_ops into the main structure, since all other ops
are gone. Instead of checking the device type we can simply
check if dsi_ops are set.

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20201215104657.802264-48-tomi.valkeinen@ti.com
drivers/gpu/drm/omapdrm/dss/dsi.c
drivers/gpu/drm/omapdrm/dss/omapdss.h
drivers/gpu/drm/omapdrm/omap_crtc.c

index 9eae61ddbda91292f5cffa28260f4a155bc08d4d..efa261e4a18a950cf0620d8db877fc814aed6e91 100644 (file)
@@ -5011,11 +5011,9 @@ static int dsi_get_clocks(struct dsi_data *dsi)
        return 0;
 }
 
-static const struct omap_dss_device_ops dsi_ops = {
-       .dsi = {
-               .update = dsi_update_all,
-               .is_video_mode = dsi_is_video_mode,
-       },
+static const struct omapdss_dsi_ops dsi_ops = {
+       .update = dsi_update_all,
+       .is_video_mode = dsi_is_video_mode,
 };
 
 static irqreturn_t omap_dsi_te_irq_handler(int irq, void *dev_id)
@@ -5446,7 +5444,7 @@ static int dsi_init_output(struct dsi_data *dsi)
        out->type = OMAP_DISPLAY_TYPE_DSI;
        out->name = dsi->module_id == 0 ? "dsi.0" : "dsi.1";
        out->dispc_channel = dsi_get_channel(dsi);
-       out->ops = &dsi_ops;
+       out->dsi_ops = &dsi_ops;
        out->owner = THIS_MODULE;
        out->of_port = 0;
        out->bus_flags = DRM_BUS_FLAG_PIXDATA_DRIVE_POSEDGE
index 1ac8f034c48cdfd48b1afa1797351fd611c8d6d1..c9c891c559998c20c47281ff021103abe3db4b68 100644 (file)
@@ -278,10 +278,6 @@ struct omapdss_dsi_ops {
        bool (*is_video_mode)(struct omap_dss_device *dssdev);
 };
 
-struct omap_dss_device_ops {
-       const struct omapdss_dsi_ops dsi;
-};
-
 struct omap_dss_device {
        struct device *dev;
 
@@ -303,7 +299,7 @@ struct omap_dss_device {
 
        const char *name;
 
-       const struct omap_dss_device_ops *ops;
+       const struct omapdss_dsi_ops *dsi_ops;
        u32 bus_flags;
 
        /* OMAP DSS output specific fields */
index 1c7184b6f0ed2d572bf06aa9202da98f21a0ecb5..6692fc52af986a321ff350956c1fab82a13fa526 100644 (file)
@@ -366,17 +366,10 @@ static void omap_crtc_manual_display_update(struct work_struct *data)
        struct drm_device *dev = omap_crtc->base.dev;
        int ret;
 
-       if (!dssdev) {
-               dev_err_once(dev->dev, "missing display dssdev!");
+       if (!dssdev || !dssdev->dsi_ops || !dssdev->dsi_ops->update)
                return;
-       }
-
-       if (dssdev->type != OMAP_DISPLAY_TYPE_DSI || !dssdev->ops->dsi.update) {
-               dev_err_once(dev->dev, "no DSI update callback found!");
-               return;
-       }
 
-       ret = dssdev->ops->dsi.update(dssdev);
+       ret = dssdev->dsi_ops->update(dssdev);
        if (ret < 0) {
                spin_lock_irq(&dev->event_lock);
                omap_crtc->pending = false;
@@ -585,11 +578,10 @@ static bool omap_crtc_is_manually_updated(struct drm_crtc *crtc)
        struct omap_crtc *omap_crtc = to_omap_crtc(crtc);
        struct omap_dss_device *dssdev = omap_crtc->pipe->output;
 
-       if (dssdev->type != OMAP_DISPLAY_TYPE_DSI ||
-           !dssdev->ops->dsi.is_video_mode)
+       if (!dssdev || !dssdev->dsi_ops || !dssdev->dsi_ops->is_video_mode)
                return false;
 
-       if (dssdev->ops->dsi.is_video_mode(dssdev))
+       if (dssdev->dsi_ops->is_video_mode(dssdev))
                return false;
 
        DBG("detected manually updated display!");