Skip to contentSkip to conversation

drm/nouveau/nvkm: refine the device SKU enum

PATCH In review Zhi Wang 2 participants 2 messages Oct 17, 2024

Subsystems (3)
lore
Share & tools
lore

Zhi Wang

author
#0 lore raw

PATCH 1/1 drm/nouveau/nvkm: refine the device SKU enum

NVKM uses a enum called "card_type" to represent the device SKU in the code. Within the enum, each device SKU is represent like NV_10, AD100, etc.

Many concerns were raised due to over-short SKU enums can conflicts with other local enums and a prefix is also required as an identifier of namespace of a driver.

Rename enum "card_type" to "sku". Add the prefix NVKM_DEVICE_ before each device SKU inside the enum and some other coding format tweaks to make checkpatch.pl happy.

No functional change is intended.

---
 .../drm/nouveau/include/nvkm/core/device.h    | 32 +++++-----
 drivers/gpu/drm/nouveau/nvkm/core/ramht.c     |  2 +-
 .../gpu/drm/nouveau/nvkm/engine/device/base.c | 58 ++++++++++++------
 .../gpu/drm/nouveau/nvkm/engine/device/user.c | 60 ++++++++++++++-----
 drivers/gpu/drm/nouveau/nvkm/engine/disp/dp.c |  2 +-
 .../gpu/drm/nouveau/nvkm/engine/disp/vga.c    | 14 ++---
 drivers/gpu/drm/nouveau/nvkm/engine/falcon.c  |  2 +-
 .../gpu/drm/nouveau/nvkm/engine/fifo/nv04.c   |  6 +-
 .../gpu/drm/nouveau/nvkm/engine/gr/gf100.c    |  4 +-
 drivers/gpu/drm/nouveau/nvkm/engine/gr/nv04.c |  2 +-
 drivers/gpu/drm/nouveau/nvkm/engine/gr/nv10.c |  8 +--
 .../gpu/drm/nouveau/nvkm/subdev/bios/dcb.c    |  2 +-
 .../gpu/drm/nouveau/nvkm/subdev/bios/init.c   |  8 +--
 .../gpu/drm/nouveau/nvkm/subdev/bios/pll.c    | 16 ++---
 .../nouveau/nvkm/subdev/bios/shadowramin.c    | 13 ++--
 .../drm/nouveau/nvkm/subdev/bios/shadowrom.c  |  2 +-
 .../gpu/drm/nouveau/nvkm/subdev/bios/therm.c  |  2 +-
 .../drm/nouveau/nvkm/subdev/devinit/nv10.c    |  2 +-
 .../drm/nouveau/nvkm/subdev/therm/fanpwm.c    |  8 +--
 19 files changed, 147 insertions(+), 96 deletions(-)
drivers/gpu/drm/nouveau/include/nvkm/core/device.h +16 -16
index 46afb877a296..1cfb83122a11 100644
@@ -32,22 +32,22 @@ struct nvkm_device {
 
 	const struct nvkm_device_chip *chip;
 	enum {
-		NV_04    = 0x04,
-		NV_10    = 0x10,
-		NV_11    = 0x11,
-		NV_20    = 0x20,
-		NV_30    = 0x30,
-		NV_40    = 0x40,
-		NV_50    = 0x50,
-		NV_C0    = 0xc0,
-		NV_E0    = 0xe0,
-		GM100    = 0x110,
-		GP100    = 0x130,
-		GV100    = 0x140,
-		TU100    = 0x160,
-		GA100    = 0x170,
-		AD100    = 0x190,
-	} card_type;
+		NVKM_DEVICE_NV_04    = 0x04,
+		NVKM_DEVICE_NV_10    = 0x10,
+		NVKM_DEVICE_NV_11    = 0x11,
+		NVKM_DEVICE_NV_20    = 0x20,
+		NVKM_DEVICE_NV_30    = 0x30,
+		NVKM_DEVICE_NV_40    = 0x40,
+		NVKM_DEVICE_NV_50    = 0x50,
+		NVKM_DEVICE_NV_C0    = 0xc0,
+		NVKM_DEVICE_NV_E0    = 0xe0,
+		NVKM_DEVICE_GM100    = 0x110,
+		NVKM_DEVICE_GP100    = 0x130,
+		NVKM_DEVICE_GV100    = 0x140,
+		NVKM_DEVICE_TU100    = 0x160,
+		NVKM_DEVICE_GA100    = 0x170,
+		NVKM_DEVICE_AD100    = 0x190,
+	} sku;
 	u32 chipset;
 	u8  chiprev;
 	u32 crystal;
drivers/gpu/drm/nouveau/nvkm/core/ramht.c +1 -1
index 8162e3d2359c..b26ed5db7bdb 100644
@@ -79,7 +79,7 @@ nvkm_ramht_update(struct nvkm_ramht *ramht, int co, struct nvkm_object *object,
 		}
 
 		if (data->inst) {
-			if (ramht->device->card_type >= NV_50)
+			if (ramht->device->sku >= NVKM_DEVICE_NV_50)
 				inst = data->inst->node->offset;
 			else
 				inst = data->inst->addr;
drivers/gpu/drm/nouveau/nvkm/engine/device/base.c +41 -17

94 lines not on this page · raw message

drivers/gpu/drm/nouveau/nvkm/engine/device/user.c +44 -16

66 lines not on this page · raw message

drivers/gpu/drm/nouveau/nvkm/engine/disp/dp.c +1 -1
index a109348bd63b..a391f7af77d0 100644
@@ -39,7 +39,7 @@
  * the x86 option ROM.  However, the relevant VBIOS table versions weren't modified,
  * so we're unable to detect this in a nice way.
  */
-#define AMPERE_IED_HACK(disp) ((disp)->engine.subdev.device->card_type >= GA100)
+#define AMPERE_IED_HACK(disp) ((disp)->engine.subdev.device->sku >= NVKM_DEVICE_GA100)
 
 static int
 nvkm_dp_mst_id_put(struct nvkm_outp *outp, u32 id)
drivers/gpu/drm/nouveau/nvkm/engine/disp/vga.c +7 -7
index 8bff95c6343f..bf2b3d413f49 100644
@@ -26,7 +26,7 @@
 u8
 nvkm_rdport(struct nvkm_device *device, int head, u16 port)
 {
-	if (device->card_type >= NV_50)
+	if (device->sku >= NVKM_DEVICE_NV_50)
 		return nvkm_rd08(device, 0x601000 + port);
 
 	if (port == 0x03c0 || port == 0x03c1 ||	/* AR */
@@ -37,7 +37,7 @@ nvkm_rdport(struct nvkm_device *device, int head, u16 port)
 	if (port == 0x03c2 || port == 0x03cc ||	/* MISC */
 	    port == 0x03c4 || port == 0x03c5 ||	/* SR */
 	    port == 0x03ce || port == 0x03cf) {	/* GR */
-		if (device->card_type < NV_40)
+		if (device->sku < NVKM_DEVICE_NV_40)
 			head = 0; /* CR44 selects head */
 		return nvkm_rd08(device, 0x0c0000 + (head * 0x2000) + port);
 	}
@@ -48,7 +48,7 @@ nvkm_rdport(struct nvkm_device *device, int head, u16 port)
 void
 nvkm_wrport(struct nvkm_device *device, int head, u16 port, u8 data)
 {
-	if (device->card_type >= NV_50)
+	if (device->sku >= NVKM_DEVICE_NV_50)
 		nvkm_wr08(device, 0x601000 + port, data);
 	else
 	if (port == 0x03c0 || port == 0x03c1 ||	/* AR */
@@ -59,7 +59,7 @@ nvkm_wrport(struct nvkm_device *device, int head, u16 port, u8 data)
 	if (port == 0x03c2 || port == 0x03cc ||	/* MISC */
 	    port == 0x03c4 || port == 0x03c5 ||	/* SR */
 	    port == 0x03ce || port == 0x03cf) {	/* GR */
-		if (device->card_type < NV_40)
+		if (device->sku < NVKM_DEVICE_NV_40)
 			head = 0; /* CR44 selects head */
 		nvkm_wr08(device, 0x0c0000 + (head * 0x2000) + port, data);
 	}
@@ -129,7 +129,7 @@ nvkm_lockvgac(struct nvkm_device *device, bool lock)
 {
 	bool locked = !nvkm_rdvgac(device, 0, 0x1f);
 	u8 data = lock ? 0x99 : 0x57;
-	if (device->card_type < NV_50)
+	if (device->sku < NVKM_DEVICE_NV_50)
 		nvkm_wrvgac(device, 0, 0x1f, data);
 	else
 		nvkm_wrvgac(device, 0, 0x3f, data);
@@ -161,7 +161,7 @@ nvkm_lockvgac(struct nvkm_device *device, bool lock)
 u8
 nvkm_rdvgaowner(struct nvkm_device *device)
 {
-	if (device->card_type < NV_50) {
+	if (device->sku < NVKM_DEVICE_NV_50) {
 		if (device->chipset == 0x11) {
 			u32 tied = nvkm_rd32(device, 0x001084) & 0x10000000;
 			if (tied == 0) {
@@ -187,7 +187,7 @@ nvkm_rdvgaowner(struct nvkm_device *device)
 void
 nvkm_wrvgaowner(struct nvkm_device *device, u8 select)
 {
-	if (device->card_type < NV_50) {
+	if (device->sku < NVKM_DEVICE_NV_50) {
 		u8 owner = (select == 1) ? 3 : select;
 		if (device->chipset == 0x11) {
 			/* workaround hw lockup bug */
drivers/gpu/drm/nouveau/nvkm/engine/falcon.c +1 -1
index fd5ee9f0af36..21970bdcc698 100644
@@ -262,7 +262,7 @@ nvkm_falcon_init(struct nvkm_engine *engine)
 	/* upload firmware bootloader (or the full code segments) */
 	if (falcon->core) {
 		u64 addr = nvkm_memory_addr(falcon->core);
-		if (device->card_type < NV_C0)
+		if (device->sku < NVKM_DEVICE_NV_C0)
 			nvkm_wr32(device, base + 0x618, 0x04000000);
 		else
 			nvkm_wr32(device, base + 0x618, 0x00000114);
drivers/gpu/drm/nouveau/nvkm/engine/fifo/nv04.c +3 -3
index 674faf002b20..36a742a3808a 100644
@@ -317,7 +317,7 @@ nv04_fifo_intr_cache_error(struct nvkm_fifo *fifo, u32 chid, u32 get)
 	 */
 	ptr = (get & 0x7ff) >> 2;
 
-	if (device->card_type < NV_40) {
+	if (device->sku < NVKM_DEVICE_NV_40) {
 		mthd = nvkm_rd32(device, NV04_PFIFO_CACHE1_METHOD(ptr));
 		data = nvkm_rd32(device, NV04_PFIFO_CACHE1_DATA(ptr));
 	} else {
@@ -365,7 +365,7 @@ nv04_fifo_intr_dma_pusher(struct nvkm_fifo *fifo, u32 chid)
 
 	chan = nvkm_chan_get_chid(&fifo->engine, chid, &flags);
 	name = chan ? chan->name : "unknown";
-	if (device->card_type == NV_50) {
+	if (device->sku == NVKM_DEVICE_NV_50) {
 		u32 ho_get = nvkm_rd32(device, 0x003328);
 		u32 ho_put = nvkm_rd32(device, 0x003320);
 		u32 ib_get = nvkm_rd32(device, 0x003334);
@@ -439,7 +439,7 @@ nv04_fifo_intr(struct nvkm_inth *inth)
 		nvkm_wr32(device, NV04_PFIFO_CACHE1_PULL0, 1);
 	}
 
-	if (device->card_type == NV_50) {
+	if (device->sku == NVKM_DEVICE_NV_50) {
 		if (stat & 0x00000010) {
 			stat &= ~0x00000010;
 			nvkm_wr32(device, 0x002100, 0x00000010);
drivers/gpu/drm/nouveau/nvkm/engine/gr/gf100.c +2 -2
index 060c74a80eb1..67036999ca9f 100644
@@ -414,7 +414,7 @@ gf100_gr_chan_new(struct nvkm_gr *base, struct nvkm_chan *fifoch,
 	if (ret)
 		return ret;
 
-	if (device->card_type < GP100) {
+	if (device->sku < NVKM_DEVICE_GP100) {
 		ret = nvkm_memory_map(gr->attrib_cb, 0, chan->vmm, chan->attrib_cb, NULL, 0);
 		if (ret)
 			return ret;
@@ -1627,7 +1627,7 @@ gf100_gr_intr(struct nvkm_inth *inth)
 		chid = chan->id;
 	}
 
-	if (device->card_type < NV_E0 || subc < 4)
+	if (device->sku < NVKM_DEVICE_NV_E0 || subc < 4)
 		class = nvkm_rd32(device, 0x404200 + (subc * 4));
 	else
 		class = 0x0000;
drivers/gpu/drm/nouveau/nvkm/engine/gr/nv04.c +1 -1
index ca822f07b63e..f8a19d2cdd69 100644
@@ -1214,7 +1214,7 @@ nv04_gr_idle(struct nvkm_gr *gr)
 	struct nvkm_device *device = subdev->device;
 	u32 mask = 0xffffffff;
 
-	if (device->card_type == NV_40)
+	if (device->sku == NVKM_DEVICE_NV_40)
 		mask &= ~NV40_PGRAPH_STATUS_SYNC_STALL;
 
 	if (nvkm_msec(device, 2000,
drivers/gpu/drm/nouveau/nvkm/engine/gr/nv10.c +4 -4
index 92ef7c9b2910..b6b19642ec40 100644
@@ -890,7 +890,7 @@ nv10_gr_load_context(struct nv10_gr_chan *chan, int chid)
 	for (i = 0; i < ARRAY_SIZE(nv10_gr_ctx_regs); i++)
 		nvkm_wr32(device, nv10_gr_ctx_regs[i], chan->nv10[i]);
 
-	if (device->card_type >= NV_11 && device->chipset >= 0x17) {
+	if (device->sku >= NVKM_DEVICE_NV_11 && device->chipset >= 0x17) {
 		for (i = 0; i < ARRAY_SIZE(nv17_gr_ctx_regs); i++)
 			nvkm_wr32(device, nv17_gr_ctx_regs[i], chan->nv17[i]);
 	}
@@ -916,7 +916,7 @@ nv10_gr_unload_context(struct nv10_gr_chan *chan)
 	for (i = 0; i < ARRAY_SIZE(nv10_gr_ctx_regs); i++)
 		chan->nv10[i] = nvkm_rd32(device, nv10_gr_ctx_regs[i]);
 
-	if (device->card_type >= NV_11 && device->chipset >= 0x17) {
+	if (device->sku >= NVKM_DEVICE_NV_11 && device->chipset >= 0x17) {
 		for (i = 0; i < ARRAY_SIZE(nv17_gr_ctx_regs); i++)
 			chan->nv17[i] = nvkm_rd32(device, nv17_gr_ctx_regs[i]);
 	}
@@ -1021,7 +1021,7 @@ nv10_gr_chan_new(struct nvkm_gr *base, struct nvkm_chan *fifoch,
 	NV_WRITE_CTX(0x00400e14, 0x00001000);
 	NV_WRITE_CTX(0x00400e30, 0x00080008);
 	NV_WRITE_CTX(0x00400e34, 0x00080008);
-	if (device->card_type >= NV_11 && device->chipset >= 0x17) {
+	if (device->sku >= NVKM_DEVICE_NV_11 && device->chipset >= 0x17) {
 		/* is it really needed ??? */
 		NV17_WRITE_CTX(NV10_PGRAPH_DEBUG_4,
 			       nvkm_rd32(device, NV10_PGRAPH_DEBUG_4));
@@ -1148,7 +1148,7 @@ nv10_gr_init(struct nvkm_gr *base)
 	nvkm_wr32(device, NV04_PGRAPH_DEBUG_2, 0x25f92ad9);
 	nvkm_wr32(device, NV04_PGRAPH_DEBUG_3, 0x55DE0830 | (1 << 29) | (1 << 31));
 
-	if (device->card_type >= NV_11 && device->chipset >= 0x17) {
+	if (device->sku >= NVKM_DEVICE_NV_11 && device->chipset >= 0x17) {
 		nvkm_wr32(device, NV10_PGRAPH_DEBUG_4, 0x1f000000);
 		nvkm_wr32(device, 0x400a10, 0x03ff3fb6);
 		nvkm_wr32(device, 0x400838, 0x002f8684);
drivers/gpu/drm/nouveau/nvkm/subdev/bios/dcb.c +1 -1
index 8698f260b988..a8bf4903132f 100644
@@ -31,7 +31,7 @@ dcb_table(struct nvkm_bios *bios, u8 *ver, u8 *hdr, u8 *cnt, u8 *len)
 	struct nvkm_device *device = subdev->device;
 	u16 dcb = 0x0000;
 
-	if (device->card_type > NV_04)
+	if (device->sku > NVKM_DEVICE_NV_04)
 		dcb = nvbios_rd16(bios, 0x36);
 	if (!dcb) {
 		nvkm_warn(subdev, "DCB table not found\n");
drivers/gpu/drm/nouveau/nvkm/subdev/bios/init.c +4 -4
index b54f044c4483..022d33e755c7 100644
@@ -156,7 +156,7 @@ init_nvreg(struct nvbios_init *init, u32 reg)
 	/* GF8+ display scripts need register addresses mangled a bit to
 	 * select a specific CRTC/OR
 	 */
-	if (init->subdev->device->card_type >= NV_50) {
+	if (init->subdev->device->sku >= NVKM_DEVICE_NV_50) {
 		if (reg & 0x80000000) {
 			reg += init_head(init) * 0x800;
 			reg &= ~0x80000000;
@@ -242,7 +242,7 @@ init_wrvgai(struct nvbios_init *init, u16 port, u8 index, u8 value)
 	struct nvkm_device *device = init->subdev->device;
 
 	/* force head 0 for updates to cr44, it only exists on first head */
-	if (device->card_type < NV_50) {
+	if (device->sku < NVKM_DEVICE_NV_50) {
 		if (port == 0x03d4 && index == 0x44)
 			init->head = 0;
 	}
@@ -253,7 +253,7 @@ init_wrvgai(struct nvbios_init *init, u16 port, u8 index, u8 value)
 	}
 
 	/* select head 1 if cr44 write selected it */
-	if (device->card_type < NV_50) {
+	if (device->sku < NVKM_DEVICE_NV_50) {
 		if (port == 0x03d4 && index == 0x44 && value == 3)
 			init->head = 1;
 	}
@@ -1635,7 +1635,7 @@ init_io(struct nvbios_init *init)
 	 * needed some day..  it's almost certainly wrong, but, it also
 	 * somehow makes things work...
 	 */
-	if (bios->subdev.device->card_type >= NV_50 &&
+	if (bios->subdev.device->sku >= NVKM_DEVICE_NV_50 &&
 	    port == 0x03c3 && data == 0x01) {
 		init_mask(init, 0x614100, 0xf0800000, 0x00800000);
 		init_mask(init, 0x00e18c, 0x00020000, 0x00020000);
drivers/gpu/drm/nouveau/nvkm/subdev/bios/pll.c +8 -8
index 2ec84b8a3b3a..8166fa5795b6 100644
@@ -116,16 +116,16 @@ static struct pll_mapping *
 pll_map(struct nvkm_bios *bios)
 {
 	struct nvkm_device *device = bios->subdev.device;
-	switch (device->card_type) {
-	case NV_04:
-	case NV_10:
-	case NV_11:
-	case NV_20:
-	case NV_30:
+	switch (device->sku) {
+	case NVKM_DEVICE_NV_04:
+	case NVKM_DEVICE_NV_10:
+	case NVKM_DEVICE_NV_11:
+	case NVKM_DEVICE_NV_20:
+	case NVKM_DEVICE_NV_30:
 		return nv04_pll_mapping;
-	case NV_40:
+	case NVKM_DEVICE_NV_40:
 		return nv40_pll_mapping;
-	case NV_50:
+	case NVKM_DEVICE_NV_50:
 		if (device->chipset == 0x50)
 			return nv50_pll_mapping;
 		else
drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadowramin.c +6 -7
index 023ddc7c5399..37235a23710e 100644
@@ -60,18 +60,17 @@ pramin_init(struct nvkm_bios *bios, const char *name)
 	u64 addr = 0;
 
 	/* PRAMIN always potentially available prior to nv50 */
-	if (device->card_type < NV_50)
+	if (device->sku < NVKM_DEVICE_NV_50)
 		return NULL;
 
 	/* we can't get the bios image pointer without PDISP */
-	if (device->card_type >= GA100)
+	if (device->sku >= NVKM_DEVICE_GA100)
 		addr = device->chipset == 0x170; /*XXX: find the fuse reg for this */
-	else
-	if (device->card_type >= GM100)
+	else if (device->sku >= NVKM_DEVICE_GM100)
 		addr = nvkm_rd32(device, 0x021c04);
-	else
-	if (device->card_type >= NV_C0)
+	else if (device->sku >= NVKM_DEVICE_NV_C0)
 		addr = nvkm_rd32(device, 0x022500);
+
 	if (addr & 0x00000001) {
 		nvkm_debug(subdev, "... display disabled\n");
 		return ERR_PTR(-ENODEV);
@@ -81,7 +80,7 @@ pramin_init(struct nvkm_bios *bios, const char *name)
 	 * important as we don't want to be touching vram on an
 	 * uninitialised board
 	 */
-	if (device->card_type >= GV100)
+	if (device->sku >= NVKM_DEVICE_GV100)
 		addr = nvkm_rd32(device, 0x625f04);
 	else
 		addr = nvkm_rd32(device, 0x619f04);
drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadowrom.c +1 -1
index 39144ceb117b..8a2a148f9632 100644
@@ -48,7 +48,7 @@ static void *
 nvbios_prom_init(struct nvkm_bios *bios, const char *name)
 {
 	struct nvkm_device *device = bios->subdev.device;
-	if (device->card_type == NV_40 && device->chipset >= 0x4c)
+	if (device->sku == NVKM_DEVICE_NV_40 && device->chipset >= 0x4c)
 		return ERR_PTR(-ENODEV);
 	nvkm_pci_rom_shadow(device->pci, false);
 	return device;
drivers/gpu/drm/nouveau/nvkm/subdev/bios/therm.c +1 -1
index 5babc5a7c7d5..8a91a91b78e3 100644
@@ -203,7 +203,7 @@ nvbios_therm_fan_parse(struct nvkm_bios *bios, struct nvbios_therm_fan *fan)
 	}
 
 	/* starting from fermi, fan management is always linear */
-	if (bios->subdev.device->card_type >= NV_C0 &&
+	if (bios->subdev.device->sku >= NVKM_DEVICE_NV_C0 &&
 		fan->fan_mode == NVBIOS_THERM_FAN_OTHER) {
 		fan->fan_mode = NVBIOS_THERM_FAN_LINEAR;
 	}
drivers/gpu/drm/nouveau/nvkm/subdev/devinit/nv10.c +1 -1
index a6aa8786d610..06044bc42d44 100644
@@ -40,7 +40,7 @@ nv10_devinit_meminit(struct nvkm_devinit *init)
 	struct io_mapping *fb;
 	int i, j, k;
 
-	if (device->card_type >= NV_11 && device->chipset >= 0x17)
+	if (device->sku >= NVKM_DEVICE_NV_11 && device->chipset >= 0x17)
 		mem_width_count = 3;
 	else
 		mem_width_count = 2;
drivers/gpu/drm/nouveau/nvkm/subdev/therm/fanpwm.c +4 -4
index b13ba9b2f6be..30edd0fa8fe6 100644
@@ -40,14 +40,14 @@ nvkm_fanpwm_get(struct nvkm_therm *therm)
 	struct nvkm_fanpwm *fan = (void *)therm->fan;
 	struct nvkm_device *device = therm->subdev.device;
 	struct nvkm_gpio *gpio = device->gpio;
-	int card_type = device->card_type;
+	int sku = device->sku;
 	u32 divs, duty;
 	int ret;
 
 	ret = therm->func->pwm_get(therm, fan->func.line, &divs, &duty);
 	if (ret == 0 && divs) {
 		divs = max(divs, duty);
-		if (card_type <= NV_40 || (fan->func.log[0] & 1))
+		if (sku <= NVKM_DEVICE_NV_40 || (fan->func.log[0] & 1))
 			duty = divs - duty;
 		return (duty * 100) / divs;
 	}
@@ -59,7 +59,7 @@ static int
 nvkm_fanpwm_set(struct nvkm_therm *therm, int percent)
 {
 	struct nvkm_fanpwm *fan = (void *)therm->fan;
-	int card_type = therm->subdev.device->card_type;
+	int sku = therm->subdev.device->sku;
 	u32 divs, duty;
 	int ret;
 
@@ -72,7 +72,7 @@ nvkm_fanpwm_set(struct nvkm_therm *therm, int percent)
 	}
 
 	duty = ((divs * percent) + 99) / 100;
-	if (card_type <= NV_40 || (fan->func.log[0] & 1))
+	if (sku <= NVKM_DEVICE_NV_40 || (fan->func.log[0] & 1))
 		duty = divs - duty;
 
 	ret = therm->func->pwm_set(therm, fan->func.line, divs, duty);
Signature · 1 line
2.43.5
Acked-by on v1 1/1
#1 lore raw
Quoted 7 lines · Zhi Wang

NVKM uses a enum called "card_type" to represent the device SKU in the code. Within the enum, each device SKU is represent like NV_10, AD100, etc.

Many concerns were raised due to over-short SKU enums can conflicts with other local enums and a prefix is also required as an identifier of namespace of a driver.

Quoted 7 lines

Rename enum "card_type" to "sku". Add the prefix NVKM_DEVICE_ before each device SKU inside the enum and some other coding format tweaks to make checkpatch.pl happy.

No functional change is intended.

Nice, thanks for doing this.