Skip to contentSkip to conversation

mfd: Add support for Asus Transformer embedded controller

PATCH Superseded Svyatoslav Ryhel 3 participants 18 messages Jun 25 – Jul 14

Subsystems (6)

v9 of 13 Superseded Latest is v13 →

lore
Share & tools
lore
#0 lore raw

v9 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

Changes in v5:
- added asus,tf600t-ec-dock compatible to schema
- rebased on top of v7.0
- kzalloc > kzalloc_obj in keys and kbc

Changes in v6:
- removed asus_ec_handle_smi casting
- asus_dockram_access_ctl > asus_ec_get_ctl in control_reg_*
- fixed battery Kconfig description

Changes in v7:
- added status check of devm_kasprintf where missing
- devm_asus_ec_register_notifier dropped, added .remove where it was used
- removed cell_to_ec, asus_dockram_read, asus_dockram_write, asus_ec_* public API asus_ec_i2c_command, devm_asus_ec_register_notifier, asus_ec_read, asus_ec_write
- renamed asusec_info > asusec_core
- ec-kbc: added packed size check
ret > error
improved key remap logic
- ec-keys: improve formatting and comments
ret > error
switched to dev_err_probe
- ec-leds: reworked to register both leds via loop
- ec-mfd: adjusted Kconfig description
fixed smbus operation sizes
fixed saving of EC fw model
adjusted IRQ flags
converted to use definer for set cell composition
added factory mode states enum and handling
defined some "magic" values
self > client, info > ec, ecreq > ecreq_gpio, priv > ddata asus_ec_chip_data data > asus_ec_chip_info info
ec_data > ec_buf, ctl_data > ctl_buf
added and improved comments, added structure descriptions asus_ec_magic_debug > asus_ec_susb_on_status
removed all dev_dbg and most of dev_info
pronts with model, fw behavior, factory and susb state preserved switched to MFD_CELL_* macros
removed debugfs
- ec-battery: swithced to BIT macro
lock usage moved to asus_ec_battery_get_value
in asus_ec_battery_poll_work fixed possible rescheduling fail in asus_ec_battery_poll_work fixed missing not charging
- ec-charger: POWER_SUPPLY_PROP_MODEL_NAME set as the first check

Changes in v8:
- added MODULE_ALIAS
- renamed DOCKRAM_* to ASUSEC_*
- ec-keys: input_handler moved into private structure
- ec-leds: added brightness_get
- ec-mdf: fixed i2c_smbus_* return checks () improved model storing
- ec-batt: added status check of devm_kasprintf

Changes in v9:
- fixed i2c_smbus_read_i2c_block_data return check
- blocking_notifier_chain_register moved before serio registration
- adjusted get_unaligned_le16 bounds check
- unsigned long long > u64
- iterator vars made scoped
- removed "magic" values from ec-mfd
- simplified logging, detect split into detect and init
- improved error logs formatting
- adjusted handler in media keys to connect strictly to dock keyboard
---

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                    | 119 ++++
 drivers/input/keyboard/Kconfig                |  10 +
 drivers/input/keyboard/Makefile               |   1 +
 .../input/keyboard/asus-transformer-ec-keys.c | 314 ++++++++++
 drivers/input/serio/Kconfig                   |  15 +
 drivers/input/serio/Makefile                  |   1 +
 drivers/input/serio/asus-transformer-ec-kbc.c | 168 ++++++
 drivers/leds/Kconfig                          |  11 +
 drivers/leds/Makefile                         |   1 +
 drivers/leds/leds-asus-transformer-ec.c       | 125 ++++
 drivers/mfd/Kconfig                           |  16 +
 drivers/mfd/Makefile                          |   1 +
 drivers/mfd/asus-transformer-ec.c             | 549 ++++++++++++++++++
 drivers/power/supply/Kconfig                  |  22 +
 drivers/power/supply/Makefile                 |   2 +
 .../supply/asus-transformer-ec-battery.c      | 289 +++++++++
 .../supply/asus-transformer-ec-charger.c      | 208 +++++++
 include/linux/mfd/asus-transformer-ec.h       |  92 +++
 18 files changed, 1944 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.53.0
#1 lore raw

PATCH v9 1/7 dt-bindings: embedded-controller: document ASUS Transformer EC

Document embedded controller used in ASUS Transformer device series.

---
 .../asus,tf201-ec-pad.yaml                    | 119 ++++++++++++++++++
 1 file changed, 119 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 +119 -0
