On systems that have no runtime-pm, we mark the wakeref as being -1. We therefore cannot use that value for the mock-gt indicator, so opt for -ENODEV instead. The wakeref should never be an error value -- one hopes! Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Cc: Andi Shyti <andi.shyti@intel.com> Reviewed-by: Andi Shyti <andi.shyti@intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20190927211749.2181-2-chris@chris-wilson.co.uk
64 lines
1.3 KiB
C
64 lines
1.3 KiB
C
/*
|
|
* SPDX-License-Identifier: MIT
|
|
*
|
|
* Copyright © 2019 Intel Corporation
|
|
*/
|
|
|
|
#ifndef INTEL_GT_PM_H
|
|
#define INTEL_GT_PM_H
|
|
|
|
#include <linux/types.h>
|
|
|
|
#include "intel_gt_types.h"
|
|
#include "intel_wakeref.h"
|
|
|
|
enum {
|
|
INTEL_GT_UNPARK,
|
|
INTEL_GT_PARK,
|
|
};
|
|
|
|
static inline bool intel_gt_pm_is_awake(const struct intel_gt *gt)
|
|
{
|
|
return intel_wakeref_is_active(>->wakeref);
|
|
}
|
|
|
|
static inline void intel_gt_pm_get(struct intel_gt *gt)
|
|
{
|
|
intel_wakeref_get(>->wakeref);
|
|
}
|
|
|
|
static inline bool intel_gt_pm_get_if_awake(struct intel_gt *gt)
|
|
{
|
|
return intel_wakeref_get_if_active(>->wakeref);
|
|
}
|
|
|
|
static inline void intel_gt_pm_put(struct intel_gt *gt)
|
|
{
|
|
intel_wakeref_put(>->wakeref);
|
|
}
|
|
|
|
static inline int intel_gt_pm_wait_for_idle(struct intel_gt *gt)
|
|
{
|
|
return intel_wakeref_wait_for_idle(>->wakeref);
|
|
}
|
|
|
|
void intel_gt_pm_init_early(struct intel_gt *gt);
|
|
void intel_gt_pm_init(struct intel_gt *gt);
|
|
void intel_gt_pm_disable(struct intel_gt *gt);
|
|
void intel_gt_pm_fini(struct intel_gt *gt);
|
|
|
|
void intel_gt_sanitize(struct intel_gt *gt, bool force);
|
|
|
|
int intel_gt_resume(struct intel_gt *gt);
|
|
void intel_gt_suspend(struct intel_gt *gt);
|
|
|
|
void intel_gt_runtime_suspend(struct intel_gt *gt);
|
|
int intel_gt_runtime_resume(struct intel_gt *gt);
|
|
|
|
static inline bool is_mock_gt(const struct intel_gt *gt)
|
|
{
|
|
return I915_SELFTEST_ONLY(gt->awake == -ENODEV);
|
|
}
|
|
|
|
#endif /* INTEL_GT_PM_H */
|