summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/nouveau/nouveau_hwmon.c
AgeCommit message (Collapse)AuthorFilesLines
2023-05-22drm/nouveau: constify pointers to hwmon_channel_infoKrzysztof Kozlowski1-1/+1
Statically allocated array of pointers to hwmon_channel_info can be made const for safety. Reviewed-by: Lyude Paul <lyude@redhat.com> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Signed-off-by: Karol Herbst <kherbst@redhat.com> Link: https://patchwork.freedesktop.org/patch/msgid/20230511175443.281970-1-krzysztof.kozlowski@linaro.org
2023-03-07drm/nouveau/hwmon: Use sysfs_emit in show function callsbacksDeepak R Varma1-5/+5
According to Documentation/filesystems/sysfs.rst, the show() callback function of kobject attributes should strictly use sysfs_emit() instead of sprintf() family functions. So, make this change. Issue identified using the coccinelle device_attr_show.cocci script. Signed-off-by: Deepak R Varma <drv@mailo.com> Reviewed-by: Ashutosh Dixit <ashutosh.dixit@intel.com> Reviewed-by: Lyude Paul <lyude@redhat.com> Signed-off-by: Lyude Paul <lyude@redhat.com> Link: https://patchwork.freedesktop.org/patch/msgid/Y/+pDaHOgG1x8Py2@ubun2204.myguest.virtualbox.org
2022-08-23drm/nouveau/hwmon: use simplified HWMON_CHANNEL_INFO macroBeniamin Sandu1-68/+17
This makes the code look cleaner and easier to read. Signed-off-by: Beniamin Sandu <beniaminsandu@gmail.com> Reviewed-by: Lyude Paul <lyude@redhat.com> Signed-off-by: Lyude Paul <lyude@redhat.com> Link: https://patchwork.freedesktop.org/patch/msgid/20220815104028.381271-1-beniaminsandu@gmail.com
2020-01-15drm/nouveau: use NULL for pointer assignment.Wambui Karuga1-1/+1
Replace the use of 0 in the pointer assignment with NULL to address the following sparse warning: drivers/gpu/drm/nouveau/nouveau_hwmon.c:744:29: warning: Using plain integer as NULL pointer Signed-off-by: Wambui Karuga <wambui.karugax@gmail.com> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch> Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2019-08-23drm/nouveau: drop use of drmp.hSam Ravnborg1-2/+0
Drop use of the deprecated drmP.h file from drm/nouveau. Build tested using allyesconfig and allmodconfig. Signed-off-by: Sam Ravnborg <sam@ravnborg.org> Cc: Ben Skeggs <bskeggs@redhat.com> Cc: nouveau@lists.freedesktop.org Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2019-07-19drm/nouveau/hwmon: return EINVAL if the GPU is powered down for sensors readsKarol Herbst1-0/+10
fixes bogus values userspace gets from hwmon while the GPU is powered down Signed-off-by: Karol Herbst <kherbst@redhat.com> Reviewed-by: Rhys Kidd <rhyskidd@gmail.com> Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2018-07-16drm/nouveau/hwmon: potential uninitialized variablesDan Carpenter1-6/+6
Smatch complains that "value" can be uninitialized when kstrtol() returns -ERANGE. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2018-05-18drm/nouveau: fix temp/pwm visibility, skip hwmon when no sensors existIlia Mirkin1-3/+13
A NV34 GPU was seeing temp and pwm entries in hwmon, which would error out when read. These should not have been visible, but also the whole hwmon object should just not have been registered in the first place. Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu> Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2017-06-16drm/nouveau/hwmon: Change permissions to numericOscar Salvador1-5/+5
This patch replaces the symbolic permissions with the numeric ones. Signed-off-by: Oscar Salvador <osalvador.vilardaga@gmail.com> Reviewed-by: Martin Peres <martin.peres@free.fr> Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2017-06-16drm/nouveau/hwmon: expose the auto_point and pwm_min/max attrsOscar Salvador1-1/+33
This patch creates a special group attributes for attrs like "*auto_point*". We check if we have support for them, and if we do, we gather them all in an attribute_group's structure which is the parameter regarding special groups of hwmon_device_register_with_info We also do the same for pwm_min/max attrs. Signed-off-by: Oscar Salvador <osalvador.vilardaga@gmail.com> Reviewed-by: Martin Peres <martin.peres@free.fr> Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2017-06-16drm/nouveau/hwmon: Remove old code, add .write/.read operationsOscar Salvador1-583/+261
This patch removes old code related to the old api and transforms the functions for the new api. It also adds the .write and .read operations. Signed-off-by: Oscar Salvador <osalvador.vilardaga@gmail.com> Reviewed-by: Martin Peres <martin.peres@free.fr> Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2017-06-16drm/nouveau/hwmon: Add nouveau_hwmon_ops structure with .is_visible/.read_stringOscar Salvador1-0/+163
This patch introduces the nouveau_hwmon_ops structure, sets up .is_visible and .read_string operations and adds all the functions for these operations. This is also a preparation for the next patches, where most of the work is being done. This code doesn't interacture with the old one. It's just to make easier the review of all patches. Signed-off-by: Oscar Salvador <osalvador.vilardaga@gmail.com> Reviewed-by: Martin Peres <martin.peres@free.fr> Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2017-06-16drm/nouveau/hwmon: Add config for all sensors and their settingsOscar Salvador1-0/+72
This is a preparation for the next patches. It just adds the sensors with their possible configurable settings and then fills the struct hwmon_channel_info with all this information. Signed-off-by: Oscar Salvador <osalvador.vilardaga@gmail.com> Reviewed-by: Martin Peres <martin.peres@free.fr> Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2017-02-17drm/nouveau/hwmon: expose power_max and power_critKarol Herbst1-0/+44
Signed-off-by: Karol Herbst <karolherbst@gmail.com> Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2017-02-17drm/nouveau: allocate device object for every clientBen Skeggs1-33/+33
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2016-07-14drm/nouveau/hwmon: add in_min and in_maxKarol Herbst1-0/+36
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>
2016-05-20drm/nouveau/iccsense: convert to linked listKarol Herbst1-1/+1
v2: add list_del calls Signed-off-by: Karol Herbst <nouveau@karolherbst.de> Reviewed-by: Martin Peres <martin.peres@free.fr> Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2016-05-20drm/nouveau: rename nouveau_drm.h to nouveau_drv.hBen Skeggs1-1/+1
Fixes out-of-tree build issue where uapi/drm/nouveau_drm.h gets picked up instead. Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2016-03-14drm/nouveau/hwmon: fix crash on non-PCI platformsAlexandre Courbot1-1/+1
Registration of the hwmon device will fail on non-PCI systems since dev->pdev is NULL in that case. Use the more generic drm_device::dev member that points to the same and is always set no matter the platform. Signed-off-by: Alexandre Courbot <acourbot@nvidia.com> Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2016-03-14drm/nouveau/hwmon: don't require therm to be valid to get any dataKarol Herbst1-20/+19
Signed-off-by: Karol Herbst <nouveau@karolherbst.de> Reviewed-by: Martin Peres <martin.peres@free.fr>
2016-03-14drm/nouveau/hwmon: add power consumptionKarol Herbst1-0/+36
v2: expose only if the sensor reading is valid Signed-off-by: Karol Herbst <nouveau@karolherbst.de> Reviewed-by: Martin Peres <martin.peres@free.fr>
2016-01-11drm/nouveau/nouveau/perfmon: add interface files for current core voltageKarol Herbst1-0/+50
Signed-off-by: Karol Herbst <nouveau@karolherbst.de> Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2015-08-28drm/nouveau/therm: convert to new-style nvkm_subdevBen Skeggs1-5/+5
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2015-01-22drm/nouveau: finalise nvkm namespace switch (no binary change)Ben Skeggs1-27/+27
The namespace of NVKM is being changed to nvkm_ instead of nouveau_, which will be used for the DRM part of the driver. This is being done in order to make it very clear as to what part of the driver a given symbol belongs to, and as a minor step towards splitting the DRM driver out to be able to stand on its own (for virt). Because there's already a large amount of churn here anyway, this is as good a time as any to also switch to NVIDIA's device and chipset naming to ease collaboration with them. A comparison of objdump disassemblies proves no code changes. Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2015-01-22drm/nouveau/therm: namespace + nvidia gpu names (no binary change)Ben Skeggs1-22/+22
The namespace of NVKM is being changed to nvkm_ instead of nouveau_, which will be used for the DRM part of the driver. This is being done in order to make it very clear as to what part of the driver a given symbol belongs to, and as a minor step towards splitting the DRM driver out to be able to stand on its own (for virt). Because there's already a large amount of churn here anyway, this is as good a time as any to also switch to NVIDIA's device and chipset naming to ease collaboration with them. A comparison of objdump disassemblies proves no code changes. Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2015-01-22drm/nouveau/nvif: namespace of nvkm accessors (no binary change)Ben Skeggs1-27/+27
NVKM is having it's namespace switched to nvkm_, which will conflict with these functions (which are workarounds for the fact that as of yet, we still aren't able to split DRM and NVKM completely). A comparison of objdump disassemblies proves no code changes. Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-08-09drm/nouveau: port to nvif client/device/objectsBen Skeggs1-4/+0
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-08-09drm/nouveau: initial pass at moving to struct nvif_deviceBen Skeggs1-27/+27
This is an attempt at isolating some of the changes necessary to port to NVIF in a separate commit. Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-03-26drm/nouveau/hwmon: replace strict_strtol() with kstrtol()Jingoo Han1-2/+3
The usage of strict_strtol() is not preferred, because strict_strtol() is obsolete. Thus, kstrtol() should be used. Signed-off-by: Jingoo Han <jg1.han@samsung.com> Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-03-26drm/nouveau/hwmon: remove some redundant checksDan Carpenter1-8/+4
No need to check "ret" twice in a row. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2013-11-28drm/nouveau/hwmon: fix compilation without CONFIG_HWMONIlia Mirkin1-1/+0
Reported-by: Jim Davis <jim.epost@gmail.com> Tested-by: Jim Davis <jim.epost@gmail.com> Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu> Signed-off-by: Dave Airlie <airlied@redhat.com>
2013-11-08drm/nouveau/drm/pm: remove everything except the hwmon interfaces to THERMBen Skeggs1-0/+656
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>