summaryrefslogtreecommitdiff
path: root/zephyr/projects/corsola/led_magikarp.dts
blob: 0e2b0aca529dfbce8daef440b340f05c1c06d412 (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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
/* 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.
 */
#include "led_it81202_base.dtsi"

/ {
	led_colors: led-colors {
		compatible = "cros-ec,led-policy";

		/* Magikarp LED bat charge */
		bat-power-state-charge {
			charge-state = "PWR_STATE_CHARGE";
			/* Battery percent range (>= Empty, <= 94%) */
			batt-lvl = <BATTERY_LEVEL_EMPTY
				   (BATTERY_LEVEL_NEAR_FULL - 3)>;
			color-0 {
				led-color = <&color_battery_amber>;
			};
		};

		bat-power-state-charge-near-full {
			charge-state = "PWR_STATE_CHARGE";
			/* Battery percent range (>= 95%, <= Full) */
			batt-lvl = <(BATTERY_LEVEL_NEAR_FULL - 2)
				     BATTERY_LEVEL_FULL>;
			color-0 {
				led-color = <&color_battery_white>;
			};
		};

		/* Magikarp LED bat discharge */
		bat-power-state-discharge-s0 {
			charge-state = "PWR_STATE_DISCHARGE";
			chipset-state = "POWER_S0";
			/* Battery percent range (>= 11%, <= Full) */
			batt-lvl = <(BATTERY_LEVEL_LOW + 1) BATTERY_LEVEL_FULL>;

			color-0 {
				led-color = <&color_battery_white>;
			};
		};


		bat-power-state-discharge-s0-bat-low {
			charge-state = "PWR_STATE_DISCHARGE";
			chipset-state = "POWER_S0";
			/* Battery percent range (>= Empty, <= 10%) */
			batt-lvl = <BATTERY_LEVEL_EMPTY BATTERY_LEVEL_LOW>;

			color-0 {
				led-color = <&color_battery_amber>;
				period-ms = <1000>;
			};

			color-1 {
				led-color = <&color_battery_off>;
				period-ms = <3000>;
			};
		};

		bat-power-state-discharge-s3 {
			charge-state = "PWR_STATE_DISCHARGE";
			chipset-state = "POWER_S3";

			color-0 {
				led-color = <&color_battery_white>;
				period-ms = <1000>;
			};

			color-1 {
				led-color = <&color_battery_off>;
				period-ms = <3000>;
			};
		};

		bat-power-state-discharge-s5 {
			charge-state = "PWR_STATE_DISCHARGE";
			chipset-state = "POWER_S5";
			color-0 {
				led-color = <&color_battery_off>;
			};
		};

		/* Magikarp LED bat error */
		bat-power-state-error {
			charge-state = "PWR_STATE_ERROR";
			chipset-state = "POWER_S0";

			color-0 {
				led-color = <&color_battery_amber>;
				period-ms = <1000>;
			};

			color-1 {
				led-color = <&color_battery_off>;
				period-ms = <1000>;
			};
		};

		bat-power-state-error-s3 {
			charge-state = "PWR_STATE_ERROR";
			chipset-state = "POWER_S3";

			color-0 {
				led-color = <&color_battery_white>;
				period-ms = <1000>;
			};

			color-1 {
				led-color = <&color_battery_off>;
				period-ms = <3000>;
			};
		};

		bat-power-state-error-s5 {
			charge-state = "PWR_STATE_ERROR";
			chipset-state = "POWER_S5";

			color-0 {
				led-color = <&color_battery_off>;
			};
		};
	};

	pwm-led-pins {
		compatible = "cros-ec,pwm-led-pins";

		/* Overwrite Power LED white to off */
		color_power_white: color-power-white {
			led-color = "LED_WHITE";
			led-id = "EC_LED_ID_POWER_LED";
			led-pins = <&led_power_white 0>;
		};
	};
};