LKML Archive mirror
 help / color / mirror / Atom feed
From: Doug Anderson <dianders@google.com>
To: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Cc: Hsin-Yi Wang <hsinyi@google.com>,
	 lvzhaoxiong <lvzhaoxiong@huaqin.corp-partner.google.com>,
	mripard@kernel.org,  airlied@gmail.com, daniel@ffwll.ch,
	robh@kernel.org,  krzysztof.kozlowski+dt@linaro.org,
	conor+dt@kernel.org,  dri-devel@lists.freedesktop.org,
	devicetree@vger.kernel.org,  linux-kernel@vger.kernel.org,
	 cong yang <yangcong5@huaqin.corp-partner.google.com>
Subject: Re: [PATCH v1 2/2] drm/panel: kd101ne3: add new panel driver
Date: Wed, 24 Apr 2024 15:27:59 -0700	[thread overview]
Message-ID: <CAD=FV=U-1A4N5aMeRpx1sC6TsG_hdOOpstzirVrA-=oPoLeg3A@mail.gmail.com> (raw)
In-Reply-To: <CAA8EJprv3qBd1hfdWHrfhY=S0w2O70dZnYb6TVsS6AGRPxsYdw@mail.gmail.com>

Hi,

On Wed, Apr 24, 2024 at 2:49 PM Dmitry Baryshkov
<dmitry.baryshkov@linaro.org> wrote:
>
> > The problem is that with these panels that need big init sequences the
> > code based solution is _a lot_ bigger. If it were a few bytes or a
> > 1-2KB then fine, but when Hsin-Yi measured Linus W's attempt to move
> > from a table to code it was 100K difference in code [1]. I would also
> > say that having these long init sequences done as separate commands
> > encourages people to skip checking the return values of each of the
> > transfer functions and I don't love that idea.
> >
> > It would be ideal if these panels didn't need these long init
> > sequences, but I don't have any inside knowledge here saying that they
> > could be removed. So assume we can't get rid of the init sequences it
> > feels like we have to find some way to make the tables work for at
> > least the large chunks of init code and encourage people to make the
> > tables readable...
>
>
> I did a quick check on the boe-tv101wum-nl6 driver by converting the
> writes to use the following macro:
>
> #define mipi_dsi_dcs_write_cmd_seq(dsi, cmd, seq...)
>              \
>         do {                                                                   \
>                 static const u8 d[] = { cmd, seq };                        \
>                 ret = mipi_dsi_dcs_write_buffer(dsi, d, ARRAY_SIZE(d));    \
>                 if (ret < 0)                                                   \
>                         goto err;                                              \
>         } while (0)
>
> And then at the end of the init funciton having
>
> err:
>         dev_err(panel->dev,
>                 "failed to write command %d\n", ret);
>         return ret;
> }
>
> Size comparison:
>    text    data     bss     dec     hex filename
> before
>   34109   10410      18   44537    adf9
> ../build-64/drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.o
> making init data const
>   44359     184       0   44543    adff
> ../build-64/drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.o
> with new macros
>   44353     184       0   44537    adf9
> ../build-64/drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.o
>
> As you can see, there is literally no size difference with this macro in place.
> The only drawback is that the init stops on the first write rather
> than going through the sequence.
>
> WDYT? I can turn this into a proper patch if you think this makes sense.

Ah, so what you're saying is that the big bloat from using the
existing mipi_dsi_dcs_write_seq() is the error printing. That makes
sense. ...and by relying on the caller to provide an error handling
label we can get rid of the overhead and still get the error prints.

Yes, that seems pretty reasonable to me. I guess I'd perhaps make the
error label a parameter to the macro (so it's obvious that the caller
needs to define it) and maybe name it in such a way to make it obvious
the difference between this macro and mipi_dsi_dcs_write_seq().

With that and your measurements then this seems perfectly reasonable
to me and I'm good with fully moving away from the table-based
approach. I'd be happy if you sent a patch for it and happy to review
it.

-Doug

      parent reply	other threads:[~2024-04-24 22:28 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-18  8:15 [PATCH v1 0/2] Add kd101ne3 bindings and driver lvzhaoxiong
2024-04-18  8:15 ` [PATCH v1 1/2] dt-bindings: display: panel: Add KD101NE3-40TI support lvzhaoxiong
2024-04-18 22:59   ` Krzysztof Kozlowski
2024-04-18  8:15 ` [PATCH v1 2/2] drm/panel: kd101ne3: add new panel driver lvzhaoxiong
2024-04-18 11:46   ` Dmitry Baryshkov
2024-04-18 13:11     ` Hsin-Yi Wang
2024-04-18 14:11       ` Dmitry Baryshkov
2024-04-23 18:10         ` Hsin-Yi Wang
2024-04-23 20:41           ` Doug Anderson
2024-04-23 21:20             ` Dmitry Baryshkov
2024-04-24 21:04               ` Doug Anderson
2024-04-24 21:18                 ` Hsin-Yi Wang
2024-04-24 21:49                 ` Dmitry Baryshkov
2024-04-24 22:15                   ` Hsin-Yi Wang
2024-04-24 22:50                     ` Dmitry Baryshkov
2024-04-24 23:25                       ` Doug Anderson
2024-04-24 23:37                         ` Dmitry Baryshkov
2024-04-25  0:21                           ` Doug Anderson
2024-04-24 22:27                   ` Doug Anderson [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAD=FV=U-1A4N5aMeRpx1sC6TsG_hdOOpstzirVrA-=oPoLeg3A@mail.gmail.com' \
    --to=dianders@google.com \
    --cc=airlied@gmail.com \
    --cc=conor+dt@kernel.org \
    --cc=daniel@ffwll.ch \
    --cc=devicetree@vger.kernel.org \
    --cc=dmitry.baryshkov@linaro.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=hsinyi@google.com \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lvzhaoxiong@huaqin.corp-partner.google.com \
    --cc=mripard@kernel.org \
    --cc=robh@kernel.org \
    --cc=yangcong5@huaqin.corp-partner.google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).