<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Helvetica,sans-serif;" dir="ltr">
<div id="divtagdefaultwrapper" dir="ltr" style="font-size: 12pt; color: rgb(0, 0, 0); font-family: Calibri, Helvetica, sans-serif, "EmojiFont", "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols;">
<p style="margin-top:0; margin-bottom:0">Series is:</p>
<p style="margin-top:0; margin-bottom:0">Reviewed-by: Alex Deucher <alexander.deucher@amd.com><br>
</p>
</div>
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="divRplyFwdMsg" dir="ltr"><font style="font-size:11pt" face="Calibri, sans-serif" color="#000000"><b>From:</b> amd-gfx <amd-gfx-bounces@lists.freedesktop.org> on behalf of Evan Quan <evan.quan@amd.com><br>
<b>Sent:</b> Monday, January 7, 2019 7:05:56 AM<br>
<b>To:</b> amd-gfx@lists.freedesktop.org<br>
<b>Cc:</b> Deucher, Alexander; Quan, Evan; Freehill, Chris<br>
<b>Subject:</b> [PATCH 2/2] drm/amd/powerplay: create pp_od_clk_voltage device file under OD support</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt">
<div class="PlainText">Since pp_od_clk_voltage device file is for OD related sysfs operations.<br>
<br>
Change-Id: I13e95b4bd2ffb93b1cd5d272dd27171ab38dbe57<br>
Signed-off-by: Evan Quan <evan.quan@amd.com><br>
---<br>
 drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c | 22 ++++++++++++++--------<br>
 1 file changed, 14 insertions(+), 8 deletions(-)<br>
<br>
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c<br>
index 32aa4d09e12d..d8f3f006f5c0 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c<br>
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c<br>
@@ -2061,6 +2061,7 @@ void amdgpu_pm_print_power_states(struct amdgpu_device *adev)<br>
 <br>
 int amdgpu_pm_sysfs_init(struct amdgpu_device *adev)<br>
 {<br>
+       struct pp_hwmgr *hwmgr = adev->powerplay.pp_handle;<br>
         int ret;<br>
 <br>
         if (adev->pm.sysfs_initialized)<br>
@@ -2144,12 +2145,14 @@ int amdgpu_pm_sysfs_init(struct amdgpu_device *adev)<br>
                                 "pp_power_profile_mode\n");<br>
                 return ret;<br>
         }<br>
-       ret = device_create_file(adev->dev,<br>
-                       &dev_attr_pp_od_clk_voltage);<br>
-       if (ret) {<br>
-               DRM_ERROR("failed to create device file "<br>
-                               "pp_od_clk_voltage\n");<br>
-               return ret;<br>
+       if (hwmgr->od_enabled) {<br>
+               ret = device_create_file(adev->dev,<br>
+                               &dev_attr_pp_od_clk_voltage);<br>
+               if (ret) {<br>
+                       DRM_ERROR("failed to create device file "<br>
+                                       "pp_od_clk_voltage\n");<br>
+                       return ret;<br>
+               }<br>
         }<br>
         ret = device_create_file(adev->dev,<br>
                         &dev_attr_gpu_busy_percent);<br>
@@ -2171,6 +2174,8 @@ int amdgpu_pm_sysfs_init(struct amdgpu_device *adev)<br>
 <br>
 void amdgpu_pm_sysfs_fini(struct amdgpu_device *adev)<br>
 {<br>
+       struct pp_hwmgr *hwmgr = adev->powerplay.pp_handle;<br>
+<br>
         if (adev->pm.dpm_enabled == 0)<br>
                 return;<br>
 <br>
@@ -2191,8 +2196,9 @@ void amdgpu_pm_sysfs_fini(struct amdgpu_device *adev)<br>
         device_remove_file(adev->dev, &dev_attr_pp_mclk_od);<br>
         device_remove_file(adev->dev,<br>
                         &dev_attr_pp_power_profile_mode);<br>
-       device_remove_file(adev->dev,<br>
-                       &dev_attr_pp_od_clk_voltage);<br>
+       if (hwmgr->od_enabled)<br>
+               device_remove_file(adev->dev,<br>
+                               &dev_attr_pp_od_clk_voltage);<br>
         device_remove_file(adev->dev, &dev_attr_gpu_busy_percent);<br>
 }<br>
 <br>
-- <br>
2.20.1<br>
<br>
_______________________________________________<br>
amd-gfx mailing list<br>
amd-gfx@lists.freedesktop.org<br>
<a href="https://lists.freedesktop.org/mailman/listinfo/amd-gfx" id="LPlnk485764" class="OWAAutoLink" previewremoved="true">https://lists.freedesktop.org/mailman/listinfo/amd-gfx</a>
<div id="LPBorder_GT_15468758038300.14527155426370342" style="margin-bottom: 20px; overflow: auto; width: 100%; text-indent: 0px;">
<table id="LPContainer_15468758038220.2871215569580159" style="width: 90%; background-color: rgb(255, 255, 255); position: relative; overflow: auto; padding-top: 20px; padding-bottom: 20px; margin-top: 20px; border-top: 1px dotted rgb(200, 200, 200); border-bottom: 1px dotted rgb(200, 200, 200);" role="presentation" cellspacing="0">
<tbody>
<tr style="border-spacing: 0px;" valign="top">
<td id="TextCell_15468758038250.4709368499858746" style="vertical-align: top; position: relative; padding: 0px; display: table-cell;" colspan="2">
<div id="LPRemovePreviewContainer_15468758038250.9884691238894818"></div>
<div id="LPTitle_15468758038250.8872406513163204" style="top: 0px; color: rgb(0, 120, 215); font-weight: 400; font-size: 21px; font-family: "wf_segoe-ui_light", "Segoe UI Light", "Segoe WP Light", "Segoe UI", "Segoe WP", Tahoma, Arial, sans-serif; line-height: 21px;">
<a id="LPUrlAnchor_15468758038270.8873306148069501" style="text-decoration: none;" href="https://lists.freedesktop.org/mailman/listinfo/amd-gfx" target="_blank">amd-gfx Info Page - freedesktop.org</a></div>
<div id="LPMetadata_15468758038280.9582781105438307" style="margin: 10px 0px 16px; color: rgb(102, 102, 102); font-weight: 400; font-family: "wf_segoe-ui_normal", "Segoe UI", "Segoe WP", Tahoma, Arial, sans-serif; font-size: 14px; line-height: 14px;">
lists.freedesktop.org</div>
<div id="LPDescription_15468758038290.42655363592050144" style="display: block; color: rgb(102, 102, 102); font-weight: 400; font-family: "wf_segoe-ui_normal", "Segoe UI", "Segoe WP", Tahoma, Arial, sans-serif; font-size: 14px; line-height: 20px; max-height: 100px; overflow: hidden;">
To see the collection of prior postings to the list, visit the amd-gfx Archives.. Using amd-gfx: To post a message to all the list members, send email to amd-gfx@lists.freedesktop.org. You can subscribe to the list, or change your existing subscription, in
 the sections below.</div>
</td>
</tr>
</tbody>
</table>
</div>
<br>
</div>
</span></font></div>
</div>
</body>
</html>