Lines Matching refs:aux
43 * levels to deal with Display Port sink devices and related things like DP aux
44 * channel transfers, EDID reading over DP aux channels, decoding certain DPCD
188 drm_dp_dump_access(const struct drm_dp_aux *aux,
195 aux->name, offset, arrow, ret, min(ret, 20), buffer);
198 aux->name, offset, arrow, ret);
213 static int drm_dp_dpcd_access(struct drm_dp_aux *aux, u8 request,
226 mutex_lock(&aux->hw_mutex);
231 * aux i2c transactions but real world devices this wasn't
240 ret = aux->transfer(aux, &msg);
262 aux->name, err);
266 mutex_unlock(&aux->hw_mutex);
272 * @aux: DisplayPort AUX channel (SST or MST)
284 ssize_t drm_dp_dpcd_read(struct drm_dp_aux *aux, unsigned int offset,
301 if (!aux->is_remote) {
302 ret = drm_dp_dpcd_access(aux, DP_AUX_NATIVE_READ, DP_DPCD_REV,
308 if (aux->is_remote)
309 ret = drm_dp_mst_dpcd_read(aux, offset, buffer, size);
311 ret = drm_dp_dpcd_access(aux, DP_AUX_NATIVE_READ, offset,
315 drm_dp_dump_access(aux, DP_AUX_NATIVE_READ, offset, buffer, ret);
322 * @aux: DisplayPort AUX channel (SST or MST)
334 ssize_t drm_dp_dpcd_write(struct drm_dp_aux *aux, unsigned int offset,
339 if (aux->is_remote)
340 ret = drm_dp_mst_dpcd_write(aux, offset, buffer, size);
342 ret = drm_dp_dpcd_access(aux, DP_AUX_NATIVE_WRITE, offset,
345 drm_dp_dump_access(aux, DP_AUX_NATIVE_WRITE, offset, buffer, ret);
352 * @aux: DisplayPort AUX channel
358 int drm_dp_dpcd_read_link_status(struct drm_dp_aux *aux,
361 return drm_dp_dpcd_read(aux, DP_LANE0_1_STATUS, status,
432 * @aux: DisplayPort AUX channel
438 bool drm_dp_send_real_edid_checksum(struct drm_dp_aux *aux,
443 if (drm_dp_dpcd_read(aux, DP_DEVICE_SERVICE_IRQ_VECTOR,
446 aux->name, DP_DEVICE_SERVICE_IRQ_VECTOR);
451 if (drm_dp_dpcd_read(aux, DP_TEST_REQUEST, &link_edid_read, 1) < 1) {
453 aux->name, DP_TEST_REQUEST);
460 aux->name);
464 if (drm_dp_dpcd_write(aux, DP_DEVICE_SERVICE_IRQ_VECTOR,
467 aux->name, DP_DEVICE_SERVICE_IRQ_VECTOR);
472 if (drm_dp_dpcd_write(aux, DP_TEST_EDID_CHECKSUM,
475 aux->name, DP_TEST_EDID_CHECKSUM);
480 if (drm_dp_dpcd_write(aux, DP_TEST_RESPONSE, &test_resp, 1) < 1) {
482 aux->name, DP_TEST_RESPONSE);
500 static int drm_dp_read_extended_dpcd_caps(struct drm_dp_aux *aux,
517 ret = drm_dp_dpcd_read(aux, DP_DP13_DPCD_REV, &dpcd_ext,
526 aux->name, dpcd[DP_DPCD_REV],
535 aux->name, DP_RECEIVER_CAP_SIZE, dpcd);
545 * @aux: DisplayPort AUX channel
548 * Attempts to read the base DPCD caps for @aux. Additionally, this function
555 int drm_dp_read_dpcd_caps(struct drm_dp_aux *aux,
560 ret = drm_dp_dpcd_read(aux, DP_DPCD_REV, dpcd, DP_RECEIVER_CAP_SIZE);
566 ret = drm_dp_read_extended_dpcd_caps(aux, dpcd);
571 aux->name, DP_RECEIVER_CAP_SIZE, dpcd);
579 * @aux: DisplayPort AUX channel
590 int drm_dp_read_downstream_info(struct drm_dp_aux *aux,
616 ret = drm_dp_dpcd_read(aux, DP_DOWNSTREAM_PORT_0, downstream_ports, len);
623 aux->name, len, downstream_ports);
939 * @aux: DisplayPort AUX channel
944 int drm_dp_downstream_id(struct drm_dp_aux *aux, char id[6])
946 return drm_dp_dpcd_read(aux, DP_BRANCH_ID, id, 6);
956 * @aux: DisplayPort AUX channel
963 struct drm_dp_aux *aux)
1008 drm_dp_downstream_id(aux, id);
1011 len = drm_dp_dpcd_read(aux, DP_BRANCH_HW_REV, &rev[0], 1);
1016 len = drm_dp_dpcd_read(aux, DP_BRANCH_SW_REV, rev, 2);
1143 * @aux: The DP AUX channel to use
1147 * Returns: The current sink count reported by @aux, or a negative error code
1150 int drm_dp_read_sink_count(struct drm_dp_aux *aux)
1155 ret = drm_dp_dpcd_readb(aux, DP_SINK_COUNT, &count);
1282 static int drm_dp_i2c_do_msg(struct drm_dp_aux *aux, struct drm_dp_aux_msg *msg)
1296 ret = aux->transfer(aux, msg);
1309 aux->name);
1312 aux->name, ret);
1327 aux->name, ret, msg->size);
1331 DRM_DEBUG_KMS("%s: native defer\n", aux->name);
1346 aux->name, msg->reply);
1362 aux->name, ret, msg->size);
1363 aux->i2c_nack_count++;
1367 DRM_DEBUG_KMS("%s: I2C defer\n", aux->name);
1372 aux->i2c_defer_count++;
1382 aux->name, msg->reply);
1387 DRM_DEBUG_KMS("%s: Too many retries, giving up\n", aux->name);
1405 static int drm_dp_i2c_drain_msg(struct drm_dp_aux *aux, struct drm_dp_aux_msg *orig_msg)
1411 err = drm_dp_i2c_do_msg(aux, &msg);
1417 aux->name, msg.size, err);
1441 struct drm_dp_aux *aux = adapter->algo_data;
1460 err = drm_dp_i2c_do_msg(aux, &msg);
1479 err = drm_dp_i2c_drain_msg(aux, &msg);
1503 (void)drm_dp_i2c_do_msg(aux, &msg);
1539 static int drm_dp_aux_get_crc(struct drm_dp_aux *aux, u8 *crc)
1544 ret = drm_dp_dpcd_readb(aux, DP_TEST_SINK, &buf);
1550 ret = drm_dp_dpcd_readb(aux, DP_TEST_SINK_MISC, &buf);
1555 if (count == aux->crc_count)
1558 aux->crc_count = count;
1564 ret = drm_dp_dpcd_read(aux, DP_TEST_CRC_R_CR, crc, 6);
1573 struct drm_dp_aux *aux = container_of(work, struct drm_dp_aux,
1580 if (WARN_ON(!aux->crtc))
1583 crtc = aux->crtc;
1589 ret = drm_dp_aux_get_crc(aux, crc_bytes);
1592 ret = drm_dp_aux_get_crc(aux, crc_bytes);
1597 aux->name, ret);
1601 aux->name, ret);
1613 * drm_dp_remote_aux_init() - minimally initialise a remote aux channel
1614 * @aux: DisplayPort AUX channel
1616 * Used for remote aux channel in general. Merely initialize the crc work
1619 void drm_dp_remote_aux_init(struct drm_dp_aux *aux)
1621 INIT_WORK(&aux->crc_work, drm_dp_aux_crc_work);
1626 * drm_dp_aux_init() - minimally initialise an aux channel
1627 * @aux: DisplayPort AUX channel
1634 void drm_dp_aux_init(struct drm_dp_aux *aux)
1636 mutex_init(&aux->hw_mutex);
1637 mutex_init(&aux->cec.lock);
1638 INIT_WORK(&aux->crc_work, drm_dp_aux_crc_work);
1640 aux->ddc.algo = &drm_dp_i2c_algo;
1641 aux->ddc.algo_data = aux;
1642 aux->ddc.retries = 3;
1644 aux->ddc.lock_ops = &drm_dp_i2c_lock_ops;
1649 * drm_dp_aux_register() - initialise and register aux channel
1650 * @aux: DisplayPort AUX channel
1658 * Drivers which need to use the aux channel before that point (e.g. at driver
1664 int drm_dp_aux_register(struct drm_dp_aux *aux)
1668 if (!aux->ddc.algo)
1669 drm_dp_aux_init(aux);
1671 aux->ddc.class = I2C_CLASS_DDC;
1672 aux->ddc.owner = THIS_MODULE;
1673 aux->ddc.dev.parent = aux->dev;
1675 strlcpy(aux->ddc.name, aux->name ? aux->name : dev_name(aux->dev),
1676 sizeof(aux->ddc.name));
1678 ret = drm_dp_aux_register_devnode(aux);
1682 ret = i2c_add_adapter(&aux->ddc);
1684 drm_dp_aux_unregister_devnode(aux);
1694 * @aux: DisplayPort AUX channel
1696 void drm_dp_aux_unregister(struct drm_dp_aux *aux)
1698 drm_dp_aux_unregister_devnode(aux);
1699 i2c_del_adapter(&aux->ddc);
1738 * @aux: DisplayPort AUX channel
1743 int drm_dp_start_crc(struct drm_dp_aux *aux, struct drm_crtc *crtc)
1748 ret = drm_dp_dpcd_readb(aux, DP_TEST_SINK, &buf);
1752 ret = drm_dp_dpcd_writeb(aux, DP_TEST_SINK, buf | DP_TEST_SINK_START);
1756 aux->crc_count = 0;
1757 aux->crtc = crtc;
1758 schedule_work(&aux->crc_work);
1766 * @aux: DisplayPort AUX channel
1770 int drm_dp_stop_crc(struct drm_dp_aux *aux)
1775 ret = drm_dp_dpcd_readb(aux, DP_TEST_SINK, &buf);
1779 ret = drm_dp_dpcd_writeb(aux, DP_TEST_SINK, buf & ~DP_TEST_SINK_START);
1783 flush_work(&aux->crc_work);
1784 aux->crtc = NULL;
1940 * @aux: DisplayPort AUX channel
1949 int drm_dp_read_desc(struct drm_dp_aux *aux, struct drm_dp_desc *desc,
1956 ret = drm_dp_dpcd_read(aux, offset, ident, sizeof(*ident));
1965 aux->name, is_branch ? "branch" : "sink",
2115 * @aux: DisplayPort AUX channel
2120 int drm_dp_get_phy_test_pattern(struct drm_dp_aux *aux,
2126 err = drm_dp_dpcd_readb(aux, DP_TEST_LINK_RATE, &rate);
2131 err = drm_dp_dpcd_readb(aux, DP_TEST_LANE_COUNT, &lanes);
2139 err = drm_dp_dpcd_readb(aux, DP_PHY_TEST_PATTERN, &data->phy_pattern);
2145 err = drm_dp_dpcd_read(aux, DP_TEST_80BIT_CUSTOM_PATTERN_7_0,
2152 err = drm_dp_dpcd_read(aux, DP_TEST_HBR2_SCRAMBLER_RESET,
2165 * @aux: DisplayPort AUX channel
2171 int drm_dp_set_phy_test_pattern(struct drm_dp_aux *aux,
2181 err = drm_dp_dpcd_writeb(aux, DP_TRAINING_PATTERN_SET,
2187 err = drm_dp_dpcd_writeb(aux,