new file mode 100644
index 000000000000..60b6375864aa
@@ -0,0 +1,119 @@
+# 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]>
+
+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-dock
+          - 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,tf701t-ec-dock
+          - const: asus,tf600t-ec-dock
+
+      - 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
+
+allOf:
+  - $ref: /schemas/power/supply/power-supply.yaml
+  - if:
+      properties:
+        compatible:
+          not:
+            contains:
+              const: asus,tf600t-ec-dock
+    then:
+      required:
+        - 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.53.0
#2 lore raw

Re: [PATCH v9 1/7] dt-bindings: embedded-controller: document ASUS Transformer EC

Sashiko has reviewed this patch and found no issues. It looks great!
Quoted 3 lines

Document embedded controller used in ASUS Transformer device series.

Sashiko has reviewed this patch and found no issues. It looks great!

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
#3 lore raw

PATCH v9 2/7 mfd: Add driver for ASUS Transformer embedded controller

In reply to Svyatoslav Ryhel

From: 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                     |  16 +
 drivers/mfd/Makefile                    |   1 +
 drivers/mfd/asus-transformer-ec.c       | 549 ++++++++++++++++++++++++
 include/linux/mfd/asus-transformer-ec.h |  92 ++++
 4 files changed, 658 insertions(+)
 create mode 100644 drivers/mfd/asus-transformer-ec.c
 create mode 100644 include/linux/mfd/asus-transformer-ec.h
drivers/mfd/Kconfig +16 -0
index 7192c9d1d268..e1c32505b97a 100644
@@ -137,6 +137,22 @@ 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"
+	select MFD_CORE
+	depends on I2C && OF
+	help
+	  Select this to enable support for the Embedded Controller (EC)
+	  found in Tegra based ASUS Transformer series tablets and mobile
+	  docks.
+
+	  This driver handles the core I2C communication with the EC and
+	  provides support for its sub-devices, including battery management,
+	  charger detection, LEDs and keyboard dock functions support.
+
+	  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
index e75e8045c28a..fd80088d8a9a 100644
@@ -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 +549 -0

549 lines not on this page · raw message

include/linux/mfd/asus-transformer-ec.h new file +92 -0

92 lines not on this page · raw message

Signature · 1 line
2.53.0
#4 lore raw

Re: [PATCH v9 2/7] mfd: Add driver for ASUS Transformer embedded controller

Sashiko has reviewed this patch and found no issues. It looks great!
Quoted 10 lines

From: 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.

Sashiko has reviewed this patch and found no issues. It looks great!

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=2
#5 lore raw

PATCH v9 3/7 input: serio: Add driver for ASUS Transformer dock keyboard and touchpad

In reply to Svyatoslav Ryhel

From: 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 | 168 ++++++++++++++++++
 3 files changed, 184 insertions(+)
 create mode 100644 drivers/input/serio/asus-transformer-ec-kbc.c
drivers/input/serio/Kconfig +15 -0
index 5f15a6462056..fad29b950309 100644
@@ -84,6 +84,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
index 8ab98f4aa28d..fedc37ee102b 100644
@@ -12,6 +12,7 @@ obj-$(CONFIG_SERIO_SERPORT)	+= serport.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 +168 -0

168 lines not on this page · raw message

Signature · 1 line
2.53.0
#6 lore raw

Re: [PATCH v9 3/7] input: serio: Add driver for ASUS Transformer dock keyboard and touchpad

Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider: - [High] Premature registration of the event notifier before callback initialization causes a race…

Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:
- [High] Premature registration of the event notifier before callback initialization causes a race condition leading to a NULL pointer dereference.
- [High] Incorrect devres ordering leaves the notifier active after serio ports are destroyed, causing a Use-After-Free during teardown.
- [High] Incorrect bounds check on the EC packet length allows an out-of-bounds heap read and exposes uninitialized memory. --

commit 27a9e7909b45cc654374940aa7f4c4574172729b
Author: Michał Mirosław <[email protected]>

input: serio: Add driver for ASUS Transformer dock keyboard and touchpad

Add input driver for ASUS Transformer dock keyboard and touchpad. Modify incoming keyboard data to send proper scancodes for keys that don't match their position.

Quoted 5 lines
drivers/input/serio/asus-transformer-ec-kbc.c new file +0 -0
new file mode 100644
index 0000000000000..3ddfa9925b2b0

[ ... ]

