]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
usb: typec: fusb302: add DRM DP HPD bridge support
authorSebastian Reichel <sebastian.reichel@collabora.com>
Tue, 10 Mar 2026 17:17:34 +0000 (18:17 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 11 Mar 2026 14:02:13 +0000 (15:02 +0100)
Add support to use fusb302 based USB-C connectors with the DP altmode
helper code on devicetree based platforms. To get this working there
must be a DRM bridge chain from the DisplayPort controller to the USB-C
connector. E.g. on Rockchip RK3576:

root@rk3576 # cat /sys/kernel/debug/dri/0/encoder-0/bridges
bridge[0]: dw_dp_bridge_funcs
refcount: 7
type: [10] DP
OF: /soc/dp@27e40000:rockchip,rk3576-dp
ops: [0x47] detect edid hpd
bridge[1]: drm_aux_bridge_funcs
refcount: 4
type: [0] Unknown
OF: /soc/phy@2b010000:rockchip,rk3576-usbdp-phy
ops: [0x0]
bridge[2]: drm_aux_hpd_bridge_funcs
refcount: 5
type: [10] DP
OF: /soc/i2c@2ac50000/typec-portc@22/connector:usb-c-connector
ops: [0x4] hpd

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Acked-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Link: https://patch.msgid.link/20260310-fusb302-drm-dp-hpd-bridge-v1-1-ffd41ef9afe3@collabora.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/typec/tcpm/Kconfig
drivers/usb/typec/tcpm/fusb302.c

index 8cdd84ca5d6f76488b00c02a368749e33c2a2b96..00baa7503d45275683358dfb23cdb932421309cb 100644 (file)
@@ -58,6 +58,8 @@ config TYPEC_FUSB302
        tristate "Fairchild FUSB302 Type-C chip driver"
        depends on I2C
        depends on EXTCON || !EXTCON
+       depends on DRM || DRM=n
+       select DRM_AUX_HPD_BRIDGE if DRM_BRIDGE && OF
        help
          The Fairchild FUSB302 Type-C chip driver that works with
          Type-C Port Controller Manager to provide USB PD and USB
index 19ff8217818e7ee0363bcbcc1f7706bd8e742f87..ce7069fb4be6931ce496f4181080730f6a12f67b 100644 (file)
@@ -5,6 +5,7 @@
  * Fairchild FUSB302 Type-C Chip Driver
  */
 
+#include <drm/bridge/aux-bridge.h>
 #include <linux/debugfs.h>
 #include <linux/delay.h>
 #include <linux/errno.h>
@@ -1689,6 +1690,7 @@ static int fusb302_probe(struct i2c_client *client)
 {
        struct fusb302_chip *chip;
        struct i2c_adapter *adapter = client->adapter;
+       struct auxiliary_device *bridge_dev;
        struct device *dev = &client->dev;
        const char *name;
        int ret = 0;
@@ -1747,6 +1749,13 @@ static int fusb302_probe(struct i2c_client *client)
                goto destroy_workqueue;
        }
 
+       bridge_dev = devm_drm_dp_hpd_bridge_alloc(chip->dev, to_of_node(chip->tcpc_dev.fwnode));
+       if (IS_ERR(bridge_dev)) {
+               ret = PTR_ERR(bridge_dev);
+               dev_err_probe(chip->dev, ret, "failed to alloc bridge\n");
+               goto destroy_workqueue;
+       }
+
        chip->tcpm_port = tcpm_register_port(&client->dev, &chip->tcpc_dev);
        if (IS_ERR(chip->tcpm_port)) {
                fwnode_handle_put(chip->tcpc_dev.fwnode);
@@ -1764,6 +1773,10 @@ static int fusb302_probe(struct i2c_client *client)
        enable_irq_wake(chip->gpio_int_n_irq);
        i2c_set_clientdata(client, chip);
 
+       ret = devm_drm_dp_hpd_bridge_add(chip->dev, bridge_dev);
+       if (ret)
+               return ret;
+
        return ret;
 
 tcpm_unregister_port: