mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Geert Uytterhoeven <geert@linux-m68k.org>
To: Javier Martinez Canillas <javierm@redhat.com>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Rob Herring <robh@kernel.org>,
	DRI Development <dri-devel@lists.freedesktop.org>,
	Neil Armstrong <narmstrong@baylibre.com>,
	Mark Brown <broonie@kernel.org>,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	Chen-Yu Tsai <wens@kernel.org>, Chen-Yu Tsai <wens@csie.org>,
	Daniel Vetter <daniel@ffwll.ch>, David Airlie <airlied@linux.ie>,
	Maxime Ripard <maxime@cerno.tech>,
	YueHaibing <yuehaibing@huawei.com>
Subject: Re: [PATCH v2 5/5] drm/solomon: Add SSD130x OLED displays SPI support
Date: Tue, 12 Apr 2022 09:31:09 +0200	[thread overview]
Message-ID: <CAMuHMdWsmtBdcV=LL4yqprtbum4f9cSu8orjoPACECa5QENmsg@mail.gmail.com> (raw)
In-Reply-To: <20220411211243.11121-6-javierm@redhat.com>

Hi Javier,

On Mon, Apr 11, 2022 at 11:12 PM Javier Martinez Canillas
<javierm@redhat.com> wrote:
> The ssd130x driver only provides the core support for these devices but it
> does not have any bus transport logic. Add a driver to interface over SPI.
>
> There is a difference in the communication protocol when using 4-wire SPI
> instead of I2C. For the latter, a control byte that contains a D/C# field
> has to be sent. This field tells the controller whether the data has to be
> written to the command register or to the graphics display data memory.
>
> But for 4-wire SPI that control byte is not used, instead a real D/C# line
> must be pulled HIGH for commands data and LOW for graphics display data.
>
> For this reason the standard SPI regmap can't be used and a custom .write
> bus handler is needed.
>
> Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
> Acked-by: Mark Brown <broonie@kernel.org>

Thanks for your patch!

> --- /dev/null
> +++ b/drivers/gpu/drm/solomon/ssd130x-spi.c

> +static struct gpio_desc *ssd130x_spi_get_dc(struct device *dev)
> +{
> +       struct gpio_desc *dc = devm_gpiod_get(dev, "dc", GPIOD_OUT_LOW);
> +
> +       if (IS_ERR(dc))
> +               return ERR_PTR(dev_err_probe(dev, PTR_ERR(dc), "Failed to get dc gpio\n"));
> +
> +       return dc;
> +}
> +
> +static int ssd130x_spi_probe(struct spi_device *spi)
> +{
> +       struct ssd130x_spi_transport *t;
> +       struct ssd130x_device *ssd130x;
> +       struct regmap *regmap;
> +       struct device *dev = &spi->dev;
> +
> +       t = devm_kzalloc(dev, sizeof(*t), GFP_KERNEL);
> +       if (!t)
> +               return dev_err_probe(dev, -ENOMEM,
> +                                    "Failed to allocate SPI transport data\n");
> +
> +       t->spi = spi;
> +
> +       t->dc = ssd130x_spi_get_dc(&spi->dev);
> +       if (IS_ERR(t->dc))
> +               return PTR_ERR(t->dc);

This can be simplified (no need for the PTR_ERR(ERR_PTR(...) dance)
by open-coding ssd130x_spi_get_dc() here.

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

  reply	other threads:[~2022-04-12  9:28 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-11 21:12 [PATCH v2 0/5] " Javier Martinez Canillas
2022-04-11 21:12 ` [PATCH v2 1/5] dt-bindings: display: ssd1307fb: Deprecate "-i2c" compatible strings Javier Martinez Canillas
2022-04-12  7:13   ` Geert Uytterhoeven
2022-04-12 11:28   ` Maxime Ripard
2022-04-12 12:48     ` Javier Martinez Canillas
2022-04-12 12:07   ` Chen-Yu Tsai
2022-04-12 12:49     ` Javier Martinez Canillas
2022-04-11 21:12 ` [PATCH v2 2/5] dt-bindings: display: ssd1307fb: Extend schema for SPI controllers Javier Martinez Canillas
2022-04-12  7:16   ` Geert Uytterhoeven
2022-04-12  8:01     ` Javier Martinez Canillas
2022-04-12  8:07       ` Geert Uytterhoeven
2022-04-12  8:12         ` Javier Martinez Canillas
2022-04-12 18:16           ` Rob Herring
2022-04-11 21:12 ` [PATCH v2 3/5] drm/solomon: Add ssd130x new compatible strings and deprecate old ones Javier Martinez Canillas
2022-04-12  7:19   ` Geert Uytterhoeven
2022-04-12  8:03     ` Javier Martinez Canillas
2022-04-11 21:12 ` [PATCH v2 4/5] drm/solomon: Move device info from ssd130x-i2c to the core driver Javier Martinez Canillas
2022-04-12  7:23   ` Geert Uytterhoeven
2022-04-12  8:07     ` Javier Martinez Canillas
2022-04-12 11:21       ` Andy Shevchenko
2022-04-12 11:22         ` Andy Shevchenko
2022-04-12 12:47           ` Javier Martinez Canillas
2022-04-12 12:45         ` Javier Martinez Canillas
2022-04-12  7:25   ` kernel test robot
2022-04-11 21:12 ` [PATCH v2 5/5] drm/solomon: Add SSD130x OLED displays SPI support Javier Martinez Canillas
2022-04-12  7:31   ` Geert Uytterhoeven [this message]
2022-04-12  8:07     ` Javier Martinez Canillas
2022-04-12  8:17   ` kernel test robot

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='CAMuHMdWsmtBdcV=LL4yqprtbum4f9cSu8orjoPACECa5QENmsg@mail.gmail.com' \
    --to=geert@linux-m68k.org \
    --cc=airlied@linux.ie \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=broonie@kernel.org \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=javierm@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maxime@cerno.tech \
    --cc=narmstrong@baylibre.com \
    --cc=robh@kernel.org \
    --cc=wens@csie.org \
    --cc=wens@kernel.org \
    --cc=yuehaibing@huawei.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

all inboxes | Powered by JetHome®