drm/nouveau/iccsense: switch to instanced constructor
Signed-off-by: Ben Skeggs <bskeggs@redhat.com> Reviewed-by: Lyude Paul <lyude@redhat.com>
This commit is contained in:
parent
c5f38d67f9
commit
4dea1a9609
|
@ -60,7 +60,6 @@ struct nvkm_device {
|
|||
struct notifier_block nb;
|
||||
} acpi;
|
||||
|
||||
struct nvkm_iccsense *iccsense;
|
||||
struct nvkm_instmem *imem;
|
||||
struct nvkm_ltc *ltc;
|
||||
struct nvkm_mc *mc;
|
||||
|
@ -135,7 +134,6 @@ struct nvkm_device_chip {
|
|||
#include <core/layout.h>
|
||||
#undef NVKM_LAYOUT_INST
|
||||
#undef NVKM_LAYOUT_ONCE
|
||||
int (*iccsense)(struct nvkm_device *, int idx, struct nvkm_iccsense **);
|
||||
int (*imem )(struct nvkm_device *, int idx, struct nvkm_instmem **);
|
||||
int (*ltc )(struct nvkm_device *, int idx, struct nvkm_ltc **);
|
||||
int (*mc )(struct nvkm_device *, int idx, struct nvkm_mc **);
|
||||
|
|
|
@ -10,5 +10,6 @@ NVKM_LAYOUT_ONCE(NVKM_SUBDEV_FB , struct nvkm_fb , fb)
|
|||
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_ACR , struct nvkm_acr , acr)
|
||||
NVKM_LAYOUT_ONCE(NVKM_SUBDEV_ICCSENSE, struct nvkm_iccsense, iccsense)
|
||||
NVKM_LAYOUT_ONCE(NVKM_SUBDEV_CLK , struct nvkm_clk , clk)
|
||||
NVKM_LAYOUT_ONCE(NVKM_SUBDEV_GSP , struct nvkm_gsp , gsp)
|
||||
|
|
|
@ -14,6 +14,6 @@ struct nvkm_iccsense {
|
|||
u32 power_w_crit;
|
||||
};
|
||||
|
||||
int gf100_iccsense_new(struct nvkm_device *, int index, struct nvkm_iccsense **);
|
||||
int gf100_iccsense_new(struct nvkm_device *, enum nvkm_subdev_type, int, struct nvkm_iccsense **);
|
||||
int nvkm_iccsense_read_all(struct nvkm_iccsense *iccsense);
|
||||
#endif
|
||||
|
|
|
@ -33,7 +33,6 @@ nvkm_subdev_type[NVKM_SUBDEV_NR] = {
|
|||
#include <core/layout.h>
|
||||
#undef NVKM_LAYOUT_ONCE
|
||||
#undef NVKM_LAYOUT_INST
|
||||
[NVKM_SUBDEV_ICCSENSE] = "iccsense",
|
||||
[NVKM_SUBDEV_INSTMEM ] = "imem",
|
||||
[NVKM_SUBDEV_LTC ] = "ltc",
|
||||
[NVKM_SUBDEV_MC ] = "mc",
|
||||
|
|
|
@ -1348,7 +1348,7 @@ nvc0_chipset = {
|
|||
.gpio = { 0x00000001, g94_gpio_new },
|
||||
.i2c = { 0x00000001, g94_i2c_new },
|
||||
.ibus = { 0x00000001, gf100_ibus_new },
|
||||
.iccsense = gf100_iccsense_new,
|
||||
.iccsense = { 0x00000001, gf100_iccsense_new },
|
||||
.imem = nv50_instmem_new,
|
||||
.ltc = gf100_ltc_new,
|
||||
.mc = gf100_mc_new,
|
||||
|
@ -1385,7 +1385,7 @@ nvc1_chipset = {
|
|||
.gpio = { 0x00000001, g94_gpio_new },
|
||||
.i2c = { 0x00000001, g94_i2c_new },
|
||||
.ibus = { 0x00000001, gf100_ibus_new },
|
||||
.iccsense = gf100_iccsense_new,
|
||||
.iccsense = { 0x00000001, gf100_iccsense_new },
|
||||
.imem = nv50_instmem_new,
|
||||
.ltc = gf100_ltc_new,
|
||||
.mc = gf100_mc_new,
|
||||
|
@ -1421,7 +1421,7 @@ nvc3_chipset = {
|
|||
.gpio = { 0x00000001, g94_gpio_new },
|
||||
.i2c = { 0x00000001, g94_i2c_new },
|
||||
.ibus = { 0x00000001, gf100_ibus_new },
|
||||
.iccsense = gf100_iccsense_new,
|
||||
.iccsense = { 0x00000001, gf100_iccsense_new },
|
||||
.imem = nv50_instmem_new,
|
||||
.ltc = gf100_ltc_new,
|
||||
.mc = gf100_mc_new,
|
||||
|
@ -1457,7 +1457,7 @@ nvc4_chipset = {
|
|||
.gpio = { 0x00000001, g94_gpio_new },
|
||||
.i2c = { 0x00000001, g94_i2c_new },
|
||||
.ibus = { 0x00000001, gf100_ibus_new },
|
||||
.iccsense = gf100_iccsense_new,
|
||||
.iccsense = { 0x00000001, gf100_iccsense_new },
|
||||
.imem = nv50_instmem_new,
|
||||
.ltc = gf100_ltc_new,
|
||||
.mc = gf100_mc_new,
|
||||
|
@ -1494,7 +1494,7 @@ nvc8_chipset = {
|
|||
.gpio = { 0x00000001, g94_gpio_new },
|
||||
.i2c = { 0x00000001, g94_i2c_new },
|
||||
.ibus = { 0x00000001, gf100_ibus_new },
|
||||
.iccsense = gf100_iccsense_new,
|
||||
.iccsense = { 0x00000001, gf100_iccsense_new },
|
||||
.imem = nv50_instmem_new,
|
||||
.ltc = gf100_ltc_new,
|
||||
.mc = gf100_mc_new,
|
||||
|
@ -1531,7 +1531,7 @@ nvce_chipset = {
|
|||
.gpio = { 0x00000001, g94_gpio_new },
|
||||
.i2c = { 0x00000001, g94_i2c_new },
|
||||
.ibus = { 0x00000001, gf100_ibus_new },
|
||||
.iccsense = gf100_iccsense_new,
|
||||
.iccsense = { 0x00000001, gf100_iccsense_new },
|
||||
.imem = nv50_instmem_new,
|
||||
.ltc = gf100_ltc_new,
|
||||
.mc = gf100_mc_new,
|
||||
|
@ -1568,7 +1568,7 @@ nvcf_chipset = {
|
|||
.gpio = { 0x00000001, g94_gpio_new },
|
||||
.i2c = { 0x00000001, g94_i2c_new },
|
||||
.ibus = { 0x00000001, gf100_ibus_new },
|
||||
.iccsense = gf100_iccsense_new,
|
||||
.iccsense = { 0x00000001, gf100_iccsense_new },
|
||||
.imem = nv50_instmem_new,
|
||||
.ltc = gf100_ltc_new,
|
||||
.mc = gf100_mc_new,
|
||||
|
@ -1604,7 +1604,7 @@ nvd7_chipset = {
|
|||
.gpio = { 0x00000001, gf119_gpio_new },
|
||||
.i2c = { 0x00000001, gf117_i2c_new },
|
||||
.ibus = { 0x00000001, gf117_ibus_new },
|
||||
.iccsense = gf100_iccsense_new,
|
||||
.iccsense = { 0x00000001, gf100_iccsense_new },
|
||||
.imem = nv50_instmem_new,
|
||||
.ltc = gf100_ltc_new,
|
||||
.mc = gf100_mc_new,
|
||||
|
@ -1639,7 +1639,7 @@ nvd9_chipset = {
|
|||
.gpio = { 0x00000001, gf119_gpio_new },
|
||||
.i2c = { 0x00000001, gf119_i2c_new },
|
||||
.ibus = { 0x00000001, gf117_ibus_new },
|
||||
.iccsense = gf100_iccsense_new,
|
||||
.iccsense = { 0x00000001, gf100_iccsense_new },
|
||||
.imem = nv50_instmem_new,
|
||||
.ltc = gf100_ltc_new,
|
||||
.mc = gf100_mc_new,
|
||||
|
@ -1675,7 +1675,7 @@ nve4_chipset = {
|
|||
.gpio = { 0x00000001, gk104_gpio_new },
|
||||
.i2c = { 0x00000001, gk104_i2c_new },
|
||||
.ibus = { 0x00000001, gk104_ibus_new },
|
||||
.iccsense = gf100_iccsense_new,
|
||||
.iccsense = { 0x00000001, gf100_iccsense_new },
|
||||
.imem = nv50_instmem_new,
|
||||
.ltc = gk104_ltc_new,
|
||||
.mc = gk104_mc_new,
|
||||
|
@ -1714,7 +1714,7 @@ nve6_chipset = {
|
|||
.gpio = { 0x00000001, gk104_gpio_new },
|
||||
.i2c = { 0x00000001, gk104_i2c_new },
|
||||
.ibus = { 0x00000001, gk104_ibus_new },
|
||||
.iccsense = gf100_iccsense_new,
|
||||
.iccsense = { 0x00000001, gf100_iccsense_new },
|
||||
.imem = nv50_instmem_new,
|
||||
.ltc = gk104_ltc_new,
|
||||
.mc = gk104_mc_new,
|
||||
|
@ -1753,7 +1753,7 @@ nve7_chipset = {
|
|||
.gpio = { 0x00000001, gk104_gpio_new },
|
||||
.i2c = { 0x00000001, gk104_i2c_new },
|
||||
.ibus = { 0x00000001, gk104_ibus_new },
|
||||
.iccsense = gf100_iccsense_new,
|
||||
.iccsense = { 0x00000001, gf100_iccsense_new },
|
||||
.imem = nv50_instmem_new,
|
||||
.ltc = gk104_ltc_new,
|
||||
.mc = gk104_mc_new,
|
||||
|
@ -1817,7 +1817,7 @@ nvf0_chipset = {
|
|||
.gpio = { 0x00000001, gk104_gpio_new },
|
||||
.i2c = { 0x00000001, gk110_i2c_new },
|
||||
.ibus = { 0x00000001, gk104_ibus_new },
|
||||
.iccsense = gf100_iccsense_new,
|
||||
.iccsense = { 0x00000001, gf100_iccsense_new },
|
||||
.imem = nv50_instmem_new,
|
||||
.ltc = gk104_ltc_new,
|
||||
.mc = gk104_mc_new,
|
||||
|
@ -1855,7 +1855,7 @@ nvf1_chipset = {
|
|||
.gpio = { 0x00000001, gk104_gpio_new },
|
||||
.i2c = { 0x00000001, gk110_i2c_new },
|
||||
.ibus = { 0x00000001, gk104_ibus_new },
|
||||
.iccsense = gf100_iccsense_new,
|
||||
.iccsense = { 0x00000001, gf100_iccsense_new },
|
||||
.imem = nv50_instmem_new,
|
||||
.ltc = gk104_ltc_new,
|
||||
.mc = gk104_mc_new,
|
||||
|
@ -1893,7 +1893,7 @@ nv106_chipset = {
|
|||
.gpio = { 0x00000001, gk104_gpio_new },
|
||||
.i2c = { 0x00000001, gk110_i2c_new },
|
||||
.ibus = { 0x00000001, gk104_ibus_new },
|
||||
.iccsense = gf100_iccsense_new,
|
||||
.iccsense = { 0x00000001, gf100_iccsense_new },
|
||||
.imem = nv50_instmem_new,
|
||||
.ltc = gk104_ltc_new,
|
||||
.mc = gk20a_mc_new,
|
||||
|
@ -1931,7 +1931,7 @@ nv108_chipset = {
|
|||
.gpio = { 0x00000001, gk104_gpio_new },
|
||||
.i2c = { 0x00000001, gk110_i2c_new },
|
||||
.ibus = { 0x00000001, gk104_ibus_new },
|
||||
.iccsense = gf100_iccsense_new,
|
||||
.iccsense = { 0x00000001, gf100_iccsense_new },
|
||||
.imem = nv50_instmem_new,
|
||||
.ltc = gk104_ltc_new,
|
||||
.mc = gk20a_mc_new,
|
||||
|
@ -1969,7 +1969,7 @@ nv117_chipset = {
|
|||
.gpio = { 0x00000001, gk104_gpio_new },
|
||||
.i2c = { 0x00000001, gk110_i2c_new },
|
||||
.ibus = { 0x00000001, gk104_ibus_new },
|
||||
.iccsense = gf100_iccsense_new,
|
||||
.iccsense = { 0x00000001, gf100_iccsense_new },
|
||||
.imem = nv50_instmem_new,
|
||||
.ltc = gm107_ltc_new,
|
||||
.mc = gk20a_mc_new,
|
||||
|
@ -2005,7 +2005,7 @@ nv118_chipset = {
|
|||
.gpio = { 0x00000001, gk104_gpio_new },
|
||||
.i2c = { 0x00000001, gk110_i2c_new },
|
||||
.ibus = { 0x00000001, gk104_ibus_new },
|
||||
.iccsense = gf100_iccsense_new,
|
||||
.iccsense = { 0x00000001, gf100_iccsense_new },
|
||||
.imem = nv50_instmem_new,
|
||||
.ltc = gm107_ltc_new,
|
||||
.mc = gk20a_mc_new,
|
||||
|
@ -2039,7 +2039,7 @@ nv120_chipset = {
|
|||
.gpio = { 0x00000001, gk104_gpio_new },
|
||||
.i2c = { 0x00000001, gm200_i2c_new },
|
||||
.ibus = { 0x00000001, gm200_ibus_new },
|
||||
.iccsense = gf100_iccsense_new,
|
||||
.iccsense = { 0x00000001, gf100_iccsense_new },
|
||||
.imem = nv50_instmem_new,
|
||||
.ltc = gm200_ltc_new,
|
||||
.mc = gk20a_mc_new,
|
||||
|
@ -2077,7 +2077,7 @@ nv124_chipset = {
|
|||
.gpio = { 0x00000001, gk104_gpio_new },
|
||||
.i2c = { 0x00000001, gm200_i2c_new },
|
||||
.ibus = { 0x00000001, gm200_ibus_new },
|
||||
.iccsense = gf100_iccsense_new,
|
||||
.iccsense = { 0x00000001, gf100_iccsense_new },
|
||||
.imem = nv50_instmem_new,
|
||||
.ltc = gm200_ltc_new,
|
||||
.mc = gk20a_mc_new,
|
||||
|
@ -2115,7 +2115,7 @@ nv126_chipset = {
|
|||
.gpio = { 0x00000001, gk104_gpio_new },
|
||||
.i2c = { 0x00000001, gm200_i2c_new },
|
||||
.ibus = { 0x00000001, gm200_ibus_new },
|
||||
.iccsense = gf100_iccsense_new,
|
||||
.iccsense = { 0x00000001, gf100_iccsense_new },
|
||||
.imem = nv50_instmem_new,
|
||||
.ltc = gm200_ltc_new,
|
||||
.mc = gk20a_mc_new,
|
||||
|
@ -3248,7 +3248,6 @@ nvkm_device_ctor(const struct nvkm_device_func *func,
|
|||
#include <core/layout.h>
|
||||
#undef NVKM_LAYOUT_INST
|
||||
#undef NVKM_LAYOUT_ONCE
|
||||
_(NVKM_SUBDEV_ICCSENSE, iccsense);
|
||||
_(NVKM_SUBDEV_INSTMEM , imem);
|
||||
_(NVKM_SUBDEV_LTC , ltc);
|
||||
_(NVKM_SUBDEV_MC , mc);
|
||||
|
|
|
@ -312,20 +312,20 @@ iccsense_func = {
|
|||
};
|
||||
|
||||
void
|
||||
nvkm_iccsense_ctor(struct nvkm_device *device, int index,
|
||||
nvkm_iccsense_ctor(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
|
||||
struct nvkm_iccsense *iccsense)
|
||||
{
|
||||
nvkm_subdev_ctor(&iccsense_func, device, index, &iccsense->subdev);
|
||||
nvkm_subdev_ctor(&iccsense_func, device, type, inst, &iccsense->subdev);
|
||||
}
|
||||
|
||||
int
|
||||
nvkm_iccsense_new_(struct nvkm_device *device, int index,
|
||||
nvkm_iccsense_new_(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
|
||||
struct nvkm_iccsense **iccsense)
|
||||
{
|
||||
if (!(*iccsense = kzalloc(sizeof(**iccsense), GFP_KERNEL)))
|
||||
return -ENOMEM;
|
||||
INIT_LIST_HEAD(&(*iccsense)->sensors);
|
||||
INIT_LIST_HEAD(&(*iccsense)->rails);
|
||||
nvkm_iccsense_ctor(device, index, *iccsense);
|
||||
nvkm_iccsense_ctor(device, type, inst, *iccsense);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -24,8 +24,8 @@
|
|||
#include "priv.h"
|
||||
|
||||
int
|
||||
gf100_iccsense_new(struct nvkm_device *device, int index,
|
||||
gf100_iccsense_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
|
||||
struct nvkm_iccsense **piccsense)
|
||||
{
|
||||
return nvkm_iccsense_new_(device, index, piccsense);
|
||||
return nvkm_iccsense_new_(device, type, inst, piccsense);
|
||||
}
|
||||
|
|
|
@ -22,6 +22,6 @@ struct nvkm_iccsense_rail {
|
|||
u8 mohm;
|
||||
};
|
||||
|
||||
void nvkm_iccsense_ctor(struct nvkm_device *, int, struct nvkm_iccsense *);
|
||||
int nvkm_iccsense_new_(struct nvkm_device *, int, struct nvkm_iccsense **);
|
||||
void nvkm_iccsense_ctor(struct nvkm_device *, enum nvkm_subdev_type, int, struct nvkm_iccsense *);
|
||||
int nvkm_iccsense_new_(struct nvkm_device *, enum nvkm_subdev_type, int, struct nvkm_iccsense **);
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue