Commit b240b212 authored by Ben Skeggs's avatar Ben Skeggs

drm/nouveau/gsp: switch to instanced constructor

Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
Reviewed-by: default avatarLyude Paul <lyude@redhat.com>
parent 01055c01
...@@ -60,7 +60,6 @@ struct nvkm_device { ...@@ -60,7 +60,6 @@ struct nvkm_device {
struct notifier_block nb; struct notifier_block nb;
} acpi; } acpi;
struct nvkm_gsp *gsp;
struct nvkm_i2c *i2c; struct nvkm_i2c *i2c;
struct nvkm_subdev *ibus; struct nvkm_subdev *ibus;
struct nvkm_iccsense *iccsense; struct nvkm_iccsense *iccsense;
...@@ -138,7 +137,6 @@ struct nvkm_device_chip { ...@@ -138,7 +137,6 @@ struct nvkm_device_chip {
#include <core/layout.h> #include <core/layout.h>
#undef NVKM_LAYOUT_INST #undef NVKM_LAYOUT_INST
#undef NVKM_LAYOUT_ONCE #undef NVKM_LAYOUT_ONCE
int (*gsp )(struct nvkm_device *, int idx, struct nvkm_gsp **);
int (*i2c )(struct nvkm_device *, int idx, struct nvkm_i2c **); int (*i2c )(struct nvkm_device *, int idx, struct nvkm_i2c **);
int (*ibus )(struct nvkm_device *, int idx, struct nvkm_subdev **); int (*ibus )(struct nvkm_device *, int idx, struct nvkm_subdev **);
int (*iccsense)(struct nvkm_device *, int idx, struct nvkm_iccsense **); int (*iccsense)(struct nvkm_device *, int idx, struct nvkm_iccsense **);
......
...@@ -9,3 +9,4 @@ NVKM_LAYOUT_ONCE(NVKM_SUBDEV_BAR , struct nvkm_bar , bar) ...@@ -9,3 +9,4 @@ NVKM_LAYOUT_ONCE(NVKM_SUBDEV_BAR , struct nvkm_bar , bar)
NVKM_LAYOUT_ONCE(NVKM_SUBDEV_FAULT , struct nvkm_fault , fault) NVKM_LAYOUT_ONCE(NVKM_SUBDEV_FAULT , struct nvkm_fault , fault)
NVKM_LAYOUT_ONCE(NVKM_SUBDEV_ACR , struct nvkm_acr , acr) NVKM_LAYOUT_ONCE(NVKM_SUBDEV_ACR , struct nvkm_acr , acr)
NVKM_LAYOUT_ONCE(NVKM_SUBDEV_CLK , struct nvkm_clk , clk) NVKM_LAYOUT_ONCE(NVKM_SUBDEV_CLK , struct nvkm_clk , clk)
NVKM_LAYOUT_ONCE(NVKM_SUBDEV_GSP , struct nvkm_gsp , gsp)
...@@ -9,5 +9,5 @@ struct nvkm_gsp { ...@@ -9,5 +9,5 @@ struct nvkm_gsp {
struct nvkm_falcon falcon; struct nvkm_falcon falcon;
}; };
int gv100_gsp_new(struct nvkm_device *, int, struct nvkm_gsp **); int gv100_gsp_new(struct nvkm_device *, enum nvkm_subdev_type, int, struct nvkm_gsp **);
#endif #endif
...@@ -33,7 +33,6 @@ nvkm_subdev_type[NVKM_SUBDEV_NR] = { ...@@ -33,7 +33,6 @@ nvkm_subdev_type[NVKM_SUBDEV_NR] = {
#include <core/layout.h> #include <core/layout.h>
#undef NVKM_LAYOUT_ONCE #undef NVKM_LAYOUT_ONCE
#undef NVKM_LAYOUT_INST #undef NVKM_LAYOUT_INST
[NVKM_SUBDEV_GSP ] = "gsp",
[NVKM_SUBDEV_I2C ] = "i2c", [NVKM_SUBDEV_I2C ] = "i2c",
[NVKM_SUBDEV_IBUS ] = "priv", [NVKM_SUBDEV_IBUS ] = "priv",
[NVKM_SUBDEV_ICCSENSE] = "iccsense", [NVKM_SUBDEV_ICCSENSE] = "iccsense",
......
...@@ -2427,7 +2427,7 @@ nv140_chipset = { ...@@ -2427,7 +2427,7 @@ nv140_chipset = {
.fb = { 0x00000001, gv100_fb_new }, .fb = { 0x00000001, gv100_fb_new },
.fuse = { 0x00000001, gm107_fuse_new }, .fuse = { 0x00000001, gm107_fuse_new },
.gpio = { 0x00000001, gk104_gpio_new }, .gpio = { 0x00000001, gk104_gpio_new },
.gsp = gv100_gsp_new, .gsp = { 0x00000001, gv100_gsp_new },
.i2c = gm200_i2c_new, .i2c = gm200_i2c_new,
.ibus = gm200_ibus_new, .ibus = gm200_ibus_new,
.imem = nv50_instmem_new, .imem = nv50_instmem_new,
...@@ -2471,7 +2471,7 @@ nv162_chipset = { ...@@ -2471,7 +2471,7 @@ nv162_chipset = {
.fb = { 0x00000001, gv100_fb_new }, .fb = { 0x00000001, gv100_fb_new },
.fuse = { 0x00000001, gm107_fuse_new }, .fuse = { 0x00000001, gm107_fuse_new },
.gpio = { 0x00000001, gk104_gpio_new }, .gpio = { 0x00000001, gk104_gpio_new },
.gsp = gv100_gsp_new, .gsp = { 0x00000001, gv100_gsp_new },
.i2c = gm200_i2c_new, .i2c = gm200_i2c_new,
.ibus = gm200_ibus_new, .ibus = gm200_ibus_new,
.imem = nv50_instmem_new, .imem = nv50_instmem_new,
...@@ -2509,7 +2509,7 @@ nv164_chipset = { ...@@ -2509,7 +2509,7 @@ nv164_chipset = {
.fb = { 0x00000001, gv100_fb_new }, .fb = { 0x00000001, gv100_fb_new },
.fuse = { 0x00000001, gm107_fuse_new }, .fuse = { 0x00000001, gm107_fuse_new },
.gpio = { 0x00000001, gk104_gpio_new }, .gpio = { 0x00000001, gk104_gpio_new },
.gsp = gv100_gsp_new, .gsp = { 0x00000001, gv100_gsp_new },
.i2c = gm200_i2c_new, .i2c = gm200_i2c_new,
.ibus = gm200_ibus_new, .ibus = gm200_ibus_new,
.imem = nv50_instmem_new, .imem = nv50_instmem_new,
...@@ -2548,7 +2548,7 @@ nv166_chipset = { ...@@ -2548,7 +2548,7 @@ nv166_chipset = {
.fb = { 0x00000001, gv100_fb_new }, .fb = { 0x00000001, gv100_fb_new },
.fuse = { 0x00000001, gm107_fuse_new }, .fuse = { 0x00000001, gm107_fuse_new },
.gpio = { 0x00000001, gk104_gpio_new }, .gpio = { 0x00000001, gk104_gpio_new },
.gsp = gv100_gsp_new, .gsp = { 0x00000001, gv100_gsp_new },
.i2c = gm200_i2c_new, .i2c = gm200_i2c_new,
.ibus = gm200_ibus_new, .ibus = gm200_ibus_new,
.imem = nv50_instmem_new, .imem = nv50_instmem_new,
...@@ -2588,7 +2588,7 @@ nv167_chipset = { ...@@ -2588,7 +2588,7 @@ nv167_chipset = {
.fb = { 0x00000001, gv100_fb_new }, .fb = { 0x00000001, gv100_fb_new },
.fuse = { 0x00000001, gm107_fuse_new }, .fuse = { 0x00000001, gm107_fuse_new },
.gpio = { 0x00000001, gk104_gpio_new }, .gpio = { 0x00000001, gk104_gpio_new },
.gsp = gv100_gsp_new, .gsp = { 0x00000001, gv100_gsp_new },
.i2c = gm200_i2c_new, .i2c = gm200_i2c_new,
.ibus = gm200_ibus_new, .ibus = gm200_ibus_new,
.imem = nv50_instmem_new, .imem = nv50_instmem_new,
...@@ -2626,7 +2626,7 @@ nv168_chipset = { ...@@ -2626,7 +2626,7 @@ nv168_chipset = {
.fb = { 0x00000001, gv100_fb_new }, .fb = { 0x00000001, gv100_fb_new },
.fuse = { 0x00000001, gm107_fuse_new }, .fuse = { 0x00000001, gm107_fuse_new },
.gpio = { 0x00000001, gk104_gpio_new }, .gpio = { 0x00000001, gk104_gpio_new },
.gsp = gv100_gsp_new, .gsp = { 0x00000001, gv100_gsp_new },
.i2c = gm200_i2c_new, .i2c = gm200_i2c_new,
.ibus = gm200_ibus_new, .ibus = gm200_ibus_new,
.imem = nv50_instmem_new, .imem = nv50_instmem_new,
...@@ -3248,7 +3248,6 @@ nvkm_device_ctor(const struct nvkm_device_func *func, ...@@ -3248,7 +3248,6 @@ nvkm_device_ctor(const struct nvkm_device_func *func,
#include <core/layout.h> #include <core/layout.h>
#undef NVKM_LAYOUT_INST #undef NVKM_LAYOUT_INST
#undef NVKM_LAYOUT_ONCE #undef NVKM_LAYOUT_ONCE
_(NVKM_SUBDEV_GSP , gsp);
_(NVKM_SUBDEV_I2C , i2c); _(NVKM_SUBDEV_I2C , i2c);
_(NVKM_SUBDEV_IBUS , ibus); _(NVKM_SUBDEV_IBUS , ibus);
_(NVKM_SUBDEV_ICCSENSE, iccsense); _(NVKM_SUBDEV_ICCSENSE, iccsense);
......
...@@ -40,14 +40,14 @@ nvkm_gsp = { ...@@ -40,14 +40,14 @@ nvkm_gsp = {
int int
nvkm_gsp_new_(const struct nvkm_gsp_fwif *fwif, struct nvkm_device *device, nvkm_gsp_new_(const struct nvkm_gsp_fwif *fwif, struct nvkm_device *device,
int index, struct nvkm_gsp **pgsp) enum nvkm_subdev_type type, int inst, struct nvkm_gsp **pgsp)
{ {
struct nvkm_gsp *gsp; struct nvkm_gsp *gsp;
if (!(gsp = *pgsp = kzalloc(sizeof(*gsp), GFP_KERNEL))) if (!(gsp = *pgsp = kzalloc(sizeof(*gsp), GFP_KERNEL)))
return -ENOMEM; return -ENOMEM;
nvkm_subdev_ctor(&nvkm_gsp, device, index, &gsp->subdev); nvkm_subdev_ctor(&nvkm_gsp, device, type, inst, &gsp->subdev);
fwif = nvkm_firmware_load(&gsp->subdev, fwif, "Gsp", gsp); fwif = nvkm_firmware_load(&gsp->subdev, fwif, "Gsp", gsp);
if (IS_ERR(fwif)) if (IS_ERR(fwif))
......
...@@ -49,7 +49,8 @@ gv100_gsp[] = { ...@@ -49,7 +49,8 @@ gv100_gsp[] = {
}; };
int int
gv100_gsp_new(struct nvkm_device *device, int index, struct nvkm_gsp **pgsp) gv100_gsp_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
struct nvkm_gsp **pgsp)
{ {
return nvkm_gsp_new_(gv100_gsp, device, index, pgsp); return nvkm_gsp_new_(gv100_gsp, device, type, inst, pgsp);
} }
...@@ -10,6 +10,6 @@ struct nvkm_gsp_fwif { ...@@ -10,6 +10,6 @@ struct nvkm_gsp_fwif {
const struct nvkm_falcon_func *flcn; const struct nvkm_falcon_func *flcn;
}; };
int nvkm_gsp_new_(const struct nvkm_gsp_fwif *, struct nvkm_device *, int, int nvkm_gsp_new_(const struct nvkm_gsp_fwif *, struct nvkm_device *, enum nvkm_subdev_type, int,
struct nvkm_gsp **); struct nvkm_gsp **);
#endif #endif
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