.. | .. |
---|
29 | 29 | #include <linux/hwmon.h> |
---|
30 | 30 | #include <linux/hwmon-sysfs.h> |
---|
31 | 31 | |
---|
32 | | -#include <drm/drmP.h> |
---|
33 | | - |
---|
34 | 32 | #include "nouveau_drv.h" |
---|
35 | 33 | #include "nouveau_hwmon.h" |
---|
36 | 34 | |
---|
.. | .. |
---|
428 | 426 | |
---|
429 | 427 | switch (attr) { |
---|
430 | 428 | case hwmon_temp_input: |
---|
| 429 | + if (drm_dev->switch_power_state != DRM_SWITCH_POWER_ON) |
---|
| 430 | + return -EINVAL; |
---|
431 | 431 | ret = nvkm_therm_temp_get(therm); |
---|
432 | 432 | *val = ret < 0 ? ret : (ret * 1000); |
---|
433 | 433 | break; |
---|
.. | .. |
---|
474 | 474 | |
---|
475 | 475 | switch (attr) { |
---|
476 | 476 | case hwmon_fan_input: |
---|
| 477 | + if (drm_dev->switch_power_state != DRM_SWITCH_POWER_ON) |
---|
| 478 | + return -EINVAL; |
---|
477 | 479 | *val = nvkm_therm_fan_sense(therm); |
---|
478 | 480 | break; |
---|
479 | 481 | default: |
---|
.. | .. |
---|
496 | 498 | |
---|
497 | 499 | switch (attr) { |
---|
498 | 500 | case hwmon_in_input: |
---|
| 501 | + if (drm_dev->switch_power_state != DRM_SWITCH_POWER_ON) |
---|
| 502 | + return -EINVAL; |
---|
499 | 503 | ret = nvkm_volt_get(volt); |
---|
500 | 504 | *val = ret < 0 ? ret : (ret / 1000); |
---|
501 | 505 | break; |
---|
.. | .. |
---|
527 | 531 | *val = therm->attr_get(therm, NVKM_THERM_ATTR_FAN_MODE); |
---|
528 | 532 | break; |
---|
529 | 533 | case hwmon_pwm_input: |
---|
| 534 | + if (drm_dev->switch_power_state != DRM_SWITCH_POWER_ON) |
---|
| 535 | + return -EINVAL; |
---|
530 | 536 | *val = therm->fan_get(therm); |
---|
531 | 537 | break; |
---|
532 | 538 | default: |
---|
.. | .. |
---|
548 | 554 | |
---|
549 | 555 | switch (attr) { |
---|
550 | 556 | case hwmon_power_input: |
---|
| 557 | + if (drm_dev->switch_power_state != DRM_SWITCH_POWER_ON) |
---|
| 558 | + return -EINVAL; |
---|
551 | 559 | *val = nvkm_iccsense_read_all(iccsense); |
---|
552 | 560 | break; |
---|
553 | 561 | case hwmon_power_max: |
---|
.. | .. |
---|
733 | 741 | special_groups[i++] = &pwm_fan_sensor_group; |
---|
734 | 742 | } |
---|
735 | 743 | |
---|
736 | | - special_groups[i] = 0; |
---|
| 744 | + special_groups[i] = NULL; |
---|
737 | 745 | hwmon_dev = hwmon_device_register_with_info(dev->dev, "nouveau", dev, |
---|
738 | 746 | &nouveau_chip_info, |
---|
739 | 747 | special_groups); |
---|