Lines Matching +full:a +full:- +full:facing

59 	return link_status[r - DP_LANE0_1_STATUS];  in dp_link_status()
150 drm_dbg_kms(aux->drm_dev, "%s: AUX interval %lu, out of range (max 4)\n", in drm_dp_link_train_clock_recovery_delay()
151 aux->name, rd_interval); in drm_dp_link_train_clock_recovery_delay()
166 drm_dbg_kms(aux->drm_dev, "%s: AUX interval %lu, out of range (max 4)\n", in __drm_dp_link_train_channel_eq_delay()
167 aux->name, rd_interval); in __drm_dp_link_train_channel_eq_delay()
194 return phy_cap[r - DP_TRAINING_AUX_RD_INTERVAL_PHY_REPEATER1]; in dp_lttpr_phy_cap()
228 const char *arrow = request == DP_AUX_NATIVE_READ ? "->" : "<-"; in drm_dp_dump_access()
231 drm_dbg_dp(aux->drm_dev, "%s: 0x%05x AUX %s (ret=%3d) %*ph\n", in drm_dp_dump_access()
232 aux->name, offset, arrow, ret, min(ret, 20), buffer); in drm_dp_dump_access()
234 drm_dbg_dp(aux->drm_dev, "%s: 0x%05x AUX %s (ret=%3d)\n", in drm_dp_dump_access()
235 aux->name, offset, arrow, ret); in drm_dp_dump_access()
241 * The DisplayPort AUX channel is an abstraction to allow generic, driver-
245 * Transactions are described using a hardware-independent drm_dp_aux_msg
246 * structure, which is passed into a driver's .transfer() implementation.
247 * Both native and I2C-over-AUX transactions are supported.
263 mutex_lock(&aux->hw_mutex); in drm_dp_dpcd_access()
272 if (ret != 0 && ret != -ETIMEDOUT) { in drm_dp_dpcd_access()
277 ret = aux->transfer(aux, &msg); in drm_dp_dpcd_access()
284 ret = -EPROTO; in drm_dp_dpcd_access()
286 ret = -EIO; in drm_dp_dpcd_access()
291 * the first transaction, since we may get a different error the in drm_dp_dpcd_access()
298 drm_dbg_kms(aux->drm_dev, "%s: Too many retries, giving up. First error: %d\n", in drm_dp_dpcd_access()
299 aux->name, err); in drm_dp_dpcd_access()
303 mutex_unlock(&aux->hw_mutex); in drm_dp_dpcd_access()
308 * drm_dp_dpcd_read() - read a series of bytes from the DPCD
314 * Returns the number of bytes transferred on success, or a negative error
315 * code on failure. -EIO is returned if the request was NAKed by the sink or
317 * function returns -EPROTO. Errors from the underlying AUX channel transfer
318 * function, with the exception of -EBUSY (which causes the transaction to
328 * mode. Eg. on a read, the entire buffer will be filled with the same in drm_dp_dpcd_read()
329 * byte. Do a throw away read to avoid corrupting anything we care in drm_dp_dpcd_read()
331 * gets woken up and subsequently re-enters power save mode. in drm_dp_dpcd_read()
338 if (!aux->is_remote) { in drm_dp_dpcd_read()
345 if (aux->is_remote) in drm_dp_dpcd_read()
358 * drm_dp_dpcd_write() - write a series of bytes to the DPCD
364 * Returns the number of bytes transferred on success, or a negative error
365 * code on failure. -EIO is returned if the request was NAKed by the sink or
367 * function returns -EPROTO. Errors from the underlying AUX channel transfer
368 * function, with the exception of -EBUSY (which causes the transaction to
376 if (aux->is_remote) in drm_dp_dpcd_write()
388 * drm_dp_dpcd_read_link_status() - read DPCD link status (bytes 0x202-0x207)
392 * Returns the number of bytes transferred on success or a negative error
404 * drm_dp_dpcd_read_phy_link_status - get the link status information for a DP PHY
413 * Returns 0 if the information was read successfully or a negative error code
439 DP_LINK_STATUS_SIZE - 1); in drm_dp_dpcd_read_phy_link_status()
444 WARN_ON(ret != DP_LINK_STATUS_SIZE - 1); in drm_dp_dpcd_read_phy_link_status()
447 memmove(&link_status[DP_SINK_STATUS - DP_LANE0_1_STATUS + 1], in drm_dp_dpcd_read_phy_link_status()
448 &link_status[DP_SINK_STATUS - DP_LANE0_1_STATUS], in drm_dp_dpcd_read_phy_link_status()
449 DP_LINK_STATUS_SIZE - (DP_SINK_STATUS - DP_LANE0_1_STATUS) - 1); in drm_dp_dpcd_read_phy_link_status()
450 link_status[DP_SINK_STATUS - DP_LANE0_1_STATUS] = 0; in drm_dp_dpcd_read_phy_link_status()
458 return edid && edid->revision >= 4 && in is_edid_digital_input_dp()
459 edid->input & DRM_EDID_INPUT_DIGITAL && in is_edid_digital_input_dp()
460 (edid->input & DRM_EDID_DIGITAL_TYPE_MASK) == DRM_EDID_DIGITAL_TYPE_DP; in is_edid_digital_input_dp()
464 * drm_dp_downstream_is_type() - is the downstream facing port of certain type?
474 * Returns: whether the downstream facing port matches the type.
486 * drm_dp_downstream_is_tmds() - is the downstream facing port TMDS?
491 * Returns: whether the downstream facing port is TMDS (HDMI/DVI).
521 * drm_dp_send_real_edid_checksum() - send back real edid checksum value
535 drm_err(aux->drm_dev, "%s: DPCD failed read at register 0x%x\n", in drm_dp_send_real_edid_checksum()
536 aux->name, DP_DEVICE_SERVICE_IRQ_VECTOR); in drm_dp_send_real_edid_checksum()
542 drm_err(aux->drm_dev, "%s: DPCD failed read at register 0x%x\n", in drm_dp_send_real_edid_checksum()
543 aux->name, DP_TEST_REQUEST); in drm_dp_send_real_edid_checksum()
549 drm_dbg_kms(aux->drm_dev, "%s: Source DUT does not support TEST_EDID_READ\n", in drm_dp_send_real_edid_checksum()
550 aux->name); in drm_dp_send_real_edid_checksum()
556 drm_err(aux->drm_dev, "%s: DPCD failed write at register 0x%x\n", in drm_dp_send_real_edid_checksum()
557 aux->name, DP_DEVICE_SERVICE_IRQ_VECTOR); in drm_dp_send_real_edid_checksum()
564 drm_err(aux->drm_dev, "%s: DPCD failed write at register 0x%x\n", in drm_dp_send_real_edid_checksum()
565 aux->name, DP_TEST_EDID_CHECKSUM); in drm_dp_send_real_edid_checksum()
571 drm_err(aux->drm_dev, "%s: DPCD failed write at register 0x%x\n", in drm_dp_send_real_edid_checksum()
572 aux->name, DP_TEST_RESPONSE); in drm_dp_send_real_edid_checksum()
599 * If it is set DP_DPCD_REV at 0000h could be at a value less than in drm_dp_read_extended_dpcd_caps()
612 return -EIO; in drm_dp_read_extended_dpcd_caps()
615 drm_dbg_kms(aux->drm_dev, in drm_dp_read_extended_dpcd_caps()
617 aux->name, dpcd[DP_DPCD_REV], dpcd_ext[DP_DPCD_REV]); in drm_dp_read_extended_dpcd_caps()
624 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()
632 * drm_dp_read_dpcd_caps() - read DPCD caps and extended DPCD caps if
653 return -EIO; in drm_dp_read_dpcd_caps()
659 drm_dbg_kms(aux->drm_dev, "%s: DPCD: %*ph\n", aux->name, DP_RECEIVER_CAP_SIZE, dpcd); in drm_dp_read_dpcd_caps()
666 * drm_dp_read_downstream_info() - read DPCD downstream port info if available
668 * @dpcd: A cached copy of the port's DPCD
676 * there was no downstream info to read, or a negative error code otherwise.
691 /* Some branches advertise having 0 downstream ports, despite also advertising they have a in drm_dp_read_downstream_info()
706 return -EIO; in drm_dp_read_downstream_info()
708 drm_dbg_kms(aux->drm_dev, "%s: DPCD DFP: %*ph\n", aux->name, len, downstream_ports); in drm_dp_read_downstream_info()
715 * drm_dp_downstream_max_dotclock() - extract downstream facing port max dot clock
719 * Returns: Downstream facing port max dot clock in kHz on success,
743 * drm_dp_downstream_max_tmds_clock() - extract downstream facing port max TMDS clock
748 * Returns: HDMI/DVI downstream facing port max TMDS clock in kHz on success,
790 * info. So it's more likely we're dealing with a HDMI 1.4 in drm_dp_downstream_max_tmds_clock()
808 * drm_dp_downstream_min_tmds_clock() - extract downstream facing port min TMDS clock
813 * Returns: HDMI/DVI downstream facing port min TMDS clock in kHz on success,
851 * drm_dp_downstream_max_bpc() - extract downstream facing port max
854 * @port_cap: downstream facing port capabilities
908 * drm_dp_downstream_420_passthrough() - determine downstream facing port
909 * YCbCr 4:2:0 pass-through capability
911 * @port_cap: downstream facing port capabilities
913 * Returns: whether the downstream facing port can pass through YCbCr 4:2:0
939 * drm_dp_downstream_444_to_420_conversion() - determine downstream facing port
940 * YCbCr 4:4:4->4:2:0 conversion capability
942 * @port_cap: downstream facing port capabilities
944 * Returns: whether the downstream facing port can convert YCbCr 4:4:4 to 4:2:0
968 * drm_dp_downstream_rgb_to_ycbcr_conversion() - determine downstream facing port
969 * RGB->YCbCr conversion capability
971 * @port_cap: downstream facing port capabilities
974 * Returns: whether the downstream facing port can convert RGB->YCbCr for a given
1000 * drm_dp_downstream_mode() - return a mode for downstream facing port
1005 * Provides a suitable mode for downstream facing ports without EDID.
1007 * Returns: A new drm_display_mode on success or NULL on failure
1055 * drm_dp_downstream_id() - identify branch device
1068 * drm_dp_downstream_debug() - debug DP branch devices
1121 seq_puts(m, "\t\tType: N/A\n"); in drm_dp_downstream_debug()
1159 * drm_dp_subconnector_type() - get DP branch device type
1177 /* Can be HDMI or DVI-D, DVI-D is a safer option */ in drm_dp_subconnector_type()
1180 /* Can be VGA or DVI-A, VGA is more popular */ in drm_dp_subconnector_type()
1211 * drm_dp_set_subconnector_property - set subconnector for DP connector
1217 * Called by a driver on every detect event.
1228 drm_object_property_set_value(&connector->base, in drm_dp_set_subconnector_property()
1229 connector->dev->mode_config.dp_subconnector_property, in drm_dp_set_subconnector_property()
1235 * drm_dp_read_sink_count_cap() - Check whether a given connector has a valid sink
1238 * @dpcd: A cached copy of the connector's DPCD RX capabilities
1239 * @desc: A cached copy of the connector's DP descriptor
1243 * Returns: %True if the (e)DP connector has a valid sink count that should
1250 /* Some eDP panels don't set a valid value for the sink count */ in drm_dp_read_sink_count_cap()
1251 return connector->connector_type != DRM_MODE_CONNECTOR_eDP && in drm_dp_read_sink_count_cap()
1259 * drm_dp_read_sink_count() - Retrieve the sink count for a given sink
1264 * Returns: The current sink count reported by @aux, or a negative error code
1276 return -EIO; in drm_dp_read_sink_count()
1283 * I2C-over-AUX implementation
1297 * In case of i2c defer or short i2c ack reply to a write, in drm_dp_i2c_msg_write_status_update()
1301 if ((msg->request & ~DP_AUX_I2C_MOT) == DP_AUX_I2C_WRITE) { in drm_dp_i2c_msg_write_status_update()
1302 msg->request &= DP_AUX_I2C_MOT; in drm_dp_i2c_msg_write_status_update()
1303 msg->request |= DP_AUX_I2C_WRITE_STATUS_UPDATE; in drm_dp_i2c_msg_write_status_update()
1324 if ((msg->request & DP_AUX_I2C_READ) == 0) in drm_dp_aux_req_duration()
1325 len += msg->size * 8; in drm_dp_aux_req_duration()
1339 if (msg->request & DP_AUX_I2C_READ) in drm_dp_aux_reply_duration()
1340 len += msg->size * 8; in drm_dp_aux_reply_duration()
1355 * message includes a START, ADDRESS and STOP. Neither does it
1363 msg->size * I2C_DATA_LEN + in drm_dp_i2c_msg_duration()
1389 "Assumed speed of the i2c bus in kHz, (1-400, default 10)");
1392 * Transfer a single I2C-over-AUX message and handle various error conditions,
1397 * Returns bytes transferred on success, or a negative error code on failure.
1404 * DP1.2 sections 2.7.7.1.5.6.1 and 2.7.7.1.6.6.1: A DP Source device in drm_dp_i2c_do_msg()
1413 ret = aux->transfer(aux, msg); in drm_dp_i2c_do_msg()
1415 if (ret == -EBUSY) in drm_dp_i2c_do_msg()
1420 * behavior (for instance, when a driver tries to in drm_dp_i2c_do_msg()
1421 * communicate with a non-existent DisplayPort device). in drm_dp_i2c_do_msg()
1424 if (ret == -ETIMEDOUT) in drm_dp_i2c_do_msg()
1425 drm_dbg_kms_ratelimited(aux->drm_dev, "%s: transaction timed out\n", in drm_dp_i2c_do_msg()
1426 aux->name); in drm_dp_i2c_do_msg()
1428 drm_dbg_kms(aux->drm_dev, "%s: transaction failed: %d\n", in drm_dp_i2c_do_msg()
1429 aux->name, ret); in drm_dp_i2c_do_msg()
1434 switch (msg->reply & DP_AUX_NATIVE_REPLY_MASK) { in drm_dp_i2c_do_msg()
1437 * For I2C-over-AUX transactions this isn't enough, we in drm_dp_i2c_do_msg()
1443 drm_dbg_kms(aux->drm_dev, "%s: native nack (result=%d, size=%zu)\n", in drm_dp_i2c_do_msg()
1444 aux->name, ret, msg->size); in drm_dp_i2c_do_msg()
1445 return -EREMOTEIO; in drm_dp_i2c_do_msg()
1448 drm_dbg_kms(aux->drm_dev, "%s: native defer\n", aux->name); in drm_dp_i2c_do_msg()
1452 * more careful with DP-to-legacy adapters where a in drm_dp_i2c_do_msg()
1456 * safe for all use-cases. in drm_dp_i2c_do_msg()
1462 drm_err(aux->drm_dev, "%s: invalid native reply %#04x\n", in drm_dp_i2c_do_msg()
1463 aux->name, msg->reply); in drm_dp_i2c_do_msg()
1464 return -EREMOTEIO; in drm_dp_i2c_do_msg()
1467 switch (msg->reply & DP_AUX_I2C_REPLY_MASK) { in drm_dp_i2c_do_msg()
1473 if (ret != msg->size) in drm_dp_i2c_do_msg()
1478 drm_dbg_kms(aux->drm_dev, "%s: I2C nack (result=%d, size=%zu)\n", in drm_dp_i2c_do_msg()
1479 aux->name, ret, msg->size); in drm_dp_i2c_do_msg()
1480 aux->i2c_nack_count++; in drm_dp_i2c_do_msg()
1481 return -EREMOTEIO; in drm_dp_i2c_do_msg()
1484 drm_dbg_kms(aux->drm_dev, "%s: I2C defer\n", aux->name); in drm_dp_i2c_do_msg()
1489 aux->i2c_defer_count++; in drm_dp_i2c_do_msg()
1498 drm_err(aux->drm_dev, "%s: invalid I2C reply %#04x\n", in drm_dp_i2c_do_msg()
1499 aux->name, msg->reply); in drm_dp_i2c_do_msg()
1500 return -EREMOTEIO; in drm_dp_i2c_do_msg()
1504 drm_dbg_kms(aux->drm_dev, "%s: Too many retries, giving up\n", aux->name); in drm_dp_i2c_do_msg()
1505 return -EREMOTEIO; in drm_dp_i2c_do_msg()
1511 msg->request = (i2c_msg->flags & I2C_M_RD) ? in drm_dp_i2c_msg_set_request()
1513 if (!(i2c_msg->flags & I2C_M_STOP)) in drm_dp_i2c_msg_set_request()
1514 msg->request |= DP_AUX_I2C_MOT; in drm_dp_i2c_msg_set_request()
1520 * Returns an error code on failure, or a recommended transfer size on success.
1524 int err, ret = orig_msg->size; in drm_dp_i2c_drain_msg()
1530 return err == 0 ? -EPROTO : err; in drm_dp_i2c_drain_msg()
1533 drm_dbg_kms(aux->drm_dev, in drm_dp_i2c_drain_msg()
1535 aux->name, msg.size, err); in drm_dp_i2c_drain_msg()
1539 msg.size -= err; in drm_dp_i2c_drain_msg()
1547 * Bizlink designed DP->DVI-D Dual Link adapters require the I2C over AUX
1554 "Number of bytes to transfer in a single I2C over DP AUX CH message, (1-16, default 16)");
1559 struct drm_dp_aux *aux = adapter->algo_data; in drm_dp_i2c_xfer()
1572 /* Send a bare address packet to start the transaction. in drm_dp_i2c_xfer()
1582 * changed into a WRITE_STATUS_UPDATE. in drm_dp_i2c_xfer()
1589 * we'll go to smaller sizes if the hardware gives us a in drm_dp_i2c_xfer()
1595 msg.size = min(transfer_size, msgs[i].len - j); in drm_dp_i2c_xfer()
1601 * changed into a WRITE_STATUS_UPDATE. in drm_dp_i2c_xfer()
1614 /* Send a bare address packet to close out the transaction. in drm_dp_i2c_xfer()
1638 mutex_lock(&i2c_to_aux(i2c)->hw_mutex); in lock_bus()
1643 return mutex_trylock(&i2c_to_aux(i2c)->hw_mutex); in trylock_bus()
1648 mutex_unlock(&i2c_to_aux(i2c)->hw_mutex); in unlock_bus()
1673 if (count == aux->crc_count) in drm_dp_aux_get_crc()
1674 return -EAGAIN; /* No CRC yet */ in drm_dp_aux_get_crc()
1676 aux->crc_count = count; in drm_dp_aux_get_crc()
1698 if (WARN_ON(!aux->crtc)) in drm_dp_aux_crc_work()
1701 crtc = aux->crtc; in drm_dp_aux_crc_work()
1702 while (crtc->crc.opened) { in drm_dp_aux_crc_work()
1704 if (!crtc->crc.opened) in drm_dp_aux_crc_work()
1708 if (ret == -EAGAIN) { in drm_dp_aux_crc_work()
1713 if (ret == -EAGAIN) { in drm_dp_aux_crc_work()
1714 drm_dbg_kms(aux->drm_dev, "%s: Get CRC failed after retrying: %d\n", in drm_dp_aux_crc_work()
1715 aux->name, ret); in drm_dp_aux_crc_work()
1718 drm_dbg_kms(aux->drm_dev, "%s: Failed to get a CRC: %d\n", aux->name, ret); in drm_dp_aux_crc_work()
1730 * drm_dp_remote_aux_init() - minimally initialise a remote aux channel
1738 INIT_WORK(&aux->crc_work, drm_dp_aux_crc_work); in drm_dp_remote_aux_init()
1743 * drm_dp_aux_init() - minimally initialise an aux channel
1748 * grandparents to their AUX adapters (e.g. the AUX adapter is parented by a
1755 * For devices which use a separate platform device for their AUX adapters, this
1761 mutex_init(&aux->hw_mutex); in drm_dp_aux_init()
1762 mutex_init(&aux->cec.lock); in drm_dp_aux_init()
1763 INIT_WORK(&aux->crc_work, drm_dp_aux_crc_work); in drm_dp_aux_init()
1765 aux->ddc.algo = &drm_dp_i2c_algo; in drm_dp_aux_init()
1766 aux->ddc.algo_data = aux; in drm_dp_aux_init()
1767 aux->ddc.retries = 3; in drm_dp_aux_init()
1769 aux->ddc.lock_ops = &drm_dp_i2c_lock_ops; in drm_dp_aux_init()
1774 * drm_dp_aux_register() - initialise and register aux channel
1787 * For devices where the AUX channel is a device that exists independently of
1789 * recommended to call drm_dp_aux_register() after a &drm_device has been
1798 * Returns 0 on success or a negative error code on failure.
1804 WARN_ON_ONCE(!aux->drm_dev); in drm_dp_aux_register()
1806 if (!aux->ddc.algo) in drm_dp_aux_register()
1809 aux->ddc.class = I2C_CLASS_DDC; in drm_dp_aux_register()
1810 aux->ddc.owner = THIS_MODULE; in drm_dp_aux_register()
1811 aux->ddc.dev.parent = aux->dev; in drm_dp_aux_register()
1813 strlcpy(aux->ddc.name, aux->name ? aux->name : dev_name(aux->dev), in drm_dp_aux_register()
1814 sizeof(aux->ddc.name)); in drm_dp_aux_register()
1820 ret = i2c_add_adapter(&aux->ddc); in drm_dp_aux_register()
1831 * drm_dp_aux_unregister() - unregister an AUX adapter
1837 i2c_del_adapter(&aux->ddc); in drm_dp_aux_unregister()
1844 * drm_dp_psr_setup_time() - PSR setup in time usec
1866 return -EINVAL; in drm_dp_psr_setup_time()
1875 * drm_dp_start_crc() - start capture of frame CRCs
1879 * Returns 0 on success or a negative error code on failure.
1894 aux->crc_count = 0; in drm_dp_start_crc()
1895 aux->crtc = crtc; in drm_dp_start_crc()
1896 schedule_work(&aux->crc_work); in drm_dp_start_crc()
1903 * drm_dp_stop_crc() - stop capture of frame CRCs
1906 * Returns 0 on success or a negative error code on failure.
1921 flush_work(&aux->crc_work); in drm_dp_stop_crc()
1922 aux->crtc = NULL; in drm_dp_stop_crc()
1944 /* LG LP140WF6-SPM1 eDP panel */
1945 …{ OUI(0x00, 0x22, 0xb9), DEVICE_ID('s', 'i', 'v', 'a', 'r', 'T'), false, BIT(DP_DPCD_QUIRK_CONSTAN…
1959 * Get a bit mask of DPCD quirks for the sink/branch device identified by
1977 if (quirk->is_branch != is_branch) in drm_dp_get_quirks()
1980 if (memcmp(quirk->oui, ident->oui, sizeof(ident->oui)) != 0) in drm_dp_get_quirks()
1983 if (memcmp(quirk->device_id, any_device, sizeof(any_device)) != 0 && in drm_dp_get_quirks()
1984 memcmp(quirk->device_id, ident->device_id, sizeof(ident->device_id)) != 0) in drm_dp_get_quirks()
1987 quirks |= quirk->quirks; in drm_dp_get_quirks()
1997 * drm_dp_read_desc - read sink/branch descriptor from DPCD
2005 * Returns 0 on success or a negative error code on failure.
2010 struct drm_dp_dpcd_ident *ident = &desc->ident; in drm_dp_read_desc()
2018 desc->quirks = drm_dp_get_quirks(ident, is_branch); in drm_dp_read_desc()
2020 dev_id_len = strnlen(ident->device_id, sizeof(ident->device_id)); in drm_dp_read_desc()
2022 drm_dbg_kms(aux->drm_dev, in drm_dp_read_desc()
2023 "%s: DP %s: OUI %*phD dev-ID %*pE HW-rev %d.%d SW-rev %d.%d quirks 0x%04x\n", in drm_dp_read_desc()
2024 aux->name, is_branch ? "branch" : "sink", in drm_dp_read_desc()
2025 (int)sizeof(ident->oui), ident->oui, dev_id_len, in drm_dp_read_desc()
2026 ident->device_id, ident->hw_rev >> 4, ident->hw_rev & 0xf, in drm_dp_read_desc()
2027 ident->sw_major_rev, ident->sw_minor_rev, desc->quirks); in drm_dp_read_desc()
2034 * drm_dp_dsc_sink_max_slice_count() - Get the max slice count
2052 u8 slice_cap1 = dsc_dpcd[DP_DSC_SLICE_CAP_1 - DP_DSC_SUPPORT]; in drm_dp_dsc_sink_max_slice_count()
2064 u8 slice_cap2 = dsc_dpcd[DP_DSC_SLICE_CAP_2 - DP_DSC_SUPPORT]; in drm_dp_dsc_sink_max_slice_count()
2093 * drm_dp_dsc_sink_line_buf_depth() - Get the line buffer depth in bits
2109 u8 line_buf_depth = dsc_dpcd[DP_DSC_LINE_BUF_BIT_DEPTH - DP_DSC_SUPPORT]; in drm_dp_dsc_sink_line_buf_depth()
2137 * drm_dp_dsc_sink_supported_input_bpcs() - Get all the input bits per component
2157 u8 color_depth = dsc_dpcd[DP_DSC_DEC_COLOR_DEPTH_CAP - DP_DSC_SUPPORT]; in drm_dp_dsc_sink_supported_input_bpcs()
2171 * drm_dp_read_lttpr_common_caps - read the LTTPR common capabilities
2177 * Returns 0 on success or a negative error code on failure.
2197 * drm_dp_read_lttpr_phy_caps - read the capabilities for a given LTTPR PHY
2204 * Returns 0 on success or a negative error code on failure.
2226 return caps[r - DP_LT_TUNABLE_PHY_REPEATER_FIELD_DATA_STRUCTURE_REV]; in dp_lttpr_common_cap()
2230 * drm_dp_lttpr_count - get the number of detected LTTPRs
2236 * -ERANGE if more than supported number (8) of LTTPRs are detected
2237 * -EINVAL if the DP_PHY_REPEATER_CNT register contains an invalid value
2248 return 8 - ilog2(count); in drm_dp_lttpr_count()
2250 return -ERANGE; in drm_dp_lttpr_count()
2252 return -EINVAL; in drm_dp_lttpr_count()
2258 * drm_dp_lttpr_max_link_rate - get the maximum link rate supported by all LTTPRs
2272 * drm_dp_lttpr_max_lane_count - get the maximum lane count supported by all LTTPRs
2286 * drm_dp_lttpr_voltage_swing_level_3_supported - check for LTTPR vswing3 support
2302 * drm_dp_lttpr_pre_emphasis_level_3_supported - check for LTTPR preemph3 support
2306 * pre-emphasis level 3.
2318 * drm_dp_get_phy_test_pattern() - get the requested pattern from the sink.
2322 * Returns 0 on success or a negative error code on failure.
2333 data->link_rate = drm_dp_bw_code_to_link_rate(rate); in drm_dp_get_phy_test_pattern()
2338 data->num_lanes = lanes & DP_MAX_LANE_COUNT_MASK; in drm_dp_get_phy_test_pattern()
2341 data->enhanced_frame_cap = true; in drm_dp_get_phy_test_pattern()
2343 err = drm_dp_dpcd_readb(aux, DP_PHY_TEST_PATTERN, &data->phy_pattern); in drm_dp_get_phy_test_pattern()
2347 switch (data->phy_pattern) { in drm_dp_get_phy_test_pattern()
2350 &data->custom80, sizeof(data->custom80)); in drm_dp_get_phy_test_pattern()
2357 &data->hbr2_reset, in drm_dp_get_phy_test_pattern()
2358 sizeof(data->hbr2_reset)); in drm_dp_get_phy_test_pattern()
2368 * drm_dp_set_phy_test_pattern() - set the pattern to the sink.
2373 * Returns 0 on success or a negative error code on failure.
2382 link_config[0] = drm_dp_link_rate_to_bw_code(data->link_rate); in drm_dp_set_phy_test_pattern()
2383 link_config[1] = data->num_lanes; in drm_dp_set_phy_test_pattern()
2384 if (data->enhanced_frame_cap) in drm_dp_set_phy_test_pattern()
2390 test_pattern = data->phy_pattern; in drm_dp_set_phy_test_pattern()
2399 for (i = 0; i < data->num_lanes; i++) { in drm_dp_set_phy_test_pattern()
2493 return "DCI-P3"; in dp_colorimetry_get_name()
2572 vsc->revision, vsc->length); in drm_dp_vsc_sdp_log()
2574 dp_pixelformat_get_name(vsc->pixelformat)); in drm_dp_vsc_sdp_log()
2576 dp_colorimetry_get_name(vsc->pixelformat, vsc->colorimetry)); in drm_dp_vsc_sdp_log()
2577 DP_SDP_LOG(" bpc: %u\n", vsc->bpc); in drm_dp_vsc_sdp_log()
2579 dp_dynamic_range_get_name(vsc->dynamic_range)); in drm_dp_vsc_sdp_log()
2581 dp_content_type_get_name(vsc->content_type)); in drm_dp_vsc_sdp_log()
2587 * drm_dp_get_pcon_max_frl_bw() - maximum frl supported by PCON
2626 * drm_dp_pcon_frl_prepare() - Prepare PCON for FRL.
2648 * drm_dp_pcon_is_frl_ready() - Is PCON ready for FRL
2670 * drm_dp_pcon_frl_configure_1() - Set HDMI LINK Configuration-Step1
2719 return -EINVAL; in drm_dp_pcon_frl_configure_1()
2731 * drm_dp_pcon_frl_configure_2() - Set HDMI Link configuration Step-2
2761 * drm_dp_pcon_reset_frl_config() - Re-Set HDMI Link configuration.
2779 * drm_dp_pcon_frl_enable() - Enable HDMI link through FRL
2793 drm_dbg_kms(aux->drm_dev, "%s: PCON in Autonomous mode, can't enable FRL\n", in drm_dp_pcon_frl_enable()
2794 aux->name); in drm_dp_pcon_frl_enable()
2795 return -EINVAL; in drm_dp_pcon_frl_enable()
2807 * drm_dp_pcon_hdmi_link_active() - check if the PCON HDMI LINK status is active.
2826 * drm_dp_pcon_hdmi_link_mode() - get the PCON HDMI LINK MODE
2856 * drm_dp_pcon_hdmi_frl_link_error_count() - print the error count per lane
2868 struct drm_hdmi_info *hdmi = &connector->display_info.hdmi; in drm_dp_pcon_hdmi_frl_link_error_count()
2870 for (i = 0; i < hdmi->max_lanes; i++) { in drm_dp_pcon_hdmi_frl_link_error_count()
2889 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()
2890 aux->name, num_error, i); in drm_dp_pcon_hdmi_frl_link_error_count()
2896 * drm_dp_pcon_enc_is_dsc_1_2 - Does PCON Encoder supports DSC 1.2
2906 buf = pcon_dsc_dpcd[DP_PCON_DSC_VERSION - DP_PCON_DSC_ENCODER]; in drm_dp_pcon_enc_is_dsc_1_2()
2918 * drm_dp_pcon_dsc_max_slices - Get max slices supported by PCON DSC Encoder
2927 slice_cap1 = pcon_dsc_dpcd[DP_PCON_DSC_SLICE_CAP_1 - DP_PCON_DSC_ENCODER]; in drm_dp_pcon_dsc_max_slices()
2928 slice_cap2 = pcon_dsc_dpcd[DP_PCON_DSC_SLICE_CAP_2 - DP_PCON_DSC_ENCODER]; in drm_dp_pcon_dsc_max_slices()
2956 * drm_dp_pcon_dsc_max_slice_width() - Get max slice width for Pcon DSC encoder
2965 buf = pcon_dsc_dpcd[DP_PCON_DSC_MAX_SLICE_WIDTH - DP_PCON_DSC_ENCODER]; in drm_dp_pcon_dsc_max_slice_width()
2972 * drm_dp_pcon_dsc_bpp_incr() - Get bits per pixel increment for PCON DSC encoder
2981 buf = pcon_dsc_dpcd[DP_PCON_DSC_BPP_INCR - DP_PCON_DSC_ENCODER]; in drm_dp_pcon_dsc_bpp_incr()
3025 * drm_dp_pcon_pps_default() - Let PCON fill the default pps parameters
3044 * drm_dp_pcon_pps_override_buf() - Configure PPS encoder override buffer for
3068 * drm_dp_pcon_pps_override_param() - Write PPS parameters to DSC encoder
3099 * drm_dp_pcon_convert_rgb_to_ycbcr() - Configure the PCon to convert RGB to Ycbcr
3101 * @color_spc: Color-space/s for which conversion is to be enabled, 0 for disable.
3128 * drm_edp_backlight_set_level() - Set the backlight level of an eDP panel via AUX
3144 if (bl->lsb_reg_used) { in drm_edp_backlight_set_level()
3153 drm_err(aux->drm_dev, in drm_edp_backlight_set_level()
3155 aux->name, ret); in drm_edp_backlight_set_level()
3156 return ret < 0 ? ret : -EIO; in drm_edp_backlight_set_level()
3171 if (!bl->aux_enable) in drm_edp_backlight_set_enable()
3176 drm_err(aux->drm_dev, "%s: Failed to read eDP display control register: %d\n", in drm_edp_backlight_set_enable()
3177 aux->name, ret); in drm_edp_backlight_set_enable()
3178 return ret < 0 ? ret : -EIO; in drm_edp_backlight_set_enable()
3187 drm_err(aux->drm_dev, "%s: Failed to write eDP display control register: %d\n", in drm_edp_backlight_set_enable()
3188 aux->name, ret); in drm_edp_backlight_set_enable()
3189 return ret < 0 ? ret : -EIO; in drm_edp_backlight_set_enable()
3196 * drm_edp_backlight_enable() - Enable an eDP panel's backlight using DPCD
3201 * This function handles enabling DPCD backlight controls on a panel over DPCD, while additionally
3221 drm_dbg_kms(aux->drm_dev, in drm_edp_backlight_enable()
3222 "%s: Failed to read backlight mode: %d\n", aux->name, ret); in drm_edp_backlight_enable()
3223 return ret < 0 ? ret : -EIO; in drm_edp_backlight_enable()
3232 if (bl->pwmgen_bit_count) { in drm_edp_backlight_enable()
3233 ret = drm_dp_dpcd_writeb(aux, DP_EDP_PWMGEN_BIT_COUNT, bl->pwmgen_bit_count); in drm_edp_backlight_enable()
3235 drm_dbg_kms(aux->drm_dev, "%s: Failed to write aux pwmgen bit count: %d\n", in drm_edp_backlight_enable()
3236 aux->name, ret); in drm_edp_backlight_enable()
3240 if (bl->pwm_freq_pre_divider) { in drm_edp_backlight_enable()
3241 ret = drm_dp_dpcd_writeb(aux, DP_EDP_BACKLIGHT_FREQ_SET, bl->pwm_freq_pre_divider); in drm_edp_backlight_enable()
3243 drm_dbg_kms(aux->drm_dev, in drm_edp_backlight_enable()
3245 aux->name, ret); in drm_edp_backlight_enable()
3253 drm_dbg_kms(aux->drm_dev, "%s: Failed to write aux backlight mode: %d\n", in drm_edp_backlight_enable()
3254 aux->name, ret); in drm_edp_backlight_enable()
3255 return ret < 0 ? ret : -EIO; in drm_edp_backlight_enable()
3271 * drm_edp_backlight_disable() - Disable an eDP backlight using DPCD, if supported
3275 * This function handles disabling DPCD backlight controls on a panel over AUX. Note that some
3278 * %false, this function will become a no-op (and we will skip updating
3282 * Returns: %0 on success or no-op, negative error code on failure.
3306 drm_dbg_kms(aux->drm_dev, "%s: Failed to read pwmgen bit count cap: %d\n", in drm_edp_backlight_probe_max()
3307 aux->name, ret); in drm_edp_backlight_probe_max()
3308 return -ENODEV; in drm_edp_backlight_probe_max()
3312 bl->max = (1 << pn) - 1; in drm_edp_backlight_probe_max()
3319 * - Where F = PWM Frequency Pre-Divider value programmed by field 7:0 of the in drm_edp_backlight_probe_max()
3321 * - Where P = 2^Pn, where Pn is the value programmed by field 4:0 of the in drm_edp_backlight_probe_max()
3333 * - Pn is in the range of Pn_min and Pn_max in drm_edp_backlight_probe_max()
3334 * - F is in the range of 1 and 255 in drm_edp_backlight_probe_max()
3335 * - FxP is within 25% of desired value. in drm_edp_backlight_probe_max()
3340 drm_dbg_kms(aux->drm_dev, "%s: Failed to read pwmgen bit count cap min: %d\n", in drm_edp_backlight_probe_max()
3341 aux->name, ret); in drm_edp_backlight_probe_max()
3346 drm_dbg_kms(aux->drm_dev, "%s: Failed to read pwmgen bit count cap max: %d\n", in drm_edp_backlight_probe_max()
3347 aux->name, ret); in drm_edp_backlight_probe_max()
3357 drm_dbg_kms(aux->drm_dev, in drm_edp_backlight_probe_max()
3359 aux->name, driver_pwm_freq_hz); in drm_edp_backlight_probe_max()
3363 for (pn = pn_max; pn >= pn_min; pn--) { in drm_edp_backlight_probe_max()
3372 drm_dbg_kms(aux->drm_dev, "%s: Failed to write aux pwmgen bit count: %d\n", in drm_edp_backlight_probe_max()
3373 aux->name, ret); in drm_edp_backlight_probe_max()
3376 bl->pwmgen_bit_count = pn; in drm_edp_backlight_probe_max()
3377 bl->max = (1 << pn) - 1; in drm_edp_backlight_probe_max()
3380 bl->pwm_freq_pre_divider = f; in drm_edp_backlight_probe_max()
3381 drm_dbg_kms(aux->drm_dev, "%s: Using backlight frequency from driver (%dHz)\n", in drm_edp_backlight_probe_max()
3382 aux->name, driver_pwm_freq_hz); in drm_edp_backlight_probe_max()
3398 drm_dbg_kms(aux->drm_dev, "%s: Failed to read backlight mode: %d\n", in drm_edp_backlight_probe_level()
3399 aux->name, ret); in drm_edp_backlight_probe_level()
3400 return ret < 0 ? ret : -EIO; in drm_edp_backlight_probe_level()
3405 int size = 1 + bl->lsb_reg_used; in drm_edp_backlight_probe_level()
3409 drm_dbg_kms(aux->drm_dev, "%s: Failed to read backlight level: %d\n", in drm_edp_backlight_probe_level()
3410 aux->name, ret); in drm_edp_backlight_probe_level()
3411 return ret < 0 ? ret : -EIO; in drm_edp_backlight_probe_level()
3414 if (bl->lsb_reg_used) in drm_edp_backlight_probe_level()
3424 return bl->max; in drm_edp_backlight_probe_level()
3428 * drm_edp_backlight_init() - Probe a display panel's TCON using the standard VESA eDP backlight
3433 * @edp_dpcd: A cached copy of the eDP DPCD
3437 * Initializes a &drm_edp_backlight_info struct by probing @aux for it's backlight capabilities,
3440 * If @driver_pwm_freq_hz is non-zero, this will be used as the backlight frequency. Otherwise, the
3453 bl->aux_enable = true; in drm_edp_backlight_init()
3455 bl->lsb_reg_used = true; in drm_edp_backlight_init()
3466 drm_dbg_kms(aux->drm_dev, in drm_edp_backlight_init()
3468 aux->name, *current_level, bl->max, bl->pwm_freq_pre_divider, *current_mode); in drm_edp_backlight_init()
3469 drm_dbg_kms(aux->drm_dev, in drm_edp_backlight_init()
3471 aux->name, bl->pwmgen_bit_count, bl->lsb_reg_used, bl->aux_enable); in drm_edp_backlight_init()
3486 if (!bl->enabled) { in dp_aux_backlight_update_status()
3487 drm_edp_backlight_enable(bl->aux, &bl->info, brightness); in dp_aux_backlight_update_status()
3488 bl->enabled = true; in dp_aux_backlight_update_status()
3491 ret = drm_edp_backlight_set_level(bl->aux, &bl->info, brightness); in dp_aux_backlight_update_status()
3493 if (bl->enabled) { in dp_aux_backlight_update_status()
3494 drm_edp_backlight_disable(bl->aux, &bl->info); in dp_aux_backlight_update_status()
3495 bl->enabled = false; in dp_aux_backlight_update_status()
3507 * drm_panel_dp_aux_backlight - create and use DP AUX backlight
3515 * When the panel is enabled backlight will be enabled after a
3521 * A typical implementation for a panel driver supporting backlight
3528 * Return: 0 on success or a negative error code on failure.
3539 if (!panel || !panel->dev || !aux) in drm_panel_dp_aux_backlight()
3540 return -EINVAL; in drm_panel_dp_aux_backlight()
3548 DRM_DEV_INFO(panel->dev, "DP AUX backlight is not supported\n"); in drm_panel_dp_aux_backlight()
3552 bl = devm_kzalloc(panel->dev, sizeof(*bl), GFP_KERNEL); in drm_panel_dp_aux_backlight()
3554 return -ENOMEM; in drm_panel_dp_aux_backlight()
3556 bl->aux = aux; in drm_panel_dp_aux_backlight()
3558 ret = drm_edp_backlight_init(aux, &bl->info, 0, edp_dpcd, in drm_panel_dp_aux_backlight()
3565 props.max_brightness = bl->info.max; in drm_panel_dp_aux_backlight()
3567 bl->base = devm_backlight_device_register(panel->dev, "dp_aux_backlight", in drm_panel_dp_aux_backlight()
3568 panel->dev, bl, in drm_panel_dp_aux_backlight()
3570 if (IS_ERR(bl->base)) in drm_panel_dp_aux_backlight()
3571 return PTR_ERR(bl->base); in drm_panel_dp_aux_backlight()
3573 backlight_disable(bl->base); in drm_panel_dp_aux_backlight()
3575 panel->backlight = bl->base; in drm_panel_dp_aux_backlight()