Lines Matching refs:aux
42 struct drm_dp_aux *aux; member
157 void drm_dp_link_train_clock_recovery_delay(const struct drm_dp_aux *aux, in drm_dp_link_train_clock_recovery_delay() argument
164 drm_dbg_kms(aux->drm_dev, "%s: AUX interval %lu, out of range (max 4)\n", in drm_dp_link_train_clock_recovery_delay()
165 aux->name, rd_interval); in drm_dp_link_train_clock_recovery_delay()
176 static void __drm_dp_link_train_channel_eq_delay(const struct drm_dp_aux *aux, in __drm_dp_link_train_channel_eq_delay() argument
180 drm_dbg_kms(aux->drm_dev, "%s: AUX interval %lu, out of range (max 4)\n", in __drm_dp_link_train_channel_eq_delay()
181 aux->name, rd_interval); in __drm_dp_link_train_channel_eq_delay()
191 void drm_dp_link_train_channel_eq_delay(const struct drm_dp_aux *aux, in drm_dp_link_train_channel_eq_delay() argument
194 __drm_dp_link_train_channel_eq_delay(aux, in drm_dp_link_train_channel_eq_delay()
211 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
218 __drm_dp_link_train_channel_eq_delay(aux, interval); in drm_dp_lttpr_link_train_channel_eq_delay()
257 drm_dp_dump_access(const struct drm_dp_aux *aux, in drm_dp_dump_access() argument
263 drm_dbg_dp(aux->drm_dev, "%s: 0x%05x AUX %s (ret=%3d) %*ph\n", in drm_dp_dump_access()
264 aux->name, offset, arrow, ret, min(ret, 20), buffer); in drm_dp_dump_access()
266 drm_dbg_dp(aux->drm_dev, "%s: 0x%05x AUX %s (ret=%3d)\n", in drm_dp_dump_access()
267 aux->name, offset, arrow, ret); in drm_dp_dump_access()
282 static int drm_dp_dpcd_access(struct drm_dp_aux *aux, u8 request, in drm_dp_dpcd_access() argument
295 mutex_lock(&aux->hw_mutex); in drm_dp_dpcd_access()
309 ret = aux->transfer(aux, &msg); in drm_dp_dpcd_access()
330 drm_dbg_kms(aux->drm_dev, "%s: Too many retries, giving up. First error: %d\n", in drm_dp_dpcd_access()
331 aux->name, err); in drm_dp_dpcd_access()
335 mutex_unlock(&aux->hw_mutex); in drm_dp_dpcd_access()
353 ssize_t drm_dp_dpcd_read(struct drm_dp_aux *aux, unsigned int offset, in drm_dp_dpcd_read() argument
370 if (!aux->is_remote) { in drm_dp_dpcd_read()
371 ret = drm_dp_dpcd_access(aux, DP_AUX_NATIVE_READ, DP_DPCD_REV, in drm_dp_dpcd_read()
377 if (aux->is_remote) in drm_dp_dpcd_read()
378 ret = drm_dp_mst_dpcd_read(aux, offset, buffer, size); in drm_dp_dpcd_read()
380 ret = drm_dp_dpcd_access(aux, DP_AUX_NATIVE_READ, offset, in drm_dp_dpcd_read()
384 drm_dp_dump_access(aux, DP_AUX_NATIVE_READ, offset, buffer, ret); in drm_dp_dpcd_read()
403 ssize_t drm_dp_dpcd_write(struct drm_dp_aux *aux, unsigned int offset, in drm_dp_dpcd_write() argument
408 if (aux->is_remote) in drm_dp_dpcd_write()
409 ret = drm_dp_mst_dpcd_write(aux, offset, buffer, size); in drm_dp_dpcd_write()
411 ret = drm_dp_dpcd_access(aux, DP_AUX_NATIVE_WRITE, offset, in drm_dp_dpcd_write()
414 drm_dp_dump_access(aux, DP_AUX_NATIVE_WRITE, offset, buffer, ret); in drm_dp_dpcd_write()
427 int drm_dp_dpcd_read_link_status(struct drm_dp_aux *aux, in drm_dp_dpcd_read_link_status() argument
430 return drm_dp_dpcd_read(aux, DP_LANE0_1_STATUS, status, in drm_dp_dpcd_read_link_status()
448 int drm_dp_dpcd_read_phy_link_status(struct drm_dp_aux *aux, in drm_dp_dpcd_read_phy_link_status() argument
455 ret = drm_dp_dpcd_read(aux, in drm_dp_dpcd_read_phy_link_status()
468 ret = drm_dp_dpcd_read(aux, in drm_dp_dpcd_read_phy_link_status()
560 bool drm_dp_send_real_edid_checksum(struct drm_dp_aux *aux, in drm_dp_send_real_edid_checksum() argument
565 if (drm_dp_dpcd_read(aux, DP_DEVICE_SERVICE_IRQ_VECTOR, in drm_dp_send_real_edid_checksum()
567 drm_err(aux->drm_dev, "%s: DPCD failed read at register 0x%x\n", in drm_dp_send_real_edid_checksum()
568 aux->name, DP_DEVICE_SERVICE_IRQ_VECTOR); in drm_dp_send_real_edid_checksum()
573 if (drm_dp_dpcd_read(aux, DP_TEST_REQUEST, &link_edid_read, 1) < 1) { in drm_dp_send_real_edid_checksum()
574 drm_err(aux->drm_dev, "%s: DPCD failed read at register 0x%x\n", in drm_dp_send_real_edid_checksum()
575 aux->name, DP_TEST_REQUEST); in drm_dp_send_real_edid_checksum()
581 drm_dbg_kms(aux->drm_dev, "%s: Source DUT does not support TEST_EDID_READ\n", in drm_dp_send_real_edid_checksum()
582 aux->name); in drm_dp_send_real_edid_checksum()
586 if (drm_dp_dpcd_write(aux, DP_DEVICE_SERVICE_IRQ_VECTOR, in drm_dp_send_real_edid_checksum()
588 drm_err(aux->drm_dev, "%s: DPCD failed write at register 0x%x\n", in drm_dp_send_real_edid_checksum()
589 aux->name, DP_DEVICE_SERVICE_IRQ_VECTOR); in drm_dp_send_real_edid_checksum()
594 if (drm_dp_dpcd_write(aux, DP_TEST_EDID_CHECKSUM, in drm_dp_send_real_edid_checksum()
596 drm_err(aux->drm_dev, "%s: DPCD failed write at register 0x%x\n", in drm_dp_send_real_edid_checksum()
597 aux->name, DP_TEST_EDID_CHECKSUM); in drm_dp_send_real_edid_checksum()
602 if (drm_dp_dpcd_write(aux, DP_TEST_RESPONSE, &test_resp, 1) < 1) { in drm_dp_send_real_edid_checksum()
603 drm_err(aux->drm_dev, "%s: DPCD failed write at register 0x%x\n", in drm_dp_send_real_edid_checksum()
604 aux->name, DP_TEST_RESPONSE); in drm_dp_send_real_edid_checksum()
622 static int drm_dp_read_extended_dpcd_caps(struct drm_dp_aux *aux, in drm_dp_read_extended_dpcd_caps() argument
639 ret = drm_dp_dpcd_read(aux, DP_DP13_DPCD_REV, &dpcd_ext, in drm_dp_read_extended_dpcd_caps()
647 drm_dbg_kms(aux->drm_dev, in drm_dp_read_extended_dpcd_caps()
649 aux->name, dpcd[DP_DPCD_REV], dpcd_ext[DP_DPCD_REV]); in drm_dp_read_extended_dpcd_caps()
656 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()
676 int drm_dp_read_dpcd_caps(struct drm_dp_aux *aux, in drm_dp_read_dpcd_caps() argument
681 ret = drm_dp_dpcd_read(aux, DP_DPCD_REV, dpcd, DP_RECEIVER_CAP_SIZE); in drm_dp_read_dpcd_caps()
687 ret = drm_dp_read_extended_dpcd_caps(aux, dpcd); in drm_dp_read_dpcd_caps()
691 drm_dbg_kms(aux->drm_dev, "%s: DPCD: %*ph\n", aux->name, DP_RECEIVER_CAP_SIZE, dpcd); in drm_dp_read_dpcd_caps()
710 int drm_dp_read_downstream_info(struct drm_dp_aux *aux, in drm_dp_read_downstream_info() argument
734 ret = drm_dp_dpcd_read(aux, DP_DOWNSTREAM_PORT_0, downstream_ports, len); in drm_dp_read_downstream_info()
740 drm_dbg_kms(aux->drm_dev, "%s: DPCD DFP: %*ph\n", aux->name, len, downstream_ports); in drm_dp_read_downstream_info()
1093 int drm_dp_downstream_id(struct drm_dp_aux *aux, char id[6]) in drm_dp_downstream_id() argument
1095 return drm_dp_dpcd_read(aux, DP_BRANCH_ID, id, 6); in drm_dp_downstream_id()
1112 struct drm_dp_aux *aux) in drm_dp_downstream_debug() argument
1157 drm_dp_downstream_id(aux, id); in drm_dp_downstream_debug()
1160 len = drm_dp_dpcd_read(aux, DP_BRANCH_HW_REV, &rev[0], 1); in drm_dp_downstream_debug()
1165 len = drm_dp_dpcd_read(aux, DP_BRANCH_SW_REV, rev, 2); in drm_dp_downstream_debug()
1299 int drm_dp_read_sink_count(struct drm_dp_aux *aux) in drm_dp_read_sink_count() argument
1304 ret = drm_dp_dpcd_readb(aux, DP_SINK_COUNT, &count); in drm_dp_read_sink_count()
1431 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
1445 ret = aux->transfer(aux, msg); in drm_dp_i2c_do_msg()
1457 drm_dbg_kms_ratelimited(aux->drm_dev, "%s: transaction timed out\n", in drm_dp_i2c_do_msg()
1458 aux->name); in drm_dp_i2c_do_msg()
1460 drm_dbg_kms(aux->drm_dev, "%s: transaction failed: %d\n", in drm_dp_i2c_do_msg()
1461 aux->name, ret); in drm_dp_i2c_do_msg()
1475 drm_dbg_kms(aux->drm_dev, "%s: native nack (result=%d, size=%zu)\n", in drm_dp_i2c_do_msg()
1476 aux->name, ret, msg->size); in drm_dp_i2c_do_msg()
1480 drm_dbg_kms(aux->drm_dev, "%s: native defer\n", aux->name); in drm_dp_i2c_do_msg()
1494 drm_err(aux->drm_dev, "%s: invalid native reply %#04x\n", in drm_dp_i2c_do_msg()
1495 aux->name, msg->reply); in drm_dp_i2c_do_msg()
1510 drm_dbg_kms(aux->drm_dev, "%s: I2C nack (result=%d, size=%zu)\n", in drm_dp_i2c_do_msg()
1511 aux->name, ret, msg->size); in drm_dp_i2c_do_msg()
1512 aux->i2c_nack_count++; in drm_dp_i2c_do_msg()
1516 drm_dbg_kms(aux->drm_dev, "%s: I2C defer\n", aux->name); in drm_dp_i2c_do_msg()
1521 aux->i2c_defer_count++; in drm_dp_i2c_do_msg()
1530 drm_err(aux->drm_dev, "%s: invalid I2C reply %#04x\n", in drm_dp_i2c_do_msg()
1531 aux->name, msg->reply); in drm_dp_i2c_do_msg()
1536 drm_dbg_kms(aux->drm_dev, "%s: Too many retries, giving up\n", aux->name); in drm_dp_i2c_do_msg()
1554 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
1560 err = drm_dp_i2c_do_msg(aux, &msg); in drm_dp_i2c_drain_msg()
1565 drm_dbg_kms(aux->drm_dev, in drm_dp_i2c_drain_msg()
1567 aux->name, msg.size, err); in drm_dp_i2c_drain_msg()
1591 struct drm_dp_aux *aux = adapter->algo_data; in drm_dp_i2c_xfer() local
1610 err = drm_dp_i2c_do_msg(aux, &msg); in drm_dp_i2c_xfer()
1629 err = drm_dp_i2c_drain_msg(aux, &msg); in drm_dp_i2c_xfer()
1653 (void)drm_dp_i2c_do_msg(aux, &msg); in drm_dp_i2c_xfer()
1689 static int drm_dp_aux_get_crc(struct drm_dp_aux *aux, u8 *crc) in drm_dp_aux_get_crc() argument
1694 ret = drm_dp_dpcd_readb(aux, DP_TEST_SINK, &buf); in drm_dp_aux_get_crc()
1700 ret = drm_dp_dpcd_readb(aux, DP_TEST_SINK_MISC, &buf); in drm_dp_aux_get_crc()
1705 if (count == aux->crc_count) in drm_dp_aux_get_crc()
1708 aux->crc_count = count; in drm_dp_aux_get_crc()
1714 ret = drm_dp_dpcd_read(aux, DP_TEST_CRC_R_CR, crc, 6); in drm_dp_aux_get_crc()
1723 struct drm_dp_aux *aux = container_of(work, struct drm_dp_aux, in drm_dp_aux_crc_work() local
1730 if (WARN_ON(!aux->crtc)) in drm_dp_aux_crc_work()
1733 crtc = aux->crtc; in drm_dp_aux_crc_work()
1739 ret = drm_dp_aux_get_crc(aux, crc_bytes); in drm_dp_aux_crc_work()
1742 ret = drm_dp_aux_get_crc(aux, crc_bytes); in drm_dp_aux_crc_work()
1746 drm_dbg_kms(aux->drm_dev, "%s: Get CRC failed after retrying: %d\n", in drm_dp_aux_crc_work()
1747 aux->name, ret); in drm_dp_aux_crc_work()
1750 drm_dbg_kms(aux->drm_dev, "%s: Failed to get a CRC: %d\n", aux->name, ret); in drm_dp_aux_crc_work()
1768 void drm_dp_remote_aux_init(struct drm_dp_aux *aux) in drm_dp_remote_aux_init() argument
1770 INIT_WORK(&aux->crc_work, drm_dp_aux_crc_work); in drm_dp_remote_aux_init()
1791 void drm_dp_aux_init(struct drm_dp_aux *aux) in drm_dp_aux_init() argument
1793 mutex_init(&aux->hw_mutex); in drm_dp_aux_init()
1794 mutex_init(&aux->cec.lock); in drm_dp_aux_init()
1795 INIT_WORK(&aux->crc_work, drm_dp_aux_crc_work); in drm_dp_aux_init()
1797 aux->ddc.algo = &drm_dp_i2c_algo; in drm_dp_aux_init()
1798 aux->ddc.algo_data = aux; in drm_dp_aux_init()
1799 aux->ddc.retries = 3; in drm_dp_aux_init()
1801 aux->ddc.lock_ops = &drm_dp_i2c_lock_ops; in drm_dp_aux_init()
1832 int drm_dp_aux_register(struct drm_dp_aux *aux) in drm_dp_aux_register() argument
1836 WARN_ON_ONCE(!aux->drm_dev); in drm_dp_aux_register()
1838 if (!aux->ddc.algo) in drm_dp_aux_register()
1839 drm_dp_aux_init(aux); in drm_dp_aux_register()
1841 aux->ddc.class = I2C_CLASS_DDC; in drm_dp_aux_register()
1842 aux->ddc.owner = THIS_MODULE; in drm_dp_aux_register()
1843 aux->ddc.dev.parent = aux->dev; in drm_dp_aux_register()
1845 strlcpy(aux->ddc.name, aux->name ? aux->name : dev_name(aux->dev), in drm_dp_aux_register()
1846 sizeof(aux->ddc.name)); in drm_dp_aux_register()
1848 ret = drm_dp_aux_register_devnode(aux); in drm_dp_aux_register()
1852 ret = i2c_add_adapter(&aux->ddc); in drm_dp_aux_register()
1854 drm_dp_aux_unregister_devnode(aux); in drm_dp_aux_register()
1866 void drm_dp_aux_unregister(struct drm_dp_aux *aux) in drm_dp_aux_unregister() argument
1868 drm_dp_aux_unregister_devnode(aux); in drm_dp_aux_unregister()
1869 i2c_del_adapter(&aux->ddc); in drm_dp_aux_unregister()
1913 int drm_dp_start_crc(struct drm_dp_aux *aux, struct drm_crtc *crtc) in drm_dp_start_crc() argument
1918 ret = drm_dp_dpcd_readb(aux, DP_TEST_SINK, &buf); in drm_dp_start_crc()
1922 ret = drm_dp_dpcd_writeb(aux, DP_TEST_SINK, buf | DP_TEST_SINK_START); in drm_dp_start_crc()
1926 aux->crc_count = 0; in drm_dp_start_crc()
1927 aux->crtc = crtc; in drm_dp_start_crc()
1928 schedule_work(&aux->crc_work); in drm_dp_start_crc()
1940 int drm_dp_stop_crc(struct drm_dp_aux *aux) in drm_dp_stop_crc() argument
1945 ret = drm_dp_dpcd_readb(aux, DP_TEST_SINK, &buf); in drm_dp_stop_crc()
1949 ret = drm_dp_dpcd_writeb(aux, DP_TEST_SINK, buf & ~DP_TEST_SINK_START); in drm_dp_stop_crc()
1953 flush_work(&aux->crc_work); in drm_dp_stop_crc()
1954 aux->crtc = NULL; in drm_dp_stop_crc()
2039 int drm_dp_read_desc(struct drm_dp_aux *aux, struct drm_dp_desc *desc, in drm_dp_read_desc() argument
2046 ret = drm_dp_dpcd_read(aux, offset, ident, sizeof(*ident)); in drm_dp_read_desc()
2054 drm_dbg_kms(aux->drm_dev, in drm_dp_read_desc()
2056 aux->name, is_branch ? "branch" : "sink", in drm_dp_read_desc()
2211 int drm_dp_read_lttpr_common_caps(struct drm_dp_aux *aux, in drm_dp_read_lttpr_common_caps() argument
2216 ret = drm_dp_dpcd_read(aux, in drm_dp_read_lttpr_common_caps()
2238 int drm_dp_read_lttpr_phy_caps(struct drm_dp_aux *aux, in drm_dp_read_lttpr_phy_caps() argument
2244 ret = drm_dp_dpcd_read(aux, in drm_dp_read_lttpr_phy_caps()
2356 int drm_dp_get_phy_test_pattern(struct drm_dp_aux *aux, in drm_dp_get_phy_test_pattern() argument
2362 err = drm_dp_dpcd_readb(aux, DP_TEST_LINK_RATE, &rate); in drm_dp_get_phy_test_pattern()
2367 err = drm_dp_dpcd_readb(aux, DP_TEST_LANE_COUNT, &lanes); in drm_dp_get_phy_test_pattern()
2375 err = drm_dp_dpcd_readb(aux, DP_PHY_TEST_PATTERN, &data->phy_pattern); in drm_dp_get_phy_test_pattern()
2381 err = drm_dp_dpcd_read(aux, DP_TEST_80BIT_CUSTOM_PATTERN_7_0, in drm_dp_get_phy_test_pattern()
2388 err = drm_dp_dpcd_read(aux, DP_TEST_HBR2_SCRAMBLER_RESET, in drm_dp_get_phy_test_pattern()
2407 int drm_dp_set_phy_test_pattern(struct drm_dp_aux *aux, in drm_dp_set_phy_test_pattern() argument
2418 err = drm_dp_dpcd_write(aux, DP_LINK_BW_SET, link_config, 2); in drm_dp_set_phy_test_pattern()
2426 err = drm_dp_dpcd_writeb(aux, DP_TRAINING_PATTERN_SET, in drm_dp_set_phy_test_pattern()
2432 err = drm_dp_dpcd_writeb(aux, in drm_dp_set_phy_test_pattern()
2664 int drm_dp_pcon_frl_prepare(struct drm_dp_aux *aux, bool enable_frl_ready_hpd) in drm_dp_pcon_frl_prepare() argument
2673 ret = drm_dp_dpcd_writeb(aux, DP_PCON_HDMI_LINK_CONFIG_1, buf); in drm_dp_pcon_frl_prepare()
2685 bool drm_dp_pcon_is_frl_ready(struct drm_dp_aux *aux) in drm_dp_pcon_is_frl_ready() argument
2690 ret = drm_dp_dpcd_readb(aux, DP_PCON_HDMI_TX_LINK_STATUS, &buf); in drm_dp_pcon_is_frl_ready()
2713 int drm_dp_pcon_frl_configure_1(struct drm_dp_aux *aux, int max_frl_gbps, in drm_dp_pcon_frl_configure_1() argument
2719 ret = drm_dp_dpcd_readb(aux, DP_PCON_HDMI_LINK_CONFIG_1, &buf); in drm_dp_pcon_frl_configure_1()
2754 ret = drm_dp_dpcd_writeb(aux, DP_PCON_HDMI_LINK_CONFIG_1, buf); in drm_dp_pcon_frl_configure_1()
2773 int drm_dp_pcon_frl_configure_2(struct drm_dp_aux *aux, int max_frl_mask, in drm_dp_pcon_frl_configure_2() argument
2784 ret = drm_dp_dpcd_writeb(aux, DP_PCON_HDMI_LINK_CONFIG_2, buf); in drm_dp_pcon_frl_configure_2()
2798 int drm_dp_pcon_reset_frl_config(struct drm_dp_aux *aux) in drm_dp_pcon_reset_frl_config() argument
2802 ret = drm_dp_dpcd_writeb(aux, DP_PCON_HDMI_LINK_CONFIG_1, 0x0); in drm_dp_pcon_reset_frl_config()
2816 int drm_dp_pcon_frl_enable(struct drm_dp_aux *aux) in drm_dp_pcon_frl_enable() argument
2821 ret = drm_dp_dpcd_readb(aux, DP_PCON_HDMI_LINK_CONFIG_1, &buf); in drm_dp_pcon_frl_enable()
2825 drm_dbg_kms(aux->drm_dev, "%s: PCON in Autonomous mode, can't enable FRL\n", in drm_dp_pcon_frl_enable()
2826 aux->name); in drm_dp_pcon_frl_enable()
2830 ret = drm_dp_dpcd_writeb(aux, DP_PCON_HDMI_LINK_CONFIG_1, buf); in drm_dp_pcon_frl_enable()
2844 bool drm_dp_pcon_hdmi_link_active(struct drm_dp_aux *aux) in drm_dp_pcon_hdmi_link_active() argument
2849 ret = drm_dp_dpcd_readb(aux, DP_PCON_HDMI_TX_LINK_STATUS, &buf); in drm_dp_pcon_hdmi_link_active()
2868 int drm_dp_pcon_hdmi_link_mode(struct drm_dp_aux *aux, u8 *frl_trained_mask) in drm_dp_pcon_hdmi_link_mode() argument
2874 ret = drm_dp_dpcd_readb(aux, DP_PCON_HDMI_POST_FRL_STATUS, &buf); in drm_dp_pcon_hdmi_link_mode()
2895 void drm_dp_pcon_hdmi_frl_link_error_count(struct drm_dp_aux *aux, in drm_dp_pcon_hdmi_frl_link_error_count() argument
2903 if (drm_dp_dpcd_readb(aux, DP_PCON_HDMI_ERROR_STATUS_LN0 + i, &buf) < 0) in drm_dp_pcon_hdmi_frl_link_error_count()
2921 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()
2922 aux->name, num_error, i); in drm_dp_pcon_hdmi_frl_link_error_count()
3033 int drm_dp_pcon_configure_dsc_enc(struct drm_dp_aux *aux, u8 pps_buf_config) in drm_dp_pcon_configure_dsc_enc() argument
3038 ret = drm_dp_dpcd_readb(aux, DP_PROTOCOL_CONVERTER_CONTROL_2, &buf); in drm_dp_pcon_configure_dsc_enc()
3049 ret = drm_dp_dpcd_writeb(aux, DP_PROTOCOL_CONVERTER_CONTROL_2, buf); in drm_dp_pcon_configure_dsc_enc()
3063 int drm_dp_pcon_pps_default(struct drm_dp_aux *aux) in drm_dp_pcon_pps_default() argument
3067 ret = drm_dp_pcon_configure_dsc_enc(aux, DP_PCON_ENC_PPS_OVERRIDE_DISABLED); in drm_dp_pcon_pps_default()
3083 int drm_dp_pcon_pps_override_buf(struct drm_dp_aux *aux, u8 pps_buf[128]) in drm_dp_pcon_pps_override_buf() argument
3087 ret = drm_dp_dpcd_write(aux, DP_PCON_HDMI_PPS_OVERRIDE_BASE, &pps_buf, 128); in drm_dp_pcon_pps_override_buf()
3091 ret = drm_dp_pcon_configure_dsc_enc(aux, DP_PCON_ENC_PPS_OVERRIDE_EN_BUFFER); in drm_dp_pcon_pps_override_buf()
3108 int drm_dp_pcon_pps_override_param(struct drm_dp_aux *aux, u8 pps_param[6]) in drm_dp_pcon_pps_override_param() argument
3112 ret = drm_dp_dpcd_write(aux, DP_PCON_HDMI_PPS_OVRD_SLICE_HEIGHT, &pps_param[0], 2); in drm_dp_pcon_pps_override_param()
3115 ret = drm_dp_dpcd_write(aux, DP_PCON_HDMI_PPS_OVRD_SLICE_WIDTH, &pps_param[2], 2); in drm_dp_pcon_pps_override_param()
3118 ret = drm_dp_dpcd_write(aux, DP_PCON_HDMI_PPS_OVRD_BPP, &pps_param[4], 2); in drm_dp_pcon_pps_override_param()
3122 ret = drm_dp_pcon_configure_dsc_enc(aux, DP_PCON_ENC_PPS_OVERRIDE_EN_BUFFER); in drm_dp_pcon_pps_override_param()
3137 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
3142 ret = drm_dp_dpcd_readb(aux, DP_PROTOCOL_CONVERTER_CONTROL_2, &buf); in drm_dp_pcon_convert_rgb_to_ycbcr()
3151 ret = drm_dp_dpcd_writeb(aux, DP_PROTOCOL_CONVERTER_CONTROL_2, buf); in drm_dp_pcon_convert_rgb_to_ycbcr()
3170 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
3183 ret = drm_dp_dpcd_write(aux, DP_EDP_BACKLIGHT_BRIGHTNESS_MSB, buf, sizeof(buf)); in drm_edp_backlight_set_level()
3185 drm_err(aux->drm_dev, in drm_edp_backlight_set_level()
3187 aux->name, ret); in drm_edp_backlight_set_level()
3196 drm_edp_backlight_set_enable(struct drm_dp_aux *aux, const struct drm_edp_backlight_info *bl, in drm_edp_backlight_set_enable() argument
3206 ret = drm_dp_dpcd_readb(aux, DP_EDP_DISPLAY_CONTROL_REGISTER, &buf); in drm_edp_backlight_set_enable()
3208 drm_err(aux->drm_dev, "%s: Failed to read eDP display control register: %d\n", in drm_edp_backlight_set_enable()
3209 aux->name, ret); in drm_edp_backlight_set_enable()
3217 ret = drm_dp_dpcd_writeb(aux, DP_EDP_DISPLAY_CONTROL_REGISTER, buf); in drm_edp_backlight_set_enable()
3219 drm_err(aux->drm_dev, "%s: Failed to write eDP display control register: %d\n", in drm_edp_backlight_set_enable()
3220 aux->name, ret); in drm_edp_backlight_set_enable()
3245 int drm_edp_backlight_enable(struct drm_dp_aux *aux, const struct drm_edp_backlight_info *bl, in drm_edp_backlight_enable() argument
3251 ret = drm_dp_dpcd_readb(aux, DP_EDP_BACKLIGHT_MODE_SET_REGISTER, &dpcd_buf); in drm_edp_backlight_enable()
3253 drm_dbg_kms(aux->drm_dev, in drm_edp_backlight_enable()
3254 "%s: Failed to read backlight mode: %d\n", aux->name, ret); in drm_edp_backlight_enable()
3265 ret = drm_dp_dpcd_writeb(aux, DP_EDP_PWMGEN_BIT_COUNT, bl->pwmgen_bit_count); in drm_edp_backlight_enable()
3267 drm_dbg_kms(aux->drm_dev, "%s: Failed to write aux pwmgen bit count: %d\n", in drm_edp_backlight_enable()
3268 aux->name, ret); in drm_edp_backlight_enable()
3273 ret = drm_dp_dpcd_writeb(aux, DP_EDP_BACKLIGHT_FREQ_SET, bl->pwm_freq_pre_divider); in drm_edp_backlight_enable()
3275 drm_dbg_kms(aux->drm_dev, in drm_edp_backlight_enable()
3277 aux->name, ret); in drm_edp_backlight_enable()
3283 ret = drm_dp_dpcd_writeb(aux, DP_EDP_BACKLIGHT_MODE_SET_REGISTER, new_dpcd_buf); in drm_edp_backlight_enable()
3285 drm_dbg_kms(aux->drm_dev, "%s: Failed to write aux backlight mode: %d\n", in drm_edp_backlight_enable()
3286 aux->name, ret); in drm_edp_backlight_enable()
3291 ret = drm_edp_backlight_set_level(aux, bl, level); in drm_edp_backlight_enable()
3294 ret = drm_edp_backlight_set_enable(aux, bl, true); in drm_edp_backlight_enable()
3316 int drm_edp_backlight_disable(struct drm_dp_aux *aux, const struct drm_edp_backlight_info *bl) in drm_edp_backlight_disable() argument
3320 ret = drm_edp_backlight_set_enable(aux, bl, false); in drm_edp_backlight_disable()
3329 drm_edp_backlight_probe_max(struct drm_dp_aux *aux, struct drm_edp_backlight_info *bl, in drm_edp_backlight_probe_max() argument
3336 ret = drm_dp_dpcd_readb(aux, DP_EDP_PWMGEN_BIT_COUNT, &pn); in drm_edp_backlight_probe_max()
3338 drm_dbg_kms(aux->drm_dev, "%s: Failed to read pwmgen bit count cap: %d\n", in drm_edp_backlight_probe_max()
3339 aux->name, ret); in drm_edp_backlight_probe_max()
3370 ret = drm_dp_dpcd_readb(aux, DP_EDP_PWMGEN_BIT_COUNT_CAP_MIN, &pn_min); in drm_edp_backlight_probe_max()
3372 drm_dbg_kms(aux->drm_dev, "%s: Failed to read pwmgen bit count cap min: %d\n", in drm_edp_backlight_probe_max()
3373 aux->name, ret); in drm_edp_backlight_probe_max()
3376 ret = drm_dp_dpcd_readb(aux, DP_EDP_PWMGEN_BIT_COUNT_CAP_MAX, &pn_max); in drm_edp_backlight_probe_max()
3378 drm_dbg_kms(aux->drm_dev, "%s: Failed to read pwmgen bit count cap max: %d\n", in drm_edp_backlight_probe_max()
3379 aux->name, ret); in drm_edp_backlight_probe_max()
3389 drm_dbg_kms(aux->drm_dev, in drm_edp_backlight_probe_max()
3391 aux->name, driver_pwm_freq_hz); in drm_edp_backlight_probe_max()
3402 ret = drm_dp_dpcd_writeb(aux, DP_EDP_PWMGEN_BIT_COUNT, pn); in drm_edp_backlight_probe_max()
3404 drm_dbg_kms(aux->drm_dev, "%s: Failed to write aux pwmgen bit count: %d\n", in drm_edp_backlight_probe_max()
3405 aux->name, ret); in drm_edp_backlight_probe_max()
3413 drm_dbg_kms(aux->drm_dev, "%s: Using backlight frequency from driver (%dHz)\n", in drm_edp_backlight_probe_max()
3414 aux->name, driver_pwm_freq_hz); in drm_edp_backlight_probe_max()
3421 drm_edp_backlight_probe_level(struct drm_dp_aux *aux, struct drm_edp_backlight_info *bl, in drm_edp_backlight_probe_level() argument
3428 ret = drm_dp_dpcd_readb(aux, DP_EDP_BACKLIGHT_MODE_SET_REGISTER, &mode_reg); in drm_edp_backlight_probe_level()
3430 drm_dbg_kms(aux->drm_dev, "%s: Failed to read backlight mode: %d\n", in drm_edp_backlight_probe_level()
3431 aux->name, ret); in drm_edp_backlight_probe_level()
3439 ret = drm_dp_dpcd_read(aux, DP_EDP_BACKLIGHT_BRIGHTNESS_MSB, buf, size); in drm_edp_backlight_probe_level()
3441 drm_dbg_kms(aux->drm_dev, "%s: Failed to read backlight level: %d\n", in drm_edp_backlight_probe_level()
3442 aux->name, ret); in drm_edp_backlight_probe_level()
3478 drm_edp_backlight_init(struct drm_dp_aux *aux, struct drm_edp_backlight_info *bl, in drm_edp_backlight_init() argument
3489 ret = drm_edp_backlight_probe_max(aux, bl, driver_pwm_freq_hz, edp_dpcd); in drm_edp_backlight_init()
3493 ret = drm_edp_backlight_probe_level(aux, bl, current_mode); in drm_edp_backlight_init()
3498 drm_dbg_kms(aux->drm_dev, in drm_edp_backlight_init()
3500 aux->name, *current_level, bl->max, bl->pwm_freq_pre_divider, *current_mode); in drm_edp_backlight_init()
3501 drm_dbg_kms(aux->drm_dev, in drm_edp_backlight_init()
3503 aux->name, bl->pwmgen_bit_count, bl->lsb_reg_used, bl->aux_enable); in drm_edp_backlight_init()
3519 drm_edp_backlight_enable(bl->aux, &bl->info, brightness); in dp_aux_backlight_update_status()
3523 ret = drm_edp_backlight_set_level(bl->aux, &bl->info, brightness); in dp_aux_backlight_update_status()
3526 drm_edp_backlight_disable(bl->aux, &bl->info); in dp_aux_backlight_update_status()
3562 int drm_panel_dp_aux_backlight(struct drm_panel *panel, struct drm_dp_aux *aux) in drm_panel_dp_aux_backlight() argument
3571 if (!panel || !panel->dev || !aux) in drm_panel_dp_aux_backlight()
3574 ret = drm_dp_dpcd_read(aux, DP_EDP_DPCD_REV, edp_dpcd, in drm_panel_dp_aux_backlight()
3588 bl->aux = aux; in drm_panel_dp_aux_backlight()
3590 ret = drm_edp_backlight_init(aux, &bl->info, 0, edp_dpcd, in drm_panel_dp_aux_backlight()