drivers/gpu/drm/nouveau/nvkm/subdev/therm/nv40.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/nouveau/nvkm/subdev/therm/nv40.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/nouveau/nvkm/subdev/therm/nv40.c- Extension
.c- Size
- 5698 bytes
- Lines
- 205
- 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.
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
priv.h
Detected Declarations
enum nv40_sensor_stylefunction nv40_sensor_stylefunction nv40_sensor_setupfunction nv40_temp_getfunction nv40_fan_pwm_ctrlfunction nv40_fan_pwm_getfunction nv40_fan_pwm_setfunction nv40_therm_intrfunction nv40_therm_initfunction nv40_therm_new
Annotated Snippet
if (reg & 0x80000000) {
*duty = (reg & 0x7fff0000) >> 16;
*divs = (reg & 0x00007fff);
return 0;
}
} else
if (line == 9) {
u32 reg = nvkm_rd32(device, 0x0015f4);
if (reg & 0x80000000) {
*divs = nvkm_rd32(device, 0x0015f8);
*duty = (reg & 0x7fffffff);
return 0;
}
} else {
nvkm_error(subdev, "unknown pwm ctrl for gpio %d\n", line);
return -ENODEV;
}
return -EINVAL;
}
static int
nv40_fan_pwm_set(struct nvkm_therm *therm, int line, u32 divs, u32 duty)
{
struct nvkm_subdev *subdev = &therm->subdev;
struct nvkm_device *device = subdev->device;
if (line == 2) {
nvkm_mask(device, 0x0010f0, 0x7fff7fff, (duty << 16) | divs);
} else
if (line == 9) {
nvkm_wr32(device, 0x0015f8, divs);
nvkm_mask(device, 0x0015f4, 0x7fffffff, duty);
} else {
nvkm_error(subdev, "unknown pwm ctrl for gpio %d\n", line);
return -ENODEV;
}
return 0;
}
void
nv40_therm_intr(struct nvkm_therm *therm)
{
struct nvkm_subdev *subdev = &therm->subdev;
struct nvkm_device *device = subdev->device;
uint32_t stat = nvkm_rd32(device, 0x1100);
/* traitement */
/* ack all IRQs */
nvkm_wr32(device, 0x1100, 0x70000);
nvkm_error(subdev, "THERM received an IRQ: stat = %x\n", stat);
}
static void
nv40_therm_init(struct nvkm_therm *therm)
{
nv40_sensor_setup(therm);
}
static const struct nvkm_therm_func
nv40_therm = {
.init = nv40_therm_init,
.intr = nv40_therm_intr,
.pwm_ctrl = nv40_fan_pwm_ctrl,
.pwm_get = nv40_fan_pwm_get,
.pwm_set = nv40_fan_pwm_set,
.temp_get = nv40_temp_get,
.program_alarms = nvkm_therm_program_alarms_polling,
};
int
nv40_therm_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
struct nvkm_therm **ptherm)
{
return nvkm_therm_new_(&nv40_therm, device, type, inst, ptherm);
}
Annotation
- Immediate include surface: `priv.h`.
- Detected declarations: `enum nv40_sensor_style`, `function nv40_sensor_style`, `function nv40_sensor_setup`, `function nv40_temp_get`, `function nv40_fan_pwm_ctrl`, `function nv40_fan_pwm_get`, `function nv40_fan_pwm_set`, `function nv40_therm_intr`, `function nv40_therm_init`, `function nv40_therm_new`.
- Atlas domain: Driver Families / drivers/gpu.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.