summaryrefslogtreecommitdiff
path: root/power
diff options
context:
space:
mode:
authorBen Lok <ben.lok@mediatek.com>2015-02-10 22:28:18 +0800
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2015-03-09 10:41:36 +0000
commit9e9ccfa24bc2fe2320b675969d7275f0e642d292 (patch)
tree26c1d925a3ba596f7053b8f4331ca720d8a63ecd /power
parent9eb1380d63752967306b6f0af8456ad7f94d8b17 (diff)
downloadchrome-ec-9e9ccfa24bc2fe2320b675969d7275f0e642d292.tar.gz
llama: enable the EC backlight override for mediatek platform.
1. Override the panel backlight enable signal from SoC in llama board, force the backlight off on lid close. 2. Revise the function llama_lid_event to mtk_lid_event, makes more sense. BRANCH=master BUG=none TEST=lid switch to open/close, observe the LCD backlight behavior. the backlight should be off, when lid is close. the backlight should be on, when lid is open. BOARD=llama Change-Id: Id1bff440c8bb6cee19c82615e916b8a2f2aa62ac Signed-off-by: Ben Lok <ben.lok@mediatek.com> (cherry picked from commit a90516b0a5493a55536e29d550f65cc743156710) Reviewed-on: https://chromium-review.googlesource.com/255441 Reviewed-by: Rong Chang <rongchang@chromium.org>
Diffstat (limited to 'power')
-rw-r--r--power/mediatek.c36
1 files changed, 34 insertions, 2 deletions
diff --git a/power/mediatek.c b/power/mediatek.c
index 8515c27310..e4b54c59d9 100644
--- a/power/mediatek.c
+++ b/power/mediatek.c
@@ -140,6 +140,16 @@ enum power_on_event_t {
POWER_ON_EVENT_COUNT,
};
+/**
+ * Parameters of mtk_backlight_override().
+ */
+enum blacklight_override_t {
+ MTK_BACKLIGHT_FORCE_OFF,
+ MTK_BACKLIGHT_CONTROL_BY_SOC,
+
+ MTK_BACKLIGHT_OVERRIDE_COUNT,
+};
+
/* Forward declaration */
static void chipset_turn_off_power_rails(void);
@@ -261,8 +271,30 @@ static int check_for_power_off_event(void)
return POWER_OFF_CANCEL;
}
-static void llama_lid_event(void)
+/**
+ * Set the LCD backlight enable pin and override the signal from SoC.
+ *
+ * @param asserted MTK_BACKLIGHT_FORCE_OFF, force off the panel backlight
+ * MTK_BACKLIGHT_CONTROL_BY_SOC, leave the control to SOC
+ */
+static void mtk_backlight_override(enum blacklight_override_t asserted)
+{
+ /* Signal is active-low */
+ gpio_set_level(GPIO_EC_BL_OVERRIDE, !asserted);
+}
+
+static void mtk_lid_event(void)
{
+ enum blacklight_override_t bl_override;
+
+ /* Override the panel backlight enable signal from SoC,
+ * force the backlight off on lid close.
+ */
+ bl_override = lid_is_open() ?
+ MTK_BACKLIGHT_CONTROL_BY_SOC :
+ MTK_BACKLIGHT_FORCE_OFF;
+ mtk_backlight_override(bl_override);
+
/* Power task only cares about lid-open events */
if (!lid_is_open())
return;
@@ -270,7 +302,7 @@ static void llama_lid_event(void)
lid_opened = 1;
task_wake(TASK_ID_CHIPSET);
}
-DECLARE_HOOK(HOOK_LID_CHANGE, llama_lid_event, HOOK_PRIO_DEFAULT);
+DECLARE_HOOK(HOOK_LID_CHANGE, mtk_lid_event, HOOK_PRIO_DEFAULT);
enum power_state power_chipset_init(void)
{