~ubuntu-branches/ubuntu/trusty/linux-armadaxp/trusty

« back to all changes in this revision

Viewing changes to drivers/base/power/runtime.c

  • Committer: Package Import Robot
  • Author(s): Michael Casadevall, Bryan Wu, Dann Frazier, Michael Casadeall
  • Date: 2012-03-10 15:00:54 UTC
  • mfrom: (1.1.1)
  • Revision ID: package-import@ubuntu.com-20120310150054-flugb39zon8vvgwe
Tags: 3.2.0-1600.1
[ Bryan Wu ]
* UBUNTU: import debian/debian.env and debian.armadaxp

[ Dann Frazier ]
* ARM: Armada XP: remove trailing '/' in dirnames in mvRules.mk

[ Michael Casadeall ]
* tools: add some tools for Marvell Armada XP processor
* kernel: timer tick hacking from Marvell
* kernel: Sheeva Errata: add delay on Sheeva when powering down
* net: add Marvell NFP netfilter
* net: socket and skb modifications made by Marvell
* miscdevice: add minor IDs for some Marvell Armada drivers
* fs: introduce memory pool for splice()
* video: EDID detection updates from Marvell Armada XP patchset
* video: backlight: add Marvell Dove LCD backlight driver
* video: display: add THS8200 display driver
* video: framebuffer: add Marvell Dove and Armada XP processor onchip LCD controller driver
* usbtest: add Interrupt transfer testing by Marvell Armada XP code
* usb: ehci: add support for Marvell EHCI controler
* tty/serial: 8250: add support for Marvell Armada XP processor and DeviceTree work
* rtc: add support for Marvell Armada XP onchip RTC controller
* net: pppoe: add Marvell ethernet NFP hook in PPPoE networking driver
* mtd: nand: add support for Marvell Armada XP Nand Flash Controller
* mtd: maps: add Marvell Armada XP specific map driver
* mmc: add support for Marvell Armada XP MMC/SD host controller
* i2c: add support for Marvell Armada XP onchip i2c bus controller
* hwmon: add Kconfig option for Armada XP onchip thermal sensor driver
* dmaengine: add Net DMA support for splice and update Marvell XOR DMA engine driver
* ata: add support for Marvell Armada XP SATA controller and update some quirks
* ARM: add Marvell Armada XP machine to mach-types
* ARM: oprofile: add support for Marvell PJ4B core
* ARM: mm: more ARMv6 switches for Marvell Armada XP
* ARM: remove static declaration to allow compilation
* ARM: alignment access fault trick
* ARM: mm: skip some fault fixing when run on NONE SMP ARMv6 mode during early abort event
* ARM: mm: add Marvell Sheeva CPU Architecture for PJ4B
* ARM: introduce optimized copy operation for Marvell Armada XP
* ARM: SAUCE: hardware breakpoint trick for Marvell Armada XP
* ARM: big endian and little endian tricks for Marvell Armada XP
* ARM: SAUCE: Add Marvell Armada XP build rules to arch/arm/kernel/Makefile
* ARM: vfp: add special handling for Marvell Armada XP
* ARM: add support for Marvell U-Boot
* ARM: add mv_controller_num for ARM PCI drivers
* ARM: add support for local PMUs, general SMP tweaks and cache flushing
* ARM: add Marvell device identifies in glue-proc.h
* ARM: add IPC driver support for Marvell platforms
* ARM: add DMA mapping for Marvell platforms
* ARM: add Sheeva errata and PJ4B code for booting
* ARM: update Kconfig and Makefile to include Marvell Armada XP platforms
* ARM: Armada XP: import LSP from Marvell for Armada XP 3.2 kernel enablement

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
 
 * drivers/base/power/runtime.c - Helper functions for device run-time PM
 
2
 * drivers/base/power/runtime.c - Helper functions for device runtime PM
3
3
 *
4
4
 * Copyright (c) 2009 Rafael J. Wysocki <rjw@sisk.pl>, Novell Inc.
5
5
 * Copyright (C) 2010 Alan Stern <stern@rowland.harvard.edu>
8
8
 */
9
9
 
10
10
#include <linux/sched.h>
 
11
#include <linux/export.h>
11
12
#include <linux/pm_runtime.h>
 
13
#include <trace/events/rpm.h>
12
14
#include "power.h"
13
15
 
14
16
static int rpm_resume(struct device *dev, int rpmflags);
28
30
void update_pm_runtime_accounting(struct device *dev)
29
31
{
30
32
        unsigned long now = jiffies;
31
 
        int delta;
 
33
        unsigned long delta;
32
34
 
33
35
        delta = now - dev->power.accounting_timestamp;
34
36
 
35
 
        if (delta < 0)
36
 
                delta = 0;
37
 
 
38
37
        dev->power.accounting_timestamp = now;
39
38
 
40
39
        if (dev->power.disable_depth > 0)
135
134
 
136
135
        if (dev->power.runtime_error)
137
136
                retval = -EINVAL;
138
 
        else if (atomic_read(&dev->power.usage_count) > 0
139
 
            || dev->power.disable_depth > 0)
 
137
        else if (dev->power.disable_depth > 0)
 
138
                retval = -EACCES;
 
139
        else if (atomic_read(&dev->power.usage_count) > 0)
140
140
                retval = -EAGAIN;
141
141
        else if (!pm_children_suspended(dev))
142
142
                retval = -EBUSY;
154
154
}
155
155
 
156
156
/**
 
157
 * __rpm_callback - Run a given runtime PM callback for a given device.
 
158
 * @cb: Runtime PM callback to run.
 
159
 * @dev: Device to run the callback for.
 
160
 */
 
161
static int __rpm_callback(int (*cb)(struct device *), struct device *dev)
 
162
        __releases(&dev->power.lock) __acquires(&dev->power.lock)
 
163
{
 
164
        int retval;
 
165
 
 
166
        if (dev->power.irq_safe)
 
167
                spin_unlock(&dev->power.lock);
 
168
        else
 
169
                spin_unlock_irq(&dev->power.lock);
 
170
 
 
171
        retval = cb(dev);
 
172
 
 
173
        if (dev->power.irq_safe)
 
174
                spin_lock(&dev->power.lock);
 
175
        else
 
176
                spin_lock_irq(&dev->power.lock);
 
177
 
 
178
        return retval;
 
179
}
 
180
 
 
181
/**
157
182
 * rpm_idle - Notify device bus type if the device can be suspended.
158
183
 * @dev: Device to notify the bus type about.
159
184
 * @rpmflags: Flag bits.
160
185
 *
161
 
 * Check if the device's run-time PM status allows it to be suspended.  If
 
186
 * Check if the device's runtime PM status allows it to be suspended.  If
162
187
 * another idle notification has been started earlier, return immediately.  If
163
188
 * the RPM_ASYNC flag is set then queue an idle-notification request; otherwise
164
189
 * run the ->runtime_idle() callback directly.
170
195
        int (*callback)(struct device *);
171
196
        int retval;
172
197
 
 
198
        trace_rpm_idle(dev, rpmflags);
173
199
        retval = rpm_check_suspend_allowed(dev);
174
200
        if (retval < 0)
175
201
                ;       /* Conditions are wrong. */
213
239
 
214
240
        dev->power.idle_notification = true;
215
241
 
216
 
        if (dev->pwr_domain)
217
 
                callback = dev->pwr_domain->ops.runtime_idle;
 
242
        if (dev->pm_domain)
 
243
                callback = dev->pm_domain->ops.runtime_idle;
218
244
        else if (dev->type && dev->type->pm)
219
245
                callback = dev->type->pm->runtime_idle;
220
246
        else if (dev->class && dev->class->pm)
224
250
        else
225
251
                callback = NULL;
226
252
 
227
 
        if (callback) {
228
 
                spin_unlock_irq(&dev->power.lock);
229
 
 
230
 
                callback(dev);
231
 
 
232
 
                spin_lock_irq(&dev->power.lock);
233
 
        }
 
253
        if (callback)
 
254
                __rpm_callback(callback, dev);
234
255
 
235
256
        dev->power.idle_notification = false;
236
257
        wake_up_all(&dev->power.wait_queue);
237
258
 
238
259
 out:
 
260
        trace_rpm_return_int(dev, _THIS_IP_, retval);
239
261
        return retval;
240
262
}
241
263
 
245
267
 * @dev: Device to run the callback for.
246
268
 */
247
269
static int rpm_callback(int (*cb)(struct device *), struct device *dev)
248
 
        __releases(&dev->power.lock) __acquires(&dev->power.lock)
249
270
{
250
271
        int retval;
251
272
 
252
273
        if (!cb)
253
274
                return -ENOSYS;
254
275
 
255
 
        if (dev->power.irq_safe) {
256
 
                retval = cb(dev);
257
 
        } else {
258
 
                spin_unlock_irq(&dev->power.lock);
259
 
 
260
 
                retval = cb(dev);
261
 
 
262
 
                spin_lock_irq(&dev->power.lock);
263
 
        }
 
276
        retval = __rpm_callback(cb, dev);
 
277
 
264
278
        dev->power.runtime_error = retval;
265
 
        return retval;
 
279
        return retval != -EACCES ? retval : -EIO;
266
280
}
267
281
 
268
282
/**
269
 
 * rpm_suspend - Carry out run-time suspend of given device.
 
283
 * rpm_suspend - Carry out runtime suspend of given device.
270
284
 * @dev: Device to suspend.
271
285
 * @rpmflags: Flag bits.
272
286
 *
273
 
 * Check if the device's run-time PM status allows it to be suspended.  If
274
 
 * another suspend has been started earlier, either return immediately or wait
275
 
 * for it to finish, depending on the RPM_NOWAIT and RPM_ASYNC flags.  Cancel a
276
 
 * pending idle notification.  If the RPM_ASYNC flag is set then queue a
277
 
 * suspend request; otherwise run the ->runtime_suspend() callback directly.
278
 
 * If a deferred resume was requested while the callback was running then carry
279
 
 * it out; otherwise send an idle notification for the device (if the suspend
280
 
 * failed) or for its parent (if the suspend succeeded).
 
287
 * Check if the device's runtime PM status allows it to be suspended.
 
288
 * Cancel a pending idle notification, autosuspend or suspend. If
 
289
 * another suspend has been started earlier, either return immediately
 
290
 * or wait for it to finish, depending on the RPM_NOWAIT and RPM_ASYNC
 
291
 * flags. If the RPM_ASYNC flag is set then queue a suspend request;
 
292
 * otherwise run the ->runtime_suspend() callback directly. When
 
293
 * ->runtime_suspend succeeded, if a deferred resume was requested while
 
294
 * the callback was running then carry it out, otherwise send an idle
 
295
 * notification for its parent (if the suspend succeeded and both
 
296
 * ignore_children of parent->power and irq_safe of dev->power are not set).
281
297
 * If ->runtime_suspend failed with -EAGAIN or -EBUSY, and if the RPM_AUTO
282
298
 * flag is set and the next autosuspend-delay expiration time is in the
283
299
 * future, schedule another autosuspend attempt.
291
307
        struct device *parent = NULL;
292
308
        int retval;
293
309
 
294
 
        dev_dbg(dev, "%s flags 0x%x\n", __func__, rpmflags);
 
310
        trace_rpm_suspend(dev, rpmflags);
295
311
 
296
312
 repeat:
297
313
        retval = rpm_check_suspend_allowed(dev);
343
359
                        goto out;
344
360
                }
345
361
 
 
362
                if (dev->power.irq_safe) {
 
363
                        spin_unlock(&dev->power.lock);
 
364
 
 
365
                        cpu_relax();
 
366
 
 
367
                        spin_lock(&dev->power.lock);
 
368
                        goto repeat;
 
369
                }
 
370
 
346
371
                /* Wait for the other suspend running in parallel with us. */
