drivers/gpu/drm/nouveau/nvkm/subdev/therm/gp100.c

Source file repositories/reference/linux-study-clean/drivers/gpu/drm/nouveau/nvkm/subdev/therm/gp100.c

File Facts

System
Linux kernel
Corpus path
drivers/gpu/drm/nouveau/nvkm/subdev/therm/gp100.c
Extension
.c
Size
2014 bytes
Lines
62
Domain
Driver Families
Bucket
drivers/gpu
Inferred role
Driver Families: implementation source
Status
source implementation candidate

Why This File Exists

Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.

Dependency Surface

Detected Declarations

Annotated Snippet

#include "priv.h"

#include <subdev/gsp.h>

static int
gp100_temp_get(struct nvkm_therm *therm)
{
	struct nvkm_device *device = therm->subdev.device;
	struct nvkm_subdev *subdev = &therm->subdev;
	u32 tsensor = nvkm_rd32(device, 0x020460);
	u32 inttemp = (tsensor & 0x0001fff8);

	/* device SHADOWed */
	if (tsensor & 0x40000000)
		nvkm_trace(subdev, "reading temperature from SHADOWed sensor\n");

	/* device valid */
	if (tsensor & 0x20000000)
		return (inttemp >> 8);
	else
		return -ENODEV;
}

static const struct nvkm_therm_func
gp100_therm = {
	.temp_get = gp100_temp_get,
	.program_alarms = nvkm_therm_program_alarms_polling,
};

int
gp100_therm_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
		struct nvkm_therm **ptherm)
{
	if (nvkm_gsp_rm(device->gsp))
		return -ENODEV;

	return nvkm_therm_new_(&gp100_therm, device, type, inst, ptherm);
}

Annotation

Implementation Notes