[PATCH 2/2] drm/panel: s6e63m0: Switch to DBI abstraction for SPI
Doug Anderson
dianders at chromium.org
Mon Jun 14 15:49:59 UTC 2021
Hi,
On Fri, Jun 11, 2021 at 2:44 PM Linus Walleij <linus.walleij at linaro.org> wrote:
>
> static int s6e63m0_spi_probe(struct spi_device *spi)
> {
> struct device *dev = &spi->dev;
> + struct mipi_dbi *dbi;
> int ret;
>
> - spi->bits_per_word = 9;
> - /* Preserve e.g. SPI_3WIRE setting */
> - spi->mode |= SPI_MODE_3;
> - ret = spi_setup(spi);
> - if (ret < 0) {
> - dev_err(dev, "spi setup failed.\n");
> - return ret;
> - }
> - return s6e63m0_probe(dev, s6e63m0_spi_dcs_read, s6e63m0_spi_dcs_write,
> - false);
> + dbi = devm_kzalloc(dev, sizeof(*dbi), GFP_KERNEL);
> + if (!dbi)
> + return -ENOMEM;
> +
> + ret = mipi_dbi_spi_init(spi, dbi, NULL);
> + if (ret)
> + return dev_err_probe(dev, ret, "MIPI DBI init failed\n");
> + /* Register our custom MCS read commands */
> + dbi->read_commands = s6e63m0_dbi_read_commands;
> +
> + spi_set_drvdata(spi, dbi);
I _think_ you want to remove the spi_set_drvdata(). It just gets
clobbered by the dev_set_drvdata() in s6e63m0_probe(), right? That's
why you had to add the "void *" data pointer?
Other than that this looks right to my non-expert eyes. ;-)
Reviewed-by: Douglas Anderson <dianders at chromium.org>
More information about the dri-devel
mailing list