drivers: snsn65dsi86: Fix link rate parsing

DP link rates are reported in an array of LE16 values. The current code
tries to parse them as 8-bit which doesn't get very far, causing us to
always drop into the fallback path. This patch should fix the issue
(+minor whitespace cleanup).

BUG=b:170630766

Signed-off-by: Julius Werner <jwerner@chromium.org>
Change-Id: I1e03088ee2d3517bdb5dcc4dcc4ac04f8b14a391
Reviewed-on: https://review.coreboot.org/c/coreboot/+/46318
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Douglas Anderson <dianders@chromium.org>
This commit is contained in:
Julius Werner 2020-10-12 15:32:52 -07:00
parent b73d2476dc
commit 6b8305d240
1 changed files with 5 additions and 7 deletions

View File

@ -259,11 +259,11 @@ static void sn65dsi86_bridge_valid_dp_rates(uint8_t bus, uint8_t chip, bool rate
DP_BRIDGE_DPCD_REV, 1, DPCD_READ, &dpcd_val); DP_BRIDGE_DPCD_REV, 1, DPCD_READ, &dpcd_val);
if (dpcd_val >= DP_BRIDGE_14) { if (dpcd_val >= DP_BRIDGE_14) {
/* eDP 1.4 devices must provide a custom table */ /* eDP 1.4 devices must provide a custom table */
uint8_t sink_rates[DP_MAX_SUPPORTED_RATES * 2]; uint16_t sink_rates[DP_MAX_SUPPORTED_RATES] = {0};
sn65dsi86_bridge_dpcd_request(bus, chip, DP_SUPPORTED_LINK_RATES, sn65dsi86_bridge_dpcd_request(bus, chip, DP_SUPPORTED_LINK_RATES,
sizeof(sink_rates), sizeof(sink_rates),
DPCD_READ, sink_rates); DPCD_READ, (void *)sink_rates);
for (i = 0; i < ARRAY_SIZE(sink_rates); i++) { for (i = 0; i < ARRAY_SIZE(sink_rates); i++) {
rate_per_200khz = le16_to_cpu(sink_rates[i]); rate_per_200khz = le16_to_cpu(sink_rates[i]);
@ -288,13 +288,11 @@ static void sn65dsi86_bridge_valid_dp_rates(uint8_t bus, uint8_t chip, bool rate
} }
/* On older versions best we can do is use DP_MAX_LINK_RATE */ /* On older versions best we can do is use DP_MAX_LINK_RATE */
sn65dsi86_bridge_dpcd_request(bus, chip, sn65dsi86_bridge_dpcd_request(bus, chip, DP_MAX_LINK_RATE, 1, DPCD_READ, &dpcd_val);
DP_MAX_LINK_RATE, 1, DPCD_READ, &dpcd_val);
switch (dpcd_val) { switch (dpcd_val) {
default: default:
printk(BIOS_ERR, printk(BIOS_ERR, "Unexpected max rate (%#x); assuming 5.4 GHz\n",
"Unexpected max rate (%#x); assuming 5.4 GHz\n",
(int)dpcd_val); (int)dpcd_val);
/* fall through */ /* fall through */
case DP_LINK_BW_5_4: case DP_LINK_BW_5_4: