mfd: Add support for Asus Transformer embedded controller
Subsystems (6)
v4 cover mfd: Add support for Asus Transformer embedded controller
Add support for embedded controller used in Asus Transformers for managing power and input functions.
---
Changes in v2:
- converted sysfs debug exports into debugfs
- added kernel-doc comments for exposed functions
- fixed minor typos and inconsistencies
Changes in v3:
- dropped DockRAM commits (both schema and driver)
- integrated DockRAM functionality directly into the controller driver
- EC schema moved to embedded controllers folder
- removed all cell descriptions from the schema
- removed all compatibles from the cell drivers
- adjusted naming conventions to better align with the ASUS Transformers
- defined EC variant sets to provide coverage for all known devices
Changes in v4:
- grouped known programming models of EC chronologically (both schema and driver)
- call debugfs init only if CONFIG_DEBUG_FS is enabled
---
Michał Mirosław (6):
mfd: Add driver for ASUS Transformer embedded controller
input: serio: Add driver for ASUS Transformer dock keyboard and
touchpad
input: keyboard: Add driver for ASUS Transformer dock multimedia keys
leds: Add driver for ASUS Transformer LEDs
power: supply: Add driver for ASUS Transformer battery
power: supply: Add charger driver for Asus Transformers
Svyatoslav Ryhel (1):
dt-bindings: embedded-controller: document ASUS Transformer EC
.../asus,tf201-ec-pad.yaml | 105 +++ drivers/input/keyboard/Kconfig | 10 + drivers/input/keyboard/Makefile | 1 + .../input/keyboard/asus-transformer-ec-keys.c | 272 +++++++ drivers/input/serio/Kconfig | 15 + drivers/input/serio/Makefile | 1 + drivers/input/serio/asus-transformer-ec-kbc.c | 147 ++++ drivers/leds/Kconfig | 11 + drivers/leds/Makefile | 1 + drivers/leds/leds-asus-transformer-ec.c | 79 ++ drivers/mfd/Kconfig | 14 + drivers/mfd/Makefile | 1 + drivers/mfd/asus-transformer-ec.c | 762 ++++++++++++++++++ drivers/power/supply/Kconfig | 22 + drivers/power/supply/Makefile | 2 + .../supply/asus-transformer-ec-battery.c | 272 +++++++ .../supply/asus-transformer-ec-charger.c | 193 +++++ include/linux/mfd/asus-transformer-ec.h | 162 ++++ 18 files changed, 2070 insertions(+) create mode 100644 Documentation/devicetree/bindings/embedded-controller/asus,tf201-ec-pad.yaml create mode 100644 drivers/input/keyboard/asus-transformer-ec-keys.c create mode 100644 drivers/input/serio/asus-transformer-ec-kbc.c create mode 100644 drivers/leds/leds-asus-transformer-ec.c create mode 100644 drivers/mfd/asus-transformer-ec.c create mode 100644 drivers/power/supply/asus-transformer-ec-battery.c create mode 100644 drivers/power/supply/asus-transformer-ec-charger.c create mode 100644 include/linux/mfd/asus-transformer-ec.h
Signature · 1 line
2.51.0
PATCH v4 1/7 dt-bindings: embedded-controller: document ASUS Transformer EC
Document embedded controller used in ASUS Transformer device series.
--- .../asus,tf201-ec-pad.yaml | 105 ++++++++++++++++++ 1 file changed, 105 insertions(+) create mode 100644 Documentation/devicetree/bindings/embedded-controller/asus,tf201-ec-pad.yaml
Documentation/devicetree/bindings/embedded-controller/asus,tf201-ec-pad.yaml new file +105 -0
@@ -0,0 +1,105 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/embedded-controller/asus,tf201-ec-pad.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: ASUS Transformer's Embedded Controller + +description: + Several Nuvoton based Embedded Controllers attached to an I2C bus, + running a custom ASUS firmware, specific to the ASUS Transformer + device series. + +maintainers: + - Svyatoslav Ryhel <[email protected]> + +allOf: + - $ref: /schemas/power/supply/power-supply.yaml + +properties: + compatible: + description: + The 'pad' suffix is used for the controller within the tablet, while + the 'dock' suffix refers to the controller in the mobile dock keyboard. + oneOf: + - enum: + - asus,sl101-ec-dock + - asus,tf101-ec-dock + - asus,tf201-ec-pad + - asus,tf600t-ec-pad + + - items: + - enum: + - asus,tf101g-ec-dock + - asus,tf201-ec-dock + - asus,tf300t-ec-dock + - asus,tf300tg-ec-dock + - asus,tf300tl-ec-dock + - asus,tf700t-ec-dock + - const: asus,tf101-ec-dock + + - items: + - enum: + - asus,tf300t-ec-pad + - asus,tf300tg-ec-pad + - asus,tf300tl-ec-pad + - asus,tf700t-ec-pad + - const: asus,tf201-ec-pad + + - items: + - enum: + - asus,p1801-t-ec-pad + - asus,tf701t-ec-pad + - const: asus,tf600t-ec-pad + + reg: + description: + The ASUS Transformer EC has a main I2C address and an associated + DockRAM device, which provides power-related functions for the + embedded controller. Both addresses are required for operation. + minItems: 2 + + reg-names: + items: + - const: ec + - const: dockram + + interrupts: + maxItems: 1 + + request-gpios: + maxItems: 1 + +required: + - compatible + - reg + - reg-names + - interrupts + - request-gpios + +unevaluatedProperties: false + +examples: + - | + #include <dt-bindings/gpio/gpio.h> + #include <dt-bindings/interrupt-controller/irq.h> + + i2c { + #address-cells = <1>; + #size-cells = <0>; + + embedded-controller@19 { + compatible = "asus,tf201-ec-dock", "asus,tf101-ec-dock"; + reg = <0x19>, <0x1b>; + reg-names = "ec", "dockram"; + + interrupt-parent = <&gpio>; + interrupts = <151 IRQ_TYPE_LEVEL_LOW>; + + request-gpios = <&gpio 134 GPIO_ACTIVE_LOW>; + + monitored-battery = <&dock_battery>; + }; + }; +...
Signature · 1 line
2.51.0
PATCH v4 2/7 mfd: Add driver for ASUS Transformer embedded controller
In reply to Svyatoslav RyhelFrom: Michał Mirosław <[email protected]>
Support Nuvoton NPCE795-based ECs as used in Asus Transformer TF201, TF300T, TF300TG, TF300TL and TF700T pad and dock, as well as TF101 dock and TF600T, P1801-T and TF701T pad. This is a glue driver handling detection and common operations for EC's functions.
--- drivers/mfd/Kconfig | 14 + drivers/mfd/Makefile | 1 + drivers/mfd/asus-transformer-ec.c | 762 ++++++++++++++++++++++++ include/linux/mfd/asus-transformer-ec.h | 162 +++++ 4 files changed, 939 insertions(+) create mode 100644 drivers/mfd/asus-transformer-ec.c create mode 100644 include/linux/mfd/asus-transformer-ec.h
drivers/mfd/Kconfig +14 -0
@@ -137,6 +137,20 @@ config MFD_AAT2870_CORE additional drivers must be enabled in order to use the functionality of the device. +config MFD_ASUS_TRANSFORMER_EC + tristate "ASUS Transformer's embedded controller" + depends on I2C && OF + help + Support ECs found in ASUS Transformer's Pad and Mobile Dock. + + This provides shared glue for functional part drivers: + asus-transformer-ec-kbc, asus-transformer-ec-keys, + leds-asus-transformer-ec, asus-transformer-ec-battery + and asus-transformer-ec-charger. + + This driver can also be built as a module. If so, the module + will be called asus-transformer-ec. + config MFD_AT91_USART tristate "AT91 USART Driver" select MFD_CORE
drivers/mfd/Makefile +1 -0
@@ -10,6 +10,7 @@ obj-$(CONFIG_MFD_88PM805) += 88pm805.o 88pm80x.o obj-$(CONFIG_MFD_88PM886_PMIC) += 88pm886.o obj-$(CONFIG_MFD_ACT8945A) += act8945a.o obj-$(CONFIG_MFD_SM501) += sm501.o +obj-$(CONFIG_MFD_ASUS_TRANSFORMER_EC) += asus-transformer-ec.o obj-$(CONFIG_ARCH_BCM2835) += bcm2835-pm.o obj-$(CONFIG_MFD_BCM590XX) += bcm590xx.o obj-$(CONFIG_MFD_BD9571MWV) += bd9571mwv.o
drivers/mfd/asus-transformer-ec.c new file +762 -0
762 lines not on this page · raw message
include/linux/mfd/asus-transformer-ec.h new file +162 -0
162 lines not on this page · raw message
Signature · 1 line
2.51.0
PATCH v4 3/7 input: serio: Add driver for ASUS Transformer dock keyboard and touchpad
In reply to Svyatoslav RyhelFrom: Michał Mirosław <[email protected]>
Add input driver for ASUS Transformer dock keyboard and touchpad.
Some keys in ASUS Dock report keycodes that don't make sense according to their position, this patch modifies the incoming data that is sent to serio to send proper scancodes.
--- drivers/input/serio/Kconfig | 15 ++ drivers/input/serio/Makefile | 1 + drivers/input/serio/asus-transformer-ec-kbc.c | 147 ++++++++++++++++++ 3 files changed, 163 insertions(+) create mode 100644 drivers/input/serio/asus-transformer-ec-kbc.c
drivers/input/serio/Kconfig +15 -0
@@ -97,6 +97,21 @@ config SERIO_RPCKBD To compile this driver as a module, choose M here: the module will be called rpckbd. +config SERIO_ASUS_TRANSFORMER_EC + tristate "Asus Transformer's Dock keyboard and touchpad controller" + depends on MFD_ASUS_TRANSFORMER_EC + help + Say Y here if you want to use the keyboard and/or touchpad on + Asus Transformed's Mobile Dock. + + For keyboard support you also need atkbd driver. + + For touchpad support you also need psmouse driver with Elantech + touchpad option enabled. + + To compile this driver as a module, choose M here: the module will + be called asus-transformer-ec-kbc. + config SERIO_AMBAKMI tristate "AMBA KMI keyboard controller" depends on ARM_AMBA
drivers/input/serio/Makefile +1 -0
@@ -13,6 +13,7 @@ obj-$(CONFIG_SERIO_CT82C710) += ct82c710.o obj-$(CONFIG_SERIO_RPCKBD) += rpckbd.o obj-$(CONFIG_SERIO_SA1111) += sa1111ps2.o obj-$(CONFIG_SERIO_AMBAKMI) += ambakmi.o +obj-$(CONFIG_SERIO_ASUS_TRANSFORMER_EC) += asus-transformer-ec-kbc.o obj-$(CONFIG_SERIO_Q40KBD) += q40kbd.o obj-$(CONFIG_SERIO_GSCPS2) += gscps2.o obj-$(CONFIG_HP_SDC) += hp_sdc.o
drivers/input/serio/asus-transformer-ec-kbc.c new file +147 -0
147 lines not on this page · raw message
Signature · 1 line
2.51.0
PATCH v4 4/7 input: keyboard: Add driver for ASUS Transformer dock multimedia keys
In reply to Svyatoslav RyhelFrom: Michał Mirosław <[email protected]>
Add support for multimedia top button row of ASUS Transformer's Mobile Dock keyboard. Driver is made that function keys (F1-F12) are used by default which suits average Linux use better and with pressing ScreenLock + AltGr function keys layout is switched to multimedia keys. Since this only modifies codes sent by asus-ec-keys it doesn't affect normal keyboards at all.
--- drivers/input/keyboard/Kconfig | 10 + drivers/input/keyboard/Makefile | 1 + .../input/keyboard/asus-transformer-ec-keys.c | 272 ++++++++++++++++++ 3 files changed, 283 insertions(+) create mode 100644 drivers/input/keyboard/asus-transformer-ec-keys.c
drivers/input/keyboard/Kconfig +10 -0
@@ -89,6 +89,16 @@ config KEYBOARD_APPLESPI To compile this driver as a module, choose M here: the module will be called applespi. +config KEYBOARD_ASUS_TRANSFORMER_EC + tristate "Asus Transformer's Mobile Dock multimedia keys" + depends on MFD_ASUS_TRANSFORMER_EC + help + Say Y here if you want to use multimedia keys present on Asus + Transformer's Mobile Dock. + + To compile this driver as a module, choose M here: the + module will be called asus-transformer-ec-keys. + config KEYBOARD_ATARI tristate "Atari keyboard" depends on ATARI
drivers/input/keyboard/Makefile +1 -0
@@ -11,6 +11,7 @@ obj-$(CONFIG_KEYBOARD_ADP5585) += adp5585-keys.o obj-$(CONFIG_KEYBOARD_ADP5588) += adp5588-keys.o obj-$(CONFIG_KEYBOARD_AMIGA) += amikbd.o obj-$(CONFIG_KEYBOARD_APPLESPI) += applespi.o +obj-$(CONFIG_KEYBOARD_ASUS_TRANSFORMER_EC) += asus-transformer-ec-keys.o obj-$(CONFIG_KEYBOARD_ATARI) += atakbd.o obj-$(CONFIG_KEYBOARD_ATKBD) += atkbd.o obj-$(CONFIG_KEYBOARD_BCM) += bcm-keypad.o
drivers/input/keyboard/asus-transformer-ec-keys.c new file +272 -0
272 lines not on this page · raw message
Signature · 1 line
2.51.0
PATCH v4 5/7 leds: Add driver for ASUS Transformer LEDs
In reply to Svyatoslav RyhelFrom: Michał Mirosław <[email protected]>
ASUS Transformer tablets have a green and an amber LED on both the Pad and the Dock. If both LEDs are enabled simultaneously, the emitted light will be yellow.
--- drivers/leds/Kconfig | 11 ++++ drivers/leds/Makefile | 1 + drivers/leds/leds-asus-transformer-ec.c | 79 +++++++++++++++++++++++++ 3 files changed, 91 insertions(+) create mode 100644 drivers/leds/leds-asus-transformer-ec.c
drivers/leds/Kconfig +11 -0
@@ -120,6 +120,17 @@ config LEDS_OSRAM_AMS_AS3668 To compile this driver as a module, choose M here: the module will be called leds-as3668. +config LEDS_ASUS_TRANSFORMER_EC + tristate "LED Support for Asus Transformer charging LED" + depends on LEDS_CLASS + depends on MFD_ASUS_TRANSFORMER_EC + help + This option enables support for charging indicator on + Asus Transformer's Pad and it's Dock. + + To compile this driver as a module, choose M here: the module + will be called leds-asus-transformer-ec. + config LEDS_AW200XX tristate "LED support for Awinic AW20036/AW20054/AW20072/AW20108" depends on LEDS_CLASS
drivers/leds/Makefile +1 -0
@@ -16,6 +16,7 @@ obj-$(CONFIG_LEDS_AN30259A) += leds-an30259a.o obj-$(CONFIG_LEDS_APU) += leds-apu.o obj-$(CONFIG_LEDS_ARIEL) += leds-ariel.o obj-$(CONFIG_LEDS_AS3668) += leds-as3668.o +obj-$(CONFIG_LEDS_ASUS_TRANSFORMER_EC) += leds-asus-transformer-ec.o obj-$(CONFIG_LEDS_AW200XX) += leds-aw200xx.o obj-$(CONFIG_LEDS_AW2013) += leds-aw2013.o obj-$(CONFIG_LEDS_BCM6328) += leds-bcm6328.o
drivers/leds/leds-asus-transformer-ec.c new file +79 -0
79 lines not on this page · raw message
Signature · 1 line
2.51.0
PATCH v4 6/7 power: supply: Add driver for ASUS Transformer battery
In reply to Svyatoslav RyhelFrom: Michał Mirosław <[email protected]>
Driver implements one battery cell per EC controller and supports reading of battery status for ASUS Transformer's pad and mobile dock.
--- drivers/power/supply/Kconfig | 11 + drivers/power/supply/Makefile | 1 + .../supply/asus-transformer-ec-battery.c | 272 ++++++++++++++++++ 3 files changed, 284 insertions(+) create mode 100644 drivers/power/supply/asus-transformer-ec-battery.c
drivers/power/supply/Kconfig +11 -0
@@ -122,6 +122,17 @@ config BATTERY_CHAGALL This driver can also be built as a module. If so, the module will be called chagall-battery. +config BATTERY_ASUS_TRANSFORMER_EC + tristate "Asus Transformer's battery driver" + depends on MFD_ASUS_TRANSFORMER_EC + help + Say Y here to enable support APM status emulation using + battery class devices. + + This sub-driver supports battery cells found in Asus Transformer + tablets and mobile docks and controlled by special embedded + controller. + config BATTERY_CPCAP tristate "Motorola CPCAP PMIC battery driver" depends on MFD_CPCAP && IIO
drivers/power/supply/Makefile +1 -0
@@ -22,6 +22,7 @@ obj-$(CONFIG_TEST_POWER) += test_power.o obj-$(CONFIG_BATTERY_88PM860X) += 88pm860x_battery.o obj-$(CONFIG_CHARGER_ADP5061) += adp5061.o obj-$(CONFIG_BATTERY_ACT8945A) += act8945a_charger.o +obj-$(CONFIG_BATTERY_ASUS_TRANSFORMER_EC) += asus-transformer-ec-battery.o obj-$(CONFIG_BATTERY_AXP20X) += axp20x_battery.o obj-$(CONFIG_CHARGER_AXP20X) += axp20x_ac_power.o obj-$(CONFIG_BATTERY_CHAGALL) += chagall-battery.o
drivers/power/supply/asus-transformer-ec-battery.c new file +272 -0
272 lines not on this page · raw message
Signature · 1 line
2.51.0
PATCH v4 7/7 power: supply: Add charger driver for Asus Transformers
In reply to Svyatoslav RyhelFrom: Michał Mirosław <[email protected]>
Add support for charger detection capabilities found in the embedded controller of ASUS Transformer devices.
--- drivers/power/supply/Kconfig | 11 + drivers/power/supply/Makefile | 1 + .../supply/asus-transformer-ec-charger.c | 193 ++++++++++++++++++ 3 files changed, 205 insertions(+) create mode 100644 drivers/power/supply/asus-transformer-ec-charger.c
drivers/power/supply/Kconfig +11 -0
@@ -497,6 +497,17 @@ config CHARGER_88PM860X help Say Y here to enable charger for Marvell 88PM860x chip. +config CHARGER_ASUS_TRANSFORMER_EC + tristate "Asus Transformer's charger driver" + depends on MFD_ASUS_TRANSFORMER_EC + help + Say Y here to enable support AC plug detection on Asus Transformer + Dock. + + This sub-driver supports charger detection mechanism found in Asus + Transformer tablets and mobile docks and controlled by special + embedded controller. + config CHARGER_PF1550 tristate "NXP PF1550 battery charger driver" depends on MFD_PF1550
drivers/power/supply/Makefile +1 -0
@@ -68,6 +68,7 @@ obj-$(CONFIG_CHARGER_RT9471) += rt9471.o obj-$(CONFIG_CHARGER_RT9756) += rt9756.o obj-$(CONFIG_BATTERY_TWL4030_MADC) += twl4030_madc_battery.o obj-$(CONFIG_CHARGER_88PM860X) += 88pm860x_charger.o +obj-$(CONFIG_CHARGER_ASUS_TRANSFORMER_EC) += asus-transformer-ec-charger.o obj-$(CONFIG_CHARGER_PF1550) += pf1550-charger.o obj-$(CONFIG_BATTERY_RX51) += rx51_battery.o obj-$(CONFIG_AB8500_BM) += ab8500_bmdata.o ab8500_charger.o ab8500_fg.o ab8500_btemp.o ab8500_chargalg.o
drivers/power/supply/asus-transformer-ec-charger.c new file +193 -0
193 lines not on this page · raw message
Signature · 1 line
2.51.0