Lines Matching +full:enforce +full:- +full:video +full:- +full:mode
1 // SPDX-License-Identifier: GPL-2.0+
3 * MIPI-DSI Sony ACX424AKP panel driver. This is a 480x864
4 * AMOLED panel with a command-only DSI interface.
8 * Based on code and know-how from Marcus Lorentzon
9 * Copyright (C) ST-Ericsson SA 2010
18 #include <video/mipi_display.h>
66 * command mode using the maximum HS frequency.
97 struct mipi_dsi_device *dsi = to_mipi_dsi_device(acx->dev); in acx424akp_set_brightness()
99 int duty_ns = bl->props.brightness; in acx424akp_set_brightness()
106 pwm_ratio = max(((duty_ns * 256) / period_ns) - 1, 1); in acx424akp_set_brightness()
112 dev_dbg(acx->dev, "calculated duty cycle %02x\n", pwm_ratio); in acx424akp_set_brightness()
116 dev_err(acx->dev, "failed to set display PWM ratio (%d)\n", ret); in acx424akp_set_brightness()
132 dev_err(acx->dev, "failed to unlock CMD 2 (%d)\n", ret); in acx424akp_set_brightness()
138 dev_err(acx->dev, "failed to enter page 1 (%d)\n", ret); in acx424akp_set_brightness()
144 dev_err(acx->dev, "failed to disable MTP reload (%d)\n", ret); in acx424akp_set_brightness()
149 dev_err(acx->dev, "failed to set PWM divisor (%d)\n", ret); in acx424akp_set_brightness()
155 dev_err(acx->dev, "failed to lock CMD 2 (%d)\n", ret); in acx424akp_set_brightness()
164 dev_err(acx->dev, "failed to enable display backlight (%d)\n", ret); in acx424akp_set_brightness()
177 struct mipi_dsi_device *dsi = to_mipi_dsi_device(acx->dev); in acx424akp_read_id()
184 dev_err(acx->dev, "could not vendor ID byte\n"); in acx424akp_read_id()
189 dev_err(acx->dev, "could not read device version byte\n"); in acx424akp_read_id()
194 dev_err(acx->dev, "could not read panel ID byte\n"); in acx424akp_read_id()
199 dev_err(acx->dev, "device vendor ID is zero\n"); in acx424akp_read_id()
200 return -ENODEV; in acx424akp_read_id()
208 dev_info(acx->dev, "MTP vendor: %02x, version: %02x, panel: %02x\n", in acx424akp_read_id()
212 dev_info(acx->dev, "unknown vendor: %02x, version: %02x, panel: %02x\n", in acx424akp_read_id()
224 ret = regulator_enable(acx->supply); in acx424akp_power_on()
226 dev_err(acx->dev, "failed to enable supply (%d)\n", ret); in acx424akp_power_on()
231 gpiod_set_value_cansleep(acx->reset_gpio, 1); in acx424akp_power_on()
233 /* De-assert RESET */ in acx424akp_power_on()
234 gpiod_set_value_cansleep(acx->reset_gpio, 0); in acx424akp_power_on()
243 gpiod_set_value_cansleep(acx->reset_gpio, 1); in acx424akp_power_off()
246 regulator_disable(acx->supply); in acx424akp_power_off()
252 struct mipi_dsi_device *dsi = to_mipi_dsi_device(acx->dev); in acx424akp_prepare()
262 dev_err(acx->dev, "failed to read panel ID (%d)\n", ret); in acx424akp_prepare()
266 /* Enabe tearing mode: send TE (tearing effect) at VBLANK */ in acx424akp_prepare()
270 dev_err(acx->dev, "failed to enable vblank TE (%d)\n", ret); in acx424akp_prepare()
287 dev_err(acx->dev, "failed to set MDDI (%d)\n", ret); in acx424akp_prepare()
291 /* Exit sleep mode */ in acx424akp_prepare()
294 dev_err(acx->dev, "failed to exit sleep mode (%d)\n", ret); in acx424akp_prepare()
301 dev_err(acx->dev, "failed to turn display on (%d)\n", ret); in acx424akp_prepare()
304 if (acx->video_mode) { in acx424akp_prepare()
305 /* In video mode turn peripheral on */ in acx424akp_prepare()
308 dev_err(acx->dev, "failed to turn on peripheral\n"); in acx424akp_prepare()
313 acx->bl->props.power = FB_BLANK_NORMAL; in acx424akp_prepare()
325 struct mipi_dsi_device *dsi = to_mipi_dsi_device(acx->dev); in acx424akp_unprepare()
334 dev_err(acx->dev, "failed to disable display backlight (%d)\n", ret); in acx424akp_unprepare()
340 dev_err(acx->dev, "failed to turn display off (%d)\n", ret); in acx424akp_unprepare()
344 /* Enter sleep mode */ in acx424akp_unprepare()
347 dev_err(acx->dev, "failed to enter sleep mode (%d)\n", ret); in acx424akp_unprepare()
353 acx->bl->props.power = FB_BLANK_POWERDOWN; in acx424akp_unprepare()
366 acx->bl->props.power = FB_BLANK_UNBLANK; in acx424akp_enable()
379 acx->bl->props.power = FB_BLANK_NORMAL; in acx424akp_disable()
388 struct drm_display_mode *mode; in acx424akp_get_modes() local
390 if (acx->video_mode) in acx424akp_get_modes()
391 mode = drm_mode_duplicate(connector->dev, in acx424akp_get_modes()
394 mode = drm_mode_duplicate(connector->dev, in acx424akp_get_modes()
396 if (!mode) { in acx424akp_get_modes()
397 dev_err(panel->dev, "bad mode or failed to add mode\n"); in acx424akp_get_modes()
398 return -EINVAL; in acx424akp_get_modes()
400 drm_mode_set_name(mode); in acx424akp_get_modes()
401 mode->type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED; in acx424akp_get_modes()
403 connector->display_info.width_mm = mode->width_mm; in acx424akp_get_modes()
404 connector->display_info.height_mm = mode->height_mm; in acx424akp_get_modes()
406 drm_mode_probed_add(connector, mode); in acx424akp_get_modes()
421 struct device *dev = &dsi->dev; in acx424akp_probe()
427 return -ENOMEM; in acx424akp_probe()
428 acx->video_mode = of_property_read_bool(dev->of_node, in acx424akp_probe()
429 "enforce-video-mode"); in acx424akp_probe()
432 acx->dev = dev; in acx424akp_probe()
434 dsi->lanes = 2; in acx424akp_probe()
435 dsi->format = MIPI_DSI_FMT_RGB888; in acx424akp_probe()
437 * FIXME: these come from the ST-Ericsson vendor driver for the in acx424akp_probe()
439 * platform, if you have the datasheet, please cross-check the in acx424akp_probe()
442 dsi->lp_rate = 19200000; in acx424akp_probe()
443 dsi->hs_rate = 420160000; in acx424akp_probe()
445 if (acx->video_mode) in acx424akp_probe()
446 /* Burst mode using event for sync */ in acx424akp_probe()
447 dsi->mode_flags = in acx424akp_probe()
451 dsi->mode_flags = in acx424akp_probe()
455 acx->supply = devm_regulator_get(dev, "vddi"); in acx424akp_probe()
456 if (IS_ERR(acx->supply)) in acx424akp_probe()
457 return PTR_ERR(acx->supply); in acx424akp_probe()
460 acx->reset_gpio = devm_gpiod_get_optional(dev, "reset", in acx424akp_probe()
462 if (IS_ERR(acx->reset_gpio)) { in acx424akp_probe()
463 ret = PTR_ERR(acx->reset_gpio); in acx424akp_probe()
464 if (ret != -EPROBE_DEFER) in acx424akp_probe()
469 drm_panel_init(&acx->panel, dev, &acx424akp_drm_funcs, in acx424akp_probe()
472 acx->bl = devm_backlight_device_register(dev, "acx424akp", dev, acx, in acx424akp_probe()
474 if (IS_ERR(acx->bl)) { in acx424akp_probe()
476 return PTR_ERR(acx->bl); in acx424akp_probe()
478 acx->bl->props.max_brightness = 1023; in acx424akp_probe()
479 acx->bl->props.brightness = 512; in acx424akp_probe()
480 acx->bl->props.power = FB_BLANK_POWERDOWN; in acx424akp_probe()
482 drm_panel_add(&acx->panel); in acx424akp_probe()
486 drm_panel_remove(&acx->panel); in acx424akp_probe()
498 drm_panel_remove(&acx->panel); in acx424akp_remove()
513 .name = "panel-sony-acx424akp",
520 MODULE_DESCRIPTION("MIPI-DSI Sony acx424akp Panel Driver");