Skip to content

Commit

Permalink
drm/nouveau/hwmon: add in_min and in_max
Browse files Browse the repository at this point in the history
it is a little help for hardware monitoring tools

Signed-off-by: Karol Herbst <karolherbst@gmail.de>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
  • Loading branch information
Karol Herbst authored and Ben Skeggs committed Jul 14, 2016
1 parent 437bb44 commit b66ad32
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions drivers/gpu/drm/nouveau/nouveau_hwmon.c
Original file line number Diff line number Diff line change
Expand Up @@ -534,6 +534,40 @@ nouveau_hwmon_get_in0_input(struct device *d,
static SENSOR_DEVICE_ATTR(in0_input, S_IRUGO,
nouveau_hwmon_get_in0_input, NULL, 0);

static ssize_t
nouveau_hwmon_get_in0_min(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_volt *volt = nvxx_volt(&drm->device);

if (!volt || !volt->min_uv)
return -ENODEV;

return sprintf(buf, "%i\n", volt->min_uv / 1000);
}

static SENSOR_DEVICE_ATTR(in0_min, S_IRUGO,
nouveau_hwmon_get_in0_min, NULL, 0);

static ssize_t
nouveau_hwmon_get_in0_max(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_volt *volt = nvxx_volt(&drm->device);

if (!volt || !volt->max_uv)
return -ENODEV;

return sprintf(buf, "%i\n", volt->max_uv / 1000);
}

static SENSOR_DEVICE_ATTR(in0_max, S_IRUGO,
nouveau_hwmon_get_in0_max, NULL, 0);

static ssize_t
nouveau_hwmon_get_in0_label(struct device *d,
struct device_attribute *a, char *buf)
Expand Down Expand Up @@ -594,6 +628,8 @@ static struct attribute *hwmon_pwm_fan_attributes[] = {

static struct attribute *hwmon_in0_attributes[] = {
&sensor_dev_attr_in0_input.dev_attr.attr,
&sensor_dev_attr_in0_min.dev_attr.attr,
&sensor_dev_attr_in0_max.dev_attr.attr,
&sensor_dev_attr_in0_label.dev_attr.attr,
NULL
};
Expand Down

0 comments on commit b66ad32

Please sign in to comment.