| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * MIPI-DSI based S6E63J0X03 AMOLED lcd 1.63 inch panel driver. |
|---|
| 3 | 4 | * |
|---|
| .. | .. |
|---|
| 5 | 6 | * |
|---|
| 6 | 7 | * Inki Dae <inki.dae@samsung.com> |
|---|
| 7 | 8 | * Hoegeun Kwon <hoegeun.kwon@samsung.com> |
|---|
| 8 | | - * |
|---|
| 9 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 10 | | - * it under the terms of the GNU General Public License version 2 as |
|---|
| 11 | | - * published by the Free Software Foundation. |
|---|
| 12 | 9 | */ |
|---|
| 13 | 10 | |
|---|
| 14 | | -#include <drm/drmP.h> |
|---|
| 15 | | -#include <drm/drm_mipi_dsi.h> |
|---|
| 16 | | -#include <drm/drm_panel.h> |
|---|
| 17 | 11 | #include <linux/backlight.h> |
|---|
| 12 | +#include <linux/delay.h> |
|---|
| 18 | 13 | #include <linux/gpio/consumer.h> |
|---|
| 14 | +#include <linux/module.h> |
|---|
| 19 | 15 | #include <linux/regulator/consumer.h> |
|---|
| 16 | + |
|---|
| 20 | 17 | #include <video/mipi_display.h> |
|---|
| 18 | + |
|---|
| 19 | +#include <drm/drm_mipi_dsi.h> |
|---|
| 20 | +#include <drm/drm_modes.h> |
|---|
| 21 | +#include <drm/drm_panel.h> |
|---|
| 21 | 22 | |
|---|
| 22 | 23 | #define MCS_LEVEL2_KEY 0xf0 |
|---|
| 23 | 24 | #define MCS_MTP_KEY 0xf1 |
|---|
| .. | .. |
|---|
| 50 | 51 | .vsync_start = 320 + 150, |
|---|
| 51 | 52 | .vsync_end = 320 + 150 + 1, |
|---|
| 52 | 53 | .vtotal = 320 + 150 + 1 + 2, |
|---|
| 53 | | - .vrefresh = 30, |
|---|
| 54 | 54 | .flags = 0, |
|---|
| 55 | 55 | }; |
|---|
| 56 | 56 | |
|---|
| .. | .. |
|---|
| 398 | 398 | return 0; |
|---|
| 399 | 399 | } |
|---|
| 400 | 400 | |
|---|
| 401 | | -static int s6e63j0x03_get_modes(struct drm_panel *panel) |
|---|
| 401 | +static int s6e63j0x03_get_modes(struct drm_panel *panel, |
|---|
| 402 | + struct drm_connector *connector) |
|---|
| 402 | 403 | { |
|---|
| 403 | | - struct drm_connector *connector = panel->connector; |
|---|
| 404 | 404 | struct drm_display_mode *mode; |
|---|
| 405 | 405 | |
|---|
| 406 | | - mode = drm_mode_duplicate(panel->drm, &default_mode); |
|---|
| 406 | + mode = drm_mode_duplicate(connector->dev, &default_mode); |
|---|
| 407 | 407 | if (!mode) { |
|---|
| 408 | | - DRM_ERROR("failed to add mode %ux%ux@%u\n", |
|---|
| 408 | + dev_err(panel->dev, "failed to add mode %ux%u@%u\n", |
|---|
| 409 | 409 | default_mode.hdisplay, default_mode.vdisplay, |
|---|
| 410 | | - default_mode.vrefresh); |
|---|
| 410 | + drm_mode_vrefresh(&default_mode)); |
|---|
| 411 | 411 | return -ENOMEM; |
|---|
| 412 | 412 | } |
|---|
| 413 | 413 | |
|---|
| .. | .. |
|---|
| 464 | 464 | return PTR_ERR(ctx->reset_gpio); |
|---|
| 465 | 465 | } |
|---|
| 466 | 466 | |
|---|
| 467 | | - drm_panel_init(&ctx->panel); |
|---|
| 468 | | - ctx->panel.dev = dev; |
|---|
| 469 | | - ctx->panel.funcs = &s6e63j0x03_funcs; |
|---|
| 467 | + drm_panel_init(&ctx->panel, dev, &s6e63j0x03_funcs, |
|---|
| 468 | + DRM_MODE_CONNECTOR_DSI); |
|---|
| 470 | 469 | |
|---|
| 471 | 470 | ctx->bl_dev = backlight_device_register("s6e63j0x03", dev, ctx, |
|---|
| 472 | 471 | &s6e63j0x03_bl_ops, NULL); |
|---|
| .. | .. |
|---|
| 479 | 478 | ctx->bl_dev->props.brightness = DEFAULT_BRIGHTNESS; |
|---|
| 480 | 479 | ctx->bl_dev->props.power = FB_BLANK_POWERDOWN; |
|---|
| 481 | 480 | |
|---|
| 482 | | - ret = drm_panel_add(&ctx->panel); |
|---|
| 483 | | - if (ret < 0) |
|---|
| 484 | | - goto unregister_backlight; |
|---|
| 481 | + drm_panel_add(&ctx->panel); |
|---|
| 485 | 482 | |
|---|
| 486 | 483 | ret = mipi_dsi_attach(dsi); |
|---|
| 487 | 484 | if (ret < 0) |
|---|
| .. | .. |
|---|
| 491 | 488 | |
|---|
| 492 | 489 | remove_panel: |
|---|
| 493 | 490 | drm_panel_remove(&ctx->panel); |
|---|
| 494 | | - |
|---|
| 495 | | -unregister_backlight: |
|---|
| 496 | 491 | backlight_device_unregister(ctx->bl_dev); |
|---|
| 497 | 492 | |
|---|
| 498 | 493 | return ret; |
|---|