summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJessy jiang <jiangchao5@huaqin.corp-partner.google.com>2019-02-15 14:08:33 +0800
committerchrome-bot <chrome-bot@chromium.org>2019-02-27 01:13:52 -0800
commit56cd91fda92d1dc8147c487737444933a665852a (patch)
tree93f19b12352339f7df0df79c2abad8de9e4013f5
parente4ac1eccf0920f53c1e3532b7ccbc3155c178508 (diff)
downloadchrome-ec-stabilize-11839.B.tar.gz
flapjack: Enable backlight channel for Flapjackstabilize-11839.Bstabilize-11839.3.B
flapjack requires to enable LED Bias to control LCD backlight. For C18 boards, three channels are required, and each channel has a current of 24 mA. For C19 boards, four channels are required, each channel having a current of 23.5mA. BUG=b:124465980 BRANCH=none TEST=1:)When the system boots, the backlight will light up. 2:)Use the ectool commands to check the channel and current. channle: ectool i2cread 8 0 104 0xA0 current: ectool i2cread 8 0 104 0xA5 If it's C18 board, get 0xfa in channel command and 0xc8 in current command. If it's C19 board, get 0xfe in channel command and 0xc4 in current command. If the SKU value of the board is empty or incorrect, the default value is the data of the C18 board. Change-Id: I2e51feec830c4cfd46e3eaec0f9db0e1cfdd620c Reviewed-on: https://chromium-review.googlesource.com/1475094 Commit-Ready: Jessy Jiang <jiangchao5@huaqin.corp-partner.google.com> Tested-by: Jessy Jiang <jiangchao5@huaqin.corp-partner.google.com> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
-rw-r--r--board/flapjack/board.c20
-rw-r--r--board/flapjack/board.h3
-rw-r--r--driver/charger/rt946x.h4
3 files changed, 27 insertions, 0 deletions
diff --git a/board/flapjack/board.c b/board/flapjack/board.c
index 13372d92f3..2077ff6b31 100644
--- a/board/flapjack/board.c
+++ b/board/flapjack/board.c
@@ -53,6 +53,25 @@ uint16_t board_version;
uint8_t oem;
uint32_t sku;
+static void board_setup_panel(void)
+{
+ uint8_t channel;
+ uint8_t dim;
+ int rv = 0;
+
+ channel = sku & SKU_ID_PANEL_SIZE_MASK ? 0xfe : 0xfa;
+ dim = sku & SKU_ID_PANEL_SIZE_MASK ? 0xc4 : 0xc8;
+
+ rv |= i2c_write8(I2C_PORT_CHARGER, RT946X_ADDR, MT6370_BACKLIGHT_BLEN,
+ channel);
+ rv |= i2c_write8(I2C_PORT_CHARGER, RT946X_ADDR, MT6370_BACKLIGHT_BLDIM,
+ dim);
+ rv |= i2c_write8(I2C_PORT_CHARGER, RT946X_ADDR, MT6370_BACKLIGHT_BLPWM,
+ 0xac);
+ if (rv)
+ CPRINTS("Board setup panel failed\n");
+}
+
static void cbi_init(void)
{
uint32_t val;
@@ -249,6 +268,7 @@ static void board_init(void)
/* Enable gauge interrupt from max17055 */
gpio_enable_interrupt(GPIO_GAUGE_INT_ODL);
+ board_setup_panel();
}
DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT);
diff --git a/board/flapjack/board.h b/board/flapjack/board.h
index 65d410fff9..260e29b16b 100644
--- a/board/flapjack/board.h
+++ b/board/flapjack/board.h
@@ -200,6 +200,9 @@
(EC_HOST_EVENT_MASK(EC_HOST_EVENT_POWER_BUTTON) |\
EC_HOST_EVENT_MASK(EC_HOST_EVENT_RTC))
+/* Define panel size mask according to skuid */
+#define SKU_ID_PANEL_SIZE_MASK (1 << 1)
+
#ifndef __ASSEMBLER__
enum oem_id {
diff --git a/driver/charger/rt946x.h b/driver/charger/rt946x.h
index 9f1d682901..d91def7b4c 100644
--- a/driver/charger/rt946x.h
+++ b/driver/charger/rt946x.h
@@ -136,6 +136,10 @@
#define MT6370_REG_RGBCHRINDCTRL 0x93
#define RT946X_REG_DPDMIRQ 0xC6
+/* backlight */
+#define MT6370_BACKLIGHT_BLEN 0xA0
+#define MT6370_BACKLIGHT_BLPWM 0xA2
+#define MT6370_BACKLIGHT_BLDIM 0xA5
/* status event */
#define MT6370_REG_CHGSTAT1 0xD0
#define RT946X_REG_CHGSTATC MT6370_REG_CHGSTAT1