drm/mediatek: dsi: Use bitfield macros where useful
authorAngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Thu, 15 Feb 2024 08:53:11 +0000 (09:53 +0100)
committerChun-Kuang Hu <chunkuang.hu@kernel.org>
Mon, 19 Feb 2024 14:42:01 +0000 (14:42 +0000)
commitaaeb9335fb38c8d3f746e0fb06d4c7ae90985714
treebe3f95fe73933b9f4f313b13b8ca4a0876e8bec3
parent5c6186a8f07e89f769d99c522cae78a121277b2d
drm/mediatek: dsi: Use bitfield macros where useful

Instead of open coding bitshifting for various register fields,
use the bitfield macro FIELD_PREP(): this allows to enhance the
human readability, decrease likeliness of mistakes (and register
field overflowing) and also to simplify the code.
The latter is especially seen in mtk_dsi_rxtx_control(), where
it was possible to change a switch to a short for loop and to
also remove the need to check for maximum DSI lanes == 4 thanks
to the FIELD_PREP macro masking the value.

While at it, also add the missing DA_HS_SYNC bitmask, used in
mtk_dsi_phy_timconfig().

Reviewed-by: Alexandre Mergnat <amergnat@baylibre.com>
Reviewed-by: CK Hu <ck.hu@mediatek.com>
Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Link: https://patchwork.kernel.org/project/dri-devel/patch/20240215085316.56835-5-angelogioacchino.delregno@collabora.com/
Signed-off-by: Chun-Kuang Hu <chunkuang.hu@kernel.org>
drivers/gpu/drm/mediatek/mtk_dsi.c