diff --git a/src/dcp.c b/src/dcp.c index f0e873c8..8cccf4f5 100644 --- a/src/dcp.c +++ b/src/dcp.c @@ -67,7 +67,7 @@ static int dcp_hdmi_dptx_init(dcp_dev_t *dcp, const display_config_t *cfg) return -1; } - dcp->dptx_ep = dcp_dptx_init(dcp); + dcp->dptx_ep = dcp_dptx_init(dcp, cfg->num_dptxports); if (!dcp->dptx_ep) { printf("dcp: failed to initialize dptx-port endpoint\n"); dcp_dpav_shutdown(dcp->dpav_ep); diff --git a/src/dcp.h b/src/dcp.h index 5046b3d5..fb323184 100644 --- a/src/dcp.h +++ b/src/dcp.h @@ -20,6 +20,7 @@ typedef struct { const char dp2hdmi_gpio[24]; const char pmgr_dev[24]; u32 dcp_index; + u8 num_dptxports; u8 die; } display_config_t; diff --git a/src/dcp/dptx_port_ep.c b/src/dcp/dptx_port_ep.c index 4fabb3ea..cfe0deb3 100644 --- a/src/dcp/dptx_port_ep.c +++ b/src/dcp/dptx_port_ep.c @@ -13,8 +13,7 @@ #include "../types.h" #include "../utils.h" -#define DCP_DPTX_PORT_ENDPOINT 0x2a -#define DCP_DPTX_PORT_NUM_SERVICES 2 +#define DCP_DPTX_PORT_ENDPOINT 0x2a #define TXBUF_LEN 0x4000 #define RXBUF_LEN 0x4000 @@ -546,7 +545,7 @@ int dcp_dptx_disconnect(dcp_dptx_if_t *dptx, u32 port) return 0; } -dcp_dptx_if_t *dcp_dptx_init(dcp_dev_t *dcp) +dcp_dptx_if_t *dcp_dptx_init(dcp_dev_t *dcp, u32 num_dptxports) { dcp_dptx_if_t *dptx = calloc(1, sizeof(dcp_dptx_if_t)); if (!dptx) @@ -559,8 +558,7 @@ dcp_dptx_if_t *dcp_dptx_init(dcp_dev_t *dcp) goto err_free; } - int err = afk_epic_start_interface(dptx->epic, dptx, DCP_DPTX_PORT_NUM_SERVICES, TXBUF_LEN, - RXBUF_LEN); + int err = afk_epic_start_interface(dptx->epic, dptx, num_dptxports, TXBUF_LEN, RXBUF_LEN); if (err < 0) { printf("dcp-dptx: failed to initialize DPTXRemotePort interface\n"); goto err_shutdown; diff --git a/src/dcp/dptx_port_ep.h b/src/dcp/dptx_port_ep.h index 8e520c2e..5a1eff13 100644 --- a/src/dcp/dptx_port_ep.h +++ b/src/dcp/dptx_port_ep.h @@ -52,7 +52,7 @@ enum dptx_link_rate { LINK_RATE_HBR3 = 0x1e, }; -dcp_dptx_if_t *dcp_dptx_init(dcp_dev_t *dcp); +dcp_dptx_if_t *dcp_dptx_init(dcp_dev_t *dcp, u32 num_dptxports); int dcp_dptx_shutdown(dcp_dptx_if_t *dptx); int dcp_dptx_connect(dcp_dptx_if_t *dptx, dptx_phy_t *phy, u32 port); diff --git a/src/display.c b/src/display.c index ebe9c621..d1bf614f 100644 --- a/src/display.c +++ b/src/display.c @@ -45,6 +45,7 @@ static const display_config_t display_config_m2 = { .dptx_phy = "/arm-io/dptx-phy", .pmgr_dev = "DISP0_CPU0", .dcp_index = 0, + .num_dptxports = 2, }; static const display_config_t display_config_m2_pro_max = { @@ -55,6 +56,7 @@ static const display_config_t display_config_m2_pro_max = { .dptx_phy = "/arm-io/lpdptx-phy0", .pmgr_dev = "DISP0_CPU0", .dcp_index = 0, + .num_dptxports = 1, }; static const display_config_t display_config_m2_ultra = { @@ -65,6 +67,7 @@ static const display_config_t display_config_m2_ultra = { .dptx_phy = "/arm-io/lpdptx-phy1", .pmgr_dev = "DISPEXT4_CPU0", .dcp_index = 1, + .num_dptxports = 2, .die = 1, };