diff mbox

[02/22] drm/radeon/dpm: add new callbacks to get the current sclk/mclk

Message ID 1412177907-24601-3-git-send-email-alexander.deucher@amd.com (mailing list archive)
State New, archived
Headers show

Commit Message

Alex Deucher Oct. 1, 2014, 3:38 p.m. UTC
Needed to to expose the current clocks via the INFO ioctl.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 drivers/gpu/drm/radeon/radeon.h | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Christian König Oct. 2, 2014, 12:26 p.m. UTC | #1
Might be a good idea to make that a bit more generic, e.g. add a 
get_current_clk callback and and a type (sclk, mclk, vclk, dclk, etc..) 
enum. But I can live with this approach as well.

Christian.

Am 01.10.2014 um 17:38 schrieb Alex Deucher:
> Needed to to expose the current clocks via the INFO ioctl.
>
> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
> ---
>   drivers/gpu/drm/radeon/radeon.h | 4 ++++
>   1 file changed, 4 insertions(+)
>
> diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h
> index 510fe96..9e3dc82 100644
> --- a/drivers/gpu/drm/radeon/radeon.h
> +++ b/drivers/gpu/drm/radeon/radeon.h
> @@ -1935,6 +1935,8 @@ struct radeon_asic {
>   		bool (*vblank_too_short)(struct radeon_device *rdev);
>   		void (*powergate_uvd)(struct radeon_device *rdev, bool gate);
>   		void (*enable_bapm)(struct radeon_device *rdev, bool enable);
> +		u32 (*get_current_sclk)(struct radeon_device *rdev);
> +		u32 (*get_current_mclk)(struct radeon_device *rdev);
>   	} dpm;
>   	/* pageflipping */
>   	struct {
> @@ -2893,6 +2895,8 @@ static inline void radeon_ring_write(struct radeon_ring *ring, uint32_t v)
>   #define radeon_dpm_vblank_too_short(rdev) rdev->asic->dpm.vblank_too_short((rdev))
>   #define radeon_dpm_powergate_uvd(rdev, g) rdev->asic->dpm.powergate_uvd((rdev), (g))
>   #define radeon_dpm_enable_bapm(rdev, e) rdev->asic->dpm.enable_bapm((rdev), (e))
> +#define radeon_dpm_get_current_sclk(rdev) rdev->asic->dpm.get_current_sclk((rdev))
> +#define radeon_dpm_get_current_mclk(rdev) rdev->asic->dpm.get_current_mclk((rdev))
>   
>   /* Common functions */
>   /* AGP */
Alex Deucher Oct. 2, 2014, 1:06 p.m. UTC | #2
On Thu, Oct 2, 2014 at 8:26 AM, Christian König <deathsimple@vodafone.de> wrote:
> Might be a good idea to make that a bit more generic, e.g. add a
> get_current_clk callback and and a type (sclk, mclk, vclk, dclk, etc..)
> enum. But I can live with this approach as well.
>

Yeah, I thought about that, but I'm not sure if there is a good way to
query that for certain clocks when dynamic clocking is enabled.  E.g.,
UVD on newer asics.

Alex

> Christian.
>
> Am 01.10.2014 um 17:38 schrieb Alex Deucher:
>
>> Needed to to expose the current clocks via the INFO ioctl.
>>
>> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
>> ---
>>   drivers/gpu/drm/radeon/radeon.h | 4 ++++
>>   1 file changed, 4 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/radeon/radeon.h
>> b/drivers/gpu/drm/radeon/radeon.h
>> index 510fe96..9e3dc82 100644
>> --- a/drivers/gpu/drm/radeon/radeon.h
>> +++ b/drivers/gpu/drm/radeon/radeon.h
>> @@ -1935,6 +1935,8 @@ struct radeon_asic {
>>                 bool (*vblank_too_short)(struct radeon_device *rdev);
>>                 void (*powergate_uvd)(struct radeon_device *rdev, bool
>> gate);
>>                 void (*enable_bapm)(struct radeon_device *rdev, bool
>> enable);
>> +               u32 (*get_current_sclk)(struct radeon_device *rdev);
>> +               u32 (*get_current_mclk)(struct radeon_device *rdev);
>>         } dpm;
>>         /* pageflipping */
>>         struct {
>> @@ -2893,6 +2895,8 @@ static inline void radeon_ring_write(struct
>> radeon_ring *ring, uint32_t v)
>>   #define radeon_dpm_vblank_too_short(rdev)
>> rdev->asic->dpm.vblank_too_short((rdev))
>>   #define radeon_dpm_powergate_uvd(rdev, g)
>> rdev->asic->dpm.powergate_uvd((rdev), (g))
>>   #define radeon_dpm_enable_bapm(rdev, e)
>> rdev->asic->dpm.enable_bapm((rdev), (e))
>> +#define radeon_dpm_get_current_sclk(rdev)
>> rdev->asic->dpm.get_current_sclk((rdev))
>> +#define radeon_dpm_get_current_mclk(rdev)
>> rdev->asic->dpm.get_current_mclk((rdev))
>>     /* Common functions */
>>   /* AGP */
>
>
Christian König Oct. 2, 2014, 1:11 p.m. UTC | #3
Am 02.10.2014 um 15:06 schrieb Alex Deucher:
> On Thu, Oct 2, 2014 at 8:26 AM, Christian König <deathsimple@vodafone.de> wrote:
>> Might be a good idea to make that a bit more generic, e.g. add a
>> get_current_clk callback and and a type (sclk, mclk, vclk, dclk, etc..)
>> enum. But I can live with this approach as well.
>>
> Yeah, I thought about that, but I'm not sure if there is a good way to
> query that for certain clocks when dynamic clocking is enabled.  E.g.,
> UVD on newer asics.

That's why I always favored using the PLL test registers. It can 
actually measure the clocks quite precisely if the reference clock 
(usually the PCI clock) is stable enough. And as far as I know can 
access any clock signal in the system, even the memory clock is 
measurable for each memory interface separately.

Christian.

>
> Alex
>
>> Christian.
>>
>> Am 01.10.2014 um 17:38 schrieb Alex Deucher:
>>
>>> Needed to to expose the current clocks via the INFO ioctl.
>>>
>>> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
>>> ---
>>>    drivers/gpu/drm/radeon/radeon.h | 4 ++++
>>>    1 file changed, 4 insertions(+)
>>>
>>> diff --git a/drivers/gpu/drm/radeon/radeon.h
>>> b/drivers/gpu/drm/radeon/radeon.h
>>> index 510fe96..9e3dc82 100644
>>> --- a/drivers/gpu/drm/radeon/radeon.h
>>> +++ b/drivers/gpu/drm/radeon/radeon.h
>>> @@ -1935,6 +1935,8 @@ struct radeon_asic {
>>>                  bool (*vblank_too_short)(struct radeon_device *rdev);
>>>                  void (*powergate_uvd)(struct radeon_device *rdev, bool
>>> gate);
>>>                  void (*enable_bapm)(struct radeon_device *rdev, bool
>>> enable);
>>> +               u32 (*get_current_sclk)(struct radeon_device *rdev);
>>> +               u32 (*get_current_mclk)(struct radeon_device *rdev);
>>>          } dpm;
>>>          /* pageflipping */
>>>          struct {
>>> @@ -2893,6 +2895,8 @@ static inline void radeon_ring_write(struct
>>> radeon_ring *ring, uint32_t v)
>>>    #define radeon_dpm_vblank_too_short(rdev)
>>> rdev->asic->dpm.vblank_too_short((rdev))
>>>    #define radeon_dpm_powergate_uvd(rdev, g)
>>> rdev->asic->dpm.powergate_uvd((rdev), (g))
>>>    #define radeon_dpm_enable_bapm(rdev, e)
>>> rdev->asic->dpm.enable_bapm((rdev), (e))
>>> +#define radeon_dpm_get_current_sclk(rdev)
>>> rdev->asic->dpm.get_current_sclk((rdev))
>>> +#define radeon_dpm_get_current_mclk(rdev)
>>> rdev->asic->dpm.get_current_mclk((rdev))
>>>      /* Common functions */
>>>    /* AGP */
>>
diff mbox

Patch

diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h
index 510fe96..9e3dc82 100644
--- a/drivers/gpu/drm/radeon/radeon.h
+++ b/drivers/gpu/drm/radeon/radeon.h
@@ -1935,6 +1935,8 @@  struct radeon_asic {
 		bool (*vblank_too_short)(struct radeon_device *rdev);
 		void (*powergate_uvd)(struct radeon_device *rdev, bool gate);
 		void (*enable_bapm)(struct radeon_device *rdev, bool enable);
+		u32 (*get_current_sclk)(struct radeon_device *rdev);
+		u32 (*get_current_mclk)(struct radeon_device *rdev);
 	} dpm;
 	/* pageflipping */
 	struct {
@@ -2893,6 +2895,8 @@  static inline void radeon_ring_write(struct radeon_ring *ring, uint32_t v)
 #define radeon_dpm_vblank_too_short(rdev) rdev->asic->dpm.vblank_too_short((rdev))
 #define radeon_dpm_powergate_uvd(rdev, g) rdev->asic->dpm.powergate_uvd((rdev), (g))
 #define radeon_dpm_enable_bapm(rdev, e) rdev->asic->dpm.enable_bapm((rdev), (e))
+#define radeon_dpm_get_current_sclk(rdev) rdev->asic->dpm.get_current_sclk((rdev))
+#define radeon_dpm_get_current_mclk(rdev) rdev->asic->dpm.get_current_mclk((rdev))
 
 /* Common functions */
 /* AGP */