Lines Matching refs:aux
94 struct drm_dp_aux *aux = cec_get_drvdata(adap); in drm_dp_cec_adap_enable() local
98 err = drm_dp_dpcd_writeb(aux, DP_CEC_TUNNELING_CONTROL, val); in drm_dp_cec_adap_enable()
104 struct drm_dp_aux *aux = cec_get_drvdata(adap); in drm_dp_cec_adap_log_addr() local
114 err = drm_dp_dpcd_write(aux, DP_CEC_LOGICAL_ADDRESS_MASK, mask, 2); in drm_dp_cec_adap_log_addr()
121 struct drm_dp_aux *aux = cec_get_drvdata(adap); in drm_dp_cec_adap_transmit() local
125 err = drm_dp_dpcd_write(aux, DP_CEC_TX_MESSAGE_BUFFER, in drm_dp_cec_adap_transmit()
130 err = drm_dp_dpcd_writeb(aux, DP_CEC_TX_MESSAGE_INFO, in drm_dp_cec_adap_transmit()
139 struct drm_dp_aux *aux = cec_get_drvdata(adap); in drm_dp_cec_adap_monitor_all_enable() local
146 err = drm_dp_dpcd_readb(aux, DP_CEC_TUNNELING_CONTROL, &val); in drm_dp_cec_adap_monitor_all_enable()
152 err = drm_dp_dpcd_writeb(aux, DP_CEC_TUNNELING_CONTROL, val); in drm_dp_cec_adap_monitor_all_enable()
160 struct drm_dp_aux *aux = cec_get_drvdata(adap); in drm_dp_cec_adap_status() local
164 if (drm_dp_read_desc(aux, &desc, true)) in drm_dp_cec_adap_status()
189 static int drm_dp_cec_received(struct drm_dp_aux *aux) in drm_dp_cec_received() argument
191 struct cec_adapter *adap = aux->cec.adap; in drm_dp_cec_received()
196 err = drm_dp_dpcd_readb(aux, DP_CEC_RX_MESSAGE_INFO, &rx_msg_info); in drm_dp_cec_received()
204 err = drm_dp_dpcd_read(aux, DP_CEC_RX_MESSAGE_BUFFER, msg.msg, msg.len); in drm_dp_cec_received()
212 static void drm_dp_cec_handle_irq(struct drm_dp_aux *aux) in drm_dp_cec_handle_irq() argument
214 struct cec_adapter *adap = aux->cec.adap; in drm_dp_cec_handle_irq()
217 if (drm_dp_dpcd_readb(aux, DP_CEC_TUNNELING_IRQ_FLAGS, &flags) < 0) in drm_dp_cec_handle_irq()
221 drm_dp_cec_received(aux); in drm_dp_cec_handle_irq()
232 drm_dp_dpcd_writeb(aux, DP_CEC_TUNNELING_IRQ_FLAGS, flags); in drm_dp_cec_handle_irq()
242 void drm_dp_cec_irq(struct drm_dp_aux *aux) in drm_dp_cec_irq() argument
248 if (!aux->transfer) in drm_dp_cec_irq()
251 mutex_lock(&aux->cec.lock); in drm_dp_cec_irq()
252 if (!aux->cec.adap) in drm_dp_cec_irq()
255 ret = drm_dp_dpcd_readb(aux, DP_DEVICE_SERVICE_IRQ_VECTOR_ESI1, in drm_dp_cec_irq()
260 drm_dp_cec_handle_irq(aux); in drm_dp_cec_irq()
261 drm_dp_dpcd_writeb(aux, DP_DEVICE_SERVICE_IRQ_VECTOR_ESI1, DP_CEC_IRQ); in drm_dp_cec_irq()
263 mutex_unlock(&aux->cec.lock); in drm_dp_cec_irq()
267 static bool drm_dp_cec_cap(struct drm_dp_aux *aux, u8 *cec_cap) in drm_dp_cec_cap() argument
271 if (drm_dp_dpcd_readb(aux, DP_CEC_TUNNELING_CAPABILITY, &cap) != 1 || in drm_dp_cec_cap()
285 struct drm_dp_aux *aux = container_of(work, struct drm_dp_aux, in drm_dp_cec_unregister_work() local
288 mutex_lock(&aux->cec.lock); in drm_dp_cec_unregister_work()
289 cec_unregister_adapter(aux->cec.adap); in drm_dp_cec_unregister_work()
290 aux->cec.adap = NULL; in drm_dp_cec_unregister_work()
291 mutex_unlock(&aux->cec.lock); in drm_dp_cec_unregister_work()
300 void drm_dp_cec_set_edid(struct drm_dp_aux *aux, const struct edid *edid) in drm_dp_cec_set_edid() argument
302 struct drm_connector *connector = aux->cec.connector; in drm_dp_cec_set_edid()
310 if (!aux->transfer) in drm_dp_cec_set_edid()
323 cancel_delayed_work_sync(&aux->cec.unregister_work); in drm_dp_cec_set_edid()
325 mutex_lock(&aux->cec.lock); in drm_dp_cec_set_edid()
326 if (!drm_dp_cec_cap(aux, &cap)) { in drm_dp_cec_set_edid()
328 cec_unregister_adapter(aux->cec.adap); in drm_dp_cec_set_edid()
329 aux->cec.adap = NULL; in drm_dp_cec_set_edid()
338 if (aux->cec.adap) { in drm_dp_cec_set_edid()
339 if (aux->cec.adap->capabilities == cec_caps && in drm_dp_cec_set_edid()
340 aux->cec.adap->available_log_addrs == num_las) { in drm_dp_cec_set_edid()
342 cec_s_phys_addr_from_edid(aux->cec.adap, edid); in drm_dp_cec_set_edid()
349 cec_unregister_adapter(aux->cec.adap); in drm_dp_cec_set_edid()
353 aux->cec.adap = cec_allocate_adapter(&drm_dp_cec_adap_ops, in drm_dp_cec_set_edid()
354 aux, connector->name, cec_caps, in drm_dp_cec_set_edid()
356 if (IS_ERR(aux->cec.adap)) { in drm_dp_cec_set_edid()
357 aux->cec.adap = NULL; in drm_dp_cec_set_edid()
362 cec_s_conn_info(aux->cec.adap, &conn_info); in drm_dp_cec_set_edid()
364 if (cec_register_adapter(aux->cec.adap, connector->dev->dev)) { in drm_dp_cec_set_edid()
365 cec_delete_adapter(aux->cec.adap); in drm_dp_cec_set_edid()
366 aux->cec.adap = NULL; in drm_dp_cec_set_edid()
373 cec_s_phys_addr_from_edid(aux->cec.adap, edid); in drm_dp_cec_set_edid()
376 mutex_unlock(&aux->cec.lock); in drm_dp_cec_set_edid()
383 void drm_dp_cec_unset_edid(struct drm_dp_aux *aux) in drm_dp_cec_unset_edid() argument
386 if (!aux->transfer) in drm_dp_cec_unset_edid()
389 cancel_delayed_work_sync(&aux->cec.unregister_work); in drm_dp_cec_unset_edid()
391 mutex_lock(&aux->cec.lock); in drm_dp_cec_unset_edid()
392 if (!aux->cec.adap) in drm_dp_cec_unset_edid()
395 cec_phys_addr_invalidate(aux->cec.adap); in drm_dp_cec_unset_edid()
403 !drm_dp_cec_cap(aux, NULL)) { in drm_dp_cec_unset_edid()
409 schedule_delayed_work(&aux->cec.unregister_work, in drm_dp_cec_unset_edid()
413 mutex_unlock(&aux->cec.lock); in drm_dp_cec_unset_edid()
427 void drm_dp_cec_register_connector(struct drm_dp_aux *aux, in drm_dp_cec_register_connector() argument
430 WARN_ON(aux->cec.adap); in drm_dp_cec_register_connector()
431 if (WARN_ON(!aux->transfer)) in drm_dp_cec_register_connector()
433 aux->cec.connector = connector; in drm_dp_cec_register_connector()
434 INIT_DELAYED_WORK(&aux->cec.unregister_work, in drm_dp_cec_register_connector()
443 void drm_dp_cec_unregister_connector(struct drm_dp_aux *aux) in drm_dp_cec_unregister_connector() argument
445 if (!aux->cec.adap) in drm_dp_cec_unregister_connector()
447 cancel_delayed_work_sync(&aux->cec.unregister_work); in drm_dp_cec_unregister_connector()
448 cec_unregister_adapter(aux->cec.adap); in drm_dp_cec_unregister_connector()
449 aux->cec.adap = NULL; in drm_dp_cec_unregister_connector()