Lines Matching full: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
141 DRM_DEBUG_KMS("AUX interval %lu, out of range (max 4)\n", in drm_dp_link_train_clock_recovery_delay()
159 DRM_DEBUG_KMS("AUX interval %lu, out of range (max 4)\n", in drm_dp_link_train_channel_eq_delay()
188 drm_dp_dump_access(const struct drm_dp_aux *aux, in drm_dp_dump_access() argument
194 DRM_DEBUG_DP("%s: 0x%05x AUX %s (ret=%3d) %*ph\n", in drm_dp_dump_access()
195 aux->name, offset, arrow, ret, min(ret, 20), buffer); in drm_dp_dump_access()
197 DRM_DEBUG_DP("%s: 0x%05x AUX %s (ret=%3d)\n", in drm_dp_dump_access()
198 aux->name, offset, arrow, ret); in drm_dp_dump_access()
204 * The DisplayPort AUX channel is an abstraction to allow generic, driver-
205 * independent access to AUX functionality. Drivers can take advantage of
210 * Both native and I2C-over-AUX transactions are supported.
213 static int drm_dp_dpcd_access(struct drm_dp_aux *aux, u8 request, in drm_dp_dpcd_access() argument
226 mutex_lock(&aux->hw_mutex); in drm_dp_dpcd_access()
231 * aux i2c transactions but real world devices this wasn't in drm_dp_dpcd_access()
240 ret = aux->transfer(aux, &msg); in drm_dp_dpcd_access()
262 aux->name, err); in drm_dp_dpcd_access()
266 mutex_unlock(&aux->hw_mutex); in drm_dp_dpcd_access()
272 * @aux: DisplayPort AUX channel (SST or MST)
280 * function returns -EPROTO. Errors from the underlying AUX channel transfer
284 ssize_t drm_dp_dpcd_read(struct drm_dp_aux *aux, unsigned int offset, in drm_dp_dpcd_read() argument
301 if (!aux->is_remote) { in drm_dp_dpcd_read()
302 ret = drm_dp_dpcd_access(aux, DP_AUX_NATIVE_READ, DP_DPCD_REV, in drm_dp_dpcd_read()
308 if (aux->is_remote) in drm_dp_dpcd_read()
309 ret = drm_dp_mst_dpcd_read(aux, offset, buffer, size); in drm_dp_dpcd_read()
311 ret = drm_dp_dpcd_access(aux, DP_AUX_NATIVE_READ, offset, in drm_dp_dpcd_read()
315 drm_dp_dump_access(aux, DP_AUX_NATIVE_READ, offset, buffer, ret); in drm_dp_dpcd_read()
322 * @aux: DisplayPort AUX channel (SST or MST)
330 * function returns -EPROTO. Errors from the underlying AUX channel transfer
334 ssize_t drm_dp_dpcd_write(struct drm_dp_aux *aux, unsigned int offset, in drm_dp_dpcd_write() argument
339 if (aux->is_remote) in drm_dp_dpcd_write()
340 ret = drm_dp_mst_dpcd_write(aux, offset, buffer, size); in drm_dp_dpcd_write()
342 ret = drm_dp_dpcd_access(aux, DP_AUX_NATIVE_WRITE, offset, in drm_dp_dpcd_write()
345 drm_dp_dump_access(aux, DP_AUX_NATIVE_WRITE, offset, buffer, ret); in drm_dp_dpcd_write()
352 * @aux: DisplayPort AUX channel
358 int drm_dp_dpcd_read_link_status(struct drm_dp_aux *aux, in drm_dp_dpcd_read_link_status() argument
361 return drm_dp_dpcd_read(aux, DP_LANE0_1_STATUS, status, in drm_dp_dpcd_read_link_status()
432 * @aux: DisplayPort AUX channel
438 bool drm_dp_send_real_edid_checksum(struct drm_dp_aux *aux, in drm_dp_send_real_edid_checksum() argument
443 if (drm_dp_dpcd_read(aux, DP_DEVICE_SERVICE_IRQ_VECTOR, in drm_dp_send_real_edid_checksum()
446 aux->name, DP_DEVICE_SERVICE_IRQ_VECTOR); in drm_dp_send_real_edid_checksum()
451 if (drm_dp_dpcd_read(aux, DP_TEST_REQUEST, &link_edid_read, 1) < 1) { in drm_dp_send_real_edid_checksum()
453 aux->name, DP_TEST_REQUEST); in drm_dp_send_real_edid_checksum()
460 aux->name); in drm_dp_send_real_edid_checksum()
464 if (drm_dp_dpcd_write(aux, DP_DEVICE_SERVICE_IRQ_VECTOR, in drm_dp_send_real_edid_checksum()
467 aux->name, DP_DEVICE_SERVICE_IRQ_VECTOR); in drm_dp_send_real_edid_checksum()
472 if (drm_dp_dpcd_write(aux, DP_TEST_EDID_CHECKSUM, in drm_dp_send_real_edid_checksum()
475 aux->name, DP_TEST_EDID_CHECKSUM); in drm_dp_send_real_edid_checksum()
480 if (drm_dp_dpcd_write(aux, DP_TEST_RESPONSE, &test_resp, 1) < 1) { in drm_dp_send_real_edid_checksum()
482 aux->name, DP_TEST_RESPONSE); in drm_dp_send_real_edid_checksum()
500 static int drm_dp_read_extended_dpcd_caps(struct drm_dp_aux *aux, in drm_dp_read_extended_dpcd_caps() argument
517 ret = drm_dp_dpcd_read(aux, DP_DP13_DPCD_REV, &dpcd_ext, in drm_dp_read_extended_dpcd_caps()
526 aux->name, dpcd[DP_DPCD_REV], in drm_dp_read_extended_dpcd_caps()
535 aux->name, DP_RECEIVER_CAP_SIZE, dpcd); in drm_dp_read_extended_dpcd_caps()
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, in drm_dp_read_dpcd_caps() argument
560 ret = drm_dp_dpcd_read(aux, DP_DPCD_REV, dpcd, DP_RECEIVER_CAP_SIZE); in drm_dp_read_dpcd_caps()
566 ret = drm_dp_read_extended_dpcd_caps(aux, dpcd); in drm_dp_read_dpcd_caps()
571 aux->name, DP_RECEIVER_CAP_SIZE, dpcd); in drm_dp_read_dpcd_caps()
579 * @aux: DisplayPort AUX channel
590 int drm_dp_read_downstream_info(struct drm_dp_aux *aux, in drm_dp_read_downstream_info() argument
616 ret = drm_dp_dpcd_read(aux, DP_DOWNSTREAM_PORT_0, downstream_ports, len); in drm_dp_read_downstream_info()
623 aux->name, len, downstream_ports); in drm_dp_read_downstream_info()
939 * @aux: DisplayPort AUX channel
944 int drm_dp_downstream_id(struct drm_dp_aux *aux, char id[6]) in drm_dp_downstream_id() argument
946 return drm_dp_dpcd_read(aux, DP_BRANCH_ID, id, 6); in drm_dp_downstream_id()
956 * @aux: DisplayPort AUX channel
963 struct drm_dp_aux *aux) in drm_dp_downstream_debug() argument
1008 drm_dp_downstream_id(aux, id); in drm_dp_downstream_debug()
1011 len = drm_dp_dpcd_read(aux, DP_BRANCH_HW_REV, &rev[0], 1); in drm_dp_downstream_debug()
1016 len = drm_dp_dpcd_read(aux, DP_BRANCH_SW_REV, rev, 2); in drm_dp_downstream_debug()
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) in drm_dp_read_sink_count() argument
1155 ret = drm_dp_dpcd_readb(aux, DP_SINK_COUNT, &count); in drm_dp_read_sink_count()
1166 * I2C-over-AUX implementation
1199 * Calculate the duration of the AUX request/reply in usec. Gives the
1244 /* AUX bitrate is 1MHz, i2c bitrate as specified */ in drm_dp_i2c_msg_duration()
1253 * i2c and AUX transfers.
1275 * Transfer a single I2C-over-AUX message and handle various error conditions,
1282 static int drm_dp_i2c_do_msg(struct drm_dp_aux *aux, struct drm_dp_aux_msg *msg) in drm_dp_i2c_do_msg() argument
1289 * before giving up the AUX transaction. in drm_dp_i2c_do_msg()
1296 ret = aux->transfer(aux, msg); in drm_dp_i2c_do_msg()
1309 aux->name); in drm_dp_i2c_do_msg()
1312 aux->name, ret); in drm_dp_i2c_do_msg()
1320 * For I2C-over-AUX transactions this isn't enough, we in drm_dp_i2c_do_msg()
1327 aux->name, ret, msg->size); in drm_dp_i2c_do_msg()
1331 DRM_DEBUG_KMS("%s: native defer\n", aux->name); in drm_dp_i2c_do_msg()
1346 aux->name, msg->reply); in drm_dp_i2c_do_msg()
1362 aux->name, ret, msg->size); in drm_dp_i2c_do_msg()
1363 aux->i2c_nack_count++; in drm_dp_i2c_do_msg()
1367 DRM_DEBUG_KMS("%s: I2C defer\n", aux->name); in drm_dp_i2c_do_msg()
1372 aux->i2c_defer_count++; in drm_dp_i2c_do_msg()
1382 aux->name, msg->reply); in drm_dp_i2c_do_msg()
1387 DRM_DEBUG_KMS("%s: Too many retries, giving up\n", aux->name); in drm_dp_i2c_do_msg()
1405 static int drm_dp_i2c_drain_msg(struct drm_dp_aux *aux, struct drm_dp_aux_msg *orig_msg) in drm_dp_i2c_drain_msg() argument
1411 err = drm_dp_i2c_do_msg(aux, &msg); in drm_dp_i2c_drain_msg()
1417 aux->name, msg.size, err); in drm_dp_i2c_drain_msg()
1429 * Bizlink designed DP->DVI-D Dual Link adapters require the I2C over AUX
1436 "Number of bytes to transfer in a single I2C over DP AUX CH message, (1-16, default 16)");
1441 struct drm_dp_aux *aux = adapter->algo_data; in drm_dp_i2c_xfer() local
1460 err = drm_dp_i2c_do_msg(aux, &msg); in drm_dp_i2c_xfer()
1479 err = drm_dp_i2c_drain_msg(aux, &msg); in drm_dp_i2c_xfer()
1503 (void)drm_dp_i2c_do_msg(aux, &msg); in drm_dp_i2c_xfer()
1539 static int drm_dp_aux_get_crc(struct drm_dp_aux *aux, u8 *crc) in drm_dp_aux_get_crc() argument
1544 ret = drm_dp_dpcd_readb(aux, DP_TEST_SINK, &buf); in drm_dp_aux_get_crc()
1550 ret = drm_dp_dpcd_readb(aux, DP_TEST_SINK_MISC, &buf); in drm_dp_aux_get_crc()
1555 if (count == aux->crc_count) in drm_dp_aux_get_crc()
1558 aux->crc_count = count; in drm_dp_aux_get_crc()
1564 ret = drm_dp_dpcd_read(aux, DP_TEST_CRC_R_CR, crc, 6); in drm_dp_aux_get_crc()
1573 struct drm_dp_aux *aux = container_of(work, struct drm_dp_aux, in drm_dp_aux_crc_work() local
1580 if (WARN_ON(!aux->crtc)) in drm_dp_aux_crc_work()
1583 crtc = aux->crtc; in drm_dp_aux_crc_work()
1589 ret = drm_dp_aux_get_crc(aux, crc_bytes); in drm_dp_aux_crc_work()
1592 ret = drm_dp_aux_get_crc(aux, crc_bytes); in drm_dp_aux_crc_work()
1597 aux->name, ret); in drm_dp_aux_crc_work()
1601 aux->name, ret); in drm_dp_aux_crc_work()
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) in drm_dp_remote_aux_init() argument
1621 INIT_WORK(&aux->crc_work, drm_dp_aux_crc_work); in drm_dp_remote_aux_init()
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) in drm_dp_aux_init() argument
1636 mutex_init(&aux->hw_mutex); in drm_dp_aux_init()
1637 mutex_init(&aux->cec.lock); in drm_dp_aux_init()
1638 INIT_WORK(&aux->crc_work, drm_dp_aux_crc_work); in drm_dp_aux_init()
1640 aux->ddc.algo = &drm_dp_i2c_algo; in drm_dp_aux_init()
1641 aux->ddc.algo_data = aux; in drm_dp_aux_init()
1642 aux->ddc.retries = 3; in drm_dp_aux_init()
1644 aux->ddc.lock_ops = &drm_dp_i2c_lock_ops; in drm_dp_aux_init()
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) in drm_dp_aux_register() argument
1668 if (!aux->ddc.algo) in drm_dp_aux_register()
1669 drm_dp_aux_init(aux); in drm_dp_aux_register()
1671 aux->ddc.class = I2C_CLASS_DDC; in drm_dp_aux_register()
1672 aux->ddc.owner = THIS_MODULE; in drm_dp_aux_register()
1673 aux->ddc.dev.parent = aux->dev; in drm_dp_aux_register()
1675 strlcpy(aux->ddc.name, aux->name ? aux->name : dev_name(aux->dev), in drm_dp_aux_register()
1676 sizeof(aux->ddc.name)); in drm_dp_aux_register()
1678 ret = drm_dp_aux_register_devnode(aux); in drm_dp_aux_register()
1682 ret = i2c_add_adapter(&aux->ddc); in drm_dp_aux_register()
1684 drm_dp_aux_unregister_devnode(aux); in drm_dp_aux_register()
1693 * drm_dp_aux_unregister() - unregister an AUX adapter
1694 * @aux: DisplayPort AUX channel
1696 void drm_dp_aux_unregister(struct drm_dp_aux *aux) in drm_dp_aux_unregister() argument
1698 drm_dp_aux_unregister_devnode(aux); in drm_dp_aux_unregister()
1699 i2c_del_adapter(&aux->ddc); in drm_dp_aux_unregister()
1738 * @aux: DisplayPort AUX channel
1743 int drm_dp_start_crc(struct drm_dp_aux *aux, struct drm_crtc *crtc) in drm_dp_start_crc() argument
1748 ret = drm_dp_dpcd_readb(aux, DP_TEST_SINK, &buf); in drm_dp_start_crc()
1752 ret = drm_dp_dpcd_writeb(aux, DP_TEST_SINK, buf | DP_TEST_SINK_START); in drm_dp_start_crc()
1756 aux->crc_count = 0; in drm_dp_start_crc()
1757 aux->crtc = crtc; in drm_dp_start_crc()
1758 schedule_work(&aux->crc_work); in drm_dp_start_crc()
1766 * @aux: DisplayPort AUX channel
1770 int drm_dp_stop_crc(struct drm_dp_aux *aux) in drm_dp_stop_crc() argument
1775 ret = drm_dp_dpcd_readb(aux, DP_TEST_SINK, &buf); in drm_dp_stop_crc()
1779 ret = drm_dp_dpcd_writeb(aux, DP_TEST_SINK, buf & ~DP_TEST_SINK_START); in drm_dp_stop_crc()
1783 flush_work(&aux->crc_work); in drm_dp_stop_crc()
1784 aux->crtc = NULL; in drm_dp_stop_crc()
1878 * Some Dell CML 2020 systems have panels support both AUX and PWM
1879 * backlight control, and some only support AUX backlight control. All
1880 * said panels start up in AUX mode by default, and we don't have any
1940 * @aux: DisplayPort AUX channel
1949 int drm_dp_read_desc(struct drm_dp_aux *aux, struct drm_dp_desc *desc, in drm_dp_read_desc() argument
1956 ret = drm_dp_dpcd_read(aux, offset, ident, sizeof(*ident)); in drm_dp_read_desc()
1965 aux->name, is_branch ? "branch" : "sink", in drm_dp_read_desc()
2115 * @aux: DisplayPort AUX channel
2120 int drm_dp_get_phy_test_pattern(struct drm_dp_aux *aux, in drm_dp_get_phy_test_pattern() argument
2126 err = drm_dp_dpcd_readb(aux, DP_TEST_LINK_RATE, &rate); in drm_dp_get_phy_test_pattern()
2131 err = drm_dp_dpcd_readb(aux, DP_TEST_LANE_COUNT, &lanes); in drm_dp_get_phy_test_pattern()
2139 err = drm_dp_dpcd_readb(aux, DP_PHY_TEST_PATTERN, &data->phy_pattern); in drm_dp_get_phy_test_pattern()
2145 err = drm_dp_dpcd_read(aux, DP_TEST_80BIT_CUSTOM_PATTERN_7_0, in drm_dp_get_phy_test_pattern()
2152 err = drm_dp_dpcd_read(aux, DP_TEST_HBR2_SCRAMBLER_RESET, in drm_dp_get_phy_test_pattern()
2165 * @aux: DisplayPort AUX channel
2171 int drm_dp_set_phy_test_pattern(struct drm_dp_aux *aux, in drm_dp_set_phy_test_pattern() argument
2181 err = drm_dp_dpcd_writeb(aux, DP_TRAINING_PATTERN_SET, in drm_dp_set_phy_test_pattern()
2187 err = drm_dp_dpcd_writeb(aux, in drm_dp_set_phy_test_pattern()