diff options
author | Daisuke Nojiri <dnojiri@chromium.org> | 2019-04-02 10:34:54 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2019-04-04 23:09:25 -0700 |
commit | ed230bf3f5ab05a2e09d4eb88d66cff4b3a856b2 (patch) | |
tree | 2313c66a26e546e9457ea54c180517357b9a69c0 | |
parent | f4d798a1ee801abc0f8cfdd2f1a1115b9050f7f0 (diff) | |
download | chrome-ec-ed230bf3f5ab05a2e09d4eb88d66cff4b3a856b2.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 control.
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>
(cherry picked from commit e879713cee3212b4afffb3f0dd3c4dfbf8237c4a)
Reviewed-on: https://chromium-review.googlesource.com/1549606
Commit-Ready: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
-rw-r--r-- | common/acpi.c | 4 | ||||
-rw-r--r-- | common/build.mk | 2 | ||||
-rw-r--r-- | common/ec_features.c | 2 | ||||
-rw-r--r-- | common/keyboard_backlight.c | 2 | ||||
-rw-r--r-- | include/config.h | 15 |
5 files changed, 19 insertions, 6 deletions
diff --git a/common/acpi.c b/common/acpi.c index e33ac17bb0..e681fd25a6 100644 --- a/common/acpi.c +++ b/common/acpi.c @@ -195,7 +195,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; @@ -301,7 +301,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 d9418f7a31..7d5cd9dad0 100644 --- a/common/build.mk +++ b/common/build.mk @@ -98,7 +98,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 fb45789a63..4e17764127 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 8fdc5dc0cf..7962fea99c 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 53d983f12b..5a62cb5728 100644 --- a/include/config.h +++ b/include/config.h @@ -2693,10 +2693,17 @@ #undef CONFIG_PWM_DISPLIGHT /* + * Support keyboard backlight control + * + * You need to define board_kblight_init unless CONFIG_PWM_KBLIGHT is used. + * For example, lm3509 can be registered as a driver in board_kblight_init. + */ +#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. + * This implies CONFIG_KEYBOARD_BACKLIGHT. */ #undef CONFIG_PWM_KBLIGHT @@ -4391,4 +4398,8 @@ #define CONFIG_SLEEP_TIMEOUT_MS 10000 #endif +#ifdef CONFIG_PWM_KBLIGHT +#define CONFIG_KEYBOARD_BACKLIGHT +#endif + #endif /* __CROS_EC_CONFIG_H */ |