tc_port
enum tc_port tc_port = intel_encoder_to_tc(encoder);
intel_de_rmw(display, MG_TX1_LINK_PARAMS(ln, tc_port),
intel_de_rmw(display, MG_TX2_LINK_PARAMS(ln, tc_port),
intel_de_rmw(display, MG_TX1_SWINGCTRL(ln, tc_port),
intel_de_rmw(display, MG_TX2_SWINGCTRL(ln, tc_port),
intel_de_rmw(display, MG_TX1_DRVCTRL(ln, tc_port),
intel_de_rmw(display, MG_TX2_DRVCTRL(ln, tc_port),
intel_de_rmw(display, MG_CLKHUB(ln, tc_port),
intel_de_rmw(display, MG_TX1_DCC(ln, tc_port),
intel_de_rmw(display, MG_TX2_DCC(ln, tc_port),
intel_de_rmw(display, MG_TX1_PISO_READLOAD(ln, tc_port),
intel_de_rmw(display, MG_TX2_PISO_READLOAD(ln, tc_port),
enum tc_port tc_port = intel_encoder_to_tc(encoder);
intel_dkl_phy_rmw(display, DKL_TX_DPCNTL2(tc_port, ln),
intel_dkl_phy_rmw(display, DKL_TX_DPCNTL2(tc_port, ln),
intel_dkl_phy_write(display, DKL_TX_PMD_LANE_SUS(tc_port, ln), 0);
intel_dkl_phy_rmw(display, DKL_TX_DPCNTL0(tc_port, ln),
intel_dkl_phy_rmw(display, DKL_TX_DPCNTL1(tc_port, ln),
intel_dkl_phy_rmw(display, DKL_TX_DPCNTL2(tc_port, ln),
intel_dkl_phy_rmw(display, DKL_TX_DPCNTL2(tc_port, ln),
enum tc_port tc_port = intel_encoder_to_tc(encoder);
ICL_DPCLKA_CFGCR0_TC_CLK_OFF(tc_port), 0);
enum tc_port tc_port = intel_encoder_to_tc(encoder);
0, ICL_DPCLKA_CFGCR0_TC_CLK_OFF(tc_port));
enum tc_port tc_port = intel_encoder_to_tc(encoder);
return !(tmp & ICL_DPCLKA_CFGCR0_TC_CLK_OFF(tc_port));
enum tc_port tc_port = intel_encoder_to_tc(encoder);
id = icl_tc_port_to_pll_id(tc_port);
enum tc_port tc_port, u32 ln0, u32 ln1)
if (ln0 != intel_dkl_phy_read(display, DKL_DP_MODE(tc_port, 0)))
intel_dkl_phy_write(display, DKL_DP_MODE(tc_port, 0), ln0);
if (ln1 != intel_dkl_phy_read(display, DKL_DP_MODE(tc_port, 1)))
intel_dkl_phy_write(display, DKL_DP_MODE(tc_port, 1), ln1);
enum tc_port tc_port = intel_encoder_to_tc(&dig_port->base);
ln0 = intel_dkl_phy_read(display, DKL_DP_MODE(tc_port, 0));
ln1 = intel_dkl_phy_read(display, DKL_DP_MODE(tc_port, 1));
ln0 = intel_de_read(display, MG_DP_MODE(0, tc_port));
ln1 = intel_de_read(display, MG_DP_MODE(1, tc_port));
intel_dkl_phy_write(display, DKL_DP_MODE(tc_port, 0), ln0);
intel_dkl_phy_write(display, DKL_DP_MODE(tc_port, 1), ln1);
tgl_dkl_phy_check_and_rewrite(display, tc_port, ln0, ln1);
intel_de_write(display, MG_DP_MODE(0, tc_port), ln0);
intel_de_write(display, MG_DP_MODE(1, tc_port), ln1);
enum tc_port tc_port = intel_encoder_to_tc(encoder);
intel_dkl_phy_rmw(display, DKL_PCS_DW5(tc_port, ln),
#define tc_port_name(tc_port) ((tc_port) - TC_PORT_1 + '1')
enum tc_port tc_port = intel_tc_phy_port_to_tc(display, port);
tc_port != TC_PORT_NONE ? "TC" : "",
tc_port != TC_PORT_NONE ? tc_port_name(tc_port) : phy_name(phy));
enum tc_port tc_port = intel_tc_phy_port_to_tc(display, port);
tc_port != TC_PORT_NONE ? "TC" : "",
tc_port != TC_PORT_NONE ? tc_port_name(tc_port) : phy_name(phy));
enum tc_port intel_port_to_tc(struct intel_display *display, enum port port)
enum tc_port intel_tc_phy_port_to_tc(struct intel_display *display, enum port port)
enum tc_port intel_encoder_to_tc(struct intel_encoder *encoder)
enum tc_port intel_port_to_tc(struct intel_display *display, enum port port);
enum tc_port intel_tc_phy_port_to_tc(struct intel_display *display, enum port port);
enum tc_port intel_encoder_to_tc(struct intel_encoder *encoder);
enum tc_port tc_port;
tc_port = TGL_AUX_PW_TO_TC_PORT(i915_power_well_instance(power_well)->hsw.idx);
ret = poll_timeout_us(val = intel_dkl_phy_read(display, DKL_CMN_UC_DW_27(tc_port)),
#define ICL_DPCLKA_CFGCR0_TC_CLK_OFF(tc_port) (1 << ((tc_port) < TC_PORT_4 ? \
(tc_port) + 12 : \
(tc_port) - TC_PORT_4 + 21))
#define MG_PLL_ENABLE(tc_port) _MMIO_PORT((tc_port), _MG_PLL1_ENABLE, \
#define ADLP_PORTTC_PLL_ENABLE(tc_port) _MMIO_PORT((tc_port), \
enum tc_port tc_port = DKL_REG_TC_PORT(reg);
tc_port < TC_PORT_1 || tc_port >= I915_MAX_TC_PORTS))
HIP_INDEX_REG(tc_port),
HIP_INDEX_VAL(tc_port, reg.bank_idx));
#define DKL_PLL_TDC_COLDST_BIAS(tc_port) _DKL_REG(tc_port, \
#define DKL_REFCLKIN_CTL(tc_port) _DKL_REG(tc_port, \
#define DKL_CLKTOP2_HSCLKCTL(rc_port) _DKL_REG(tc_port, \
#define DKL_CLKTOP2_CORECLKCTL1(tc_port) _DKL_REG(tc_port, \
#define DKL_TX_DPCNTL0(tc_port, ln) _DKL_REG_LN(tc_port, ln, \
#define DKL_TX_DPCNTL1(tc_port, ln) _DKL_REG_LN(tc_port, ln, \
#define DKL_TX_DPCNTL2(tc_port, ln) _DKL_REG_LN(tc_port, ln, \
#define DKL_TX_FW_CALIB(tc_port, ln) _DKL_REG_LN(tc_port, ln, \
#define DKL_TX_PMD_LANE_SUS(tc_port, ln) _DKL_REG_LN(tc_port, ln, \
#define DKL_TX_DW17(tc_port, ln) _DKL_REG_LN(tc_port, ln, \
#define DKL_TX_DW18(tc_port, ln) _DKL_REG_LN(tc_port, ln, \
#define DKL_DP_MODE(tc_port, ln) _DKL_REG_LN(tc_port, ln, \
#define DKL_CMN_UC_DW_27(tc_port) _DKL_REG(tc_port, \
#define HIP_INDEX_REG(tc_port) _MMIO((tc_port) < 4 ? _HIP_INDEX_REG0 \
#define _HIP_INDEX_SHIFT(tc_port) (8 * ((tc_port) % 4))
#define HIP_INDEX_VAL(tc_port, val) ((val) << _HIP_INDEX_SHIFT(tc_port))
#define _DKL_REG_PHY_BASE(tc_port) _PORT(tc_port, \
#define _DKL_REG(tc_port, phy_offset) \
.reg = _DKL_REG_PHY_BASE(tc_port) + \
#define _DKL_REG_LN(tc_port, ln_idx, ln0_offs, ln1_offs) \
_DKL_REG(tc_port, (ln0_offs) + (ln_idx) * ((ln1_offs) - (ln0_offs)))
#define DKL_PCS_DW5(tc_port, ln) _DKL_REG_LN(tc_port, ln, \
#define DKL_PLL_DIV0(tc_port) _DKL_REG(tc_port, \
#define DKL_PLL_DIV1(tc_port) _DKL_REG(tc_port, \
#define DKL_PLL_SSC(tc_port) _DKL_REG(tc_port, \
#define DKL_PLL_BIAS(tc_port) _DKL_REG(tc_port, \
static enum tc_port icl_pll_id_to_tc_port(enum intel_dpll_id id)
enum intel_dpll_id icl_tc_port_to_pll_id(enum tc_port tc_port)
return tc_port - TC_PORT_1 + DPLL_ID_ICL_MGPLL1;
enum tc_port tc_port = icl_pll_id_to_tc_port(id);
return ADLP_PORTTC_PLL_ENABLE(tc_port);
return MG_PLL_ENABLE(tc_port);
enum tc_port tc_port = icl_pll_id_to_tc_port(id);
MG_REFCLKIN_CTL(tc_port));
intel_de_read(display, MG_CLKTOP2_CORECLKCTL1(tc_port));
intel_de_read(display, MG_CLKTOP2_HSCLKCTL(tc_port));
hw_state->mg_pll_div0 = intel_de_read(display, MG_PLL_DIV0(tc_port));
hw_state->mg_pll_div1 = intel_de_read(display, MG_PLL_DIV1(tc_port));
hw_state->mg_pll_lf = intel_de_read(display, MG_PLL_LF(tc_port));
MG_PLL_FRAC_LOCK(tc_port));
hw_state->mg_pll_ssc = intel_de_read(display, MG_PLL_SSC(tc_port));
hw_state->mg_pll_bias = intel_de_read(display, MG_PLL_BIAS(tc_port));
intel_de_read(display, MG_PLL_TDC_COLDST_BIAS(tc_port));
enum tc_port tc_port = icl_pll_id_to_tc_port(id);
DKL_REFCLKIN_CTL(tc_port));
intel_dkl_phy_read(display, DKL_CLKTOP2_HSCLKCTL(tc_port));
intel_dkl_phy_read(display, DKL_CLKTOP2_CORECLKCTL1(tc_port));
hw_state->mg_pll_div0 = intel_dkl_phy_read(display, DKL_PLL_DIV0(tc_port));
hw_state->mg_pll_div1 = intel_dkl_phy_read(display, DKL_PLL_DIV1(tc_port));
hw_state->mg_pll_ssc = intel_dkl_phy_read(display, DKL_PLL_SSC(tc_port));
hw_state->mg_pll_bias = intel_dkl_phy_read(display, DKL_PLL_BIAS(tc_port));
intel_dkl_phy_read(display, DKL_PLL_TDC_COLDST_BIAS(tc_port));
enum tc_port tc_port = icl_pll_id_to_tc_port(pll->info->id);
intel_de_rmw(display, MG_REFCLKIN_CTL(tc_port),
intel_de_rmw(display, MG_CLKTOP2_CORECLKCTL1(tc_port),
intel_de_rmw(display, MG_CLKTOP2_HSCLKCTL(tc_port),
intel_de_write(display, MG_PLL_DIV0(tc_port), hw_state->mg_pll_div0);
intel_de_write(display, MG_PLL_DIV1(tc_port), hw_state->mg_pll_div1);
intel_de_write(display, MG_PLL_LF(tc_port), hw_state->mg_pll_lf);
intel_de_write(display, MG_PLL_FRAC_LOCK(tc_port),
intel_de_write(display, MG_PLL_SSC(tc_port), hw_state->mg_pll_ssc);
intel_de_rmw(display, MG_PLL_BIAS(tc_port),
intel_de_rmw(display, MG_PLL_TDC_COLDST_BIAS(tc_port),
intel_de_posting_read(display, MG_PLL_TDC_COLDST_BIAS(tc_port));
enum tc_port tc_port = icl_pll_id_to_tc_port(pll->info->id);
val = intel_dkl_phy_read(display, DKL_REFCLKIN_CTL(tc_port));
intel_dkl_phy_write(display, DKL_REFCLKIN_CTL(tc_port), val);
val = intel_dkl_phy_read(display, DKL_CLKTOP2_CORECLKCTL1(tc_port));
intel_dkl_phy_write(display, DKL_CLKTOP2_CORECLKCTL1(tc_port), val);
val = intel_dkl_phy_read(display, DKL_CLKTOP2_HSCLKCTL(tc_port));
intel_dkl_phy_write(display, DKL_CLKTOP2_HSCLKCTL(tc_port), val);
intel_dkl_phy_rmw(display, DKL_PLL_DIV0(tc_port), val,
val = intel_dkl_phy_read(display, DKL_PLL_DIV1(tc_port));
intel_dkl_phy_write(display, DKL_PLL_DIV1(tc_port), val);
val = intel_dkl_phy_read(display, DKL_PLL_SSC(tc_port));
intel_dkl_phy_write(display, DKL_PLL_SSC(tc_port), val);
val = intel_dkl_phy_read(display, DKL_PLL_BIAS(tc_port));
intel_dkl_phy_write(display, DKL_PLL_BIAS(tc_port), val);
val = intel_dkl_phy_read(display, DKL_PLL_TDC_COLDST_BIAS(tc_port));
intel_dkl_phy_write(display, DKL_PLL_TDC_COLDST_BIAS(tc_port), val);
intel_dkl_phy_posting_read(display, DKL_PLL_TDC_COLDST_BIAS(tc_port));
enum tc_port;
enum intel_dpll_id icl_tc_port_to_pll_id(enum tc_port tc_port);
#define MG_CLKHUB(ln, tc_port) \
MG_PHY_PORT_LN(ln, tc_port, MG_CLKHUB_LN0_PORT1, \
#define MG_PHY_PORT_LN(ln, tc_port, ln0p1, ln0p2, ln1p1) \
#define MG_TX1_DCC(ln, tc_port) \
MG_PHY_PORT_LN(ln, tc_port, MG_TX_DCC_TX1LN0_PORT1, \
_MMIO(_PORT(tc_port, ln0p1, ln0p2) + (ln) * ((ln1p1) - (ln0p1)))
#define MG_TX2_DCC(ln, tc_port) \
MG_PHY_PORT_LN(ln, tc_port, MG_TX_DCC_TX2LN0_PORT1, \
#define MG_DP_MODE(ln, tc_port) \
MG_PHY_PORT_LN(ln, tc_port, MG_DP_MODE_LN0_ACU_PORT1, \
#define MG_REFCLKIN_CTL(tc_port) _MMIO_PORT((tc_port), \
#define MG_CLKTOP2_CORECLKCTL1(tc_port) _MMIO_PORT((tc_port), \
#define MG_TX1_LINK_PARAMS(ln, tc_port) \
MG_PHY_PORT_LN(ln, tc_port, MG_TX_LINK_PARAMS_TX1LN0_PORT1, \
#define MG_CLKTOP2_HSCLKCTL(tc_port) _MMIO_PORT((tc_port), \
#define MG_PLL_DIV0(tc_port) _MMIO_PORT((tc_port), _MG_PLL_DIV0_PORT1, \
#define MG_PLL_DIV1(tc_port) _MMIO_PORT((tc_port), _MG_PLL_DIV1_PORT1, \
#define MG_PLL_LF(tc_port) _MMIO_PORT((tc_port), _MG_PLL_LF_PORT1, \
#define MG_PLL_FRAC_LOCK(tc_port) _MMIO_PORT((tc_port), \
#define MG_PLL_SSC(tc_port) _MMIO_PORT((tc_port), _MG_PLL_SSC_PORT1, \
#define MG_PLL_BIAS(tc_port) _MMIO_PORT((tc_port), _MG_PLL_BIAS_PORT1, \
#define MG_TX2_LINK_PARAMS(ln, tc_port) \
#define MG_PLL_TDC_COLDST_BIAS(tc_port) _MMIO_PORT((tc_port), \
MG_PHY_PORT_LN(ln, tc_port, MG_TX_LINK_PARAMS_TX2LN0_PORT1, \
#define MG_TX1_PISO_READLOAD(ln, tc_port) \
MG_PHY_PORT_LN(ln, tc_port, MG_TX_PISO_READLOAD_TX1LN0_PORT1, \
#define MG_TX2_PISO_READLOAD(ln, tc_port) \
MG_PHY_PORT_LN(ln, tc_port, MG_TX_PISO_READLOAD_TX2LN0_PORT1, \
#define MG_TX1_SWINGCTRL(ln, tc_port) \
MG_PHY_PORT_LN(ln, tc_port, MG_TX_SWINGCTRL_TX1LN0_PORT1, \
#define MG_TX2_SWINGCTRL(ln, tc_port) \
MG_PHY_PORT_LN(ln, tc_port, MG_TX_SWINGCTRL_TX2LN0_PORT1, \
#define MG_TX1_DRVCTRL(ln, tc_port) \
MG_PHY_PORT_LN(ln, tc_port, MG_TX_DRVCTRL_TX1LN0_TXPORT1, \
#define MG_TX2_DRVCTRL(ln, tc_port) \
MG_PHY_PORT_LN(ln, tc_port, MG_TX_DRVCTRL_TX2LN0_PORT1, \
enum tc_port tc_port = intel_encoder_to_tc(&dig_port->base);
if (drm_WARN_ON(display->drm, tc_port == TC_PORT_NONE))
tc_port + 1);
enum tc_port tc_port = intel_encoder_to_tc(&tc->dig_port->base);
if (tc_port == TC_PORT_NONE)
return POWER_DOMAIN_PORT_DDI_LANES_TC1 + tc_port - TC_PORT_1;
enum tc_port tc_port = intel_encoder_to_tc(&tc->dig_port->base);
reg = TCSS_DDI_STATUS(tc_port);
enum tc_port tc_port = intel_encoder_to_tc(&tc->dig_port->base);
tc->phy_fia = tc_port / 2;
tc->phy_fia_idx = tc_port % 2;
tc->phy_fia_idx = tc_port;
enum tc_port tc_port = intel_encoder_to_tc(&tc->dig_port->base);
val = intel_de_read(display, TCSS_DDI_STATUS(tc_port));
typec_set_data_role(tc_port, target_role);
typec_set_pwr_role(tc_port, target_role);
static int cros_typec_enter_usb_mode(struct typec_port *tc_port, enum usb_mode mode)
struct cros_typec_port *port = typec_get_drvdata(tc_port);
static int cros_typec_perform_role_swap(struct typec_port *tc_port, int target_role, u8 swap_type)
struct cros_typec_port *port = typec_get_drvdata(tc_port);