Lines Matching +full:vddi +full:- +full:supply

1 // SPDX-License-Identifier: GPL-2.0+
3 * MIPI-DSI Novatek NT35560-based panel controller.
6 * Sony ACX424AKM - a 480x854 AMOLED DSI panel
7 * Sony ACX424AKP - a 480x864 AMOLED DSI panel
9 * Copyright (C) Linaro Ltd. 2019-2021
11 * Based on code and know-how from Marcus Lorentzon
12 * Copyright (C) ST-Ericsson SA 2010
13 * Based on code and know-how from Johan Olson and Joakim Wesslen
55 struct regulator *supply;
151 struct mipi_dsi_device *dsi = to_mipi_dsi_device(nt->dev);
153 int duty_ns = bl->props.brightness;
165 dev_err(nt->dev, "failed to disable display backlight (%d)\n", ret);
172 pwm_ratio = max(((duty_ns * 256) / period_ns) - 1, 1);
178 dev_dbg(nt->dev, "calculated duty cycle %02x\n", pwm_ratio);
182 dev_err(nt->dev, "failed to set display PWM ratio (%d)\n", ret);
198 dev_err(nt->dev, "failed to unlock CMD 2 (%d)\n", ret);
204 dev_err(nt->dev, "failed to enter page 1 (%d)\n", ret);
210 dev_err(nt->dev, "failed to disable MTP reload (%d)\n", ret);
215 dev_err(nt->dev, "failed to set PWM divisor (%d)\n", ret);
221 dev_err(nt->dev, "failed to lock CMD 2 (%d)\n", ret);
230 dev_err(nt->dev, "failed to enable display backlight (%d)\n", ret);
249 struct mipi_dsi_device *dsi = to_mipi_dsi_device(nt->dev);
256 dev_err(nt->dev, "could not vendor ID byte\n");
261 dev_err(nt->dev, "could not read device version byte\n");
266 dev_err(nt->dev, "could not read panel ID byte\n");
271 dev_err(nt->dev, "device vendor ID is zero\n");
272 return -ENODEV;
281 dev_info(nt->dev, "MTP vendor: %02x, version: %02x, panel: %02x\n",
285 dev_info(nt->dev, "unknown vendor: %02x, version: %02x, panel: %02x\n",
297 ret = regulator_enable(nt->supply);
299 dev_err(nt->dev, "failed to enable supply (%d)\n", ret);
304 gpiod_set_value_cansleep(nt->reset_gpio, 1);
306 /* De-assert RESET */
307 gpiod_set_value_cansleep(nt->reset_gpio, 0);
316 gpiod_set_value_cansleep(nt->reset_gpio, 1);
319 regulator_disable(nt->supply);
325 struct mipi_dsi_device *dsi = to_mipi_dsi_device(nt->dev);
335 dev_err(nt->dev, "failed to read panel ID (%d)\n", ret);
343 dev_err(nt->dev, "failed to enable vblank TE (%d)\n", ret);
360 dev_err(nt->dev, "failed to set MDDI (%d)\n", ret);
367 dev_err(nt->dev, "failed to exit sleep mode (%d)\n", ret);
374 dev_err(nt->dev, "failed to turn display on (%d)\n", ret);
377 if (nt->video_mode) {
381 dev_err(nt->dev, "failed to turn on peripheral\n");
396 struct mipi_dsi_device *dsi = to_mipi_dsi_device(nt->dev);
401 dev_err(nt->dev, "failed to turn display off (%d)\n", ret);
408 dev_err(nt->dev, "failed to enter sleep mode (%d)\n", ret);
423 const struct nt35560_config *conf = nt->conf;
426 if (nt->video_mode)
427 mode = drm_mode_duplicate(connector->dev,
428 conf->vid_mode);
430 mode = drm_mode_duplicate(connector->dev,
431 conf->cmd_mode);
433 dev_err(panel->dev, "bad mode or failed to add mode\n");
434 return -EINVAL;
437 mode->type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED;
439 connector->display_info.width_mm = mode->width_mm;
440 connector->display_info.height_mm = mode->height_mm;
455 struct device *dev = &dsi->dev;
465 nt->video_mode = of_property_read_bool(dev->of_node,
466 "enforce-video-mode");
469 nt->dev = dev;
471 nt->conf = of_device_get_match_data(dev);
472 if (!nt->conf) {
474 return -ENODEV;
477 dsi->lanes = 2;
478 dsi->format = MIPI_DSI_FMT_RGB888;
480 * FIXME: these come from the ST-Ericsson vendor driver for the
482 * platform, if you have the datasheet, please cross-check the
485 dsi->lp_rate = 19200000;
486 dsi->hs_rate = 420160000;
488 if (nt->video_mode)
490 dsi->mode_flags =
494 dsi->mode_flags =
497 nt->supply = devm_regulator_get(dev, "vddi");
498 if (IS_ERR(nt->supply))
499 return PTR_ERR(nt->supply);
502 nt->reset_gpio = devm_gpiod_get_optional(dev, "reset",
504 if (IS_ERR(nt->reset_gpio))
505 return dev_err_probe(dev, PTR_ERR(nt->reset_gpio),
508 nt->panel.backlight = devm_backlight_device_register(dev, "nt35560", dev, nt,
510 if (IS_ERR(nt->panel.backlight))
511 return dev_err_probe(dev, PTR_ERR(nt->panel.backlight),
514 drm_panel_add(&nt->panel);
518 drm_panel_remove(&nt->panel);
530 drm_panel_remove(&nt->panel);
550 .name = "panel-novatek-nt35560",
557 MODULE_DESCRIPTION("MIPI-DSI Novatek NT35560 Panel Driver");