summaryrefslogtreecommitdiff
path: root/driver/led
diff options
context:
space:
mode:
authorJack Rosenthal <jrosenth@chromium.org>2021-11-04 12:11:58 -0600
committerCommit Bot <commit-bot@chromium.org>2021-11-05 04:22:34 +0000
commit252457d4b21f46889eebad61d4c0a65331919cec (patch)
tree01856c4d31d710b20e85a74c8d7b5836e35c3b98 /driver/led
parent08f5a1e6fc2c9467230444ac9b582dcf4d9f0068 (diff)
downloadchrome-ec-stabilize-14477.B-ish.tar.gz
In the interest of making long-term branch maintenance incur as little technical debt on us as possible, we should not maintain any files on the branch we are not actually using. This has the added effect of making it extremely clear when merging CLs from the main branch when changes have the possibility to affect us. The follow-on CL adds a convenience script to actually pull updates from the main branch and generate a CL for the update. BUG=b:204206272 BRANCH=ish TEST=make BOARD=arcada_ish && make BOARD=drallion_ish Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: I17e4694c38219b5a0823e0a3e55a28d1348f4b18 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3262038 Reviewed-by: Jett Rink <jettrink@chromium.org> Reviewed-by: Tom Hughes <tomhughes@chromium.org>
Diffstat (limited to 'driver/led')
-rw-r--r--driver/led/ds2413.c166
-rw-r--r--driver/led/lm3509.c85
-rw-r--r--driver/led/lm3509.h37
-rw-r--r--driver/led/lm3630a.c86
-rw-r--r--driver/led/lm3630a.h68
-rw-r--r--driver/led/lp5562.c160
-rw-r--r--driver/led/lp5562.h76
-rw-r--r--driver/led/max695x.c123
-rw-r--r--driver/led/max695x.h44
-rw-r--r--driver/led/oz554.c147
-rw-r--r--driver/led/oz554.h35
11 files changed, 0 insertions, 1027 deletions
diff --git a/driver/led/ds2413.c b/driver/led/ds2413.c
deleted file mode 100644
index b856d85671..0000000000
--- a/driver/led/ds2413.c
+++ /dev/null
@@ -1,166 +0,0 @@
-/* Copyright 2013 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 */
-
-#include "charge_state.h"
-#include "console.h"
-#include "hooks.h"
-#include "onewire.h"
-#include "timer.h"
-#include "util.h"
-
-#define ONEWIRE_RETRIES 10
-
-enum led_color {
- LED_OFF = 0,
- LED_RED,
- LED_YELLOW,
- LED_GREEN,
- LED_COLOR_COUNT /* Number of colors, not a color itself */
-};
-
-static const uint8_t led_masks[LED_COLOR_COUNT] = {0xff, 0xfe, 0xfc, 0xfd};
-static const char * const color_names[LED_COLOR_COUNT] = {
- "off", "red", "yellow", "green"};
-
-/**
- * Set the onewire LED GPIO controller outputs
- *
- * @param mask Mask of outputs to enable
- *
- * @return EC_SUCCESS, or non-zero if error.
- */
-static int led_set_mask(int mask)
-{
- int rv;
-
- /* Reset the 1-wire bus */
- rv = onewire_reset();
- if (rv)
- return rv;
-
- /* Skip ROM, since only one device */
- onewire_write(0xcc);
-
- /* Write and turn on the LEDs */
- onewire_write(0x5a);
- onewire_write(mask);
- onewire_write(~mask); /* Repeat inverted */
-
- rv = onewire_read(); /* Confirmation byte */
- if (rv != 0xaa)
- return EC_ERROR_UNKNOWN;
-
- /* The next byte is a read-back of the chip status. Since we're only
- * using lines as outputs, we can ignore it. */
- return EC_SUCCESS;
-}
-
-static int led_set(enum led_color color)
-{
- int rv = EC_SUCCESS;
- int i;
-
- /*
- * 1-wire communication can fail for timing reasons in the current
- * system. We have a limited timing window to send/receive bits, but
- * we can't disable interrupts for the rest of the system to guarantee
- * we hit that window. Instead, simply retry the low-level command a
- * few times.
- */
- for (i = 0; i < ONEWIRE_RETRIES; i++) {
- rv = led_set_mask(led_masks[color]);
- if (rv == EC_SUCCESS)
- break;
-
- /*
- * Sleep for a bit between tries. This gives the 1-wire GPIO
- * chip time to recover from the failed attempt, and allows
- * lower-priority tasks a chance to run.
- */
- usleep(100);
- }
-
- return rv;
-}
-
-/*****************************************************************************/
-/* Hooks */
-
-static void onewire_led_tick(void)
-{
- static enum led_color current_color = LED_COLOR_COUNT;
- static int tick_count;
-
- enum led_color new_color = LED_OFF;
- uint32_t chflags = charge_get_flags();
-
- tick_count++;
-
- if (!(chflags & CHARGE_FLAG_EXTERNAL_POWER)) {
- /* AC isn't present, so the power LED on the AC plug is off */
- current_color = LED_OFF;
- return;
- }
-
- /* Translate charge state to LED color */
- switch (charge_get_state()) {
- case PWR_STATE_IDLE:
- if (chflags & CHARGE_FLAG_FORCE_IDLE)
- new_color = (tick_count & 1) ? LED_GREEN : LED_OFF;
- else
- new_color = LED_GREEN;
- break;
- case PWR_STATE_CHARGE:
- new_color = LED_YELLOW;
- break;
- case PWR_STATE_CHARGE_NEAR_FULL:
- new_color = LED_GREEN;
- break;
- case PWR_STATE_ERROR:
- new_color = LED_RED;
- break;
- default:
- /* Other states don't change LED color */
- break;
- }
-
- /*
- * The power adapter on link can partially unplug and lose its LED
- * state. There's no way to detect this, so just assume it forgets its
- * state every 10 seconds.
- */
- if (!(tick_count % 10))
- current_color = LED_COLOR_COUNT;
-
- /* If current color is still correct, leave now */
- if (new_color == current_color)
- return;
-
- /* Update LED */
- if (!led_set(new_color))
- current_color = new_color;
-}
-DECLARE_HOOK(HOOK_SECOND, onewire_led_tick, HOOK_PRIO_DEFAULT);
-
-/*****************************************************************************/
-/* Console commands */
-#define CONFIG_CMD_POWERLED
-static int command_powerled(int argc, char **argv)
-{
- int i;
-
- /* Pick a color, any color... */
- for (i = 0; i < LED_COLOR_COUNT; i++) {
- if (!strcasecmp(argv[1], color_names[i]))
- return led_set(i);
- }
- return EC_ERROR_PARAM1;
-}
-DECLARE_CONSOLE_COMMAND(powerled, command_powerled,
- "<off | red | yellow | green>",
- "Set power LED color");
-#endif
diff --git a/driver/led/lm3509.c b/driver/led/lm3509.c
deleted file mode 100644
index 7c20c43ac2..0000000000
--- a/driver/led/lm3509.c
+++ /dev/null
@@ -1,85 +0,0 @@
-/* Copyright 2018 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.
- *
- * TI LM3509 LED driver.
- */
-
-#include "compile_time_macros.h"
-#include "i2c.h"
-#include "keyboard_backlight.h"
-#include "lm3509.h"
-
-static inline int lm3509_write(uint8_t reg, uint8_t val)
-{
- return i2c_write8(I2C_PORT_KBLIGHT, LM3509_I2C_ADDR_FLAGS,
- reg, val);
-}
-
-static inline int lm3509_read(uint8_t reg, int *val)
-{
- return i2c_read8(I2C_PORT_KBLIGHT, LM3509_I2C_ADDR_FLAGS,
- reg, val);
-}
-
-/* Brightness level (0.0 to 100.0%) to brightness register conversion table */
-static const uint16_t lm3509_brightness[32] = {
- 0, 1, 6, 10, 11, 13, 16, 20,
- 24, 28, 31, 37, 43, 52, 62, 75,
- 87, 100, 125, 150, 168, 187, 225, 262,
- 312, 375, 437, 525, 612, 700, 875, 1000
-};
-
-static int brightness_to_bmain(int percent)
-{
- int i;
- int b = percent * 10;
-
- for (i = 1; i < sizeof(lm3509_brightness); i++) {
- int low = lm3509_brightness[i - 1];
- int high = lm3509_brightness[i];
- if (high < b)
- continue;
- /* rounding to the nearest */
- return (b - low < high - b) ? i - 1 : i;
- }
- /* Brightness is out of range. Return the highest value. */
- return i - 1;
-}
-
-static int lm3509_power(int enable)
-{
- /* Enable both MAIN and SUB in unison mode.
- * Don't alter brightness here. It's not driver's business. */
- return lm3509_write(LM3509_REG_GP, enable ? 0x7 : 0);
-}
-
-static int lm3509_set_brightness(int percent)
-{
- /* We don't need to read/mask/write BMAIN because bit6 and 7 are non
- * functional read only bits.
- */
- return lm3509_write(LM3509_REG_BMAIN, brightness_to_bmain(percent));
-}
-
-static int lm3509_get_brightness(void)
-{
- int rv, val;
- rv = lm3509_read(LM3509_REG_BMAIN, &val);
- if (rv)
- return -1;
- val &= LM3509_BMAIN_MASK;
- return lm3509_brightness[val] / 10;
-}
-
-static int lm3509_init(void)
-{
- return EC_SUCCESS;
-}
-
-const struct kblight_drv kblight_lm3509 = {
- .init = lm3509_init,
- .set = lm3509_set_brightness,
- .get = lm3509_get_brightness,
- .enable = lm3509_power,
-};
diff --git a/driver/led/lm3509.h b/driver/led/lm3509.h
deleted file mode 100644
index a7defe1fb7..0000000000
--- a/driver/led/lm3509.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/* Copyright 2018 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.
- *
- * TI LM3509 LED driver.
- */
-
-#ifndef __CROS_EC_LM3509_H
-#define __CROS_EC_LM3509_H
-
-#define LM3509_I2C_ADDR_FLAGS 0x36
-
-/*
- * General purpose register
- *
- * [2]= set both main and secondary current same
- * both control by BMAIN.
- * [1]= enable secondary current sink.
- * [0]= enable main current sink.
- */
-#define LM3509_REG_GP 0x10
-
-/*
- * Brightness register
- *
- * 0x00: 0%
- * 0x1F: 100%
- * Power-on-value: 0% (0xE0)
- */
-#define LM3509_REG_BMAIN 0xA0
-#define LM3509_REG_BSUB 0xB0
-
-#define LM3509_BMAIN_MASK 0x1F
-
-extern const struct kblight_drv kblight_lm3509;
-
-#endif /* __CROS_EC_LM3509_H */
diff --git a/driver/led/lm3630a.c b/driver/led/lm3630a.c
deleted file mode 100644
index a2c4aaa74c..0000000000
--- a/driver/led/lm3630a.c
+++ /dev/null
@@ -1,86 +0,0 @@
-/* Copyright 2018 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.
- *
- * TI LM3630A LED driver.
- */
-
-#include "hooks.h"
-#include "i2c.h"
-#include "lm3630a.h"
-#include "timer.h"
-
-
-/* I2C address */
-#define LM3630A_I2C_ADDR_FLAGS 0x36
-
-static inline int lm3630a_write(uint8_t reg, uint8_t val)
-{
- return i2c_write8(I2C_PORT_KBLIGHT, LM3630A_I2C_ADDR_FLAGS,
- reg, val);
-}
-
-static inline int lm3630a_read(uint8_t reg, int *val)
-{
- return i2c_read8(I2C_PORT_KBLIGHT, LM3630A_I2C_ADDR_FLAGS,
- reg, val);
-}
-
-static void deferred_lm3630a_poweron(void)
-{
- /*
- * Set full brightness so that PWM will control. This needs to happen
- * after setting the control register, because enabling the banks
- * resets the value to 0.
- */
- lm3630a_write(LM3630A_REG_A_BRIGHTNESS, 0xff);
-}
-DECLARE_DEFERRED(deferred_lm3630a_poweron);
-
-int lm3630a_poweron(void)
-{
- int ret = 0;
-
- /*
- * LM3630A will NAK I2C transactions for 1ms (tWAIT in the datasheet)
- * after HWEN asserted or after SW reset.
- */
- msleep(1);
-
- /* Sample PWM every 8 periods. */
- ret |= lm3630a_write(LM3630A_REG_FILTER_STRENGTH, 0x3);
-
- /* Enable feedback and PWM for banks A. */
- ret |= lm3630a_write(LM3630A_REG_CONFIG,
- LM3630A_CFG_BIT_FB_EN_A |
- LM3630A_CFG_BIT_PWM_EN_A);
-
- /* 24V, 800mA overcurrent protection, 500kHz boost frequency. */
- ret |= lm3630a_write(LM3630A_REG_BOOST_CONTROL,
- LM3630A_BOOST_OVP_24V |
- LM3630A_BOOST_OCP_800MA |
- LM3630A_FMODE_500KHZ);
-
- /* Limit current to 24.5mA */
- ret |= lm3630a_write(LM3630A_REG_A_CURRENT, 0x1a);
-
- /* Enable bank A, put in linear mode, and connect LED2 to bank A. */
- ret |= lm3630a_write(LM3630A_REG_CONTROL,
- LM3630A_CTRL_BIT_LINEAR_A |
- LM3630A_CTRL_BIT_LED_EN_A |
- LM3630A_CTRL_BIT_LED2_ON_A);
-
- /*
- * Only set the brightness after ~100 ms. Without this, LED may blink
- * for a short duration, as the PWM sampler sometimes appears to be
- * confused, and slowly dim from a large initial PWM input value.
- */
- hook_call_deferred(&deferred_lm3630a_poweron_data, 100 * MSEC);
-
- return ret;
-}
-
-int lm3630a_poweroff(void)
-{
- return lm3630a_write(LM3630A_REG_CONTROL, LM3630A_CTRL_BIT_SLEEP_CMD);
-}
diff --git a/driver/led/lm3630a.h b/driver/led/lm3630a.h
deleted file mode 100644
index d43304b66e..0000000000
--- a/driver/led/lm3630a.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/* Copyright 2018 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.
- *
- * TI LM3630A LED driver.
- */
-
-#ifndef __CROS_EC_LM3630A_H
-#define __CROS_EC_LM3630A_H
-
-#define LM3630A_REG_CONTROL 0x00
-#define LM3630A_REG_CONFIG 0x01
-#define LM3630A_REG_BOOST_CONTROL 0x02
-#define LM3630A_REG_A_BRIGHTNESS 0x03
-#define LM3630A_REG_B_BRIGHTNESS 0x04
-#define LM3630A_REG_A_CURRENT 0x05
-#define LM3630A_REG_B_CURRENT 0x06
-#define LM3630A_REG_ONOFF_RAMP 0x07
-#define LM3630A_REG_RUN_RAMP 0x08
-#define LM3630A_REG_INT_STATUS 0x09
-#define LM3630A_REG_INT_ENABLE 0x0a
-#define LM3630A_REG_FAULT_STATUS 0x0b
-#define LM3630A_REG_SW_RESET 0x0f
-#define LM3630A_REG_PWM_OUT_LOW 0x12
-#define LM3630A_REG_PWM_OUT_HIGH 0x13
-#define LM3630A_REG_REVISION 0x1f
-#define LM3630A_REG_FILTER_STRENGTH 0x50
-
-/* Control register bits */
-#define LM3630A_CTRL_BIT_SLEEP_CMD BIT(7)
-#define LM3630A_CTRL_BIT_SLEEP_STAT BIT(6)
-#define LM3630A_CTRL_BIT_LINEAR_A BIT(4)
-#define LM3630A_CTRL_BIT_LINEAR_B BIT(3)
-#define LM3630A_CTRL_BIT_LED_EN_A BIT(2)
-#define LM3630A_CTRL_BIT_LED_EN_B BIT(1)
-#define LM3630A_CTRL_BIT_LED2_ON_A BIT(0)
-
-/* Config register bits */
-#define LM3630A_CFG_BIT_FB_EN_B BIT(4)
-#define LM3630A_CFG_BIT_FB_EN_A BIT(3)
-#define LM3630A_CFG_BIT_PWM_LOW BIT(2)
-#define LM3630A_CFG_BIT_PWM_EN_B BIT(1)
-#define LM3630A_CFG_BIT_PWM_EN_A BIT(0)
-
-/* Boost control register bits */
-#define LM3630A_BOOST_OVP_16V (0 << 5)
-#define LM3630A_BOOST_OVP_24V BIT(5)
-#define LM3630A_BOOST_OVP_32V (2 << 5)
-#define LM3630A_BOOST_OVP_40V (3 << 5)
-#define LM3630A_BOOST_OCP_600MA (0 << 3)
-#define LM3630A_BOOST_OCP_800MA BIT(3)
-#define LM3630A_BOOST_OCP_1000MA (2 << 3)
-#define LM3630A_BOOST_OCP_1200MA (3 << 3)
-#define LM3630A_BOOST_SLOW_START BIT(2)
-#define LM3630A_SHIFT_500KHZ (0 << 1) /* FMODE=0 */
-#define LM3630A_SHIFT_560KHZ BIT(1) /* FMODE=0 */
-#define LM3630A_SHIFT_1000KHZ (0 << 1) /* FMODE=1 */
-#define LM3630A_SHIFT_1120KHZ BIT(1) /* FMODE=1 */
-#define LM3630A_FMODE_500KHZ (0 << 0)
-#define LM3630A_FMODE_1000KHZ BIT(0)
-
-/* Power on and initialize LM3630A. */
-int lm3630a_poweron(void);
-
-/* Power off LM3630A. */
-int lm3630a_poweroff(void);
-
-#endif /* __CROS_EC_LM3630A_H */
diff --git a/driver/led/lp5562.c b/driver/led/lp5562.c
deleted file mode 100644
index e0758a8b91..0000000000
--- a/driver/led/lp5562.c
+++ /dev/null
@@ -1,160 +0,0 @@
-/* Copyright 2013 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.
- *
- * TI LP5562 driver.
- */
-
-#include "console.h"
-#include "i2c.h"
-#include "lp5562.h"
-#include "timer.h"
-#include "util.h"
-
-/* I2C address */
-#define LP5562_I2C_ADDR_FLAGS 0x30
-
-inline int lp5562_write(uint8_t reg, uint8_t val)
-{
- return i2c_write8(I2C_PORT_MASTER, LP5562_I2C_ADDR_FLAGS, reg, val);
-}
-
-inline int lp5562_read(uint8_t reg, int *val)
-{
- return i2c_read8(I2C_PORT_MASTER, LP5562_I2C_ADDR_FLAGS, reg, val);
-}
-
-int lp5562_set_color(uint32_t rgb)
-{
- int ret = 0;
-
- ret |= lp5562_write(LP5562_REG_B_PWM, rgb & 0xff);
- ret |= lp5562_write(LP5562_REG_G_PWM, (rgb >> 8) & 0xff);
- ret |= lp5562_write(LP5562_REG_R_PWM, (rgb >> 16) & 0xff);
-
- return ret;
-}
-
-int lp5562_set_engine(uint8_t r, uint8_t g, uint8_t b)
-{
- return lp5562_write(LP5562_REG_LED_MAP, (r << 4) | (g << 2) | b);
-}
-
-int lp5562_engine_load(int engine, const uint8_t *program, int size)
-{
- int prog_addr = LP5562_REG_ENG_PROG(engine);
- int i, ret, val;
- int shift = 6 - engine * 2;
-
- ret = lp5562_read(LP5562_REG_OP_MODE, &val);
- if (ret)
- return ret;
- val &= ~(0x3 << shift);
- val |= 0x1 << shift;
- ret = lp5562_write(LP5562_REG_OP_MODE, val);
- if (ret)
- return ret;
-
- for (i = 0; i < size; ++i) {
- ret = lp5562_write(prog_addr + i, program[i]);
- if (ret)
- return ret;
- }
-
- val &= ~(0x3 << shift);
- val |= 0x2 << shift;
- ret = lp5562_write(LP5562_REG_OP_MODE, val);
-
- return ret;
-}
-
-int lp5562_engine_control(int eng1, int eng2, int eng3)
-{
- int ret, val;
-
- ret = lp5562_read(LP5562_REG_ENABLE, &val);
- if (ret)
- return ret;
- val &= 0xc0;
- val |= (eng1 << 4) | (eng2 << 2) | eng3;
- return lp5562_write(LP5562_REG_ENABLE, val);
-}
-
-int lp5562_get_engine_state(int engine)
-{
- int val;
-
- if (lp5562_read(LP5562_REG_ENABLE, &val))
- return 0xee;
- return (val >> (6 - engine * 2)) & 0x3;
-}
-
-int lp5562_poweron(void)
-{
- int ret = 0;
-
- ret |= lp5562_write(LP5562_REG_ENABLE, 0x40);
- udelay(500); /* start-up delay */
-
- ret |= lp5562_write(LP5562_REG_CONFIG, 0x1);
- ret |= lp5562_write(LP5562_REG_LED_MAP, 0x0);
-
- return ret;
-}
-
-int lp5562_poweroff(void)
-{
- return lp5562_write(LP5562_REG_ENABLE, 0x0);
-}
-
-int lp5562_get_pc(int engine)
-{
- int ret;
- if (lp5562_read(LP5562_REG_ENG1_PC + engine - 1, &ret))
- return 0xee;
- return ret;
-}
-
-int lp5562_set_pc(int engine, int val)
-{
- return lp5562_write(LP5562_REG_ENG1_PC + engine - 1, val);
-}
-
-/*****************************************************************************/
-/* Console commands */
-#ifdef CONFIG_CMD_POWERLED
-static int command_lp5562(int argc, char **argv)
-{
- if (argc == 4) {
- char *e;
- uint8_t red, green, blue;
-
- red = strtoi(argv[1], &e, 0);
- if (e && *e)
- return EC_ERROR_PARAM1;
- green = strtoi(argv[2], &e, 0);
- if (e && *e)
- return EC_ERROR_PARAM2;
- blue = strtoi(argv[3], &e, 0);
- if (e && *e)
- return EC_ERROR_PARAM3;
-
- return lp5562_set_color((red << 16) | (green << 8) | blue);
- } else if (argc == 2) {
- int v;
-
- if (!parse_bool(argv[1], &v))
- return EC_ERROR_PARAM1;
-
- if (v)
- return lp5562_poweron();
- else
- return lp5562_poweroff();
- }
-
- return EC_ERROR_INVAL;
-}
-DECLARE_CONSOLE_COMMAND(lp5562, command_lp5562,
- "on | off | <red> <green> <blue>",
- "Set the color of the LED");
-#endif
diff --git a/driver/led/lp5562.h b/driver/led/lp5562.h
deleted file mode 100644
index 75e820aab7..0000000000
--- a/driver/led/lp5562.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/* Copyright 2013 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.
- *
- * TI LP5562 LED driver.
- */
-
-#ifndef __CROS_EC_LP5562_H
-#define __CROS_EC_LP5562_H
-
-#define LP5562_REG_ENABLE 0x00
-#define LP5562_REG_OP_MODE 0x01
-#define LP5562_REG_B_PWM 0x02
-#define LP5562_REG_G_PWM 0x03
-#define LP5562_REG_R_PWM 0x04
-#define LP5562_REG_B_CURRENT 0x05
-#define LP5562_REG_G_CURRENT 0x06
-#define LP5562_REG_R_CURRENT 0x07
-#define LP5562_REG_CONFIG 0x08
-#define LP5562_REG_ENG1_PC 0x09
-#define LP5562_REG_ENG2_PC 0x0a
-#define LP5562_REG_ENG3_PC 0x0b
-#define LP5562_REG_STATUS 0x0c
-#define LP5562_REG_RESET 0x0d
-#define LP5562_REG_W_PWM 0x0e
-#define LP5562_REG_W_CURRENT 0x0f
-#define LP5562_REG_LED_MAP 0x70
-
-#define LP5562_REG_ENG_PROG(n) (0x10 + ((n)-1) * 0x20)
-
-/* Brightness range: 0x00 - 0xff */
-#define LP5562_COLOR_NONE 0x000000
-#define LP5562_COLOR_RED(b) (0x010000 * (b))
-#define LP5562_COLOR_GREEN(b) (0x000100 * (b))
-#define LP5562_COLOR_BLUE(b) (0x000001 * (b))
-
-#define LP5562_ENG_SEL_NONE 0x0
-#define LP5562_ENG_SEL_1 0x1
-#define LP5562_ENG_SEL_2 0x2
-#define LP5562_ENG_SEL_3 0x3
-
-#define LP5562_ENG_HOLD 0x0
-#define LP5562_ENG_STEP 0x1
-#define LP5562_ENG_RUN 0x2
-
-/* Power on and initialize LP5562. */
-int lp5562_poweron(void);
-
-/* Power off LP5562. */
-int lp5562_poweroff(void);
-
-/*
- * Set LED color.
- * The parameter 'rgb' is in the format 0x00RRGGBB.
- */
-int lp5562_set_color(uint32_t rgb);
-
-/* Set lighting engine used by each color */
-int lp5562_set_engine(uint8_t r, uint8_t g, uint8_t b);
-
-/* Load lighting engine program */
-int lp5562_engine_load(int engine, const uint8_t *program, int size);
-
-/* Control lighting engine execution state */
-int lp5562_engine_control(int eng1, int eng2, int eng3);
-
-/* Get engine execution state. Return 0xee on error. */
-int lp5562_get_engine_state(int engine);
-
-/* Get current program counter. Return 0xee on error. */
-int lp5562_get_pc(int engine);
-
-/* Set program counter */
-int lp5562_set_pc(int engine, int val);
-
-#endif /* __CROS_EC_LP5562_H */
diff --git a/driver/led/max695x.c b/driver/led/max695x.c
deleted file mode 100644
index 6f0e1b8e84..0000000000
--- a/driver/led/max695x.c
+++ /dev/null
@@ -1,123 +0,0 @@
-/* Copyright 2019 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.
- *
- * MAX6958/MAX6959 7-Segment LED Display Driver
- */
-
-#include "common.h"
-#include "console.h"
-#include "display_7seg.h"
-#include "hooks.h"
-#include "i2c.h"
-#include "max695x.h"
-#include "util.h"
-
-#define CPRINTS(format, args...) cprints(CC_SYSTEM, format, ## args)
-
-static inline int max695x_i2c_write8(uint8_t offset, uint8_t data)
-{
- return i2c_write8(I2C_PORT_PORT80, PORT80_I2C_ADDR,
- offset, (int)data);
-}
-
-static inline int max695x_i2c_write(uint8_t offset, uint8_t *data, int len)
-{
- /*
- * The address pointer stored in the MAX695x increments after
- * each data byte is written unless the address equals 01111111
- */
- return i2c_write_block(I2C_PORT_PORT80, PORT80_I2C_ADDR,
- offset, data, len);
-}
-
-int display_7seg_write(enum seven_seg_module_display module, uint16_t data)
-{
- uint8_t buf[4];
-
- /*
- * Convert the data into binary coded hexadecimal value i.e.
- * in hexadecimal code-decode mode, the decoder prints 1 byte
- * on two segments. It checks the lower nibble of the data in
- * the digit register (D3–D0), disregarding bits D7–D4. Hence,
- * preparing the hexadecimal buffer to be sent.
- *
- * Segment 3-2 : Module name
- * 0xEC : EC
- * 0x80 : PORT80
- * Segment 1-0 : Data
- * For console Command segment 3-0 : Data
- */
- switch (module) {
- case SEVEN_SEG_CONSOLE_DISPLAY:
- /* Segment - 3 */
- buf[0] = (data >> 12) & 0x0F;
- /* Segment - 2 */
- buf[1] = (data >> 8) & 0x0F;
- break;
- case SEVEN_SEG_EC_DISPLAY:
- /* Segment - 3 */
- buf[0] = 0x0E;
- /* Segment - 2 */
- buf[1] = 0x0C;
- break;
- case SEVEN_SEG_PORT80_DISPLAY:
- /* Segment - 3 */
- buf[0] = 0x08;
- /* Segment - 2 */
- buf[1] = 0x00;
- break;
- default:
- CPRINTS("Unknown Module");
- return EC_ERROR_UNKNOWN;
- }
- /* Segment - 1 */
- buf[2] = (data >> 4) & 0x0F;
- /* Segment - 0 */
- buf[3] = data & 0x0F;
-
- return max695x_i2c_write(MAX695X_DIGIT0_ADDR, buf, ARRAY_SIZE(buf));
-}
-
-/**
- * Initialise MAX656x 7-segment display.
- */
-static void max695x_init(void)
-{
- uint8_t buf[4] = {
- [0] = MAX695X_DECODE_MODE_HEX_DECODE,
- [1] = MAX695X_INTENSITY_MEDIUM,
- [2] = MAX695X_SCAN_LIMIT_4,
- [3] = MAX695X_CONFIG_OPR_NORMAL
- };
- max695x_i2c_write(MAX695X_REG_DECODE_MODE, buf, ARRAY_SIZE(buf));
-}
-DECLARE_HOOK(HOOK_INIT, max695x_init, HOOK_PRIO_DEFAULT);
-
-static void max695x_shutdown(void)
-{
- max695x_i2c_write8(MAX695X_REG_CONFIG,
- MAX695X_CONFIG_OPR_SHUTDOWN);
-}
-DECLARE_HOOK(HOOK_CHIPSET_SHUTDOWN, max695x_shutdown, HOOK_PRIO_DEFAULT);
-
-#ifdef CONFIG_CMD_SEVEN_SEG_DISPLAY
-static int console_command_max695x_write(int argc, char **argv)
-{
- char *e;
- int val;
-
- if (argc < 2)
- return EC_ERROR_PARAM_COUNT;
-
- /* Get value to be written to the seven segment display*/
- val = strtoi(argv[1], &e, 0);
- if (*e || val < 0 || val > UINT16_MAX)
- return EC_ERROR_PARAM1;
-
- return display_7seg_write(SEVEN_SEG_CONSOLE_DISPLAY, val);
-}
-DECLARE_CONSOLE_COMMAND(seg, console_command_max695x_write,
- "<val>",
- "Write to 7 segment display in hex");
-#endif
diff --git a/driver/led/max695x.h b/driver/led/max695x.h
deleted file mode 100644
index 5ed5d91e2f..0000000000
--- a/driver/led/max695x.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/* Copyright 2019 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.
- *
- * MAX6958/MAX6959 7-Segment LED Display Driver header
- */
-
-#ifndef __CROS_EC_MAX656X_H
-#define __CROS_EC_MAX656X_H
-
-/* I2C interface */
-#define MAX695X_I2C_ADDR1_FLAGS 0x38
-#define MAX695X_I2C_ADDR2_FLAGS 0x39
-
-/* Decode mode register */
-#define MAX695X_REG_DECODE_MODE 0x01
-/* Hexadecimal decode for digits 3–0 */
-#define MAX695X_DECODE_MODE_HEX_DECODE 0x0f
-
-/* Intensity register */
-#define MAX695X_REG_INTENSITY 0x02
-/* Setting meduim intensity */
-#define MAX695X_INTENSITY_MEDIUM 0x20
-
-/* Scan limit register value */
-#define MAX695X_REG_SCAN_LIMIT 0x03
-
-/* Scanning digits 0-3 */
-#define MAX695X_SCAN_LIMIT_4 0x03
-
-/* Configuration register */
-#define MAX695X_REG_CONFIG 0x04
-/* Shutdown seven segment display */
-#define MAX695X_CONFIG_OPR_SHUTDOWN 0x00
-/* Start seven segment display */
-#define MAX695X_CONFIG_OPR_NORMAL 0x01
-
-/* Digit addresses */
-#define MAX695X_DIGIT0_ADDR 0x20
-#define MAX695X_DIGIT1_ADDR 0x21
-#define MAX695X_DIGIT2_ADDR 0x22
-#define MAX695X_DIGIT3_ADDR 0x23
-
-#endif /* __CROS_EC_MAX656X_H */
diff --git a/driver/led/oz554.c b/driver/led/oz554.c
deleted file mode 100644
index 504ac55e90..0000000000
--- a/driver/led/oz554.c
+++ /dev/null
@@ -1,147 +0,0 @@
-/* Copyright 2018 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.
- *
- * O2 Micro OZ554 LED driver.
- */
-
-#include "console.h"
-#include "gpio.h"
-#include "hooks.h"
-#include "i2c.h"
-#include "oz554.h"
-#include "task.h"
-#include "timer.h"
-
-#define CPRINTS(format, args...) cprints(CC_I2C, format, ## args)
-#define CPRINTF(format, args...) cprintf(CC_I2C, format, ## args)
-
-#define I2C_ADDR_OZ554_FLAGS 0x31
-
-struct oz554_value {
- uint8_t offset;
- uint8_t data;
-};
-
-/*
- * OZ554ALN asserts the interrupt when it's ready for writing settings, which
- * are cleared when it's turned off. We enable the interrupt on HOOK_INIT and
- * keep it enabled in S0/S3/S5.
- *
- * It's assumed the device doesn't have a lid and OZ554ALN is powered only in
- * S0. For clamshell devices, different interrupt & power control scheme may be
- * needed.
- */
-
-/* This ordering is suggested by vendor. */
-static struct oz554_value oz554_conf[] = {
- /*
- * Reigster 0x01: Operation frequency control
- * Frequency selection: 300(KHz)
- * Short circuit protection: 8(V)
- */
- {.offset = 1, .data = 0x43},
- /*
- * Reigster 0x02: LED current amplitude control
- * ISET Resistor: 10.2(Kohm)
- * Maximum LED current: 1636/10.2 = 160.4(mA)
- * Setting LED current: 65(mA)
- */
- {.offset = 2, .data = 0x65},
- /*
- * Reigster 0x03: LED backlight Status
- * Status function: Read only
- */
- {.offset = 3, .data = 0x00},
- /*
- * Reigster 0x04: LED current control with SMBus
- * SMBus PWM function: None Use
- */
- {.offset = 4, .data = 0x00},
- /*
- * Reigster 0x05: OVP, OCP control
- * Over Current Protection: 0.5(V)
- * Panel LED Voltage(Max): 47.8(V)
- * OVP setting: 54(V)
- */
- {.offset = 5, .data = 0x97},
- /*
- * Reigster 0x00: Dimming mode and string ON/OFF control
- * String Selection: 4(Number)
- * Interface Selection: 1
- * Brightness mode: 3
- */
- {.offset = 0, .data = 0xF2},
-};
-static const int oz554_conf_size = ARRAY_SIZE(oz554_conf);
-
-static void set_oz554_reg(void)
-{
- int i;
-
- for (i = 0; i < oz554_conf_size; ++i) {
- int rv = i2c_write8(I2C_PORT_BACKLIGHT,
- I2C_ADDR_OZ554_FLAGS,
- oz554_conf[i].offset, oz554_conf[i].data);
- if (rv) {
- CPRINTS("Write OZ554 register %d failed rv=%d" , i, rv);
- return;
- }
- }
- CPRINTS("Wrote OZ554 settings");
-}
-
-static void backlight_enable_deferred(void)
-{
- if (gpio_get_level(GPIO_PANEL_BACKLIGHT_EN))
- set_oz554_reg();
-}
-DECLARE_DEFERRED(backlight_enable_deferred);
-
-void backlight_enable_interrupt(enum gpio_signal signal)
-{
- /*
- * 1. Spec says backlight should be turned on after 500ms
- * after eDP signals are ready.
- *
- * 2. There's no way to get exact eDP ready time, therefore,
- * give one second delay.
- *
- * power up __/----------------
- * eDP ______/------------
- * backlight _____________/-----
- * |- t1 -| : >=500 ms
- * |- t2 -| : 1 second is enough
- */
- hook_call_deferred(&backlight_enable_deferred_data,
- OZ554_POWER_BACKLIGHT_DELAY);
-}
-
-int oz554_set_config(int offset, int data)
-{
- int i;
- for (i = 0; i < oz554_conf_size; i++) {
- if (oz554_conf[i].offset == offset)
- break;
- }
- if (i >= oz554_conf_size) {
- /* Matching offset not found */
- CPRINTS("oz554: offset %d not found", i);
- return EC_ERROR_INVAL;
- }
- oz554_conf[i].data = data;
- return EC_SUCCESS;
-}
-
-static void init_oz554(void)
-{
- oz554_board_init();
-
- gpio_enable_interrupt(GPIO_PANEL_BACKLIGHT_EN);
-}
-DECLARE_HOOK(HOOK_INIT, init_oz554, HOOK_PRIO_DEFAULT);
-
-
-__overridable void oz554_board_init(void)
-{
-}
diff --git a/driver/led/oz554.h b/driver/led/oz554.h
deleted file mode 100644
index d1d9d9656e..0000000000
--- a/driver/led/oz554.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/* Copyright 2018 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.
- *
- * O2 Micro OZ554 LED driver.
- */
-
-#ifndef __CROS_EC_OZ554_H
-#define __CROS_EC_OZ554_H
-
-#include "gpio.h"
-#include "common.h"
-
-/*
- * Overridable board initialization. Should be overridden by a board
- * specific function if the default is not appropriate
- */
-__override_proto void oz554_board_init(void);
-
-/**
- * Update oz554 configuration array (oz554_conf).
- *
- * @param offset: Offset of the register to be set.
- * @param data: Value to be set.
- * @return EC_SUCCESS or EC_ERROR_* for errors.
- */
-int oz554_set_config(int offset, int data);
-
-#ifndef OZ554_POWER_BACKLIGHT_DELAY
-#define OZ554_POWER_BACKLIGHT_DELAY SECOND
-#endif
-
-void backlight_enable_interrupt(enum gpio_signal signal);
-
-#endif