Lines Matching +full:0 +full:- +full:inch
2 * Copyright © 2016-2017 Broadcom
8 * Portions of this file (derived from panel-simple.c) are:
25 * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
36 * TC358762XBG DSI-DPI bridge, and an I2C-connected Atmel ATTINY88-MUR
59 #define RPI_DSI_DRIVER_NAME "rpi-ts-dsi"
63 REG_ID = 0x80,
84 /* DSI D-PHY Layer Registers */
85 #define D0W_DPHYCONTTX 0x0004
86 #define CLW_DPHYCONTRX 0x0020
87 #define D0W_DPHYCONTRX 0x0024
88 #define D1W_DPHYCONTRX 0x0028
89 #define COM_DPHYCONTRX 0x0038
90 #define CLW_CNTRL 0x0040
91 #define D0W_CNTRL 0x0044
92 #define D1W_CNTRL 0x0048
93 #define DFTMODE_CNTRL 0x0054
96 #define PPI_STARTPPI 0x0104
97 #define PPI_BUSYPPI 0x0108
98 #define PPI_LINEINITCNT 0x0110
99 #define PPI_LPTXTIMECNT 0x0114
100 #define PPI_CLS_ATMR 0x0140
101 #define PPI_D0S_ATMR 0x0144
102 #define PPI_D1S_ATMR 0x0148
103 #define PPI_D0S_CLRSIPOCOUNT 0x0164
104 #define PPI_D1S_CLRSIPOCOUNT 0x0168
105 #define CLS_PRE 0x0180
106 #define D0S_PRE 0x0184
107 #define D1S_PRE 0x0188
108 #define CLS_PREP 0x01A0
109 #define D0S_PREP 0x01A4
110 #define D1S_PREP 0x01A8
111 #define CLS_ZERO 0x01C0
112 #define D0S_ZERO 0x01C4
113 #define D1S_ZERO 0x01C8
114 #define PPI_CLRFLG 0x01E0
115 #define PPI_CLRSIPO 0x01E4
116 #define HSTIMEOUT 0x01F0
117 #define HSTIMEOUTENABLE 0x01F4
120 #define DSI_STARTDSI 0x0204
121 #define DSI_BUSYDSI 0x0208
122 #define DSI_LANEENABLE 0x0210
123 # define DSI_LANEENABLE_CLOCK BIT(0)
127 #define DSI_LANESTATUS0 0x0214
128 #define DSI_LANESTATUS1 0x0218
129 #define DSI_INTSTATUS 0x0220
130 #define DSI_INTMASK 0x0224
131 #define DSI_INTCLR 0x0228
132 #define DSI_LPTXTO 0x0230
133 #define DSI_MODE 0x0260
134 #define DSI_PAYLOAD0 0x0268
135 #define DSI_PAYLOAD1 0x026C
136 #define DSI_SHORTPKTDAT 0x0270
137 #define DSI_SHORTPKTREQ 0x0274
138 #define DSI_BTASTA 0x0278
139 #define DSI_BTACLR 0x027C
142 #define DSIERRCNT 0x0300
143 #define DSISIGMOD 0x0304
146 #define APLCTRL 0x0400
147 #define APLSTAT 0x0404
148 #define APLERR 0x0408
149 #define PWRMOD 0x040C
150 #define RDPKTLN 0x0410
151 #define PXLFMT 0x0414
152 #define MEMWRCMD 0x0418
155 #define LCDCTRL 0x0420
156 #define HSR 0x0424
157 #define HDISPR 0x0428
158 #define VSR 0x042C
159 #define VDISPR 0x0430
160 #define VFUEN 0x0434
162 /* DBI-B Host Registers */
163 #define DBIBCTRL 0x0440
166 #define SPICMR 0x0450
167 #define SPITCR 0x0454
170 #define SYSSTAT 0x0460
171 #define SYSCTRL 0x0464
172 #define SYSPLL1 0x0468
173 #define SYSPLL2 0x046C
174 #define SYSPLL3 0x0470
175 #define SYSPMCTRL 0x047C
178 #define GPIOC 0x0480
179 #define GPIOO 0x0484
180 #define GPIOI 0x0488
183 #define I2CCLKCTRL 0x0490
186 #define IDREG 0x04A0
189 #define WCMDQUEUE 0x0500
190 #define RCMDQUEUE 0x0504
201 * plugged in and clock re-computed from that.
222 return i2c_smbus_read_byte_data(ts->i2c, reg); in rpi_touchscreen_i2c_read()
230 ret = i2c_smbus_write_byte_data(ts->i2c, reg, val); in rpi_touchscreen_i2c_write()
232 dev_err(&ts->dsi->dev, "I2C write failed: %d\n", ret); in rpi_touchscreen_i2c_write()
246 mipi_dsi_generic_write(ts->dsi, msg, sizeof(msg)); in rpi_touchscreen_write()
248 return 0; in rpi_touchscreen_write()
255 rpi_touchscreen_i2c_write(ts, REG_PWM, 0); in rpi_touchscreen_disable()
257 rpi_touchscreen_i2c_write(ts, REG_POWERON, 0); in rpi_touchscreen_disable()
260 return 0; in rpi_touchscreen_disable()
265 return 0; in rpi_touchscreen_noop()
275 for (i = 0; i < 100; i++) { in rpi_touchscreen_enable()
283 rpi_touchscreen_write(ts, PPI_D0S_CLRSIPOCOUNT, 0x05); in rpi_touchscreen_enable()
284 rpi_touchscreen_write(ts, PPI_D1S_CLRSIPOCOUNT, 0x05); in rpi_touchscreen_enable()
285 rpi_touchscreen_write(ts, PPI_D0S_ATMR, 0x00); in rpi_touchscreen_enable()
286 rpi_touchscreen_write(ts, PPI_D1S_ATMR, 0x00); in rpi_touchscreen_enable()
287 rpi_touchscreen_write(ts, PPI_LPTXTIMECNT, 0x03); in rpi_touchscreen_enable()
289 rpi_touchscreen_write(ts, SPICMR, 0x00); in rpi_touchscreen_enable()
290 rpi_touchscreen_write(ts, LCDCTRL, 0x00100150); in rpi_touchscreen_enable()
291 rpi_touchscreen_write(ts, SYSCTRL, 0x040f); in rpi_touchscreen_enable()
294 rpi_touchscreen_write(ts, PPI_STARTPPI, 0x01); in rpi_touchscreen_enable()
295 rpi_touchscreen_write(ts, DSI_STARTDSI, 0x01); in rpi_touchscreen_enable()
308 return 0; in rpi_touchscreen_enable()
314 unsigned int i, num = 0; in rpi_touchscreen_get_modes()
317 for (i = 0; i < ARRAY_SIZE(rpi_touchscreen_modes); i++) { in rpi_touchscreen_get_modes()
321 mode = drm_mode_duplicate(connector->dev, m); in rpi_touchscreen_get_modes()
323 dev_err(panel->dev, "failed to add mode %ux%u@%u\n", in rpi_touchscreen_get_modes()
324 m->hdisplay, m->vdisplay, in rpi_touchscreen_get_modes()
329 mode->type |= DRM_MODE_TYPE_DRIVER; in rpi_touchscreen_get_modes()
331 if (i == 0) in rpi_touchscreen_get_modes()
332 mode->type |= DRM_MODE_TYPE_PREFERRED; in rpi_touchscreen_get_modes()
340 connector->display_info.bpc = 8; in rpi_touchscreen_get_modes()
341 connector->display_info.width_mm = 154; in rpi_touchscreen_get_modes()
342 connector->display_info.height_mm = 86; in rpi_touchscreen_get_modes()
343 drm_display_info_set_bus_formats(&connector->display_info, in rpi_touchscreen_get_modes()
360 struct device *dev = &i2c->dev; in rpi_touchscreen_probe()
367 .channel = 0, in rpi_touchscreen_probe()
373 return -ENOMEM; in rpi_touchscreen_probe()
377 ts->i2c = i2c; in rpi_touchscreen_probe()
380 if (ver < 0) { in rpi_touchscreen_probe()
382 return -ENODEV; in rpi_touchscreen_probe()
386 case 0xde: /* ver 1 */ in rpi_touchscreen_probe()
387 case 0xc3: /* ver 2 */ in rpi_touchscreen_probe()
390 dev_err(dev, "Unknown Atmel firmware revision: 0x%02x\n", ver); in rpi_touchscreen_probe()
391 return -ENODEV; in rpi_touchscreen_probe()
395 rpi_touchscreen_i2c_write(ts, REG_POWERON, 0); in rpi_touchscreen_probe()
398 endpoint = of_graph_get_next_endpoint(dev->of_node, NULL); in rpi_touchscreen_probe()
400 return -ENODEV; in rpi_touchscreen_probe()
410 return -EPROBE_DEFER; in rpi_touchscreen_probe()
419 ts->dsi = mipi_dsi_device_register_full(host, &info); in rpi_touchscreen_probe()
420 if (IS_ERR(ts->dsi)) { in rpi_touchscreen_probe()
422 PTR_ERR(ts->dsi)); in rpi_touchscreen_probe()
423 return PTR_ERR(ts->dsi); in rpi_touchscreen_probe()
426 drm_panel_init(&ts->base, dev, &rpi_touchscreen_funcs, in rpi_touchscreen_probe()
432 drm_panel_add(&ts->base); in rpi_touchscreen_probe()
434 return 0; in rpi_touchscreen_probe()
438 return -ENODEV; in rpi_touchscreen_probe()
445 mipi_dsi_detach(ts->dsi); in rpi_touchscreen_remove()
447 drm_panel_remove(&ts->base); in rpi_touchscreen_remove()
449 mipi_dsi_device_unregister(ts->dsi); in rpi_touchscreen_remove()
450 kfree(ts->dsi); in rpi_touchscreen_remove()
452 return 0; in rpi_touchscreen_remove()
459 dsi->mode_flags = (MIPI_DSI_MODE_VIDEO | in rpi_touchscreen_dsi_probe()
462 dsi->format = MIPI_DSI_FMT_RGB888; in rpi_touchscreen_dsi_probe()
463 dsi->lanes = 1; in rpi_touchscreen_dsi_probe()
468 dev_err(&dsi->dev, "failed to attach dsi to host: %d\n", ret); in rpi_touchscreen_dsi_probe()
479 { .compatible = "raspberrypi,7inch-touchscreen-panel" },
508 MODULE_DESCRIPTION("Raspberry Pi 7-inch touchscreen driver");