Re: [PATCH] drm/panel: novatek-nt36523: transition to mipi_dsi wrapped functions

From: Doug Anderson
Date: Thu Mar 06 2025 - 12:37:46 EST


Hi,

On Thu, Mar 6, 2025 at 8:33 AM Dmitry Baryshkov
<dmitry.baryshkov@xxxxxxxxxx> wrote:
>
> On Thu, Mar 06, 2025 at 03:05:10PM +0100, neil.armstrong@xxxxxxxxxx wrote:
> > On 06/03/2025 14:43, Tejas Vipin wrote:
> > > Changes the novatek-nt36523 panel to use multi style functions for
> > > improved error handling.
> > >
> > > Signed-off-by: Tejas Vipin <tejasvipin76@xxxxxxxxx>
> > > ---
> > > drivers/gpu/drm/panel/panel-novatek-nt36523.c | 1683 ++++++++---------
> > > 1 file changed, 823 insertions(+), 860 deletions(-)
> > >
> > > diff --git a/drivers/gpu/drm/panel/panel-novatek-nt36523.c b/drivers/gpu/drm/panel/panel-novatek-nt36523.c
> > > index 04f1d2676c78..922a225f6258 100644
> > > --- a/drivers/gpu/drm/panel/panel-novatek-nt36523.c
> > > +++ b/drivers/gpu/drm/panel/panel-novatek-nt36523.c
> > > @@ -23,10 +23,12 @@
> > > #define DSI_NUM_MIN 1
> > > -#define mipi_dsi_dual_dcs_write_seq(dsi0, dsi1, cmd, seq...) \
> > > - do { \
> > > - mipi_dsi_dcs_write_seq(dsi0, cmd, seq); \
> > > - mipi_dsi_dcs_write_seq(dsi1, cmd, seq); \
> > > +#define mipi_dsi_dual_dcs_write_seq_multi(dsi_ctx0, dsi_ctx1, cmd, seq...) \
> > > + do { \
> > > + mipi_dsi_dcs_write_seq_multi(&dsi_ctx0, cmd, seq); \
> > > + dsi_ctx1.accum_err = dsi_ctx0.accum_err; \
> > > + mipi_dsi_dcs_write_seq_multi(&dsi_ctx1, cmd, seq); \
> > > + dsi_ctx0.accum_err = dsi_ctx1.accum_err; \
> >
> > Just thinking out loud, but can't we do :
> >
> > struct mipi_dsi_multi_context dsi_ctx = { .dsi = NULL };
> >
> > #define mipi_dsi_dual_dcs_write_seq_multi(dsi_ctx, dsi0, dsi1, cmd, seq...) \
> > do {
> > dsi_ctx.dsi = dsi0; \
> > mipi_dsi_dcs_write_seq_multi(&dsi_ctx, cmd, seq); \
> > dsi_ctx.dsi = dsi1; \
> > mipi_dsi_dcs_write_seq_multi(&dsi_ctx, cmd, seq); \
> >
> > ?
> >
> > So we have a single accum_err.
>
> I'd say that can be counter-prodactive. If only one of the links falls
> apart, then the second link still can be initialized (and by observing a
> half of the screen the user / devloper can make several assumptions).
> In case of using just one context the driver will fail on the first
> error and skip the rest of the init for both halves.
>
> I'd have a different suggestion though: what about passing two contexts
> to the init_sequence callback and letting nt36523_prepare() handle each
> of the error separately?

IMO that's a bit outside the scope of what Tejas is doing since it's a
functional change. Unless something is a super obvious bugfix it feels
like doing the conversions like we're doing here should not include
functionality changes and should be straight conversions.

Also: I don't have tons of experience with dual MIPI panels, but I'm
not totally sure how your suggestion would work in the end. Would you
expect that if one panel succeeded and the other didn't that the
prepare/enable calls in the panel should return "success"? If they
don't then higher levels will assume that the single "panel" that
they're aware of didn't initialize at all and won't continue to do
more. That means the user wouldn't have a chance to observe half the
screen working.

I could believe that, for all practical purposes, we could keep the
errors separate and then just return the if either panel got an error
in the end. It probably wouldn't make a huge difference and would
shrink the code side. ...but that I think that should probably be the
second patch in the series and not squahsed into the conversion.


Oh, also: Tejas, please make sure you CC Anusha on your patches. :-) Added here.