Lines Matching +full:0 +full:- +full:2
1 // SPDX-License-Identifier: GPL-2.0
64 struct mipi_dsi_device *dsi[2];
78 { { 0xff, 0x20 }, 2 },
79 { { 0xfb, 0x01 }, 2 },
80 { { 0x00, 0x01 }, 2 },
81 { { 0x01, 0x55 }, 2 },
82 { { 0x02, 0x45 }, 2 },
83 { { 0x05, 0x40 }, 2 },
84 { { 0x06, 0x19 }, 2 },
85 { { 0x07, 0x1e }, 2 },
86 { { 0x0b, 0x73 }, 2 },
87 { { 0x0c, 0x73 }, 2 },
88 { { 0x0e, 0xb0 }, 2 },
89 { { 0x0f, 0xae }, 2 },
90 { { 0x11, 0xb8 }, 2 },
91 { { 0x13, 0x00 }, 2 },
92 { { 0x58, 0x80 }, 2 },
93 { { 0x59, 0x01 }, 2 },
94 { { 0x5a, 0x00 }, 2 },
95 { { 0x5b, 0x01 }, 2 },
96 { { 0x5c, 0x80 }, 2 },
97 { { 0x5d, 0x81 }, 2 },
98 { { 0x5e, 0x00 }, 2 },
99 { { 0x5f, 0x01 }, 2 },
100 { { 0x72, 0x11 }, 2 },
101 { { 0x68, 0x03 }, 2 },
103 { { 0xFF, 0x24 }, 2 },
104 { { 0xFB, 0x01 }, 2 },
105 { { 0x00, 0x1C }, 2 },
106 { { 0x01, 0x0B }, 2 },
107 { { 0x02, 0x0C }, 2 },
108 { { 0x03, 0x01 }, 2 },
109 { { 0x04, 0x0F }, 2 },
110 { { 0x05, 0x10 }, 2 },
111 { { 0x06, 0x10 }, 2 },
112 { { 0x07, 0x10 }, 2 },
113 { { 0x08, 0x89 }, 2 },
114 { { 0x09, 0x8A }, 2 },
115 { { 0x0A, 0x13 }, 2 },
116 { { 0x0B, 0x13 }, 2 },
117 { { 0x0C, 0x15 }, 2 },
118 { { 0x0D, 0x15 }, 2 },
119 { { 0x0E, 0x17 }, 2 },
120 { { 0x0F, 0x17 }, 2 },
121 { { 0x10, 0x1C }, 2 },
122 { { 0x11, 0x0B }, 2 },
123 { { 0x12, 0x0C }, 2 },
124 { { 0x13, 0x01 }, 2 },
125 { { 0x14, 0x0F }, 2 },
126 { { 0x15, 0x10 }, 2 },
127 { { 0x16, 0x10 }, 2 },
128 { { 0x17, 0x10 }, 2 },
129 { { 0x18, 0x89 }, 2 },
130 { { 0x19, 0x8A }, 2 },
131 { { 0x1A, 0x13 }, 2 },
132 { { 0x1B, 0x13 }, 2 },
133 { { 0x1C, 0x15 }, 2 },
134 { { 0x1D, 0x15 }, 2 },
135 { { 0x1E, 0x17 }, 2 },
136 { { 0x1F, 0x17 }, 2 },
138 { { 0x20, 0x40 }, 2 },
139 { { 0x21, 0x01 }, 2 },
140 { { 0x22, 0x00 }, 2 },
141 { { 0x23, 0x40 }, 2 },
142 { { 0x24, 0x40 }, 2 },
143 { { 0x25, 0x6D }, 2 },
144 { { 0x26, 0x40 }, 2 },
145 { { 0x27, 0x40 }, 2 },
147 { { 0xE0, 0x00 }, 2 },
148 { { 0xDC, 0x21 }, 2 },
149 { { 0xDD, 0x22 }, 2 },
150 { { 0xDE, 0x07 }, 2 },
151 { { 0xDF, 0x07 }, 2 },
152 { { 0xE3, 0x6D }, 2 },
153 { { 0xE1, 0x07 }, 2 },
154 { { 0xE2, 0x07 }, 2 },
156 { { 0x29, 0xD8 }, 2 },
157 { { 0x2A, 0x2A }, 2 },
159 { { 0x4B, 0x03 }, 2 },
160 { { 0x4C, 0x11 }, 2 },
161 { { 0x4D, 0x10 }, 2 },
162 { { 0x4E, 0x01 }, 2 },
163 { { 0x4F, 0x01 }, 2 },
164 { { 0x50, 0x10 }, 2 },
165 { { 0x51, 0x00 }, 2 },
166 { { 0x52, 0x80 }, 2 },
167 { { 0x53, 0x00 }, 2 },
168 { { 0x56, 0x00 }, 2 },
169 { { 0x54, 0x07 }, 2 },
170 { { 0x58, 0x07 }, 2 },
171 { { 0x55, 0x25 }, 2 },
173 { { 0x5B, 0x43 }, 2 },
174 { { 0x5C, 0x00 }, 2 },
175 { { 0x5F, 0x73 }, 2 },
176 { { 0x60, 0x73 }, 2 },
177 { { 0x63, 0x22 }, 2 },
178 { { 0x64, 0x00 }, 2 },
179 { { 0x67, 0x08 }, 2 },
180 { { 0x68, 0x04 }, 2 },
182 { { 0x72, 0x02 }, 2 },
184 { { 0x7A, 0x80 }, 2 },
185 { { 0x7B, 0x91 }, 2 },
186 { { 0x7C, 0xD8 }, 2 },
187 { { 0x7D, 0x60 }, 2 },
188 { { 0x7F, 0x15 }, 2 },
189 { { 0x75, 0x15 }, 2 },
191 { { 0xB3, 0xC0 }, 2 },
192 { { 0xB4, 0x00 }, 2 },
193 { { 0xB5, 0x00 }, 2 },
195 { { 0x78, 0x00 }, 2 },
196 { { 0x79, 0x00 }, 2 },
197 { { 0x80, 0x00 }, 2 },
198 { { 0x83, 0x00 }, 2 },
200 { { 0x93, 0x0A }, 2 },
201 { { 0x94, 0x0A }, 2 },
203 { { 0x8A, 0x00 }, 2 },
204 { { 0x9B, 0xFF }, 2 },
206 { { 0x9D, 0xB0 }, 2 },
207 { { 0x9F, 0x63 }, 2 },
208 { { 0x98, 0x10 }, 2 },
210 { { 0xEC, 0x00 }, 2 },
212 { { 0xFF, 0x10 }, 2 },
214 { { 0x3B, 0x03, 0x0A, 0x0A }, 4 },
216 { { 0x35, 0x00 }, 2 },
218 { { 0xE5, 0x01 }, 2 },
220 { { 0xBB, 0x03 }, 2 },
222 { { 0xFB, 0x01 }, 2 },
230 for (i = 0; i < ARRAY_SIZE(ctx->dsi); i++) { in truly_dcs_write()
231 ret = mipi_dsi_dcs_write(ctx->dsi[i], command, NULL, 0); in truly_dcs_write()
232 if (ret < 0) { in truly_dcs_write()
233 dev_err(ctx->dev, "cmd 0x%x failed for dsi = %d\n", command, i); in truly_dcs_write()
244 int ret = 0; in truly_dcs_write_buf()
247 for (i = 0; i < ARRAY_SIZE(ctx->dsi); i++) { in truly_dcs_write_buf()
248 ret = mipi_dsi_dcs_write_buffer(ctx->dsi[i], buf, size); in truly_dcs_write_buf()
249 if (ret < 0) { in truly_dcs_write_buf()
250 dev_err(ctx->dev, "failed to tx cmd [%d], err: %d\n", i, ret); in truly_dcs_write_buf()
262 for (i = 0; i < ARRAY_SIZE(ctx->supplies); i++) { in truly_35597_power_on()
263 ret = regulator_set_load(ctx->supplies[i].consumer, in truly_35597_power_on()
269 ret = regulator_bulk_enable(ARRAY_SIZE(ctx->supplies), ctx->supplies); in truly_35597_power_on()
270 if (ret < 0) in truly_35597_power_on()
278 gpiod_set_value(ctx->reset_gpio, 0); in truly_35597_power_on()
280 gpiod_set_value(ctx->reset_gpio, 1); in truly_35597_power_on()
282 gpiod_set_value(ctx->reset_gpio, 0); in truly_35597_power_on()
285 return 0; in truly_35597_power_on()
290 int ret = 0; in truly_nt35597_power_off()
293 gpiod_set_value(ctx->reset_gpio, 1); in truly_nt35597_power_off()
295 for (i = 0; i < ARRAY_SIZE(ctx->supplies); i++) { in truly_nt35597_power_off()
296 ret = regulator_set_load(ctx->supplies[i].consumer, in truly_nt35597_power_off()
299 dev_err(ctx->dev, "regulator_set_load failed %d\n", ret); in truly_nt35597_power_off()
304 ret = regulator_bulk_disable(ARRAY_SIZE(ctx->supplies), ctx->supplies); in truly_nt35597_power_off()
306 dev_err(ctx->dev, "regulator_bulk_disable failed %d\n", ret); in truly_nt35597_power_off()
316 if (!ctx->enabled) in truly_nt35597_disable()
317 return 0; in truly_nt35597_disable()
319 if (ctx->backlight) { in truly_nt35597_disable()
320 ret = backlight_disable(ctx->backlight); in truly_nt35597_disable()
321 if (ret < 0) in truly_nt35597_disable()
322 dev_err(ctx->dev, "backlight disable failed %d\n", ret); in truly_nt35597_disable()
325 ctx->enabled = false; in truly_nt35597_disable()
326 return 0; in truly_nt35597_disable()
332 int ret = 0; in truly_nt35597_unprepare()
334 if (!ctx->prepared) in truly_nt35597_unprepare()
335 return 0; in truly_nt35597_unprepare()
337 ctx->dsi[0]->mode_flags = 0; in truly_nt35597_unprepare()
338 ctx->dsi[1]->mode_flags = 0; in truly_nt35597_unprepare()
341 if (ret < 0) { in truly_nt35597_unprepare()
342 dev_err(ctx->dev, "set_display_off cmd failed ret = %d\n", ret); in truly_nt35597_unprepare()
349 if (ret < 0) { in truly_nt35597_unprepare()
350 dev_err(ctx->dev, "enter_sleep cmd failed ret = %d\n", ret); in truly_nt35597_unprepare()
354 if (ret < 0) in truly_nt35597_unprepare()
355 dev_err(ctx->dev, "power_off failed ret = %d\n", ret); in truly_nt35597_unprepare()
357 ctx->prepared = false; in truly_nt35597_unprepare()
370 if (ctx->prepared) in truly_nt35597_prepare()
371 return 0; in truly_nt35597_prepare()
374 if (ret < 0) in truly_nt35597_prepare()
377 ctx->dsi[0]->mode_flags |= MIPI_DSI_MODE_LPM; in truly_nt35597_prepare()
378 ctx->dsi[1]->mode_flags |= MIPI_DSI_MODE_LPM; in truly_nt35597_prepare()
380 config = ctx->config; in truly_nt35597_prepare()
381 panel_on_cmds = config->panel_on_cmds; in truly_nt35597_prepare()
382 num_cmds = config->num_on_cmds; in truly_nt35597_prepare()
384 for (i = 0; i < num_cmds; i++) { in truly_nt35597_prepare()
388 if (ret < 0) { in truly_nt35597_prepare()
389 dev_err(ctx->dev, "cmd set tx failed i = %d ret = %d\n", i, ret); in truly_nt35597_prepare()
395 if (ret < 0) { in truly_nt35597_prepare()
396 dev_err(ctx->dev, "exit_sleep_mode cmd failed ret = %d\n", ret); in truly_nt35597_prepare()
404 if (ret < 0) { in truly_nt35597_prepare()
405 dev_err(ctx->dev, "set_display_on cmd failed ret = %d\n", ret); in truly_nt35597_prepare()
412 ctx->prepared = true; in truly_nt35597_prepare()
414 return 0; in truly_nt35597_prepare()
418 dev_err(ctx->dev, "power_off failed\n"); in truly_nt35597_prepare()
427 if (ctx->enabled) in truly_nt35597_enable()
428 return 0; in truly_nt35597_enable()
430 if (ctx->backlight) { in truly_nt35597_enable()
431 ret = backlight_enable(ctx->backlight); in truly_nt35597_enable()
432 if (ret < 0) in truly_nt35597_enable()
433 dev_err(ctx->dev, "backlight enable failed %d\n", ret); in truly_nt35597_enable()
436 ctx->enabled = true; in truly_nt35597_enable()
438 return 0; in truly_nt35597_enable()
448 config = ctx->config; in truly_nt35597_get_modes()
449 mode = drm_mode_create(connector->dev); in truly_nt35597_get_modes()
451 dev_err(ctx->dev, "failed to create a new display mode\n"); in truly_nt35597_get_modes()
452 return 0; in truly_nt35597_get_modes()
455 connector->display_info.width_mm = config->width_mm; in truly_nt35597_get_modes()
456 connector->display_info.height_mm = config->height_mm; in truly_nt35597_get_modes()
457 drm_mode_copy(mode, config->dm); in truly_nt35597_get_modes()
458 mode->type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED; in truly_nt35597_get_modes()
474 struct device *dev = ctx->dev; in truly_nt35597_panel_add()
477 for (i = 0; i < ARRAY_SIZE(ctx->supplies); i++) in truly_nt35597_panel_add()
478 ctx->supplies[i].supply = regulator_names[i]; in truly_nt35597_panel_add()
480 ret = devm_regulator_bulk_get(dev, ARRAY_SIZE(ctx->supplies), in truly_nt35597_panel_add()
481 ctx->supplies); in truly_nt35597_panel_add()
482 if (ret < 0) in truly_nt35597_panel_add()
485 ctx->reset_gpio = devm_gpiod_get(dev, "reset", GPIOD_OUT_LOW); in truly_nt35597_panel_add()
486 if (IS_ERR(ctx->reset_gpio)) { in truly_nt35597_panel_add()
487 dev_err(dev, "cannot get reset gpio %ld\n", PTR_ERR(ctx->reset_gpio)); in truly_nt35597_panel_add()
488 return PTR_ERR(ctx->reset_gpio); in truly_nt35597_panel_add()
491 ctx->mode_gpio = devm_gpiod_get(dev, "mode", GPIOD_OUT_LOW); in truly_nt35597_panel_add()
492 if (IS_ERR(ctx->mode_gpio)) { in truly_nt35597_panel_add()
493 dev_err(dev, "cannot get mode gpio %ld\n", PTR_ERR(ctx->mode_gpio)); in truly_nt35597_panel_add()
494 return PTR_ERR(ctx->mode_gpio); in truly_nt35597_panel_add()
498 gpiod_set_value(ctx->mode_gpio, 0); in truly_nt35597_panel_add()
500 drm_panel_init(&ctx->panel, dev, &truly_nt35597_drm_funcs, in truly_nt35597_panel_add()
502 drm_panel_add(&ctx->panel); in truly_nt35597_panel_add()
504 return 0; in truly_nt35597_panel_add()
518 .flags = 0,
532 struct device *dev = &dsi->dev; in truly_nt35597_probe()
538 int ret = 0; in truly_nt35597_probe()
543 .channel = 0, in truly_nt35597_probe()
550 return -ENOMEM; in truly_nt35597_probe()
559 ctx->config = of_device_get_match_data(dev); in truly_nt35597_probe()
561 if (!ctx->config) { in truly_nt35597_probe()
563 return -ENODEV; in truly_nt35597_probe()
566 dsi1 = of_graph_get_remote_node(dsi->dev.of_node, 1, -1); in truly_nt35597_probe()
569 return -ENODEV; in truly_nt35597_probe()
576 return -EPROBE_DEFER; in truly_nt35597_probe()
588 ctx->dev = dev; in truly_nt35597_probe()
589 ctx->dsi[0] = dsi; in truly_nt35597_probe()
590 ctx->dsi[1] = dsi1_device; in truly_nt35597_probe()
598 for (i = 0; i < ARRAY_SIZE(ctx->dsi); i++) { in truly_nt35597_probe()
599 dsi_dev = ctx->dsi[i]; in truly_nt35597_probe()
600 dsi_dev->lanes = 4; in truly_nt35597_probe()
601 dsi_dev->format = MIPI_DSI_FMT_RGB888; in truly_nt35597_probe()
602 dsi_dev->mode_flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_LPM | in truly_nt35597_probe()
605 if (ret < 0) { in truly_nt35597_probe()
611 return 0; in truly_nt35597_probe()
614 drm_panel_remove(&ctx->panel); in truly_nt35597_probe()
624 if (ctx->dsi[0]) in truly_nt35597_remove()
625 mipi_dsi_detach(ctx->dsi[0]); in truly_nt35597_remove()
626 if (ctx->dsi[1]) { in truly_nt35597_remove()
627 mipi_dsi_detach(ctx->dsi[1]); in truly_nt35597_remove()
628 mipi_dsi_device_unregister(ctx->dsi[1]); in truly_nt35597_remove()
631 drm_panel_remove(&ctx->panel); in truly_nt35597_remove()
632 return 0; in truly_nt35597_remove()
637 .compatible = "truly,nt35597-2K-display",
646 .name = "panel-truly-nt35597",