Skip to contentSkip to conversation

platform/chrome: cros_kbd_led_backlight: add EC PWM backend

PATCH In review Tzung-Bi Shih 4 participants 13 messages Feb 14, 2022 – Mar 2, 2022

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

cover platform/chrome: cros_kbd_led_backlight: add EC PWM backend

The series adds EC PWM as an backend option for ChromeOS keyboard LED backlight.

The 1st patch reorder the headers alphabetically.

The 2nd patch separates the ACPI backend as an independent option.

The 3rd patch is the DT binding document for the proposed compatible string.

The 4th patch supports OF match.

The 5th patch adds EC PWM as another backend option.

Tzung-Bi Shih (5):
platform/chrome: cros_kbd_led_backlight: sort headers alphabetically platform/chrome: cros_kbd_led_backlight: separate ACPI backend
dt-bindings: add google,cros-kbd-led-backlight platform/chrome: cros_kbd_led_backlight: support OF match platform/chrome: cros_kbd_led_backlight: support EC PWM backend

 .../chrome/google,cros-kbd-led-backlight.yaml |  35 +++
 .../bindings/mfd/google,cros-ec.yaml          |   3 +
 drivers/platform/chrome/Kconfig               |  14 +-
 .../platform/chrome/cros_kbd_led_backlight.c  | 218 ++++++++++++++++--
 4 files changed, 247 insertions(+), 23 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/chrome/google,cros-kbd-led-backlight.yaml
Signature · 1 line
2.35.1.265.g69c8d7142f-goog
#1 lore raw

PATCH 1/5 platform/chrome: cros_kbd_led_backlight: sort headers alphabetically

---
 drivers/platform/chrome/cros_kbd_led_backlight.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/platform/chrome/cros_kbd_led_backlight.c +2 -2
index aa409f0201fb..f9587a562bb7 100644
@@ -4,12 +4,12 @@
 // Copyright (C) 2012 Google, Inc.
 
 #include <linux/acpi.h>
-#include <linux/leds.h>
 #include <linux/delay.h>
 #include <linux/err.h>
-#include <linux/module.h>
 #include <linux/init.h>
 #include <linux/kernel.h>
+#include <linux/leds.h>
+#include <linux/module.h>
 #include <linux/platform_device.h>
 #include <linux/slab.h>
 
Signature · 1 line
2.35.1.265.g69c8d7142f-goog
#2 lore raw

PATCH 2/5 platform/chrome: cros_kbd_led_backlight: separate ACPI backend

In reply to Tzung-Bi Shih

cros_kbd_led_backlight uses ACPI_KEYBOARD_BACKLIGHT_WRITE and ACPI_KEYBOARD_BACKLIGHT_READ for setting and getting the brightness respectively.

Separate ACPI operations as an independent option for preparing the driver to support other backends.

---
 drivers/platform/chrome/Kconfig               |  8 +-
 .../platform/chrome/cros_kbd_led_backlight.c  | 91 ++++++++++++++++---
 2 files changed, 85 insertions(+), 14 deletions(-)
drivers/platform/chrome/Kconfig +7 -1
index ccc23d8686e8..3f74679a556c 100644
@@ -128,7 +128,7 @@ config CROS_EC_PROTO
 
 config CROS_KBD_LED_BACKLIGHT
 	tristate "Backlight LED support for Chrome OS keyboards"
-	depends on LEDS_CLASS && ACPI
+	depends on LEDS_CLASS
 	help
 	  This option enables support for the keyboard backlight LEDs on
 	  select Chrome OS systems.
@@ -136,6 +136,12 @@ config CROS_KBD_LED_BACKLIGHT
 	  To compile this driver as a module, choose M here: the
 	  module will be called cros_kbd_led_backlight.
 
