blob: 5fb8ebf68ff22acd4593617f657963bd1020bac4 [file] [log] [blame]
Vadim Bendebury5fa5f992015-03-17 15:15:42 -07001/*
2 * Copyright (C) 2015 Google, Inc.
3 *
4 * This software is licensed under the terms of the GNU General Public
5 * License version 2, as published by the Free Software Foundation, and
6 * may be copied, distributed, and modified under those terms.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 */
13
14/*
15 * This is a driver for the Whirlwind LED ring, which is equipped with two LED
16 * microcontrollers TI LP55231 (http://www.ti.com/product/lp55231), each of
17 * them driving three multicolor LEDs.
18 *
19 * The only connection between the ring and the main board is an i2c bus.
20 *
21 * This driver imitates a depthcharge display device. On initialization the
22 * driver sets up the controllers to prepare them to accept programs to run.
23 *
24 * When a certain vboot state needs to be indicated, the program for that
25 * state is loaded into the controllers, resulting in the state appropriate
26 * LED behavior.
27 */
28
29#ifndef __THIRD_PARTY_COREBOOT_SRC_DRIVERS_I2C_WW_RING_WW_RING_PROGRAMS_H__
30#define __THIRD_PARTY_COREBOOT_SRC_DRIVERS_I2C_WW_RING_WW_RING_PROGRAMS_H__
31
32#include <stdint.h>
33#include "drivers/i2c/ww_ring/ww_ring.h"
34
35/* There are threee independent engines/cores in the controller. */
36#define LP55231_NUM_OF_ENGINES 3
37
38/* Number of lp55321 controllers on the ring */
Suresh Rajashekaraa39a5b62016-08-15 16:18:11 -070039#define WW_RING_NUM_LED_CONTROLLERS 1
Vadim Bendebury5fa5f992015-03-17 15:15:42 -070040
41/*
42 * Structure to describe an lp55231 program: pointer to the text of the
43 * program, its size and load address (load addr + size sould not exceed
44 * LP55231_MAX_PROG_SIZE), and start addresses for all of the three
45 * engines.
46 */
47typedef struct {
48 const uint8_t *program_text;
49 uint8_t program_size;
50 uint8_t load_addr;
51 uint8_t engine_start_addr[LP55231_NUM_OF_ENGINES];
52} TiLp55231Program;
53
54/* A structure to bind controller programs to a vboot state. */
55typedef struct {
56 enum display_pattern led_pattern;
57 const TiLp55231Program *programs[WW_RING_NUM_LED_CONTROLLERS];
58} WwRingStateProg;
59
60extern const WwRingStateProg wwr_state_programs[];
61
62#endif