[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <d710ac65-655a-6a5a-ce6e-6dee4fd1760b@ideasonboard.com>
Date: Tue, 29 Nov 2022 14:59:19 +0200
From: Tomi Valkeinen <tomi.valkeinen+renesas@...asonboard.com>
To: Laurent Pinchart <laurent.pinchart@...asonboard.com>
Cc: Kieran Bingham <kieran.bingham+renesas@...asonboard.com>,
Rob Herring <robh+dt@...nel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>,
Geert Uytterhoeven <geert+renesas@...der.be>,
Magnus Damm <magnus.damm@...il.com>,
dri-devel@...ts.freedesktop.org, linux-renesas-soc@...r.kernel.org,
devicetree@...r.kernel.org, linux-kernel@...r.kernel.org,
Andrzej Hajda <andrzej.hajda@...el.com>,
Neil Armstrong <neil.armstrong@...aro.org>,
Robert Foss <robert.foss@...aro.org>,
Jonas Karlman <jonas@...boo.se>,
Jernej Skrabec <jernej.skrabec@...il.com>
Subject: Re: [PATCH v2 7/7] drm: rcar-du: dsi: Add r8a779g0 support
On 29/11/2022 03:49, Laurent Pinchart wrote:
>> @@ -198,70 +436,53 @@ static void rcar_mipi_dsi_parameters_calc(struct rcar_mipi_dsi *dsi,
>> */
>> fout_target = target * mipi_dsi_pixel_format_to_bpp(dsi->format)
>> / (2 * dsi->lanes);
>> - if (fout_target < 40000000 || fout_target > 1250000000)
>> + if (fout_target < MHZ(40) || fout_target > MHZ(1250))
>> return;
>>
>> /* Find vco_cntrl */
>> - for (vco_cntrl = vco_cntrl_table; vco_cntrl->min_freq != 0; vco_cntrl++) {
>> - if (fout_target > vco_cntrl->min_freq &&
>> - fout_target <= vco_cntrl->max_freq) {
>> - setup_info->vco_cntrl = vco_cntrl->value;
>> - if (fout_target >= 1150000000)
>> - setup_info->prop_cntrl = 0x0c;
>> - else
>> - setup_info->prop_cntrl = 0x0b;
>> + for (clkset = dsi->info->clk_cfg; clkset->min_freq != 0; clkset++) {
>> + if (fout_target > clkset->min_freq &&
>> + fout_target <= clkset->max_freq) {
>> + setup_info->clkset = clkset;
>> break;
>> }
>> }
>>
>> - /* Add divider */
>> - setup_info->div = (setup_info->vco_cntrl & 0x30) >> 4;
>> + switch (dsi->info->model) {
>> + case RCAR_DSI_R8A779A0:
>> + setup_info->vclk_divider = 1 << ((clkset->vco_cntrl >> 4) & 0x3);
>
> If you stored (clkset->vco_cntrl >> 4) & 0x3 in setup_info->vclk_divider
> you wouldn't have to use __ffs() in rcar_mipi_dsi_startup(). You could
> also drop the - 1 there, which would allow dropping one of the
> switch(dsi->info->model). You can store the real divider value in
> setup_info separately for rcar_mipi_dsi_pll_calc_r8a779a0(), or pass it
> to the function.
That's true. The reason I chose this approach was to keep dsi_setup_info
"neutral", containing only the logical values, and the register specific
tinkering is done only where the register is written. Mixing the logical
and the register values in the old dsi_setup_info was confusing, and
implementing your suggestion would again go that direction. But as you
noticed, this is uglified a bit by the need to get the divider from the
vco_cntrl.
We could store the logical divider in the dsi_clk_config table, though,
which would remove the need for the above code.
Tomi
Powered by blists - more mailing lists