Commit 77e7da68 authored by Ben Skeggs's avatar Ben Skeggs

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: default avatarBen Skeggs <bskeggs@redhat.com>
parent 3b0582d3
...@@ -498,6 +498,11 @@ struct nouveau_pm_engine { ...@@ -498,6 +498,11 @@ struct nouveau_pm_engine {
void *(*clock_pre)(struct drm_device *, struct nouveau_pm_level *, void *(*clock_pre)(struct drm_device *, struct nouveau_pm_level *,
u32 id, int khz); u32 id, int khz);
void (*clock_set)(struct drm_device *, void *); 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_get)(struct drm_device *);
int (*voltage_set)(struct drm_device *, int voltage); int (*voltage_set)(struct drm_device *, int voltage);
int (*fanspeed_get)(struct drm_device *); int (*fanspeed_get)(struct drm_device *);
......
...@@ -72,6 +72,12 @@ nouveau_pm_perflvl_set(struct drm_device *dev, struct nouveau_pm_level *perflvl) ...@@ -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) { if (pm->clock_set) {
nouveau_pm_clock_set(dev, perflvl, PLL_CORE, perflvl->core); nouveau_pm_clock_set(dev, perflvl, PLL_CORE, perflvl->core);
nouveau_pm_clock_set(dev, perflvl, PLL_SHADER, perflvl->shader); 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) ...@@ -124,6 +130,11 @@ nouveau_pm_perflvl_get(struct drm_device *dev, struct nouveau_pm_level *perflvl)
memset(perflvl, 0, sizeof(*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) { if (pm->clock_get) {
ret = pm->clock_get(dev, PLL_CORE); ret = pm->clock_get(dev, PLL_CORE);
if (ret > 0) if (ret > 0)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment