Lines Matching refs:dev

54 static int runtime_suspend(const struct device *dev, bool async,  in runtime_suspend()  argument
58 struct pm_device *pm = dev->pm; in runtime_suspend()
99 ret = pm->base.action_cb(pm->dev, PM_DEVICE_ACTION_SUSPEND); in runtime_suspend()
108 if (atomic_test_bit(&dev->pm_base->flags, PM_DEVICE_FLAG_PD_CLAIMED)) { in runtime_suspend()
109 (void)pm_device_runtime_put(PM_DOMAIN(dev->pm_base)); in runtime_suspend()
110 atomic_clear_bit(&dev->pm_base->flags, PM_DEVICE_FLAG_PD_CLAIMED); in runtime_suspend()
129 ret = pm->base.action_cb(pm->dev, PM_DEVICE_ACTION_SUSPEND); in runtime_suspend_work()
155 static int get_sync_locked(const struct device *dev) in get_sync_locked() argument
158 struct pm_device_isr *pm = dev->pm_isr; in get_sync_locked()
175 ret = pm->base.action_cb(dev, PM_DEVICE_ACTION_RESUME); in get_sync_locked()
189 int pm_device_runtime_get(const struct device *dev) in pm_device_runtime_get() argument
192 struct pm_device *pm = dev->pm; in pm_device_runtime_get()
198 SYS_PORT_TRACING_FUNC_ENTER(pm, device_runtime_get, dev); in pm_device_runtime_get()
207 if (atomic_test_bit(&dev->pm_base->flags, PM_DEVICE_FLAG_ISR_SAFE)) { in pm_device_runtime_get()
208 struct pm_device_isr *pm_sync = dev->pm_isr; in pm_device_runtime_get()
211 ret = get_sync_locked(dev); in pm_device_runtime_get()
234 if (domain != NULL && !atomic_test_bit(&dev->pm_base->flags, PM_DEVICE_FLAG_PD_CLAIMED)) { in pm_device_runtime_get()
283 ret = pm->base.action_cb(pm->dev, PM_DEVICE_ACTION_RESUME); in pm_device_runtime_get()
300 SYS_PORT_TRACING_FUNC_EXIT(pm, device_runtime_get, dev, ret); in pm_device_runtime_get()
306 static int put_sync_locked(const struct device *dev) in put_sync_locked() argument
309 struct pm_device_isr *pm = dev->pm_isr; in put_sync_locked()
322 ret = pm->base.action_cb(dev, PM_DEVICE_ACTION_SUSPEND); in put_sync_locked()
344 int pm_device_runtime_put(const struct device *dev) in pm_device_runtime_put() argument
348 if (dev->pm_base == NULL) { in pm_device_runtime_put()
352 SYS_PORT_TRACING_FUNC_ENTER(pm, device_runtime_put, dev); in pm_device_runtime_put()
354 if (atomic_test_bit(&dev->pm_base->flags, PM_DEVICE_FLAG_ISR_SAFE)) { in pm_device_runtime_put()
355 struct pm_device_isr *pm_sync = dev->pm_isr; in pm_device_runtime_put()
358 ret = put_sync_locked(dev); in pm_device_runtime_put()
362 ret = runtime_suspend(dev, false, K_NO_WAIT); in pm_device_runtime_put()
364 SYS_PORT_TRACING_FUNC_EXIT(pm, device_runtime_put, dev, ret); in pm_device_runtime_put()
369 int pm_device_runtime_put_async(const struct device *dev, k_timeout_t delay) in pm_device_runtime_put_async() argument
374 if (dev->pm_base == NULL) { in pm_device_runtime_put_async()
378 SYS_PORT_TRACING_FUNC_ENTER(pm, device_runtime_put_async, dev, delay); in pm_device_runtime_put_async()
379 if (atomic_test_bit(&dev->pm_base->flags, PM_DEVICE_FLAG_ISR_SAFE)) { in pm_device_runtime_put_async()
380 struct pm_device_isr *pm_sync = dev->pm_isr; in pm_device_runtime_put_async()
383 ret = put_sync_locked(dev); in pm_device_runtime_put_async()
387 ret = runtime_suspend(dev, true, delay); in pm_device_runtime_put_async()
389 SYS_PORT_TRACING_FUNC_EXIT(pm, device_runtime_put_async, dev, delay, ret); in pm_device_runtime_put_async()
399 int pm_device_runtime_auto_enable(const struct device *dev) in pm_device_runtime_auto_enable() argument
401 struct pm_device_base *pm = dev->pm_base; in pm_device_runtime_auto_enable()
407 return pm_device_runtime_enable(dev); in pm_device_runtime_auto_enable()
410 static int runtime_enable_sync(const struct device *dev) in runtime_enable_sync() argument
413 struct pm_device_isr *pm = dev->pm_isr; in runtime_enable_sync()
417 ret = pm->base.action_cb(dev, PM_DEVICE_ACTION_SUSPEND); in runtime_enable_sync()
434 int pm_device_runtime_enable(const struct device *dev) in pm_device_runtime_enable() argument
437 struct pm_device *pm = dev->pm; in pm_device_runtime_enable()
439 SYS_PORT_TRACING_FUNC_ENTER(pm, device_runtime_enable, dev); in pm_device_runtime_enable()
450 if (pm_device_is_busy(dev)) { in pm_device_runtime_enable()
455 if (atomic_test_bit(&dev->pm_base->flags, PM_DEVICE_FLAG_ISR_SAFE)) { in pm_device_runtime_enable()
456 ret = runtime_enable_sync(dev); in pm_device_runtime_enable()
465 if (pm->dev == NULL) { in pm_device_runtime_enable()
466 pm->dev = dev; in pm_device_runtime_enable()
473 ret = pm->base.action_cb(pm->dev, PM_DEVICE_ACTION_SUSPEND); in pm_device_runtime_enable()
490 SYS_PORT_TRACING_FUNC_EXIT(pm, device_runtime_enable, dev, ret); in pm_device_runtime_enable()
494 static int runtime_disable_sync(const struct device *dev) in runtime_disable_sync() argument
496 struct pm_device_isr *pm = dev->pm_isr; in runtime_disable_sync()
501 ret = pm->base.action_cb(dev, PM_DEVICE_ACTION_RESUME); in runtime_disable_sync()
517 int pm_device_runtime_disable(const struct device *dev) in pm_device_runtime_disable() argument
520 struct pm_device *pm = dev->pm; in pm_device_runtime_disable()
522 SYS_PORT_TRACING_FUNC_ENTER(pm, device_runtime_disable, dev); in pm_device_runtime_disable()
533 if (atomic_test_bit(&dev->pm_base->flags, PM_DEVICE_FLAG_ISR_SAFE)) { in pm_device_runtime_disable()
534 ret = runtime_disable_sync(dev); in pm_device_runtime_disable()
564 ret = pm->base.action_cb(dev, PM_DEVICE_ACTION_RESUME); in pm_device_runtime_disable()
582 SYS_PORT_TRACING_FUNC_EXIT(pm, device_runtime_disable, dev, ret); in pm_device_runtime_disable()
587 bool pm_device_runtime_is_enabled(const struct device *dev) in pm_device_runtime_is_enabled() argument
589 struct pm_device_base *pm = dev->pm_base; in pm_device_runtime_is_enabled()
594 int pm_device_runtime_usage(const struct device *dev) in pm_device_runtime_usage() argument
596 if (!pm_device_runtime_is_enabled(dev)) { in pm_device_runtime_usage()
600 return dev->pm_base->usage; in pm_device_runtime_usage()