12
12
* @file mali_kernel_pm.c
13
* Implementation of the Linux Power Management for Mali GPU kernel driver
13
* Linux Power Management integration
17
16
#include <linux/sched.h>
19
#ifdef CONFIG_PM_RUNTIME
20
#include <linux/pm_runtime.h>
21
#endif /* CONFIG_PM_RUNTIME */
23
17
#include <linux/platform_device.h>
24
18
#include <linux/version.h>
25
19
#include <asm/current.h>
26
20
#include <linux/suspend.h>
28
#include "mali_platform.h"
21
#include <linux/module.h>
22
#ifdef CONFIG_PM_RUNTIME
23
#include <linux/pm_runtime.h>
29
25
#include "mali_osk.h"
30
26
#include "mali_uk_types.h"
33
27
#include "mali_kernel_common.h"
34
28
#include "mali_kernel_license.h"
35
#include "mali_kernel_pm.h"
36
#include "mali_device_pause_resume.h"
37
29
#include "mali_linux_pm.h"
39
#if MALI_GPU_UTILIZATION
40
#include "mali_kernel_utilization.h"
41
#endif /* MALI_GPU_UTILIZATION */
43
#if MALI_POWER_MGMT_TEST_SUITE
45
#include "mali_linux_pm_testsuite.h"
46
#include "mali_platform_pmu_internal_testing.h"
47
unsigned int pwr_mgmt_status_reg = 0;
48
#endif /* CONFIG_PM */
49
#endif /* MALI_POWER_MGMT_TEST_SUITE */
51
static int is_os_pmm_thread_waiting = 0;
53
/* kernel should be configured with power management support */
56
#if MALI_LICENSE_IS_GPL
58
/* Linux kernel major version */
59
#define LINUX_KERNEL_MAJOR_VERSION 2
61
/* Linux kernel minor version */
62
#define LINUX_KERNEL_MINOR_VERSION 6
64
/* Linux kernel development version */
65
#define LINUX_KERNEL_DEVELOPMENT_VERSION 29
67
#ifdef CONFIG_PM_DEBUG
68
static const char* const mali_states[_MALI_MAX_DEBUG_OPERATIONS] = {
69
[_MALI_DEVICE_SUSPEND] = "suspend",
70
[_MALI_DEVICE_RESUME] = "resume",
71
[_MALI_DVFS_PAUSE_EVENT] = "dvfs_pause",
72
[_MALI_DVFS_RESUME_EVENT] = "dvfs_resume",
75
#endif /* CONFIG_PM_DEBUG */
77
#ifdef CONFIG_PM_RUNTIME
78
#if MALI_PMM_RUNTIME_JOB_CONTROL_ON
79
static int mali_pwr_suspend_notifier(struct notifier_block *nb,unsigned long event,void* dummy);
81
static struct notifier_block mali_pwr_notif_block = {
82
.notifier_call = mali_pwr_suspend_notifier
84
#endif /* MALI_PMM_RUNTIME_JOB_CONTROL_ON */
85
#endif /* CONFIG_PM_RUNTIME */
87
/* Power management thread pointer */
88
struct task_struct *pm_thread;
90
/* dvfs power management thread */
91
struct task_struct *dvfs_pm_thread;
93
/* is wake up needed */
94
short is_wake_up_needed = 0;
95
int timeout_fired = 2;
96
unsigned int is_mali_pmm_testsuite_enabled = 0;
98
_mali_device_power_states mali_device_state = _MALI_DEVICE_RESUME;
99
_mali_device_power_states mali_dvfs_device_state = _MALI_DEVICE_RESUME;
100
_mali_osk_lock_t *lock;
102
#if MALI_POWER_MGMT_TEST_SUITE
104
const char* const mali_pmm_recording_events[_MALI_DEVICE_MAX_PMM_EVENTS] = {
105
[_MALI_DEVICE_PMM_TIMEOUT_EVENT] = "timeout",
106
[_MALI_DEVICE_PMM_JOB_SCHEDULING_EVENTS] = "job_scheduling",
107
[_MALI_DEVICE_PMM_REGISTERED_CORES] = "cores",
111
unsigned int mali_timeout_event_recording_on = 0;
112
unsigned int mali_job_scheduling_events_recording_on = 0;
113
unsigned int is_mali_pmu_present = 0;
114
#endif /* MALI_POWER_MGMT_TEST_SUITE */
116
/* Function prototypes */
117
static int mali_pm_probe(struct platform_device *pdev);
118
static int mali_pm_remove(struct platform_device *pdev);
120
/* Mali device suspend function */
121
static int mali_pm_suspend(struct device *dev);
123
/* Mali device resume function */
124
static int mali_pm_resume(struct device *dev);
126
/* Run time suspend and resume functions */
127
#ifdef CONFIG_PM_RUNTIME
128
#if MALI_PMM_RUNTIME_JOB_CONTROL_ON
129
static int mali_device_runtime_suspend(struct device *dev);
130
static int mali_device_runtime_resume(struct device *dev);
131
#endif /* MALI_PMM_RUNTIME_JOB_CONTROL_ON */
132
#endif /* CONFIG_PM_RUNTIME */
134
/* OS suspend and resume callbacks */
135
#if !MALI_PMM_RUNTIME_JOB_CONTROL_ON
136
#ifndef CONFIG_PM_RUNTIME
137
#if (LINUX_VERSION_CODE < KERNEL_VERSION(LINUX_KERNEL_MAJOR_VERSION,LINUX_KERNEL_MINOR_VERSION,LINUX_KERNEL_DEVELOPMENT_VERSION))
138
static int mali_pm_os_suspend(struct platform_device *pdev, pm_message_t state);
140
static int mali_pm_os_suspend(struct device *dev);
143
#if (LINUX_VERSION_CODE < KERNEL_VERSION(LINUX_KERNEL_MAJOR_VERSION,LINUX_KERNEL_MINOR_VERSION,LINUX_KERNEL_DEVELOPMENT_VERSION))
144
static int mali_pm_os_resume(struct platform_device *pdev);
146
static int mali_pm_os_resume(struct device *dev);
148
#endif /* CONFIG_PM_RUNTIME */
149
#endif /* MALI_PMM_RUNTIME_JOB_CONTROL_ON */
151
/* OS Hibernation suspend callback */
152
static int mali_pm_os_suspend_on_hibernation(struct device *dev);
154
/* OS Hibernation resume callback */
155
static int mali_pm_os_resume_on_hibernation(struct device *dev);
157
static void _mali_release_pm(struct device* device);
159
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(LINUX_KERNEL_MAJOR_VERSION,LINUX_KERNEL_MINOR_VERSION,LINUX_KERNEL_DEVELOPMENT_VERSION))
160
static const struct dev_pm_ops mali_dev_pm_ops = {
162
#ifdef CONFIG_PM_RUNTIME
163
#if MALI_PMM_RUNTIME_JOB_CONTROL_ON
164
.runtime_suspend = mali_device_runtime_suspend,
165
.runtime_resume = mali_device_runtime_resume,
166
#endif /* MALI_PMM_RUNTIME_JOB_CONTROL_ON */
167
#endif /* CONFIG_PM_RUNTIME */
169
#ifndef CONFIG_PM_RUNTIME
170
#if !MALI_PMM_RUNTIME_JOB_CONTROL_ON
171
.suspend = mali_pm_os_suspend,
172
.resume = mali_pm_os_resume,
173
#endif /* MALI_PMM_RUNTIME_JOB_CONTROL_ON */
174
#endif /* CONFIG_PM_RUNTIME */
175
.freeze = mali_pm_os_suspend_on_hibernation,
176
.poweroff = mali_pm_os_suspend_on_hibernation,
177
.thaw = mali_pm_os_resume_on_hibernation,
178
.restore = mali_pm_os_resume_on_hibernation,
182
#if (LINUX_VERSION_CODE < KERNEL_VERSION(LINUX_KERNEL_MAJOR_VERSION,LINUX_KERNEL_MINOR_VERSION,LINUX_KERNEL_DEVELOPMENT_VERSION))
183
struct pm_ext_ops mali_pm_operations = {
185
.freeze = mali_pm_os_suspend_on_hibernation,
186
.thaw = mali_pm_os_resume_on_hibernation,
187
.poweroff = mali_pm_os_resume_on_hibernation,
188
.restore = mali_pm_os_resume_on_hibernation,
31
#include "mali_platform.h"
33
#if ! MALI_LICENSE_IS_GPL
34
#undef CONFIG_PM_RUNTIME
37
static int mali_probe(struct platform_device *pdev);
38
static int mali_remove(struct platform_device *pdev);
40
#ifdef CONFIG_PM_RUNTIME
41
static int mali_runtime_suspend(struct device *dev);
42
static int mali_runtime_resume(struct device *dev);
45
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29))
46
static int mali_os_suspend(struct platform_device *pdev, pm_message_t state);
47
static int mali_os_resume(struct platform_device *pdev);
49
static int mali_os_suspend(struct device *dev);
50
static int mali_os_resume(struct device *dev);
54
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29))
55
static const struct dev_pm_ops mali_dev_pm_ops =
57
#ifdef CONFIG_PM_RUNTIME
58
.runtime_suspend = mali_runtime_suspend,
59
.runtime_resume = mali_runtime_resume,
62
.suspend = mali_os_suspend,
63
.resume = mali_os_resume,
66
.freeze = mali_os_suspend,
67
.poweroff = mali_os_suspend,
68
.thaw = mali_os_resume,
69
.restore = mali_os_resume,
71
#elif (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29))
72
struct pm_ext_ops mali_ext_pm_operations =
76
.freeze = mali_os_suspend,
77
.thaw = mali_os_resume,
78
.poweroff = mali_os_suspend,
79
.restore = mali_os_resume,
193
static struct platform_driver mali_plat_driver = {
194
.probe = mali_pm_probe,
195
.remove = mali_pm_remove,
196
#if (LINUX_VERSION_CODE < KERNEL_VERSION(LINUX_KERNEL_MAJOR_VERSION,LINUX_KERNEL_MINOR_VERSION,LINUX_KERNEL_DEVELOPMENT_VERSION))
197
#ifndef CONFIG_PM_RUNTIME
198
#if !MALI_PMM_RUNTIME_JOB_CONTROL_ON
199
.suspend = mali_pm_os_suspend,
200
.resume = mali_pm_os_resume,
201
#endif /* CONFIG_PM_RUNTIME */
202
#endif /* MALI_PMM_RUNTIME_JOB_CONTROL_ON */
203
.pm = &mali_pm_operations,
85
static struct platform_driver mali_plat_driver =
88
.remove = mali_remove,
89
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29))
90
.suspend = mali_os_suspend,
91
.resume = mali_os_resume,
92
.pm = &mali_ext_pm_operations,
207
97
.name = "mali_dev",
208
98
.owner = THIS_MODULE,
99
#if MALI_LICENSE_IS_GPL
209
100
.bus = &platform_bus_type,
210
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(LINUX_KERNEL_MAJOR_VERSION,LINUX_KERNEL_MINOR_VERSION,LINUX_KERNEL_DEVELOPMENT_VERSION))
102
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29))
211
103
.pm = &mali_dev_pm_ops,
216
/* Mali GPU platform device */
217
struct platform_device mali_gpu_device = {
108
#ifdef CONFIG_PM_RUNTIME
109
static int mali_pwr_suspend_notifier(struct notifier_block *nb,unsigned long event,void* dummy);
111
static struct notifier_block mali_pwr_notif_block =
113
.notifier_call = mali_pwr_suspend_notifier
117
/** This function is called when platform device is unregistered. This function
118
* is necessary when the platform device is unregistered.
120
static void _mali_release_pm(struct device *device)
123
struct platform_device mali_gpu_device =
218
125
.name = "mali_dev",
220
127
.dev.release = _mali_release_pm
223
/** This function is called when platform device is unregistered. This function
224
* is necessary when the platform device is unregistered.
226
static void _mali_release_pm(struct device *device)
228
MALI_DEBUG_PRINT(4, ("OSPMM: MALI Platform device removed\n" ));
231
#if MALI_POWER_MGMT_TEST_SUITE
232
void mali_is_pmu_present(void)
235
temp = pmu_get_power_up_down_info();
238
is_mali_pmu_present = 0;
242
is_mali_pmu_present = 1;
245
#endif /* MALI_POWER_MGMT_TEST_SUITE */
246
#endif /* MALI_LICENSE_IS_GPL */
248
#if MALI_LICENSE_IS_GPL
250
static int mali_wait_for_power_management_policy_event(void)
255
set_current_state(TASK_INTERRUPTIBLE);
256
if (signal_pending(current))
261
if (is_wake_up_needed == 1)
267
__set_current_state(TASK_RUNNING);
268
is_wake_up_needed =0;
272
/** This function is invoked when mali device is suspended
274
int mali_device_suspend(unsigned int event_id, struct task_struct **pwr_mgmt_thread)
277
_mali_uk_pmm_message_s event = {
281
*pwr_mgmt_thread = current;
282
MALI_DEBUG_PRINT(4, ("OSPMM: MALI device is being suspended\n" ));
283
_mali_ukk_pmm_event_message(&event);
284
is_os_pmm_thread_waiting = 1;
285
err = mali_wait_for_power_management_policy_event();
286
is_os_pmm_thread_waiting = 0;
290
/** This function is called when Operating system wants to power down
291
* the mali GPU device.
293
static int mali_pm_suspend(struct device *dev)
296
_mali_osk_lock_wait(lock, _MALI_OSK_LOCKMODE_RW);
297
#if MALI_GPU_UTILIZATION
298
mali_utilization_suspend();
299
#endif /* MALI_GPU_UTILIZATION */
300
if ((mali_device_state == _MALI_DEVICE_SUSPEND))
302
_mali_osk_lock_signal(lock, _MALI_OSK_LOCKMODE_RW);
305
err = mali_device_suspend(MALI_PMM_EVENT_OS_POWER_DOWN, &pm_thread);
306
mali_device_state = _MALI_DEVICE_SUSPEND;
307
_mali_osk_lock_signal(lock, _MALI_OSK_LOCKMODE_RW);
311
#ifndef CONFIG_PM_RUNTIME
312
#if !MALI_PMM_RUNTIME_JOB_CONTROL_ON
313
#if (LINUX_VERSION_CODE < KERNEL_VERSION(LINUX_KERNEL_MAJOR_VERSION,LINUX_KERNEL_MINOR_VERSION,LINUX_KERNEL_DEVELOPMENT_VERSION))
314
static int mali_pm_os_suspend(struct platform_device *pdev, pm_message_t state)
316
static int mali_pm_os_suspend(struct device *dev)
130
/** This function is called when the device is probed */
131
static int mali_probe(struct platform_device *pdev)
136
static int mali_remove(struct platform_device *pdev)
138
#ifdef CONFIG_PM_RUNTIME
139
pm_runtime_disable(&pdev->dev);
320
err = mali_pm_suspend(NULL);
323
#endif /* MALI_PMM_RUNTIME_JOB_CONTROL_ON */
324
#endif /* CONFIG_PM_RUNTIME */
326
144
#ifdef CONFIG_PM_RUNTIME
327
#if MALI_PMM_RUNTIME_JOB_CONTROL_ON
328
145
static int mali_pwr_suspend_notifier(struct notifier_block *nb,unsigned long event,void* dummy)
333
149
case PM_SUSPEND_PREPARE:
334
err = mali_pm_suspend(NULL);
150
MALI_DEBUG_PRINT(2, ("mali_pwr_suspend_notifier(PM_SUSPEND_PREPARE) called\n"));
151
mali_pm_os_suspend();
337
153
case PM_POST_SUSPEND:
338
err = mali_pm_resume(NULL);
154
MALI_DEBUG_PRINT(2, ("mali_pwr_suspend_notifier(PM_SUSPEND_PREPARE) called\n"));
345
#endif /* MALI_PMM_RUNTIME_JOB_CONTROL_ON */
346
#endif /* CONFIG_PM_RUNTIME */
348
/** This function is called when mali GPU device is to be resumed.
350
int mali_device_resume(unsigned int event_id, struct task_struct **pwr_mgmt_thread)
353
_mali_uk_pmm_message_s event = {
357
*pwr_mgmt_thread = current;
358
MALI_DEBUG_PRINT(4, ("OSPMM: MALI device is being resumed\n" ));
359
_mali_ukk_pmm_event_message(&event);
360
MALI_DEBUG_PRINT(4, ("OSPMM: MALI Power up event is scheduled\n" ));
361
is_os_pmm_thread_waiting = 1;
362
err = mali_wait_for_power_management_policy_event();
363
is_os_pmm_thread_waiting = 0;
367
/** This function is called when mali GPU device is to be resumed
370
static int mali_pm_resume(struct device *dev)
373
_mali_osk_lock_wait(lock, _MALI_OSK_LOCKMODE_RW);
374
if (mali_device_state == _MALI_DEVICE_RESUME)
376
_mali_osk_lock_signal(lock, _MALI_OSK_LOCKMODE_RW);
379
err = mali_device_resume(MALI_PMM_EVENT_OS_POWER_UP, &pm_thread);
380
mali_device_state = _MALI_DEVICE_RESUME;
381
mali_dvfs_device_state = _MALI_DEVICE_RESUME;
382
_mali_osk_lock_signal(lock, _MALI_OSK_LOCKMODE_RW);
386
#ifndef CONFIG_PM_RUNTIME
387
#if !MALI_PMM_RUNTIME_JOB_CONTROL_ON
388
#if (LINUX_VERSION_CODE < KERNEL_VERSION(LINUX_KERNEL_MAJOR_VERSION,LINUX_KERNEL_MINOR_VERSION,LINUX_KERNEL_DEVELOPMENT_VERSION))
389
static int mali_pm_os_resume(struct platform_device *pdev)
391
static int mali_pm_os_resume(struct device *dev)
395
err = mali_pm_resume(NULL);
398
#endif /* MALI_PMM_RUNTIME_JOB_CONTROL_ON */
399
#endif /* CONFIG_PM_RUNTIME */
401
static int mali_pm_os_suspend_on_hibernation(struct device *dev)
404
err = mali_pm_suspend(NULL);
408
static int mali_pm_os_resume_on_hibernation(struct device *dev)
411
err = mali_pm_resume(NULL);
415
#ifdef CONFIG_PM_RUNTIME
416
#if MALI_PMM_RUNTIME_JOB_CONTROL_ON
417
/** This function is called when runtime suspend of mali device is required.
419
static int mali_device_runtime_suspend(struct device *dev)
421
MALI_DEBUG_PRINT(4, ("PMMDEBUG: Mali device Run time suspended \n" ));
425
/** This function is called when runtime resume of mali device is required.
427
static int mali_device_runtime_resume(struct device *dev)
429
MALI_DEBUG_PRINT(4, ("PMMDEBUG: Mali device Run time Resumed \n" ));
432
#endif /* MALI_PMM_RUNTIME_JOB_CONTROL_ON */
433
#endif /* CONFIG_PM_RUNTIME */
435
#ifdef CONFIG_PM_DEBUG
437
/** This function is used for debugging purposes when the user want to see
438
* which power management operations are supported for
441
static ssize_t show_file(struct device *dev, struct device_attribute *attr, char *buf)
444
#if !MALI_POWER_MGMT_TEST_SUITE
446
for (pm_counter = 0; pm_counter<_MALI_MAX_DEBUG_OPERATIONS; pm_counter++)
448
str += sprintf(str, "%s ", mali_states[pm_counter]);
451
str += sprintf(str, "%d ",pwr_mgmt_status_reg);
460
/** This function is called when user wants to suspend the mali GPU device in order
461
* to simulate the power up and power down events.
463
static ssize_t store_file(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
467
#if MALI_POWER_MGMT_TEST_SUITE
468
int test_flag_dvfs = 0;
469
pwr_mgmt_status_reg = 0;
470
mali_is_pmu_present();
473
if (!strncmp(buf,mali_states[_MALI_DEVICE_SUSPEND],strlen(mali_states[_MALI_DEVICE_SUSPEND])))
475
MALI_DEBUG_PRINT(4, ("PMMDEBUG: MALI suspend Power operation is scheduled\n" ));
476
err = mali_pm_suspend(NULL);
479
#if MALI_POWER_MGMT_TEST_SUITE
480
else if (!strncmp(buf,mali_pmm_recording_events[_MALI_DEVICE_PMM_REGISTERED_CORES],strlen(mali_pmm_recording_events[_MALI_DEVICE_PMM_REGISTERED_CORES])))
482
MALI_DEBUG_PRINT(4, ("PMMDEBUG: MALI Device get number of registerd cores\n" ));
483
pwr_mgmt_status_reg = _mali_pmm_cores_list();
486
else if (!strncmp(buf,mali_pmm_recording_events[_MALI_DEVICE_PMM_TIMEOUT_EVENT],strlen(mali_pmm_recording_events[_MALI_DEVICE_PMM_TIMEOUT_EVENT])))
488
MALI_DEBUG_PRINT(4, ("PMMDEBUG: MALI timeout event recording is enabled\n" ));
489
mali_timeout_event_recording_on = 1;
491
else if (!strncmp(buf,mali_pmm_recording_events[_MALI_DEVICE_PMM_JOB_SCHEDULING_EVENTS],strlen(mali_pmm_recording_events[_MALI_DEVICE_PMM_JOB_SCHEDULING_EVENTS])))
493
MALI_DEBUG_PRINT(4, ("PMMDEBUG: MALI Job scheduling events recording is enabled\n" ));
494
mali_job_scheduling_events_recording_on = 1;
496
#endif /* MALI_POWER_MGMT_TEST_SUITE */
498
else if (!strncmp(buf,mali_states[_MALI_DEVICE_RESUME],strlen(mali_states[_MALI_DEVICE_RESUME])))
500
MALI_DEBUG_PRINT(4, ("PMMDEBUG: MALI Resume Power operation is scheduled\n" ));
501
err = mali_pm_resume(NULL);
503
else if (!strncmp(buf,mali_states[_MALI_DVFS_PAUSE_EVENT],strlen(mali_states[_MALI_DVFS_PAUSE_EVENT])))
505
MALI_DEBUG_PRINT(4, ("PMMDEBUG: MALI DVFS Pause Power operation is scheduled\n" ));
506
err = mali_dev_pause();
507
#if MALI_POWER_MGMT_TEST_SUITE
509
#endif /* MALI_POWER_MGMT_TEST_SUITE */
511
else if (!strncmp(buf,mali_states[_MALI_DVFS_RESUME_EVENT],strlen(mali_states[_MALI_DVFS_RESUME_EVENT])))
513
MALI_DEBUG_PRINT(4, ("PMMDEBUG: MALI DVFS Resume Power operation is scheduled\n" ));
514
err = mali_dev_resume();
515
#if MALI_POWER_MGMT_TEST_SUITE
517
#endif /* MALI_POWER_MGMT_TEST_SUITE */
521
MALI_DEBUG_PRINT(4, ("PMMDEBUG: Invalid Power Mode Operation selected\n" ));
523
#if MALI_POWER_MGMT_TEST_SUITE
524
if (test_flag_dvfs == 1)
528
pwr_mgmt_status_reg = 2;
532
pwr_mgmt_status_reg = 1;
537
if (1 == is_mali_pmu_present)
539
pwr_mgmt_status_reg = pmu_get_power_up_down_info();
542
#endif /* MALI_POWER_MGMT_TEST_SUITE */
546
/* Device attribute file */
547
static DEVICE_ATTR(file, 0644, show_file, store_file);
548
#endif /* CONFIG_PM_DEBUG */
550
static int mali_pm_remove(struct platform_device *pdev)
552
#ifdef CONFIG_PM_DEBUG
553
device_remove_file(&mali_gpu_device.dev, &dev_attr_file);
554
#endif /* CONFIG_PM_DEBUG */
555
#ifdef CONFIG_PM_RUNTIME
556
#if MALI_PMM_RUNTIME_JOB_CONTROL_ON
557
pm_runtime_disable(&pdev->dev);
558
#endif /* MALI_PMM_RUNTIME_JOB_CONTROL_ON */
559
#endif /* CONFIG_PM_RUNTIME */
563
/** This function is called when the device is probed */
564
static int mali_pm_probe(struct platform_device *pdev)
566
#ifdef CONFIG_PM_DEBUG
568
err = device_create_file(&mali_gpu_device.dev, &dev_attr_file);
571
MALI_DEBUG_PRINT(4, ("PMMDEBUG: Error in creating device file\n" ));
573
#endif /* CONFIG_PM_DEBUG */
165
#ifdef CONFIG_PM_RUNTIME
167
static int mali_runtime_suspend(struct device *dev)
169
MALI_DEBUG_PRINT(3, ("mali_runtime_suspend() called\n"));
170
mali_pm_runtime_suspend();
171
return 0; /* all ok */
174
static int mali_runtime_resume(struct device *dev)
176
MALI_DEBUG_PRINT(3, ("mali_runtime_resume() called\n"));
177
mali_pm_runtime_resume();
178
return 0; /* all ok */
183
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29))
185
static int mali_os_suspend(struct platform_device *pdev, pm_message_t state)
187
MALI_DEBUG_PRINT(3, ("mali_os_suspend(old) called\n"));
188
mali_pm_os_suspend();
189
return 0; /* all ok */
192
static int mali_os_resume(struct platform_device *pdev)
194
MALI_DEBUG_PRINT(3, ("mali_os_resume(old) called\n"));
196
return 0; /* all ok */
201
static int mali_os_suspend(struct device *dev)
203
MALI_DEBUG_PRINT(3, ("mali_os_suspend(new) called\n"));
204
mali_pm_os_suspend();
205
return 0; /* all ok */
208
static int mali_os_resume(struct device *dev)
210
MALI_DEBUG_PRINT(3, ("mali_os_resume(new) called\n"));
212
return 0; /* all ok */
577
217
/** This function is called when Mali GPU device is initialized
579
219
int _mali_dev_platform_register(void)
582
#if MALI_PMM_RUNTIME_JOB_CONTROL_ON
223
#ifdef CONFIG_PM_RUNTIME
583
224
set_mali_parent_power_domain((void *)&mali_gpu_device);
586
227
#ifdef CONFIG_PM_RUNTIME
587
#if MALI_PMM_RUNTIME_JOB_CONTROL_ON
588
228
err = register_pm_notifier(&mali_pwr_notif_block);
593
#endif /* MALI_PMM_RUNTIME_JOB_CONTROL_ON */
594
#endif /* CONFIG_PM_RUNTIME */
235
#if MALI_LICENSE_IS_GPL
595
236
err = platform_device_register(&mali_gpu_device);
596
lock = _mali_osk_lock_init((_mali_osk_lock_flags_t)( _MALI_OSK_LOCKFLAG_READERWRITER | _MALI_OSK_LOCKFLAG_ORDERED), 0, 0);
599
239
err = platform_driver_register(&mali_plat_driver);
602
_mali_osk_lock_term(lock);
603
242
#ifdef CONFIG_PM_RUNTIME
604
#if MALI_PMM_RUNTIME_JOB_CONTROL_ON
605
243
unregister_pm_notifier(&mali_pwr_notif_block);
606
#endif /* MALI_PMM_RUNTIME_JOB_CONTROL_ON */
607
#endif /* CONFIG_PM_RUNTIME */
608
245
platform_device_unregister(&mali_gpu_device);