]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
extcon: usbc-tusb320: Make typec-power-opmode optional
authorYannis Bolliger <yannis.bolliger@protonmail.com>
Fri, 17 Oct 2025 19:30:01 +0000 (19:30 +0000)
committerChanwoo Choi <cw00.choi@samsung.com>
Fri, 20 Mar 2026 02:20:43 +0000 (11:20 +0900)
The driver returned an error in the probe function when a usb c
connector is configured in the DT without a "typec-power-opmode"
property. This property is used to initialize the CURRENT_MODE_ADVERTISE
register of the TUSB320, which is unused when operating as a UFP.
Requiring this property causes unnecessary configuration overhead and
inconsistency with the USB connector DT bindings, which do not specify
it as required.

This change makes typec-power-opmode optional. When the property is not
present, the driver will skip programming the CURRENT_MODE_ADVERTISE
register and rely on the hardware default.

Signed-off-by: Yannis Bolliger <yannis.bolliger@protonmail.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Link: https://lore.kernel.org/lkml/aPKZJ6WTZlhSOyST@yaene-desktop/
drivers/extcon/extcon-usbc-tusb320.c

index 2eab341de6b76f3b3ca3d89b008b8800d5260ae1..920b034218502983032640cc6bf132fe478d27f4 100644 (file)
@@ -454,20 +454,18 @@ static int tusb320_typec_probe(struct i2c_client *client,
        priv->port_type = priv->cap.type;
 
        /* This goes into register 0x8 field CURRENT_MODE_ADVERTISE */
-       ret = fwnode_property_read_string(connector, "typec-power-opmode", &cap_str);
-       if (ret)
-               goto err_put;
-
-       ret = typec_find_pwr_opmode(cap_str);
-       if (ret < 0)
-               goto err_put;
-
-       priv->pwr_opmode = ret;
+       if (!fwnode_property_read_string(connector, "typec-power-opmode",
+                                        &cap_str)) {
+               ret = typec_find_pwr_opmode(cap_str);
+               if (ret < 0)
+                       goto err_put;
+               priv->pwr_opmode = ret;
 
-       /* Initialize the hardware with the devicetree settings. */
-       ret = tusb320_set_adv_pwr_mode(priv);
-       if (ret)
-               goto err_put;
+               /* Initialize the hardware with the devicetree settings. */
+               ret = tusb320_set_adv_pwr_mode(priv);
+               if (ret)
+                       goto err_put;
+       }
 
        priv->cap.revision              = USB_TYPEC_REV_1_1;
        priv->cap.accessory[0]          = TYPEC_ACCESSORY_AUDIO;