Re: [PATCH v1 2/2] drm/tinydrm: add driver for ST7735R panels

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





Den 06.12.2017 19.27, skrev Noralf Trønnes:

Den 29.11.2017 04.01, skrev David Lechner:
This adds a new driver for Sitronix ST7735R display panels.

This has been tested using an Adafruit 1.8" TFT.

Signed-off-by: David Lechner <david@xxxxxxxxxxxxxx>
---

<snip>

diff --git a/drivers/gpu/drm/tinydrm/st7735r.c b/drivers/gpu/drm/tinydrm/st7735r.c

<snip>

+static struct drm_driver st7735r_driver = {
+    .driver_features    = DRIVER_GEM | DRIVER_MODESET | DRIVER_PRIME |
+                  DRIVER_ATOMIC,
+    .fops            = &st7735r_fops,
+    TINYDRM_GEM_DRIVER_OPS,
+    .lastclose        = tinydrm_lastclose,

tinydrm_lastclose() is going away, please use:

    .lastclose        = drm_fb_helper_lastclose,

Noralf.

+    .name            = "st7735r",
+    .desc            = "Sitronix ST7735R",
+    .date            = "20171128",
+    .major            = 1,
+    .minor            = 0,
+};
+
+static const struct of_device_id st7735r_of_match[] = {
+    { .compatible = "sitronix,st7735r-jd-t18003-t01" },
+    {},
+};
+MODULE_DEVICE_TABLE(of, st7735r_of_match);
+
+static const struct spi_device_id st7735r_id[] = {
+    { "st7735r-jd-t18003-t01", 0 },
+    { },
+};
+MODULE_DEVICE_TABLE(spi, st7735r_id);
+
+static int st7735r_probe(struct spi_device *spi)
+{
+    struct device *dev = &spi->dev;
+    struct mipi_dbi *mipi;
+    struct gpio_desc *dc;
+    u32 rotation = 0;
+    int ret;
+
+    mipi = devm_kzalloc(dev, sizeof(*mipi), GFP_KERNEL);
+    if (!mipi)
+        return -ENOMEM;
+
+    mipi->reset = devm_gpiod_get(dev, "reset", GPIOD_OUT_HIGH);
+    if (IS_ERR(mipi->reset)) {
+        DRM_DEV_ERROR(dev, "Failed to get gpio 'reset'\n");
+        return PTR_ERR(mipi->reset);
+    }
+
+    dc = devm_gpiod_get(dev, "dc", GPIOD_OUT_LOW);
+    if (IS_ERR(dc)) {
+        DRM_DEV_ERROR(dev, "Failed to get gpio 'dc'\n");
+        return PTR_ERR(dc);
+    }
+
+    mipi->backlight = tinydrm_of_find_backlight(dev);
+    if (IS_ERR(mipi->backlight))
+        return PTR_ERR(mipi->backlight);
+
+    device_property_read_u32(dev, "rotation", &rotation);
+
+    ret = mipi_dbi_spi_init(spi, mipi, dc);
+    if (ret)
+        return ret;
+
+    ret = mipi_dbi_init(&spi->dev, mipi, &st7735r_pipe_funcs,
+                &st7735r_driver, &st7735r_mode, rotation);
+    if (ret)
+        return ret;
+
+    spi_set_drvdata(spi, mipi);
+
+    return devm_tinydrm_register(&mipi->tinydrm);
+}
+
+static void st7735r_shutdown(struct spi_device *spi)
+{
+    struct mipi_dbi *mipi = spi_get_drvdata(spi);
+
+    tinydrm_shutdown(&mipi->tinydrm);
+}
+
+static struct spi_driver st7735r_spi_driver = {
+    .driver = {
+        .name = "st7735r",
+        .owner = THIS_MODULE,
+        .of_match_table = st7735r_of_match,
+    },
+    .id_table = st7735r_id,
+    .probe = st7735r_probe,
+    .shutdown = st7735r_shutdown,
+};
+module_spi_driver(st7735r_spi_driver);
+
+MODULE_DESCRIPTION("Sitronix ST7735R DRM driver");
+MODULE_AUTHOR("David Lechner <david@xxxxxxxxxxxxxx>");
+MODULE_LICENSE("GPL");

_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/dri-devel


--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux