Commit ba801ef0 authored by Ben Skeggs's avatar Ben Skeggs

drm/nouveau/kms: display destroy/init/fini hooks can be static

Swapped order of functions in dispnv04 to allow this, but no code changes.
Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
parent d7f9bb65
...@@ -31,6 +31,61 @@ ...@@ -31,6 +31,61 @@
#include "nouveau_encoder.h" #include "nouveau_encoder.h"
#include "nouveau_connector.h" #include "nouveau_connector.h"
static void
nv04_display_fini(struct drm_device *dev)
{
/* Disable vblank interrupts. */
NVWriteCRTC(dev, 0, NV_PCRTC_INTR_EN_0, 0);
if (nv_two_heads(dev))
NVWriteCRTC(dev, 1, NV_PCRTC_INTR_EN_0, 0);
}
static int
nv04_display_init(struct drm_device *dev)
{
struct nouveau_encoder *encoder;
struct nouveau_crtc *crtc;
/* meh.. modeset apparently doesn't setup all the regs and depends
* on pre-existing state, for now load the state of the card *before*
* nouveau was loaded, and then do a modeset.
*
* best thing to do probably is to make save/restore routines not
* save/restore "pre-load" state, but more general so we can save
* on suspend too.
*/
list_for_each_entry(crtc, &dev->mode_config.crtc_list, base.head)
crtc->save(&crtc->base);
list_for_each_entry(encoder, &dev->mode_config.encoder_list, base.base.head)
encoder->enc_save(&encoder->base.base);
return 0;
}
static void
nv04_display_destroy(struct drm_device *dev)
{
struct nv04_display *disp = nv04_display(dev);
struct nouveau_drm *drm = nouveau_drm(dev);
struct nouveau_encoder *encoder;
struct nouveau_crtc *nv_crtc;
/* Restore state */
list_for_each_entry(encoder, &dev->mode_config.encoder_list, base.base.head)
encoder->enc_restore(&encoder->base.base);
list_for_each_entry(nv_crtc, &dev->mode_config.crtc_list, base.head)
nv_crtc->restore(&nv_crtc->base);
nouveau_hw_save_vga_fonts(dev, 0);
nouveau_display(dev)->priv = NULL;
kfree(disp);
nvif_object_unmap(&drm->client.device.object);
}
int int
nv04_display_create(struct drm_device *dev) nv04_display_create(struct drm_device *dev)
{ {
...@@ -121,58 +176,3 @@ nv04_display_create(struct drm_device *dev) ...@@ -121,58 +176,3 @@ nv04_display_create(struct drm_device *dev)
return 0; return 0;
} }
void
nv04_display_destroy(struct drm_device *dev)
{
struct nv04_display *disp = nv04_display(dev);
struct nouveau_drm *drm = nouveau_drm(dev);
struct nouveau_encoder *encoder;
struct nouveau_crtc *nv_crtc;
/* Restore state */
list_for_each_entry(encoder, &dev->mode_config.encoder_list, base.base.head)
encoder->enc_restore(&encoder->base.base);
list_for_each_entry(nv_crtc, &dev->mode_config.crtc_list, base.head)
nv_crtc->restore(&nv_crtc->base);
nouveau_hw_save_vga_fonts(dev, 0);
nouveau_display(dev)->priv = NULL;
kfree(disp);
nvif_object_unmap(&drm->client.device.object);
}
int
nv04_display_init(struct drm_device *dev)
{
struct nouveau_encoder *encoder;
struct nouveau_crtc *crtc;
/* meh.. modeset apparently doesn't setup all the regs and depends
* on pre-existing state, for now load the state of the card *before*
* nouveau was loaded, and then do a modeset.
*
* best thing to do probably is to make save/restore routines not
* save/restore "pre-load" state, but more general so we can save
* on suspend too.
*/
list_for_each_entry(crtc, &dev->mode_config.crtc_list, base.head)
crtc->save(&crtc->base);
list_for_each_entry(encoder, &dev->mode_config.encoder_list, base.base.head)
encoder->enc_save(&encoder->base.base);
return 0;
}
void
nv04_display_fini(struct drm_device *dev)
{
/* disable vblank interrupts */
NVWriteCRTC(dev, 0, NV_PCRTC_INTR_EN_0, 0);
if (nv_two_heads(dev))
NVWriteCRTC(dev, 1, NV_PCRTC_INTR_EN_0, 0);
}
...@@ -92,9 +92,6 @@ nv04_display(struct drm_device *dev) ...@@ -92,9 +92,6 @@ nv04_display(struct drm_device *dev)
/* nv04_display.c */ /* nv04_display.c */
int nv04_display_create(struct drm_device *); int nv04_display_create(struct drm_device *);
void nv04_display_destroy(struct drm_device *);
int nv04_display_init(struct drm_device *);
void nv04_display_fini(struct drm_device *);
/* nv04_crtc.c */ /* nv04_crtc.c */
int nv04_crtc_create(struct drm_device *, int index); int nv04_crtc_create(struct drm_device *, int index);
......
...@@ -2221,7 +2221,7 @@ nv50_disp_func = { ...@@ -2221,7 +2221,7 @@ nv50_disp_func = {
* Init * Init
*****************************************************************************/ *****************************************************************************/
void static void
nv50_display_fini(struct drm_device *dev) nv50_display_fini(struct drm_device *dev)
{ {
struct nouveau_encoder *nv_encoder; struct nouveau_encoder *nv_encoder;
...@@ -2243,7 +2243,7 @@ nv50_display_fini(struct drm_device *dev) ...@@ -2243,7 +2243,7 @@ nv50_display_fini(struct drm_device *dev)
} }
} }
int static int
nv50_display_init(struct drm_device *dev) nv50_display_init(struct drm_device *dev)
{ {
struct nv50_core *core = nv50_disp(dev)->core; struct nv50_core *core = nv50_disp(dev)->core;
...@@ -2270,7 +2270,7 @@ nv50_display_init(struct drm_device *dev) ...@@ -2270,7 +2270,7 @@ nv50_display_init(struct drm_device *dev)
return 0; return 0;
} }
void static void
nv50_display_destroy(struct drm_device *dev) nv50_display_destroy(struct drm_device *dev)
{ {
struct nv50_disp *disp = nv50_disp(dev); struct nv50_disp *disp = nv50_disp(dev);
......
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