summaryrefslogtreecommitdiff
path: root/include/power_led.h
blob: 2fd7322095e72b64debd990c4f128b65dca134ae (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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
/* Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */

/* Power LED control for Chrome EC */

#ifndef __CROS_EC_POWER_LED_H
#define __CROS_EC_POWER_LED_H

#include "common.h"

/* Interface for LM4-based boards */

enum powerled_color {
	POWERLED_OFF = 0,
	POWERLED_RED,
	POWERLED_YELLOW,
	POWERLED_GREEN,
	POWERLED_COLOR_COUNT  /* Number of colors, not a color itself */
};

#ifdef CONFIG_POWER_LED

/**
 * Set the power adapter LED
 *
 * @param color		Color to set LED
 *
 * @return EC_SUCCESS, or non-zero if error.
 */
int powerled_set(enum powerled_color color);

#else

static inline int powerled_set(enum powerled_color color) { return 0; }

#endif

/* Interface for STM32-based boards */

enum powerled_state {
	POWERLED_STATE_OFF,
	POWERLED_STATE_ON,
	POWERLED_STATE_SUSPEND,
	POWERLED_STATE_COUNT
};

enum powerled_config {
	POWERLED_CONFIG_MANUAL_OFF,
	POWERLED_CONFIG_MANUAL_ON,
	POWERLED_CONFIG_PWM,
};

#ifdef CONFIG_TASK_POWERLED

/**
 * Set the power LED
 *
 * @param state		Target state
 */
void powerled_set_state(enum powerled_state state);

#else

static inline void powerled_set_state(enum powerled_state state) {}

#endif

#endif /* __CROS_EC_POWER_LED_H */