0f1abf00f4cf88e024af07d6c9a7ca530d0c7eff
[oweals/openwrt.git] /
1 From a28a55876fa9df72d7e3c1bc0fc2ea4bd65337f0 Mon Sep 17 00:00:00 2001
2 From: Eric Anholt <eric@anholt.net>
3 Date: Tue, 26 Apr 2016 13:46:13 -0700
4 Subject: [PATCH 126/454] drm/panel: Add support for the Raspberry Pi 7"
5  Touchscreen.
6
7 This driver communicates with the Atmel microcontroller for sequencing
8 the poweron of the TC358762 DSI-DPI bridge and controlling the
9 backlight PWM.
10
11 The following lines are required in config.txt, to keep the firmware
12 from trying to bash our I2C lines and steal the DSI interrupts:
13
14     disable_touchscreen=1
15     ignore_lcd=2
16     mask_gpu_interrupt1=0x1000
17
18 This means that the firmware won't power on the panel at boot time (no
19 rainbow) and the touchscreen input won't work.  The native input
20 driver for the touchscreen still needs to be written.
21
22 v2: Set the same default orientation as the closed source firmware
23     used, which is the best for viewing angle.
24
25 Signed-off-by: Eric Anholt <eric@anholt.net>
26 ---
27  drivers/gpu/drm/panel/Kconfig                 |   8 +
28  drivers/gpu/drm/panel/Makefile                |   1 +
29  .../drm/panel/panel-raspberrypi-touchscreen.c | 514 ++++++++++++++++++
30  3 files changed, 523 insertions(+)
31  create mode 100644 drivers/gpu/drm/panel/panel-raspberrypi-touchscreen.c
32
33 --- a/drivers/gpu/drm/panel/Kconfig
34 +++ b/drivers/gpu/drm/panel/Kconfig
35 @@ -73,6 +73,14 @@ config DRM_PANEL_PANASONIC_VVX10F034N00
36           WUXGA (1920x1200) Novatek NT1397-based DSI panel as found in some
37           Xperia Z2 tablets
38  
39 +config DRM_PANEL_RASPBERRYPI_TOUCHSCREEN
40 +       tristate "Raspberry Pi 7-inch touchscreen panel"
41 +       depends on DRM_MIPI_DSI
42 +       help
43 +         Say Y here if you want to enable support for the Raspberry
44 +         Pi 7" Touchscreen.  To compile this driver as a module,
45 +         choose M here.
46 +
47  config DRM_PANEL_SAMSUNG_S6E3HA2
48         tristate "Samsung S6E3HA2 DSI video mode panel"
49         depends on OF
50 --- a/drivers/gpu/drm/panel/Makefile
51 +++ b/drivers/gpu/drm/panel/Makefile
52 @@ -5,6 +5,7 @@ obj-$(CONFIG_DRM_PANEL_INNOLUX_P079ZCA)
53  obj-$(CONFIG_DRM_PANEL_JDI_LT070ME05000) += panel-jdi-lt070me05000.o
54  obj-$(CONFIG_DRM_PANEL_LG_LG4573) += panel-lg-lg4573.o
55  obj-$(CONFIG_DRM_PANEL_PANASONIC_VVX10F034N00) += panel-panasonic-vvx10f034n00.o
56 +obj-$(CONFIG_DRM_PANEL_RASPBERRYPI_TOUCHSCREEN) += panel-raspberrypi-touchscreen.o
57  obj-$(CONFIG_DRM_PANEL_SAMSUNG_LD9040) += panel-samsung-ld9040.o
58  obj-$(CONFIG_DRM_PANEL_SAMSUNG_S6E3HA2) += panel-samsung-s6e3ha2.o
59  obj-$(CONFIG_DRM_PANEL_SAMSUNG_S6E8AA0) += panel-samsung-s6e8aa0.o
60 --- /dev/null
61 +++ b/drivers/gpu/drm/panel/panel-raspberrypi-touchscreen.c
62 @@ -0,0 +1,514 @@
63 +/*
64 + * Copyright © 2016 Broadcom
65 + *
66 + * This program is free software; you can redistribute it and/or modify
67 + * it under the terms of the GNU General Public License version 2 as
68 + * published by the Free Software Foundation.
69 + *
70 + * Portions of this file (derived from panel-simple.c) are:
71 + *
72 + * Copyright (C) 2013, NVIDIA Corporation.  All rights reserved.
73 + *
74 + * Permission is hereby granted, free of charge, to any person obtaining a
75 + * copy of this software and associated documentation files (the "Software"),
76 + * to deal in the Software without restriction, including without limitation
77 + * the rights to use, copy, modify, merge, publish, distribute, sub license,
78 + * and/or sell copies of the Software, and to permit persons to whom the
79 + * Software is furnished to do so, subject to the following conditions:
80 + *
81 + * The above copyright notice and this permission notice (including the
82 + * next paragraph) shall be included in all copies or substantial portions
83 + * of the Software.
84 + *
85 + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
86 + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
87 + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
88 + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
89 + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
90 + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
91 + * DEALINGS IN THE SOFTWARE.
92 + */
93 +
94 +/**
95 + * DOC: Raspberry Pi 7" touchscreen panel driver.
96 + *
97 + * The 7" touchscreen consists of a DPI LCD panel, a Toshiba
98 + * TC358762XBG DSI-DPI bridge, and an I2C-connected Atmel ATTINY88-MUR
99 + * controlling power management, the LCD PWM, and the touchscreen.
100 + *
101 + * This driver presents this device as a MIPI DSI panel to the DRM
102 + * driver, and should expose the touchscreen as a HID device.
103 + */
104 +
105 +#include <linux/delay.h>
106 +#include <linux/err.h>
107 +#include <linux/fb.h>
108 +#include <linux/gpio.h>
109 +#include <linux/gpio/consumer.h>
110 +#include <linux/i2c.h>
111 +#include <linux/module.h>
112 +#include <linux/of.h>
113 +#include <linux/of_device.h>
114 +#include <linux/of_graph.h>
115 +#include <linux/pm.h>
116 +
117 +#include <drm/drm_panel.h>
118 +#include <drm/drmP.h>
119 +#include <drm/drm_crtc.h>
120 +#include <drm/drm_mipi_dsi.h>
121 +#include <drm/drm_panel.h>
122 +
123 +/* I2C registers of the Atmel microcontroller. */
124 +enum REG_ADDR {
125 +       REG_ID = 0x80,
126 +       REG_PORTA, // BIT(2) for horizontal flip, BIT(3) for vertical flip
127 +       REG_PORTB,
128 +       REG_PORTC,
129 +       REG_PORTD,
130 +       REG_POWERON,
131 +       REG_PWM,
132 +       REG_DDRA,
133 +       REG_DDRB,
134 +       REG_DDRC,
135 +       REG_DDRD,
136 +       REG_TEST,
137 +       REG_WR_ADDRL,
138 +       REG_WR_ADDRH,
139 +       REG_READH,
140 +       REG_READL,
141 +       REG_WRITEH,
142 +       REG_WRITEL,
143 +       REG_ID2,
144 +};
145 +
146 +/* We only turn the PWM on or off, without varying values. */
147 +#define RPI_TOUCHSCREEN_MAX_BRIGHTNESS 1
148 +
149 +/* DSI D-PHY Layer Registers */
150 +#define D0W_DPHYCONTTX         0x0004
151 +#define CLW_DPHYCONTRX         0x0020
152 +#define D0W_DPHYCONTRX         0x0024
153 +#define D1W_DPHYCONTRX         0x0028
154 +#define COM_DPHYCONTRX         0x0038
155 +#define CLW_CNTRL              0x0040
156 +#define D0W_CNTRL              0x0044
157 +#define D1W_CNTRL              0x0048
158 +#define DFTMODE_CNTRL          0x0054
159 +
160 +/* DSI PPI Layer Registers */
161 +#define PPI_STARTPPI           0x0104
162 +#define PPI_BUSYPPI            0x0108
163 +#define PPI_LINEINITCNT                0x0110
164 +#define PPI_LPTXTIMECNT                0x0114
165 +//#define PPI_LANEENABLE               0x0134
166 +//#define PPI_TX_RX_TA         0x013C
167 +#define PPI_CLS_ATMR           0x0140
168 +#define PPI_D0S_ATMR           0x0144
169 +#define PPI_D1S_ATMR           0x0148
170 +#define PPI_D0S_CLRSIPOCOUNT   0x0164
171 +#define PPI_D1S_CLRSIPOCOUNT   0x0168
172 +#define CLS_PRE                        0x0180
173 +#define D0S_PRE                        0x0184
174 +#define D1S_PRE                        0x0188
175 +#define CLS_PREP               0x01A0
176 +#define D0S_PREP               0x01A4
177 +#define D1S_PREP               0x01A8
178 +#define CLS_ZERO               0x01C0
179 +#define D0S_ZERO               0x01C4
180 +#define D1S_ZERO               0x01C8
181 +#define PPI_CLRFLG             0x01E0
182 +#define PPI_CLRSIPO            0x01E4
183 +#define HSTIMEOUT              0x01F0
184 +#define HSTIMEOUTENABLE                0x01F4
185 +
186 +/* DSI Protocol Layer Registers */
187 +#define DSI_STARTDSI           0x0204
188 +#define DSI_BUSYDSI            0x0208
189 +#define DSI_LANEENABLE         0x0210
190 +# define DSI_LANEENABLE_CLOCK          BIT(0)
191 +# define DSI_LANEENABLE_D0             BIT(1)
192 +# define DSI_LANEENABLE_D1             BIT(2)
193 +
194 +#define DSI_LANESTATUS0                0x0214
195 +#define DSI_LANESTATUS1                0x0218
196 +#define DSI_INTSTATUS          0x0220
197 +#define DSI_INTMASK            0x0224
198 +#define DSI_INTCLR             0x0228
199 +#define DSI_LPTXTO             0x0230
200 +#define DSI_MODE               0x0260
201 +#define DSI_PAYLOAD0           0x0268
202 +#define DSI_PAYLOAD1           0x026C
203 +#define DSI_SHORTPKTDAT                0x0270
204 +#define DSI_SHORTPKTREQ                0x0274
205 +#define DSI_BTASTA             0x0278
206 +#define DSI_BTACLR             0x027C
207 +
208 +/* DSI General Registers */
209 +#define DSIERRCNT              0x0300
210 +#define DSISIGMOD              0x0304
211 +
212 +/* DSI Application Layer Registers */
213 +#define APLCTRL                        0x0400
214 +#define APLSTAT                        0x0404
215 +#define APLERR                 0x0408
216 +#define PWRMOD                 0x040C
217 +#define RDPKTLN                        0x0410
218 +#define PXLFMT                 0x0414
219 +#define MEMWRCMD               0x0418
220 +
221 +/* LCDC/DPI Host Registers */
222 +#define LCDCTRL                        0x0420
223 +#define HSR                    0x0424
224 +#define HDISPR                 0x0428
225 +#define VSR                    0x042C
226 +#define VDISPR                 0x0430
227 +#define VFUEN                  0x0434
228 +
229 +/* DBI-B Host Registers */
230 +#define DBIBCTRL               0x0440
231 +
232 +/* SPI Master Registers */
233 +#define SPICMR                 0x0450
234 +#define SPITCR                 0x0454
235 +
236 +/* System Controller Registers */
237 +#define SYSSTAT                        0x0460
238 +#define SYSCTRL                        0x0464
239 +#define SYSPLL1                        0x0468
240 +#define SYSPLL2                        0x046C
241 +#define SYSPLL3                        0x0470
242 +#define SYSPMCTRL              0x047C
243 +
244 +/* GPIO Registers */
245 +#define GPIOC                  0x0480
246 +#define GPIOO                  0x0484
247 +#define GPIOI                  0x0488
248 +
249 +/* I2C Registers */
250 +#define I2CCLKCTRL             0x0490
251 +
252 +/* Chip/Rev Registers */
253 +#define IDREG                  0x04A0
254 +
255 +/* Debug Registers */
256 +#define WCMDQUEUE              0x0500
257 +#define RCMDQUEUE              0x0504
258 +
259 +struct rpi_touchscreen {
260 +       struct drm_panel base;
261 +       struct mipi_dsi_device *dsi;
262 +       struct i2c_client *bridge_i2c;
263 +
264 +       /* Version of the firmware on the bridge chip */
265 +       int atmel_ver;
266 +};
267 +
268 +static const struct drm_display_mode rpi_touchscreen_modes[] = {
269 +       {
270 +               /* The DSI PLL can only integer divide from the 2Ghz
271 +                * PLLD, giving us few choices.  We pick a divide by 3
272 +                * as our DSI HS clock, giving us a pixel clock of
273 +                * that divided by 24 bits.  Pad out HFP to get our
274 +                * panel to refresh at 60Hz, even if that doesn't
275 +                * match the datasheet.
276 +                */
277 +#define PIXEL_CLOCK ((2000000000 / 3) / 24)
278 +#define VREFRESH    60
279 +#define VTOTAL      (480 + 7 + 2 + 21)
280 +#define HACT        800
281 +#define HSW         2
282 +#define HBP         46
283 +#define HFP         ((PIXEL_CLOCK / (VTOTAL * VREFRESH)) - (HACT + HSW + HBP))
284 +
285 +               .clock = PIXEL_CLOCK / 1000,
286 +               .hdisplay = HACT,
287 +               .hsync_start = HACT + HFP,
288 +               .hsync_end = HACT + HFP + HSW,
289 +               .htotal = HACT + HFP + HSW + HBP,
290 +               .vdisplay = 480,
291 +               .vsync_start = 480 + 7,
292 +               .vsync_end = 480 + 7 + 2,
293 +               .vtotal = VTOTAL,
294 +               .vrefresh = 60,
295 +       },
296 +};
297 +
298 +static struct rpi_touchscreen *panel_to_ts(struct drm_panel *panel)
299 +{
300 +       return container_of(panel, struct rpi_touchscreen, base);
301 +}
302 +
303 +static u8 rpi_touchscreen_i2c_read(struct rpi_touchscreen *ts, u8 reg)
304 +{
305 +       return i2c_smbus_read_byte_data(ts->bridge_i2c, reg);
306 +}
307 +
308 +static void rpi_touchscreen_i2c_write(struct rpi_touchscreen *ts,
309 +                                     u8 reg, u8 val)
310 +{
311 +       int ret;
312 +
313 +       ret = i2c_smbus_write_byte_data(ts->bridge_i2c, reg, val);
314 +       if (ret)
315 +               dev_err(&ts->dsi->dev, "I2C write failed: %d\n", ret);
316 +}
317 +
318 +static int rpi_touchscreen_write(struct rpi_touchscreen *ts, u16 reg, u32 val)
319 +{
320 +#if 0
321 +       /* The firmware uses LP DSI transactions like this to bring up
322 +        * the hardware, which should be faster than using I2C to then
323 +        * pass to the Toshiba.  However, I was unable to get it to
324 +        * work.
325 +        */
326 +       u8 msg[] = {
327 +               reg,
328 +               reg >> 8,
329 +               val,
330 +               val >> 8,
331 +               val >> 16,
332 +               val >> 24,
333 +       };
334 +
335 +       mipi_dsi_dcs_write_buffer(ts->dsi, msg, sizeof(msg));
336 +#else
337 +       rpi_touchscreen_i2c_write(ts, REG_WR_ADDRH, reg >> 8);
338 +       rpi_touchscreen_i2c_write(ts, REG_WR_ADDRL, reg);
339 +       rpi_touchscreen_i2c_write(ts, REG_WRITEH, val >> 8);
340 +       rpi_touchscreen_i2c_write(ts, REG_WRITEL, val);
341 +#endif
342 +
343 +       return 0;
344 +}
345 +
346 +static int rpi_touchscreen_disable(struct drm_panel *panel)
347 +{
348 +       struct rpi_touchscreen *ts = panel_to_ts(panel);
349 +
350 +       rpi_touchscreen_i2c_write(ts, REG_PWM, 0);
351 +
352 +       rpi_touchscreen_i2c_write(ts, REG_POWERON, 0);
353 +       udelay(1);
354 +
355 +       return 0;
356 +}
357 +
358 +static int rpi_touchscreen_noop(struct drm_panel *panel)
359 +{
360 +       return 0;
361 +}
362 +
363 +static int rpi_touchscreen_enable(struct drm_panel *panel)
364 +{
365 +       struct rpi_touchscreen *ts = panel_to_ts(panel);
366 +       int i;
367 +
368 +       rpi_touchscreen_i2c_write(ts, REG_POWERON, 1);
369 +       /* Wait for nPWRDWN to go low to indicate poweron is done. */
370 +       for (i = 0; i < 100; i++) {
371 +               if (rpi_touchscreen_i2c_read(ts, REG_PORTB) & 1)
372 +                       break;
373 +       }
374 +
375 +       rpi_touchscreen_write(ts, DSI_LANEENABLE,
376 +                             DSI_LANEENABLE_CLOCK |
377 +                             DSI_LANEENABLE_D0 |
378 +                             (ts->dsi->lanes > 1 ? DSI_LANEENABLE_D1 : 0));
379 +       rpi_touchscreen_write(ts, PPI_D0S_CLRSIPOCOUNT, 0x05);
380 +       rpi_touchscreen_write(ts, PPI_D1S_CLRSIPOCOUNT, 0x05);
381 +       rpi_touchscreen_write(ts, PPI_D0S_ATMR, 0x00);
382 +       rpi_touchscreen_write(ts, PPI_D1S_ATMR, 0x00);
383 +       rpi_touchscreen_write(ts, PPI_LPTXTIMECNT, 0x03);
384 +
385 +       rpi_touchscreen_write(ts, SPICMR, 0x00);
386 +       rpi_touchscreen_write(ts, LCDCTRL, 0x00100150);
387 +       rpi_touchscreen_write(ts, SYSCTRL, 0x040f);
388 +       msleep(100);
389 +
390 +       rpi_touchscreen_write(ts, PPI_STARTPPI, 0x01);
391 +       rpi_touchscreen_write(ts, DSI_STARTDSI, 0x01);
392 +       msleep(100);
393 +
394 +       /* Turn on the backlight. */
395 +       rpi_touchscreen_i2c_write(ts, REG_PWM, 255);
396 +
397 +       /* Default to the same orientation as the closed source
398 +        * firmware used for the panel.  Runtime rotation
399 +        * configuration will be supported using VC4's plane
400 +        * orientation bits.
401 +        */
402 +       rpi_touchscreen_i2c_write(ts, REG_PORTA, BIT(2));
403 +
404 +       return 0;
405 +}
406 +
407 +static int rpi_touchscreen_get_modes(struct drm_panel *panel)
408 +{
409 +       struct drm_connector *connector = panel->connector;
410 +       struct drm_device *drm = panel->drm;
411 +       unsigned int i, num = 0;
412 +
413 +       for (i = 0; i < ARRAY_SIZE(rpi_touchscreen_modes); i++) {
414 +               const struct drm_display_mode *m = &rpi_touchscreen_modes[i];
415 +               struct drm_display_mode *mode;
416 +
417 +               mode = drm_mode_duplicate(drm, m);
418 +               if (!mode) {
419 +                       dev_err(drm->dev, "failed to add mode %ux%u@%u\n",
420 +                               m->hdisplay, m->vdisplay, m->vrefresh);
421 +                       continue;
422 +               }
423 +
424 +               mode->type |= DRM_MODE_TYPE_DRIVER;
425 +
426 +               if (i == 0)
427 +                       mode->type |= DRM_MODE_TYPE_PREFERRED;
428 +
429 +               drm_mode_set_name(mode);
430 +
431 +               drm_mode_probed_add(connector, mode);
432 +               num++;
433 +       }
434 +
435 +       connector->display_info.bpc = 8;
436 +       connector->display_info.width_mm = 154;
437 +       connector->display_info.height_mm = 86;
438 +
439 +       return num;
440 +}
441 +
442 +static const struct drm_panel_funcs rpi_touchscreen_funcs = {
443 +       .disable = rpi_touchscreen_disable,
444 +       .unprepare = rpi_touchscreen_noop,
445 +       .prepare = rpi_touchscreen_noop,
446 +       .enable = rpi_touchscreen_enable,
447 +       .get_modes = rpi_touchscreen_get_modes,
448 +};
449 +
450 +static struct i2c_client *rpi_touchscreen_get_i2c(struct device *dev,
451 +                                                 const char *name)
452 +{
453 +       struct device_node *node;
454 +       struct i2c_client *client;
455 +
456 +       node = of_parse_phandle(dev->of_node, name, 0);
457 +       if (!node)
458 +               return ERR_PTR(-ENODEV);
459 +
460 +       client = of_find_i2c_device_by_node(node);
461 +
462 +       of_node_put(node);
463 +
464 +       return client;
465 +}
466 +
467 +static int rpi_touchscreen_dsi_probe(struct mipi_dsi_device *dsi)
468 +{
469 +       struct device *dev = &dsi->dev;
470 +       struct rpi_touchscreen *ts;
471 +       int ret, ver;
472 +
473 +       ts = devm_kzalloc(dev, sizeof(*ts), GFP_KERNEL);
474 +       if (!ts)
475 +               return -ENOMEM;
476 +
477 +       dev_set_drvdata(dev, ts);
478 +
479 +       ts->dsi = dsi;
480 +       dsi->mode_flags = (MIPI_DSI_MODE_VIDEO |
481 +                          MIPI_DSI_MODE_VIDEO_SYNC_PULSE |
482 +                          MIPI_DSI_MODE_LPM);
483 +       dsi->format = MIPI_DSI_FMT_RGB888;
484 +       dsi->lanes = 1;
485 +
486 +       ts->bridge_i2c =
487 +               rpi_touchscreen_get_i2c(dev, "raspberrypi,touchscreen-bridge");
488 +       if (IS_ERR(ts->bridge_i2c)) {
489 +               ret = -EPROBE_DEFER;
490 +               return ret;
491 +       }
492 +
493 +       ver = rpi_touchscreen_i2c_read(ts, REG_ID);
494 +       if (ver < 0) {
495 +               dev_err(dev, "Atmel I2C read failed: %d\n", ver);
496 +               return -ENODEV;
497 +       }
498 +
499 +       switch (ver) {
500 +       case 0xde:
501 +               ts->atmel_ver = 1;
502 +               break;
503 +       case 0xc3:
504 +               ts->atmel_ver = 2;
505 +               break;
506 +       default:
507 +               dev_err(dev, "Unknown Atmel firmware revision: 0x%02x\n", ver);
508 +               return -ENODEV;
509 +       }
510 +
511 +       /* Turn off at boot, so we can cleanly sequence powering on. */
512 +       rpi_touchscreen_i2c_write(ts, REG_POWERON, 0);
513 +
514 +       drm_panel_init(&ts->base);
515 +       ts->base.dev = dev;
516 +       ts->base.funcs = &rpi_touchscreen_funcs;
517 +
518 +       ret = drm_panel_add(&ts->base);
519 +       if (ret < 0)
520 +               goto err_release_bridge;
521 +
522 +       return mipi_dsi_attach(dsi);
523 +
524 +err_release_bridge:
525 +       put_device(&ts->bridge_i2c->dev);
526 +       return ret;
527 +}
528 +
529 +static int rpi_touchscreen_dsi_remove(struct mipi_dsi_device *dsi)
530 +{
531 +       struct device *dev = &dsi->dev;
532 +       struct rpi_touchscreen *ts = dev_get_drvdata(dev);
533 +       int ret;
534 +
535 +       ret = mipi_dsi_detach(dsi);
536 +       if (ret < 0) {
537 +               dev_err(&dsi->dev, "failed to detach from DSI host: %d\n", ret);
538 +               return ret;
539 +       }
540 +
541 +       drm_panel_detach(&ts->base);
542 +       drm_panel_remove(&ts->base);
543 +
544 +       put_device(&ts->bridge_i2c->dev);
545 +
546 +       return 0;
547 +}
548 +
549 +static void rpi_touchscreen_dsi_shutdown(struct mipi_dsi_device *dsi)
550 +{
551 +       struct device *dev = &dsi->dev;
552 +       struct rpi_touchscreen *ts = dev_get_drvdata(dev);
553 +
554 +       rpi_touchscreen_i2c_write(ts, REG_POWERON, 0);
555 +}
556 +
557 +static const struct of_device_id rpi_touchscreen_of_match[] = {
558 +       { .compatible = "raspberrypi,touchscreen" },
559 +       { } /* sentinel */
560 +};
561 +MODULE_DEVICE_TABLE(of, rpi_touchscreen_of_match);
562 +
563 +static struct mipi_dsi_driver rpi_touchscreen_driver = {
564 +       .driver = {
565 +               .name = "raspberrypi-touchscreen",
566 +               .of_match_table = rpi_touchscreen_of_match,
567 +       },
568 +       .probe = rpi_touchscreen_dsi_probe,
569 +       .remove = rpi_touchscreen_dsi_remove,
570 +       .shutdown = rpi_touchscreen_dsi_shutdown,
571 +};
572 +module_mipi_dsi_driver(rpi_touchscreen_driver);
573 +
574 +MODULE_AUTHOR("Eric Anholt <eric@anholt.net>");
575 +MODULE_DESCRIPTION("Raspberry Pi 7-inch touchscreen driver");
576 +MODULE_LICENSE("GPL v2");