aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHoegeun Kwon <hoegeun.kwon@samsung.com>2017-04-18 04:40:35 -0400
committerThierry Reding <treding@nvidia.com>2017-06-14 14:18:22 -0400
commite2af12bfb0ba198d66acf99e14aedc34244e74dc (patch)
treebb873da35d57920d61b740ee450271ac6e529b27
parent60ee02bf9a54b925d8b655069ad9a1444667ee40 (diff)
drm/panel: s6e3ha2: Add support for s6e3hf2 panel on TM2e board
This patch supports TM2e panel and the panel has 1600x2560 resolution in 5.65" physical. This identify panel type with compatibility string, also invoke display mode that matches the type. So add the check code for s6e3ha2 compatibility and s6e3hf2 type and select the drm_display_mode of default and edge type. Signed-off-by: Hoegeun Kwon <hoegeun.kwon@samsung.com> Reviewed-by: Andrzej Hajda <a.hajda@samsung.com> Reviewed-by: Inki Dae <inki.dae@samsung.com> [treding@nvidia.com: fixup checkpatch warnings] Signed-off-by: Thierry Reding <treding@nvidia.com> Link: http://patchwork.freedesktop.org/patch/msgid/1492504836-19225-3-git-send-email-hoegeun.kwon@samsung.com
-rw-r--r--drivers/gpu/drm/panel/panel-samsung-s6e3ha2.c64
1 files changed, 57 insertions, 7 deletions
diff --git a/drivers/gpu/drm/panel/panel-samsung-s6e3ha2.c b/drivers/gpu/drm/panel/panel-samsung-s6e3ha2.c
index 4cc08d7b3de4..797bbc7a264e 100644
--- a/drivers/gpu/drm/panel/panel-samsung-s6e3ha2.c
+++ b/drivers/gpu/drm/panel/panel-samsung-s6e3ha2.c
@@ -16,6 +16,7 @@
16#include <drm/drm_panel.h> 16#include <drm/drm_panel.h>
17#include <linux/backlight.h> 17#include <linux/backlight.h>
18#include <linux/gpio/consumer.h> 18#include <linux/gpio/consumer.h>
19#include <linux/of_device.h>
19#include <linux/regulator/consumer.h> 20#include <linux/regulator/consumer.h>
20 21
21#define S6E3HA2_MIN_BRIGHTNESS 0 22#define S6E3HA2_MIN_BRIGHTNESS 0
@@ -218,6 +219,16 @@ unsigned char vint_table[S6E3HA2_VINT_STATUS_MAX] = {
218 0x1d, 0x1e, 0x1f, 0x20, 0x21 219 0x1d, 0x1e, 0x1f, 0x20, 0x21
219}; 220};
220 221
222enum s6e3ha2_type {
223 HA2_TYPE,
224 HF2_TYPE,
225};
226
227struct s6e3ha2_panel_desc {
228 const struct drm_display_mode *mode;
229 enum s6e3ha2_type type;
230};
231
221struct s6e3ha2 { 232struct s6e3ha2 {
222 struct device *dev; 233 struct device *dev;
223 struct drm_panel panel; 234 struct drm_panel panel;
@@ -226,6 +237,8 @@ struct s6e3ha2 {
226 struct regulator_bulk_data supplies[2]; 237 struct regulator_bulk_data supplies[2];
227 struct gpio_desc *reset_gpio; 238 struct gpio_desc *reset_gpio;
228 struct gpio_desc *enable_gpio; 239 struct gpio_desc *enable_gpio;
240
241 const struct s6e3ha2_panel_desc *desc;
229}; 242};
230 243
231static int s6e3ha2_dcs_write(struct s6e3ha2 *ctx, const void *data, size_t len) 244static int s6e3ha2_dcs_write(struct s6e3ha2 *ctx, const void *data, size_t len)
@@ -283,11 +296,21 @@ static int s6e3ha2_single_dsi_set(struct s6e3ha2 *ctx)
283static int s6e3ha2_freq_calibration(struct s6e3ha2 *ctx) 296static int s6e3ha2_freq_calibration(struct s6e3ha2 *ctx)
284{ 297{
285 s6e3ha2_dcs_write_seq_static(ctx, 0xfd, 0x1c); 298 s6e3ha2_dcs_write_seq_static(ctx, 0xfd, 0x1c);
299 if (ctx->desc->type == HF2_TYPE)
300 s6e3ha2_dcs_write_seq_static(ctx, 0xf2, 0x67, 0x40, 0xc5);
286 s6e3ha2_dcs_write_seq_static(ctx, 0xfe, 0x20, 0x39); 301 s6e3ha2_dcs_write_seq_static(ctx, 0xfe, 0x20, 0x39);
287 s6e3ha2_dcs_write_seq_static(ctx, 0xfe, 0xa0); 302 s6e3ha2_dcs_write_seq_static(ctx, 0xfe, 0xa0);
288 s6e3ha2_dcs_write_seq_static(ctx, 0xfe, 0x20); 303 s6e3ha2_dcs_write_seq_static(ctx, 0xfe, 0x20);
289 s6e3ha2_dcs_write_seq_static(ctx, 0xce, 0x03, 0x3b, 0x12, 0x62, 0x40, 304
290 0x80, 0xc0, 0x28, 0x28, 0x28, 0x28, 0x39, 0xc5); 305 if (ctx->desc->type == HA2_TYPE)
306 s6e3ha2_dcs_write_seq_static(ctx, 0xce, 0x03, 0x3b, 0x12, 0x62,
307 0x40, 0x80, 0xc0, 0x28, 0x28,
308 0x28, 0x28, 0x39, 0xc5);
309 else
310 s6e3ha2_dcs_write_seq_static(ctx, 0xce, 0x03, 0x3b, 0x14, 0x6d,
311 0x40, 0x80, 0xc0, 0x28, 0x28,
312 0x28, 0x28, 0x39, 0xc5);
313
291 return 0; 314 return 0;
292} 315}
293 316
@@ -583,7 +606,7 @@ static int s6e3ha2_enable(struct drm_panel *panel)
583 return 0; 606 return 0;
584} 607}
585 608
586static const struct drm_display_mode default_mode = { 609static const struct drm_display_mode s6e3ha2_mode = {
587 .clock = 222372, 610 .clock = 222372,
588 .hdisplay = 1440, 611 .hdisplay = 1440,
589 .hsync_start = 1440 + 1, 612 .hsync_start = 1440 + 1,
@@ -597,16 +620,41 @@ static const struct drm_display_mode default_mode = {
597 .flags = 0, 620 .flags = 0,
598}; 621};
599 622
623static const struct s6e3ha2_panel_desc samsung_s6e3ha2 = {
624 .mode = &s6e3ha2_mode,
625 .type = HA2_TYPE,
626};
627
628static const struct drm_display_mode s6e3hf2_mode = {
629 .clock = 247856,
630 .hdisplay = 1600,
631 .hsync_start = 1600 + 1,
632 .hsync_end = 1600 + 1 + 1,
633 .htotal = 1600 + 1 + 1 + 1,
634 .vdisplay = 2560,
635 .vsync_start = 2560 + 1,
636 .vsync_end = 2560 + 1 + 1,
637 .vtotal = 2560 + 1 + 1 + 15,
638 .vrefresh = 60,
639 .flags = 0,
640};
641
642static const struct s6e3ha2_panel_desc samsung_s6e3hf2 = {
643 .mode = &s6e3hf2_mode,
644 .type = HF2_TYPE,
645};
646
600static int s6e3ha2_get_modes(struct drm_panel *panel) 647static int s6e3ha2_get_modes(struct drm_panel *panel)
601{ 648{
602 struct drm_connector *connector = panel->connector; 649 struct drm_connector *connector = panel->connector;
650 struct s6e3ha2 *ctx = container_of(panel, struct s6e3ha2, panel);
603 struct drm_display_mode *mode; 651 struct drm_display_mode *mode;
604 652
605 mode = drm_mode_duplicate(panel->drm, &default_mode); 653 mode = drm_mode_duplicate(panel->drm, ctx->desc->mode);
606 if (!mode) { 654 if (!mode) {
607 DRM_ERROR("failed to add mode %ux%ux@%u\n", 655 DRM_ERROR("failed to add mode %ux%ux@%u\n",
608 default_mode.hdisplay, default_mode.vdisplay, 656 ctx->desc->mode->hdisplay, ctx->desc->mode->vdisplay,
609 default_mode.vrefresh); 657 ctx->desc->mode->vrefresh);
610 return -ENOMEM; 658 return -ENOMEM;
611 } 659 }
612 660
@@ -642,6 +690,7 @@ static int s6e3ha2_probe(struct mipi_dsi_device *dsi)
642 mipi_dsi_set_drvdata(dsi, ctx); 690 mipi_dsi_set_drvdata(dsi, ctx);
643 691
644 ctx->dev = dev; 692 ctx->dev = dev;
693 ctx->desc = of_device_get_match_data(dev);
645 694
646 dsi->lanes = 4; 695 dsi->lanes = 4;
647 dsi->format = MIPI_DSI_FMT_RGB888; 696 dsi->format = MIPI_DSI_FMT_RGB888;
@@ -717,7 +766,8 @@ static int s6e3ha2_remove(struct mipi_dsi_device *dsi)
717} 766}
718 767
719static const struct of_device_id s6e3ha2_of_match[] = { 768static const struct of_device_id s6e3ha2_of_match[] = {
720 { .compatible = "samsung,s6e3ha2" }, 769 { .compatible = "samsung,s6e3ha2", .data = &samsung_s6e3ha2 },
770 { .compatible = "samsung,s6e3hf2", .data = &samsung_s6e3hf2 },
721 { } 771 { }
722}; 772};
723MODULE_DEVICE_TABLE(of, s6e3ha2_of_match); 773MODULE_DEVICE_TABLE(of, s6e3ha2_of_match);