Re: [PATCH RESEND v4 4/4] drm/bridge: nwl-dsi: Correct MIPI DSI horizontal sync timing

From: Esben Haabendal

Date: Tue Oct 27 2026 - 06:19:08 EST


Sorry for the premature send of the previous reply.


"Liu Ying" <victor.liu@xxxxxxx> writes:

>>
>> diff --git a/drivers/gpu/drm/bridge/nwl-dsi.c b/drivers/gpu/drm/bridge/nwl-dsi.c
>> index f3f4334136c0..eb604733eea0 100644
>> --- a/drivers/gpu/drm/bridge/nwl-dsi.c
>> +++ b/drivers/gpu/drm/bridge/nwl-dsi.c
>> @@ -22,6 +22,7 @@
>> #include <linux/reset.h>
>> #include <linux/sys_soc.h>
>> #include <linux/time64.h>
>> +#include <linux/math64.h>
>
> Sort the header files alphabetically.

Will do.

>> + hfp = roundup(hfp, 2);
>> + hbp = roundup(hbp, 2);
>> + hsa = roundup(hsa, 2);
>> +
>> + /*
>> + * We need to subtract the packet header length: 32
>> + * In order to make sure we don't get negative values,
>> + * subtract a proportional value to the total length of the
>> + * horizontal blanking duration.
>> + */
>> + h_blank = hfp + hbp + hsa;
>> +
>> + if (h_blank) {
>> + pkt_len = min(hfp, roundup(((hfp * 100 / h_blank) * 32) / 100, 2));
>> + pkt_hdr_len = pkt_len;
>> + hfp -= pkt_len;
>> +
>> + pkt_len = min(hbp, roundup(((hbp * 100 / h_blank) * 32) / 100, 2));
>> + pkt_hdr_len += pkt_len;
>> + hbp -= pkt_len;
>> +
>> + pkt_len = min(hsa, 32 - pkt_hdr_len);
>> + pkt_hdr_len += pkt_len;
>> + hsa -= pkt_len;
>> + if (pkt_hdr_len != 32)
>> + dev_warn(dsi->dev,
>> + "Unable to subtract packet header length fully: %d left\n",
>> + 32 - pkt_hdr_len);
>> + }
>> +
>> + DRM_DEV_DEBUG_DRIVER(dsi->dev, "Register values: hfp=%d hbp=%d hsa=%d\n", hfp, hbp, hsa);
>> +
>> + nwl_dsi_write(dsi, NWL_DSI_HFP, hfp);
>> + nwl_dsi_write(dsi, NWL_DSI_HBP, hbp);
>> + nwl_dsi_write(dsi, NWL_DSI_HSA, hsa);
>>
>> nwl_dsi_write(dsi, NWL_DSI_ENABLE_MULT_PKTS, 0x0);
>> nwl_dsi_write(dsi, NWL_DSI_BLLP_MODE, 0x1);
>>
>> --
>> 2.56.0
>>
>
> Not sure if the fix is 100% correct, but it is a correct direction to
> change the blanking packet payload size from in pixel clocks to in bytes,
> so better than no fix:
> Acked-by: Liu Ying <victor.liu@xxxxxxx>

Thanks. With the information available to me, this is the best I can do.

/Esben