+config CROS_KBD_LED_BACKLIGHT_ACPI
+	bool "ChromeOS keyboard backlight ACPI backend"
+	depends on ACPI && CROS_KBD_LED_BACKLIGHT
+	help
+	  ChromeOS keyboard backlight ACPI backend.
+
 config CROS_EC_CHARDEV
 	tristate "ChromeOS EC miscdevice"
 	depends on MFD_CROS_EC_DEV
drivers/platform/chrome/cros_kbd_led_backlight.c +78 -13

142 lines not on this page · raw message

Signature · 1 line
2.35.1.265.g69c8d7142f-goog
#3 lore raw

Re: [PATCH 2/5] platform/chrome: cros_kbd_led_backlight: separate ACPI backend

Thank you for the patch! Perhaps something to improve:

Hi Tzung-Bi,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on chrome-platform/for-next]
[also build test WARNING on robh/for-next lee-mfd/for-mfd-next v5.17-rc4 next-20220214] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Tzung-Bi-Shih/platform-chrome-cros_kbd_led_backlight-add-EC-PWM-backend/20220214-133805
base:   https://git.kernel.org/pub/scm/linux/kernel/git/chrome-platform/linux.git for-next
config: hexagon-allyesconfig (https://download.01.org/0day-ci/archive/20220215/202202150337.USCNWPYx-lkp(a)intel.com/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project ea071884b0cc7210b3cc5fe858f0e892a779a23b)

reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/aea3ce64e967f0980a22b475b6f4aa3154fff332
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Tzung-Bi-Shih/platform-chrome-cros_kbd_led_backlight-add-EC-PWM-backend/20220214-133805 git checkout aea3ce64e967f0980a22b475b6f4aa3154fff332
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=hexagon SHELL=/bin/bash drivers/platform/chrome/

If you fix the issue, kindly add following tag as appropriate

All warnings (new ones prefixed by >>):

>> drivers/platform/chrome/cros_kbd_led_backlight.c:158:36: warning: unused variable 'keyboard_led_acpi_match' [-Wunused-const-variable]
   static const struct acpi_device_id keyboard_led_acpi_match[] = {
                                      ^

1 warning generated.

vim +/keyboard_led_acpi_match +158 drivers/platform/chrome/cros_kbd_led_backlight.c

157

 > 158	static const struct acpi_device_id keyboard_led_acpi_match[] = {

159 { "GOOG0002", (kernel_ulong_t)&keyboard_led_drvdata_acpi },
160 { }
161 };
162 MODULE_DEVICE_TABLE(acpi, keyboard_led_acpi_match);
163

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

#4 lore raw

Re: [PATCH 2/5] platform/chrome: cros_kbd_led_backlight: separate ACPI backend

Thanks, will fix it in the next version.

Quoted 64 lines · kernel test robot

Hi Tzung-Bi,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on chrome-platform/for-next]
[also build test WARNING on robh/for-next lee-mfd/for-mfd-next v5.17-rc4 next-20220214]
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:
https://github.com/0day-ci/linux/commits/Tzung-Bi-Shih/platform-chrome-cros_kbd_led_backlight-add-EC-PWM-backend/20220214-133805
base:
https://git.kernel.org/pub/scm/linux/kernel/git/chrome-platform/linux.git
for-next
config: hexagon-allyesconfig (
https://download.01.org/0day-ci/archive/20220215/202202150337.USCNWPYx-lkp(a)intel.com/config
)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project
ea071884b0cc7210b3cc5fe858f0e892a779a23b)
reproduce (this is a W=1 build):
wget
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross
-O ~/bin/make.cross
chmod +x ~/bin/make.cross
#
https://github.com/0day-ci/linux/commit/aea3ce64e967f0980a22b475b6f4aa3154fff332
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review
Tzung-Bi-Shih/platform-chrome-cros_kbd_led_backlight-add-EC-PWM-backend/20220214-133805
git checkout aea3ce64e967f0980a22b475b6f4aa3154fff332
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1
O=build_dir ARCH=hexagon SHELL=/bin/bash drivers/platform/chrome/

