drm/amdgpu: add sysfs for current gpu voltage.
Subsystems (2)
PATCH 2/2 drm/amdgpu: add sysfs for current gpu voltage.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_dpm.h | 4 +++ drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c | 50 +++++++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_dpm.h +4 -0
@@ -414,6 +414,10 @@ struct amdgpu_dpm_funcs { ((adev)->powerplay.pp_funcs->switch_power_profile (\ (adev)->powerplay.pp_handle, type)) +#define amdgpu_get_voltage (adev, type, vol) \ + ((adev)->powerplay.pp_funcs->get_gpu_voltage(\ + (adev)->powerplay.pp_handle, type, vol)) +struct amdgpu_dpm {struct amdgpu_ps *ps;/* number of valid power states */
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +50 -0
68 lines not on this page · raw message
Signature · 6 lines
1.9.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 1496996392-25230-1-git-send-email-Rex.Zhu-5C7GfCeVMHo@public.gmane.org
Am 09.06.2017 um 10:19 schrieb Rex Zhu:
Quoted 12 lines
Change-Id I348f9307c8e03e193df481e6c9faf234039d97b5Signed-off-by Rex Zhu <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_dpm.h | 4 +++ drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c | 50 +++++++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+)drivers/gpu/drm/amd/amdgpu/amdgpu_dpm.h +0
-0
drivers/gpu/drm/amd/amdgpu/amdgpu_dpm.h struct amdgpu_dpm_funcs { · line 420
Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_dpm.h +4
-0@@ -414,6 +414,10 @@ struct amdgpu_dpm_funcs { ((adev)->powerplay.pp_funcs->switch_power_profile (\ (adev)->powerplay.pp_handle, type)) +#define amdgpu_get_voltage (adev, type, vol) \ + ((adev)->powerplay.pp_funcs->get_gpu_voltage(\ + (adev)->powerplay.pp_handle, type, vol)) +
Could we keep the amdgpu_dpm_ prefix here?
Apart from that the change looks good to me, but Alex should probably take a look as well.
Regards,
Christian.
Quoted 70 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_dpm.h +0
-0struct amdgpu_dpm {struct amdgpu_ps *ps;/* number of valid power states */ drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +48
-0@@ -958,6 +958,52 @@ static ssize_t amdgpu_hwmon_get_fan1_input(struct device *dev,return sprintf (buf,"%i\n" , speed); } + +static ssize_t amdgpu_hwmon_show_vddc (struct device *dev, +struct device_attribute *attr, +char *buf) +{ +struct amdgpu_device *adev =dev_get_drvdata (dev); +u32 vol =0 ; + +if (adev->pp_enabled) +amdgpu_get_voltage (adev,PP_VDDC , &vol); + +return sprintf (buf,"%i\n" , vol >>15 );/* voltage in unit of mv */ + +} + + +static ssize_t amdgpu_hwmon_set_vddc (struct device *dev, +struct device_attribute *attr, +const char *buf,size_t count) +{ +/* to do */ +return count; +} + +static ssize_t amdgpu_hwmon_show_vddci (struct device *dev, +struct device_attribute *attr, +char *buf) +{ +struct amdgpu_device *adev =dev_get_drvdata (dev); +u32 vol =0 ; + +if (adev->pp_enabled) +amdgpu_get_voltage (adev,PP_VDDCI , &vol); + +return sprintf (buf,"%i\n" , vol >>15 );/* voltage in unit of mv */ +} + + +static ssize_t amdgpu_hwmon_set_vddci (struct device *dev, +struct device_attribute *attr, +const char *buf,size_t count) +{ +/* to do */ +return count; +} + static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, amdgpu_hwmon_show_temp, NULL, 0); static SENSOR_DEVICE_ATTR(temp1_crit, S_IRUGO, amdgpu_hwmon_show_temp_thresh, NULL, 0); static SENSOR_DEVICE_ATTR(temp1_crit_hyst, S_IRUGO, amdgpu_hwmon_show_temp_thresh, NULL, 1);@@ -966,6 +1012,8 @@ static ssize_t amdgpu_hwmon_get_fan1_input(struct device *dev, static SENSOR_DEVICE_ATTR(pwm1_min, S_IRUGO, amdgpu_hwmon_get_pwm1_min, NULL, 0); static SENSOR_DEVICE_ATTR(pwm1_max, S_IRUGO, amdgpu_hwmon_get_pwm1_max, NULL, 0); static SENSOR_DEVICE_ATTR(fan1_input, S_IRUGO, amdgpu_hwmon_get_fan1_input, NULL, 0); +static SENSOR_DEVICE_ATTR(in0_input, S_IRUGO | S_IWUSR, amdgpu_hwmon_show_vddc, amdgpu_hwmon_set_vddc, 0); +static SENSOR_DEVICE_ATTR(in1_input, S_IRUGO | S_IWUSR, amdgpu_hwmon_show_vddci, amdgpu_hwmon_set_vddci, 0);static struct attribute *hwmon_attributes[] = { &sensor_dev_attr_temp1_input.dev_attr.attr,
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c static ssize_t amdgpu_hwmon_get_fan1_input(struct device *dev, · line 1031
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +2
-0@@ -976,6 +1024,8 @@ static ssize_t amdgpu_hwmon_get_fan1_input(struct device *dev, &sensor_dev_attr_pwm1_min.dev_attr.attr, &sensor_dev_attr_pwm1_max.dev_attr.attr, &sensor_dev_attr_fan1_input.dev_attr.attr, + &sensor_dev_attr_in0_input.dev_attr.attr, + &sensor_dev_attr_in1_input.dev_attr.attr, NULL };
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Quoted 7 lines
-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of Rex Zhu
Sent: Friday, June 09, 2017 4:20 AM
To: [email protected]
Cc: Zhu, Rex
Subject: [PATCH 2/2] drm/amdgpu: add sysfs for current gpu voltage.
Do we want to expose this via sysfs? Why not just include it in the debugfs amdgpu_pm_info file along with all the other power info? This seems inconsistent.
Alex
Quoted 115 lines
Change-Id I348f9307c8e03e193df481e6c9faf234039d97b5Signed-off-by Rex Zhu <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_dpm.h | 4 +++ drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c | 50 +++++++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+)drivers/gpu/drm/amd/amdgpu/amdgpu_dpm.h +4
-0@@ -414,6 +414,10 @@ struct amdgpu_dpm_funcs { ((adev)->powerplay.pp_funcs->switch_power_profile (\ (adev)->powerplay.pp_handle, type)) +#define amdgpu_get_voltage (adev, type, vol) \ + ((adev)->powerplay.pp_funcs->get_gpu_voltage(\ + (adev)->powerplay.pp_handle, type, vol)) +struct amdgpu_dpm {struct amdgpu_ps *ps;/* number of valid power states */ drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +46
-0@@ -958,6 +958,52 @@ static ssize_t amdgpu_hwmon_get_fan1_input(struct device *dev, return sprintf(buf, "%i\n", speed); } + +static ssize_t amdgpu_hwmon_show_vddc (struct device *dev, +struct device_attribute *attr, +char *buf) +{ +struct amdgpu_device *adev =dev_get_drvdata (dev); +u32 vol =0 ; + +if (adev->pp_enabled) +amdgpu_get_voltage (adev,PP_VDDC , &vol); + +return sprintf (buf,"%i\n" , vol >>15 );/* voltage in unit of mv */ + +} + + +static ssize_t amdgpu_hwmon_set_vddc (struct device *dev, +struct device_attribute *attr, +const char *buf,size_t count) +{ +/* to do */ +return count; +} + +static ssize_t amdgpu_hwmon_show_vddci (struct device *dev, +struct device_attribute *attr, +char *buf) +{ +struct amdgpu_device *adev =dev_get_drvdata (dev); +u32 vol =0 ; + +if (adev->pp_enabled) +amdgpu_get_voltage (adev,PP_VDDCI , &vol); + +return sprintf (buf,"%i\n" , vol >>15 );/* voltage in unit of mv */ +} + + +static ssize_t amdgpu_hwmon_set_vddci (struct device *dev, +struct device_attribute *attr, +const char *buf,size_t count) +{ +/* to do */ +return count; +} + static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, amdgpu_hwmon_show_temp, NULL, 0);static SENSOR_DEVICE_ATTR(temp1_crit,
S_IRUGO,amdgpu_hwmon_show_temp_thresh, NULL, 0);
static SENSOR_DEVICE_ATTR(temp1_crit_hyst,S_IRUGO,amdgpu_hwmon_show_temp_thresh, NULL, 1);drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +0
-0@@ -966,6 +1012,8 @@ static ssize_t amdgpu_hwmon_get_fan1_input(struct device *dev, static SENSOR_DEVICE_ATTR(pwm1_min, S_IRUGO, amdgpu_hwmon_get_pwm1_min, NULL, 0); static SENSOR_DEVICE_ATTR(pwm1_max, S_IRUGO, amdgpu_hwmon_get_pwm1_max, NULL, 0); static SENSOR_DEVICE_ATTR(fan1_input, S_IRUGO,
amdgpu_hwmon_get_fan1_input, NULL, 0);
+staticSENSOR_DEVICE_ATTR(in0_input, S_IRUGO | S_IWUSR, amdgpu_hwmon_show_vddc, amdgpu_hwmon_set_vddc, 0); +staticSENSOR_DEVICE_ATTR(in1_input, S_IRUGO | S_IWUSR, amdgpu_hwmon_show_vddci, amdgpu_hwmon_set_vddci, 0);static struct attribute *hwmon_attributes[] = {
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +2
-1&sensor_dev_attr_temp1_input.dev_attr.attr,@@ -976,6 +1024,8 @@ static ssize_t amdgpu_hwmon_get_fan1_input(struct device *dev, &sensor_dev_attr_pwm1_min.dev_attr.attr, &sensor_dev_attr_pwm1_max.dev_attr.attr, &sensor_dev_attr_fan1_input.dev_attr.attr, + &sensor_dev_attr_in0_input.dev_attr.attr, + &sensor_dev_attr_in1_input.dev_attr.attr, NULL }; --1.9.1
Quoted 4 lines
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx