Skip to contentSkip to conversation

gpio: Add ChromeOS EC GPIO driver

PATCH Applied Stephen Boyd 4 participants 5 messages Feb 20, 2024 – Mar 25, 2024

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

PATCH v2 1/1 gpio: Add ChromeOS EC GPIO driver

The ChromeOS embedded controller (EC) supports setting the state of GPIOs when the system is unlocked, and getting the state of GPIOs in all cases. The GPIOs are on the EC itself, so the EC acts similar to a GPIO expander. Add a driver to get and set the GPIOs on the EC through the host command interface.

Cc Lee Jones <[email protected]>
Cc Linus Walleij <[email protected]>
Cc Bartosz Golaszewski <[email protected]>
Cc Benson Leung <[email protected]>
Cc Guenter Roeck <[email protected]>
Cc Pin-yen Lin <[email protected]>

---

Changes from v1 (https://lore.kernel.org/r/[email protected]):
* Remove headers that aren't used or necessary
* Make the device an mfd_cell instead of child node in DT
* Remove the devicetable because there's no compatible anymore
* Prefix line names with "EC:" to avoid conflicts

 drivers/gpio/Kconfig        |  10 ++
 drivers/gpio/Makefile       |   1 +
 drivers/gpio/gpio-cros-ec.c | 209 ++++++++++++++++++++++++++++++++++++
 3 files changed, 220 insertions(+)
 create mode 100644 drivers/gpio/gpio-cros-ec.c
drivers/gpio/Kconfig +10 -0
index 1301cec94f12..f6792c814e84 100644
@@ -1240,6 +1240,16 @@ config GPIO_BD9571MWV
 	  This driver can also be built as a module. If so, the module
 	  will be called gpio-bd9571mwv.
 
+config GPIO_CROS_EC
+	tristate "ChromeOS EC GPIO support"
+	depends on CROS_EC
+	help
+	  GPIO driver for the ChromeOS Embedded Controller (EC). GPIOs
+	  cannot be set unless the system is unlocked.
+
+	  This driver can also be built as a module. If so, the module
+	  will be called gpio-cros-ec.
+
 config GPIO_CRYSTAL_COVE
 	tristate "GPIO support for Crystal Cove PMIC"
 	depends on (X86 || COMPILE_TEST) && INTEL_SOC_PMIC
drivers/gpio/Makefile +1 -0
index 9e40af196aae..7ae4d81de1df 100644
@@ -46,6 +46,7 @@ obj-$(CONFIG_GPIO_BT8XX)		+= gpio-bt8xx.o
 obj-$(CONFIG_GPIO_CADENCE)		+= gpio-cadence.o
 obj-$(CONFIG_GPIO_CLPS711X)		+= gpio-clps711x.o
 obj-$(CONFIG_GPIO_SNPS_CREG)		+= gpio-creg-snps.o
+obj-$(CONFIG_GPIO_CROS_EC)		+= gpio-cros-ec.o
 obj-$(CONFIG_GPIO_CRYSTAL_COVE)		+= gpio-crystalcove.o
 obj-$(CONFIG_GPIO_CS5535)		+= gpio-cs5535.o
 obj-$(CONFIG_GPIO_DA9052)		+= gpio-da9052.o
drivers/gpio/gpio-cros-ec.c new file +209 -0

209 lines not on this page · raw message

base-commit: 6613476e225e090cc9aad49be7fa504e290dd33d

Signature · 1 line
https://chromeos.dev
Reviewed-by on v2 1/1
#1 lore raw
Quoted 6 lines · Stephen Boyd

The ChromeOS embedded controller (EC) supports setting the state of GPIOs when the system is unlocked, and getting the state of GPIOs in all cases. The GPIOs are on the EC itself, so the EC acts similar to a GPIO expander. Add a driver to get and set the GPIOs on the EC through the host command interface.

Quoted 9 lines
Cc Lee Jones <[email protected]>
Cc Linus Walleij <[email protected]>
Cc Bartosz Golaszewski <[email protected]>
Cc Benson Leung <[email protected]>
Cc Guenter Roeck <[email protected]>
Cc Pin-yen Lin <[email protected]>

This looks good to me!

Yours,
Linus Walleij

#2 lore raw
In reply to Stephen Boyd
Quoted 16 lines · Stephen Boyd

The ChromeOS embedded controller (EC) supports setting the state of GPIOs when the system is unlocked, and getting the state of GPIOs in all cases. The GPIOs are on the EC itself, so the EC acts similar to a GPIO expander. Add a driver to get and set the GPIOs on the EC through the host command interface.

Cc Lee Jones <[email protected]>
Cc Linus Walleij <[email protected]>
Cc Bartosz Golaszewski <[email protected]>
Cc Benson Leung <[email protected]>
Cc Guenter Roeck <[email protected]>
Cc Pin-yen Lin <[email protected]>
Quoted 2 lines

---

Applied, thanks!

Bart

#3 lore raw
In reply to Stephen Boyd
This patch was applied to chrome-platform/linux.git (for-kernelci) by Bartosz Golaszewski <[email protected]>:

Hello:

This patch was applied to chrome-platform/linux.git (for-kernelci) by Bartosz Golaszewski <[email protected]>:

Quoted 16 lines · On Mon, 19 Feb 2024 20:52:27 -0800 you wrote:

The ChromeOS embedded controller (EC) supports setting the state of GPIOs when the system is unlocked, and getting the state of GPIOs in all cases. The GPIOs are on the EC itself, so the EC acts similar to a GPIO expander. Add a driver to get and set the GPIOs on the EC through the host command interface.

Cc Lee Jones <[email protected]>
Cc Linus Walleij <[email protected]>
Cc Bartosz Golaszewski <[email protected]>
Cc Benson Leung <[email protected]>
Cc Guenter Roeck <[email protected]>
Cc Pin-yen Lin <[email protected]>
Quoted 1 line

[...]

Here is the summary with links:
- [v2] gpio: Add ChromeOS EC GPIO driver

    https://git.kernel.org/chrome-platform/c/f837fe1bffe6

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
#4 lore raw
In reply to Stephen Boyd
This patch was applied to chrome-platform/linux.git (for-next) by Bartosz Golaszewski <[email protected]>:

Hello:

This patch was applied to chrome-platform/linux.git (for-next) by Bartosz Golaszewski <[email protected]>:

Quoted 16 lines · On Mon, 19 Feb 2024 20:52:27 -0800 you wrote:

The ChromeOS embedded controller (EC) supports setting the state of GPIOs when the system is unlocked, and getting the state of GPIOs in all cases. The GPIOs are on the EC itself, so the EC acts similar to a GPIO expander. Add a driver to get and set the GPIOs on the EC through the host command interface.

Cc Lee Jones <[email protected]>
Cc Linus Walleij <[email protected]>
Cc Bartosz Golaszewski <[email protected]>
Cc Benson Leung <[email protected]>
Cc Guenter Roeck <[email protected]>
Cc Pin-yen Lin <[email protected]>
Quoted 1 line

[...]

Here is the summary with links:
- [v2] gpio: Add ChromeOS EC GPIO driver

    https://git.kernel.org/chrome-platform/c/f837fe1bffe6

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html