drm/nouveau/pm: add hooks to get/set *all* clocks at once
This is probably better than having to tell the common code about all the clocks that exist on every chipset. Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
This commit is contained in:
parent
3b0582d31d
commit
77e7da6814
2 changed files with 16 additions and 0 deletions
|
@ -498,6 +498,11 @@ struct nouveau_pm_engine {
|
|||
void *(*clock_pre)(struct drm_device *, struct nouveau_pm_level *,
|
||||
u32 id, int khz);
|
||||
void (*clock_set)(struct drm_device *, void *);
|
||||
|
||||
int (*clocks_get)(struct drm_device *, struct nouveau_pm_level *);
|
||||
void *(*clocks_pre)(struct drm_device *, struct nouveau_pm_level *);
|
||||
void (*clocks_set)(struct drm_device *, void *);
|
||||
|
||||
int (*voltage_get)(struct drm_device *);
|
||||
int (*voltage_set)(struct drm_device *, int voltage);
|
||||
int (*fanspeed_get)(struct drm_device *);
|
||||
|
|
|
@ -72,6 +72,12 @@ nouveau_pm_perflvl_set(struct drm_device *dev, struct nouveau_pm_level *perflvl)
|
|||
}
|
||||
}
|
||||
|
||||
if (pm->clocks_pre) {
|
||||
void *state = pm->clocks_pre(dev, perflvl);
|
||||
if (IS_ERR(state))
|
||||
return PTR_ERR(state);
|
||||
pm->clocks_set(dev, state);
|
||||
} else
|
||||
if (pm->clock_set) {
|
||||
nouveau_pm_clock_set(dev, perflvl, PLL_CORE, perflvl->core);
|
||||
nouveau_pm_clock_set(dev, perflvl, PLL_SHADER, perflvl->shader);
|
||||
|
@ -124,6 +130,11 @@ nouveau_pm_perflvl_get(struct drm_device *dev, struct nouveau_pm_level *perflvl)
|
|||
|
||||
memset(perflvl, 0, sizeof(*perflvl));
|
||||
|
||||
if (pm->clocks_get) {
|
||||
ret = pm->clocks_get(dev, perflvl);
|
||||
if (ret)
|
||||
return ret;
|
||||
} else
|
||||
if (pm->clock_get) {
|
||||
ret = pm->clock_get(dev, PLL_CORE);
|
||||
if (ret > 0)
|
||||
|
|
Loading…
Reference in a new issue