| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * MIPI-DSI based s6e3ha2 AMOLED 5.7 inch panel driver. |
|---|
| 3 | 4 | * |
|---|
| .. | .. |
|---|
| 5 | 6 | * Donghwa Lee <dh09.lee@samsung.com> |
|---|
| 6 | 7 | * Hyungwon Hwang <human.hwang@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/of_device.h> |
|---|
| 20 | 16 | #include <linux/regulator/consumer.h> |
|---|
| 17 | + |
|---|
| 18 | +#include <drm/drm_mipi_dsi.h> |
|---|
| 19 | +#include <drm/drm_modes.h> |
|---|
| 20 | +#include <drm/drm_panel.h> |
|---|
| 21 | 21 | |
|---|
| 22 | 22 | #define S6E3HA2_MIN_BRIGHTNESS 0 |
|---|
| 23 | 23 | #define S6E3HA2_MAX_BRIGHTNESS 100 |
|---|
| .. | .. |
|---|
| 616 | 616 | .vsync_start = 2560 + 1, |
|---|
| 617 | 617 | .vsync_end = 2560 + 1 + 1, |
|---|
| 618 | 618 | .vtotal = 2560 + 1 + 1 + 15, |
|---|
| 619 | | - .vrefresh = 60, |
|---|
| 620 | 619 | .flags = 0, |
|---|
| 621 | 620 | }; |
|---|
| 622 | 621 | |
|---|
| .. | .. |
|---|
| 635 | 634 | .vsync_start = 2560 + 1, |
|---|
| 636 | 635 | .vsync_end = 2560 + 1 + 1, |
|---|
| 637 | 636 | .vtotal = 2560 + 1 + 1 + 15, |
|---|
| 638 | | - .vrefresh = 60, |
|---|
| 639 | 637 | .flags = 0, |
|---|
| 640 | 638 | }; |
|---|
| 641 | 639 | |
|---|
| .. | .. |
|---|
| 644 | 642 | .type = HF2_TYPE, |
|---|
| 645 | 643 | }; |
|---|
| 646 | 644 | |
|---|
| 647 | | -static int s6e3ha2_get_modes(struct drm_panel *panel) |
|---|
| 645 | +static int s6e3ha2_get_modes(struct drm_panel *panel, |
|---|
| 646 | + struct drm_connector *connector) |
|---|
| 648 | 647 | { |
|---|
| 649 | | - struct drm_connector *connector = panel->connector; |
|---|
| 650 | 648 | struct s6e3ha2 *ctx = container_of(panel, struct s6e3ha2, panel); |
|---|
| 651 | 649 | struct drm_display_mode *mode; |
|---|
| 652 | 650 | |
|---|
| 653 | | - mode = drm_mode_duplicate(panel->drm, ctx->desc->mode); |
|---|
| 651 | + mode = drm_mode_duplicate(connector->dev, ctx->desc->mode); |
|---|
| 654 | 652 | if (!mode) { |
|---|
| 655 | | - DRM_ERROR("failed to add mode %ux%ux@%u\n", |
|---|
| 653 | + dev_err(panel->dev, "failed to add mode %ux%u@%u\n", |
|---|
| 656 | 654 | ctx->desc->mode->hdisplay, ctx->desc->mode->vdisplay, |
|---|
| 657 | | - ctx->desc->mode->vrefresh); |
|---|
| 655 | + drm_mode_vrefresh(ctx->desc->mode)); |
|---|
| 658 | 656 | return -ENOMEM; |
|---|
| 659 | 657 | } |
|---|
| 660 | 658 | |
|---|
| .. | .. |
|---|
| 731 | 729 | ctx->bl_dev->props.brightness = S6E3HA2_DEFAULT_BRIGHTNESS; |
|---|
| 732 | 730 | ctx->bl_dev->props.power = FB_BLANK_POWERDOWN; |
|---|
| 733 | 731 | |
|---|
| 734 | | - drm_panel_init(&ctx->panel); |
|---|
| 735 | | - ctx->panel.dev = dev; |
|---|
| 736 | | - ctx->panel.funcs = &s6e3ha2_drm_funcs; |
|---|
| 732 | + drm_panel_init(&ctx->panel, dev, &s6e3ha2_drm_funcs, |
|---|
| 733 | + DRM_MODE_CONNECTOR_DSI); |
|---|
| 737 | 734 | |
|---|
| 738 | | - ret = drm_panel_add(&ctx->panel); |
|---|
| 739 | | - if (ret < 0) |
|---|
| 740 | | - goto unregister_backlight; |
|---|
| 735 | + drm_panel_add(&ctx->panel); |
|---|
| 741 | 736 | |
|---|
| 742 | 737 | ret = mipi_dsi_attach(dsi); |
|---|
| 743 | 738 | if (ret < 0) |
|---|
| .. | .. |
|---|
| 747 | 742 | |
|---|
| 748 | 743 | remove_panel: |
|---|
| 749 | 744 | drm_panel_remove(&ctx->panel); |
|---|
| 750 | | - |
|---|
| 751 | | -unregister_backlight: |
|---|
| 752 | 745 | backlight_device_unregister(ctx->bl_dev); |
|---|
| 753 | 746 | |
|---|
| 754 | 747 | return ret; |
|---|