summaryrefslogtreecommitdiff
path: root/driver/led/lm3630a.c
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/lm3630a.c
parent08f5a1e6fc2c9467230444ac9b582dcf4d9f0068 (diff)
downloadchrome-ec-252457d4b21f46889eebad61d4c0a65331919cec.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/lm3630a.c')
-rw-r--r--driver/led/lm3630a.c86
1 files changed, 0 insertions, 86 deletions
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);
-}