Lines 285-290
struct typec_altmode *ucsi_register_displayport(struct ucsi_connector *con,
Link Here
|
285 |
struct typec_altmode *alt; |
285 |
struct typec_altmode *alt; |
286 |
struct ucsi_dp *dp; |
286 |
struct ucsi_dp *dp; |
287 |
|
287 |
|
|
|
288 |
mutex_lock(&con->lock); |
289 |
|
288 |
/* We can't rely on the firmware with the capabilities. */ |
290 |
/* We can't rely on the firmware with the capabilities. */ |
289 |
desc->vdo |= DP_CAP_DP_SIGNALING | DP_CAP_RECEPTACLE; |
291 |
desc->vdo |= DP_CAP_DP_SIGNALING | DP_CAP_RECEPTACLE; |
290 |
|
292 |
|
Lines 293-304
struct typec_altmode *ucsi_register_displayport(struct ucsi_connector *con,
Link Here
|
293 |
desc->vdo |= all_assignments << 16; |
295 |
desc->vdo |= all_assignments << 16; |
294 |
|
296 |
|
295 |
alt = typec_port_register_altmode(con->port, desc); |
297 |
alt = typec_port_register_altmode(con->port, desc); |
296 |
if (IS_ERR(alt)) |
298 |
if (IS_ERR(alt)) { |
|
|
299 |
mutex_unlock(&con->lock); |
297 |
return alt; |
300 |
return alt; |
|
|
301 |
} |
298 |
|
302 |
|
299 |
dp = devm_kzalloc(&alt->dev, sizeof(*dp), GFP_KERNEL); |
303 |
dp = devm_kzalloc(&alt->dev, sizeof(*dp), GFP_KERNEL); |
300 |
if (!dp) { |
304 |
if (!dp) { |
301 |
typec_unregister_altmode(alt); |
305 |
typec_unregister_altmode(alt); |
|
|
306 |
mutex_unlock(&con->lock); |
302 |
return ERR_PTR(-ENOMEM); |
307 |
return ERR_PTR(-ENOMEM); |
303 |
} |
308 |
} |
304 |
|
309 |
|
Lines 311-315
struct typec_altmode *ucsi_register_displayport(struct ucsi_connector *con,
Link Here
|
311 |
alt->ops = &ucsi_displayport_ops; |
316 |
alt->ops = &ucsi_displayport_ops; |
312 |
typec_altmode_set_drvdata(alt, dp); |
317 |
typec_altmode_set_drvdata(alt, dp); |
313 |
|
318 |
|
|
|
319 |
mutex_unlock(&con->lock); |
320 |
|
314 |
return alt; |
321 |
return alt; |
315 |
} |
322 |
} |