Quoted 3 lines
drivers/input/serio/asus-transformer-ec-kbc.c new file +3 -0
+static int asus_ec_kbc_notify(struct notifier_block *nb,
+			      unsigned long action, void *data_)
+{

[ ... ]

Quoted 10 lines
drivers/input/serio/asus-transformer-ec-kbc.c new file +10 -0
+	/*
+	 * The data[0] is the length of the packet including itself. The data[]
+	 * buffer has to be at least 3 bytes (length + ctrl + 1 data byte) and
+	 * must not exceed the EC buffer size.
+	 */
+	if (data[0] < 2 || data[0] > ASUSEC_ENTRY_BUFSIZE)
+		return NOTIFY_BAD;
+
+	n = data[0] - 1;
+	data += 2;

[ ... ]

drivers/input/serio/asus-transformer-ec-kbc.c line 68

Quoted 2 lines
drivers/input/serio/asus-transformer-ec-kbc.c new file +2 -0
+	while (n--)
+		serio_interrupt(priv->sdev[port_idx], *data++, 0);

[Severity: High]
If data[0] is ASUSEC_ENTRY_BUFSIZE (33), n becomes 32, and data is advanced by 2. Will the loop read 32 bytes from data[2] up to data[33]?

Since the buffer is exactly 33 bytes long, could this read past the end of the array or access uninitialized data?

Quoted 3 lines
drivers/input/serio/asus-transformer-ec-kbc.c new file +3 -0
+
+	return NOTIFY_OK;
+}

[ ... ]

Quoted 6 lines
drivers/input/serio/asus-transformer-ec-kbc.c new file +6 -0
+static int asus_ec_kbc_probe(struct platform_device *pdev)
+{
+	struct asusec_core *ec = dev_get_drvdata(pdev->dev.parent);
+	struct asus_ec_kbc_data *priv;
+	int error;
+

drivers/input/serio/asus-transformer-ec-kbc.c line 135

Quoted 10 lines
drivers/input/serio/asus-transformer-ec-kbc.c new file +10 -0
+	priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
+	if (!priv)
+		return -ENOMEM;
+
+	platform_set_drvdata(pdev, priv);
+
+	priv->ec = ec;
+	priv->parent = to_i2c_client(pdev->dev.parent);
+
+	error = blocking_notifier_chain_register(&ec->notify_list, &priv->nb);

[Severity: High]
Is it safe to register the notifier here before priv->nb.notifier_call is initialized?

If an interrupt fires immediately after registration, could the notifier core attempt to call a NULL pointer?

drivers/input/serio/asus-transformer-ec-kbc.c line 142

Quoted 7 lines
drivers/input/serio/asus-transformer-ec-kbc.c new file +7 -0
+	if (error)
+		return dev_err_probe(&pdev->dev, error,
+				     "failed to register blocking notifier chain");
+
+	error = devm_add_action_or_reset(&pdev->dev,
+					 asus_ec_notifier_chain_unregister,
+					 priv);

[Severity: High]
Since managed resources (devm) are released in LIFO order, will the serio ports registered below be unregistered and freed before this notifier is unregistered?

If an interrupt arrives during the unbind window or if the probe function fails after port registration, could the notifier loop in asus_ec_kbc_notify() dereference the freed serio port pointers?

Quoted 15 lines
drivers/input/serio/asus-transformer-ec-kbc.c new file +15 -0
+	if (error)
+		return error;
+
+	error = asus_ec_register_serio(pdev, 0, "Keyboard", 0);
+	if (error)
+		return error;
+
+	error = asus_ec_register_serio(pdev, 1, "Touchpad", I8042_CMD_AUX_SEND);
+	if (error)
+		return error;
+
+	priv->nb.notifier_call = asus_ec_kbc_notify;
+
+	return 0;
+}
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=3
#7 lore raw

PATCH v9 4/7 input: keyboard: Add driver for ASUS Transformer dock multimedia keys

In reply to Svyatoslav Ryhel

From: 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. Only Dock keyboard input events are tracked for AltGr pressing.

---
 drivers/input/keyboard/Kconfig                |  10 +
 drivers/input/keyboard/Makefile               |   1 +
 .../input/keyboard/asus-transformer-ec-keys.c | 314 ++++++++++++++++++
 3 files changed, 325 insertions(+)
 create mode 100644 drivers/input/keyboard/asus-transformer-ec-keys.c
drivers/input/keyboard/Kconfig +10 -0
index 9d1019ba0245..913cb4900565 100644
@@ -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
index 60bb7baf802f..0d81096887ad 100644
@@ -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 +314 -0

314 lines not on this page · raw message

Signature · 1 line
2.53.0
#8 lore raw

Re: [PATCH v9 4/7] input: keyboard: Add driver for ASUS Transformer dock multimedia keys

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Medium] Explicitly calling `input_unregister_device()` on a device allocated with…

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] Explicitly calling input_unregister_device() on a device allocated with devm_input_allocate_device(). --

commit b1b4cf8c044b790c2019bf0bb44a52ad2de52358
Author: Michał Mirosław <[email protected]>

input: keyboard: Add driver for ASUS Transformer dock multimedia keys

This patch adds support for the multimedia top button row of the ASUS Transformer's Mobile Dock keyboard. It tracks keyboard input events for AltGr presses to switch to multimedia keys.

Quoted 5 lines
drivers/input/keyboard/asus-transformer-ec-keys.c new file +0 -0
new file mode 100644
index 0000000000000..53aff3ce7146d

[ ... ]

Quoted 16 lines
drivers/input/keyboard/asus-transformer-ec-keys.c new file +16 -0
+static int asus_ec_keys_probe(struct platform_device *pdev)
+{
+	struct i2c_client *parent = to_i2c_client(pdev->dev.parent);
+	struct asusec_core *ec = dev_get_drvdata(pdev->dev.parent);
+	struct device *dev = &pdev->dev;
+	struct asus_ec_keys_data *priv;
+	int error;
+
+	priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
+	if (!priv)
+		return -ENOMEM;
+
+	platform_set_drvdata(pdev, priv);
+	priv->ec = ec;
+
+	priv->xidev = devm_input_allocate_device(dev);

[ ... ]

drivers/input/keyboard/asus-transformer-ec-keys.c line 278

Quoted 8 lines
drivers/input/keyboard/asus-transformer-ec-keys.c new file +8 -0
+	error = input_register_device(priv->xidev);
+	if (error)
+		return dev_err_probe(dev, error,
+				     "failed to register extension keys\n");
+
+	error = asus_ec_keys_register_handler(dev, priv);
+	if (error) {
+		input_unregister_device(priv->xidev);

[Severity: Medium]
Since priv->xidev is allocated with devm_input_allocate_device() earlier in asus_ec_keys_probe(), does explicitly calling input_unregister_device() here in the error path lead to a double-unregistration when the managed API automatic cleanup triggers?

drivers/input/keyboard/asus-transformer-ec-keys.c line 286

Quoted 8 lines
drivers/input/keyboard/asus-transformer-ec-keys.c new file +8 -0
+		return error;
+	}
+
+	priv->nb.notifier_call = asus_ec_keys_notify;
+
+	error = blocking_notifier_chain_register(&ec->notify_list, &priv->nb);
+	if (error) {
+		input_unregister_device(priv->xidev);

[Severity: Medium]
Could manually unregistering the devm-managed input device here in the notifier registration error path similarly cause a double-unregistration?

Quoted 5 lines
drivers/input/keyboard/asus-transformer-ec-keys.c new file +5 -0
+		input_unregister_handler(&priv->input_handler);
+		return error;
+	}
+
+	return 0;

drivers/input/keyboard/asus-transformer-ec-keys.c line 301

Quoted 10 lines
drivers/input/keyboard/asus-transformer-ec-keys.c new file +10 -0
+}
+
+static void asus_ec_keys_remove(struct platform_device *pdev)
+{
+	struct asus_ec_keys_data *priv = platform_get_drvdata(pdev);
+	struct asusec_core *ec = priv->ec;
+
+	blocking_notifier_chain_unregister(&ec->notify_list, &priv->nb);
+	input_unregister_handler(&priv->input_handler);
+	input_unregister_device(priv->xidev);

[Severity: Medium]
Does bypassing the automatic devm lifecycle by explicitly calling input_unregister_device() in asus_ec_keys_remove() on a managed device lead to double-unregistration when the device is unbound?

Quoted 1 line

+}

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=4
#9 lore raw

Re: [PATCH v9 4/7] input: keyboard: Add driver for ASUS Transformer dock multimedia keys

In reply to Svyatoslav Ryhel

чт, 25 черв. 2026 р. о 11:16 Svyatoslav Ryhel <[email protected]> пише:

Quoted 95 lines

From: 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. Only Dock keyboard input events are tracked for AltGr pressing.

---
 drivers/input/keyboard/Kconfig                |  10 +
 drivers/input/keyboard/Makefile               |   1 +
 .../input/keyboard/asus-transformer-ec-keys.c | 314 ++++++++++++++++++
 3 files changed, 325 insertions(+)
 create mode 100644 drivers/input/keyboard/asus-transformer-ec-keys.c
