* [PATCH v2 0/2] platform/asus: Add driver for ASUS Transformer's Dock
@ 2026-12-04 6:34 Svyatoslav Ryhel
2026-12-04 6:34 ` [PATCH v2 1/2] dt-bindings: connector: Document " Svyatoslav Ryhel
2026-12-04 6:34 ` [PATCH v2 2/2] platform/asus: Add driver for ASUS Transformer's Dock of Tegra based devices Svyatoslav Ryhel
0 siblings, 2 replies; 5+ messages in thread
From: Svyatoslav Ryhel @ 2026-12-04 6:34 UTC (permalink / raw)
To: Hans de Goede, Andi Shyti, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Ilpo Järvinen, Svyatoslav Ryhel,
Michał Mirosław
Cc: linux-i2c, devicetree, linux-kernel
The ASUS Transformer dock used by Tegra-based devices has an extended I2C
bus where certain devices are hot-pluggable and their presence
is indicated by a GPIO line. The set of hot-pluggable devices must be
predetermined and static.
Tegra20 and Tegra30 Transformers have EC and dockram clients on this line,
while TF600T and Tegra114 Transformers have hid-over-i2c keyboard,
touchpad and EC here.
I have tried to submit this patch in more generic way, but I was rejected.
More details: https://lore.kernel.org/lkml/20251013060018.43851-1-clamor95@gmail.com/
---
Changes in v2:
- schema moved to connector
- added i2c child node into schema to describe i2c-controller part
- added port node to link to tegra USB controller
- added usb node to describe usb-controller part (hub, card-reader)
- added connector nodes
- added I2C and ARCH_TEGRA depencency in Kconfig
- switched parent->algo->* with __i2c_transfer() and __i2c_smbus_xfer()
- added gpiod_get_value_cansleep() check in interrupt handler
- fixed parent_np and parent checks in the probe
- switched of_find_i2c_adapter_by_node() > of_get_i2c_adapter_by_node()
- added gpiod_to_irq() chech in the probe
- added i2c-device parsing from dedicated i2c node
---
Michał Mirosław (1):
platform/asus: Add driver for ASUS Transformer's Dock of Tegra based
devices
Svyatoslav Ryhel (1):
dt-bindings: connector: Document ASUS Transformer's Dock
.../connector/asus,transformer-dock.yaml | 171 +++++++++++
drivers/platform/asus/Kconfig | 12 +
drivers/platform/asus/Makefile | 1 +
drivers/platform/asus/asus-transformer-dock.c | 282 ++++++++++++++++++
4 files changed, 466 insertions(+)
create mode 100644 Documentation/devicetree/bindings/connector/asus,transformer-dock.yaml
create mode 100644 drivers/platform/asus/asus-transformer-dock.c
--
2.53.0
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v2 1/2] dt-bindings: connector: Document ASUS Transformer's Dock
2026-12-04 6:34 [PATCH v2 0/2] platform/asus: Add driver for ASUS Transformer's Dock Svyatoslav Ryhel
@ 2026-12-04 6:34 ` Svyatoslav Ryhel
2026-12-04 6:52 ` sashiko-bot
2026-12-04 6:34 ` [PATCH v2 2/2] platform/asus: Add driver for ASUS Transformer's Dock of Tegra based devices Svyatoslav Ryhel
1 sibling, 1 reply; 5+ messages in thread
From: Svyatoslav Ryhel @ 2026-12-04 6:34 UTC (permalink / raw)
To: Hans de Goede, Andi Shyti, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Ilpo Järvinen, Svyatoslav Ryhel,
Michał Mirosław
Cc: linux-i2c, devicetree, linux-kernel
Document a hardware configuration that uses a GPIO signal to determine the
presence and state of devices on the bus, allowing the system to
dynamically configure a predetermined set of I2C devices as they are
plugged in or removed used in Tegra based ASUS Transformers.
Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
---
.../connector/asus,transformer-dock.yaml | 171 ++++++++++++++++++
1 file changed, 171 insertions(+)
create mode 100644 Documentation/devicetree/bindings/connector/asus,transformer-dock.yaml
diff --git a/Documentation/devicetree/bindings/connector/asus,transformer-dock.yaml b/Documentation/devicetree/bindings/connector/asus,transformer-dock.yaml
new file mode 100644
index 0000000000000..ce9730b558e5b
--- /dev/null
+++ b/Documentation/devicetree/bindings/connector/asus,transformer-dock.yaml
@@ -0,0 +1,171 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/connector/asus,transformer-dock.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: ASUS Transformer's Dock for Tegra based devices
+
+maintainers:
+ - Svyatoslav Ryhel <clamor95@gmail.com>
+
+description:
+ A composite detachable dock found on Tegra-based ASUS Transformers. The
+ dock contains an I2C bus extension for devices providing input and power
+ management functions, a USB hub linked to a host controller with an
+ integrated card reader, and one or two USB ports. Dock presence is
+ indicated by a GPIO line. The set of potential hot-pluggable I2C devices
+ must be predefined and fixed.
+
+properties:
+ compatible:
+ const: asus,transformer-dock
+
+ detect-gpios:
+ description:
+ A pin whose active state indicates that detachable devices are plugged in.
+ maxItems: 1
+
+ i2c-parent:
+ $ref: /schemas/types.yaml#/definitions/phandle
+ description:
+ The phandle of the I2C bus that this multiplexer's master-side port is
+ connected to.
+
+ i2c:
+ $ref: /schemas/i2c/i2c-controller.yaml#
+ description:
+ Container for i2c devices found in the dock.
+ unevaluatedProperties: false
+
+ port:
+ $ref: /schemas/graph.yaml#/properties/port
+ description:
+ OF graph link modeling a connection from HOST USB node to Dock.
+
+ usb:
+ $ref: /schemas/usb/usb-hcd.yaml#
+ description:
+ Container for USB devices found in the dock.
+ unevaluatedProperties: false
+
+patternProperties:
+ "^usb-connector(-[01])?$":
+ $ref: /schemas/connector/usb-connector.yaml#
+ description:
+ USB connectors exposed on the dock.
+ unevaluatedProperties: false
+
+required:
+ - compatible
+ - detect-gpios
+ - i2c-parent
+ - i2c
+
+additionalProperties: false
+
+examples:
+ - |
+ #include <dt-bindings/gpio/gpio.h>
+ #include <dt-bindings/interrupt-controller/irq.h>
+
+ dock {
+ compatible = "asus,transformer-dock";
+
+ detect-gpios = <&gpio 164 GPIO_ACTIVE_LOW>;
+ i2c-parent = <&gen2_i2c>;
+
+ i2c {
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ embedded-controller@19 {
+ compatible = "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>;
+ };
+ };
+
+ port {
+ dock_usb_out: endpoint {
+ remote-endpoint = <&host_usb_in>;
+ };
+ };
+
+ usb {
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ /* Genesys Logic 4-port USB2.0 Hub */
+ hub@1 {
+ compatible = "usb5e3,610";
+ reg = <1>;
+
+ vdd-supply = <&vdd_5v0_bat>;
+
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ /* Alcor Micro Corp. Multi Flash Reader */
+ device@3 {
+ compatible = "usb58f,6366";
+ reg = <3>;
+ };
+
+ /* Two USB ports are externally accessible on the docking station */
+ ports {
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ port@1 {
+ reg = <1>;
+
+ usb_hub_p1_in: endpoint {
+ remote-endpoint = <&dock_usb_left_connector_out>;
+ };
+ };
+
+ port@2 {
+ reg = <2>;
+
+ usb_hub_p2_in: endpoint {
+ remote-endpoint = <&dock_usb_right_connector_out>;
+ };
+ };
+ };
+ };
+ };
+
+ usb-connector-0 {
+ compatible = "usb-a-connector";
+ label = "USB Left";
+
+ vbus-supply = <&vdd_5v0_sys>;
+
+ port {
+ dock_usb_left_connector_out: endpoint {
+ remote-endpoint = <&usb_hub_p1_in>;
+ };
+ };
+ };
+
+ usb-connector-1 {
+ compatible = "usb-a-connector";
+ label = "USB Right";
+
+ vbus-supply = <&vdd_5v0_sys>;
+
+ port {
+ dock_usb_right_connector_out: endpoint {
+ remote-endpoint = <&usb_hub_p2_in>;
+ };
+ };
+ };
+ };
+...
--
2.53.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH v2 2/2] platform/asus: Add driver for ASUS Transformer's Dock of Tegra based devices
2026-12-04 6:34 [PATCH v2 0/2] platform/asus: Add driver for ASUS Transformer's Dock Svyatoslav Ryhel
2026-12-04 6:34 ` [PATCH v2 1/2] dt-bindings: connector: Document " Svyatoslav Ryhel
@ 2026-12-04 6:34 ` Svyatoslav Ryhel
2026-12-04 7:08 ` sashiko-bot
1 sibling, 1 reply; 5+ messages in thread
From: Svyatoslav Ryhel @ 2026-12-04 6:34 UTC (permalink / raw)
To: Hans de Goede, Andi Shyti, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Ilpo Järvinen, Svyatoslav Ryhel,
Michał Mirosław
Cc: linux-i2c, devicetree, linux-kernel
From: Michał Mirosław <mirq-linux@rere.qmqm.pl>
The ASUS Transformer dock used by Tegra-based devices has an extended I2C
bus where certain devices are hot-pluggable and their presence
is indicated by a GPIO line. The set of hot-pluggable devices must be
predetermined and static.
Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
---
drivers/platform/asus/Kconfig | 12 +
drivers/platform/asus/Makefile | 1 +
drivers/platform/asus/asus-transformer-dock.c | 282 ++++++++++++++++++
3 files changed, 295 insertions(+)
create mode 100644 drivers/platform/asus/asus-transformer-dock.c
diff --git a/drivers/platform/asus/Kconfig b/drivers/platform/asus/Kconfig
index 0219418ce3523..04ca3105cf5ed 100644
--- a/drivers/platform/asus/Kconfig
+++ b/drivers/platform/asus/Kconfig
@@ -113,6 +113,18 @@ config ASUS_ARMOURY
To compile this driver as a module, choose M here: the module will
be called asus-armoury.
+config ASUS_TRANSFORMER_DOCK
+ tristate "ASUS Transformer Dock for Tegra based devices"
+ depends on GPIOLIB
+ depends on I2C && OF
+ depends on ARCH_TEGRA
+ help
+ Say Y here if you want support for ASUS Transformer Dock for
+ Tegra devices.
+
+ This driver can also be built as a module. If so, the module
+ will be called asus-transformer-dock.
+
config ASUS_WMI
tristate "ASUS WMI Driver"
depends on ACPI_WMI
diff --git a/drivers/platform/asus/Makefile b/drivers/platform/asus/Makefile
index 7bb25cba4853d..f130141dda534 100644
--- a/drivers/platform/asus/Makefile
+++ b/drivers/platform/asus/Makefile
@@ -10,5 +10,6 @@ obj-$(CONFIG_ASUS_ARMOURY) += asus-armoury.o
obj-$(CONFIG_ASUS_WMI) += asus-wmi.o
obj-$(CONFIG_ASUS_NB_WMI) += asus-nb-wmi.o
obj-$(CONFIG_ASUS_TF103C_DOCK) += asus-tf103c-dock.o
+obj-$(CONFIG_ASUS_TRANSFORMER_DOCK) += asus-transformer-dock.o
obj-$(CONFIG_EEEPC_LAPTOP) += eeepc-laptop.o
obj-$(CONFIG_EEEPC_WMI) += eeepc-wmi.o
diff --git a/drivers/platform/asus/asus-transformer-dock.c b/drivers/platform/asus/asus-transformer-dock.c
new file mode 100644
index 0000000000000..a3f5e5ddcb0c7
--- /dev/null
+++ b/drivers/platform/asus/asus-transformer-dock.c
@@ -0,0 +1,282 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#include <linux/delay.h>
+#include <linux/device.h>
+#include <linux/gpio/consumer.h>
+#include <linux/i2c.h>
+#include <linux/interrupt.h>
+#include <linux/module.h>
+#include <linux/platform_device.h>
+#include <linux/property.h>
+#include <linux/slab.h>
+
+#define ASUS_TF_DOCK_ATTACHED 0
+
+struct asus_tf_dock_priv {
+ struct i2c_adapter adap;
+ struct i2c_adapter *parent;
+ struct device *dev;
+ struct fwnode_handle *i2c_fwnode;
+ struct gpio_desc *gpio;
+ unsigned long state_flags;
+};
+
+static inline struct i2c_adapter *asus_tf_dock_parent(struct i2c_adapter *adap)
+{
+ struct asus_tf_dock_priv *priv =
+ container_of(adap, struct asus_tf_dock_priv, adap);
+
+ return priv->parent;
+}
+
+static int asus_tf_dock_master_xfer(struct i2c_adapter *adap,
+ struct i2c_msg msgs[], int num)
+{
+ struct i2c_adapter *parent = asus_tf_dock_parent(adap);
+
+ return __i2c_transfer(parent, msgs, num);
+}
+
+static int asus_tf_dock_smbus_xfer(struct i2c_adapter *adap, u16 addr,
+ unsigned short flags, char read_write,
+ u8 command, int protocol,
+ union i2c_smbus_data *data)
+{
+ struct i2c_adapter *parent = asus_tf_dock_parent(adap);
+
+ return __i2c_smbus_xfer(parent, addr, flags, read_write, command,
+ protocol, data);
+}
+
+static u32 asus_tf_dock_functionality(struct i2c_adapter *adap)
+{
+ u32 parent_func = i2c_get_functionality(asus_tf_dock_parent(adap));
+
+ return parent_func & ~I2C_FUNC_SLAVE;
+}
+
+static const struct i2c_algorithm asus_tf_dock_algo_i2c = {
+ .master_xfer = asus_tf_dock_master_xfer,
+ .functionality = asus_tf_dock_functionality,
+};
+
+static const struct i2c_algorithm asus_tf_dock_algo_smbus = {
+ .smbus_xfer = asus_tf_dock_smbus_xfer,
+ .functionality = asus_tf_dock_functionality,
+};
+
+static const struct i2c_algorithm asus_tf_dock_algo_both = {
+ .master_xfer = asus_tf_dock_master_xfer,
+ .smbus_xfer = asus_tf_dock_smbus_xfer,
+ .functionality = asus_tf_dock_functionality,
+};
+
+static const struct i2c_algorithm *const asus_tf_dock_algo[2][2] = {
+ /* non-I2C */
+ { NULL, &asus_tf_dock_algo_smbus },
+ /* I2C */
+ { &asus_tf_dock_algo_i2c, &asus_tf_dock_algo_both }
+};
+
+static void asus_tf_dock_lock_bus(struct i2c_adapter *adap, unsigned int flags)
+{
+ i2c_lock_bus(asus_tf_dock_parent(adap), flags);
+}
+
+static int asus_tf_dock_trylock_bus(struct i2c_adapter *adap,
+ unsigned int flags)
+{
+ return i2c_trylock_bus(asus_tf_dock_parent(adap), flags);
+}
+
+static void asus_tf_dock_unlock_bus(struct i2c_adapter *adap,
+ unsigned int flags)
+{
+ i2c_unlock_bus(asus_tf_dock_parent(adap), flags);
+}
+
+static const struct i2c_lock_operations asus_tf_dock_lock_ops = {
+ .lock_bus = asus_tf_dock_lock_bus,
+ .trylock_bus = asus_tf_dock_trylock_bus,
+ .unlock_bus = asus_tf_dock_unlock_bus,
+};
+
+static int asus_tf_dock_recover_bus(struct i2c_adapter *adap)
+{
+ return i2c_recover_bus(asus_tf_dock_parent(adap));
+}
+
+static struct i2c_bus_recovery_info asus_tf_dock_recovery_info = {
+ .recover_bus = asus_tf_dock_recover_bus,
+};
+
+static int asus_tf_dock_activate(struct asus_tf_dock_priv *priv)
+{
+ int ret;
+
+ if (test_bit(ASUS_TF_DOCK_ATTACHED, &priv->state_flags))
+ return 0;
+
+ /*
+ * Store the dev data in adapter dev, since
+ * previous i2c_del_adapter might have wiped it.
+ */
+ priv->adap.dev.parent = priv->dev;
+ device_set_node(&priv->adap.dev, priv->i2c_fwnode);
+
+ dev_dbg(priv->adap.dev.parent, "connection detected");
+
+ ret = i2c_add_adapter(&priv->adap);
+ if (!ret)
+ set_bit(ASUS_TF_DOCK_ATTACHED, &priv->state_flags);
+
+ return ret;
+}
+
+static void asus_tf_dock_deactivate(struct asus_tf_dock_priv *priv)
+{
+ if (!test_bit(ASUS_TF_DOCK_ATTACHED, &priv->state_flags))
+ return;
+
+ dev_dbg(priv->adap.dev.parent, "disconnection detected");
+
+ i2c_del_adapter(&priv->adap);
+ clear_bit(ASUS_TF_DOCK_ATTACHED, &priv->state_flags);
+}
+
+static irqreturn_t asus_tf_dock_interrupt(int irq, void *dev_id)
+{
+ struct asus_tf_dock_priv *priv = dev_id;
+ int state;
+
+ /* debounce */
+ msleep(20);
+
+ state = gpiod_get_value_cansleep(priv->gpio);
+ if (state < 0)
+ return IRQ_NONE;
+
+ if (state)
+ asus_tf_dock_activate(priv);
+ else
+ asus_tf_dock_deactivate(priv);
+
+ return IRQ_HANDLED;
+}
+
+static void wrap_fwnode_handle_put(void *fwnode)
+{
+ fwnode_handle_put(fwnode);
+}
+
+static void wrap_i2c_put_adapter(void *adapter)
+{
+ i2c_put_adapter(adapter);
+}
+
+static void wrap_asus_tf_dock_deactivate(void *priv)
+{
+ asus_tf_dock_deactivate(priv);
+}
+
+static int asus_tf_dock_probe(struct platform_device *pdev)
+{
+ struct device *dev = &pdev->dev;
+ struct device_node *parent_np;
+ struct i2c_adapter *parent;
+ struct asus_tf_dock_priv *priv;
+ bool is_i2c, is_smbus;
+ int irq, err;
+
+ priv = devm_kzalloc_obj(dev, struct asus_tf_dock_priv);
+ if (!priv)
+ return -ENOMEM;
+
+ platform_set_drvdata(pdev, priv);
+ priv->dev = dev;
+
+ priv->i2c_fwnode = device_get_named_child_node(dev, "i2c");
+ if (!priv->i2c_fwnode)
+ return dev_err_probe(dev, -ENODEV, "Failed to parse i2c node\n");
+
+ err = devm_add_action_or_reset(dev, wrap_fwnode_handle_put, priv->i2c_fwnode);
+ if (err)
+ return err;
+
+ parent_np = of_parse_phandle(dev_of_node(dev), "i2c-parent", 0);
+ if (!parent_np)
+ return dev_err_probe(dev, -ENODEV, "Failed to parse i2c-parent\n");
+
+ parent = of_get_i2c_adapter_by_node(parent_np);
+ of_node_put(parent_np);
+ if (!parent)
+ return dev_err_probe(dev, -ENODEV,
+ "Failed to get parent I2C adapter\n");
+
+ priv->parent = parent;
+
+ err = devm_add_action_or_reset(dev, wrap_i2c_put_adapter, parent);
+ if (err)
+ return err;
+
+ priv->gpio = devm_gpiod_get(dev, "detect", GPIOD_IN);
+ if (IS_ERR(priv->gpio))
+ return dev_err_probe(dev, PTR_ERR(priv->gpio),
+ "Failed to get detect GPIO\n");
+
+ is_i2c = parent->algo->master_xfer;
+ is_smbus = parent->algo->smbus_xfer;
+
+ priv->adap.algo = asus_tf_dock_algo[is_i2c][is_smbus];
+ if (!priv->adap.algo)
+ return -EINVAL;
+
+ snprintf(priv->adap.name, sizeof(priv->adap.name),
+ "asus-transformer-dock (master i2c-%d)", i2c_adapter_id(parent));
+ priv->adap.owner = THIS_MODULE;
+ priv->adap.lock_ops = &asus_tf_dock_lock_ops;
+ priv->adap.class = parent->class;
+ priv->adap.retries = parent->retries;
+ priv->adap.timeout = parent->timeout;
+ priv->adap.quirks = parent->quirks;
+ if (parent->bus_recovery_info)
+ priv->adap.bus_recovery_info = &asus_tf_dock_recovery_info;
+
+ err = devm_add_action_or_reset(dev, wrap_asus_tf_dock_deactivate, priv);
+ if (err)
+ return err;
+
+ irq = gpiod_to_irq(priv->gpio);
+ if (irq < 0)
+ return dev_err_probe(dev, irq, "Failed to request IRQ\n");
+
+ err = devm_request_threaded_irq(dev, irq, NULL, asus_tf_dock_interrupt,
+ IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING |
+ IRQF_ONESHOT | IRQF_SHARED,
+ "asus-transformer-dock", priv);
+ if (err)
+ return dev_err_probe(dev, err, "Failed to register IRQ %d\n", irq);
+
+ irq_wake_thread(irq, priv);
+
+ return 0;
+}
+
+static const struct of_device_id asus_tf_dock_of_match[] = {
+ { .compatible = "asus,transformer-dock" },
+ { },
+};
+MODULE_DEVICE_TABLE(of, asus_tf_dock_of_match);
+
+static struct platform_driver asus_tf_dock_driver = {
+ .driver = {
+ .name = "asus-transformer-dock",
+ .of_match_table = asus_tf_dock_of_match,
+ },
+ .probe = asus_tf_dock_probe,
+};
+module_platform_driver(asus_tf_dock_driver);
+
+MODULE_DESCRIPTION("ASUS Transformer's Dock for Tegra based devices");
+MODULE_AUTHOR("Michał Mirosław <mirq-linux@rere.qmqm.pl>");
+MODULE_LICENSE("GPL");
--
2.53.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v2 1/2] dt-bindings: connector: Document ASUS Transformer's Dock
2026-12-04 6:34 ` [PATCH v2 1/2] dt-bindings: connector: Document " Svyatoslav Ryhel
@ 2026-12-04 6:52 ` sashiko-bot
0 siblings, 0 replies; 5+ messages in thread
From: sashiko-bot @ 2026-12-04 6:52 UTC (permalink / raw)
To: Svyatoslav Ryhel; +Cc: devicetree, robh, conor+dt
Thank you for your contribution! Sashiko AI review found 5 potential
issues to consider:
- [Medium] dt-bindings: connector: invalid USB HCD and OF-graph topology
for dock USB
- [Medium] dt-bindings: connector: generic device-family compatible
asus,transformer-dock
- [Low] dt-bindings: connector: usb-connector pattern allows three nodes
simultaneously
- [Low] dt-bindings: connector: commit message omits USB port, hub, and
connectors
- [Low] dt-bindings: connector: i2c-parent description calls dock a
multiplexer
--
commit 23017faaeccc7305b09d4187274fdced8e9a001f
Author: Svyatoslav Ryhel <clamor95@gmail.com>
> dt-bindings: connector: Document ASUS Transformer's Dock
>
> Document a hardware configuration that uses a GPIO signal to determine the
> presence and state of devices on the bus, allowing the system to
> dynamically configure a predetermined set of I2C devices as they are
> plugged in or removed used in Tegra based ASUS Transformers.
>
> Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
[Severity: Low]
Should the commit message also describe the USB port, USB hub container,
and USB connectors added by this binding? Right now it only mentions
GPIO-detected hot-pluggable I2C devices, leaving out the rationale for
the USB portion of the schema.
> diff --git a/Documentation/devicetree/bindings/connector/asus,transformer-dock.yaml b/Documentation/devicetree/bindings/connector/asus,transformer-dock.yaml
> new file mode 100644
> index 0000000000000..ce9730b558e5b
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/connector/asus,transformer-dock.yaml
> @@ -0,0 +1,171 @@
[ ... ]
> +properties:
> + compatible:
> + const: asus,transformer-dock
[Severity: Medium]
Should compatible use model-specific strings with a fallback instead of
the device-family name asus,transformer-dock?
writing-bindings.rst forbids device-family names in compatibles. A single
family string cannot distinguish hardware differences across Tegra docks
(such as one vs. two USB ports), unlike sibling bindings such as
asus,tf201-ec-pad.yaml which define model-specific compatibles.
[ ... ]
> + i2c-parent:
> + $ref: /schemas/types.yaml#/definitions/phandle
> + description:
> + The phandle of the I2C bus that this multiplexer's master-side port is
> + connected to.
[Severity: Low]
This description looks copied from i2c-mux-gpio.yaml and refers to the
dock as a multiplexer, even though it is a detachable bus extension rather
than an I2C multiplexer.
[ ... ]
> + port:
> + $ref: /schemas/graph.yaml#/properties/port
> + description:
> + OF graph link modeling a connection from HOST USB node to Dock.
> +
> + usb:
> + $ref: /schemas/usb/usb-hcd.yaml#
> + description:
> + Container for USB devices found in the dock.
> + unevaluatedProperties: false
[Severity: Medium]
Is referencing usb-hcd.yaml and linking the dock via an OF graph port
valid for a passive downstream USB hub?
usb-hcd.yaml models a USB host controller and exposes HCD/PHY properties,
whereas the dock only contains a downstream USB hub attached to the SoC's
host controller.
In Linux, usb_of_get_device_node() (used by usb_alloc_dev() and
onboard_dev_create_pdevs()) only matches direct children of the HCD or
parent hub by reg, and never traverses an OF graph port into a separate
dock/usb container, so hub@1 and device@3 will never bind.
On Tegra ASUS Transformers, chipidea,usb2-common.yaml also requires
usb-role-switch whenever a port node is present, so adding a port to a
host-only Tegra EHCI controller fails dtbs_check. The dock hub should
instead be described directly under the parent USB host controller node.
> +patternProperties:
> + "^usb-connector(-[01])?$":
> + $ref: /schemas/connector/usb-connector.yaml#
> + description:
> + USB connectors exposed on the dock.
> + unevaluatedProperties: false
[Severity: Low]
Can this pattern allow three USB connector nodes (usb-connector,
usb-connector-0, and usb-connector-1) to appear at the same time? There
is no mutual-exclusion rule preventing the unnumbered form from coexisting
with the numbered ones, exceeding the stated one-or-two port limit.
Separately, port and usb are both optional with no dependency tying them
together, so a node can declare usb without port or vice versa.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261204063414.63617-1-clamor95@gmail.com?part=1
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2 2/2] platform/asus: Add driver for ASUS Transformer's Dock of Tegra based devices
2026-12-04 6:34 ` [PATCH v2 2/2] platform/asus: Add driver for ASUS Transformer's Dock of Tegra based devices Svyatoslav Ryhel
@ 2026-12-04 7:08 ` sashiko-bot
0 siblings, 0 replies; 5+ messages in thread
From: sashiko-bot @ 2026-12-04 7:08 UTC (permalink / raw)
To: Svyatoslav Ryhel; +Cc: devicetree, robh, conor+dt
Thank you for your contribution! Sashiko AI review found 7 potential
issues to consider:
- [High] platform/asus: double-free and UAF reusing priv->adap after
failed add
- [Medium] platform/asus: asus_tf_dock_probe() returns -ENODEV instead
of -EPROBE_DEFER
- [Medium] platform/asus: asus_tf_dock_activate() sets wrong
adap.dev.parent
- [Medium] platform/asus: missing PM resume callback misses dock changes
in suspend
- [Medium] platform/asus: asus_tf_dock_algo omits xfer_atomic and uses
deprecated master_xfer
- [Medium] platform/asus: nested I2C retries in asus_tf_dock_probe()
- [Low] platform/asus: shared static i2c_bus_recovery_info mutated
without locking
--
commit a88f182670e0c763b88a8c86992d33cc8ebfaf13
Author: Michał Mirosław <mirq-linux@rere.qmqm.pl>
platform/asus: Add driver for ASUS Transformer's Dock of Tegra based devices
This commit adds a platform driver for the ASUS Transformer dock on
Tegra-based devices, exposing a hot-pluggable child I2C adapter whose
presence is tracked via a detect GPIO.
> diff --git a/drivers/platform/asus/asus-transformer-dock.c b/drivers/platform/asus/asus-transformer-dock.c
> new file mode 100644
> index 0000000000000..a3f5e5ddcb0c7
> --- /dev/null
> +++ b/drivers/platform/asus/asus-transformer-dock.c
> @@ -0,0 +1,282 @@
[ ... ]
> +static const struct i2c_algorithm asus_tf_dock_algo_i2c = {
> + .master_xfer = asus_tf_dock_master_xfer,
> + .functionality = asus_tf_dock_functionality,
> +};
> +
> +static const struct i2c_algorithm asus_tf_dock_algo_smbus = {
> + .smbus_xfer = asus_tf_dock_smbus_xfer,
> + .functionality = asus_tf_dock_functionality,
> +};
> +
> +static const struct i2c_algorithm asus_tf_dock_algo_both = {
> + .master_xfer = asus_tf_dock_master_xfer,
> + .smbus_xfer = asus_tf_dock_smbus_xfer,
> + .functionality = asus_tf_dock_functionality,
> +};
[Severity: Medium]
Should these i2c_algorithm structs use .xfer instead of the deprecated
.master_xfer and propagate .xfer_atomic / .smbus_xfer_atomic from parent?
Tegra's tegra_i2c_algo supports .xfer_atomic, so an atomic dock transfer
during shutdown or reboot triggers a WARN in __i2c_lock_bus_helper() and
breaks atomic SMBus fallback in __i2c_smbus_xfer(). Populating a
per-instance struct i2c_algorithm from parent->algo avoids this.
[ ... ]
> +static struct i2c_bus_recovery_info asus_tf_dock_recovery_info = {
> + .recover_bus = asus_tf_dock_recover_bus,
> +};
[Severity: Low]
Can sharing a single mutable static struct i2c_bus_recovery_info across
instances cause a data race during adapter registration?
i2c_add_adapter() -> i2c_register_adapter() -> i2c_init_recovery() calls
i2c_gpio_init_pinctrl_recovery() without holding core_lock, mutating
bri->pinctrl, bri->pins_default, and bri->pins_gpio before non-generic
recover_bus callbacks are skipped. Embedding struct i2c_bus_recovery_info
in struct asus_tf_dock_priv eliminates the shared mutable state.
> +static int asus_tf_dock_activate(struct asus_tf_dock_priv *priv)
> +{
> + int ret;
> +
> + if (test_bit(ASUS_TF_DOCK_ATTACHED, &priv->state_flags))
> + return 0;
> +
> + /*
> + * Store the dev data in adapter dev, since
> + * previous i2c_del_adapter might have wiped it.
> + */
> + priv->adap.dev.parent = priv->dev;
[Severity: Medium]
Should priv->adap.dev.parent be &priv->parent->dev rather than priv->dev?
i2c_parent_is_i2c_adapter() and i2c_adapter_depth() check for ancestors of
type &i2c_adapter_type. Using the platform device breaks cross-bus address
collision detection in i2c_check_addr_busy(), stops i2c_root_adapter() at
priv->adap, and loses lockdep depth and parent-child async PM ordering.
> + device_set_node(&priv->adap.dev, priv->i2c_fwnode);
> +
> + dev_dbg(priv->adap.dev.parent, "connection detected");
> +
> + ret = i2c_add_adapter(&priv->adap);
> + if (!ret)
> + set_bit(ASUS_TF_DOCK_ATTACHED, &priv->state_flags);
> +
> + return ret;
> +}
[ ... ]
> + if (state)
> + asus_tf_dock_activate(priv);
> + else
> + asus_tf_dock_deactivate(priv);
[Severity: High]
Can reusing priv->adap after a failed i2c_add_adapter() cause a double
free and use-after-free on the next attach interrupt?
Unlike i2c_del_adapter(), i2c_register_adapter()'s err_put_adap path calls
put_device(&adap->dev) without zeroing adap->dev. If registration fails
after device_initialize() (e.g., in device_add()), kobject_cleanup() frees
kobj.name and device_release() frees dev->p without clearing them.
Since ASUS_TF_DOCK_ATTACHED remains clear and asus_tf_dock_interrupt()
ignores the return value, the next attach retries on the released device:
dev_set_name() double frees kobj.name and device_add() dereferences the
dangling dev->p.
Allocating a fresh struct i2c_adapter per activation (or zeroing
priv->adap.dev before registration) and logging errors from
asus_tf_dock_activate() would avoid this.
[ ... ]
> + parent = of_get_i2c_adapter_by_node(parent_np);
> + of_node_put(parent_np);
> + if (!parent)
> + return dev_err_probe(dev, -ENODEV,
> + "Failed to get parent I2C adapter\n");
[Severity: Medium]
Should this return -EPROBE_DEFER instead of -ENODEV when parent is NULL?
of_get_i2c_adapter_by_node() returns NULL whenever the parent I2C adapter
has not registered yet (for instance with modular or asynchronously probed
controllers, or fw_devlink=off). Returning -ENODEV permanently aborts
probe instead of deferring, leaving the dock bus and its devices unbound.
[ ... ]
> + priv->adap.retries = parent->retries;
> + priv->adap.timeout = parent->timeout;
[Severity: Medium]
Does copying parent->retries and parent->timeout nest the I2C core retry
loops on -EAGAIN?
asus_tf_dock_master_xfer() and asus_tf_dock_smbus_xfer() delegate to
__i2c_transfer(parent, ...) and __i2c_smbus_xfer(parent, ...), running the
parent retry loop inside priv->adap's loop. On arbitration loss, attempts
are squared to (parent->retries + 1)^2 while holding parent->bus_lock.
Leaving priv->adap.retries at 0 lets the parent adapter handle retries
once without nesting.
[ ... ]
> +static struct platform_driver asus_tf_dock_driver = {
> + .driver = {
> + .name = "asus-transformer-dock",
> + .of_match_table = asus_tf_dock_of_match,
> + },
> + .probe = asus_tf_dock_probe,
> +};
[Severity: Medium]
Does this driver miss dock attach and detach events that occur during
system suspend?
On Tegra, tegra_gpio_suspend() masks non-wakeup GPIO interrupts and
tegra_gpio_resume() does not synthesize missed edges. Without
enable_irq_wake() or a PM resume callback to re-check priv->gpio, docking
or undocking during suspend leaves software state out of sync on resume.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261204063414.63617-1-clamor95@gmail.com?part=2
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-12-04 7:08 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-04 6:34 [PATCH v2 0/2] platform/asus: Add driver for ASUS Transformer's Dock Svyatoslav Ryhel
2026-12-04 6:34 ` [PATCH v2 1/2] dt-bindings: connector: Document " Svyatoslav Ryhel
2026-12-04 6:52 ` sashiko-bot
2026-12-04 6:34 ` [PATCH v2 2/2] platform/asus: Add driver for ASUS Transformer's Dock of Tegra based devices Svyatoslav Ryhel
2026-12-04 7:08 ` sashiko-bot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox