From: Alexander Stein <alexander.stein@ew.tq-group.com>
To: Inki Dae <inki.dae@samsung.com>,
Jagan Teki <jagan@amarulasolutions.com>,
Marek Szyprowski <m.szyprowski@samsung.com>,
Andrzej Hajda <andrzej.hajda@intel.com>,
Neil Armstrong <neil.armstrong@linaro.org>,
Robert Foss <rfoss@kernel.org>,
Laurent Pinchart <Laurent.pinchart@ideasonboard.com>,
Jonas Karlman <jonas@kwiboo.se>,
Jernej Skrabec <jernej.skrabec@gmail.com>,
Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
Maxime Ripard <mripard@kernel.org>,
Thomas Zimmermann <tzimmermann@suse.de>,
David Airlie <airlied@gmail.com>, Simona Vetter <simona@ffwll.ch>,
dri-devel@lists.freedesktop.org
Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
kernel@pengutronix.de, Philipp Zabel <p.zabel@pengutronix.de>,
Philipp Zabel <p.zabel@pengutronix.de>
Subject: Re: [PATCH 2/2] drm/bridge: samsung-dsim: Use HZ_PER_MHZ macro from units.h
Date: Tue, 27 May 2025 17:12:01 +0200 [thread overview]
Message-ID: <6646604.DvuYhMxLoT@steina-w> (raw)
In-Reply-To: <20250527-samsung-dsim-v1-2-5be520d84fbb@pengutronix.de>
Am Dienstag, 27. Mai 2025, 16:21:48 CEST schrieb Philipp Zabel:
> Drop the custom MHZ macro and replace it with HZ_PER_MHZ.
>
> Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Reviewed-by: Alexander Stein <alexander.stein@ew.tq-group.com>
> ---
> drivers/gpu/drm/bridge/samsung-dsim.c | 26 ++++++++++++--------------
> 1 file changed, 12 insertions(+), 14 deletions(-)
>
> diff --git a/drivers/gpu/drm/bridge/samsung-dsim.c b/drivers/gpu/drm/bridge/samsung-dsim.c
> index 1dfc9710bee5134e0e0114ce52f673c21564b11b..b7fd5870eba7e4bef3f420ae7cf6de1a700eb41d 100644
> --- a/drivers/gpu/drm/bridge/samsung-dsim.c
> +++ b/drivers/gpu/drm/bridge/samsung-dsim.c
> @@ -19,6 +19,7 @@
> #include <linux/of.h>
> #include <linux/phy/phy.h>
> #include <linux/platform_device.h>
> +#include <linux/units.h>
>
> #include <video/mipi_display.h>
>
> @@ -557,10 +558,6 @@ static void samsung_dsim_reset(struct samsung_dsim *dsi)
> samsung_dsim_write(dsi, DSIM_SWRST_REG, reset_val);
> }
>
> -#ifndef MHZ
> -#define MHZ (1000 * 1000)
> -#endif
> -
> static unsigned long samsung_dsim_pll_find_pms(struct samsung_dsim *dsi,
> unsigned long fin,
> unsigned long fout,
> @@ -574,8 +571,8 @@ static unsigned long samsung_dsim_pll_find_pms(struct samsung_dsim *dsi,
> u16 _m, best_m;
> u8 _s, best_s;
>
> - p_min = DIV_ROUND_UP(fin, (driver_data->pll_fin_max * MHZ));
> - p_max = fin / (driver_data->pll_fin_min * MHZ);
> + p_min = DIV_ROUND_UP(fin, (driver_data->pll_fin_max * HZ_PER_MHZ));
> + p_max = fin / (driver_data->pll_fin_min * HZ_PER_MHZ);
>
> for (_p = p_min; _p <= p_max; ++_p) {
> for (_s = 0; _s <= 5; ++_s) {
> @@ -590,8 +587,8 @@ static unsigned long samsung_dsim_pll_find_pms(struct samsung_dsim *dsi,
>
> tmp = (u64)_m * fin;
> do_div(tmp, _p);
> - if (tmp < driver_data->min_freq * MHZ ||
> - tmp > driver_data->max_freq * MHZ)
> + if (tmp < driver_data->min_freq * HZ_PER_MHZ ||
> + tmp > driver_data->max_freq * HZ_PER_MHZ)
> continue;
>
> tmp = (u64)_m * fin;
> @@ -634,7 +631,7 @@ static unsigned long samsung_dsim_set_pll(struct samsung_dsim *dsi,
> * limit.
> */
> fin = clk_get_rate(clk_get_parent(dsi->pll_clk));
> - while (fin > driver_data->pll_fin_max * MHZ)
> + while (fin > driver_data->pll_fin_max * HZ_PER_MHZ)
> fin /= 2;
> clk_set_rate(dsi->pll_clk, fin);
>
> @@ -660,10 +657,11 @@ static unsigned long samsung_dsim_set_pll(struct samsung_dsim *dsi,
>
> if (driver_data->has_freqband) {
> static const unsigned long freq_bands[] = {
> - 100 * MHZ, 120 * MHZ, 160 * MHZ, 200 * MHZ,
> - 270 * MHZ, 320 * MHZ, 390 * MHZ, 450 * MHZ,
> - 510 * MHZ, 560 * MHZ, 640 * MHZ, 690 * MHZ,
> - 770 * MHZ, 870 * MHZ, 950 * MHZ,
> + 100 * HZ_PER_MHZ, 120 * HZ_PER_MHZ, 160 * HZ_PER_MHZ,
> + 200 * HZ_PER_MHZ, 270 * HZ_PER_MHZ, 320 * HZ_PER_MHZ,
> + 390 * HZ_PER_MHZ, 450 * HZ_PER_MHZ, 510 * HZ_PER_MHZ,
> + 560 * HZ_PER_MHZ, 640 * HZ_PER_MHZ, 690 * HZ_PER_MHZ,
> + 770 * HZ_PER_MHZ, 870 * HZ_PER_MHZ, 950 * HZ_PER_MHZ,
> };
> int band;
>
> @@ -723,7 +721,7 @@ static int samsung_dsim_enable_clock(struct samsung_dsim *dsi)
> esc_div = DIV_ROUND_UP(byte_clk, dsi->esc_clk_rate);
> esc_clk = byte_clk / esc_div;
>
> - if (esc_clk > 20 * MHZ) {
> + if (esc_clk > 20 * HZ_PER_MHZ) {
> ++esc_div;
> esc_clk = byte_clk / esc_div;
> }
>
>
--
TQ-Systems GmbH | Mühlstraße 2, Gut Delling | 82229 Seefeld, Germany
Amtsgericht München, HRB 105018
Geschäftsführer: Detlef Schneider, Rüdiger Stahl, Stefan Schneider
http://www.tq-group.com/
next prev parent reply other threads:[~2025-05-27 15:12 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-27 14:21 [PATCH 0/2] drm/bridge: samsung-dsim: Small cleanups Philipp Zabel
2025-05-27 14:21 ` [PATCH 1/2] drm/bridge: samsung-dsim: use while loop in samsung_dsim_transfer_start Philipp Zabel
2025-05-27 14:52 ` Frieder Schrempf
2025-05-27 15:10 ` Alexander Stein
2025-05-27 14:21 ` [PATCH 2/2] drm/bridge: samsung-dsim: Use HZ_PER_MHZ macro from units.h Philipp Zabel
2025-05-27 14:53 ` Frieder Schrempf
2025-05-27 15:12 ` Alexander Stein [this message]
2025-06-27 11:49 ` [PATCH 0/2] drm/bridge: samsung-dsim: Small cleanups Philipp Zabel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=6646604.DvuYhMxLoT@steina-w \
--to=alexander.stein@ew.tq-group.com \
--cc=Laurent.pinchart@ideasonboard.com \
--cc=airlied@gmail.com \
--cc=andrzej.hajda@intel.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=inki.dae@samsung.com \
--cc=jagan@amarulasolutions.com \
--cc=jernej.skrabec@gmail.com \
--cc=jonas@kwiboo.se \
--cc=kernel@pengutronix.de \
--cc=linux-kernel@vger.kernel.org \
--cc=m.szyprowski@samsung.com \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mripard@kernel.org \
--cc=neil.armstrong@linaro.org \
--cc=p.zabel@pengutronix.de \
--cc=rfoss@kernel.org \
--cc=simona@ffwll.ch \
--cc=tzimmermann@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).