drivers/input/keyboard/Kconfig +10 -0
index 9d1019ba0245..913cb4900565 100644
@@ -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
index 60bb7baf802f..0d81096887ad 100644
@@ -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 +36 -0
new file mode 100644
index 000000000000..53aff3ce7146
@@ -0,0 +1,314 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#include <linux/array_size.h>
+#include <linux/err.h>
+#include <linux/i2c.h>
+#include <linux/input.h>
+#include <linux/mfd/asus-transformer-ec.h>
+#include <linux/module.h>
+#include <linux/platform_device.h>
+#include <linux/slab.h>
+
+#define ASUSEC_EXT_KEY_CODES           0x20
+
+struct asus_ec_keys_data {
+       struct notifier_block nb;
+       struct asusec_core *ec;
+       struct input_dev *xidev;
+       struct input_handler input_handler;
+       unsigned short keymap[ASUSEC_EXT_KEY_CODES * 2];
+       const char *kbc_phys;
+       bool special_key_pressed;
+       bool special_key_mode;
+};
+
+static void asus_ec_input_event(struct input_handle *handle,
+                               unsigned int event_type,
+                               unsigned int event_code, int value)
+{
+       struct asus_ec_keys_data *priv = handle->handler->private;
+
+       /* Store special key state */
+       if (event_type == EV_KEY && event_code == KEY_RIGHTALT)
+               priv->special_key_pressed = !!value;
+}
+
+static int asus_ec_input_connect(struct input_handler *handler,

drivers/input/keyboard/asus-transformer-ec-keys.c line 46

Quoted 10 lines
drivers/input/keyboard/asus-transformer-ec-keys.c new file +10 -0
+                                struct input_dev *dev,
+                                const struct input_device_id *id)
+{
+       struct asus_ec_keys_data *priv = handler->private;
+       struct input_handle *handle;
+       int error;
+
+       if (!dev->phys || !strstr(dev->phys, priv->kbc_phys))
+               return -ENODEV;
+

Hello Dmitry!

Would this approach be acceptable? Handler links strictly to asus-ec keyboard.

Quoted 271 lines
drivers/input/keyboard/asus-transformer-ec-keys.c new file +268 -1
+       handle = kzalloc_obj(*handle);
+       if (!handle)
+               return -ENOMEM;
+
+       handle->dev = dev;
+       handle->handler = handler;
+       handle->name = handler->name;
+
+       error = input_register_handle(handle);
+       if (error)
+               goto err_free_handle;
+
+       error = input_open_device(handle);
+       if (error)
+               goto err_unregister_handle;
+
+       return 0;
+
+ err_unregister_handle:
+       input_unregister_handle(handle);
+ err_free_handle:
+       kfree(handle);
+
+       return error;
+}
+
+static void asus_ec_input_disconnect(struct input_handle *handle)
+{
+       input_close_device(handle);
+       input_unregister_handle(handle);
+       kfree(handle);
+}
+
+static const struct input_device_id asus_ec_input_ids[] = {
+       {
+               .flags = INPUT_DEVICE_ID_MATCH_EVBIT,
+               .evbit = { BIT_MASK(EV_KEY) },
+       },
+       { }
+};
+
+static const unsigned short asus_ec_dock_ext_keys[] = {
+       /* Function keys [0x00 - 0x19] */
+       [0x01] = KEY_DELETE,
+       [0x02] = KEY_F1,
+       [0x03] = KEY_F2,
+       [0x04] = KEY_F3,
+       [0x05] = KEY_F4,
+       [0x06] = KEY_F5,
+       [0x07] = KEY_F6,
+       [0x08] = KEY_F7,
+       [0x10] = KEY_F8,
+       [0x11] = KEY_F9,
+       [0x12] = KEY_F10,
+       [0x13] = KEY_F11,
+       [0x14] = KEY_F12,
+       [0x15] = KEY_MUTE,
+       [0x16] = KEY_VOLUMEDOWN,
+       [0x17] = KEY_VOLUMEUP,
+       /* Multimedia keys [0x20 - 0x39] */
+       [0x21] = KEY_SCREENLOCK,
+       [0x22] = KEY_WLAN,
+       [0x23] = KEY_BLUETOOTH,
+       [0x24] = KEY_TOUCHPAD_TOGGLE,
+       [0x25] = KEY_BRIGHTNESSDOWN,
+       [0x26] = KEY_BRIGHTNESSUP,
+       [0x27] = KEY_BRIGHTNESS_AUTO,
+       [0x28] = KEY_PRINT,
+       [0x30] = KEY_WWW,
+       [0x31] = KEY_CONFIG,
+       [0x32] = KEY_PREVIOUSSONG,
+       [0x33] = KEY_PLAYPAUSE,
+       [0x34] = KEY_NEXTSONG,
+       [0x35] = KEY_MUTE,
+       [0x36] = KEY_VOLUMEDOWN,
+       [0x37] = KEY_VOLUMEUP,
+};
+
+static void asus_ec_keys_report_key(struct input_dev *dev, unsigned int code,
+                                   unsigned int key, bool value)
+{
+       input_event(dev, EV_MSC, MSC_SCAN, code);
+       input_report_key(dev, key, value);
+       input_sync(dev);
+}
+
+static int asus_ec_keys_process_key(struct input_dev *dev, u8 code)
+{
+       struct asus_ec_keys_data *priv = dev_get_drvdata(dev->dev.parent);
+       unsigned int key = 0;
+
+       if (code == 0)
+               return NOTIFY_DONE;
+
+       /* Flip special key mode state when pressing SCREEN LOCK + R ALT */
+       if (priv->special_key_pressed && code == 1) {
+               priv->special_key_mode = !priv->special_key_mode;
+               return NOTIFY_DONE;
+       }
+
+       /*
+        * Relocate code to second "page" if pressed state XOR's mode state
+        * This way special key will invert the current mode
+        */
+       if (priv->special_key_mode ^ priv->special_key_pressed)
+               code += ASUSEC_EXT_KEY_CODES;
+
+       if (code < dev->keycodemax) {
+               unsigned short *map = dev->keycode;
+
+               key = map[code];
+       }
+
+       if (!key)
+               key = KEY_UNKNOWN;
+
+       asus_ec_keys_report_key(dev, code, key, 1);
+       asus_ec_keys_report_key(dev, code, key, 0);
+
+       return NOTIFY_OK;
+}
+
+static int asus_ec_keys_notify(struct notifier_block *nb,
+                              unsigned long action, void *data_)
+{
+       struct asus_ec_keys_data *priv =
+               container_of(nb, struct asus_ec_keys_data, nb);
+       u8 *data = data_;
+
+       if (action & ASUSEC_SMI_MASK)
+               return NOTIFY_DONE;
+
+       if (action & ASUSEC_SCI_MASK)
+               return asus_ec_keys_process_key(priv->xidev, data[2]);
+
+       return NOTIFY_DONE;
+}
+
+static void asus_ec_keys_setup_keymap(struct asus_ec_keys_data *priv)
+{
+       struct input_dev *dev = priv->xidev;
+       unsigned int i;
+
+       BUILD_BUG_ON(ARRAY_SIZE(priv->keymap) < ARRAY_SIZE(asus_ec_dock_ext_keys));
+
+       dev->keycode = priv->keymap;
+       dev->keycodesize = sizeof(*priv->keymap);
+       dev->keycodemax = ARRAY_SIZE(priv->keymap);
+
+       input_set_capability(dev, EV_MSC, MSC_SCAN);
+       input_set_capability(dev, EV_KEY, KEY_UNKNOWN);
+
+       for (i = 0; i < ARRAY_SIZE(asus_ec_dock_ext_keys); i++) {
+               unsigned int code = asus_ec_dock_ext_keys[i];
+
+               if (!code)
+                       continue;
+
+               __set_bit(code, dev->keybit);
+               priv->keymap[i] = code;
+       }
+}
+
+static int asus_ec_keys_register_handler(struct device *dev,
+                                        struct asus_ec_keys_data *priv)
+{
+       struct i2c_client *parent = to_i2c_client(dev->parent);
+       int error;
+
+       priv->input_handler.event = asus_ec_input_event;
+       priv->input_handler.connect = asus_ec_input_connect;
+       priv->input_handler.disconnect = asus_ec_input_disconnect;
+       priv->input_handler.id_table = asus_ec_input_ids;
+       priv->input_handler.passive_observer = true;
+       priv->input_handler.private = priv;
+       priv->input_handler.name = devm_kasprintf(dev, GFP_KERNEL,
+                                                 "%s-media-handler",
+                                                 priv->ec->name);
+       if (!priv->input_handler.name)
+               return -ENOMEM;
+
+       priv->kbc_phys = devm_kasprintf(dev, GFP_KERNEL, "i2c-%u-%04x/serio0",
+                                       i2c_adapter_id(parent->adapter),
+                                       parent->addr);
+       if (!priv->kbc_phys)
+               return -ENOMEM;
+
+       error = input_register_handler(&priv->input_handler);
+       if (error)
+               return error;
+
+       return 0;
+}
+
+static int asus_ec_keys_probe(struct platform_device *pdev)
+{
+       struct i2c_client *parent = to_i2c_client(pdev->dev.parent);
+       struct asusec_core *ec = dev_get_drvdata(pdev->dev.parent);
+       struct device *dev = &pdev->dev;
+       struct asus_ec_keys_data *priv;
+       int error;
+
+       priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
+       if (!priv)
+               return -ENOMEM;
+
+       platform_set_drvdata(pdev, priv);
+       priv->ec = ec;
+
+       priv->xidev = devm_input_allocate_device(dev);
+       if (!priv->xidev)
+               return -ENOMEM;
+
+       priv->xidev->name = devm_kasprintf(dev, GFP_KERNEL, "%s Keyboard Ext",
+                                          ec->model);
+       priv->xidev->phys = devm_kasprintf(dev, GFP_KERNEL, "i2c-%u-%04x",
+                                          i2c_adapter_id(parent->adapter),
+                                          parent->addr);
+
+       if (!priv->xidev->name || !priv->xidev->phys)
+               return -ENOMEM;
+
+       asus_ec_keys_setup_keymap(priv);
+
+       error = input_register_device(priv->xidev);
+       if (error)
+               return dev_err_probe(dev, error,
+                                    "failed to register extension keys\n");
+
+       error = asus_ec_keys_register_handler(dev, priv);
+       if (error) {
+               input_unregister_device(priv->xidev);
+               return error;
+       }
+
+       priv->nb.notifier_call = asus_ec_keys_notify;
+
+       error = blocking_notifier_chain_register(&ec->notify_list, &priv->nb);
+       if (error) {
+               input_unregister_device(priv->xidev);
+               input_unregister_handler(&priv->input_handler);
+               return error;
+       }
+
+       return 0;
+}
+
+static void asus_ec_keys_remove(struct platform_device *pdev)
+{
+       struct asus_ec_keys_data *priv = platform_get_drvdata(pdev);
+       struct asusec_core *ec = priv->ec;
+
+       blocking_notifier_chain_unregister(&ec->notify_list, &priv->nb);
+       input_unregister_handler(&priv->input_handler);
+       input_unregister_device(priv->xidev);
+}
+
+static struct platform_driver asus_ec_keys_driver = {
+       .driver.name = "asus-transformer-ec-keys",
+       .probe = asus_ec_keys_probe,
+       .remove = asus_ec_keys_remove,
+};
+module_platform_driver(asus_ec_keys_driver);
+
+MODULE_ALIAS("platform:asus-transformer-ec-keys");
+MODULE_AUTHOR("Michał Mirosław <[email protected]>");
+MODULE_DESCRIPTION("ASUS Transformer's multimedia keys driver");
+MODULE_LICENSE("GPL");
--

