Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d351b856 authored by Ben Skeggs's avatar Ben Skeggs
Browse files

drm/nouveau/subdev: add direct pointer to nvkm_device



Will be utilised in upcoming commits to remove the need for heuristics
to lookup the device a subdev belongs to.

Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
parent 0d5dd3f3
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -130,17 +130,17 @@ static bool
get_tv_detect_quirks(struct drm_device *dev, uint32_t *pin_mask)
{
	struct nouveau_drm *drm = nouveau_drm(dev);
	struct nvif_device *device = &drm->device;
	struct nvkm_device *device = nvxx_device(&drm->device);

	/* Zotac FX5200 */
	if (nv_device_match(nvxx_object(device), 0x0322, 0x19da, 0x1035) ||
	    nv_device_match(nvxx_object(device), 0x0322, 0x19da, 0x2035)) {
	if (nv_device_match(device, 0x0322, 0x19da, 0x1035) ||
	    nv_device_match(device, 0x0322, 0x19da, 0x2035)) {
		*pin_mask = 0xc;
		return false;
	}

	/* MSI nForce2 IGP */
	if (nv_device_match(nvxx_object(device), 0x01f0, 0x1462, 0x5710)) {
	if (nv_device_match(device, 0x01f0, 0x1462, 0x5710)) {
		*pin_mask = 0xc;
		return false;
	}
+1 −2
Original line number Diff line number Diff line
@@ -49,9 +49,8 @@ int nvkm_device_list(u64 *name, int size);
struct nvkm_device *nv_device(void *obj);

static inline bool
nv_device_match(struct nvkm_object *object, u16 dev, u16 ven, u16 sub)
nv_device_match(struct nvkm_device *device, u16 dev, u16 ven, u16 sub)
{
	struct nvkm_device *device = nv_device(object);
	return device->pdev->device == dev &&
	       device->pdev->subsystem_vendor == ven &&
	       device->pdev->subsystem_device == sub;
+3 −0
Original line number Diff line number Diff line
@@ -8,6 +8,9 @@

struct nvkm_subdev {
	struct nvkm_object object;

	struct nvkm_device *device;

	struct mutex mutex;
	const char *name;
	void __iomem *mmio;
+3 −0
Original line number Diff line number Diff line
@@ -114,6 +114,9 @@ nvkm_subdev_create_(struct nvkm_object *parent, struct nvkm_object *engine,
		struct nvkm_device *device = nv_device(parent);
		subdev->debug = nvkm_dbgopt(device->dbgopt, subname);
		subdev->mmio  = nv_subdev(device)->mmio;
		subdev->device = device;
	} else {
		subdev->device = nv_device(subdev);
	}

	return 0;
+2 −1
Original line number Diff line number Diff line
@@ -44,6 +44,7 @@ static int
nvkm_gpio_find(struct nvkm_gpio *gpio, int idx, u8 tag, u8 line,
	       struct dcb_gpio_func *func)
{
	struct nvkm_device *device = gpio->base.device;
	struct nvkm_bios *bios = nvkm_bios(gpio);
	u8  ver, len;
	u16 data;
@@ -56,7 +57,7 @@ nvkm_gpio_find(struct nvkm_gpio *gpio, int idx, u8 tag, u8 line,
		return 0;

	/* Apple iMac G4 NV18 */
	if (nv_device_match(nv_object(gpio), 0x0189, 0x10de, 0x0010)) {
	if (nv_device_match(device, 0x0189, 0x10de, 0x0010)) {
		if (tag == DCB_GPIO_TVDAC0) {
			*func = (struct dcb_gpio_func) {
				.func = DCB_GPIO_TVDAC0,
Loading