David Lechner | 5b8ea81 | 2018-01-01 13:02:16 -0600 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
| 2 | /* |
Geert Uytterhoeven | d1d511d | 2020-01-15 13:45:48 +0100 | [diff] [blame] | 3 | * DRM driver for display panels connected to a Sitronix ST7715R or ST7735R |
| 4 | * display controller in SPI mode. |
David Lechner | 5b8ea81 | 2018-01-01 13:02:16 -0600 | [diff] [blame] | 5 | * |
| 6 | * Copyright 2017 David Lechner <david@lechnology.com> |
Geert Uytterhoeven | 98823f3 | 2020-01-15 13:45:47 +0100 | [diff] [blame] | 7 | * Copyright (C) 2019 Glider bvba |
David Lechner | 5b8ea81 | 2018-01-01 13:02:16 -0600 | [diff] [blame] | 8 | */ |
| 9 | |
Meghana Madhyastha | d1a2e70 | 2018-01-24 16:36:09 +0000 | [diff] [blame] | 10 | #include <linux/backlight.h> |
David Lechner | 5b8ea81 | 2018-01-01 13:02:16 -0600 | [diff] [blame] | 11 | #include <linux/delay.h> |
| 12 | #include <linux/dma-buf.h> |
| 13 | #include <linux/gpio/consumer.h> |
| 14 | #include <linux/module.h> |
| 15 | #include <linux/property.h> |
| 16 | #include <linux/spi/spi.h> |
| 17 | #include <video/mipi_display.h> |
| 18 | |
Noralf Trønnes | d0a5163 | 2019-02-10 14:10:33 +0100 | [diff] [blame] | 19 | #include <drm/drm_atomic_helper.h> |
Sam Ravnborg | 84056e9 | 2019-01-08 20:29:38 +0100 | [diff] [blame] | 20 | #include <drm/drm_drv.h> |
Noralf Trønnes | 3eba392 | 2019-02-25 15:42:30 +0100 | [diff] [blame] | 21 | #include <drm/drm_fb_helper.h> |
Thomas Zimmermann | 820c170 | 2021-02-22 15:17:56 +0100 | [diff] [blame] | 22 | #include <drm/drm_gem_atomic_helper.h> |
Danilo Krummrich | 4a83c26 | 2022-08-02 02:04:03 +0200 | [diff] [blame] | 23 | #include <drm/drm_gem_dma_helper.h> |
Daniel Vetter | f5ad671 | 2020-03-23 15:49:04 +0100 | [diff] [blame] | 24 | #include <drm/drm_managed.h> |
Noralf Trønnes | 174102f | 2019-07-22 12:43:11 +0200 | [diff] [blame] | 25 | #include <drm/drm_mipi_dbi.h> |
David Lechner | 5b8ea81 | 2018-01-01 13:02:16 -0600 | [diff] [blame] | 26 | |
| 27 | #define ST7735R_FRMCTR1 0xb1 |
| 28 | #define ST7735R_FRMCTR2 0xb2 |
| 29 | #define ST7735R_FRMCTR3 0xb3 |
| 30 | #define ST7735R_INVCTR 0xb4 |
| 31 | #define ST7735R_PWCTR1 0xc0 |
| 32 | #define ST7735R_PWCTR2 0xc1 |
| 33 | #define ST7735R_PWCTR3 0xc2 |
| 34 | #define ST7735R_PWCTR4 0xc3 |
| 35 | #define ST7735R_PWCTR5 0xc4 |
| 36 | #define ST7735R_VMCTR1 0xc5 |
| 37 | #define ST7735R_GAMCTRP1 0xe0 |
| 38 | #define ST7735R_GAMCTRN1 0xe1 |
| 39 | |
| 40 | #define ST7735R_MY BIT(7) |
| 41 | #define ST7735R_MX BIT(6) |
| 42 | #define ST7735R_MV BIT(5) |
Geert Uytterhoeven | 98823f3 | 2020-01-15 13:45:47 +0100 | [diff] [blame] | 43 | #define ST7735R_RGB BIT(3) |
David Lechner | 5b8ea81 | 2018-01-01 13:02:16 -0600 | [diff] [blame] | 44 | |
Geert Uytterhoeven | 98823f3 | 2020-01-15 13:45:47 +0100 | [diff] [blame] | 45 | struct st7735r_cfg { |
| 46 | const struct drm_display_mode mode; |
| 47 | unsigned int left_offset; |
| 48 | unsigned int top_offset; |
| 49 | unsigned int write_only:1; |
| 50 | unsigned int rgb:1; /* RGB (vs. BGR) */ |
| 51 | }; |
| 52 | |
| 53 | struct st7735r_priv { |
| 54 | struct mipi_dbi_dev dbidev; /* Must be first for .release() */ |
| 55 | const struct st7735r_cfg *cfg; |
| 56 | }; |
| 57 | |
| 58 | static void st7735r_pipe_enable(struct drm_simple_display_pipe *pipe, |
| 59 | struct drm_crtc_state *crtc_state, |
| 60 | struct drm_plane_state *plane_state) |
David Lechner | 5b8ea81 | 2018-01-01 13:02:16 -0600 | [diff] [blame] | 61 | { |
Noralf Trønnes | 84137b8 | 2019-07-22 12:43:07 +0200 | [diff] [blame] | 62 | struct mipi_dbi_dev *dbidev = drm_to_mipi_dbi_dev(pipe->crtc.dev); |
Geert Uytterhoeven | 98823f3 | 2020-01-15 13:45:47 +0100 | [diff] [blame] | 63 | struct st7735r_priv *priv = container_of(dbidev, struct st7735r_priv, |
| 64 | dbidev); |
Noralf Trønnes | 84137b8 | 2019-07-22 12:43:07 +0200 | [diff] [blame] | 65 | struct mipi_dbi *dbi = &dbidev->dbi; |
Noralf Trønnes | 9d5645a | 2019-02-25 15:42:32 +0100 | [diff] [blame] | 66 | int ret, idx; |
David Lechner | 5b8ea81 | 2018-01-01 13:02:16 -0600 | [diff] [blame] | 67 | u8 addr_mode; |
| 68 | |
Noralf Trønnes | 9d5645a | 2019-02-25 15:42:32 +0100 | [diff] [blame] | 69 | if (!drm_dev_enter(pipe->crtc.dev, &idx)) |
| 70 | return; |
| 71 | |
David Lechner | 5b8ea81 | 2018-01-01 13:02:16 -0600 | [diff] [blame] | 72 | DRM_DEBUG_KMS("\n"); |
| 73 | |
Noralf Trønnes | 440961d | 2019-07-22 12:43:06 +0200 | [diff] [blame] | 74 | ret = mipi_dbi_poweron_reset(dbidev); |
Noralf Trønnes | 070ab12 | 2018-01-10 19:59:37 +0100 | [diff] [blame] | 75 | if (ret) |
Noralf Trønnes | 9d5645a | 2019-02-25 15:42:32 +0100 | [diff] [blame] | 76 | goto out_exit; |
David Lechner | 5b8ea81 | 2018-01-01 13:02:16 -0600 | [diff] [blame] | 77 | |
| 78 | msleep(150); |
| 79 | |
Noralf Trønnes | 36b5057 | 2019-07-22 12:43:05 +0200 | [diff] [blame] | 80 | mipi_dbi_command(dbi, MIPI_DCS_EXIT_SLEEP_MODE); |
David Lechner | 5b8ea81 | 2018-01-01 13:02:16 -0600 | [diff] [blame] | 81 | msleep(500); |
| 82 | |
Noralf Trønnes | 36b5057 | 2019-07-22 12:43:05 +0200 | [diff] [blame] | 83 | mipi_dbi_command(dbi, ST7735R_FRMCTR1, 0x01, 0x2c, 0x2d); |
| 84 | mipi_dbi_command(dbi, ST7735R_FRMCTR2, 0x01, 0x2c, 0x2d); |
| 85 | mipi_dbi_command(dbi, ST7735R_FRMCTR3, 0x01, 0x2c, 0x2d, 0x01, 0x2c, |
David Lechner | 5b8ea81 | 2018-01-01 13:02:16 -0600 | [diff] [blame] | 86 | 0x2d); |
Noralf Trønnes | 36b5057 | 2019-07-22 12:43:05 +0200 | [diff] [blame] | 87 | mipi_dbi_command(dbi, ST7735R_INVCTR, 0x07); |
| 88 | mipi_dbi_command(dbi, ST7735R_PWCTR1, 0xa2, 0x02, 0x84); |
| 89 | mipi_dbi_command(dbi, ST7735R_PWCTR2, 0xc5); |
| 90 | mipi_dbi_command(dbi, ST7735R_PWCTR3, 0x0a, 0x00); |
| 91 | mipi_dbi_command(dbi, ST7735R_PWCTR4, 0x8a, 0x2a); |
| 92 | mipi_dbi_command(dbi, ST7735R_PWCTR5, 0x8a, 0xee); |
| 93 | mipi_dbi_command(dbi, ST7735R_VMCTR1, 0x0e); |
| 94 | mipi_dbi_command(dbi, MIPI_DCS_EXIT_INVERT_MODE); |
Noralf Trønnes | 440961d | 2019-07-22 12:43:06 +0200 | [diff] [blame] | 95 | switch (dbidev->rotation) { |
David Lechner | 5b8ea81 | 2018-01-01 13:02:16 -0600 | [diff] [blame] | 96 | default: |
| 97 | addr_mode = ST7735R_MX | ST7735R_MY; |
| 98 | break; |
| 99 | case 90: |
| 100 | addr_mode = ST7735R_MX | ST7735R_MV; |
| 101 | break; |
| 102 | case 180: |
| 103 | addr_mode = 0; |
| 104 | break; |
| 105 | case 270: |
| 106 | addr_mode = ST7735R_MY | ST7735R_MV; |
| 107 | break; |
| 108 | } |
Geert Uytterhoeven | 98823f3 | 2020-01-15 13:45:47 +0100 | [diff] [blame] | 109 | |
| 110 | if (priv->cfg->rgb) |
| 111 | addr_mode |= ST7735R_RGB; |
| 112 | |
Noralf Trønnes | 36b5057 | 2019-07-22 12:43:05 +0200 | [diff] [blame] | 113 | mipi_dbi_command(dbi, MIPI_DCS_SET_ADDRESS_MODE, addr_mode); |
| 114 | mipi_dbi_command(dbi, MIPI_DCS_SET_PIXEL_FORMAT, |
David Lechner | 5b8ea81 | 2018-01-01 13:02:16 -0600 | [diff] [blame] | 115 | MIPI_DCS_PIXEL_FMT_16BIT); |
Noralf Trønnes | 36b5057 | 2019-07-22 12:43:05 +0200 | [diff] [blame] | 116 | mipi_dbi_command(dbi, ST7735R_GAMCTRP1, 0x02, 0x1c, 0x07, 0x12, 0x37, |
David Lechner | 5b8ea81 | 2018-01-01 13:02:16 -0600 | [diff] [blame] | 117 | 0x32, 0x29, 0x2d, 0x29, 0x25, 0x2b, 0x39, 0x00, 0x01, |
| 118 | 0x03, 0x10); |
Noralf Trønnes | 36b5057 | 2019-07-22 12:43:05 +0200 | [diff] [blame] | 119 | mipi_dbi_command(dbi, ST7735R_GAMCTRN1, 0x03, 0x1d, 0x07, 0x06, 0x2e, |
David Lechner | 5b8ea81 | 2018-01-01 13:02:16 -0600 | [diff] [blame] | 120 | 0x2c, 0x29, 0x2d, 0x2e, 0x2e, 0x37, 0x3f, 0x00, 0x00, |
| 121 | 0x02, 0x10); |
Noralf Trønnes | 36b5057 | 2019-07-22 12:43:05 +0200 | [diff] [blame] | 122 | mipi_dbi_command(dbi, MIPI_DCS_SET_DISPLAY_ON); |
David Lechner | 5b8ea81 | 2018-01-01 13:02:16 -0600 | [diff] [blame] | 123 | |
| 124 | msleep(100); |
| 125 | |
Noralf Trønnes | 36b5057 | 2019-07-22 12:43:05 +0200 | [diff] [blame] | 126 | mipi_dbi_command(dbi, MIPI_DCS_ENTER_NORMAL_MODE); |
David Lechner | 5b8ea81 | 2018-01-01 13:02:16 -0600 | [diff] [blame] | 127 | |
| 128 | msleep(20); |
| 129 | |
Noralf Trønnes | 440961d | 2019-07-22 12:43:06 +0200 | [diff] [blame] | 130 | mipi_dbi_enable_flush(dbidev, crtc_state, plane_state); |
Noralf Trønnes | 9d5645a | 2019-02-25 15:42:32 +0100 | [diff] [blame] | 131 | out_exit: |
| 132 | drm_dev_exit(idx); |
David Lechner | 5b8ea81 | 2018-01-01 13:02:16 -0600 | [diff] [blame] | 133 | } |
| 134 | |
Geert Uytterhoeven | 98823f3 | 2020-01-15 13:45:47 +0100 | [diff] [blame] | 135 | static const struct drm_simple_display_pipe_funcs st7735r_pipe_funcs = { |
Thomas Zimmermann | 216b9bb | 2022-09-05 16:16:46 +0200 | [diff] [blame] | 136 | .mode_valid = mipi_dbi_pipe_mode_valid, |
Geert Uytterhoeven | 98823f3 | 2020-01-15 13:45:47 +0100 | [diff] [blame] | 137 | .enable = st7735r_pipe_enable, |
David Lechner | 5b8ea81 | 2018-01-01 13:02:16 -0600 | [diff] [blame] | 138 | .disable = mipi_dbi_pipe_disable, |
Noralf Trønnes | af74138 | 2019-01-15 05:36:42 +0100 | [diff] [blame] | 139 | .update = mipi_dbi_pipe_update, |
David Lechner | 5b8ea81 | 2018-01-01 13:02:16 -0600 | [diff] [blame] | 140 | }; |
| 141 | |
Geert Uytterhoeven | 98823f3 | 2020-01-15 13:45:47 +0100 | [diff] [blame] | 142 | static const struct st7735r_cfg jd_t18003_t01_cfg = { |
| 143 | .mode = { DRM_SIMPLE_MODE(128, 160, 28, 35) }, |
| 144 | /* Cannot read from Adafruit 1.8" display via SPI */ |
| 145 | .write_only = true, |
| 146 | }; |
| 147 | |
Geert Uytterhoeven | d1d511d | 2020-01-15 13:45:48 +0100 | [diff] [blame] | 148 | static const struct st7735r_cfg rh128128t_cfg = { |
| 149 | .mode = { DRM_SIMPLE_MODE(128, 128, 25, 26) }, |
| 150 | .left_offset = 2, |
| 151 | .top_offset = 3, |
| 152 | .rgb = true, |
David Lechner | 5b8ea81 | 2018-01-01 13:02:16 -0600 | [diff] [blame] | 153 | }; |
| 154 | |
Danilo Krummrich | 4a83c26 | 2022-08-02 02:04:03 +0200 | [diff] [blame] | 155 | DEFINE_DRM_GEM_DMA_FOPS(st7735r_fops); |
David Lechner | 5b8ea81 | 2018-01-01 13:02:16 -0600 | [diff] [blame] | 156 | |
Daniel Vetter | 70a59dd | 2020-11-04 11:04:24 +0100 | [diff] [blame] | 157 | static const struct drm_driver st7735r_driver = { |
Daniel Vetter | 0424fda | 2019-06-17 17:39:24 +0200 | [diff] [blame] | 158 | .driver_features = DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC, |
David Lechner | 5b8ea81 | 2018-01-01 13:02:16 -0600 | [diff] [blame] | 159 | .fops = &st7735r_fops, |
Danilo Krummrich | 4a83c26 | 2022-08-02 02:04:03 +0200 | [diff] [blame] | 160 | DRM_GEM_DMA_DRIVER_OPS_VMAP, |
David Lechner | 5b8ea81 | 2018-01-01 13:02:16 -0600 | [diff] [blame] | 161 | .debugfs_init = mipi_dbi_debugfs_init, |
| 162 | .name = "st7735r", |
| 163 | .desc = "Sitronix ST7735R", |
| 164 | .date = "20171128", |
| 165 | .major = 1, |
| 166 | .minor = 0, |
| 167 | }; |
| 168 | |
| 169 | static const struct of_device_id st7735r_of_match[] = { |
Geert Uytterhoeven | 98823f3 | 2020-01-15 13:45:47 +0100 | [diff] [blame] | 170 | { .compatible = "jianda,jd-t18003-t01", .data = &jd_t18003_t01_cfg }, |
Geert Uytterhoeven | d1d511d | 2020-01-15 13:45:48 +0100 | [diff] [blame] | 171 | { .compatible = "okaya,rh128128t", .data = &rh128128t_cfg }, |
David Lechner | 5b8ea81 | 2018-01-01 13:02:16 -0600 | [diff] [blame] | 172 | { }, |
| 173 | }; |
| 174 | MODULE_DEVICE_TABLE(of, st7735r_of_match); |
| 175 | |
| 176 | static const struct spi_device_id st7735r_id[] = { |
Geert Uytterhoeven | 98823f3 | 2020-01-15 13:45:47 +0100 | [diff] [blame] | 177 | { "jd-t18003-t01", (uintptr_t)&jd_t18003_t01_cfg }, |
Javier Martinez Canillas | 9ad6f18 | 2022-05-20 11:16:02 +0200 | [diff] [blame] | 178 | { "rh128128t", (uintptr_t)&rh128128t_cfg }, |
David Lechner | 5b8ea81 | 2018-01-01 13:02:16 -0600 | [diff] [blame] | 179 | { }, |
| 180 | }; |
| 181 | MODULE_DEVICE_TABLE(spi, st7735r_id); |
| 182 | |
| 183 | static int st7735r_probe(struct spi_device *spi) |
| 184 | { |
| 185 | struct device *dev = &spi->dev; |
Geert Uytterhoeven | 98823f3 | 2020-01-15 13:45:47 +0100 | [diff] [blame] | 186 | const struct st7735r_cfg *cfg; |
Noralf Trønnes | 84137b8 | 2019-07-22 12:43:07 +0200 | [diff] [blame] | 187 | struct mipi_dbi_dev *dbidev; |
Geert Uytterhoeven | 98823f3 | 2020-01-15 13:45:47 +0100 | [diff] [blame] | 188 | struct st7735r_priv *priv; |
Noralf Trønnes | 3eba392 | 2019-02-25 15:42:30 +0100 | [diff] [blame] | 189 | struct drm_device *drm; |
Noralf Trønnes | 36b5057 | 2019-07-22 12:43:05 +0200 | [diff] [blame] | 190 | struct mipi_dbi *dbi; |
David Lechner | 5b8ea81 | 2018-01-01 13:02:16 -0600 | [diff] [blame] | 191 | struct gpio_desc *dc; |
| 192 | u32 rotation = 0; |
| 193 | int ret; |
| 194 | |
Andy Shevchenko | 5703d6a | 2020-01-31 22:49:26 +0200 | [diff] [blame] | 195 | cfg = device_get_match_data(&spi->dev); |
Geert Uytterhoeven | 98823f3 | 2020-01-15 13:45:47 +0100 | [diff] [blame] | 196 | if (!cfg) |
| 197 | cfg = (void *)spi_get_device_id(spi)->driver_data; |
| 198 | |
Daniel Vetter | 14877bc7 | 2020-04-15 09:39:48 +0200 | [diff] [blame] | 199 | priv = devm_drm_dev_alloc(dev, &st7735r_driver, |
| 200 | struct st7735r_priv, dbidev.drm); |
| 201 | if (IS_ERR(priv)) |
| 202 | return PTR_ERR(priv); |
David Lechner | 5b8ea81 | 2018-01-01 13:02:16 -0600 | [diff] [blame] | 203 | |
Geert Uytterhoeven | 98823f3 | 2020-01-15 13:45:47 +0100 | [diff] [blame] | 204 | dbidev = &priv->dbidev; |
| 205 | priv->cfg = cfg; |
| 206 | |
Noralf Trønnes | 84137b8 | 2019-07-22 12:43:07 +0200 | [diff] [blame] | 207 | dbi = &dbidev->dbi; |
Noralf Trønnes | 440961d | 2019-07-22 12:43:06 +0200 | [diff] [blame] | 208 | drm = &dbidev->drm; |
Noralf Trønnes | 3eba392 | 2019-02-25 15:42:30 +0100 | [diff] [blame] | 209 | |
Noralf Trønnes | 36b5057 | 2019-07-22 12:43:05 +0200 | [diff] [blame] | 210 | dbi->reset = devm_gpiod_get(dev, "reset", GPIOD_OUT_HIGH); |
Andy Shevchenko | a3204e2 | 2021-04-21 19:31:51 +0300 | [diff] [blame] | 211 | if (IS_ERR(dbi->reset)) |
| 212 | return dev_err_probe(dev, PTR_ERR(dbi->reset), "Failed to get GPIO 'reset'\n"); |
David Lechner | 5b8ea81 | 2018-01-01 13:02:16 -0600 | [diff] [blame] | 213 | |
| 214 | dc = devm_gpiod_get(dev, "dc", GPIOD_OUT_LOW); |
Andy Shevchenko | a3204e2 | 2021-04-21 19:31:51 +0300 | [diff] [blame] | 215 | if (IS_ERR(dc)) |
| 216 | return dev_err_probe(dev, PTR_ERR(dc), "Failed to get GPIO 'dc'\n"); |
David Lechner | 5b8ea81 | 2018-01-01 13:02:16 -0600 | [diff] [blame] | 217 | |
Noralf Trønnes | 440961d | 2019-07-22 12:43:06 +0200 | [diff] [blame] | 218 | dbidev->backlight = devm_of_find_backlight(dev); |
| 219 | if (IS_ERR(dbidev->backlight)) |
| 220 | return PTR_ERR(dbidev->backlight); |
David Lechner | 5b8ea81 | 2018-01-01 13:02:16 -0600 | [diff] [blame] | 221 | |
| 222 | device_property_read_u32(dev, "rotation", &rotation); |
| 223 | |
Noralf Trønnes | 36b5057 | 2019-07-22 12:43:05 +0200 | [diff] [blame] | 224 | ret = mipi_dbi_spi_init(spi, dbi, dc); |
David Lechner | 5b8ea81 | 2018-01-01 13:02:16 -0600 | [diff] [blame] | 225 | if (ret) |
| 226 | return ret; |
| 227 | |
Geert Uytterhoeven | 98823f3 | 2020-01-15 13:45:47 +0100 | [diff] [blame] | 228 | if (cfg->write_only) |
| 229 | dbi->read_commands = NULL; |
David Lechner | 5b8ea81 | 2018-01-01 13:02:16 -0600 | [diff] [blame] | 230 | |
Geert Uytterhoeven | 98823f3 | 2020-01-15 13:45:47 +0100 | [diff] [blame] | 231 | dbidev->left_offset = cfg->left_offset; |
| 232 | dbidev->top_offset = cfg->top_offset; |
| 233 | |
| 234 | ret = mipi_dbi_dev_init(dbidev, &st7735r_pipe_funcs, &cfg->mode, |
| 235 | rotation); |
David Lechner | 5b8ea81 | 2018-01-01 13:02:16 -0600 | [diff] [blame] | 236 | if (ret) |
| 237 | return ret; |
| 238 | |
Noralf Trønnes | 3eba392 | 2019-02-25 15:42:30 +0100 | [diff] [blame] | 239 | drm_mode_config_reset(drm); |
David Lechner | 5b8ea81 | 2018-01-01 13:02:16 -0600 | [diff] [blame] | 240 | |
Noralf Trønnes | 3eba392 | 2019-02-25 15:42:30 +0100 | [diff] [blame] | 241 | ret = drm_dev_register(drm, 0); |
| 242 | if (ret) |
| 243 | return ret; |
| 244 | |
| 245 | spi_set_drvdata(spi, drm); |
| 246 | |
Noralf Trønnes | f47056e | 2019-04-10 14:43:45 +0200 | [diff] [blame] | 247 | drm_fbdev_generic_setup(drm, 0); |
Noralf Trønnes | 3eba392 | 2019-02-25 15:42:30 +0100 | [diff] [blame] | 248 | |
| 249 | return 0; |
| 250 | } |
| 251 | |
Uwe Kleine-König | a0386bb | 2022-01-23 18:52:01 +0100 | [diff] [blame] | 252 | static void st7735r_remove(struct spi_device *spi) |
Noralf Trønnes | 3eba392 | 2019-02-25 15:42:30 +0100 | [diff] [blame] | 253 | { |
| 254 | struct drm_device *drm = spi_get_drvdata(spi); |
| 255 | |
| 256 | drm_dev_unplug(drm); |
| 257 | drm_atomic_helper_shutdown(drm); |
David Lechner | 5b8ea81 | 2018-01-01 13:02:16 -0600 | [diff] [blame] | 258 | } |
| 259 | |
| 260 | static void st7735r_shutdown(struct spi_device *spi) |
| 261 | { |
Noralf Trønnes | d0a5163 | 2019-02-10 14:10:33 +0100 | [diff] [blame] | 262 | drm_atomic_helper_shutdown(spi_get_drvdata(spi)); |
David Lechner | 5b8ea81 | 2018-01-01 13:02:16 -0600 | [diff] [blame] | 263 | } |
| 264 | |
| 265 | static struct spi_driver st7735r_spi_driver = { |
| 266 | .driver = { |
| 267 | .name = "st7735r", |
David Lechner | 5b8ea81 | 2018-01-01 13:02:16 -0600 | [diff] [blame] | 268 | .of_match_table = st7735r_of_match, |
| 269 | }, |
| 270 | .id_table = st7735r_id, |
| 271 | .probe = st7735r_probe, |
Noralf Trønnes | 3eba392 | 2019-02-25 15:42:30 +0100 | [diff] [blame] | 272 | .remove = st7735r_remove, |
David Lechner | 5b8ea81 | 2018-01-01 13:02:16 -0600 | [diff] [blame] | 273 | .shutdown = st7735r_shutdown, |
| 274 | }; |
| 275 | module_spi_driver(st7735r_spi_driver); |
| 276 | |
| 277 | MODULE_DESCRIPTION("Sitronix ST7735R DRM driver"); |
| 278 | MODULE_AUTHOR("David Lechner <david@lechnology.com>"); |
| 279 | MODULE_LICENSE("GPL"); |