2.53.0

#10 lore raw

Re: [PATCH v9 4/7] input: keyboard: Add driver for ASUS Transformer dock multimedia keys

пт, 3 лип. 2026 р. о 11:53 Svyatoslav Ryhel <[email protected]> пише:

Quoted 110 lines

чт, 25 черв. 2026 р. о 11:16 Svyatoslav Ryhel <[email protected]> пише:

Quoted 95 lines

From: 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. Only Dock keyboard input events are tracked for AltGr pressing.

---
 drivers/input/keyboard/Kconfig                |  10 +
 drivers/input/keyboard/Makefile               |   1 +
 .../input/keyboard/asus-transformer-ec-keys.c | 314 ++++++++++++++++++
 3 files changed, 325 insertions(+)
 create mode 100644 drivers/input/keyboard/asus-transformer-ec-keys.c
drivers/input/keyboard/Kconfig +10 -0
index 9d1019ba0245..913cb4900565 100644
@@ -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
index 60bb7baf802f..0d81096887ad 100644
@@ -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 +36 -0
new file mode 100644
index 000000000000..53aff3ce7146
@@ -0,0 +1,314 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#include <linux/array_size.h>
+#include <linux/err.h>
+#include <linux/i2c.h>
+#include <linux/input.h>
+#include <linux/mfd/asus-transformer-ec.h>
+#include <linux/module.h>
+#include <linux/platform_device.h>
+#include <linux/slab.h>
+
+#define ASUSEC_EXT_KEY_CODES           0x20
+
+struct asus_ec_keys_data {
+       struct notifier_block nb;
+       struct asusec_core *ec;
+       struct input_dev *xidev;
+       struct input_handler input_handler;
+       unsigned short keymap[ASUSEC_EXT_KEY_CODES * 2];
+       const char *kbc_phys;
+       bool special_key_pressed;
+       bool special_key_mode;
+};
+
+static void asus_ec_input_event(struct input_handle *handle,
+                               unsigned int event_type,
+                               unsigned int event_code, int value)
+{
+       struct asus_ec_keys_data *priv = handle->handler->private;
+
+       /* Store special key state */
+       if (event_type == EV_KEY && event_code == KEY_RIGHTALT)
+               priv->special_key_pressed = !!value;
+}
+
+static int asus_ec_input_connect(struct input_handler *handler,

drivers/input/keyboard/asus-transformer-ec-keys.c line 46

Quoted 10 lines
drivers/input/keyboard/asus-transformer-ec-keys.c new file +10 -0
+                                struct input_dev *dev,
+                                const struct input_device_id *id)
+{
+       struct asus_ec_keys_data *priv = handler->private;
+       struct input_handle *handle;
+       int error;
+
+       if (!dev->phys || !strstr(dev->phys, priv->kbc_phys))
+               return -ENODEV;
+

Hello Dmitry!

Quoted 2 lines

Would this approach be acceptable? Handler links strictly to asus-ec keyboard.

Hello Dmitry! May you please take a look? ATM only ACK on input patches left.

#11 lore raw

PATCH v9 5/7 leds: Add driver for ASUS Transformer LEDs

In reply to Svyatoslav Ryhel

From: 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 | 125 ++++++++++++++++++++++++
 3 files changed, 137 insertions(+)
 create mode 100644 drivers/leds/leds-asus-transformer-ec.c
drivers/leds/Kconfig +11 -0
index f4a0a3c8c870..f637d23400a8 100644
@@ -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
index 8fdb45d5b439..d5395c3f1124 100644
@@ -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 +125 -0

125 lines not on this page · raw message

Signature · 1 line
2.53.0
#12 lore raw

Re: [PATCH v9 5/7] leds: Add driver for ASUS Transformer LEDs

Sashiko has reviewed this patch and found no issues. It looks great!
Quoted 9 lines

From: 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.

Sashiko has reviewed this patch and found no issues. It looks great!

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=5
#13 lore raw

PATCH v9 6/7 power: supply: Add driver for ASUS Transformer battery

In reply to Svyatoslav Ryhel

From: 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      | 289 ++++++++++++++++++
 3 files changed, 301 insertions(+)
 create mode 100644 drivers/power/supply/asus-transformer-ec-battery.c
drivers/power/supply/Kconfig +11 -0
index 83392ed6a8da..1dc3d0b2e021 100644
@@ -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 to enable support for battery status access on Tegra based
+	  ASUS Transformer devices.
+
+	  This sub-driver supports battery cells found in Asus Transformer
+	  tablets and mobile docks and controlled by a special embedded
+	  controller.
+
 config BATTERY_CPCAP
 	tristate "Motorola CPCAP PMIC battery driver"
 	depends on MFD_CPCAP && IIO
drivers/power/supply/Makefile +1 -0
index 7ee839dca7f3..1313f367715c 100644
@@ -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 +289 -0

289 lines not on this page · raw message

Signature · 1 line
2.53.0
#14 lore raw

Re: [PATCH v9 6/7] power: supply: Add driver for ASUS Transformer battery

Sashiko has reviewed this patch and found no issues. It looks great!
Quoted 8 lines

From: 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.

Sashiko has reviewed this patch and found no issues. It looks great!

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=6
#15 lore raw

PATCH v9 7/7 power: supply: Add charger driver for Asus Transformers

In reply to Svyatoslav Ryhel

From: 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      | 208 ++++++++++++++++++
 3 files changed, 220 insertions(+)
 create mode 100644 drivers/power/supply/asus-transformer-ec-charger.c
drivers/power/supply/Kconfig +11 -0
index 1dc3d0b2e021..ebc6d5c01330 100644
@@ -508,6 +508,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
index 1313f367715c..93d17d28081e 100644
@@ -69,6 +69,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 +208 -0

208 lines not on this page · raw message

Signature · 1 line
2.53.0
#16 lore raw

Re: [PATCH v9 7/7] power: supply: Add charger driver for Asus Transformers

Sashiko has reviewed this patch and found no issues. It looks great!
Quoted 9 lines

From: Michał Mirosław <[email protected]>

Add support for charger detection capabilities found in the embedded controller of ASUS Transformer devices.

Sashiko has reviewed this patch and found no issues. It looks great!

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=7
maintainer
#17 lore raw
In reply to Svyatoslav Ryhel
Quoted 8 lines · Svyatoslav Ryhel

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

LEDs and MFD look okay.

Let me know when you have all the other Acks and I'll merge it through MFD.

Signature · 1 line
Lee Jones