347
372
                for (;;) {
348
373
                        prepare_to_wait(&dev->power.wait_queue, &wait,
377
402
 
378
403
        __update_runtime_status(dev, RPM_SUSPENDING);
379
404
 
380
 
        if (dev->pwr_domain)
381
 
                callback = dev->pwr_domain->ops.runtime_suspend;
 
405
        if (dev->pm_domain)
 
406
                callback = dev->pm_domain->ops.runtime_suspend;
382
407
        else if (dev->type && dev->type->pm)
383
408
                callback = dev->type->pm->runtime_suspend;
384
409
        else if (dev->class && dev->class->pm)
391
416
        retval = rpm_callback(callback, dev);
392
417
        if (retval) {
393
418
                __update_runtime_status(dev, RPM_ACTIVE);
394
 
                dev->power.deferred_resume = 0;
 
419
                dev->power.deferred_resume = false;
395
420
                if (retval == -EAGAIN || retval == -EBUSY) {
396
421
                        dev->power.runtime_error = 0;
397
422
 
407
432
                } else {
408
433
                        pm_runtime_cancel_pending(dev);
409
434
                }
410
 
        } else {
 
435
                wake_up_all(&dev->power.wait_queue);
 
436
                goto out;
 
437
        }
411
438
 no_callback:
412
 
                __update_runtime_status(dev, RPM_SUSPENDED);
413
 
                pm_runtime_deactivate_timer(dev);
 
439
        __update_runtime_status(dev, RPM_SUSPENDED);
 
440
        pm_runtime_deactivate_timer(dev);
414
441
 
415
 
                if (dev->parent) {
416
 
                        parent = dev->parent;
417
 
                        atomic_add_unless(&parent->power.child_count, -1, 0);
418
 
                }
 
442
        if (dev->parent) {
 
443
                parent = dev->parent;
 
444
                atomic_add_unless(&parent->power.child_count, -1, 0);
419
445
        }
420
446
        wake_up_all(&dev->power.wait_queue);
421
447
 
437
463
        }
438
464
 
439
465
 out:
440
 
        dev_dbg(dev, "%s returns %d\n", __func__, retval);
 
466
        trace_rpm_return_int(dev, _THIS_IP_, retval);
441
467
 
442
468
        return retval;
443
469
}
444
470
 
445
471
/**
446
 
 * rpm_resume - Carry out run-time resume of given device.
 
472
 * rpm_resume - Carry out runtime resume of given device.
447
473
 * @dev: Device to resume.
448
474
 * @rpmflags: Flag bits.
449
475
 *
450
 
 * Check if the device's run-time PM status allows it to be resumed.  Cancel
 
476
 * Check if the device's runtime PM status allows it to be resumed.  Cancel
451
477
 * any scheduled or pending requests.  If another resume has been started
452
478
 * earlier, either return immediately or wait for it to finish, depending on the
453
479
 * RPM_NOWAIT and RPM_ASYNC flags.  Similarly, if there's a suspend running in
466
492
        struct device *parent = NULL;
467
493
        int retval = 0;
468
494
 
469
 
        dev_dbg(dev, "%s flags 0x%x\n", __func__, rpmflags);
 
495
        trace_rpm_resume(dev, rpmflags);
470
496
 
471
497
 repeat:
472
498
        if (dev->power.runtime_error)
473
499
                retval = -EINVAL;
474
500
        else if (dev->power.disable_depth > 0)
475
 
                retval = -EAGAIN;
 
501
                retval = -EACCES;
476
502
        if (retval)
477
503
                goto out;
478
504
 
503
529
                        goto out;
504
530
                }
505
531
 
 
532
                if (dev->power.irq_safe) {
 
533
                        spin_unlock(&dev->power.lock);
 
534
 
 
535
                        cpu_relax();
 
536
 
 
537
                        spin_lock(&dev->power.lock);
 
538
                        goto repeat;
 
539
                }
 
540
 
506
541
                /* Wait for the operation carried out in parallel with us. */
507
542
                for (;;) {
508
543
                        prepare_to_wait(&dev->power.wait_queue, &wait,
564
599
 
565
600
                spin_lock(&parent->power.lock);
566
601
                /*
567
 
                 * We can resume if the parent's run-time PM is disabled or it
 
602
                 * We can resume if the parent's runtime PM is disabled or it
568
603
                 * is set to ignore children.
569
604
                 */
570
605
                if (!parent->power.disable_depth
587
622
 
588
623
        __update_runtime_status(dev, RPM_RESUMING);
589
624
 
590
 
        if (dev->pwr_domain)
591
 
                callback = dev->pwr_domain->ops.runtime_resume;
 
625
        if (dev->pm_domain)
 
626
                callback = dev->pm_domain->ops.runtime_resume;
592
627
        else if (dev->type && dev->type->pm)
593
628
                callback = dev->type->pm->runtime_resume;
594
629
        else if (dev->class && dev->class->pm)
622
657
                spin_lock_irq(&dev->power.lock);
623
658
        }
624
659
 
625
 
        dev_dbg(dev, "%s returns %d\n", __func__, retval);
 
660
        trace_rpm_return_int(dev, _THIS_IP_, retval);
626
661
 
627
662
        return retval;
628
663
}
629
664
 
630
665
/**
631
 
 * pm_runtime_work - Universal run-time PM work function.
 
666
 * pm_runtime_work - Universal runtime PM work function.
632
667
 * @work: Work structure used for scheduling the execution of this function.
633
668
 *
634
669
 * Use @work to get the device object the work is to be done for, determine what
635
 
 * is to be done and execute the appropriate run-time PM function.
 
670
 * is to be done and execute the appropriate runtime PM function.
636
671
 */
637
672
static void pm_runtime_work(struct work_struct *work)
638
673
{
731
766
EXPORT_SYMBOL_GPL(pm_schedule_suspend);
732
767
 
733
768
/**
734
 
 * __pm_runtime_idle - Entry point for run-time idle operations.
 
769
 * __pm_runtime_idle - Entry point for runtime idle operations.
735
770
 * @dev: Device to send idle notification for.
736
771
 * @rpmflags: Flag bits.
737
772
 *
739
774
 * return immediately if it is larger than zero.  Then carry out an idle
740
775
 * notification, either synchronous or asynchronous.
741
776
 *
742
 
 * This routine may be called in atomic context if the RPM_ASYNC flag is set.
 
777
 * This routine may be called in atomic context if the RPM_ASYNC flag is set,
 
778
 * or if pm_runtime_irq_safe() has been called.
743
779
 */
744
780
int __pm_runtime_idle(struct device *dev, int rpmflags)
745
781
{
746
782
        unsigned long flags;
747
783
        int retval;
748
784
 
 
785
        might_sleep_if(!(rpmflags & RPM_ASYNC) && !dev->power.irq_safe);
 
786
 
749
787
        if (rpmflags & RPM_GET_PUT) {
750
788
                if (!atomic_dec_and_test(&dev->power.usage_count))
751
789
                        return 0;
760
798
EXPORT_SYMBOL_GPL(__pm_runtime_idle);
761
799
 
762
800
/**
763
 
 * __pm_runtime_suspend - Entry point for run-time put/suspend operations.
 
801
 * __pm_runtime_suspend - Entry point for runtime put/suspend operations.
764
802
 * @dev: Device to suspend.
765
803
 * @rpmflags: Flag bits.
766
804
 *
768
806
 * return immediately if it is larger than zero.  Then carry out a suspend,
769
807
 * either synchronous or asynchronous.
770
808
 *
771
 
 * This routine may be called in atomic context if the RPM_ASYNC flag is set.
 
809
 * This routine may be called in atomic context if the RPM_ASYNC flag is set,
 
810
 * or if pm_runtime_irq_safe() has been called.
772
811
 */
773
812
int __pm_runtime_suspend(struct device *dev, int rpmflags)
774
813
{
775
814
        unsigned long flags;
776
815
        int retval;
777
816
 
 
817
        might_sleep_if(!(rpmflags & RPM_ASYNC) && !dev->power.irq_safe);
 
818
 
778
819
        if (rpmflags & RPM_GET_PUT) {
779
820
                if (!atomic_dec_and_test(&dev->power.usage_count))
780
821
                        return 0;
789
830
EXPORT_SYMBOL_GPL(__pm_runtime_suspend);
790
831
 
791
832
/**
792
 
 * __pm_runtime_resume - Entry point for run-time resume operations.
 
833
 * __pm_runtime_resume - Entry point for runtime resume operations.
793
834
 * @dev: Device to resume.
794
835
 * @rpmflags: Flag bits.
795
836
 *
796
837
 * If the RPM_GET_PUT flag is set, increment the device's usage count.  Then
797
838
 * carry out a resume, either synchronous or asynchronous.
798
839
 *
799
 
 * This routine may be called in atomic context if the RPM_ASYNC flag is set.
 
840
 * This routine may be called in atomic context if the RPM_ASYNC flag is set,
 
841
 * or if pm_runtime_irq_safe() has been called.
800
842
 */
801
843
int __pm_runtime_resume(struct device *dev, int rpmflags)
802
844
{
803
845
        unsigned long flags;
804
846
        int retval;
805
847
 
 
848
        might_sleep_if(!(rpmflags & RPM_ASYNC) && !dev->power.irq_safe);
 
849
 
806
850
        if (rpmflags & RPM_GET_PUT)
807
851
                atomic_inc(&dev->power.usage_count);
808
852
 
815
859
EXPORT_SYMBOL_GPL(__pm_runtime_resume);
816
860
 
817
861
/**
818
 
 * __pm_runtime_set_status - Set run-time PM status of a device.
 
862
 * __pm_runtime_set_status - Set runtime PM status of a device.
819
863
 * @dev: Device to handle.
820
 
 * @status: New run-time PM status of the device.
 
864
 * @status: New runtime PM status of the device.
821
865
 *
822
 
 * If run-time PM of the device is disabled or its power.runtime_error field is
 
866
 * If runtime PM of the device is disabled or its power.runtime_error field is
823
867
 * different from zero, the status may be changed either to RPM_ACTIVE, or to
824
868
 * RPM_SUSPENDED, as long as that reflects the actual state of the device.
825
869
 * However, if the device has a parent and the parent is not active, and the
865
909
 
866
910
                /*
867
911
                 * It is invalid to put an active child under a parent that is
868
 
                 * not active, has run-time PM enabled and the
 
912
                 * not active, has runtime PM enabled and the
869
913
                 * 'power.ignore_children' flag unset.
870
914
                 */
871
915
                if (!parent->power.disable_depth
899
943
 * @dev: Device to handle.
900
944
 *
901
945
 * Flush all pending requests for the device from pm_wq and wait for all
902
 
 * run-time PM operations involving the device in progress to complete.
 
946
 * runtime PM operations involving the device in progress to complete.
903
947
 *
904
948
 * Should be called under dev->power.lock with interrupts disabled.
905
949
 */
947
991
 * Prevent the device from being suspended by incrementing its usage counter and
948
992
 * if there's a pending resume request for the device, wake the device up.
949
993
 * Next, make sure that all pending requests for the device have been flushed
950
 
 * from pm_wq and wait for all run-time PM operations involving the device in
 
994
 * from pm_wq and wait for all runtime PM operations involving the device in
951
995
 * progress to complete.
952
996
 *
953
997
 * Return value:
977
1021
EXPORT_SYMBOL_GPL(pm_runtime_barrier);
978
1022
 
979
1023
/**
980
 
 * __pm_runtime_disable - Disable run-time PM of a device.
 
1024
 * __pm_runtime_disable - Disable runtime PM of a device.
981
1025
 * @dev: Device to handle.
982
1026
 * @check_resume: If set, check if there's a resume request for the device.
983
1027
 *
984
1028
 * Increment power.disable_depth for the device and if was zero previously,
985
 
 * cancel all pending run-time PM requests for the device and wait for all
 
1029
 * cancel all pending runtime PM requests for the device and wait for all
986
1030
 * operations in progress to complete.  The device can be either active or
987
 
 * suspended after its run-time PM has been disabled.
 
1031
 * suspended after its runtime PM has been disabled.
988
1032
 *
989
1033
 * If @check_resume is set and there's a resume request pending when
990
1034
 * __pm_runtime_disable() is called and power.disable_depth is zero, the
991
 
 * function will wake up the device before disabling its run-time PM.
 
1035
 * function will wake up the device before disabling its runtime PM.
992
1036
 */
993
1037
void __pm_runtime_disable(struct device *dev, bool check_resume)
994
1038
{
1001
1045
 
1002
1046
        /*
1003
1047
         * Wake up the device if there's a resume request pending, because that
1004
 
         * means there probably is some I/O to process and disabling run-time PM
 
1048
         * means there probably is some I/O to process and disabling runtime PM
1005
1049
         * shouldn't prevent the device from processing the I/O.
1006
1050
         */
1007
1051
        if (check_resume && dev->power.request_pending
1026
1070
EXPORT_SYMBOL_GPL(__pm_runtime_disable);
1027
1071
 
1028
1072
/**
1029
 
 * pm_runtime_enable - Enable run-time PM of a device.
 
1073
 * pm_runtime_enable - Enable runtime PM of a device.
1030
1074
 * @dev: Device to handle.
1031
1075
 */
1032
1076
void pm_runtime_enable(struct device *dev)
1045
1089
EXPORT_SYMBOL_GPL(pm_runtime_enable);
1046
1090
 
1047
1091
/**
1048
 
 * pm_runtime_forbid - Block run-time PM of a device.
 
1092
 * pm_runtime_forbid - Block runtime PM of a device.
1049
1093
 * @dev: Device to handle.
1050
1094
 *
1051
1095
 * Increase the device's usage count and clear its power.runtime_auto flag,
1068
1112
EXPORT_SYMBOL_GPL(pm_runtime_forbid);
1069
1113
 
1070
1114
/**
1071
 
 * pm_runtime_allow - Unblock run-time PM of a device.
 
1115
 * pm_runtime_allow - Unblock runtime PM of a device.
1072
1116
 * @dev: Device to handle.
1073
1117
 *
1074
1118
 * Decrease the device's usage count and set its power.runtime_auto flag.
1089
1133
EXPORT_SYMBOL_GPL(pm_runtime_allow);
1090
1134
 
1091
1135
/**
1092
 
 * pm_runtime_no_callbacks - Ignore run-time PM callbacks for a device.
 
1136
 * pm_runtime_no_callbacks - Ignore runtime PM callbacks for a device.
1093
1137
 * @dev: Device to handle.
1094
1138
 *
1095
1139
 * Set the power.no_callbacks flag, which tells the PM core that this
1096
 
 * device is power-managed through its parent and has no run-time PM
1097
 
 * callbacks of its own.  The run-time sysfs attributes will be removed.
 
1140
 * device is power-managed through its parent and has no runtime PM
 
1141
 * callbacks of its own.  The runtime sysfs attributes will be removed.
1098
1142
 */
1099
1143
void pm_runtime_no_callbacks(struct device *dev)
1100
1144
{
1170
1214
 * @delay: Value of the new delay in milliseconds.
1171
1215
 *
1172
1216
 * Set the device's power.autosuspend_delay value.  If it changes to negative
1173
 
 * and the power.use_autosuspend flag is set, prevent run-time suspends.  If it
1174
 
 * changes the other way, allow run-time suspends.
 
1217
 * and the power.use_autosuspend flag is set, prevent runtime suspends.  If it
 
1218
 * changes the other way, allow runtime suspends.
1175
1219
 */
1176
1220
void pm_runtime_set_autosuspend_delay(struct device *dev, int delay)
1177
1221
{
1191
1235
 * @dev: Device to handle.
1192
1236
 * @use: New value for use_autosuspend.
1193
1237
 *
1194
 
 * Set the device's power.use_autosuspend flag, and allow or prevent run-time
 
1238
 * Set the device's power.use_autosuspend flag, and allow or prevent runtime
1195
1239
 * suspends as needed.
1196
1240
 */
1197
1241
void __pm_runtime_use_autosuspend(struct device *dev, bool use)
1208
1252
EXPORT_SYMBOL_GPL(__pm_runtime_use_autosuspend);
1209
1253
 
1210
1254
/**
1211
 
 * pm_runtime_init - Initialize run-time PM fields in given device object.
 
1255
 * pm_runtime_init - Initialize runtime PM fields in given device object.
1212
1256
 * @dev: Device object to initialize.
1213
1257
 */
1214
1258
void pm_runtime_init(struct device *dev)