Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

phy: mediatek: mipi: mt8173: use FIELD_PREP to prepare bits field

Use FIELD_PREP() macro to prepare bits field value, then no need define
macros of bits offset.

Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Link: https://lore.kernel.org/r/20220920090038.15133-15-chunfeng.yun@mediatek.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>

authored by

Chunfeng Yun and committed by
Vinod Koul
993aa53e 7bd72714

+10 -4
+10 -4
drivers/phy/mediatek/phy-mtk-mipi-dsi-mt8173.c
··· 153 153 mtk_mipi_tx_update_bits(mipi_tx, MIPITX_DSI_BG_CON, 154 154 RG_DSI_VOUT_MSK | 155 155 RG_DSI_BG_CKEN | RG_DSI_BG_CORE_EN, 156 - (4 << 20) | (4 << 17) | (4 << 14) | 157 - (4 << 11) | (4 << 8) | (4 << 5) | 156 + FIELD_PREP(RG_DSI_V02_SEL, 4) | 157 + FIELD_PREP(RG_DSI_V032_SEL, 4) | 158 + FIELD_PREP(RG_DSI_V04_SEL, 4) | 159 + FIELD_PREP(RG_DSI_V072_SEL, 4) | 160 + FIELD_PREP(RG_DSI_V10_SEL, 4) | 161 + FIELD_PREP(RG_DSI_V12_SEL, 4) | 158 162 RG_DSI_BG_CKEN | RG_DSI_BG_CORE_EN); 159 163 160 164 usleep_range(30, 100); 161 165 162 166 mtk_mipi_tx_update_bits(mipi_tx, MIPITX_DSI_TOP_CON, 163 167 RG_DSI_LNT_IMP_CAL_CODE | RG_DSI_LNT_HS_BIAS_EN, 164 - (8 << 4) | RG_DSI_LNT_HS_BIAS_EN); 168 + FIELD_PREP(RG_DSI_LNT_IMP_CAL_CODE, 8) | 169 + RG_DSI_LNT_HS_BIAS_EN); 165 170 166 171 mtk_mipi_tx_set_bits(mipi_tx, MIPITX_DSI_CON, 167 172 RG_DSI_CKG_LDOOUT_EN | RG_DSI_LDOCORE_EN); ··· 182 177 mtk_mipi_tx_update_bits(mipi_tx, MIPITX_DSI_PLL_CON0, 183 178 RG_DSI_MPPLL_TXDIV0 | RG_DSI_MPPLL_TXDIV1 | 184 179 RG_DSI_MPPLL_PREDIV, 185 - (txdiv0 << 3) | (txdiv1 << 5)); 180 + FIELD_PREP(RG_DSI_MPPLL_TXDIV0, txdiv0) | 181 + FIELD_PREP(RG_DSI_MPPLL_TXDIV1, txdiv1)); 186 182 187 183 /* 188 184 * PLL PCW config