[RFC V3 3/3] phy: freescale: fsl-samsung-hdmi: Support dynamic integer
Adam Ford
aford173 at gmail.com
Mon Sep 2 18:20:50 PDT 2024
On Mon, Sep 2, 2024 at 7:47 PM Dominique Martinet
<dominique.martinet at atmark-techno.com> wrote:
>
> Adam Ford wrote on Mon, Sep 02, 2024 at 04:20:11PM -0500:
> > > - const struct phy_config *cur_cfg;
> > > + struct phy_config cur_cfg;
> >
> > Wouldn't converting this from a pointer require me to do a memcpy
> > later? It seems like that's more work than just pointing it to an
> > address.
> >
> > > - phy->cur_cfg = &phy_pll_cfg[i];
> > > + phy->cur_cfg = phy_pll_cfg[i];
> >
> > I think this is would have to be a memcpy instead of just an equal
> > statement since phy->cur_cfg would no longer be a pointer.
>
> C allows copying structs like this, it's fine to write it as just an
> equal.
> It's not 100% equivalent, iiuc simple assignment is undefined behaviour
> if the elements aren't aligned but memcpy will work even in that case,
> but for us this is not a proble mand the generated code should be
> identical... Also note I'm only suggesting that because the struct is
> tiny (1*u32+7*u8 is less than two u64), but this code isn't meant to run
> very often anyway so we should prioritize readability -- if you think
> it's harder to understand than an extra pointer somewhere I have no
> strong opinion; as said in the previous mail if parallel uses are
> possible it'd be better kept on the stack anyway...
Dominique,
Unless someone pushes back, I think keeping it a pointer is more
consistent with what we did before, and it's more in my style of
coding.
I have two more patches in the series.
* One updates the round and set functions to compare the closest
values between the fractional divider and the integer divider and uses
the option with the smallest difference between the achievable value
and the desired rate if the actual value is not achievable.
* The second removes the integer divider values from the LUT since
having it there just takes up extra space and makes the LUT search
longer.
I'll send it as V4 with a cover letter describing everything I have
done and the rationale behind it without the RFC designation.
For what it's worth, adding the integer calculator added 4 entries to
my modetest list, and changing the hdmi-tx to support a clock rante of
+/- 5% added another 11 possible entries. I have not tested them all
yet.
I likely won't do a patch for the HDMI-TX, but if you want to send a
patch increasing the tolerance, I'll likely test it as I have time.
adam
>
> --
> Dominique
>
>
More information about the linux-phy
mailing list