From e5cbb6e8eaa6d4ae8b4acafd59e2e058105c8177 Mon Sep 17 00:00:00 2001 From: Tomi Valkeinen Date: Wed, 4 Nov 2015 19:36:26 +0200 Subject: [PATCH] drm/omap: convert dss_mgr_ops to use omap_channel We are removing the use of 'struct omap_overlay_manager' from omapdrm. This patch changes the function pointers in 'dss_mgr_ops' to get 'enum omap_channel' parameter instead of 'struct omap_overlay_manager'. The change is very straightforward, as we still use 'struct omap_overlay_manager' inside the function implementations where needed. Signed-off-by: Tomi Valkeinen --- drivers/gpu/drm/omapdrm/dss/apply.c | 27 ++++++++++++------- drivers/gpu/drm/omapdrm/dss/omapdss.h | 18 ++++++------- drivers/gpu/drm/omapdrm/dss/output.c | 18 ++++++------- drivers/gpu/drm/omapdrm/omap_crtc.c | 38 +++++++++++++++------------ 4 files changed, 57 insertions(+), 44 deletions(-) diff --git a/drivers/gpu/drm/omapdrm/dss/apply.c b/drivers/gpu/drm/omapdrm/dss/apply.c index 663ccc3bf4e5..1b7c718c08b2 100644 --- a/drivers/gpu/drm/omapdrm/dss/apply.c +++ b/drivers/gpu/drm/omapdrm/dss/apply.c @@ -805,20 +805,23 @@ static void mgr_clear_shadow_dirty(struct omap_overlay_manager *mgr) } } -static int dss_mgr_connect_compat(struct omap_overlay_manager *mgr, +static int dss_mgr_connect_compat(enum omap_channel channel, struct omap_dss_device *dst) { + struct omap_overlay_manager *mgr = omap_dss_get_overlay_manager(channel); return mgr->set_output(mgr, dst); } -static void dss_mgr_disconnect_compat(struct omap_overlay_manager *mgr, +static void dss_mgr_disconnect_compat(enum omap_channel channel, struct omap_dss_device *dst) { + struct omap_overlay_manager *mgr = omap_dss_get_overlay_manager(channel); mgr->unset_output(mgr); } -static void dss_mgr_start_update_compat(struct omap_overlay_manager *mgr) +static void dss_mgr_start_update_compat(enum omap_channel channel) { + struct omap_overlay_manager *mgr = omap_dss_get_overlay_manager(channel); struct mgr_priv_data *mp = get_mgr_priv(mgr); unsigned long flags; int r; @@ -1072,8 +1075,9 @@ static void dss_setup_fifos(void) } } -static int dss_mgr_enable_compat(struct omap_overlay_manager *mgr) +static int dss_mgr_enable_compat(enum omap_channel channel) { + struct omap_overlay_manager *mgr = omap_dss_get_overlay_manager(channel); struct mgr_priv_data *mp = get_mgr_priv(mgr); unsigned long flags; int r; @@ -1122,8 +1126,9 @@ err: return r; } -static void dss_mgr_disable_compat(struct omap_overlay_manager *mgr) +static void dss_mgr_disable_compat(enum omap_channel channel) { + struct omap_overlay_manager *mgr = omap_dss_get_overlay_manager(channel); struct mgr_priv_data *mp = get_mgr_priv(mgr); unsigned long flags; @@ -1261,9 +1266,10 @@ static void dss_apply_mgr_timings(struct omap_overlay_manager *mgr, mp->extra_info_dirty = true; } -static void dss_mgr_set_timings_compat(struct omap_overlay_manager *mgr, +static void dss_mgr_set_timings_compat(enum omap_channel channel, const struct omap_video_timings *timings) { + struct omap_overlay_manager *mgr = omap_dss_get_overlay_manager(channel); unsigned long flags; struct mgr_priv_data *mp = get_mgr_priv(mgr); @@ -1289,9 +1295,10 @@ static void dss_apply_mgr_lcd_config(struct omap_overlay_manager *mgr, mp->extra_info_dirty = true; } -static void dss_mgr_set_lcd_config_compat(struct omap_overlay_manager *mgr, +static void dss_mgr_set_lcd_config_compat(enum omap_channel channel, const struct dss_lcd_mgr_config *config) { + struct omap_overlay_manager *mgr = omap_dss_get_overlay_manager(channel); unsigned long flags; struct mgr_priv_data *mp = get_mgr_priv(mgr); @@ -1554,9 +1561,10 @@ err: return r; } -static int dss_mgr_register_framedone_handler_compat(struct omap_overlay_manager *mgr, +static int dss_mgr_register_framedone_handler_compat(enum omap_channel channel, void (*handler)(void *), void *data) { + struct omap_overlay_manager *mgr = omap_dss_get_overlay_manager(channel); struct mgr_priv_data *mp = get_mgr_priv(mgr); if (mp->framedone_handler) @@ -1568,9 +1576,10 @@ static int dss_mgr_register_framedone_handler_compat(struct omap_overlay_manager return 0; } -static void dss_mgr_unregister_framedone_handler_compat(struct omap_overlay_manager *mgr, +static void dss_mgr_unregister_framedone_handler_compat(enum omap_channel channel, void (*handler)(void *), void *data) { + struct omap_overlay_manager *mgr = omap_dss_get_overlay_manager(channel); struct mgr_priv_data *mp = get_mgr_priv(mgr); WARN_ON(mp->framedone_handler != handler || diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h index 0a213489f133..640ba08735c5 100644 --- a/drivers/gpu/drm/omapdrm/dss/omapdss.h +++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h @@ -61,21 +61,21 @@ int dispc_ovl_setup(enum omap_plane plane, const struct omap_overlay_info *oi, enum omap_dss_output_id dispc_mgr_get_supported_outputs(enum omap_channel channel); struct dss_mgr_ops { - int (*connect)(struct omap_overlay_manager *mgr, + int (*connect)(enum omap_channel channel, struct omap_dss_device *dst); - void (*disconnect)(struct omap_overlay_manager *mgr, + void (*disconnect)(enum omap_channel channel, struct omap_dss_device *dst); - void (*start_update)(struct omap_overlay_manager *mgr); - int (*enable)(struct omap_overlay_manager *mgr); - void (*disable)(struct omap_overlay_manager *mgr); - void (*set_timings)(struct omap_overlay_manager *mgr, + void (*start_update)(enum omap_channel channel); + int (*enable)(enum omap_channel channel); + void (*disable)(enum omap_channel channel); + void (*set_timings)(enum omap_channel channel, const struct omap_video_timings *timings); - void (*set_lcd_config)(struct omap_overlay_manager *mgr, + void (*set_lcd_config)(enum omap_channel channel, const struct dss_lcd_mgr_config *config); - int (*register_framedone_handler)(struct omap_overlay_manager *mgr, + int (*register_framedone_handler)(enum omap_channel channel, void (*handler)(void *), void *data); - void (*unregister_framedone_handler)(struct omap_overlay_manager *mgr, + void (*unregister_framedone_handler)(enum omap_channel channel, void (*handler)(void *), void *data); }; diff --git a/drivers/gpu/drm/omapdrm/dss/output.c b/drivers/gpu/drm/omapdrm/dss/output.c index c1c099dfd621..69e081392ee5 100644 --- a/drivers/gpu/drm/omapdrm/dss/output.c +++ b/drivers/gpu/drm/omapdrm/dss/output.c @@ -191,59 +191,59 @@ EXPORT_SYMBOL(dss_uninstall_mgr_ops); int dss_mgr_connect(struct omap_overlay_manager *mgr, struct omap_dss_device *dst) { - return dss_mgr_ops->connect(mgr, dst); + return dss_mgr_ops->connect(mgr->id, dst); } EXPORT_SYMBOL(dss_mgr_connect); void dss_mgr_disconnect(struct omap_overlay_manager *mgr, struct omap_dss_device *dst) { - dss_mgr_ops->disconnect(mgr, dst); + dss_mgr_ops->disconnect(mgr->id, dst); } EXPORT_SYMBOL(dss_mgr_disconnect); void dss_mgr_set_timings(struct omap_overlay_manager *mgr, const struct omap_video_timings *timings) { - dss_mgr_ops->set_timings(mgr, timings); + dss_mgr_ops->set_timings(mgr->id, timings); } EXPORT_SYMBOL(dss_mgr_set_timings); void dss_mgr_set_lcd_config(struct omap_overlay_manager *mgr, const struct dss_lcd_mgr_config *config) { - dss_mgr_ops->set_lcd_config(mgr, config); + dss_mgr_ops->set_lcd_config(mgr->id, config); } EXPORT_SYMBOL(dss_mgr_set_lcd_config); int dss_mgr_enable(struct omap_overlay_manager *mgr) { - return dss_mgr_ops->enable(mgr); + return dss_mgr_ops->enable(mgr->id); } EXPORT_SYMBOL(dss_mgr_enable); void dss_mgr_disable(struct omap_overlay_manager *mgr) { - dss_mgr_ops->disable(mgr); + dss_mgr_ops->disable(mgr->id); } EXPORT_SYMBOL(dss_mgr_disable); void dss_mgr_start_update(struct omap_overlay_manager *mgr) { - dss_mgr_ops->start_update(mgr); + dss_mgr_ops->start_update(mgr->id); } EXPORT_SYMBOL(dss_mgr_start_update); int dss_mgr_register_framedone_handler(struct omap_overlay_manager *mgr, void (*handler)(void *), void *data) { - return dss_mgr_ops->register_framedone_handler(mgr, handler, data); + return dss_mgr_ops->register_framedone_handler(mgr->id, handler, data); } EXPORT_SYMBOL(dss_mgr_register_framedone_handler); void dss_mgr_unregister_framedone_handler(struct omap_overlay_manager *mgr, void (*handler)(void *), void *data) { - dss_mgr_ops->unregister_framedone_handler(mgr, handler, data); + dss_mgr_ops->unregister_framedone_handler(mgr->id, handler, data); } EXPORT_SYMBOL(dss_mgr_unregister_framedone_handler); diff --git a/drivers/gpu/drm/omapdrm/omap_crtc.c b/drivers/gpu/drm/omapdrm/omap_crtc.c index e583de9e31db..cb5a30e3109d 100644 --- a/drivers/gpu/drm/omapdrm/omap_crtc.c +++ b/drivers/gpu/drm/omapdrm/omap_crtc.c @@ -99,16 +99,18 @@ static struct omap_crtc *omap_crtcs[8]; static struct omap_dss_device *omap_crtc_output[8]; /* we can probably ignore these until we support command-mode panels: */ -static int omap_crtc_dss_connect(struct omap_overlay_manager *mgr, +static int omap_crtc_dss_connect(enum omap_channel channel, struct omap_dss_device *dst) { - if (omap_crtc_output[mgr->id]) + struct omap_overlay_manager *mgr = omap_dss_get_overlay_manager(channel); + + if (omap_crtc_output[channel]) return -EINVAL; - if ((dispc_mgr_get_supported_outputs(mgr->id) & dst->id) == 0) + if ((dispc_mgr_get_supported_outputs(channel) & dst->id) == 0) return -EINVAL; - omap_crtc_output[mgr->id] = dst; + omap_crtc_output[channel] = dst; dst->manager = mgr; mgr->output = dst; @@ -116,16 +118,18 @@ static int omap_crtc_dss_connect(struct omap_overlay_manager *mgr, return 0; } -static void omap_crtc_dss_disconnect(struct omap_overlay_manager *mgr, +static void omap_crtc_dss_disconnect(enum omap_channel channel, struct omap_dss_device *dst) { - omap_crtc_output[mgr->id] = NULL; + struct omap_overlay_manager *mgr = omap_dss_get_overlay_manager(channel); + + omap_crtc_output[channel] = NULL; mgr->output->manager = NULL; mgr->output = NULL; } -static void omap_crtc_dss_start_update(struct omap_overlay_manager *mgr) +static void omap_crtc_dss_start_update(enum omap_channel channel) { } @@ -192,9 +196,9 @@ static void omap_crtc_set_enabled(struct drm_crtc *crtc, bool enable) } -static int omap_crtc_dss_enable(struct omap_overlay_manager *mgr) +static int omap_crtc_dss_enable(enum omap_channel channel) { - struct omap_crtc *omap_crtc = omap_crtcs[mgr->id]; + struct omap_crtc *omap_crtc = omap_crtcs[channel]; struct omap_overlay_manager_info info; memset(&info, 0, sizeof(info)); @@ -211,38 +215,38 @@ static int omap_crtc_dss_enable(struct omap_overlay_manager *mgr) return 0; } -static void omap_crtc_dss_disable(struct omap_overlay_manager *mgr) +static void omap_crtc_dss_disable(enum omap_channel channel) { - struct omap_crtc *omap_crtc = omap_crtcs[mgr->id]; + struct omap_crtc *omap_crtc = omap_crtcs[channel]; omap_crtc_set_enabled(&omap_crtc->base, false); } -static void omap_crtc_dss_set_timings(struct omap_overlay_manager *mgr, +static void omap_crtc_dss_set_timings(enum omap_channel channel, const struct omap_video_timings *timings) { - struct omap_crtc *omap_crtc = omap_crtcs[mgr->id]; + struct omap_crtc *omap_crtc = omap_crtcs[channel]; DBG("%s", omap_crtc->name); omap_crtc->timings = *timings; } -static void omap_crtc_dss_set_lcd_config(struct omap_overlay_manager *mgr, +static void omap_crtc_dss_set_lcd_config(enum omap_channel channel, const struct dss_lcd_mgr_config *config) { - struct omap_crtc *omap_crtc = omap_crtcs[mgr->id]; + struct omap_crtc *omap_crtc = omap_crtcs[channel]; DBG("%s", omap_crtc->name); dispc_mgr_set_lcd_config(omap_crtc->channel, config); } static int omap_crtc_dss_register_framedone( - struct omap_overlay_manager *mgr, + enum omap_channel channel, void (*handler)(void *), void *data) { return 0; } static void omap_crtc_dss_unregister_framedone( - struct omap_overlay_manager *mgr, + enum omap_channel channel, void (*handler)(void *), void *data) { } -- 2.20.1