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