If you fix the issue, kindly add following tag as appropriate

All warnings (new ones prefixed by >>):

Quoted 1 line
Quoted 1 line

drivers/platform/chrome/cros_kbd_led_backlight.c:158:36: warning:

unused variable 'keyboard_led_acpi_match' [-Wunused-const-variable]

   static const struct acpi_device_id keyboard_led_acpi_match[] = {
                                      ^

1 warning generated.

vim +/keyboard_led_acpi_match +158
drivers/platform/chrome/cros_kbd_led_backlight.c

   157
Quoted 1 line

158 static const struct acpi_device_id keyboard_led_acpi_match[] = {

159 { "GOOG0002", (kernel_ulong_t)&keyboard_led_drvdata_acpi },
160 { }

   161  };
   162  MODULE_DEVICE_TABLE(acpi, keyboard_led_acpi_match);
   163

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

#5 lore raw

PATCH 3/5 dt-bindings: add google,cros-kbd-led-backlight

In reply to Tzung-Bi Shih
---
 .../chrome/google,cros-kbd-led-backlight.yaml | 35 +++++++++++++++++++
 .../bindings/mfd/google,cros-ec.yaml          |  3 ++
 2 files changed, 38 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/chrome/google,cros-kbd-led-backlight.yaml
Documentation/devicetree/bindings/chrome/google,cros-kbd-led-backlight.yaml new file +35 -0
new file mode 100644
index 000000000000..104299e09cbb
@@ -0,0 +1,35 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/chrome/google,cros-kbd-led-backlight.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: ChromeOS keyboard backlight LED driver.
+
+maintainers:
+  - Tzung-Bi Shih <[email protected]>
+
+properties:
+  compatible:
+    const: google,cros-kbd-led-backlight
+
+required:
+  - compatible
+
+additionalProperties: false
+
+examples:
+  - |
+    spi0 {
+      #address-cells = <1>;
+      #size-cells = <0>;
+
+      cros_ec: ec@0 {
+        compatible = "google,cros-ec-spi";
+        reg = <0>;
+
+        kbd-led-backlight {
+          compatible = "google,cros-kbd-led-backlight";
+        };
+      };
+    };
Documentation/devicetree/bindings/mfd/google,cros-ec.yaml +3 -0
index d1f53bd449f7..1815ca0e8ebc 100644
@@ -90,6 +90,9 @@ properties:
   ec-pwm:
     $ref: "/schemas/pwm/google,cros-ec-pwm.yaml#"
 
+  kbd-led-backlight:
+    $ref: "/schemas/chrome/google,cros-kbd-led-backlight.yaml#"
+
   keyboard-controller:
     $ref: "/schemas/input/google,cros-ec-keyb.yaml#"
 
Signature · 1 line
2.35.1.265.g69c8d7142f-goog
maintainer Acked-by on v1 3/5
#6 lore raw

Re: [PATCH 3/5] dt-bindings: add google,cros-kbd-led-backlight

Quoted 7 lines · Tzung-Bi Shih
---
 .../chrome/google,cros-kbd-led-backlight.yaml | 35 +++++++++++++++++++
 .../bindings/mfd/google,cros-ec.yaml          |  3 ++
 2 files changed, 38 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/chrome/google,cros-kbd-led-backlight.yaml
#7 lore raw

PATCH 4/5 platform/chrome: cros_kbd_led_backlight: support OF match

In reply to Tzung-Bi Shih
---
 .../platform/chrome/cros_kbd_led_backlight.c    | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)
drivers/platform/chrome/cros_kbd_led_backlight.c +15 -2
index 814f2b74c602..ba853e55d29a 100644
@@ -10,6 +10,7 @@
 #include <linux/kernel.h>
 #include <linux/leds.h>
 #include <linux/module.h>
+#include <linux/of_device.h>
 #include <linux/platform_device.h>
 #include <linux/slab.h>
 
