diff options
author | Ben Skeggs <bskeggs@redhat.com> | 2012-01-24 03:03:25 -0500 |
---|---|---|
committer | Ben Skeggs <bskeggs@redhat.com> | 2012-03-13 03:09:11 -0400 |
commit | 25c53c1068a804c6b51f86e937cebab6274dc056 (patch) | |
tree | fc52ae0515b86341801b19940d070bdaa4c98924 /drivers/gpu/drm/nouveau/nouveau_pm.c | |
parent | 8d7bb400638906075c38cb07891993cf95076aa7 (diff) |
drm/nouveau/pm: extend profile interface for destroy/init/fini
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Martin Peres <martin.peres@labri.fr>
Diffstat (limited to 'drivers/gpu/drm/nouveau/nouveau_pm.c')
-rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_pm.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/drivers/gpu/drm/nouveau/nouveau_pm.c b/drivers/gpu/drm/nouveau/nouveau_pm.c index 4fff09e3f592..dcc16927716f 100644 --- a/drivers/gpu/drm/nouveau/nouveau_pm.c +++ b/drivers/gpu/drm/nouveau/nouveau_pm.c | |||
@@ -183,6 +183,12 @@ nouveau_pm_trigger(struct drm_device *dev) | |||
183 | else | 183 | else |
184 | profile = pm->profile_dc; | 184 | profile = pm->profile_dc; |
185 | 185 | ||
186 | if (profile != pm->profile) { | ||
187 | pm->profile->func->fini(pm->profile); | ||
188 | pm->profile = profile; | ||
189 | pm->profile->func->init(pm->profile); | ||
190 | } | ||
191 | |||
186 | /* select performance level based on profile */ | 192 | /* select performance level based on profile */ |
187 | perflvl = profile->func->select(profile); | 193 | perflvl = profile->func->select(profile); |
188 | 194 | ||
@@ -251,6 +257,11 @@ nouveau_pm_profile_set(struct drm_device *dev, const char *profile) | |||
251 | return 0; | 257 | return 0; |
252 | } | 258 | } |
253 | 259 | ||
260 | static void | ||
261 | nouveau_pm_static_dummy(struct nouveau_pm_profile *profile) | ||
262 | { | ||
263 | } | ||
264 | |||
254 | static struct nouveau_pm_level * | 265 | static struct nouveau_pm_level * |
255 | nouveau_pm_static_select(struct nouveau_pm_profile *profile) | 266 | nouveau_pm_static_select(struct nouveau_pm_profile *profile) |
256 | { | 267 | { |
@@ -258,6 +269,9 @@ nouveau_pm_static_select(struct nouveau_pm_profile *profile) | |||
258 | } | 269 | } |
259 | 270 | ||
260 | const struct nouveau_pm_profile_func nouveau_pm_static_profile_func = { | 271 | const struct nouveau_pm_profile_func nouveau_pm_static_profile_func = { |
272 | .destroy = nouveau_pm_static_dummy, | ||
273 | .init = nouveau_pm_static_dummy, | ||
274 | .fini = nouveau_pm_static_dummy, | ||
261 | .select = nouveau_pm_static_select, | 275 | .select = nouveau_pm_static_select, |
262 | }; | 276 | }; |
263 | 277 | ||
@@ -856,6 +870,7 @@ nouveau_pm_init(struct drm_device *dev) | |||
856 | 870 | ||
857 | pm->profile_ac = &pm->boot.profile; | 871 | pm->profile_ac = &pm->boot.profile; |
858 | pm->profile_dc = &pm->boot.profile; | 872 | pm->profile_dc = &pm->boot.profile; |
873 | pm->profile = &pm->boot.profile; | ||
859 | pm->cur = &pm->boot; | 874 | pm->cur = &pm->boot; |
860 | 875 | ||
861 | /* add performance levels from vbios */ | 876 | /* add performance levels from vbios */ |
@@ -893,6 +908,12 @@ nouveau_pm_fini(struct drm_device *dev) | |||
893 | { | 908 | { |
894 | struct drm_nouveau_private *dev_priv = dev->dev_private; | 909 | struct drm_nouveau_private *dev_priv = dev->dev_private; |
895 | struct nouveau_pm_engine *pm = &dev_priv->engine.pm; | 910 | struct nouveau_pm_engine *pm = &dev_priv->engine.pm; |
911 | struct nouveau_pm_profile *profile, *tmp; | ||
912 | |||
913 | list_for_each_entry_safe(profile, tmp, &pm->profiles, head) { | ||
914 | list_del(&profile->head); | ||
915 | profile->func->destroy(profile); | ||
916 | } | ||
896 | 917 | ||
897 | if (pm->cur != &pm->boot) | 918 | if (pm->cur != &pm->boot) |
898 | nouveau_pm_perflvl_set(dev, &pm->boot); | 919 | nouveau_pm_perflvl_set(dev, &pm->boot); |