drivers/gpu/drm/nouveau/nouveau_hwmon.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/nouveau/nouveau_hwmon.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/nouveau/nouveau_hwmon.c- Extension
.c- Size
- 18249 bytes
- Lines
- 726
- 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.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/acpi.hlinux/power_supply.hlinux/hwmon.hlinux/hwmon-sysfs.hnouveau_drv.hnouveau_hwmon.hnvkm/subdev/iccsense.hnvkm/subdev/volt.h
Detected Declarations
function filesfunction nouveau_hwmon_temp1_auto_point1_tempfunction nouveau_hwmon_set_temp1_auto_point1_tempfunction nouveau_hwmon_temp1_auto_point1_temp_hystfunction nouveau_hwmon_set_temp1_auto_point1_temp_hystfunction nouveau_hwmon_get_pwm1_maxfunction nouveau_hwmon_get_pwm1_minfunction nouveau_hwmon_set_pwm1_minfunction nouveau_hwmon_set_pwm1_maxfunction nouveau_chip_is_visiblefunction nouveau_power_is_visiblefunction nouveau_temp_is_visiblefunction nouveau_pwm_is_visiblefunction nouveau_input_is_visiblefunction nouveau_fan_is_visiblefunction nouveau_chip_readfunction nouveau_temp_readfunction nouveau_fan_readfunction nouveau_in_readfunction nouveau_pwm_readfunction nouveau_power_readfunction nouveau_temp_writefunction nouveau_pwm_writefunction nouveau_is_visiblefunction nouveau_read_stringfunction nouveau_readfunction nouveau_writefunction nouveau_hwmon_initfunction nouveau_hwmon_fini
Annotated Snippet
#ifdef CONFIG_ACPI
#include <linux/acpi.h>
#endif
#include <linux/power_supply.h>
#include <linux/hwmon.h>
#include <linux/hwmon-sysfs.h>
#include "nouveau_drv.h"
#include "nouveau_hwmon.h"
#include <nvkm/subdev/iccsense.h>
#include <nvkm/subdev/volt.h>
#if defined(CONFIG_HWMON) || (defined(MODULE) && defined(CONFIG_HWMON_MODULE))
static ssize_t
nouveau_hwmon_show_temp1_auto_point1_pwm(struct device *d,
struct device_attribute *a, char *buf)
{
return sysfs_emit(buf, "%d\n", 100);
}
static SENSOR_DEVICE_ATTR(temp1_auto_point1_pwm, 0444,
nouveau_hwmon_show_temp1_auto_point1_pwm, NULL, 0);
static ssize_t
nouveau_hwmon_temp1_auto_point1_temp(struct device *d,
struct device_attribute *a, char *buf)
{
struct drm_device *dev = dev_get_drvdata(d);
struct nouveau_drm *drm = nouveau_drm(dev);
struct nvkm_therm *therm = nvxx_therm(drm);
return sysfs_emit(buf, "%d\n",
therm->attr_get(therm, NVKM_THERM_ATTR_THRS_FAN_BOOST) * 1000);
}
static ssize_t
nouveau_hwmon_set_temp1_auto_point1_temp(struct device *d,
struct device_attribute *a,
const char *buf, size_t count)
{
struct drm_device *dev = dev_get_drvdata(d);
struct nouveau_drm *drm = nouveau_drm(dev);
struct nvkm_therm *therm = nvxx_therm(drm);
long value;
if (kstrtol(buf, 10, &value))
return -EINVAL;
therm->attr_set(therm, NVKM_THERM_ATTR_THRS_FAN_BOOST,
value / 1000);
return count;
}
static SENSOR_DEVICE_ATTR(temp1_auto_point1_temp, 0644,
nouveau_hwmon_temp1_auto_point1_temp,
nouveau_hwmon_set_temp1_auto_point1_temp, 0);
static ssize_t
nouveau_hwmon_temp1_auto_point1_temp_hyst(struct device *d,
struct device_attribute *a, char *buf)
{
struct drm_device *dev = dev_get_drvdata(d);
struct nouveau_drm *drm = nouveau_drm(dev);
struct nvkm_therm *therm = nvxx_therm(drm);
return sysfs_emit(buf, "%d\n",
therm->attr_get(therm, NVKM_THERM_ATTR_THRS_FAN_BOOST_HYST) * 1000);
}
static ssize_t
nouveau_hwmon_set_temp1_auto_point1_temp_hyst(struct device *d,
struct device_attribute *a,
const char *buf, size_t count)
{
struct drm_device *dev = dev_get_drvdata(d);
struct nouveau_drm *drm = nouveau_drm(dev);
struct nvkm_therm *therm = nvxx_therm(drm);
long value;
if (kstrtol(buf, 10, &value))
return -EINVAL;
therm->attr_set(therm, NVKM_THERM_ATTR_THRS_FAN_BOOST_HYST,
value / 1000);
return count;
}
static SENSOR_DEVICE_ATTR(temp1_auto_point1_temp_hyst, 0644,
nouveau_hwmon_temp1_auto_point1_temp_hyst,
nouveau_hwmon_set_temp1_auto_point1_temp_hyst, 0);
Annotation
- Immediate include surface: `linux/acpi.h`, `linux/power_supply.h`, `linux/hwmon.h`, `linux/hwmon-sysfs.h`, `nouveau_drv.h`, `nouveau_hwmon.h`, `nvkm/subdev/iccsense.h`, `nvkm/subdev/volt.h`.
- Detected declarations: `function files`, `function nouveau_hwmon_temp1_auto_point1_temp`, `function nouveau_hwmon_set_temp1_auto_point1_temp`, `function nouveau_hwmon_temp1_auto_point1_temp_hyst`, `function nouveau_hwmon_set_temp1_auto_point1_temp_hyst`, `function nouveau_hwmon_get_pwm1_max`, `function nouveau_hwmon_get_pwm1_min`, `function nouveau_hwmon_set_pwm1_min`, `function nouveau_hwmon_set_pwm1_max`, `function nouveau_chip_is_visible`.
- 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.