Commit 01055c01 authored by Ben Skeggs's avatar Ben Skeggs

drm/nouveau/gpio: switch to instanced constructor

Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
Reviewed-by: default avatarLyude Paul <lyude@redhat.com>
parent 8d056d99
...@@ -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_gpio *gpio;
struct nvkm_gsp *gsp; struct nvkm_gsp *gsp;
struct nvkm_i2c *i2c; struct nvkm_i2c *i2c;
struct nvkm_subdev *ibus; struct nvkm_subdev *ibus;
...@@ -139,7 +138,6 @@ struct nvkm_device_chip { ...@@ -139,7 +138,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 (*gpio )(struct nvkm_device *, int idx, struct nvkm_gpio **);
int (*gsp )(struct nvkm_device *, int idx, struct nvkm_gsp **); 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 **);
......
/* SPDX-License-Identifier: MIT */ /* SPDX-License-Identifier: MIT */
NVKM_LAYOUT_ONCE(NVKM_SUBDEV_VBIOS , struct nvkm_bios , bios) NVKM_LAYOUT_ONCE(NVKM_SUBDEV_VBIOS , struct nvkm_bios , bios)
NVKM_LAYOUT_ONCE(NVKM_SUBDEV_DEVINIT , struct nvkm_devinit , devinit) NVKM_LAYOUT_ONCE(NVKM_SUBDEV_DEVINIT , struct nvkm_devinit , devinit)
NVKM_LAYOUT_ONCE(NVKM_SUBDEV_GPIO , struct nvkm_gpio , gpio)
NVKM_LAYOUT_ONCE(NVKM_SUBDEV_FUSE , struct nvkm_fuse , fuse) NVKM_LAYOUT_ONCE(NVKM_SUBDEV_FUSE , struct nvkm_fuse , fuse)
NVKM_LAYOUT_ONCE(NVKM_SUBDEV_BUS , struct nvkm_bus , bus) NVKM_LAYOUT_ONCE(NVKM_SUBDEV_BUS , struct nvkm_bus , bus)
NVKM_LAYOUT_ONCE(NVKM_SUBDEV_FB , struct nvkm_fb , fb) NVKM_LAYOUT_ONCE(NVKM_SUBDEV_FB , struct nvkm_fb , fb)
......
...@@ -32,10 +32,10 @@ int nvkm_gpio_find(struct nvkm_gpio *, int idx, u8 tag, u8 line, ...@@ -32,10 +32,10 @@ int nvkm_gpio_find(struct nvkm_gpio *, int idx, u8 tag, u8 line,
int nvkm_gpio_set(struct nvkm_gpio *, int idx, u8 tag, u8 line, int state); int nvkm_gpio_set(struct nvkm_gpio *, int idx, u8 tag, u8 line, int state);
int nvkm_gpio_get(struct nvkm_gpio *, int idx, u8 tag, u8 line); int nvkm_gpio_get(struct nvkm_gpio *, int idx, u8 tag, u8 line);
int nv10_gpio_new(struct nvkm_device *, int, struct nvkm_gpio **); int nv10_gpio_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_gpio **);
int nv50_gpio_new(struct nvkm_device *, int, struct nvkm_gpio **); int nv50_gpio_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_gpio **);
int g94_gpio_new(struct nvkm_device *, int, struct nvkm_gpio **); int g94_gpio_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_gpio **);
int gf119_gpio_new(struct nvkm_device *, int, struct nvkm_gpio **); int gf119_gpio_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_gpio **);
int gk104_gpio_new(struct nvkm_device *, int, struct nvkm_gpio **); int gk104_gpio_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_gpio **);
int ga102_gpio_new(struct nvkm_device *, int, struct nvkm_gpio **); int ga102_gpio_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_gpio **);
#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_GPIO ] = "gpio",
[NVKM_SUBDEV_GSP ] = "gsp", [NVKM_SUBDEV_GSP ] = "gsp",
[NVKM_SUBDEV_I2C ] = "i2c", [NVKM_SUBDEV_I2C ] = "i2c",
[NVKM_SUBDEV_IBUS ] = "priv", [NVKM_SUBDEV_IBUS ] = "priv",
......
...@@ -241,14 +241,14 @@ nvkm_gpio = { ...@@ -241,14 +241,14 @@ nvkm_gpio = {
int int
nvkm_gpio_new_(const struct nvkm_gpio_func *func, struct nvkm_device *device, nvkm_gpio_new_(const struct nvkm_gpio_func *func, struct nvkm_device *device,
int index, struct nvkm_gpio **pgpio) enum nvkm_subdev_type type, int inst, struct nvkm_gpio **pgpio)
{ {
struct nvkm_gpio *gpio; struct nvkm_gpio *gpio;
if (!(gpio = *pgpio = kzalloc(sizeof(*gpio), GFP_KERNEL))) if (!(gpio = *pgpio = kzalloc(sizeof(*gpio), GFP_KERNEL)))
return -ENOMEM; return -ENOMEM;
nvkm_subdev_ctor(&nvkm_gpio, device, index, &gpio->subdev); nvkm_subdev_ctor(&nvkm_gpio, device, type, inst, &gpio->subdev);
gpio->func = func; gpio->func = func;
return nvkm_event_init(&nvkm_gpio_intr_func, 2, func->lines, return nvkm_event_init(&nvkm_gpio_intr_func, 2, func->lines,
......
...@@ -68,7 +68,8 @@ g94_gpio = { ...@@ -68,7 +68,8 @@ g94_gpio = {
}; };
int int
g94_gpio_new(struct nvkm_device *device, int index, struct nvkm_gpio **pgpio) g94_gpio_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
struct nvkm_gpio **pgpio)
{ {
return nvkm_gpio_new_(&g94_gpio, device, index, pgpio); return nvkm_gpio_new_(&g94_gpio, device, type, inst, pgpio);
} }
...@@ -112,7 +112,8 @@ ga102_gpio = { ...@@ -112,7 +112,8 @@ ga102_gpio = {
}; };
int int
ga102_gpio_new(struct nvkm_device *device, int index, struct nvkm_gpio **pgpio) ga102_gpio_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
struct nvkm_gpio **pgpio)
{ {
return nvkm_gpio_new_(&ga102_gpio, device, index, pgpio); return nvkm_gpio_new_(&ga102_gpio, device, type, inst, pgpio);
} }
...@@ -80,7 +80,8 @@ gf119_gpio = { ...@@ -80,7 +80,8 @@ gf119_gpio = {
}; };
int int
gf119_gpio_new(struct nvkm_device *device, int index, struct nvkm_gpio **pgpio) gf119_gpio_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
struct nvkm_gpio **pgpio)
{ {
return nvkm_gpio_new_(&gf119_gpio, device, index, pgpio); return nvkm_gpio_new_(&gf119_gpio, device, type, inst, pgpio);
} }
...@@ -68,7 +68,8 @@ gk104_gpio = { ...@@ -68,7 +68,8 @@ gk104_gpio = {
}; };
int int
gk104_gpio_new(struct nvkm_device *device, int index, struct nvkm_gpio **pgpio) gk104_gpio_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
struct nvkm_gpio **pgpio)
{ {
return nvkm_gpio_new_(&gk104_gpio, device, index, pgpio); return nvkm_gpio_new_(&gk104_gpio, device, type, inst, pgpio);
} }
...@@ -112,7 +112,8 @@ nv10_gpio = { ...@@ -112,7 +112,8 @@ nv10_gpio = {
}; };
int int
nv10_gpio_new(struct nvkm_device *device, int index, struct nvkm_gpio **pgpio) nv10_gpio_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
struct nvkm_gpio **pgpio)
{ {
return nvkm_gpio_new_(&nv10_gpio, device, index, pgpio); return nvkm_gpio_new_(&nv10_gpio, device, type, inst, pgpio);
} }
...@@ -126,7 +126,8 @@ nv50_gpio = { ...@@ -126,7 +126,8 @@ nv50_gpio = {
}; };
int int
nv50_gpio_new(struct nvkm_device *device, int index, struct nvkm_gpio **pgpio) nv50_gpio_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
struct nvkm_gpio **pgpio)
{ {
return nvkm_gpio_new_(&nv50_gpio, device, index, pgpio); return nvkm_gpio_new_(&nv50_gpio, device, type, inst, pgpio);
} }
...@@ -28,8 +28,8 @@ struct nvkm_gpio_func { ...@@ -28,8 +28,8 @@ struct nvkm_gpio_func {
void (*reset)(struct nvkm_gpio *, u8); void (*reset)(struct nvkm_gpio *, u8);
}; };
int nvkm_gpio_new_(const struct nvkm_gpio_func *, struct nvkm_device *, int nvkm_gpio_new_(const struct nvkm_gpio_func *, struct nvkm_device *, enum nvkm_subdev_type, int,
int index, struct nvkm_gpio **); struct nvkm_gpio **);
void nv50_gpio_reset(struct nvkm_gpio *, u8); void nv50_gpio_reset(struct nvkm_gpio *, u8);
int nv50_gpio_drive(struct nvkm_gpio *, int, int, int); int nv50_gpio_drive(struct nvkm_gpio *, int, int, int);
......
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