+ /*
+ * After EN is deasserted and an external clock is detected, the bridge
+ * will sample GPIO3:1 to determine its frequency. The driver will
+ * overwrite this setting. But this is racy. Thus we have to wait a
+ * couple of us. According to the datasheet the GPIO lines has to be
+ * stable at least 5 us (td5) but it seems that is not enough and the
+ * refclk frequency value is lost/overwritten by the bridge itself.
+ * Waiting for 20us seems to work.
+ */
+ usleep_range(20, 30);
It might be worth pointing at _where_ the driver overwrites this
setting, or maybe at least pointing to something that makes it easy to
find which exact bits you're talking about.
This looks reasonable to me, though.
I think we are talking about SN_DPPLL_SRC_REG[3:1] bits?
What exact mismatch are you observing in register value?
I am assuming that you have a clock at REFCLK pin. For that:
If refclk is described in devicetree node, then I see that
the driver modifies it in every resume call based solely on the
clock value in dts.
If refclk is not described in dts, then this register is modified by the
driver only when pre_enable() calls enable_comms(). Here also, the
value depends on crtc_mode and the refclk_rate often would not be equal
to the values in "ti_sn_bridge_dsiclk_lut" (supported frequencies), and
you would fallback to "001" register value.
Rest of time, I guess it depends on reading the status from GPIO and
changing the register.
Is the latter one your usecase?