The DRV_DIAG_TX_DRV register is always written with the same value (0x0003) regardless of the voltage swing / pre-emphasis combination, so the diag_tx_drv member of the DisplayPort voltage coefficient structure only ever held a single constant and carried no information.
Remove the diag_tx_drv member and write the constant directly at the call site, which also shrinks the coefficient table. Along the way, the structure and table are renamed to tp_dp_vltg_coeff and tp_dp_vltg_coeff_table for consistency with the rest of the driver. No functional change intended. Signed-off-by: Benjamin Robin <[email protected]> --- drivers/phy/cadence/phy-cadence-torrent.c | 66 ++++++++++++------------------- 1 file changed, 25 insertions(+), 41 deletions(-) diff --git a/drivers/phy/cadence/phy-cadence-torrent.c b/drivers/phy/cadence/phy-cadence-torrent.c index d626e3780cf6..28627bd23445 100644 --- a/drivers/phy/cadence/phy-cadence-torrent.c +++ b/drivers/phy/cadence/phy-cadence-torrent.c @@ -445,9 +445,7 @@ static const struct cdns_torrent_vals *cdns_torrent_get_tbl_vals(const struct cd * coefficients, for particular voltage swing and pre-emphasis level. Values * are shared across all physical lanes. */ -struct coefficients { - /* Value of DRV_DIAG_TX_DRV register to use */ - u16 diag_tx_drv; +struct tp_dp_vltg_coeff { /* Value of TX_TXCC_MGNFS_MULT_000 register to use */ u16 mgnfs_mult; /* Value of TX_TXCC_CPOST_MULT_00 register to use */ @@ -458,53 +456,40 @@ struct coefficients { * Array consists of values of voltage-related registers for sd0801 PHY. A value * of 0xFFFF is a placeholder for invalid combination, and will never be used. */ -static const struct coefficients vltg_coeff[4][4] = { +static const struct tp_dp_vltg_coeff tp_dp_vltg_coeff_table[4][4] = { /* voltage swing 0, pre-emphasis 0->3 */ - { {.diag_tx_drv = 0x0003, .mgnfs_mult = 0x002A, - .cpost_mult = 0x0000}, - {.diag_tx_drv = 0x0003, .mgnfs_mult = 0x001F, - .cpost_mult = 0x0014}, - {.diag_tx_drv = 0x0003, .mgnfs_mult = 0x0012, - .cpost_mult = 0x0020}, - {.diag_tx_drv = 0x0003, .mgnfs_mult = 0x0000, - .cpost_mult = 0x002A} + { + { .mgnfs_mult = 0x002A, .cpost_mult = 0x0000 }, + { .mgnfs_mult = 0x001F, .cpost_mult = 0x0014 }, + { .mgnfs_mult = 0x0012, .cpost_mult = 0x0020 }, + { .mgnfs_mult = 0x0000, .cpost_mult = 0x002A }, }, /* voltage swing 1, pre-emphasis 0->3 */ - { {.diag_tx_drv = 0x0003, .mgnfs_mult = 0x001F, - .cpost_mult = 0x0000}, - {.diag_tx_drv = 0x0003, .mgnfs_mult = 0x0013, - .cpost_mult = 0x0012}, - {.diag_tx_drv = 0x0003, .mgnfs_mult = 0x0000, - .cpost_mult = 0x001F}, - {.diag_tx_drv = 0xFFFF, .mgnfs_mult = 0xFFFF, - .cpost_mult = 0xFFFF} + { + { .mgnfs_mult = 0x001F, .cpost_mult = 0x0000 }, + { .mgnfs_mult = 0x0013, .cpost_mult = 0x0012 }, + { .mgnfs_mult = 0x0000, .cpost_mult = 0x001F }, + { .mgnfs_mult = 0xFFFF, .cpost_mult = 0xFFFF }, }, /* voltage swing 2, pre-emphasis 0->3 */ - { {.diag_tx_drv = 0x0003, .mgnfs_mult = 0x0013, - .cpost_mult = 0x0000}, - {.diag_tx_drv = 0x0003, .mgnfs_mult = 0x0000, - .cpost_mult = 0x0013}, - {.diag_tx_drv = 0xFFFF, .mgnfs_mult = 0xFFFF, - .cpost_mult = 0xFFFF}, - {.diag_tx_drv = 0xFFFF, .mgnfs_mult = 0xFFFF, - .cpost_mult = 0xFFFF} + { + { .mgnfs_mult = 0x0013, .cpost_mult = 0x0000 }, + { .mgnfs_mult = 0x0000, .cpost_mult = 0x0013 }, + { .mgnfs_mult = 0xFFFF, .cpost_mult = 0xFFFF }, + { .mgnfs_mult = 0xFFFF, .cpost_mult = 0xFFFF }, }, /* voltage swing 3, pre-emphasis 0->3 */ - { {.diag_tx_drv = 0x0003, .mgnfs_mult = 0x0000, - .cpost_mult = 0x0000}, - {.diag_tx_drv = 0xFFFF, .mgnfs_mult = 0xFFFF, - .cpost_mult = 0xFFFF}, - {.diag_tx_drv = 0xFFFF, .mgnfs_mult = 0xFFFF, - .cpost_mult = 0xFFFF}, - {.diag_tx_drv = 0xFFFF, .mgnfs_mult = 0xFFFF, - .cpost_mult = 0xFFFF} + { + { .mgnfs_mult = 0x0000, .cpost_mult = 0x0000 }, + { .mgnfs_mult = 0xFFFF, .cpost_mult = 0xFFFF }, + { .mgnfs_mult = 0xFFFF, .cpost_mult = 0xFFFF }, + { .mgnfs_mult = 0xFFFF, .cpost_mult = 0xFFFF }, } }; - static void tp_reg_base_init(const struct tp_data *tp_data, u32 block_offset, struct tp_reg_base *ctx) { @@ -1420,11 +1405,10 @@ static void tp_dp_set_voltages(const struct tp_data *tp_data, const struct tp_li tp_reg_set_bits(reg_base, TX_DIAG_ACYA, TX_DIAG_ACYA_HBDC_MASK); tp_reg_write(reg_base, TX_TXCC_CTRL, 0x08A4); - val = vltg_coeff[dp->voltage[lane]][dp->pre[lane]].diag_tx_drv; - tp_reg_write(reg_base, DRV_DIAG_TX_DRV, val); - val = vltg_coeff[dp->voltage[lane]][dp->pre[lane]].mgnfs_mult; + tp_reg_write(reg_base, DRV_DIAG_TX_DRV, 0x0003); + val = tp_dp_vltg_coeff_table[dp->voltage[lane]][dp->pre[lane]].mgnfs_mult; tp_reg_write(reg_base, TX_TXCC_MGNFS_MULT_000, val); - val = vltg_coeff[dp->voltage[lane]][dp->pre[lane]].cpost_mult; + val = tp_dp_vltg_coeff_table[dp->voltage[lane]][dp->pre[lane]].cpost_mult; tp_reg_write(reg_base, TX_TXCC_CPOST_MULT_00, val); /* -- 2.56.1
