diff options
Diffstat (limited to 'include/linux/pm.h')
-rw-r--r-- | include/linux/pm.h | 38 |
1 files changed, 24 insertions, 14 deletions
diff --git a/include/linux/pm.h b/include/linux/pm.h index 52e8c55ff314..40f3f45702ba 100644 --- a/include/linux/pm.h +++ b/include/linux/pm.h | |||
@@ -41,6 +41,12 @@ extern void (*pm_power_off_prepare)(void); | |||
41 | 41 | ||
42 | struct device; | 42 | struct device; |
43 | 43 | ||
44 | #ifdef CONFIG_PM | ||
45 | extern const char power_group_name[]; /* = "power" */ | ||
46 | #else | ||
47 | #define power_group_name NULL | ||
48 | #endif | ||
49 | |||
44 | typedef struct pm_message { | 50 | typedef struct pm_message { |
45 | int event; | 51 | int event; |
46 | } pm_message_t; | 52 | } pm_message_t; |
@@ -438,6 +444,9 @@ enum rpm_status { | |||
438 | * | 444 | * |
439 | * RPM_REQ_SUSPEND Run the device bus type's ->runtime_suspend() callback | 445 | * RPM_REQ_SUSPEND Run the device bus type's ->runtime_suspend() callback |
440 | * | 446 | * |
447 | * RPM_REQ_AUTOSUSPEND Same as RPM_REQ_SUSPEND, but not until the device has | ||
448 | * been inactive for as long as power.autosuspend_delay | ||
449 | * | ||
441 | * RPM_REQ_RESUME Run the device bus type's ->runtime_resume() callback | 450 | * RPM_REQ_RESUME Run the device bus type's ->runtime_resume() callback |
442 | */ | 451 | */ |
443 | 452 | ||
@@ -445,26 +454,28 @@ enum rpm_request { | |||
445 | RPM_REQ_NONE = 0, | 454 | RPM_REQ_NONE = 0, |
446 | RPM_REQ_IDLE, | 455 | RPM_REQ_IDLE, |
447 | RPM_REQ_SUSPEND, | 456 | RPM_REQ_SUSPEND, |
457 | RPM_REQ_AUTOSUSPEND, | ||
448 | RPM_REQ_RESUME, | 458 | RPM_REQ_RESUME, |
449 | }; | 459 | }; |
450 | 460 | ||
461 | struct wakeup_source; | ||
462 | |||
451 | struct dev_pm_info { | 463 | struct dev_pm_info { |
452 | pm_message_t power_state; | 464 | pm_message_t power_state; |
453 | unsigned int can_wakeup:1; | 465 | unsigned int can_wakeup:1; |
454 | unsigned int should_wakeup:1; | ||
455 | unsigned async_suspend:1; | 466 | unsigned async_suspend:1; |
456 | enum dpm_state status; /* Owned by the PM core */ | 467 | enum dpm_state status; /* Owned by the PM core */ |
468 | spinlock_t lock; | ||
457 | #ifdef CONFIG_PM_SLEEP | 469 | #ifdef CONFIG_PM_SLEEP |
458 | struct list_head entry; | 470 | struct list_head entry; |
459 | struct completion completion; | 471 | struct completion completion; |
460 | unsigned long wakeup_count; | 472 | struct wakeup_source *wakeup; |
461 | #endif | 473 | #endif |
462 | #ifdef CONFIG_PM_RUNTIME | 474 | #ifdef CONFIG_PM_RUNTIME |
463 | struct timer_list suspend_timer; | 475 | struct timer_list suspend_timer; |
464 | unsigned long timer_expires; | 476 | unsigned long timer_expires; |
465 | struct work_struct work; | 477 | struct work_struct work; |
466 | wait_queue_head_t wait_queue; | 478 | wait_queue_head_t wait_queue; |
467 | spinlock_t lock; | ||
468 | atomic_t usage_count; | 479 | atomic_t usage_count; |
469 | atomic_t child_count; | 480 | atomic_t child_count; |
470 | unsigned int disable_depth:3; | 481 | unsigned int disable_depth:3; |
@@ -474,9 +485,14 @@ struct dev_pm_info { | |||
474 | unsigned int deferred_resume:1; | 485 | unsigned int deferred_resume:1; |
475 | unsigned int run_wake:1; | 486 | unsigned int run_wake:1; |
476 | unsigned int runtime_auto:1; | 487 | unsigned int runtime_auto:1; |
488 | unsigned int no_callbacks:1; | ||
489 | unsigned int use_autosuspend:1; | ||
490 | unsigned int timer_autosuspends:1; | ||
477 | enum rpm_request request; | 491 | enum rpm_request request; |
478 | enum rpm_status runtime_status; | 492 | enum rpm_status runtime_status; |
479 | int runtime_error; | 493 | int runtime_error; |
494 | int autosuspend_delay; | ||
495 | unsigned long last_busy; | ||
480 | unsigned long active_jiffies; | 496 | unsigned long active_jiffies; |
481 | unsigned long suspended_jiffies; | 497 | unsigned long suspended_jiffies; |
482 | unsigned long accounting_timestamp; | 498 | unsigned long accounting_timestamp; |
@@ -558,12 +574,7 @@ extern void __suspend_report_result(const char *function, void *fn, int ret); | |||
558 | __suspend_report_result(__func__, fn, ret); \ | 574 | __suspend_report_result(__func__, fn, ret); \ |
559 | } while (0) | 575 | } while (0) |
560 | 576 | ||
561 | extern void device_pm_wait_for_dev(struct device *sub, struct device *dev); | 577 | extern int device_pm_wait_for_dev(struct device *sub, struct device *dev); |
562 | |||
563 | /* drivers/base/power/wakeup.c */ | ||
564 | extern void pm_wakeup_event(struct device *dev, unsigned int msec); | ||
565 | extern void pm_stay_awake(struct device *dev); | ||
566 | extern void pm_relax(void); | ||
567 | #else /* !CONFIG_PM_SLEEP */ | 578 | #else /* !CONFIG_PM_SLEEP */ |
568 | 579 | ||
569 | #define device_pm_lock() do {} while (0) | 580 | #define device_pm_lock() do {} while (0) |
@@ -576,11 +587,10 @@ static inline int dpm_suspend_start(pm_message_t state) | |||
576 | 587 | ||
577 | #define suspend_report_result(fn, ret) do {} while (0) | 588 | #define suspend_report_result(fn, ret) do {} while (0) |
578 | 589 | ||
579 | static inline void device_pm_wait_for_dev(struct device *a, struct device *b) {} | 590 | static inline int device_pm_wait_for_dev(struct device *a, struct device *b) |
580 | 591 | { | |
581 | static inline void pm_wakeup_event(struct device *dev, unsigned int msec) {} | 592 | return 0; |
582 | static inline void pm_stay_awake(struct device *dev) {} | 593 | } |
583 | static inline void pm_relax(void) {} | ||
584 | #endif /* !CONFIG_PM_SLEEP */ | 594 | #endif /* !CONFIG_PM_SLEEP */ |
585 | 595 | ||
586 | /* How to reorder dpm_list after device_move() */ | 596 | /* How to reorder dpm_list after device_move() */ |