summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaisuke Nojiri <dnojiri@chromium.org>2019-04-02 10:34:54 -0700
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2019-04-02 18:54:05 +0000
commite879713cee3212b4afffb3f0dd3c4dfbf8237c4a (patch)
treebc676b35e32d599022d978906119c775ff3461f1
parenta8a79eef9ce2ff09539df60ca98b94991199430d (diff)
downloadchrome-ec-e879713cee3212b4afffb3f0dd3c4dfbf8237c4a.tar.gz
kblight: Remove dependency on PWM
Keyboard backlight can be controlled either by PWM or an external controller. This patch decouples keyboard backlight common code and PWM based backlight controll. Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> BUG=none BRANCH=nami TEST=Verify keyboard backlight can be adjusted on Ekko. Change-Id: I332b01a2a2b15bd37ce385b6c30591c90f078dfc Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1549476 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Commit-Queue: Daisuke Nojiri <dnojiri@chromium.org> Tested-by: Daisuke Nojiri <dnojiri@chromium.org>
-rw-r--r--common/acpi.c4
-rw-r--r--common/build.mk2
-rw-r--r--common/ec_features.c2
-rw-r--r--common/keyboard_backlight.c2
-rw-r--r--include/config.h6
5 files changed, 11 insertions, 5 deletions
diff --git a/common/acpi.c b/common/acpi.c
index de6b927747..3a79a117a8 100644
--- a/common/acpi.c
+++ b/common/acpi.c
@@ -152,7 +152,7 @@ int acpi_ap_to_ec(int is_cmd, uint8_t value, uint8_t *resultptr)
case EC_ACPI_MEM_TEST_COMPLIMENT:
result = 0xff - acpi_mem_test;
break;
-#ifdef CONFIG_PWM_KBLIGHT
+#ifdef CONFIG_KEYBOARD_BACKLIGHT
case EC_ACPI_MEM_KEYBOARD_BACKLIGHT:
result = kblight_get();
break;
@@ -252,7 +252,7 @@ int acpi_ap_to_ec(int is_cmd, uint8_t value, uint8_t *resultptr)
battery_memmap_set_index(data);
break;
#endif
-#ifdef CONFIG_PWM_KBLIGHT
+#ifdef CONFIG_KEYBOARD_BACKLIGHT
case EC_ACPI_MEM_KEYBOARD_BACKLIGHT:
/*
* Debug output with CR not newline, because the host
diff --git a/common/build.mk b/common/build.mk
index 9530586e41..671adfa53e 100644
--- a/common/build.mk
+++ b/common/build.mk
@@ -89,7 +89,7 @@ common-$(CONFIG_POWER_BUTTON_X86)+=power_button_x86.o
common-$(CONFIG_PSTORE)+=pstore_commands.o
common-$(CONFIG_PWM)+=pwm.o
common-$(CONFIG_PWM_KBLIGHT)+=pwm_kblight.o
-common-$(CONFIG_PWM_KBLIGHT)+=keyboard_backlight.o
+common-$(CONFIG_KEYBOARD_BACKLIGHT)+=keyboard_backlight.o
common-$(CONFIG_RMA_AUTH)+=rma_auth.o
common-$(CONFIG_RSA)+=rsa.o
common-$(CONFIG_ROLLBACK)+=rollback.o
diff --git a/common/ec_features.c b/common/ec_features.c
index ec483ad47f..245154630a 100644
--- a/common/ec_features.c
+++ b/common/ec_features.c
@@ -22,7 +22,7 @@ uint32_t get_feature_flags0(void)
#ifdef CONFIG_FANS
| EC_FEATURE_MASK_0(EC_FEATURE_PWM_FAN)
#endif
-#ifdef CONFIG_PWM_KBLIGHT
+#ifdef CONFIG_KEYBOARD_BACKLIGHT
| EC_FEATURE_MASK_0(EC_FEATURE_PWM_KEYB)
#endif
#ifdef HAS_TASK_LIGHTBAR
diff --git a/common/keyboard_backlight.c b/common/keyboard_backlight.c
index d17c2bd319..821e403f3b 100644
--- a/common/keyboard_backlight.c
+++ b/common/keyboard_backlight.c
@@ -74,7 +74,9 @@ int kblight_register(const struct kblight_drv *drv)
static void keyboard_backlight_init(void)
{
/* Uses PWM by default. Can be customized by board_kblight_init */
+#ifdef CONFIG_PWM_KBLIGHT
kblight_register(&kblight_pwm);
+#endif
board_kblight_init();
if (kblight_init())
CPRINTS("kblight init failed");
diff --git a/include/config.h b/include/config.h
index 791298edf7..64dbf8c9ea 100644
--- a/include/config.h
+++ b/include/config.h
@@ -2441,10 +2441,14 @@
#undef CONFIG_PWM_DISPLIGHT
/*
+ * Support keyboard backlight control
+ */
+#undef CONFIG_KEYBOARD_BACKLIGHT
+
+/*
* Support PWM output to keyboard backlight
*
* Optionally, lm3509 can be used as a keyboard backlight controller.
- * TODO: Create CONFIG_KEYBOARD_BACKLIGHT to allow lm3509 is used without PWM.
*/
#undef CONFIG_PWM_KBLIGHT