lkml.org 
[lkml]   [2024]   [Apr]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH] drm/mipi-dsi: Reduce driver bloat of mipi_dsi_*_write_seq()
On Fri, 26 Apr 2024 at 18:41, Doug Anderson <dianders@chromium.org> wrote:
>
> Hi,
>
> On Thu, Apr 25, 2024 at 8:03 PM Dmitry Baryshkov
> <dmitry.baryshkov@linaro.org> wrote:
> >
> > On Thu, Apr 25, 2024 at 10:04:49AM -0700, Doug Anderson wrote:
> > > Hi,
> > >
> > > On Thu, Apr 25, 2024 at 1:19 AM Jani Nikula <jani.nikula@linux.intel.com> wrote:
> > > >
> > > > > @@ -279,6 +281,8 @@ enum mipi_dsi_dcs_tear_mode {
> > > > >
> > > > > ssize_t mipi_dsi_dcs_write_buffer(struct mipi_dsi_device *dsi,
> > > > > const void *data, size_t len);
> > > > > +ssize_t mipi_dsi_dcs_write_buffer_chatty(struct mipi_dsi_device *dsi,
> > > > > + const void *data, size_t len);
> > > > > ssize_t mipi_dsi_dcs_write(struct mipi_dsi_device *dsi, u8 cmd,
> > > > > const void *data, size_t len);
> > > > > ssize_t mipi_dsi_dcs_read(struct mipi_dsi_device *dsi, u8 cmd, void *data,
> > > > > @@ -317,14 +321,10 @@ int mipi_dsi_dcs_get_display_brightness_large(struct mipi_dsi_device *dsi,
> > > > > #define mipi_dsi_generic_write_seq(dsi, seq...) \
> > > > > do { \
> > > > > static const u8 d[] = { seq }; \
> > > > > - struct device *dev = &dsi->dev; \
> > > > > int ret; \
> > > > > - ret = mipi_dsi_generic_write(dsi, d, ARRAY_SIZE(d)); \
> > > > > - if (ret < 0) { \
> > > > > - dev_err_ratelimited(dev, "transmit data failed: %d\n", \
> > > > > - ret); \
> > > > > + ret = mipi_dsi_generic_write_chatty(dsi, d, ARRAY_SIZE(d)); \
> > > > > + if (ret < 0) \
> > > > > return ret; \
> > > > > - } \
> > > > > } while (0)
> >
> >
> > Reading the thread makes me wonder whether we should be going into
> > slightly other direction:
> >
> > Add __must_check() to mipi_dsi_ writing functions,
> >
> > #define mipi_dsi_dcs_whatever_write(dsi, cmd, seq...) \
> > ({ \
> > static const u8 d[] = { cmd, seq }; \
> > mipi_dsi_dcs_write_buffer(dsi, d, ARRAY_SIZE(d)); \
> > })
> >
> > Then in panel drivers we actually have to explicitly handle the return
> > code (either by dropping to the error label or by just returning an
> > error).
>
> Given the sheer number of init commands needed by some panels (see
> j606f_boe_init_sequence() for instance) I'm still convinced that we
> want something that allows people to write their init code in a way
> that's not quite so verbose. It sounds as if Jani is OK w/ the
> proposal of using the "accumulated return value" (proposal #2 I had).
> I'm hoping you're OK w/ that too...

Yes, I'm fine with that.

--
With best wishes
Dmitry

\
 
 \ /
  Last update: 2024-04-26 17:43    [W:0.086 / U:0.648 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site