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 3531f90e53d043e4ec6ae473570389a24b1fd6c3..8745971a768037059df59ca3ea2eef2a7ef4fad2 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 7d47b3d5cc0d0be41258c71f4e81b3840be88a2d..6126546295e96858d17e039fdd5444449e326939 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 6b1d3340ba1439eb3491a08d3a15cf4dcf38dc2f..e7b1e99fe2cc6a14bc339c295fa3e5c587542665 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 211069b2b951733b39b510545ddb04c34ef3d4dc..9e648bcb81a7eb5c3cdb538868095e366190d2d5 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 265ad0de44a6ba41eef74f11818057c65bb790bc..e2ab858122f9745dfb2e0408894eda8651c8980f 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 89f705c3a5eb3a4242a3c2d785bd03f181d82945..d758f4cc68055b39b8b02b5202f35f936b653a95 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 368a03ae3010a34d37e206c6792356799c361e24..ba30b43a3412ee05a7017bab3c028a8a160126f0 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 07df7d4eea7282911fb6d1d7ce1e699541babd7b..dc0f8527570c262d27d2d82edad04cbcaac01f53 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 3bd2c726dd61526f435d121f64c507f7de32bb56..b74372760d7f9e3f29000fba4d1325cbf360da9f 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 6659da88fe5b3639da95078dc63cb9505b4a69af..dcdbc37e55e1b67aae06833b35f95472991442a1 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 860dd2177ca15269bfedc7cf1ca2b4dafc3bddae..2a3b7c684db243f6462d9bdb8f82dc14a9f80355 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 ce0645d0c1e5f578a39038c73a78102d44dd04c7..0d6143702b86d8fa6be4ff3e6fc150f9239d4738 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 58529cea575d3c9492e8ea267b56e22772bf2490..86f28ac1e673d9deac48c009429ebc6a4fc5511e 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 26dfed6b0c48be9a756c5064ea12450b36626800..5379dc4bbcacb0db32167546d54429074d38848c 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,
 };