soc/intel/common: Add helper function to get DP mode

The patch adds helper function to get the DP mode.

TEST=Build the code for Rex

Signed-off-by: Sridhar Siricilla <sridhar.siricilla@intel.com>
Change-Id: I02ed1f818e77c37ead8ce962fa12fddfdc8efeb6
Reviewed-on: https://review.coreboot.org/c/coreboot/+/70507
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Subrata Banik <subratabanik@google.com>
This commit is contained in:
Sridhar Siricilla 2022-12-08 16:15:16 +05:30 committed by Felix Held
parent e64b8ac1e7
commit f9ee35ea34
1 changed files with 17 additions and 24 deletions

View File

@ -11,6 +11,7 @@
#include <intelblocks/systemagent.h> #include <intelblocks/systemagent.h>
#include <intelblocks/tcss.h> #include <intelblocks/tcss.h>
#include <inttypes.h> #include <inttypes.h>
#include <lib.h>
#include <security/vboot/vboot_common.h> #include <security/vboot/vboot_common.h>
#include <soc/pci_devs.h> #include <soc/pci_devs.h>
#include <soc/pcr_ids.h> #include <soc/pcr_ids.h>
@ -204,6 +205,21 @@ static int send_pmc_dp_hpd_request(int port, const struct usbc_mux_info *mux_dat
return send_pmc_req(HPD_REQ, &req, &rsp, PMC_IPC_HPD_REQ_SIZE); return send_pmc_req(HPD_REQ, &req, &rsp, PMC_IPC_HPD_REQ_SIZE);
} }
static uint8_t get_dp_mode(uint8_t dp_pin_mode)
{
switch (dp_pin_mode) {
case MODE_DP_PIN_A:
case MODE_DP_PIN_B:
case MODE_DP_PIN_C:
case MODE_DP_PIN_D:
case MODE_DP_PIN_E:
case MODE_DP_PIN_F:
return log2(dp_pin_mode) + 1;
default:
return 0;
}
}
static int send_pmc_dp_mode_request(int port, const struct usbc_mux_info *mux_data, static int send_pmc_dp_mode_request(int port, const struct usbc_mux_info *mux_data,
const struct tcss_port_map *port_map) const struct tcss_port_map *port_map)
{ {
@ -227,30 +243,7 @@ static int send_pmc_dp_mode_request(int port, const struct usbc_mux_info *mux_da
GET_TCSS_ALT_FIELD(USB3, cmd), GET_TCSS_ALT_FIELD(USB3, cmd),
GET_TCSS_ALT_FIELD(MODE, cmd)); GET_TCSS_ALT_FIELD(MODE, cmd));
switch (mux_data->dp_pin_mode) { dp_mode = get_dp_mode(mux_data->dp_pin_mode);
case MODE_DP_PIN_A:
dp_mode = 1;
break;
case MODE_DP_PIN_B:
dp_mode = 2;
break;
case MODE_DP_PIN_C:
dp_mode = 3;
break;
case MODE_DP_PIN_D:
dp_mode = 4;
break;
case MODE_DP_PIN_E:
dp_mode = 5;
break;
case MODE_DP_PIN_F:
dp_mode = 6;
break;
default:
dp_mode = 0;
break;
}
cmd = tcss_make_alt_mode_cmd_buf_1( cmd = tcss_make_alt_mode_cmd_buf_1(
mux_data->polarity, mux_data->polarity,
mux_data->cable, mux_data->cable,