dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Doug Anderson <dianders@chromium.org>
To: Linus Walleij <linus.walleij@linaro.org>
Cc: "Paul Cercueil" <paul@crapouillou.net>,
	"Thierry Reding" <thierry.reding@gmail.com>,
	"Sam Ravnborg" <sam@ravnborg.org>,
	dri-devel <dri-devel@lists.freedesktop.org>,
	"Noralf Trønnes" <noralf@tronnes.org>
Subject: Re: [PATCH v5] drm/panel: db7430: Add driver for Samsung DB7430
Date: Thu, 10 Jun 2021 15:30:39 -0700	[thread overview]
Message-ID: <CAD=FV=XVCNZTPmvLPx7uvU8r8uuHai2Mxpxt0-Jv-ryD=grAMw@mail.gmail.com> (raw)
In-Reply-To: <20210610220527.366432-1-linus.walleij@linaro.org>

Hi,

On Thu, Jun 10, 2021 at 3:07 PM Linus Walleij <linus.walleij@linaro.org> wrote:
>
> @@ -0,0 +1,347 @@
> +// SPDX-License-Identifier: GPL-2.0
> +/*
> + * Panel driver for the Samsung LMS397KF04 480x800 DPI RGB panel.
> + * According to the data sheet the display controller is called DB7430.
> + * Found in the Samsung Galaxy Beam GT-I8350 mobile phone.
> + * Linus Walleij <linus.walleij@linaro.org>
> + */
> +#include <drm/drm_modes.h>
> +#include <drm/drm_mipi_dbi.h>

nit that "mipi" sorts before "modes"


> +static int db7430_power_on(struct db7430 *db)
> +{
> +       struct mipi_dbi *dbi = &db->dbi;
> +       int ret;
> +
> +       /* Power up */
> +       ret = regulator_bulk_enable(ARRAY_SIZE(db->regulators),
> +                                   db->regulators);
> +       if (ret) {
> +               dev_err(db->dev, "failed to enable regulators: %d\n", ret);
> +               return ret;
> +       }
> +       msleep(50);
> +
> +       /* Assert reset >=1 ms */
> +       gpiod_set_value_cansleep(db->reset, 1);
> +       usleep_range(1000, 5000);
> +       /* De-assert reset */
> +       gpiod_set_value_cansleep(db->reset, 0);
> +       /* Wait >= 10 ms */
> +       msleep(10);
> +       dev_dbg(db->dev, "de-asserted RESET\n");
> +
> +       /*
> +        * This is set to 0x0a (RGB/BGR order + horizontal flip) in order
> +        * to make the display behave normally. If this is not set the displays
> +        * normal output behaviour is horizontally flipped and BGR ordered. Do
> +        * it twice because the first message doesn't always "take".
> +        */
> +       mipi_dbi_command(dbi, MIPI_DCS_SET_ADDRESS_MODE, 0x0a);

I would still prefer it if there was some type of error checking since
SPI commands can fail and could potentially fail silently. What about
at least this (untested):

#define db7430_dbi_cmd(_db, _cmd, _seq...) \
  do {
    int _ret = mipi_dbi_command(_db->dbi, _cmd, _seq);
    if (_ret)
      dev_warn(_db->dev, "DBI cmd %d failed (%d)\n", _cmd, _ret);
  } while (0)

Then at least you know _something_ will show up in the logs if there's
a transfer failure instead of silence?

If you truly don't want the error checking then I guess I won't
insist, but it feels like the kind of thing that will bite someone
eventually... In any case, I'm happy to add this now (especially since
the DBI stuff is Acked now).

Reviewed-by: Douglas Anderson <dianders@chromium.org>

I presume that you'd commit it to drm-misc yourself?

-Doug

  reply	other threads:[~2021-06-10 22:30 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-10 22:05 [PATCH v5] drm/panel: db7430: Add driver for Samsung DB7430 Linus Walleij
2021-06-10 22:30 ` Doug Anderson [this message]
2021-06-10 22:38   ` Linus Walleij
2021-06-10 22:42     ` Doug Anderson
2021-06-10 23:00       ` Linus Walleij
2021-06-10 23:05         ` Doug Anderson

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=XVCNZTPmvLPx7uvU8r8uuHai2Mxpxt0-Jv-ryD=grAMw@mail.gmail.com' \
    --to=dianders@chromium.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linus.walleij@linaro.org \
    --cc=noralf@tronnes.org \
    --cc=paul@crapouillou.net \
    --cc=sam@ravnborg.org \
    --cc=thierry.reding@gmail.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 NNTP newsgroup(s).