Commit 129b7820 authored by Daniel Vetter's avatar Daniel Vetter

drm: Move encoder->save/restore into nouveau

Nouveau is the only user, and atomic drivers should do state
save/restoring differently. So move it into noveau.

Saves me typing some kerneldoc, too ;-)

v2: Move misplaced hunk into earlier nouveau patch.

Cc: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1449245647-1315-1-git-send-email-daniel.vetter@ffwll.chReviewed-by: default avatarThierry Reding <treding@nvidia.com>
parent 813b0f3e
...@@ -504,8 +504,6 @@ static void nv04_dac_destroy(struct drm_encoder *encoder) ...@@ -504,8 +504,6 @@ static void nv04_dac_destroy(struct drm_encoder *encoder)
static const struct drm_encoder_helper_funcs nv04_dac_helper_funcs = { static const struct drm_encoder_helper_funcs nv04_dac_helper_funcs = {
.dpms = nv04_dac_dpms, .dpms = nv04_dac_dpms,
.save = nv04_dac_save,
.restore = nv04_dac_restore,
.mode_fixup = nv04_dac_mode_fixup, .mode_fixup = nv04_dac_mode_fixup,
.prepare = nv04_dac_prepare, .prepare = nv04_dac_prepare,
.commit = nv04_dac_commit, .commit = nv04_dac_commit,
...@@ -515,8 +513,6 @@ static const struct drm_encoder_helper_funcs nv04_dac_helper_funcs = { ...@@ -515,8 +513,6 @@ static const struct drm_encoder_helper_funcs nv04_dac_helper_funcs = {
static const struct drm_encoder_helper_funcs nv17_dac_helper_funcs = { static const struct drm_encoder_helper_funcs nv17_dac_helper_funcs = {
.dpms = nv04_dac_dpms, .dpms = nv04_dac_dpms,
.save = nv04_dac_save,
.restore = nv04_dac_restore,
.mode_fixup = nv04_dac_mode_fixup, .mode_fixup = nv04_dac_mode_fixup,
.prepare = nv04_dac_prepare, .prepare = nv04_dac_prepare,
.commit = nv04_dac_commit, .commit = nv04_dac_commit,
...@@ -545,6 +541,9 @@ nv04_dac_create(struct drm_connector *connector, struct dcb_output *entry) ...@@ -545,6 +541,9 @@ nv04_dac_create(struct drm_connector *connector, struct dcb_output *entry)
nv_encoder->dcb = entry; nv_encoder->dcb = entry;
nv_encoder->or = ffs(entry->or) - 1; nv_encoder->or = ffs(entry->or) - 1;
nv_encoder->enc_save = nv04_dac_save;
nv_encoder->enc_restore = nv04_dac_restore;
if (nv_gf4_disp_arch(dev)) if (nv_gf4_disp_arch(dev))
helper = &nv17_dac_helper_funcs; helper = &nv17_dac_helper_funcs;
else else
......
...@@ -652,8 +652,6 @@ static void nv04_tmds_slave_init(struct drm_encoder *encoder) ...@@ -652,8 +652,6 @@ static void nv04_tmds_slave_init(struct drm_encoder *encoder)
static const struct drm_encoder_helper_funcs nv04_lvds_helper_funcs = { static const struct drm_encoder_helper_funcs nv04_lvds_helper_funcs = {
.dpms = nv04_lvds_dpms, .dpms = nv04_lvds_dpms,
.save = nv04_dfp_save,
.restore = nv04_dfp_restore,
.mode_fixup = nv04_dfp_mode_fixup, .mode_fixup = nv04_dfp_mode_fixup,
.prepare = nv04_dfp_prepare, .prepare = nv04_dfp_prepare,
.commit = nv04_dfp_commit, .commit = nv04_dfp_commit,
...@@ -663,8 +661,6 @@ static const struct drm_encoder_helper_funcs nv04_lvds_helper_funcs = { ...@@ -663,8 +661,6 @@ static const struct drm_encoder_helper_funcs nv04_lvds_helper_funcs = {
static const struct drm_encoder_helper_funcs nv04_tmds_helper_funcs = { static const struct drm_encoder_helper_funcs nv04_tmds_helper_funcs = {
.dpms = nv04_tmds_dpms, .dpms = nv04_tmds_dpms,
.save = nv04_dfp_save,
.restore = nv04_dfp_restore,
.mode_fixup = nv04_dfp_mode_fixup, .mode_fixup = nv04_dfp_mode_fixup,
.prepare = nv04_dfp_prepare, .prepare = nv04_dfp_prepare,
.commit = nv04_dfp_commit, .commit = nv04_dfp_commit,
...@@ -701,6 +697,9 @@ nv04_dfp_create(struct drm_connector *connector, struct dcb_output *entry) ...@@ -701,6 +697,9 @@ nv04_dfp_create(struct drm_connector *connector, struct dcb_output *entry)
if (!nv_encoder) if (!nv_encoder)
return -ENOMEM; return -ENOMEM;
nv_encoder->enc_save = nv04_dfp_save;
nv_encoder->enc_restore = nv04_dfp_restore;
encoder = to_drm_encoder(nv_encoder); encoder = to_drm_encoder(nv_encoder);
nv_encoder->dcb = entry; nv_encoder->dcb = entry;
......
...@@ -39,6 +39,7 @@ nv04_display_create(struct drm_device *dev) ...@@ -39,6 +39,7 @@ nv04_display_create(struct drm_device *dev)
struct dcb_table *dcb = &drm->vbios.dcb; struct dcb_table *dcb = &drm->vbios.dcb;
struct drm_connector *connector, *ct; struct drm_connector *connector, *ct;
struct drm_encoder *encoder; struct drm_encoder *encoder;
struct nouveau_encoder *nv_encoder;
struct nouveau_crtc *crtc; struct nouveau_crtc *crtc;
struct nv04_display *disp; struct nv04_display *disp;
int i, ret; int i, ret;
...@@ -110,11 +111,8 @@ nv04_display_create(struct drm_device *dev) ...@@ -110,11 +111,8 @@ nv04_display_create(struct drm_device *dev)
list_for_each_entry(crtc, &dev->mode_config.crtc_list, base.head) list_for_each_entry(crtc, &dev->mode_config.crtc_list, base.head)
crtc->save(&crtc->base); crtc->save(&crtc->base);
list_for_each_entry(encoder, &dev->mode_config.encoder_list, head) { list_for_each_entry(nv_encoder, &dev->mode_config.encoder_list, base.base.head)
const struct drm_encoder_helper_funcs *func = encoder->helper_private; nv_encoder->enc_save(&nv_encoder->base.base);
func->save(encoder);
}
nouveau_overlay_init(dev); nouveau_overlay_init(dev);
...@@ -126,7 +124,7 @@ nv04_display_destroy(struct drm_device *dev) ...@@ -126,7 +124,7 @@ nv04_display_destroy(struct drm_device *dev)
{ {
struct nv04_display *disp = nv04_display(dev); struct nv04_display *disp = nv04_display(dev);
struct nouveau_drm *drm = nouveau_drm(dev); struct nouveau_drm *drm = nouveau_drm(dev);
struct drm_encoder *encoder; struct nouveau_encoder *encoder;
struct drm_crtc *crtc; struct drm_crtc *crtc;
struct nouveau_crtc *nv_crtc; struct nouveau_crtc *nv_crtc;
...@@ -140,11 +138,8 @@ nv04_display_destroy(struct drm_device *dev) ...@@ -140,11 +138,8 @@ nv04_display_destroy(struct drm_device *dev)
} }
/* Restore state */ /* Restore state */
list_for_each_entry(encoder, &dev->mode_config.encoder_list, head) { list_for_each_entry(encoder, &dev->mode_config.encoder_list, base.base.head)
const struct drm_encoder_helper_funcs *func = encoder->helper_private; encoder->enc_restore(&encoder->base.base);
func->restore(encoder);
}
list_for_each_entry(nv_crtc, &dev->mode_config.crtc_list, base.head) list_for_each_entry(nv_crtc, &dev->mode_config.crtc_list, base.head)
nv_crtc->restore(&nv_crtc->base); nv_crtc->restore(&nv_crtc->base);
...@@ -160,8 +155,8 @@ nv04_display_destroy(struct drm_device *dev) ...@@ -160,8 +155,8 @@ nv04_display_destroy(struct drm_device *dev)
int int
nv04_display_init(struct drm_device *dev) nv04_display_init(struct drm_device *dev)
{ {
struct drm_encoder *encoder; struct nouveau_encoder *encoder;
struct drm_crtc *crtc; struct nouveau_crtc *crtc;
/* meh.. modeset apparently doesn't setup all the regs and depends /* meh.. modeset apparently doesn't setup all the regs and depends
* on pre-existing state, for now load the state of the card *before* * on pre-existing state, for now load the state of the card *before*
...@@ -171,14 +166,11 @@ nv04_display_init(struct drm_device *dev) ...@@ -171,14 +166,11 @@ nv04_display_init(struct drm_device *dev)
* save/restore "pre-load" state, but more general so we can save * save/restore "pre-load" state, but more general so we can save
* on suspend too. * on suspend too.
*/ */
list_for_each_entry(encoder, &dev->mode_config.encoder_list, head) { list_for_each_entry(crtc, &dev->mode_config.crtc_list, base.head)
const struct drm_encoder_helper_funcs *func = encoder->helper_private; crtc->save(&crtc->base);
func->restore(encoder);
}
list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) list_for_each_entry(encoder, &dev->mode_config.encoder_list, base.base.head)
crtc->funcs->restore(crtc); encoder->enc_save(&encoder->base.base);
return 0; return 0;
} }
......
...@@ -192,8 +192,6 @@ static const struct drm_encoder_funcs nv04_tv_funcs = { ...@@ -192,8 +192,6 @@ static const struct drm_encoder_funcs nv04_tv_funcs = {
static const struct drm_encoder_helper_funcs nv04_tv_helper_funcs = { static const struct drm_encoder_helper_funcs nv04_tv_helper_funcs = {
.dpms = nv04_tv_dpms, .dpms = nv04_tv_dpms,
.save = drm_i2c_encoder_save,
.restore = drm_i2c_encoder_restore,
.mode_fixup = drm_i2c_encoder_mode_fixup, .mode_fixup = drm_i2c_encoder_mode_fixup,
.prepare = nv04_tv_prepare, .prepare = nv04_tv_prepare,
.commit = nv04_tv_commit, .commit = nv04_tv_commit,
...@@ -228,6 +226,9 @@ nv04_tv_create(struct drm_connector *connector, struct dcb_output *entry) ...@@ -228,6 +226,9 @@ nv04_tv_create(struct drm_connector *connector, struct dcb_output *entry)
drm_encoder_init(dev, encoder, &nv04_tv_funcs, DRM_MODE_ENCODER_TVDAC); drm_encoder_init(dev, encoder, &nv04_tv_funcs, DRM_MODE_ENCODER_TVDAC);
drm_encoder_helper_add(encoder, &nv04_tv_helper_funcs); drm_encoder_helper_add(encoder, &nv04_tv_helper_funcs);
nv_encoder->enc_save = drm_i2c_encoder_save;
nv_encoder->enc_restore = drm_i2c_encoder_restore;
encoder->possible_crtcs = entry->heads; encoder->possible_crtcs = entry->heads;
encoder->possible_clones = 0; encoder->possible_clones = 0;
nv_encoder->dcb = entry; nv_encoder->dcb = entry;
......
...@@ -771,8 +771,6 @@ static void nv17_tv_destroy(struct drm_encoder *encoder) ...@@ -771,8 +771,6 @@ static void nv17_tv_destroy(struct drm_encoder *encoder)
static struct drm_encoder_helper_funcs nv17_tv_helper_funcs = { static struct drm_encoder_helper_funcs nv17_tv_helper_funcs = {
.dpms = nv17_tv_dpms, .dpms = nv17_tv_dpms,
.save = nv17_tv_save,
.restore = nv17_tv_restore,
.mode_fixup = nv17_tv_mode_fixup, .mode_fixup = nv17_tv_mode_fixup,
.prepare = nv17_tv_prepare, .prepare = nv17_tv_prepare,
.commit = nv17_tv_commit, .commit = nv17_tv_commit,
...@@ -820,6 +818,9 @@ nv17_tv_create(struct drm_connector *connector, struct dcb_output *entry) ...@@ -820,6 +818,9 @@ nv17_tv_create(struct drm_connector *connector, struct dcb_output *entry)
drm_encoder_helper_add(encoder, &nv17_tv_helper_funcs); drm_encoder_helper_add(encoder, &nv17_tv_helper_funcs);
to_encoder_slave(encoder)->slave_funcs = &nv17_tv_slave_funcs; to_encoder_slave(encoder)->slave_funcs = &nv17_tv_slave_funcs;
tv_enc->base.enc_save = nv17_tv_save;
tv_enc->base.enc_restore = nv17_tv_restore;
encoder->possible_crtcs = entry->heads; encoder->possible_crtcs = entry->heads;
encoder->possible_clones = 0; encoder->possible_clones = 0;
......
...@@ -63,6 +63,9 @@ struct nouveau_encoder { ...@@ -63,6 +63,9 @@ struct nouveau_encoder {
u32 datarate; u32 datarate;
} dp; } dp;
}; };
void (*enc_save)(struct drm_encoder *encoder);
void (*enc_restore)(struct drm_encoder *encoder);
}; };
struct nouveau_encoder * struct nouveau_encoder *
......
...@@ -131,8 +131,6 @@ static inline void drm_crtc_helper_add(struct drm_crtc *crtc, ...@@ -131,8 +131,6 @@ static inline void drm_crtc_helper_add(struct drm_crtc *crtc,
/** /**
* struct drm_encoder_helper_funcs - helper operations for encoders * struct drm_encoder_helper_funcs - helper operations for encoders
* @dpms: set power state * @dpms: set power state
* @save: save connector state
* @restore: restore connector state
* @mode_fixup: try to fixup proposed mode for this connector * @mode_fixup: try to fixup proposed mode for this connector
* @prepare: part of the disable sequence, called before the CRTC modeset * @prepare: part of the disable sequence, called before the CRTC modeset
* @commit: called after the CRTC modeset * @commit: called after the CRTC modeset
...@@ -154,8 +152,6 @@ static inline void drm_crtc_helper_add(struct drm_crtc *crtc, ...@@ -154,8 +152,6 @@ static inline void drm_crtc_helper_add(struct drm_crtc *crtc,
*/ */
struct drm_encoder_helper_funcs { struct drm_encoder_helper_funcs {
void (*dpms)(struct drm_encoder *encoder, int mode); void (*dpms)(struct drm_encoder *encoder, int mode);
void (*save)(struct drm_encoder *encoder);
void (*restore)(struct drm_encoder *encoder);
bool (*mode_fixup)(struct drm_encoder *encoder, bool (*mode_fixup)(struct drm_encoder *encoder,
const struct drm_display_mode *mode, const struct drm_display_mode *mode,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment