drm/gma500: Move to private save/restore hooks
authorDaniel Vetter <daniel.vetter@ffwll.ch>
Fri, 4 Dec 2015 08:45:53 +0000 (09:45 +0100)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Tue, 8 Dec 2015 15:13:30 +0000 (16:13 +0100)
I want to remove the core ones since with atomic drivers system
suspend/resume is solved much differently. And there's only 2 drivers
(nouveau besides gma500) really using them.

v2: Fixup build noise 0day reported.

Cc: Patrik Jakobsson <patrik.r.jakobsson@gmail.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1449218769-16577-13-git-send-email-daniel.vetter@ffwll.ch
Reviewed-by: Thierry Reding <treding@nvidia.com> (v1)
14 files changed:
drivers/gpu/drm/gma500/cdv_device.c
drivers/gpu/drm/gma500/cdv_intel_display.c
drivers/gpu/drm/gma500/cdv_intel_hdmi.c
drivers/gpu/drm/gma500/cdv_intel_lvds.c
drivers/gpu/drm/gma500/mdfld_device.c
drivers/gpu/drm/gma500/mdfld_dsi_output.c
drivers/gpu/drm/gma500/oaktrail_device.c
drivers/gpu/drm/gma500/psb_device.c
drivers/gpu/drm/gma500/psb_drv.h
drivers/gpu/drm/gma500/psb_intel_display.c
drivers/gpu/drm/gma500/psb_intel_drv.h
drivers/gpu/drm/gma500/psb_intel_lvds.c
drivers/gpu/drm/gma500/psb_intel_sdvo.c
drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c

