summaryrefslogtreecommitdiff
path: root/include/linux/pwrseq/consumer.h
blob: 7d583b4f266e625fa61a8a424a9dfbca7aab1603 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/* SPDX-License-Identifier: GPL-2.0-only */
/*
 * Copyright (C) 2024 Linaro Ltd.
 */

#ifndef __POWER_SEQUENCING_CONSUMER_H__
#define __POWER_SEQUENCING_CONSUMER_H__

#include <linux/err.h>

struct device;
struct pwrseq_desc;

#if IS_ENABLED(CONFIG_POWER_SEQUENCING)

struct pwrseq_desc * __must_check
pwrseq_get(struct device *dev, const char *target);
void pwrseq_put(struct pwrseq_desc *desc);

struct pwrseq_desc * __must_check
devm_pwrseq_get(struct device *dev, const char *target);

int pwrseq_power_on(struct pwrseq_desc *desc);
int pwrseq_power_off(struct pwrseq_desc *desc);

#else /* CONFIG_POWER_SEQUENCING */

static inline struct pwrseq_desc * __must_check
pwrseq_get(struct device *dev, const char *target)
{
	return ERR_PTR(-ENOSYS);
}

static inline void pwrseq_put(struct pwrseq_desc *desc)
{
}

static inline struct pwrseq_desc * __must_check
devm_pwrseq_get(struct device *dev, const char *target)
{
	return ERR_PTR(-ENOSYS);
}

static inline int pwrseq_power_on(struct pwrseq_desc *desc)
{
	return -ENOSYS;
}

static inline int pwrseq_power_off(struct pwrseq_desc *desc)
{
	return -ENOSYS;
}

#endif /* CONFIG_POWER_SEQUENCING */

#endif /* __POWER_SEQUENCING_CONSUMER_H__ */