Skip to content

Commit 9aea250

Browse files
wenping.zhangrkhuangtao
authored andcommitted
mfd: fusb302: add usb super speed property support.
The meaning of the property value is as below: The value of the property EXTCON_PROP_USB_SS is 0: USB1.0 or USB2.0 The value of the property EXTCON_PROP_USB_SS is 1: USB3.0 we change the logic of fusb302 notification , if dp sink device is connected, dfp is set to 1, and use pin assignment value to define if sink device support usb3.0. Change-Id: Ib7afaf9b754b4585b0ef211dd246059b8ab72904 Signed-off-by: wenping.zhang <wenping.zhang@rock-chips.com>
1 parent bad81ba commit 9aea250

1 file changed

Lines changed: 44 additions & 5 deletions

File tree

drivers/mfd/fusb302.c

Lines changed: 44 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ void fusb_irq_enable(struct fusb30x_chip *chip)
140140

141141
static void platform_fusb_notify(struct fusb30x_chip *chip)
142142
{
143-
bool plugged = 0, flip = 0, dfp = 0, ufp = 0, dp = 0;
143+
bool plugged = 0, flip = 0, dfp = 0, ufp = 0, dp = 0, usb_ss = 0;
144144
union extcon_property_value property;
145145

146146
if (chip->notify.is_cc_connected)
@@ -160,13 +160,17 @@ static void platform_fusb_notify(struct fusb30x_chip *chip)
160160
(chip->notify.orientation - 1) : 0;
161161
dp = chip->notify.is_enter_mode;
162162

163-
if (dp)
164-
dfp = (chip->notify.pin_assignment_def &
163+
if (dp) {
164+
dfp = 1;
165+
usb_ss = (chip->notify.pin_assignment_def &
165166
(PIN_MAP_B | PIN_MAP_D | PIN_MAP_F)) ? 1 : 0;
166-
else if (chip->notify.data_role)
167+
} else if (chip->notify.data_role) {
167168
dfp = 1;
168-
else if (plugged)
169+
usb_ss = 1;
170+
} else if (plugged) {
169171
ufp = 1;
172+
usb_ss = 1;
173+
}
170174

171175
property.intval = flip;
172176
extcon_set_property(chip->extcon, EXTCON_USB,
@@ -175,6 +179,14 @@ static void platform_fusb_notify(struct fusb30x_chip *chip)
175179
EXTCON_PROP_USB_TYPEC_POLARITY, property);
176180
extcon_set_property(chip->extcon, EXTCON_DISP_DP,
177181
EXTCON_PROP_USB_TYPEC_POLARITY, property);
182+
183+
property.intval = usb_ss;
184+
extcon_set_property(chip->extcon, EXTCON_USB,
185+
EXTCON_PROP_USB_SS, property);
186+
extcon_set_property(chip->extcon, EXTCON_USB_HOST,
187+
EXTCON_PROP_USB_SS, property);
188+
extcon_set_property(chip->extcon, EXTCON_DISP_DP,
189+
EXTCON_PROP_USB_SS, property);
178190
extcon_set_state(chip->extcon, EXTCON_USB, ufp);
179191
extcon_set_state(chip->extcon, EXTCON_USB_HOST, dfp);
180192
extcon_set_state(chip->extcon, EXTCON_DISP_DP, dp);
@@ -2279,6 +2291,33 @@ static int fusb30x_probe(struct i2c_client *client,
22792291
return ret;
22802292
}
22812293

2294+
ret = extcon_set_property_capability(chip->extcon, EXTCON_USB,
2295+
EXTCON_PROP_USB_SS);
2296+
if (ret) {
2297+
dev_err(&client->dev,
2298+
"failed to set USB USB_SS property capability: %d\n",
2299+
ret);
2300+
return ret;
2301+
}
2302+
2303+
ret = extcon_set_property_capability(chip->extcon, EXTCON_USB_HOST,
2304+
EXTCON_PROP_USB_SS);
2305+
if (ret) {
2306+
dev_err(&client->dev,
2307+
"failed to set USB_HOST USB_SS property capability: %d\n",
2308+
ret);
2309+
return ret;
2310+
}
2311+
2312+
ret = extcon_set_property_capability(chip->extcon, EXTCON_DISP_DP,
2313+
EXTCON_PROP_USB_SS);
2314+
if (ret) {
2315+
dev_err(&client->dev,
2316+
"failed to set DISP_DP USB_SS property capability: %d\n",
2317+
ret);
2318+
return ret;
2319+
}
2320+
22822321
i2c_set_clientdata(client, chip);
22832322

22842323
spin_lock_init(&chip->irq_lock);

0 commit comments

Comments
 (0)