Lines Matching refs:aux

59 	struct drm_dp_aux *aux;  member
227 static int __8b10b_clock_recovery_delay_us(const struct drm_dp_aux *aux, u8 rd_interval) in __8b10b_clock_recovery_delay_us() argument
230 drm_dbg_kms(aux->drm_dev, "%s: invalid AUX interval 0x%02x (max 4)\n", in __8b10b_clock_recovery_delay_us()
231 aux->name, rd_interval); in __8b10b_clock_recovery_delay_us()
239 static int __8b10b_channel_eq_delay_us(const struct drm_dp_aux *aux, u8 rd_interval) in __8b10b_channel_eq_delay_us() argument
242 drm_dbg_kms(aux->drm_dev, "%s: invalid AUX interval 0x%02x (max 4)\n", in __8b10b_channel_eq_delay_us()
243 aux->name, rd_interval); in __8b10b_channel_eq_delay_us()
251 static int __128b132b_channel_eq_delay_us(const struct drm_dp_aux *aux, u8 rd_interval) in __128b132b_channel_eq_delay_us() argument
255 drm_dbg_kms(aux->drm_dev, "%s: invalid AUX interval 0x%02x\n", in __128b132b_channel_eq_delay_us()
256 aux->name, rd_interval); in __128b132b_channel_eq_delay_us()
285 static int __read_delay(struct drm_dp_aux *aux, const u8 dpcd[DP_RECEIVER_CAP_SIZE], in __read_delay() argument
288 int (*parse)(const struct drm_dp_aux *aux, u8 rd_interval); in __read_delay()
329 if (drm_dp_dpcd_readb(aux, offset, &rd_interval) != 1) { in __read_delay()
330 drm_dbg_kms(aux->drm_dev, "%s: failed rd interval read\n", in __read_delay()
331 aux->name); in __read_delay()
337 return parse(aux, rd_interval & mask); in __read_delay()
340 int drm_dp_read_clock_recovery_delay(struct drm_dp_aux *aux, const u8 dpcd[DP_RECEIVER_CAP_SIZE], in drm_dp_read_clock_recovery_delay() argument
343 return __read_delay(aux, dpcd, dp_phy, uhbr, true); in drm_dp_read_clock_recovery_delay()
347 int drm_dp_read_channel_eq_delay(struct drm_dp_aux *aux, const u8 dpcd[DP_RECEIVER_CAP_SIZE], in drm_dp_read_channel_eq_delay() argument
350 return __read_delay(aux, dpcd, dp_phy, uhbr, false); in drm_dp_read_channel_eq_delay()
355 int drm_dp_128b132b_read_aux_rd_interval(struct drm_dp_aux *aux) in drm_dp_128b132b_read_aux_rd_interval() argument
360 if (drm_dp_dpcd_readb(aux, DP_128B132B_TRAINING_AUX_RD_INTERVAL, &val) != 1) { in drm_dp_128b132b_read_aux_rd_interval()
361 drm_err(aux->drm_dev, "%s: failed rd interval read\n", in drm_dp_128b132b_read_aux_rd_interval()
362 aux->name); in drm_dp_128b132b_read_aux_rd_interval()
374 void drm_dp_link_train_clock_recovery_delay(const struct drm_dp_aux *aux, in drm_dp_link_train_clock_recovery_delay() argument
384 delay_us = __8b10b_clock_recovery_delay_us(aux, rd_interval); in drm_dp_link_train_clock_recovery_delay()
390 static void __drm_dp_link_train_channel_eq_delay(const struct drm_dp_aux *aux, in __drm_dp_link_train_channel_eq_delay() argument
393 int delay_us = __8b10b_channel_eq_delay_us(aux, rd_interval); in __drm_dp_link_train_channel_eq_delay()
398 void drm_dp_link_train_channel_eq_delay(const struct drm_dp_aux *aux, in drm_dp_link_train_channel_eq_delay() argument
401 __drm_dp_link_train_channel_eq_delay(aux, in drm_dp_link_train_channel_eq_delay()
450 void drm_dp_lttpr_link_train_channel_eq_delay(const struct drm_dp_aux *aux, in drm_dp_lttpr_link_train_channel_eq_delay() argument
457 __drm_dp_link_train_channel_eq_delay(aux, interval); in drm_dp_lttpr_link_train_channel_eq_delay()
496 drm_dp_dump_access(const struct drm_dp_aux *aux, in drm_dp_dump_access() argument
502 drm_dbg_dp(aux->drm_dev, "%s: 0x%05x AUX %s (ret=%3d) %*ph\n", in drm_dp_dump_access()
503 aux->name, offset, arrow, ret, min(ret, 20), buffer); in drm_dp_dump_access()
505 drm_dbg_dp(aux->drm_dev, "%s: 0x%05x AUX %s (ret=%3d)\n", in drm_dp_dump_access()
506 aux->name, offset, arrow, ret); in drm_dp_dump_access()
521 static int drm_dp_dpcd_access(struct drm_dp_aux *aux, u8 request, in drm_dp_dpcd_access() argument
534 mutex_lock(&aux->hw_mutex); in drm_dp_dpcd_access()
540 if (aux->powered_down) { in drm_dp_dpcd_access()
557 ret = aux->transfer(aux, &msg); in drm_dp_dpcd_access()
578 drm_dbg_kms(aux->drm_dev, "%s: Too many retries, giving up. First error: %d\n", in drm_dp_dpcd_access()
579 aux->name, err); in drm_dp_dpcd_access()
583 mutex_unlock(&aux->hw_mutex); in drm_dp_dpcd_access()
598 int drm_dp_dpcd_probe(struct drm_dp_aux *aux, unsigned int offset) in drm_dp_dpcd_probe() argument
603 ret = drm_dp_dpcd_access(aux, DP_AUX_NATIVE_READ, offset, &buffer, 1); in drm_dp_dpcd_probe()
606 drm_dp_dump_access(aux, DP_AUX_NATIVE_READ, offset, &buffer, ret); in drm_dp_dpcd_probe()
624 void drm_dp_dpcd_set_powered(struct drm_dp_aux *aux, bool powered) in drm_dp_dpcd_set_powered() argument
626 if (!aux) in drm_dp_dpcd_set_powered()
629 mutex_lock(&aux->hw_mutex); in drm_dp_dpcd_set_powered()
630 aux->powered_down = !powered; in drm_dp_dpcd_set_powered()
631 mutex_unlock(&aux->hw_mutex); in drm_dp_dpcd_set_powered()
649 ssize_t drm_dp_dpcd_read(struct drm_dp_aux *aux, unsigned int offset, in drm_dp_dpcd_read() argument
666 if (!aux->is_remote) { in drm_dp_dpcd_read()
667 ret = drm_dp_dpcd_probe(aux, DP_DPCD_REV); in drm_dp_dpcd_read()
672 if (aux->is_remote) in drm_dp_dpcd_read()
673 ret = drm_dp_mst_dpcd_read(aux, offset, buffer, size); in drm_dp_dpcd_read()
675 ret = drm_dp_dpcd_access(aux, DP_AUX_NATIVE_READ, offset, in drm_dp_dpcd_read()
678 drm_dp_dump_access(aux, DP_AUX_NATIVE_READ, offset, buffer, ret); in drm_dp_dpcd_read()
697 ssize_t drm_dp_dpcd_write(struct drm_dp_aux *aux, unsigned int offset, in drm_dp_dpcd_write() argument
702 if (aux->is_remote) in drm_dp_dpcd_write()
703 ret = drm_dp_mst_dpcd_write(aux, offset, buffer, size); in drm_dp_dpcd_write()
705 ret = drm_dp_dpcd_access(aux, DP_AUX_NATIVE_WRITE, offset, in drm_dp_dpcd_write()
708 drm_dp_dump_access(aux, DP_AUX_NATIVE_WRITE, offset, buffer, ret); in drm_dp_dpcd_write()
721 int drm_dp_dpcd_read_link_status(struct drm_dp_aux *aux, in drm_dp_dpcd_read_link_status() argument
724 return drm_dp_dpcd_read(aux, DP_LANE0_1_STATUS, status, in drm_dp_dpcd_read_link_status()
742 int drm_dp_dpcd_read_phy_link_status(struct drm_dp_aux *aux, in drm_dp_dpcd_read_phy_link_status() argument
749 ret = drm_dp_dpcd_read(aux, in drm_dp_dpcd_read_phy_link_status()
762 ret = drm_dp_dpcd_read(aux, in drm_dp_dpcd_read_phy_link_status()
857 bool drm_dp_send_real_edid_checksum(struct drm_dp_aux *aux, in drm_dp_send_real_edid_checksum() argument
862 if (drm_dp_dpcd_read(aux, DP_DEVICE_SERVICE_IRQ_VECTOR, in drm_dp_send_real_edid_checksum()
864 drm_err(aux->drm_dev, "%s: DPCD failed read at register 0x%x\n", in drm_dp_send_real_edid_checksum()
865 aux->name, DP_DEVICE_SERVICE_IRQ_VECTOR); in drm_dp_send_real_edid_checksum()
870 if (drm_dp_dpcd_read(aux, DP_TEST_REQUEST, &link_edid_read, 1) < 1) { in drm_dp_send_real_edid_checksum()
871 drm_err(aux->drm_dev, "%s: DPCD failed read at register 0x%x\n", in drm_dp_send_real_edid_checksum()
872 aux->name, DP_TEST_REQUEST); in drm_dp_send_real_edid_checksum()
878 drm_dbg_kms(aux->drm_dev, "%s: Source DUT does not support TEST_EDID_READ\n", in drm_dp_send_real_edid_checksum()
879 aux->name); in drm_dp_send_real_edid_checksum()
883 if (drm_dp_dpcd_write(aux, DP_DEVICE_SERVICE_IRQ_VECTOR, in drm_dp_send_real_edid_checksum()
885 drm_err(aux->drm_dev, "%s: DPCD failed write at register 0x%x\n", in drm_dp_send_real_edid_checksum()
886 aux->name, DP_DEVICE_SERVICE_IRQ_VECTOR); in drm_dp_send_real_edid_checksum()
891 if (drm_dp_dpcd_write(aux, DP_TEST_EDID_CHECKSUM, in drm_dp_send_real_edid_checksum()
893 drm_err(aux->drm_dev, "%s: DPCD failed write at register 0x%x\n", in drm_dp_send_real_edid_checksum()
894 aux->name, DP_TEST_EDID_CHECKSUM); in drm_dp_send_real_edid_checksum()
899 if (drm_dp_dpcd_write(aux, DP_TEST_RESPONSE, &test_resp, 1) < 1) { in drm_dp_send_real_edid_checksum()
900 drm_err(aux->drm_dev, "%s: DPCD failed write at register 0x%x\n", in drm_dp_send_real_edid_checksum()
901 aux->name, DP_TEST_RESPONSE); in drm_dp_send_real_edid_checksum()
919 static int drm_dp_read_extended_dpcd_caps(struct drm_dp_aux *aux, in drm_dp_read_extended_dpcd_caps() argument
936 ret = drm_dp_dpcd_read(aux, DP_DP13_DPCD_REV, &dpcd_ext, in drm_dp_read_extended_dpcd_caps()
944 drm_dbg_kms(aux->drm_dev, in drm_dp_read_extended_dpcd_caps()
946 aux->name, dpcd[DP_DPCD_REV], dpcd_ext[DP_DPCD_REV]); in drm_dp_read_extended_dpcd_caps()
953 drm_dbg_kms(aux->drm_dev, "%s: Base DPCD: %*ph\n", aux->name, DP_RECEIVER_CAP_SIZE, dpcd); in drm_dp_read_extended_dpcd_caps()
973 int drm_dp_read_dpcd_caps(struct drm_dp_aux *aux, in drm_dp_read_dpcd_caps() argument
978 ret = drm_dp_dpcd_read(aux, DP_DPCD_REV, dpcd, DP_RECEIVER_CAP_SIZE); in drm_dp_read_dpcd_caps()
984 ret = drm_dp_read_extended_dpcd_caps(aux, dpcd); in drm_dp_read_dpcd_caps()
988 drm_dbg_kms(aux->drm_dev, "%s: DPCD: %*ph\n", aux->name, DP_RECEIVER_CAP_SIZE, dpcd); in drm_dp_read_dpcd_caps()
1007 int drm_dp_read_downstream_info(struct drm_dp_aux *aux, in drm_dp_read_downstream_info() argument
1031 ret = drm_dp_dpcd_read(aux, DP_DOWNSTREAM_PORT_0, downstream_ports, len); in drm_dp_read_downstream_info()
1037 drm_dbg_kms(aux->drm_dev, "%s: DPCD DFP: %*ph\n", aux->name, len, downstream_ports); in drm_dp_read_downstream_info()
1390 int drm_dp_downstream_id(struct drm_dp_aux *aux, char id[6]) in drm_dp_downstream_id() argument
1392 return drm_dp_dpcd_read(aux, DP_BRANCH_ID, id, 6); in drm_dp_downstream_id()
1409 struct drm_dp_aux *aux) in drm_dp_downstream_debug() argument
1454 drm_dp_downstream_id(aux, id); in drm_dp_downstream_debug()
1457 len = drm_dp_dpcd_read(aux, DP_BRANCH_HW_REV, &rev[0], 1); in drm_dp_downstream_debug()
1462 len = drm_dp_dpcd_read(aux, DP_BRANCH_SW_REV, rev, 2); in drm_dp_downstream_debug()
1596 int drm_dp_read_sink_count(struct drm_dp_aux *aux) in drm_dp_read_sink_count() argument
1601 ret = drm_dp_dpcd_readb(aux, DP_SINK_COUNT, &count); in drm_dp_read_sink_count()
1728 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
1742 ret = aux->transfer(aux, msg); in drm_dp_i2c_do_msg()
1754 drm_dbg_kms_ratelimited(aux->drm_dev, "%s: transaction timed out\n", in drm_dp_i2c_do_msg()
1755 aux->name); in drm_dp_i2c_do_msg()
1757 drm_dbg_kms(aux->drm_dev, "%s: transaction failed: %d\n", in drm_dp_i2c_do_msg()
1758 aux->name, ret); in drm_dp_i2c_do_msg()
1772 drm_dbg_kms(aux->drm_dev, "%s: native nack (result=%d, size=%zu)\n", in drm_dp_i2c_do_msg()
1773 aux->name, ret, msg->size); in drm_dp_i2c_do_msg()
1777 drm_dbg_kms(aux->drm_dev, "%s: native defer\n", aux->name); in drm_dp_i2c_do_msg()
1791 drm_err(aux->drm_dev, "%s: invalid native reply %#04x\n", in drm_dp_i2c_do_msg()
1792 aux->name, msg->reply); in drm_dp_i2c_do_msg()
1807 drm_dbg_kms(aux->drm_dev, "%s: I2C nack (result=%d, size=%zu)\n", in drm_dp_i2c_do_msg()
1808 aux->name, ret, msg->size); in drm_dp_i2c_do_msg()
1809 aux->i2c_nack_count++; in drm_dp_i2c_do_msg()
1813 drm_dbg_kms(aux->drm_dev, "%s: I2C defer\n", aux->name); in drm_dp_i2c_do_msg()
1818 aux->i2c_defer_count++; in drm_dp_i2c_do_msg()
1827 drm_err(aux->drm_dev, "%s: invalid I2C reply %#04x\n", in drm_dp_i2c_do_msg()
1828 aux->name, msg->reply); in drm_dp_i2c_do_msg()
1833 drm_dbg_kms(aux->drm_dev, "%s: Too many retries, giving up\n", aux->name); in drm_dp_i2c_do_msg()
1851 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
1857 err = drm_dp_i2c_do_msg(aux, &msg); in drm_dp_i2c_drain_msg()
1862 drm_dbg_kms(aux->drm_dev, in drm_dp_i2c_drain_msg()
1864 aux->name, msg.size, err); in drm_dp_i2c_drain_msg()
1888 struct drm_dp_aux *aux = adapter->algo_data; in drm_dp_i2c_xfer() local
1894 if (aux->powered_down) in drm_dp_i2c_xfer()
1910 err = drm_dp_i2c_do_msg(aux, &msg); in drm_dp_i2c_xfer()
1929 err = drm_dp_i2c_drain_msg(aux, &msg); in drm_dp_i2c_xfer()
1953 (void)drm_dp_i2c_do_msg(aux, &msg); in drm_dp_i2c_xfer()
1989 static int drm_dp_aux_get_crc(struct drm_dp_aux *aux, u8 *crc) in drm_dp_aux_get_crc() argument
1994 ret = drm_dp_dpcd_readb(aux, DP_TEST_SINK, &buf); in drm_dp_aux_get_crc()
2000 ret = drm_dp_dpcd_readb(aux, DP_TEST_SINK_MISC, &buf); in drm_dp_aux_get_crc()
2005 if (count == aux->crc_count) in drm_dp_aux_get_crc()
2008 aux->crc_count = count; in drm_dp_aux_get_crc()
2014 ret = drm_dp_dpcd_read(aux, DP_TEST_CRC_R_CR, crc, 6); in drm_dp_aux_get_crc()
2023 struct drm_dp_aux *aux = container_of(work, struct drm_dp_aux, in drm_dp_aux_crc_work() local
2030 if (WARN_ON(!aux->crtc)) in drm_dp_aux_crc_work()
2033 crtc = aux->crtc; in drm_dp_aux_crc_work()
2039 ret = drm_dp_aux_get_crc(aux, crc_bytes); in drm_dp_aux_crc_work()
2042 ret = drm_dp_aux_get_crc(aux, crc_bytes); in drm_dp_aux_crc_work()
2046 drm_dbg_kms(aux->drm_dev, "%s: Get CRC failed after retrying: %d\n", in drm_dp_aux_crc_work()
2047 aux->name, ret); in drm_dp_aux_crc_work()
2050 drm_dbg_kms(aux->drm_dev, "%s: Failed to get a CRC: %d\n", aux->name, ret); in drm_dp_aux_crc_work()
2068 void drm_dp_remote_aux_init(struct drm_dp_aux *aux) in drm_dp_remote_aux_init() argument
2070 INIT_WORK(&aux->crc_work, drm_dp_aux_crc_work); in drm_dp_remote_aux_init()
2091 void drm_dp_aux_init(struct drm_dp_aux *aux) in drm_dp_aux_init() argument
2093 mutex_init(&aux->hw_mutex); in drm_dp_aux_init()
2094 mutex_init(&aux->cec.lock); in drm_dp_aux_init()
2095 INIT_WORK(&aux->crc_work, drm_dp_aux_crc_work); in drm_dp_aux_init()
2097 aux->ddc.algo = &drm_dp_i2c_algo; in drm_dp_aux_init()
2098 aux->ddc.algo_data = aux; in drm_dp_aux_init()
2099 aux->ddc.retries = 3; in drm_dp_aux_init()
2101 aux->ddc.lock_ops = &drm_dp_i2c_lock_ops; in drm_dp_aux_init()
2132 int drm_dp_aux_register(struct drm_dp_aux *aux) in drm_dp_aux_register() argument
2136 WARN_ON_ONCE(!aux->drm_dev); in drm_dp_aux_register()
2138 if (!aux->ddc.algo) in drm_dp_aux_register()
2139 drm_dp_aux_init(aux); in drm_dp_aux_register()
2141 aux->ddc.owner = THIS_MODULE; in drm_dp_aux_register()
2142 aux->ddc.dev.parent = aux->dev; in drm_dp_aux_register()
2144 strscpy(aux->ddc.name, aux->name ? aux->name : dev_name(aux->dev), in drm_dp_aux_register()
2145 sizeof(aux->ddc.name)); in drm_dp_aux_register()
2147 ret = drm_dp_aux_register_devnode(aux); in drm_dp_aux_register()
2151 ret = i2c_add_adapter(&aux->ddc); in drm_dp_aux_register()
2153 drm_dp_aux_unregister_devnode(aux); in drm_dp_aux_register()
2165 void drm_dp_aux_unregister(struct drm_dp_aux *aux) in drm_dp_aux_unregister() argument
2167 drm_dp_aux_unregister_devnode(aux); in drm_dp_aux_unregister()
2168 i2c_del_adapter(&aux->ddc); in drm_dp_aux_unregister()
2212 int drm_dp_start_crc(struct drm_dp_aux *aux, struct drm_crtc *crtc) in drm_dp_start_crc() argument
2217 ret = drm_dp_dpcd_readb(aux, DP_TEST_SINK, &buf); in drm_dp_start_crc()
2221 ret = drm_dp_dpcd_writeb(aux, DP_TEST_SINK, buf | DP_TEST_SINK_START); in drm_dp_start_crc()
2225 aux->crc_count = 0; in drm_dp_start_crc()
2226 aux->crtc = crtc; in drm_dp_start_crc()
2227 schedule_work(&aux->crc_work); in drm_dp_start_crc()
2239 int drm_dp_stop_crc(struct drm_dp_aux *aux) in drm_dp_stop_crc() argument
2244 ret = drm_dp_dpcd_readb(aux, DP_TEST_SINK, &buf); in drm_dp_stop_crc()
2248 ret = drm_dp_dpcd_writeb(aux, DP_TEST_SINK, buf & ~DP_TEST_SINK_START); in drm_dp_stop_crc()
2252 flush_work(&aux->crc_work); in drm_dp_stop_crc()
2253 aux->crtc = NULL; in drm_dp_stop_crc()
2331 static int drm_dp_read_ident(struct drm_dp_aux *aux, unsigned int offset, in drm_dp_read_ident() argument
2336 ret = drm_dp_dpcd_read(aux, offset, ident, sizeof(*ident)); in drm_dp_read_ident()
2341 static void drm_dp_dump_desc(struct drm_dp_aux *aux, in drm_dp_dump_desc() argument
2346 drm_dbg_kms(aux->drm_dev, in drm_dp_dump_desc()
2348 aux->name, device_name, in drm_dp_dump_desc()
2367 int drm_dp_read_desc(struct drm_dp_aux *aux, struct drm_dp_desc *desc, in drm_dp_read_desc() argument
2374 ret = drm_dp_read_ident(aux, offset, ident); in drm_dp_read_desc()
2380 drm_dp_dump_desc(aux, is_branch ? "DP branch" : "DP sink", desc); in drm_dp_read_desc()
2396 int drm_dp_dump_lttpr_desc(struct drm_dp_aux *aux, enum drm_dp_phy dp_phy) in drm_dp_dump_lttpr_desc() argument
2401 if (drm_WARN_ON(aux->drm_dev, dp_phy < DP_PHY_LTTPR1 || dp_phy > DP_MAX_LTTPR_COUNT)) in drm_dp_dump_lttpr_desc()
2404 ret = drm_dp_read_ident(aux, DP_OUI_PHY_REPEATER(dp_phy), &desc.ident); in drm_dp_dump_lttpr_desc()
2408 drm_dp_dump_desc(aux, drm_dp_phy_name(dp_phy), &desc); in drm_dp_dump_lttpr_desc()
2582 static int drm_dp_read_lttpr_regs(struct drm_dp_aux *aux, in drm_dp_read_lttpr_regs() argument
2596 ret = drm_dp_dpcd_read(aux, in drm_dp_read_lttpr_regs()
2618 int drm_dp_read_lttpr_common_caps(struct drm_dp_aux *aux, in drm_dp_read_lttpr_common_caps() argument
2622 return drm_dp_read_lttpr_regs(aux, dpcd, in drm_dp_read_lttpr_common_caps()
2639 int drm_dp_read_lttpr_phy_caps(struct drm_dp_aux *aux, in drm_dp_read_lttpr_phy_caps() argument
2644 return drm_dp_read_lttpr_regs(aux, dpcd, in drm_dp_read_lttpr_phy_caps()
2750 int drm_dp_get_phy_test_pattern(struct drm_dp_aux *aux, in drm_dp_get_phy_test_pattern() argument
2756 err = drm_dp_dpcd_readb(aux, DP_TEST_LINK_RATE, &rate); in drm_dp_get_phy_test_pattern()
2761 err = drm_dp_dpcd_readb(aux, DP_TEST_LANE_COUNT, &lanes); in drm_dp_get_phy_test_pattern()
2769 err = drm_dp_dpcd_readb(aux, DP_PHY_TEST_PATTERN, &data->phy_pattern); in drm_dp_get_phy_test_pattern()
2775 err = drm_dp_dpcd_read(aux, DP_TEST_80BIT_CUSTOM_PATTERN_7_0, in drm_dp_get_phy_test_pattern()
2782 err = drm_dp_dpcd_read(aux, DP_TEST_HBR2_SCRAMBLER_RESET, in drm_dp_get_phy_test_pattern()
2801 int drm_dp_set_phy_test_pattern(struct drm_dp_aux *aux, in drm_dp_set_phy_test_pattern() argument
2811 err = drm_dp_dpcd_writeb(aux, DP_TRAINING_PATTERN_SET, in drm_dp_set_phy_test_pattern()
2817 err = drm_dp_dpcd_writeb(aux, in drm_dp_set_phy_test_pattern()
3019 bool drm_dp_as_sdp_supported(struct drm_dp_aux *aux, const u8 dpcd[DP_RECEIVER_CAP_SIZE]) in drm_dp_as_sdp_supported() argument
3026 if (drm_dp_dpcd_readb(aux, DP_DPRX_FEATURE_ENUMERATION_LIST_CONT_1, in drm_dp_as_sdp_supported()
3028 drm_dbg_dp(aux->drm_dev, in drm_dp_as_sdp_supported()
3044 bool drm_dp_vsc_sdp_supported(struct drm_dp_aux *aux, const u8 dpcd[DP_RECEIVER_CAP_SIZE]) in drm_dp_vsc_sdp_supported() argument
3051 if (drm_dp_dpcd_readb(aux, DP_DPRX_FEATURE_ENUMERATION_LIST, &rx_feature) != 1) { in drm_dp_vsc_sdp_supported()
3052 drm_dbg_dp(aux->drm_dev, "failed to read DP_DPRX_FEATURE_ENUMERATION_LIST\n"); in drm_dp_vsc_sdp_supported()
3180 int drm_dp_pcon_frl_prepare(struct drm_dp_aux *aux, bool enable_frl_ready_hpd) in drm_dp_pcon_frl_prepare() argument
3189 ret = drm_dp_dpcd_writeb(aux, DP_PCON_HDMI_LINK_CONFIG_1, buf); in drm_dp_pcon_frl_prepare()
3201 bool drm_dp_pcon_is_frl_ready(struct drm_dp_aux *aux) in drm_dp_pcon_is_frl_ready() argument
3206 ret = drm_dp_dpcd_readb(aux, DP_PCON_HDMI_TX_LINK_STATUS, &buf); in drm_dp_pcon_is_frl_ready()
3229 int drm_dp_pcon_frl_configure_1(struct drm_dp_aux *aux, int max_frl_gbps, in drm_dp_pcon_frl_configure_1() argument
3235 ret = drm_dp_dpcd_readb(aux, DP_PCON_HDMI_LINK_CONFIG_1, &buf); in drm_dp_pcon_frl_configure_1()
3270 ret = drm_dp_dpcd_writeb(aux, DP_PCON_HDMI_LINK_CONFIG_1, buf); in drm_dp_pcon_frl_configure_1()
3289 int drm_dp_pcon_frl_configure_2(struct drm_dp_aux *aux, int max_frl_mask, in drm_dp_pcon_frl_configure_2() argument
3300 ret = drm_dp_dpcd_writeb(aux, DP_PCON_HDMI_LINK_CONFIG_2, buf); in drm_dp_pcon_frl_configure_2()
3314 int drm_dp_pcon_reset_frl_config(struct drm_dp_aux *aux) in drm_dp_pcon_reset_frl_config() argument
3318 ret = drm_dp_dpcd_writeb(aux, DP_PCON_HDMI_LINK_CONFIG_1, 0x0); in drm_dp_pcon_reset_frl_config()
3332 int drm_dp_pcon_frl_enable(struct drm_dp_aux *aux) in drm_dp_pcon_frl_enable() argument
3337 ret = drm_dp_dpcd_readb(aux, DP_PCON_HDMI_LINK_CONFIG_1, &buf); in drm_dp_pcon_frl_enable()
3341 drm_dbg_kms(aux->drm_dev, "%s: PCON in Autonomous mode, can't enable FRL\n", in drm_dp_pcon_frl_enable()
3342 aux->name); in drm_dp_pcon_frl_enable()
3346 ret = drm_dp_dpcd_writeb(aux, DP_PCON_HDMI_LINK_CONFIG_1, buf); in drm_dp_pcon_frl_enable()
3360 bool drm_dp_pcon_hdmi_link_active(struct drm_dp_aux *aux) in drm_dp_pcon_hdmi_link_active() argument
3365 ret = drm_dp_dpcd_readb(aux, DP_PCON_HDMI_TX_LINK_STATUS, &buf); in drm_dp_pcon_hdmi_link_active()
3384 int drm_dp_pcon_hdmi_link_mode(struct drm_dp_aux *aux, u8 *frl_trained_mask) in drm_dp_pcon_hdmi_link_mode() argument
3390 ret = drm_dp_dpcd_readb(aux, DP_PCON_HDMI_POST_FRL_STATUS, &buf); in drm_dp_pcon_hdmi_link_mode()
3411 void drm_dp_pcon_hdmi_frl_link_error_count(struct drm_dp_aux *aux, in drm_dp_pcon_hdmi_frl_link_error_count() argument
3419 if (drm_dp_dpcd_readb(aux, DP_PCON_HDMI_ERROR_STATUS_LN0 + i, &buf) < 0) in drm_dp_pcon_hdmi_frl_link_error_count()
3437 drm_err(aux->drm_dev, "%s: More than %d errors since the last read for lane %d", in drm_dp_pcon_hdmi_frl_link_error_count()
3438 aux->name, num_error, i); in drm_dp_pcon_hdmi_frl_link_error_count()
3549 int drm_dp_pcon_configure_dsc_enc(struct drm_dp_aux *aux, u8 pps_buf_config) in drm_dp_pcon_configure_dsc_enc() argument
3554 ret = drm_dp_dpcd_readb(aux, DP_PROTOCOL_CONVERTER_CONTROL_2, &buf); in drm_dp_pcon_configure_dsc_enc()
3565 ret = drm_dp_dpcd_writeb(aux, DP_PROTOCOL_CONVERTER_CONTROL_2, buf); in drm_dp_pcon_configure_dsc_enc()
3579 int drm_dp_pcon_pps_default(struct drm_dp_aux *aux) in drm_dp_pcon_pps_default() argument
3583 ret = drm_dp_pcon_configure_dsc_enc(aux, DP_PCON_ENC_PPS_OVERRIDE_DISABLED); in drm_dp_pcon_pps_default()
3599 int drm_dp_pcon_pps_override_buf(struct drm_dp_aux *aux, u8 pps_buf[128]) in drm_dp_pcon_pps_override_buf() argument
3603 ret = drm_dp_dpcd_write(aux, DP_PCON_HDMI_PPS_OVERRIDE_BASE, &pps_buf, 128); in drm_dp_pcon_pps_override_buf()
3607 ret = drm_dp_pcon_configure_dsc_enc(aux, DP_PCON_ENC_PPS_OVERRIDE_EN_BUFFER); in drm_dp_pcon_pps_override_buf()
3624 int drm_dp_pcon_pps_override_param(struct drm_dp_aux *aux, u8 pps_param[6]) in drm_dp_pcon_pps_override_param() argument
3628 ret = drm_dp_dpcd_write(aux, DP_PCON_HDMI_PPS_OVRD_SLICE_HEIGHT, &pps_param[0], 2); in drm_dp_pcon_pps_override_param()
3631 ret = drm_dp_dpcd_write(aux, DP_PCON_HDMI_PPS_OVRD_SLICE_WIDTH, &pps_param[2], 2); in drm_dp_pcon_pps_override_param()
3634 ret = drm_dp_dpcd_write(aux, DP_PCON_HDMI_PPS_OVRD_BPP, &pps_param[4], 2); in drm_dp_pcon_pps_override_param()
3638 ret = drm_dp_pcon_configure_dsc_enc(aux, DP_PCON_ENC_PPS_OVERRIDE_EN_BUFFER); in drm_dp_pcon_pps_override_param()
3653 int drm_dp_pcon_convert_rgb_to_ycbcr(struct drm_dp_aux *aux, u8 color_spc) in drm_dp_pcon_convert_rgb_to_ycbcr() argument
3658 ret = drm_dp_dpcd_readb(aux, DP_PROTOCOL_CONVERTER_CONTROL_2, &buf); in drm_dp_pcon_convert_rgb_to_ycbcr()
3667 ret = drm_dp_dpcd_writeb(aux, DP_PROTOCOL_CONVERTER_CONTROL_2, buf); in drm_dp_pcon_convert_rgb_to_ycbcr()
3686 int drm_edp_backlight_set_level(struct drm_dp_aux *aux, const struct drm_edp_backlight_info *bl, in drm_edp_backlight_set_level() argument
3703 ret = drm_dp_dpcd_write(aux, DP_EDP_BACKLIGHT_BRIGHTNESS_MSB, buf, sizeof(buf)); in drm_edp_backlight_set_level()
3705 drm_err(aux->drm_dev, in drm_edp_backlight_set_level()
3707 aux->name, ret); in drm_edp_backlight_set_level()
3716 drm_edp_backlight_set_enable(struct drm_dp_aux *aux, const struct drm_edp_backlight_info *bl, in drm_edp_backlight_set_enable() argument
3726 ret = drm_dp_dpcd_readb(aux, DP_EDP_DISPLAY_CONTROL_REGISTER, &buf); in drm_edp_backlight_set_enable()
3728 drm_err(aux->drm_dev, "%s: Failed to read eDP display control register: %d\n", in drm_edp_backlight_set_enable()
3729 aux->name, ret); in drm_edp_backlight_set_enable()
3737 ret = drm_dp_dpcd_writeb(aux, DP_EDP_DISPLAY_CONTROL_REGISTER, buf); in drm_edp_backlight_set_enable()
3739 drm_err(aux->drm_dev, "%s: Failed to write eDP display control register: %d\n", in drm_edp_backlight_set_enable()
3740 aux->name, ret); in drm_edp_backlight_set_enable()
3765 int drm_edp_backlight_enable(struct drm_dp_aux *aux, const struct drm_edp_backlight_info *bl, in drm_edp_backlight_enable() argument
3777 ret = drm_dp_dpcd_writeb(aux, DP_EDP_PWMGEN_BIT_COUNT, bl->pwmgen_bit_count); in drm_edp_backlight_enable()
3779 drm_dbg_kms(aux->drm_dev, "%s: Failed to write aux pwmgen bit count: %d\n", in drm_edp_backlight_enable()
3780 aux->name, ret); in drm_edp_backlight_enable()
3784 ret = drm_dp_dpcd_writeb(aux, DP_EDP_BACKLIGHT_FREQ_SET, bl->pwm_freq_pre_divider); in drm_edp_backlight_enable()
3786 drm_dbg_kms(aux->drm_dev, in drm_edp_backlight_enable()
3788 aux->name, ret); in drm_edp_backlight_enable()
3793 ret = drm_dp_dpcd_writeb(aux, DP_EDP_BACKLIGHT_MODE_SET_REGISTER, dpcd_buf); in drm_edp_backlight_enable()
3795 drm_dbg_kms(aux->drm_dev, "%s: Failed to write aux backlight mode: %d\n", in drm_edp_backlight_enable()
3796 aux->name, ret); in drm_edp_backlight_enable()
3800 ret = drm_edp_backlight_set_level(aux, bl, level); in drm_edp_backlight_enable()
3803 ret = drm_edp_backlight_set_enable(aux, bl, true); in drm_edp_backlight_enable()
3826 int drm_edp_backlight_disable(struct drm_dp_aux *aux, const struct drm_edp_backlight_info *bl) in drm_edp_backlight_disable() argument
3830 ret = drm_edp_backlight_set_enable(aux, bl, false); in drm_edp_backlight_disable()
3839 drm_edp_backlight_probe_max(struct drm_dp_aux *aux, struct drm_edp_backlight_info *bl, in drm_edp_backlight_probe_max() argument
3849 ret = drm_dp_dpcd_readb(aux, DP_EDP_PWMGEN_BIT_COUNT, &pn); in drm_edp_backlight_probe_max()
3851 drm_dbg_kms(aux->drm_dev, "%s: Failed to read pwmgen bit count cap: %d\n", in drm_edp_backlight_probe_max()
3852 aux->name, ret); in drm_edp_backlight_probe_max()
3883 ret = drm_dp_dpcd_readb(aux, DP_EDP_PWMGEN_BIT_COUNT_CAP_MIN, &pn_min); in drm_edp_backlight_probe_max()
3885 drm_dbg_kms(aux->drm_dev, "%s: Failed to read pwmgen bit count cap min: %d\n", in drm_edp_backlight_probe_max()
3886 aux->name, ret); in drm_edp_backlight_probe_max()
3889 ret = drm_dp_dpcd_readb(aux, DP_EDP_PWMGEN_BIT_COUNT_CAP_MAX, &pn_max); in drm_edp_backlight_probe_max()
3891 drm_dbg_kms(aux->drm_dev, "%s: Failed to read pwmgen bit count cap max: %d\n", in drm_edp_backlight_probe_max()
3892 aux->name, ret); in drm_edp_backlight_probe_max()
3902 drm_dbg_kms(aux->drm_dev, in drm_edp_backlight_probe_max()
3904 aux->name, driver_pwm_freq_hz); in drm_edp_backlight_probe_max()
3915 ret = drm_dp_dpcd_writeb(aux, DP_EDP_PWMGEN_BIT_COUNT, pn); in drm_edp_backlight_probe_max()
3917 drm_dbg_kms(aux->drm_dev, "%s: Failed to write aux pwmgen bit count: %d\n", in drm_edp_backlight_probe_max()
3918 aux->name, ret); in drm_edp_backlight_probe_max()
3926 drm_dbg_kms(aux->drm_dev, "%s: Using backlight frequency from driver (%dHz)\n", in drm_edp_backlight_probe_max()
3927 aux->name, driver_pwm_freq_hz); in drm_edp_backlight_probe_max()
3934 drm_edp_backlight_probe_state(struct drm_dp_aux *aux, struct drm_edp_backlight_info *bl, in drm_edp_backlight_probe_state() argument
3941 ret = drm_dp_dpcd_readb(aux, DP_EDP_BACKLIGHT_MODE_SET_REGISTER, &mode_reg); in drm_edp_backlight_probe_state()
3943 drm_dbg_kms(aux->drm_dev, "%s: Failed to read backlight mode: %d\n", in drm_edp_backlight_probe_state()
3944 aux->name, ret); in drm_edp_backlight_probe_state()
3955 ret = drm_dp_dpcd_read(aux, DP_EDP_BACKLIGHT_BRIGHTNESS_MSB, buf, size); in drm_edp_backlight_probe_state()
3957 drm_dbg_kms(aux->drm_dev, "%s: Failed to read backlight level: %d\n", in drm_edp_backlight_probe_state()
3958 aux->name, ret); in drm_edp_backlight_probe_state()
3994 drm_edp_backlight_init(struct drm_dp_aux *aux, struct drm_edp_backlight_info *bl, in drm_edp_backlight_init() argument
4009 drm_dbg_kms(aux->drm_dev, in drm_edp_backlight_init()
4011 aux->name); in drm_edp_backlight_init()
4015 ret = drm_edp_backlight_probe_max(aux, bl, driver_pwm_freq_hz, edp_dpcd); in drm_edp_backlight_init()
4019 ret = drm_edp_backlight_probe_state(aux, bl, current_mode); in drm_edp_backlight_init()
4024 drm_dbg_kms(aux->drm_dev, in drm_edp_backlight_init()
4026 aux->name, bl->aux_set, bl->aux_enable, *current_mode); in drm_edp_backlight_init()
4028 drm_dbg_kms(aux->drm_dev, in drm_edp_backlight_init()
4030 aux->name, *current_level, bl->max, bl->pwm_freq_pre_divider, in drm_edp_backlight_init()
4049 drm_edp_backlight_enable(bl->aux, &bl->info, brightness); in dp_aux_backlight_update_status()
4053 ret = drm_edp_backlight_set_level(bl->aux, &bl->info, brightness); in dp_aux_backlight_update_status()
4056 drm_edp_backlight_disable(bl->aux, &bl->info); in dp_aux_backlight_update_status()
4092 int drm_panel_dp_aux_backlight(struct drm_panel *panel, struct drm_dp_aux *aux) in drm_panel_dp_aux_backlight() argument
4101 if (!panel || !panel->dev || !aux) in drm_panel_dp_aux_backlight()
4104 ret = drm_dp_dpcd_read(aux, DP_EDP_DPCD_REV, edp_dpcd, in drm_panel_dp_aux_backlight()
4118 bl->aux = aux; in drm_panel_dp_aux_backlight()
4120 ret = drm_edp_backlight_init(aux, &bl->info, 0, edp_dpcd, in drm_panel_dp_aux_backlight()