@@ -128,8 +129,11 @@ static int keyboard_led_probe(struct platform_device *pdev)
 	int error;
 
 	drvdata = acpi_device_get_match_data(&pdev->dev);
-	if (!drvdata)
-		return -EINVAL;
+	if (!drvdata) {
+		drvdata = of_device_get_match_data(&pdev->dev);
+		if (!drvdata)
+			return -EINVAL;
+	}
 
 	if (drvdata->init) {
 		error = drvdata->init(pdev);
@@ -161,10 +165,19 @@ static const struct acpi_device_id keyboard_led_acpi_match[] = {
 };
 MODULE_DEVICE_TABLE(acpi, keyboard_led_acpi_match);
 
+static const struct of_device_id keyboard_led_of_match[] = {
+	{
+		.compatible = "google,cros-kbd-led-backlight",
+	},
+	{}
+};
+MODULE_DEVICE_TABLE(of, keyboard_led_of_match);
+
 static struct platform_driver keyboard_led_driver = {
 	.driver		= {
 		.name	= "chromeos-keyboard-leds",
 		.acpi_match_table = ACPI_PTR(keyboard_led_acpi_match),
+		.of_match_table = of_match_ptr(keyboard_led_of_match),
 	},
 	.probe		= keyboard_led_probe,
 };
Signature · 1 line
2.35.1.265.g69c8d7142f-goog
#8 lore raw

Re: [PATCH 4/5] platform/chrome: cros_kbd_led_backlight: support OF match

Thank you for the patch! Yet something to improve:

Hi Tzung-Bi,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on chrome-platform/for-next]
[also build test ERROR on robh/for-next lee-mfd/for-mfd-next v5.17-rc4 next-20220214] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Tzung-Bi-Shih/platform-chrome-cros_kbd_led_backlight-add-EC-PWM-backend/20220214-133805
base:   https://git.kernel.org/pub/scm/linux/kernel/git/chrome-platform/linux.git for-next
config: i386-randconfig-a001 (https://download.01.org/0day-ci/archive/20220214/202202142320.uQhUtcwm-lkp(a)intel.com/config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0

reproduce (this is a W=1 build):
# https://github.com/0day-ci/linux/commit/8f5fc05563b71136a2ab6f2cb5a068a152267965
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Tzung-Bi-Shih/platform-chrome-cros_kbd_led_backlight-add-EC-PWM-backend/20220214-133805 git checkout 8f5fc05563b71136a2ab6f2cb5a068a152267965
# save the config file to linux build tree
mkdir build_dir
make W=1 O=build_dir ARCH=i386 SHELL=/bin/bash drivers/platform/chrome/

If you fix the issue, kindly add following tag as appropriate

All errors (new ones prefixed by >>):

>> drivers/platform/chrome/cros_kbd_led_backlight.c:168:34: error: 'keyboard_led_of_match' defined but not used [-Werror=unused-const-variable=]
     168 | static const struct of_device_id keyboard_led_of_match[] = {
         |                                  ^~~~~~~~~~~~~~~~~~~~~

cc1: all warnings being treated as errors

vim +/keyboard_led_of_match +168 drivers/platform/chrome/cros_kbd_led_backlight.c

167

 > 168	static const struct of_device_id keyboard_led_of_match[] = {

169 {
170 .compatible = "google,cros-kbd-led-backlight",
171 },
172 {}
173 };
174 MODULE_DEVICE_TABLE(of, keyboard_led_of_match);
175

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

#9 lore raw

Re: [PATCH 4/5] platform/chrome: cros_kbd_led_backlight: support OF match

Thanks, will fix it in the next version.

Quoted 62 lines · kernel test robot

Hi Tzung-Bi,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on chrome-platform/for-next]
[also build test ERROR on robh/for-next lee-mfd/for-mfd-next v5.17-rc4 next-20220214]
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:
https://github.com/0day-ci/linux/commits/Tzung-Bi-Shih/platform-chrome-cros_kbd_led_backlight-add-EC-PWM-backend/20220214-133805
base:
https://git.kernel.org/pub/scm/linux/kernel/git/chrome-platform/linux.git
for-next
config: i386-randconfig-a001 (
https://download.01.org/0day-ci/archive/20220214/202202142320.uQhUtcwm-lkp(a)intel.com/config
)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce (this is a W=1 build):

        #

https://github.com/0day-ci/linux/commit/8f5fc05563b71136a2ab6f2cb5a068a152267965
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review
Tzung-Bi-Shih/platform-chrome-cros_kbd_led_backlight-add-EC-PWM-backend/20220214-133805
git checkout 8f5fc05563b71136a2ab6f2cb5a068a152267965
# save the config file to linux build tree
mkdir build_dir
make W=1 O=build_dir ARCH=i386 SHELL=/bin/bash
drivers/platform/chrome/

If you fix the issue, kindly add following tag as appropriate

All errors (new ones prefixed by >>):

Quoted 1 line
Quoted 1 line

drivers/platform/chrome/cros_kbd_led_backlight.c:168:34: error:

'keyboard_led_of_match' defined but not used
[-Werror=unused-const-variable=]

     168 | static const struct of_device_id keyboard_led_of_match[] = {
         |                                  ^~~~~~~~~~~~~~~~~~~~~

cc1: all warnings being treated as errors

vim +/keyboard_led_of_match +168
drivers/platform/chrome/cros_kbd_led_backlight.c

   167
Quoted 1 line

168 static const struct of_device_id keyboard_led_of_match[] = {

   169          {
   170                  .compatible = "google,cros-kbd-led-backlight",
   171          },
   172          {}
   173  };
   174  MODULE_DEVICE_TABLE(of, keyboard_led_of_match);
   175

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

#10 lore raw

Re: [PATCH 4/5] platform/chrome: cros_kbd_led_backlight: support OF match

In reply to Tzung-Bi Shih
Quoted 19 lines · Tzung-Bi Shih
---
 .../platform/chrome/cros_kbd_led_backlight.c    | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)
drivers/platform/chrome/cros_kbd_led_backlight.c +1 -0
index 814f2b74c602..ba853e55d29a 100644
@@ -10,6 +10,7 @@
 #include <linux/kernel.h>
 #include <linux/leds.h>
 #include <linux/module.h>
+#include <linux/of_device.h>
 #include <linux/platform_device.h>
 #include <linux/slab.h>
 

drivers/platform/chrome/cros_kbd_led_backlight.c static int keyboard_led_probe(struct platform_device *pdev) · line 136

Quoted 10 lines
drivers/platform/chrome/cros_kbd_led_backlight.c +5 -2
@@ -128,8 +129,11 @@ static int keyboard_led_probe(struct platform_device *pdev)
        int error;
 
        drvdata = acpi_device_get_match_data(&pdev->dev);
-       if (!drvdata)
-               return -EINVAL;
+       if (!drvdata) {
+               drvdata = of_device_get_match_data(&pdev->dev);
+               if (!drvdata)
+                       return -EINVAL;
+       }

I'm not familiar with this driver, so can't do a full review, but shouldn't device_get_match_data()
from property.h [1] be able to handle both DT and ACPI cases?

[1]: https://elixir.bootlin.com/linux/v5.17-rc4/source/include/linux/property.h

Quoted 27 lines
drivers/platform/chrome/cros_kbd_led_backlight.c +9 -1
        if (drvdata->init) {
                error = drvdata->init(pdev);
@@ -161,10 +165,19 @@ static const struct acpi_device_id keyboard_led_acpi_match[] = {
 };
 MODULE_DEVICE_TABLE(acpi, keyboard_led_acpi_match);
 
+static const struct of_device_id keyboard_led_of_match[] = {
+       {
+               .compatible = "google,cros-kbd-led-backlight",
+       },
+       {}
+};
+MODULE_DEVICE_TABLE(of, keyboard_led_of_match);
+
 static struct platform_driver keyboard_led_driver = {
        .driver         = {
                .name   = "chromeos-keyboard-leds",
                .acpi_match_table = ACPI_PTR(keyboard_led_acpi_match),
+               .of_match_table = of_match_ptr(keyboard_led_of_match),
        },
        .probe          = keyboard_led_probe,
 };
--

2.35.1.265.g69c8d7142f-goog

#11 lore raw

Re: [PATCH 4/5] platform/chrome: cros_kbd_led_backlight: support OF match

Quoted 29 lines · Prashant Malani
Quoted 13 lines · Tzung-Bi Shih
drivers/platform/chrome/cros_kbd_led_backlight.c +1 -0
index 814f2b74c602..ba853e55d29a 100644
@@ -10,6 +10,7 @@
 #include <linux/kernel.h>
 #include <linux/leds.h>
 #include <linux/module.h>
+#include <linux/of_device.h>
 #include <linux/platform_device.h>
 #include <linux/slab.h>
 

drivers/platform/chrome/cros_kbd_led_backlight.c static int keyboard_led_probe(struct platform_device *pdev) · line 136

Quoted 10 lines
drivers/platform/chrome/cros_kbd_led_backlight.c +5 -2
@@ -128,8 +129,11 @@ static int keyboard_led_probe(struct platform_device *pdev)
        int error;
 
        drvdata = acpi_device_get_match_data(&pdev->dev);
-       if (!drvdata)
-               return -EINVAL;
+       if (!drvdata) {
+               drvdata = of_device_get_match_data(&pdev->dev);
+               if (!drvdata)
+                       return -EINVAL;
+       }

I'm not familiar with this driver, so can't do a full review, but shouldn't device_get_match_data()
from property.h [1] be able to handle both DT and ACPI cases?

Quoted 1 line

[1]: https://elixir.bootlin.com/linux/v5.17-rc4/source/include/linux/property.h

Yes, it does[2][3]. Thanks for the feedback, will fix it in next version.

[2]: https://elixir.bootlin.com/linux/v5.17-rc4/source/drivers/of/property.c#L1474
[3]: https://elixir.bootlin.com/linux/v5.17-rc4/source/drivers/acpi/property.c#L1386

#12 lore raw

PATCH 5/5 platform/chrome: cros_kbd_led_backlight: support EC PWM backend

In reply to Tzung-Bi Shih

EC PWM backend uses EC_CMD_PWM_SET_KEYBOARD_BACKLIGHT and EC_CMD_PWM_GET_KEYBOARD_BACKLIGHT for setting and getting the brightness respectively.

---
 drivers/platform/chrome/Kconfig               |   6 +
 .../platform/chrome/cros_kbd_led_backlight.c  | 126 +++++++++++++++---
 2 files changed, 117 insertions(+), 15 deletions(-)
drivers/platform/chrome/Kconfig +6 -0
index 3f74679a556c..298a49550857 100644
@@ -142,6 +142,12 @@ config CROS_KBD_LED_BACKLIGHT_ACPI
 	help
 	  ChromeOS keyboard backlight ACPI backend.
 
+config CROS_KBD_LED_BACKLIGHT_EC_PWM
+	tristate "ChromeOS keyboard backlight EC PWM backend"
+	depends on CROS_EC && CROS_KBD_LED_BACKLIGHT
+	help
+	  ChromeOS keyboard backlight EC PWM backend.
+
 config CROS_EC_CHARDEV
 	tristate "ChromeOS EC miscdevice"
 	depends on MFD_CROS_EC_DEV
drivers/platform/chrome/cros_kbd_led_backlight.c +111 -15

181 lines not on this page · raw message

Signature · 1 line
2.35.1.265.g69c8d7142f-goog