Skip to content
Snippets Groups Projects
Commit cf336014 authored by Ben Skeggs's avatar Ben Skeggs
Browse files

drm/nouveau/devinit: tidy up the subdev class definition

parent 52225551
No related branches found
No related tags found
No related merge requests found
...@@ -22,12 +22,12 @@ ...@@ -22,12 +22,12 @@
* Authors: Ben Skeggs * Authors: Ben Skeggs
*/ */
#include "priv.h" #include "nv50.h"
static int static int
nvc0_devinit_pll_set(struct nouveau_devinit *devinit, u32 type, u32 freq) nvc0_devinit_pll_set(struct nouveau_devinit *devinit, u32 type, u32 freq)
{ {
struct nvc0_devinit_priv *priv = (void *)devinit; struct nv50_devinit_priv *priv = (void *)devinit;
struct nouveau_bios *bios = nouveau_bios(priv); struct nouveau_bios *bios = nouveau_bios(priv);
struct nvbios_pll info; struct nvbios_pll info;
int N, fN, M, P; int N, fN, M, P;
...@@ -72,19 +72,19 @@ nvc0_devinit_ctor(struct nouveau_object *parent, struct nouveau_object *engine, ...@@ -72,19 +72,19 @@ nvc0_devinit_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
if (ret) if (ret)
return ret; return ret;
priv->base.pll_set = nvc0_devinit_pll_set;
if (nv_rd32(priv, 0x022500) & 0x00000001) if (nv_rd32(priv, 0x022500) & 0x00000001)
priv->base.post = true; priv->base.post = true;
return 0; return 0;
} }
struct nouveau_oclass struct nouveau_oclass *
nvc0_devinit_oclass = { nvc0_devinit_oclass = &(struct nouveau_devinit_impl) {
.handle = NV_SUBDEV(DEVINIT, 0xc0), .base.handle = NV_SUBDEV(DEVINIT, 0xc0),
.ofuncs = &(struct nouveau_ofuncs) { .base.ofuncs = &(struct nouveau_ofuncs) {
.ctor = nvc0_devinit_ctor, .ctor = nvc0_devinit_ctor,
.dtor = _nouveau_devinit_dtor, .dtor = _nouveau_devinit_dtor,
.init = nv50_devinit_init, .init = nv50_devinit_init,
.fini = _nouveau_devinit_fini, .fini = _nouveau_devinit_fini,
}, },
}; .pll_set = nvc0_devinit_pll_set,
}.base;
...@@ -6,20 +6,29 @@ ...@@ -6,20 +6,29 @@
#include <subdev/clock/pll.h> #include <subdev/clock/pll.h>
#include <subdev/devinit.h> #include <subdev/devinit.h>
void nv04_devinit_dtor(struct nouveau_object *); struct nouveau_devinit_impl {
int nv04_devinit_init(struct nouveau_object *); struct nouveau_oclass base;
int nv04_devinit_fini(struct nouveau_object *, bool); void (*meminit)(struct nouveau_devinit *);
int nv04_devinit_pll_set(struct nouveau_devinit *, u32, u32); int (*pll_set)(struct nouveau_devinit *, u32 type, u32 freq);
void setPLL_single(struct nouveau_devinit *, u32, struct nouveau_pll_vals *);
void setPLL_double_highregs(struct nouveau_devinit *, u32, struct nouveau_pll_vals *);
void setPLL_double_lowregs(struct nouveau_devinit *, u32, struct nouveau_pll_vals *);
struct nv50_devinit_priv {
struct nouveau_devinit base;
}; };
int nv50_devinit_init(struct nouveau_object *); #define nouveau_devinit_create(p,e,o,d) \
nouveau_devinit_create_((p), (e), (o), sizeof(**d), (void **)d)
#define nouveau_devinit_destroy(p) \
nouveau_subdev_destroy(&(p)->base)
#define nouveau_devinit_init(p) ({ \
struct nouveau_devinit *d = (p); \
_nouveau_devinit_init(nv_object(d)); \
})
#define nouveau_devinit_fini(p,s) ({ \
struct nouveau_devinit *d = (p); \
_nouveau_devinit_fini(nv_object(d), (s)); \
})
int nouveau_devinit_create_(struct nouveau_object *, struct nouveau_object *,
struct nouveau_oclass *, int, void **);
#define _nouveau_devinit_dtor _nouveau_subdev_dtor
int _nouveau_devinit_init(struct nouveau_object *);
int _nouveau_devinit_fini(struct nouveau_object *, bool suspend);
#endif #endif
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment