summaryrefslogtreecommitdiff
path: root/zephyr/subsys/ap_pwrseq/include/signal_vw.h
blob: 55ecc73e99ae0eeb650850b3ea866b2123f6bc65 (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
/* Copyright 2022 The ChromiumOS Authors
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */

#ifndef __AP_PWRSEQ_SIGNAL_VW_H__
#define __AP_PWRSEQ_SIGNAL_VW_H__

#define PWR_SIG_TAG_VW PWR_VW_

/*
 * Generate enums for the virtual wire signals.
 * These enums are only used internally
 * to assign an index to each signal that is specific
 * to the source.
 */

#define TAG_VW(tag, name) DT_CAT(tag, name)

#define PWR_VW_ENUM(id) TAG_VW(PWR_SIG_TAG_VW, PWR_SIGNAL_ENUM(id)),

enum pwr_sig_vw {
#if HAS_VW_SIGNALS
	DT_FOREACH_STATUS_OKAY(intel_ap_pwrseq_vw, PWR_VW_ENUM)
#endif
		PWR_SIG_VW_COUNT
};

#undef PWR_VW_ENUM
#undef TAG_VW

/**
 * @brief Get the value of the virtual wire signal.
 *
 * @param index The VW signal index to get.
 * @return the current value of the virtual wire.
 */
int power_signal_vw_get(enum pwr_sig_vw vw);

/**
 * @brief Initialize the power signal interface.
 *
 * Called when the power sequence code is ready to start
 * processing inputs and outputs.
 */
void power_signal_vw_init(void);

#endif /* __AP_PWRSEQ_SIGNAL_VW_H__ */