usb: typec: mux: tusb1046: Support no-hpd
v3 cover usb: typec: mux: tusb1046: Support no-hpd
On boards where the TUSB1046 HPD_IN pin has no usable HPD signal, configure the device to treat HPD_IN as asserted while DisplayPort Alt Mode is active. Describe this with no-hpd.
Changes in v3:
- Describe only the hardware condition in the binding, as requested by Romain Gantois.
- Carry Romain's Reviewed-by tag on the driver patch.
Changes in v2:
- Use no-hpd instead of ti,hpd-in-override, as suggested by Rob Herring.
Ajit Singh (2):
dt-bindings: usb: ti,tusb1046: Document no-hpd
usb: typec: mux: tusb1046: Support no-hpd
.../devicetree/bindings/usb/ti,tusb1046.yaml | 5 +++++ drivers/usb/typec/mux/tusb1046.c | 13 +++++++++++++ 2 files changed, 18 insertions(+)
Signature · 1 line
2.50.1 (Apple Git-155)
PATCH v3 1/2 dt-bindings: usb: ti,tusb1046: Document no-hpd
Describe boards where the TUSB1046 HPD_IN pin is not connected to a usable HPD signal.
--- Documentation/devicetree/bindings/usb/ti,tusb1046.yaml | 5 +++++ 1 file changed, 5 insertions(+)
Documentation/devicetree/bindings/usb/ti,tusb1046.yaml +5 -0
@@ -20,6 +20,11 @@ properties: reg: maxItems: 1 + no-hpd: + type: boolean + description: + The HPD_IN pin is not connected to a usable HPD signal. + required: - compatible - reg
Signature · 1 line
2.50.1 (Apple Git-155)
PATCH v3 2/2 usb: typec: mux: tusb1046: Support no-hpd
In reply to Ajit SinghWhen HPD_IN has no usable hardware signal, set HPDIN_OVERRIDE over I2C in DisplayPort Alt Mode so the device treats HPD_IN as asserted. Clear the override when leaving DisplayPort mode, and preserve the existing register value on boards without no-hpd.
--- drivers/usb/typec/mux/tusb1046.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
drivers/usb/typec/mux/tusb1046.c +13 -0
@@ -21,6 +21,7 @@/* General register bits */ #define TUSB1046_GENERAL_FLIPSEL BIT(2)#define TUSB1046_GENERAL_CTLSEL GENMASK(1, 0) +#define TUSB1046_GENERAL_HPDIN_OVERRIDE BIT(3)/* Mux modes */ #define TUSB1046_CTLSEL_DISABLED 0x0
@@ -32,6 +33,7 @@ struct tusb1046_priv {struct i2c_client *client;struct typec_switch_dev *sw;struct typec_mux_dev *mux; +bool no_hpd;/* Lock General register during accesses */ struct mutex general_reg_lock;
@@ -44,6 +46,7 @@ static int tusb1046_mux_set(struct typec_mux_dev *mux,struct i2c_client *client = priv->client;struct device *dev = &client->dev;int mode, val, ret =0 ; +bool dp_active = false;if (state->mode >=TYPEC_STATE_MODAL && state->alt->svid !=USB_TYPEC_DP_SID )
@@ -67,9 +70,11 @@ static int tusb1046_mux_set(struct typec_mux_dev *mux,case TYPEC_DP_STATE_C :case TYPEC_DP_STATE_E : mode =TUSB1046_CTLSEL_4LANE_DP ; + dp_active = true;break ;case TYPEC_DP_STATE_D : mode =TUSB1046_CTLSEL_USB3_AND_2LANE_DP ; + dp_active = true;break ;case TYPEC_STATE_SAFE :default :
@@ -80,6 +85,13 @@ static int tusb1046_mux_set(struct typec_mux_dev *mux, val &= ~TUSB1046_GENERAL_CTLSEL ; val |= mode; +if (priv->no_hpd) { +if (dp_active) + val |=TUSB1046_GENERAL_HPDIN_OVERRIDE ; +else + val &= ~TUSB1046_GENERAL_HPDIN_OVERRIDE ; + } + ret =i2c_smbus_write_byte_data (client,TUSB1046_REG_GENERAL , val); out_unlock:
@@ -131,6 +143,7 @@ static int tusb1046_i2c_probe(struct i2c_client *client)return -ENOMEM ; priv->client = client; + priv->no_hpd =device_property_read_bool (dev,"no-hpd" );mutex_init (&priv->general_reg_lock);
Signature · 1 line
2.50.1 (Apple Git-155)
[email protected]
AI reviewSashiko has reviewed this 2-patch series and found no issues.
Sashiko has reviewed this 2-patch series and found no issues.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]