Release 4.11 drivers/gpu/drm/nouveau/nouveau_hwmon.c
/*
* Copyright 2010 Red Hat Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*
* Authors: Ben Skeggs
*/
#ifdef CONFIG_ACPI
#include <linux/acpi.h>
#endif
#include <linux/power_supply.h>
#include <linux/hwmon.h>
#include <linux/hwmon-sysfs.h>
#include <drm/drmP.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_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->client.device);
int temp = nvkm_therm_temp_get(therm);
if (temp < 0)
return temp;
return snprintf(buf, PAGE_SIZE, "%d\n", temp * 1000);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Ben Skeggs | 77 | 89.53% | 12 | 85.71% |
Martin Peres | 9 | 10.47% | 2 | 14.29% |
Total | 86 | 100.00% | 14 | 100.00% |
static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, nouveau_hwmon_show_temp,
NULL, 0);
static ssize_t
nouveau_hwmon_show_temp1_auto_point1_pwm(struct device *d,
struct device_attribute *a, char *buf)
{
return snprintf(buf, PAGE_SIZE, "%d\n", 100);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Ben Skeggs | 32 | 100.00% | 3 | 100.00% |
Total | 32 | 100.00% | 3 | 100.00% |
static SENSOR_DEVICE_ATTR(temp1_auto_point1_pwm, S_IRUGO,
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->client.device);
return snprintf(buf, PAGE_SIZE, "%d\n",
therm->attr_get(therm, NVKM_THERM_ATTR_THRS_FAN_BOOST) * 1000);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Ben Skeggs | 76 | 100.00% | 11 | 100.00% |
Total | 76 | 100.00% | 11 | 100.00% |
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->client.device);
long value;
if (kstrtol(buf, 10, &value) == -EINVAL)
return count;
therm->attr_set(therm, NVKM_THERM_ATTR_THRS_FAN_BOOST,
value / 1000);
return count;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Ben Skeggs | 89 | 92.71% | 9 | 81.82% |
Martin Peres | 7 | 7.29% | 2 | 18.18% |
Total | 96 | 100.00% | 11 | 100.00% |
static SENSOR_DEVICE_ATTR(temp1_auto_point1_temp, S_IRUGO | S_IWUSR,
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->client.device);
return snprintf(buf, PAGE_SIZE, "%d\n",
therm->attr_get(therm, NVKM_THERM_ATTR_THRS_FAN_BOOST_HYST) * 1000);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Ben Skeggs | 76 | 100.00% | 10 | 100.00% |
Total | 76 | 100.00% | 10 | 100.00% |
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->client.device);
long value;
if (kstrtol(buf, 10, &value) == -EINVAL)
return count;
therm->attr_set(therm, NVKM_THERM_ATTR_THRS_FAN_BOOST_HYST,
value / 1000);
return count;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Ben Skeggs | 96 | 100.00% | 11 | 100.00% |
Total | 96 | 100.00% | 11 | 100.00% |
static SENSOR_DEVICE_ATTR(temp1_auto_point1_temp_hyst, S_IRUGO | S_IWUSR,
nouveau_hwmon_temp1_auto_point1_temp_hyst,
nouveau_hwmon_set_temp1_auto_point1_temp_hyst, 0);
static ssize_t
nouveau_hwmon_max_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->client.device);
return snprintf(buf, PAGE_SIZE, "%d\n",
therm->attr_get(therm, NVKM_THERM_ATTR_THRS_DOWN_CLK) * 1000);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Ben Skeggs | 75 | 98.68% | 10 | 90.91% |
Martin Peres | 1 | 1.32% | 1 | 9.09% |
Total | 76 | 100.00% | 11 | 100.00% |
static ssize_t
nouveau_hwmon_set_max_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->client.device);
long value;
if (kstrtol(buf, 10, &value) == -EINVAL)
return count;
therm->attr_set(therm, NVKM_THERM_ATTR_THRS_DOWN_CLK, value / 1000);
return count;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Ben Skeggs | 93 | 96.88% | 10 | 90.91% |
Martin Peres | 3 | 3.12% | 1 | 9.09% |
Total | 96 | 100.00% | 11 | 100.00% |
static SENSOR_DEVICE_ATTR(temp1_max, S_IRUGO | S_IWUSR, nouveau_hwmon_max_temp,
nouveau_hwmon_set_max_temp,
0);
static ssize_t
nouveau_hwmon_max_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->client.device);
return snprintf(buf, PAGE_SIZE, "%d\n",
therm->attr_get(therm, NVKM_THERM_ATTR_THRS_DOWN_CLK_HYST) * 1000);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Ben Skeggs | 70 | 92.11% | 9 | 90.00% |
Martin Peres | 6 | 7.89% | 1 | 10.00% |
Total | 76 | 100.00% | 10 | 100.00% |
static ssize_t
nouveau_hwmon_set_max_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->client.device);
long value;
if (kstrtol(buf, 10, &value) == -EINVAL)
return count;
therm->attr_set(therm, NVKM_THERM_ATTR_THRS_DOWN_CLK_HYST,
value / 1000);
return count;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Ben Skeggs | 87 | 90.62% | 12 | 85.71% |
Martin Peres | 9 | 9.38% | 2 | 14.29% |
Total | 96 | 100.00% | 14 | 100.00% |
static SENSOR_DEVICE_ATTR(temp1_max_hyst, S_IRUGO | S_IWUSR,
nouveau_hwmon_max_temp_hyst,
nouveau_hwmon_set_max_temp_hyst, 0);
static ssize_t
nouveau_hwmon_critical_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->client.device);
return snprintf(buf, PAGE_SIZE, "%d\n",
therm->attr_get(therm, NVKM_THERM_ATTR_THRS_CRITICAL) * 1000);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Ben Skeggs | 73 | 96.05% | 9 | 90.00% |
Martin Peres | 3 | 3.95% | 1 | 10.00% |
Total | 76 | 100.00% | 10 | 100.00% |
static ssize_t
nouveau_hwmon_set_critical_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->client.device);
long value;
if (kstrtol(buf, 10, &value) == -EINVAL)
return count;
therm->attr_set(therm, NVKM_THERM_ATTR_THRS_CRITICAL, value / 1000);
return count;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Ben Skeggs | 94 | 97.92% | 9 | 90.00% |
Francisco Jerez | 2 | 2.08% | 1 | 10.00% |
Total | 96 | 100.00% | 10 | 100.00% |
static SENSOR_DEVICE_ATTR(temp1_crit, S_IRUGO | S_IWUSR,
nouveau_hwmon_critical_temp,
nouveau_hwmon_set_critical_temp,
0);
static ssize_t
nouveau_hwmon_critical_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->client.device);
return snprintf(buf, PAGE_SIZE, "%d\n",
therm->attr_get(therm, NVKM_THERM_ATTR_THRS_CRITICAL_HYST) * 1000);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Ben Skeggs | 73 | 96.05% | 10 | 90.91% |
Martin Peres | 3 | 3.95% | 1 | 9.09% |
Total | 76 | 100.00% | 11 | 100.00% |
static ssize_t
nouveau_hwmon_set_critical_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->client.device);
long value;
if (kstrtol(buf, 10, &value) == -EINVAL)
return count;
therm->attr_set(therm, NVKM_THERM_ATTR_THRS_CRITICAL_HYST,
value / 1000);
return count;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Ben Skeggs | 96 | 100.00% | 13 | 100.00% |
Total | 96 | 100.00% | 13 | 100.00% |
static SENSOR_DEVICE_ATTR(temp1_crit_hyst, S_IRUGO | S_IWUSR,
nouveau_hwmon_critical_temp_hyst,
nouveau_hwmon_set_critical_temp_hyst, 0);
static ssize_t
nouveau_hwmon_emergency_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->client.device);
return snprintf(buf, PAGE_SIZE, "%d\n",
therm->attr_get(therm, NVKM_THERM_ATTR_THRS_SHUTDOWN) * 1000);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Ben Skeggs | 74 | 97.37% | 9 | 90.00% |
Francisco Jerez | 2 | 2.63% | 1 | 10.00% |
Total | 76 | 100.00% | 10 | 100.00% |
static ssize_t
nouveau_hwmon_set_emergency_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->client.device);
long value;
if (kstrtol(buf, 10, &value) == -EINVAL)
return count;
therm->attr_set(therm, NVKM_THERM_ATTR_THRS_SHUTDOWN, value / 1000);
return count;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Ben Skeggs | 95 | 98.96% | 9 | 90.00% |
Martin Peres | 1 | 1.04% | 1 | 10.00% |
Total | 96 | 100.00% | 10 | 100.00% |
static SENSOR_DEVICE_ATTR(temp1_emergency, S_IRUGO | S_IWUSR,
nouveau_hwmon_emergency_temp,
nouveau_hwmon_set_emergency_temp,
0);
static ssize_t
nouveau_hwmon_emergency_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->client.device);
return snprintf(buf, PAGE_SIZE, "%d\n",
therm->attr_get(therm, NVKM_THERM_ATTR_THRS_SHUTDOWN_HYST) * 1000);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Ben Skeggs | 76 | 100.00% | 8 | 100.00% |
Total | 76 | 100.00% | 8 | 100.00% |
static ssize_t
nouveau_hwmon_set_emergency_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->client.device);
long value;
if (kstrtol(buf, 10, &value) == -EINVAL)
return count;
therm->attr_set(therm, NVKM_THERM_ATTR_THRS_SHUTDOWN_HYST,
value / 1000);
return count;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Ben Skeggs | 78 | 81.25% | 9 | 75.00% |
Martin Peres | 18 | 18.75% | 3 | 25.00% |
Total | 96 | 100.00% | 12 | 100.00% |
static SENSOR_DEVICE_ATTR(temp1_emergency_hyst, S_IRUGO | S_IWUSR,
nouveau_hwmon_emergency_temp_hyst,
nouveau_hwmon_set_emergency_temp_hyst,
0);
static ssize_t nouveau_hwmon_show_name(struct device *dev,
struct device_attribute *attr,
char *buf)
{
return sprintf(buf, "nouveau\n");
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Martin Peres | 18 | 64.29% | 1 | 33.33% |
Ben Skeggs | 10 | 35.71% | 2 | 66.67% |
Total | 28 | 100.00% | 3 | 100.00% |
static SENSOR_DEVICE_ATTR(name, S_IRUGO, nouveau_hwmon_show_name, NULL, 0);
static ssize_t nouveau_hwmon_show_update_rate(struct device *dev,
struct device_attribute *attr,
char *buf)
{
return sprintf(buf, "1000\n");
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Ben Skeggs | 25 | 89.29% | 1 | 50.00% |
Martin Peres | 3 | 10.71% | 1 | 50.00% |
Total | 28 | 100.00% | 2 | 100.00% |
static SENSOR_DEVICE_ATTR(update_rate, S_IRUGO,
nouveau_hwmon_show_update_rate,
NULL, 0);
static ssize_t
nouveau_hwmon_show_fan1_input(struct device *d, struct device_attribute *attr,
char *buf)
{
struct drm_device *dev = dev_get_drvdata(d);
struct nouveau_drm *drm = nouveau_drm(dev);
struct nvkm_therm *therm = nvxx_therm(&drm->client.device);
return snprintf(buf, PAGE_SIZE, "%d\n", nvkm_therm_fan_sense(therm));
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Martin Peres | 62 | 88.57% | 1 | 14.29% |
Ben Skeggs | 8 | 11.43% | 6 | 85.71% |
Total | 70 | 100.00% | 7 | 100.00% |
static SENSOR_DEVICE_ATTR(fan1_input, S_IRUGO, nouveau_hwmon_show_fan1_input,
NULL, 0);
static ssize_t
nouveau_hwmon_get_pwm1_enable(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->client.device);
int ret;
ret = therm->attr_get(therm, NVKM_THERM_ATTR_FAN_MODE);
if (ret < 0)
return ret;
return sprintf(buf, "%i\n", ret);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Martin Peres | 51 | 57.95% | 1 | 14.29% |
Ben Skeggs | 37 | 42.05% | 6 | 85.71% |
Total | 88 | 100.00% | 7 | 100.00% |
static ssize_t
nouveau_hwmon_set_pwm1_enable(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->client.device);
long value;
int ret;
ret = kstrtol(buf, 10, &value);
if (ret)
return ret;
ret = therm->attr_set(therm, NVKM_THERM_ATTR_FAN_MODE, value);
if (ret)
return ret;
else
return count;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Ben Skeggs | 79 | 73.15% | 6 | 75.00% |
Martin Peres | 21 | 19.44% | 1 | 12.50% |
Jingoo Han | 8 | 7.41% | 1 | 12.50% |
Total | 108 | 100.00% | 8 | 100.00% |
static SENSOR_DEVICE_ATTR(pwm1_enable, S_IRUGO | S_IWUSR,
nouveau_hwmon_get_pwm1_enable,
nouveau_hwmon_set_pwm1_enable, 0);
static ssize_t
nouveau_hwmon_get_pwm1(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->client.device);
int ret;
ret = therm->fan_get(therm);
if (ret < 0)
return ret;
return sprintf(buf, "%i\n", ret);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Martin Peres | 56 | 65.12% | 1 | 16.67% |
Ben Skeggs | 30 | 34.88% | 5 | 83.33% |
Total | 86 | 100.00% | 6 | 100.00% |
static ssize_t
nouveau_hwmon_set_pwm1(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->client.device);
int ret = -ENODEV;
long value;
if (kstrtol(buf, 10, &value) == -EINVAL)
return -EINVAL;
ret = therm->fan_set(therm, value);
if (ret)
return ret;
return count;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Martin Peres | 84 | 77.78% | 1 | 16.67% |
Ben Skeggs | 24 | 22.22% | 5 | 83.33% |
Total | 108 | 100.00% | 6 | 100.00% |
static SENSOR_DEVICE_ATTR(pwm1, S_IRUGO | S_IWUSR,
nouveau_hwmon_get_pwm1,
nouveau_hwmon_set_pwm1, 0);
static ssize_t
nouveau_hwmon_get_pwm1_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_therm *therm = nvxx_therm(&drm->client.device);
int ret;
ret = therm->attr_get(therm, NVKM_THERM_ATTR_FAN_MIN_DUTY);
if (ret < 0)
return ret;
return sprintf(buf, "%i\n", ret);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Ben Skeggs | 58 | 65.91% | 8 | 72.73% |
Martin Peres | 30 | 34.09% | 3 | 27.27% |
Total | 88 | 100.00% | 11 | 100.00% |
static ssize_t
nouveau_hwmon_set_pwm1_min(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->client.device);
long value;
int ret;
if (kstrtol(buf, 10, &value) == -EINVAL)
return -EINVAL;
ret = therm->attr_set(therm, NVKM_THERM_ATTR_FAN_MIN_DUTY, value);
if (ret < 0)
return ret;
return count;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Martin Peres | 85 | 77.98% | 1 | 14.29% |
Ben Skeggs | 24 | 22.02% | 6 | 85.71% |
Total | 109 | 100.00% | 7 | 100.00% |
static SENSOR_DEVICE_ATTR(pwm1_min, S_IRUGO | S_IWUSR,
nouveau_hwmon_get_pwm1_min,
nouveau_hwmon_set_pwm1_min, 0);
static ssize_t
nouveau_hwmon_get_pwm1_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_therm *therm = nvxx_therm(&drm->client.device);
int ret;
ret = therm->attr_get(therm, NVKM_THERM_ATTR_FAN_MAX_DUTY);
if (ret < 0)
return ret;
return sprintf(buf, "%i\n", ret);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Martin Peres | 58 | 65.91% | 1 | 14.29% |
Ben Skeggs | 30 | 34.09% | 6 | 85.71% |
Total | 88 | 100.00% | 7 | 100.00% |
static ssize_t
nouveau_hwmon_set_pwm1_max(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->client.device);
long value;
int ret;
if (kstrtol(buf, 10, &value) == -EINVAL)
return -EINVAL;
ret = therm->attr_set(therm, NVKM_THERM_ATTR_FAN_MAX_DUTY, value);
if (ret < 0)
return ret;
return count;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Martin Peres | 86 | 78.90% | 1 | 14.29% |
Ben Skeggs | 23 | 21.10% | 6 | 85.71% |
Total | 109 | 100.00% | 7 | 100.00% |
static SENSOR_DEVICE_ATTR(pwm1_max, S_IRUGO | S_IWUSR,
nouveau_hwmon_get_pwm1_max,
nouveau_hwmon_set_pwm1_max, 0);
static ssize_t
nouveau_hwmon_get_in0_input(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->client.device);
int ret;
ret = nvkm_volt_get(volt);
if (ret < 0)
return ret;
return sprintf(buf, "%i\n", ret / 1000);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Karol Herbst | 84 | 97.67% | 1 | 50.00% |
Ben Skeggs | 2 | 2.33% | 1 | 50.00% |
Total | 86 | 100.00% | 2 | 100.00% |
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->client.device);
if (!volt || !volt->min_uv)
return -ENODEV;
return sprintf(buf, "%i\n", volt->min_uv / 1000);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Karol Herbst | 81 | 97.59% | 2 | 66.67% |
Ben Skeggs | 2 | 2.41% | 1 | 33.33% |
Total | 83 | 100.00% | 3 | 100.00% |
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->client.device);
if (!volt || !volt->max_uv)
return -ENODEV;
return sprintf(buf, "%i\n", volt->max_uv / 1000);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Karol Herbst | 81 | 97.59% | 1 | 50.00% |
Ben Skeggs | 2 | 2.41% | 1 | 50.00% |
Total | 83 | 100.00% | 2 | 100.00% |
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)
{
return sprintf(buf, "GPU core\n");
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Karol Herbst | 28 | 100.00% | 2 | 100.00% |
Total | 28 | 100.00% | 2 | 100.00% |
static SENSOR_DEVICE_ATTR(in0_label, S_IRUGO,
nouveau_hwmon_get_in0_label, NULL, 0);
static ssize_t
nouveau_hwmon_get_power1_input(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_iccsense *iccsense = nvxx_iccsense(&drm->client.device);
int result = nvkm_iccsense_read_all(iccsense);
if (result < 0)
return result;
return sprintf(buf, "%i\n", result);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Karol Herbst | 80 | 97.56% | 1 | 50.00% |
Ben Skeggs | 2 | 2.44% | 1 | 50.00% |
Total | 82 | 100.00% | 2 | 100.00% |
static SENSOR_DEVICE_ATTR(power1_input, S_IRUGO,
nouveau_hwmon_get_power1_input, NULL, 0);
static ssize_t
nouveau_hwmon_get_power1_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_iccsense *iccsense = nvxx_iccsense(&drm->client.device);
return sprintf(buf, "%i\n", iccsense->power_w_max);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Karol Herbst | 67 | 100.00% | 1 | 100.00% |
Total | 67 | 100.00% | 1 | 100.00% |
static SENSOR_DEVICE_ATTR(power1_max, S_IRUGO,
nouveau_hwmon_get_power1_max, NULL, 0);
static ssize_t
nouveau_hwmon_get_power1_crit(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_iccsense *iccsense = nvxx_iccsense(&drm->client.device);
return sprintf(buf, "%i\n", iccsense->power_w_crit);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Karol Herbst | 67 | 100.00% | 1 | 100.00% |
Total | 67 | 100.00% | 1 | 100.00% |
static SENSOR_DEVICE_ATTR(power1_crit, S_IRUGO,
nouveau_hwmon_get_power1_crit, NULL, 0);
static struct attribute *hwmon_default_attributes[] = {
&sensor_dev_attr_name.dev_attr.attr,
&sensor_dev_attr_update_rate.dev_attr.attr,
NULL
};
static struct attribute *hwmon_temp_attributes[] = {
&sensor_dev_attr_temp1_input.dev_attr.attr,
&sensor_dev_attr_temp1_auto_point1_pwm.dev_attr.attr,
&sensor_dev_attr_temp1_auto_point1_temp.dev_attr.attr,
&sensor_dev_attr_temp1_auto_point1_temp_hyst.dev_attr.attr,
&sensor_dev_attr_temp1_max.dev_attr.attr,
&sensor_dev_attr_temp1_max_hyst.dev_attr.attr,
&sensor_dev_attr_temp1_crit.dev_attr.attr,
&sensor_dev_attr_temp1_crit_hyst.dev_attr.attr,
&sensor_dev_attr_temp1_emergency.dev_attr.attr,
&sensor_dev_attr_temp1_emergency_hyst.dev_attr.attr,
NULL
};
static struct attribute *hwmon_fan_rpm_attributes[] = {
&sensor_dev_attr_fan1_input.dev_attr.attr,
NULL
};
static struct attribute *hwmon_pwm_fan_attributes[] = {
&sensor_dev_attr_pwm1_enable.dev_attr.attr,
&sensor_dev_attr_pwm1.dev_attr.attr,
&sensor_dev_attr_pwm1_min.dev_attr.attr,
&sensor_dev_attr_pwm1_max.dev_attr.attr,
NULL
};
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
};
static struct attribute *hwmon_power_attributes[] = {
&sensor_dev_attr_power1_input.dev_attr.attr,
NULL
};
static struct attribute *hwmon_power_caps_attributes[] = {
&sensor_dev_attr_power1_max.dev_attr.attr,
&sensor_dev_attr_power1_crit.dev_attr.attr,
NULL
};
static const struct attribute_group hwmon_default_attrgroup = {
.attrs = hwmon_default_attributes,
};
static const struct attribute_group hwmon_temp_attrgroup = {
.attrs = hwmon_temp_attributes,
};
static const struct attribute_group hwmon_fan_rpm_attrgroup = {
.attrs = hwmon_fan_rpm_attributes,
};
static const struct attribute_group hwmon_pwm_fan_attrgroup = {
.attrs = hwmon_pwm_fan_attributes,
};
static const struct attribute_group hwmon_in0_attrgroup = {
.attrs = hwmon_in0_attributes,
};
static const struct attribute_group hwmon_power_attrgroup = {
.attrs = hwmon_power_attributes,
};
static const struct attribute_group hwmon_power_caps_attrgroup = {
.attrs = hwmon_power_caps_attributes,
};
#endif
int
nouveau_hwmon_init(struct drm_device *dev)
{
#if defined(CONFIG_HWMON) || (defined(MODULE) && defined(CONFIG_HWMON_MODULE))
struct nouveau_drm *drm = nouveau_drm(dev);
struct nvkm_therm *therm = nvxx_therm(&drm->client.device);
struct nvkm_volt *volt = nvxx_volt(&drm->client.device);
struct nvkm_iccsense *iccsense = nvxx_iccsense(&drm->client.device);
struct nouveau_hwmon *hwmon;
struct device *hwmon_dev;
int ret = 0;
hwmon = drm->hwmon = kzalloc(sizeof(*hwmon), GFP_KERNEL);
if (!hwmon)
return -ENOMEM;
hwmon->dev = dev;
hwmon_dev = hwmon_device_register(dev->dev);
if (IS_ERR(hwmon_dev)) {
ret = PTR_ERR(hwmon_dev);
NV_ERROR(drm, "Unable to register hwmon device: %d\n", ret);
return ret;
}
dev_set_drvdata(hwmon_dev, dev);
/* set the default attributes */
ret = sysfs_create_group(&hwmon_dev->kobj, &hwmon_default_attrgroup);
if (ret)
goto error;
if (therm && therm->attr_get && therm->attr_set) {
/* if the card has a working thermal sensor */
if (nvkm_therm_temp_get(therm) >= 0) {
ret = sysfs_create_group(&hwmon_dev->kobj, &hwmon_temp_attrgroup);
if (ret)
goto error;
}
/* if the card has a pwm fan */
/*XXX: incorrect, need better detection for this, some boards have
* the gpio entries for pwm fan control even when there's no
* actual fan connected to it... therm table? */
if (therm->fan_get && therm->fan_get(therm) >= 0) {
ret = sysfs_create_group(&hwmon_dev->kobj,
&hwmon_pwm_fan_attrgroup);
if (ret)
goto error;
}
}
/* if the card can read the fan rpm */
if (therm && nvkm_therm_fan_sense(therm) >= 0) {
ret = sysfs_create_group(&hwmon_dev->kobj,
&hwmon_fan_rpm_attrgroup);
if (ret)
goto error;
}
if (volt && nvkm_volt_get(volt) >= 0) {
ret = sysfs_create_group(&hwmon_dev->kobj,
&hwmon_in0_attrgroup);
if (ret)
goto error;
}
if (iccsense && iccsense->data_valid && !list_empty(&iccsense->rails)) {
ret = sysfs_create_group(&hwmon_dev->kobj,
&hwmon_power_attrgroup);
if (ret)
goto error;
if (iccsense->power_w_max && iccsense->power_w_crit) {
ret = sysfs_create_group(&hwmon_dev->kobj,
&hwmon_power_caps_attrgroup);
if (ret)
goto error;
}
}
hwmon->hwmon = hwmon_dev;
return 0;
error:
NV_ERROR(drm, "Unable to create some hwmon sysfs files: %d\n", ret);
hwmon_device_unregister(hwmon_dev);
hwmon->hwmon = NULL;
return ret;
#else
return 0;
#endif
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Ben Skeggs | 261 | 56.86% | 11 | 57.89% |
Karol Herbst | 147 | 32.03% | 5 | 26.32% |
Martin Peres | 50 | 10.89% | 2 | 10.53% |
Roy Spliet | 1 | 0.22% | 1 | 5.26% |
Total | 459 | 100.00% | 19 | 100.00% |
void
nouveau_hwmon_fini(struct drm_device *dev)
{
#if defined(CONFIG_HWMON) || (defined(MODULE) && defined(CONFIG_HWMON_MODULE))
struct nouveau_hwmon *hwmon = nouveau_hwmon(dev);
if (hwmon->hwmon) {
sysfs_remove_group(&hwmon->hwmon->kobj, &hwmon_default_attrgroup);
sysfs_remove_group(&hwmon->hwmon->kobj, &hwmon_temp_attrgroup);
sysfs_remove_group(&hwmon->hwmon->kobj, &hwmon_pwm_fan_attrgroup);
sysfs_remove_group(&hwmon->hwmon->kobj, &hwmon_fan_rpm_attrgroup);
sysfs_remove_group(&hwmon->hwmon->kobj, &hwmon_in0_attrgroup);
sysfs_remove_group(&hwmon->hwmon->kobj, &hwmon_power_attrgroup);
sysfs_remove_group(&hwmon->hwmon->kobj, &hwmon_power_caps_attrgroup);
hwmon_device_unregister(hwmon->hwmon);
}
nouveau_drm(dev)->hwmon = NULL;
kfree(hwmon);
#endif
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Ben Skeggs | 98 | 61.25% | 6 | 54.55% |
Karol Herbst | 39 | 24.38% | 3 | 27.27% |
Martin Peres | 20 | 12.50% | 1 | 9.09% |
Roy Spliet | 3 | 1.88% | 1 | 9.09% |
Total | 160 | 100.00% | 11 | 100.00% |
Overall Contributors
Person | Tokens | Prop | Commits | CommitProp |
Ben Skeggs | 2562 | 60.03% | 27 | 57.45% |
Karol Herbst | 899 | 21.06% | 6 | 12.77% |
Martin Peres | 788 | 18.46% | 9 | 19.15% |
Jingoo Han | 8 | 0.19% | 1 | 2.13% |
Francisco Jerez | 6 | 0.14% | 2 | 4.26% |
Roy Spliet | 4 | 0.09% | 1 | 2.13% |
Linus Torvalds | 1 | 0.02% | 1 | 2.13% |
Total | 4268 | 100.00% | 47 | 100.00% |
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.