diff options
author | Dave Airlie <airlied@redhat.com> | 2016-01-11 04:48:18 +0300 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2016-01-11 04:48:18 +0300 |
commit | 57b4f7e68720e8a9f5e6e9e61446ec36822e4c57 (patch) | |
tree | e6143801b0e29d132695b8056872a4e56f5a699c /drivers/gpu/drm/nouveau/nouveau_hwmon.c | |
parent | b483666bb4939ee14501da9978e5f87e4aa22228 (diff) | |
parent | a18c91decee6ba4fc252bf82108adc1207dd1f86 (diff) | |
download | linux-57b4f7e68720e8a9f5e6e9e61446ec36822e4c57.tar.xz |
Merge branch 'linux-4.5' of git://github.com/skeggsb/linux into drm-next
- gk20a instmem fixes / improvements
- more gm10x vs gm20x differences deal with
- better support for high-frequency hdmi modes
- pstate control interfaces moved to debugfs
- support for pcie link speed changes
- misc other fixes across the board
* 'linux-4.5' of git://github.com/skeggsb/linux: (50 commits)
drm/nouveau/pmu: prevent falcon from acking interrupts routed to the host
drm/nouveau/perf: change pcie speed on pstate change
drm/nouveau/perf: add fields for pci speed and width and use it for the pstates
drm/nouveau/bios/perf: parse the pci speed from the bios for tesla and newer cards
drm/nouveau/pci: implement pcie speed change for kepler+
drm/nouveau/pci: implement pcie speed change for Fermi
drm/nouveau/pci: implement pcie speed change for tesla
drm/nouveau/pci: implement generic code for pcie speed change
drm/nouveau/pci: add gk104 variant
drm/nouveau/pci: add gf106 variant
drm/nouveau/kms: take mode_config mutex in connector hotplug path
drm/nouveau/nouveau/perfmon: add interface files for current core voltage
drm/nouveau/sysfs: remove pstate interface
drm/nouveau/debugfs: add copy of sysfs pstate interface ported to debugfs
drm/nouveau/debugfs: we need a ctrl object for debugfs
drm/nouveau/debugfs: rename functions to indicate they are used inside drm
drm/nouveau/debugfs: add infrastructure to add files with other fops than only read
drm/nouveau/fifo/gf100: remove references to "daemon"
drm/nouveau/fb/nv50: remove references to "daemon"
drm/nouveau/clk: remove references to "daemon"
...
Diffstat (limited to 'drivers/gpu/drm/nouveau/nouveau_hwmon.c')
-rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_hwmon.c | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/drivers/gpu/drm/nouveau/nouveau_hwmon.c b/drivers/gpu/drm/nouveau/nouveau_hwmon.c index 491c7149d197..8e13467d0ddb 100644 --- a/drivers/gpu/drm/nouveau/nouveau_hwmon.c +++ b/drivers/gpu/drm/nouveau/nouveau_hwmon.c @@ -34,6 +34,8 @@ #include "nouveau_drm.h" #include "nouveau_hwmon.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) @@ -512,6 +514,35 @@ 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->device); + int ret; + + ret = nvkm_volt_get(volt); + if (ret < 0) + return ret; + + return sprintf(buf, "%i\n", ret / 1000); +} + +static SENSOR_DEVICE_ATTR(in0_input, S_IRUGO, + nouveau_hwmon_get_in0_input, 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"); +} + +static SENSOR_DEVICE_ATTR(in0_label, S_IRUGO, + nouveau_hwmon_get_in0_label, NULL, 0); + static struct attribute *hwmon_default_attributes[] = { &sensor_dev_attr_name.dev_attr.attr, &sensor_dev_attr_update_rate.dev_attr.attr, @@ -542,6 +573,12 @@ static struct attribute *hwmon_pwm_fan_attributes[] = { NULL }; +static struct attribute *hwmon_in0_attributes[] = { + &sensor_dev_attr_in0_input.dev_attr.attr, + &sensor_dev_attr_in0_label.dev_attr.attr, + NULL +}; + static const struct attribute_group hwmon_default_attrgroup = { .attrs = hwmon_default_attributes, }; @@ -554,6 +591,9 @@ static const struct attribute_group hwmon_fan_rpm_attrgroup = { 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, +}; #endif int @@ -562,6 +602,7 @@ 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->device); + struct nvkm_volt *volt = nvxx_volt(&drm->device); struct nouveau_hwmon *hwmon; struct device *hwmon_dev; int ret = 0; @@ -613,6 +654,14 @@ nouveau_hwmon_init(struct drm_device *dev) goto error; } + if (volt && nvkm_volt_get(volt) >= 0) { + ret = sysfs_create_group(&hwmon_dev->kobj, + &hwmon_in0_attrgroup); + + if (ret) + goto error; + } + hwmon->hwmon = hwmon_dev; return 0; @@ -638,6 +687,7 @@ nouveau_hwmon_fini(struct drm_device *dev) 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); hwmon_device_unregister(hwmon->hwmon); } |