]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drm/mediatek: dsi: Replace open-coded instance of HZ_PER_MHZ
authorAngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Thu, 15 Feb 2024 08:53:12 +0000 (09:53 +0100)
committerChun-Kuang Hu <chunkuang.hu@kernel.org>
Mon, 19 Feb 2024 14:43:30 +0000 (14:43 +0000)
In mtk_dsi_phy_timconfig(), we're dividing the `data_rate` variable,
expressed in Hz to retrieve a value in MHz: instead of open-coding,
use the HZ_PER_MHZ definition, available in linux/units.h.

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-6-angelogioacchino.delregno@collabora.com/
Signed-off-by: Chun-Kuang Hu <chunkuang.hu@kernel.org>
drivers/gpu/drm/mediatek/mtk_dsi.c

index a330bb94c44ad3444dadc6e7a15cffa9f933d90f..52758cab0abf0aa1401d0879d969f48e2968cf2c 100644 (file)
@@ -13,6 +13,7 @@
 #include <linux/phy/phy.h>
 #include <linux/platform_device.h>
 #include <linux/reset.h>
+#include <linux/units.h>
 
 #include <video/mipi_display.h>
 #include <video/videomode.h>
@@ -238,7 +239,7 @@ static void mtk_dsi_mask(struct mtk_dsi *dsi, u32 offset, u32 mask, u32 data)
 static void mtk_dsi_phy_timconfig(struct mtk_dsi *dsi)
 {
        u32 timcon0, timcon1, timcon2, timcon3;
-       u32 data_rate_mhz = DIV_ROUND_UP(dsi->data_rate, 1000000);
+       u32 data_rate_mhz = DIV_ROUND_UP(dsi->data_rate, HZ_PER_MHZ);
        struct mtk_phy_timing *timing = &dsi->phy_timing;
 
        timing->lpx = (60 * data_rate_mhz / (8 * 1000)) + 1;