Lines Matching +full:dual +full:- +full:dsi +full:- +full:mode

1 // SPDX-License-Identifier: GPL-2.0
64 struct mipi_dsi_device *dsi[2]; member
217 /* CMD mode(10) VDO mode(03) */
228 for (i = 0; i < ARRAY_SIZE(ctx->dsi); i++) { in truly_dcs_write()
229 ret = mipi_dsi_dcs_write(ctx->dsi[i], command, NULL, 0); in truly_dcs_write()
231 dev_err(ctx->dev, "cmd 0x%x failed for dsi = %d\n", command, i); in truly_dcs_write()
245 for (i = 0; i < ARRAY_SIZE(ctx->dsi); i++) { in truly_dcs_write_buf()
246 ret = mipi_dsi_dcs_write_buffer(ctx->dsi[i], buf, size); in truly_dcs_write_buf()
248 dev_err(ctx->dev, "failed to tx cmd [%d], err: %d\n", i, ret); in truly_dcs_write_buf()
260 for (i = 0; i < ARRAY_SIZE(ctx->supplies); i++) { in truly_35597_power_on()
261 ret = regulator_set_load(ctx->supplies[i].consumer, in truly_35597_power_on()
267 ret = regulator_bulk_enable(ARRAY_SIZE(ctx->supplies), ctx->supplies); in truly_35597_power_on()
276 gpiod_set_value(ctx->reset_gpio, 0); in truly_35597_power_on()
278 gpiod_set_value(ctx->reset_gpio, 1); in truly_35597_power_on()
280 gpiod_set_value(ctx->reset_gpio, 0); in truly_35597_power_on()
291 gpiod_set_value(ctx->reset_gpio, 1); in truly_nt35597_power_off()
293 for (i = 0; i < ARRAY_SIZE(ctx->supplies); i++) { in truly_nt35597_power_off()
294 ret = regulator_set_load(ctx->supplies[i].consumer, in truly_nt35597_power_off()
297 dev_err(ctx->dev, "regulator_set_load failed %d\n", ret); in truly_nt35597_power_off()
302 ret = regulator_bulk_disable(ARRAY_SIZE(ctx->supplies), ctx->supplies); in truly_nt35597_power_off()
304 dev_err(ctx->dev, "regulator_bulk_disable failed %d\n", ret); in truly_nt35597_power_off()
314 if (ctx->backlight) { in truly_nt35597_disable()
315 ret = backlight_disable(ctx->backlight); in truly_nt35597_disable()
317 dev_err(ctx->dev, "backlight disable failed %d\n", ret); in truly_nt35597_disable()
328 ctx->dsi[0]->mode_flags = 0; in truly_nt35597_unprepare()
329 ctx->dsi[1]->mode_flags = 0; in truly_nt35597_unprepare()
333 dev_err(ctx->dev, "set_display_off cmd failed ret = %d\n", ret); in truly_nt35597_unprepare()
341 dev_err(ctx->dev, "enter_sleep cmd failed ret = %d\n", ret); in truly_nt35597_unprepare()
346 dev_err(ctx->dev, "power_off failed ret = %d\n", ret); in truly_nt35597_unprepare()
364 ctx->dsi[0]->mode_flags |= MIPI_DSI_MODE_LPM; in truly_nt35597_prepare()
365 ctx->dsi[1]->mode_flags |= MIPI_DSI_MODE_LPM; in truly_nt35597_prepare()
367 config = ctx->config; in truly_nt35597_prepare()
368 panel_on_cmds = config->panel_on_cmds; in truly_nt35597_prepare()
369 num_cmds = config->num_on_cmds; in truly_nt35597_prepare()
376 dev_err(ctx->dev, "cmd set tx failed i = %d ret = %d\n", i, ret); in truly_nt35597_prepare()
383 dev_err(ctx->dev, "exit_sleep_mode cmd failed ret = %d\n", ret); in truly_nt35597_prepare()
387 /* Per DSI spec wait 120ms after sending exit sleep DCS command */ in truly_nt35597_prepare()
392 dev_err(ctx->dev, "set_display_on cmd failed ret = %d\n", ret); in truly_nt35597_prepare()
396 /* Per DSI spec wait 120ms after sending set_display_on DCS command */ in truly_nt35597_prepare()
403 dev_err(ctx->dev, "power_off failed\n"); in truly_nt35597_prepare()
412 if (ctx->backlight) { in truly_nt35597_enable()
413 ret = backlight_enable(ctx->backlight); in truly_nt35597_enable()
415 dev_err(ctx->dev, "backlight enable failed %d\n", ret); in truly_nt35597_enable()
425 struct drm_display_mode *mode; in truly_nt35597_get_modes() local
428 config = ctx->config; in truly_nt35597_get_modes()
429 mode = drm_mode_duplicate(connector->dev, config->dm); in truly_nt35597_get_modes()
430 if (!mode) { in truly_nt35597_get_modes()
431 dev_err(ctx->dev, "failed to create a new display mode\n"); in truly_nt35597_get_modes()
435 connector->display_info.width_mm = config->width_mm; in truly_nt35597_get_modes()
436 connector->display_info.height_mm = config->height_mm; in truly_nt35597_get_modes()
437 mode->type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED; in truly_nt35597_get_modes()
438 drm_mode_probed_add(connector, mode); in truly_nt35597_get_modes()
453 struct device *dev = ctx->dev; in truly_nt35597_panel_add()
456 for (i = 0; i < ARRAY_SIZE(ctx->supplies); i++) in truly_nt35597_panel_add()
457 ctx->supplies[i].supply = regulator_names[i]; in truly_nt35597_panel_add()
459 ret = devm_regulator_bulk_get(dev, ARRAY_SIZE(ctx->supplies), in truly_nt35597_panel_add()
460 ctx->supplies); in truly_nt35597_panel_add()
464 ctx->reset_gpio = devm_gpiod_get(dev, "reset", GPIOD_OUT_LOW); in truly_nt35597_panel_add()
465 if (IS_ERR(ctx->reset_gpio)) { in truly_nt35597_panel_add()
466 dev_err(dev, "cannot get reset gpio %ld\n", PTR_ERR(ctx->reset_gpio)); in truly_nt35597_panel_add()
467 return PTR_ERR(ctx->reset_gpio); in truly_nt35597_panel_add()
470 ctx->mode_gpio = devm_gpiod_get(dev, "mode", GPIOD_OUT_LOW); in truly_nt35597_panel_add()
471 if (IS_ERR(ctx->mode_gpio)) { in truly_nt35597_panel_add()
472 dev_err(dev, "cannot get mode gpio %ld\n", PTR_ERR(ctx->mode_gpio)); in truly_nt35597_panel_add()
473 return PTR_ERR(ctx->mode_gpio); in truly_nt35597_panel_add()
476 /* dual port */ in truly_nt35597_panel_add()
477 gpiod_set_value(ctx->mode_gpio, 0); in truly_nt35597_panel_add()
479 drm_panel_init(&ctx->panel, dev, &truly_nt35597_drm_funcs, in truly_nt35597_panel_add()
481 drm_panel_add(&ctx->panel); in truly_nt35597_panel_add()
509 static int truly_nt35597_probe(struct mipi_dsi_device *dsi) in truly_nt35597_probe() argument
511 struct device *dev = &dsi->dev; in truly_nt35597_probe()
529 return -ENOMEM; in truly_nt35597_probe()
533 * fed by the output ports of the two DSI controllers . The DSI0 is in truly_nt35597_probe()
538 ctx->config = of_device_get_match_data(dev); in truly_nt35597_probe()
540 if (!ctx->config) { in truly_nt35597_probe()
542 return -ENODEV; in truly_nt35597_probe()
545 dsi1 = of_graph_get_remote_node(dsi->dev.of_node, 1, -1); in truly_nt35597_probe()
548 return -ENODEV; in truly_nt35597_probe()
554 return dev_err_probe(dev, -EPROBE_DEFER, "failed to find dsi host\n"); in truly_nt35597_probe()
556 /* register the second DSI device */ in truly_nt35597_probe()
559 dev_err(dev, "failed to create dsi device\n"); in truly_nt35597_probe()
563 mipi_dsi_set_drvdata(dsi, ctx); in truly_nt35597_probe()
565 ctx->dev = dev; in truly_nt35597_probe()
566 ctx->dsi[0] = dsi; in truly_nt35597_probe()
567 ctx->dsi[1] = dsi1_device; in truly_nt35597_probe()
575 for (i = 0; i < ARRAY_SIZE(ctx->dsi); i++) { in truly_nt35597_probe()
576 dsi_dev = ctx->dsi[i]; in truly_nt35597_probe()
577 dsi_dev->lanes = 4; in truly_nt35597_probe()
578 dsi_dev->format = MIPI_DSI_FMT_RGB888; in truly_nt35597_probe()
579 dsi_dev->mode_flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_LPM | in truly_nt35597_probe()
583 dev_err(dev, "dsi attach failed i = %d\n", i); in truly_nt35597_probe()
591 drm_panel_remove(&ctx->panel); in truly_nt35597_probe()
597 static void truly_nt35597_remove(struct mipi_dsi_device *dsi) in truly_nt35597_remove() argument
599 struct truly_nt35597 *ctx = mipi_dsi_get_drvdata(dsi); in truly_nt35597_remove()
601 if (ctx->dsi[0]) in truly_nt35597_remove()
602 mipi_dsi_detach(ctx->dsi[0]); in truly_nt35597_remove()
603 if (ctx->dsi[1]) { in truly_nt35597_remove()
604 mipi_dsi_detach(ctx->dsi[1]); in truly_nt35597_remove()
605 mipi_dsi_device_unregister(ctx->dsi[1]); in truly_nt35597_remove()
608 drm_panel_remove(&ctx->panel); in truly_nt35597_remove()
613 .compatible = "truly,nt35597-2K-display",
622 .name = "panel-truly-nt35597",
630 MODULE_DESCRIPTION("Truly NT35597 DSI Panel Driver");