index 3531f90..8745971 100644 (file)
@@ -619,6 +619,8 @@ const struct psb_ops cdv_chip_ops = {
        .init_pm = cdv_init_pm,
        .save_regs = cdv_save_display_registers,
        .restore_regs = cdv_restore_display_registers,
+       .save_crtc = gma_crtc_save,
+       .restore_crtc = gma_crtc_restore,
        .power_down = cdv_power_down,
        .power_up = cdv_power_up,
        .update_wm = cdv_update_wm,
index 7d47b3d..6126546 100644 (file)
@@ -983,8 +983,6 @@ const struct drm_crtc_helper_funcs cdv_intel_helper_funcs = {
 };
 
 const struct drm_crtc_funcs cdv_intel_crtc_funcs = {
-       .save = gma_crtc_save,
-       .restore = gma_crtc_restore,
        .cursor_set = gma_crtc_cursor_set,
        .cursor_move = gma_crtc_cursor_move,
        .gamma_set = gma_crtc_gamma_set,
index 6b1d334..e7b1e99 100644 (file)
@@ -270,8 +270,6 @@ static const struct drm_connector_helper_funcs
 
 static const struct drm_connector_funcs cdv_hdmi_connector_funcs = {
        .dpms = drm_helper_connector_dpms,
-       .save = cdv_hdmi_save,
-       .restore = cdv_hdmi_restore,
        .detect = cdv_hdmi_detect,
        .fill_modes = drm_helper_probe_single_connector_modes,
        .set_property = cdv_hdmi_set_property,
@@ -306,6 +304,9 @@ void cdv_hdmi_init(struct drm_device *dev,
 
        connector = &gma_connector->base;
        connector->polled = DRM_CONNECTOR_POLL_HPD;
+       gma_connector->save = cdv_hdmi_save;
+       gma_connector->restore = cdv_hdmi_restore;
+
        encoder = &gma_encoder->base;
        drm_connector_init(dev, connector,
                           &cdv_hdmi_connector_funcs,
index 211069b..9e648bc 100644 (file)
@@ -530,8 +530,6 @@ static const struct drm_connector_helper_funcs
 
 static const struct drm_connector_funcs cdv_intel_lvds_connector_funcs = {
        .dpms = drm_helper_connector_dpms,
-       .save = cdv_intel_lvds_save,
-       .restore = cdv_intel_lvds_restore,
        .detect = cdv_intel_lvds_detect,
        .fill_modes = drm_helper_probe_single_connector_modes,
        .set_property = cdv_intel_lvds_set_property,
@@ -643,6 +641,8 @@ void cdv_intel_lvds_init(struct drm_device *dev,
        gma_encoder->dev_priv = lvds_priv;
 
        connector = &gma_connector->base;
+       gma_connector->save = cdv_intel_lvds_save;
+       gma_connector->restore = cdv_intel_lvds_restore;
        encoder = &gma_encoder->base;
 
 
index 265ad0d..e2ab858 100644 (file)
@@ -546,6 +546,8 @@ const struct psb_ops mdfld_chip_ops = {
 
        .save_regs = mdfld_save_registers,
        .restore_regs = mdfld_restore_registers,
+       .save_crtc = gma_crtc_save,
+       .restore_crtc = gma_crtc_restore,
        .power_down = mdfld_power_down,
        .power_up = mdfld_power_up,
 };
index 89f705c..d758f4c 100644 (file)
@@ -405,8 +405,6 @@ static struct drm_encoder *mdfld_dsi_connector_best_encoder(
 /*DSI connector funcs*/
 static const struct drm_connector_funcs mdfld_dsi_connector_funcs = {
        .dpms = /*drm_helper_connector_dpms*/mdfld_dsi_connector_dpms,
-       .save = mdfld_dsi_connector_save,
-       .restore = mdfld_dsi_connector_restore,
        .detect = mdfld_dsi_connector_detect,
        .fill_modes = drm_helper_probe_single_connector_modes,
        .set_property = mdfld_dsi_connector_set_property,
@@ -563,6 +561,9 @@ void mdfld_dsi_output_init(struct drm_device *dev,
 
 
        connector = &dsi_connector->base.base;
+       dsi_connector->base.save = mdfld_dsi_connector_save;
+       dsi_connector->base.restore = mdfld_dsi_connector_restore;
+
        drm_connector_init(dev, connector, &mdfld_dsi_connector_funcs,
                                                DRM_MODE_CONNECTOR_LVDS);
        drm_connector_helper_add(connector, &mdfld_dsi_connector_helper_funcs);
index 368a03a..ba30b43 100644 (file)
@@ -568,6 +568,8 @@ const struct psb_ops oaktrail_chip_ops = {
 
        .save_regs = oaktrail_save_display_registers,
        .restore_regs = oaktrail_restore_display_registers,
+       .save_crtc = gma_crtc_save,
+       .restore_crtc = gma_crtc_restore,
        .power_down = oaktrail_power_down,
        .power_up = oaktrail_power_up,
 
index 07df7d4..dc0f852 100644 (file)
@@ -181,7 +181,7 @@ static int psb_save_display_registers(struct drm_device *dev)
 {
        struct drm_psb_private *dev_priv = dev->dev_private;
        struct drm_crtc *crtc;
-       struct drm_connector *connector;
+       struct gma_connector *connector;
        struct psb_state *regs = &dev_priv->regs.psb;
 
        /* Display arbitration control + watermarks */
@@ -198,12 +198,12 @@ static int psb_save_display_registers(struct drm_device *dev)
        drm_modeset_lock_all(dev);
        list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) {
                if (drm_helper_crtc_in_use(crtc))
-                       crtc->funcs->save(crtc);
+                       dev_priv->ops->save_crtc(crtc);
        }
 
-       list_for_each_entry(connector, &dev->mode_config.connector_list, head)
-               if (connector->funcs->save)
-                       connector->funcs->save(connector);
+       list_for_each_entry(connector, &dev->mode_config.connector_list, base.head)
+               if (connector->save)
+                       connector->save(&connector->base);
 
        drm_modeset_unlock_all(dev);
        return 0;
@@ -219,7 +219,7 @@ static int psb_restore_display_registers(struct drm_device *dev)
 {
        struct drm_psb_private *dev_priv = dev->dev_private;
        struct drm_crtc *crtc;
-       struct drm_connector *connector;
+       struct gma_connector *connector;
        struct psb_state *regs = &dev_priv->regs.psb;
 
        /* Display arbitration + watermarks */
@@ -238,11 +238,11 @@ static int psb_restore_display_registers(struct drm_device *dev)
        drm_modeset_lock_all(dev);
        list_for_each_entry(crtc, &dev->mode_config.crtc_list, head)
                if (drm_helper_crtc_in_use(crtc))
-                       crtc->funcs->restore(crtc);
+                       dev_priv->ops->restore_crtc(crtc);
 
-       list_for_each_entry(connector, &dev->mode_config.connector_list, head)
-               if (connector->funcs->restore)
-                       connector->funcs->restore(connector);
+       list_for_each_entry(connector, &dev->mode_config.connector_list, base.head)
+               if (connector->restore)
+                       connector->restore(&connector->base);
 
        drm_modeset_unlock_all(dev);
        return 0;
@@ -354,6 +354,8 @@ const struct psb_ops psb_chip_ops = {
        .init_pm = psb_init_pm,
        .save_regs = psb_save_display_registers,
        .restore_regs = psb_restore_display_registers,
+       .save_crtc = gma_crtc_save,
+       .restore_crtc = gma_crtc_restore,
        .power_down = psb_power_down,
        .power_up = psb_power_up,
 };
index 3bd2c72..b743727 100644 (file)
@@ -653,6 +653,8 @@ struct psb_ops {
        void (*init_pm)(struct drm_device *dev);
        int (*save_regs)(struct drm_device *dev);
        int (*restore_regs)(struct drm_device *dev);
+       void (*save_crtc)(struct drm_crtc *crtc);
+       void (*restore_crtc)(struct drm_crtc *crtc);
        int (*power_up)(struct drm_device *dev);
        int (*power_down)(struct drm_device *dev);
        void (*update_wm)(struct drm_device *dev, struct drm_crtc *crtc);
index 6659da8..dcdbc37 100644 (file)
@@ -439,8 +439,6 @@ const struct drm_crtc_helper_funcs psb_intel_helper_funcs = {
 };
 
 const struct drm_crtc_funcs psb_intel_crtc_funcs = {
-       .save = gma_crtc_save,
-       .restore = gma_crtc_restore,
        .cursor_set = gma_crtc_cursor_set,
        .cursor_move = gma_crtc_cursor_move,
        .gamma_set = gma_crtc_gamma_set,
index 860dd21..2a3b7c6 100644 (file)
@@ -140,6 +140,9 @@ struct gma_encoder {
 struct gma_connector {
        struct drm_connector base;
        struct gma_encoder *encoder;
+
+       void (*save)(struct drm_connector *connector);
+       void (*restore)(struct drm_connector *connector);
 };
 
 struct psb_intel_crtc_state {
index ce0645d..0d61437 100644 (file)
@@ -653,8 +653,6 @@ const struct drm_connector_helper_funcs
 
 const struct drm_connector_funcs psb_intel_lvds_connector_funcs = {
        .dpms = drm_helper_connector_dpms,
-       .save = psb_intel_lvds_save,
-       .restore = psb_intel_lvds_restore,
        .detect = psb_intel_lvds_detect,
        .fill_modes = drm_helper_probe_single_connector_modes,
        .set_property = psb_intel_lvds_set_property,
@@ -715,6 +713,9 @@ void psb_intel_lvds_init(struct drm_device *dev,
        gma_encoder->dev_priv = lvds_priv;
 
        connector = &gma_connector->base;
+       gma_connector->save = psb_intel_lvds_save;
+       gma_connector->restore = psb_intel_lvds_restore;
+
        encoder = &gma_encoder->base;
        drm_connector_init(dev, connector,
                           &psb_intel_lvds_connector_funcs,
index 58529ce..86f28ac 100644 (file)
@@ -1837,8 +1837,6 @@ static const struct drm_encoder_helper_funcs psb_intel_sdvo_helper_funcs = {
 
 static const struct drm_connector_funcs psb_intel_sdvo_connector_funcs = {
        .dpms = drm_helper_connector_dpms,
-       .save = psb_intel_sdvo_save,
-       .restore = psb_intel_sdvo_restore,
        .detect = psb_intel_sdvo_detect,
        .fill_modes = drm_helper_probe_single_connector_modes,
        .set_property = psb_intel_sdvo_set_property,
@@ -2021,6 +2019,9 @@ psb_intel_sdvo_connector_init(struct psb_intel_sdvo_connector *connector,
        connector->base.base.doublescan_allowed = 0;
        connector->base.base.display_info.subpixel_order = SubPixelHorizontalRGB;
 
+       connector->base.save = psb_intel_sdvo_save;
+       connector->base.restore = psb_intel_sdvo_restore;
+
        gma_connector_attach_encoder(&connector->base, &encoder->base);
        drm_connector_register(&connector->base.base);
 }
index 26dfed6..5379dc4 100644 (file)
@@ -563,8 +563,6 @@ static void vmw_sou_connector_destroy(struct drm_connector *connector)
 
 static struct drm_connector_funcs vmw_sou_connector_funcs = {
        .dpms = vmw_du_connector_dpms,
-       .detect = vmw_du_connector_detect,
-       .fill_modes = vmw_du_connector_fill_modes,
        .set_property = vmw_du_connector_set_property,
        .destroy = vmw_sou_connector_destroy,
 };