From patchwork Tue Apr 18 08:40:35 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hoegeun Kwon X-Patchwork-Id: 9685165 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 7643F601C2 for ; Tue, 18 Apr 2017 08:40:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6ADFB27C0B for ; Tue, 18 Apr 2017 08:40:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5F95728372; Tue, 18 Apr 2017 08:40:58 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id DDA2B27C0B for ; Tue, 18 Apr 2017 08:40:57 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id F38FC89F75; Tue, 18 Apr 2017 08:40:56 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from epoutp01.samsung.com (mailout1.samsung.com [203.254.224.24]) by gabe.freedesktop.org (Postfix) with ESMTPS id 4536189F27 for ; Tue, 18 Apr 2017 08:40:50 +0000 (UTC) Received: from epcas1p1.samsung.com (unknown [182.195.41.45]) by epoutp01.samsung.com (KnoxPortal) with ESMTP id 20170418084048epoutp0170aa5edda445d89e51434b06f65e00ff~2cUCVOgcx2601126011epoutp01T; Tue, 18 Apr 2017 08:40:48 +0000 (GMT) Received: from epsmges5p2.samsung.com (unknown [182.195.40.68]) by epcas1p4.samsung.com (KnoxPortal) with ESMTP id 20170418084048epcas1p410ec2400faf7440f777d5942e51c283c~2cUCB2SpB0498604986epcas1p4A; Tue, 18 Apr 2017 08:40:48 +0000 (GMT) Received: from epcas5p3.samsung.com ( [182.195.41.41]) by epsmges5p2.samsung.com (EPCPMTA) with SMTP id 4A.1E.21921.011D5F85; Tue, 18 Apr 2017 17:40:48 +0900 (KST) Received: from epcpsbgm2new.samsung.com (u27.gpu120.samsung.co.kr [203.254.230.27]) by epcas5p4.samsung.com (KnoxPortal) with ESMTP id 20170418084047epcas5p498466f18393893d7dd3b2be64f950f61~2cUBPJjXD2277722777epcas5p44; Tue, 18 Apr 2017 08:40:47 +0000 (GMT) X-AuditID: b6c32a2d-f792a6d0000055a1-23-58f5d110d9b1 Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm2new.samsung.com (EPCPMTA) with SMTP id E5.C0.05013.F01D5F85; Tue, 18 Apr 2017 17:40:47 +0900 (KST) Received: from localhost.localdomain ([10.113.63.38]) by mmp2.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0OOL00BYXK3W7J00@mmp2.samsung.com>; Tue, 18 Apr 2017 17:40:47 +0900 (KST) From: Hoegeun Kwon To: thierry.reding@gmail.com, airlied@linux.ie, robh+dt@kernel.org, mark.rutland@arm.com, catalin.marinas@arm.com, will.deacon@arm.com, kgene@kernel.org, krzk@kernel.org Subject: [PATCH v3 2/3] drm/panel: s6e3ha2: Add support for s6e3hf2 panel on TM2e board Date: Tue, 18 Apr 2017 17:40:35 +0900 Message-id: <1492504836-19225-3-git-send-email-hoegeun.kwon@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1492504836-19225-1-git-send-email-hoegeun.kwon@samsung.com> X-Brightmail-Tracker: H4sIAAAAAA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P3+4FvR4UWh3Cf3lTnd4Pp+g6j8AMa109rKrEUZyQaajEXFScCAIUpmOGcAwAA X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrOIsWRmVeSWpSXmKPExsVy+t9jQV3+i18jDM7NlLO4te4cq0XvuZNM FtuPPGO1eL+sh9Fi/hGg2JWv79ks3i/vYrOYdH8Ci8Wbt2uYLPofv2a2OH9+A7vFpsfXWC0u 75rDZjHj/D4mi6XXLzJZtO49wm7xc9c8FouXH0+wOAh5rJm3htFj56y77B6bVnWyeWz/9oDV 4373cSaPzUvqPbb0A8X7tqxi9Pi8SS6AM8rNJiM1MSW1SCE1Lzk/JTMv3VYpNMRN10JJIS8x N9VWKULXNyRISaEsMacUyDMyQAMOzgHuwUr6dgluGVOnzGEq+KdScf6eSgPjWrkuRk4OCQET iRV3p7BA2GISF+6tZ+ti5OIQEpjFKNG2awkzhPOdUaJv/ySwKjYBXYmvPdeZQBIiAmsZJTYu uQzWwiywiUnizK7ZbCBVwgKREqvWLwfq4OBgEVCV+NIXDRLmFfCQWLD2FBPEOjmJk8cms4LY nAKeEl3794ItEAKqObhvG/sERt4FjAyrGCVSC5ILipPSc43yUsv1ihNzi0vz0vWS83M3MYIj 7Zn0DsbDu9wPMQpwMCrx8K7Y9yVCiDWxrLgy9xCjBAezkghv2LGvEUK8KYmVValF+fFFpTmp xYcYTYHumsgsJZqcD0wCeSXxhibmJubGBhbmlpYmRkrivI2zn4ULCaQnlqRmp6YWpBbB9DFx cEo1MHbPL6vQVNbLZ4ufwu3cInyFW93PTXv301taa95kLv4m/1qE7+SU5n/HO5+EXN+m+dOe e2fNmaLeL7WHZROEuObKMxUcTjy4bfed5d+WF9SUWukbXZAtnKDywuP9z83xU5u+xhrX7wvf x2S7Z4uAyvnj7w23n72r1mmW+Yt71abT+hf81fvbqpVYijMSDbWYi4oTAYqxr8DKAgAA X-MTR: 20000000000000000@CPGS X-CMS-MailID: 20170418084047epcas5p498466f18393893d7dd3b2be64f950f61 X-Msg-Generator: CA X-Sender-IP: 203.254.230.27 X-Local-Sender: =?UTF-8?B?6raM7ZqM6re8G1RpemVuIFBsYXRmb3JtIExhYihTL1fshLw=?= =?UTF-8?B?7YSwKRvsgrzshLHsoITsnpAbRW5naW5lZXI=?= X-Global-Sender: =?UTF-8?B?SG9lZ2V1biBLd29uG1RpemVuIFBsYXRmb3JtIExhYi4bU2Ft?= =?UTF-8?B?c3VuZyBFbGVjdHJvbmljcxtFbmdpbmVlcg==?= X-Sender-Code: =?UTF-8?B?QzEwG1NUQUYbQzEwVjgxMTE=?= CMS-TYPE: 105P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20170418084047epcas5p498466f18393893d7dd3b2be64f950f61 X-RootMTR: 20170418084047epcas5p498466f18393893d7dd3b2be64f950f61 References: <1492504836-19225-1-git-send-email-hoegeun.kwon@samsung.com> Cc: devicetree@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, javier@osg.samsung.com, andi.shyti@samsung.com, Hoegeun Kwon , linux-arm-kernel@lists.infradead.org X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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 Reviewed-by: Andrzej Hajda Reviewed-by: Inki Dae --- drivers/gpu/drm/panel/panel-samsung-s6e3ha2.c | 64 ++++++++++++++++++++++++--- 1 file 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 4cc08d7..c7b418b 100644 --- a/drivers/gpu/drm/panel/panel-samsung-s6e3ha2.c +++ b/drivers/gpu/drm/panel/panel-samsung-s6e3ha2.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #define S6E3HA2_MIN_BRIGHTNESS 0 @@ -218,6 +219,16 @@ 0x1d, 0x1e, 0x1f, 0x20, 0x21 }; +enum s6e3ha2_type { + HA2_TYPE, + HF2_TYPE, +}; + +struct s6e3ha2_panel_desc { + const struct drm_display_mode *mode; + enum s6e3ha2_type type; +}; + struct s6e3ha2 { struct device *dev; struct drm_panel panel; @@ -226,6 +237,8 @@ struct s6e3ha2 { struct regulator_bulk_data supplies[2]; struct gpio_desc *reset_gpio; struct gpio_desc *enable_gpio; + + const struct s6e3ha2_panel_desc *desc; }; static int s6e3ha2_dcs_write(struct s6e3ha2 *ctx, const void *data, size_t len) @@ -283,11 +296,19 @@ static int s6e3ha2_single_dsi_set(struct s6e3ha2 *ctx) static int s6e3ha2_freq_calibration(struct s6e3ha2 *ctx) { s6e3ha2_dcs_write_seq_static(ctx, 0xfd, 0x1c); + if (ctx->desc->type == HF2_TYPE) + s6e3ha2_dcs_write_seq_static(ctx, 0xf2, 0x67, 0x40, 0xc5); s6e3ha2_dcs_write_seq_static(ctx, 0xfe, 0x20, 0x39); s6e3ha2_dcs_write_seq_static(ctx, 0xfe, 0xa0); s6e3ha2_dcs_write_seq_static(ctx, 0xfe, 0x20); - s6e3ha2_dcs_write_seq_static(ctx, 0xce, 0x03, 0x3b, 0x12, 0x62, 0x40, - 0x80, 0xc0, 0x28, 0x28, 0x28, 0x28, 0x39, 0xc5); + + if (ctx->desc->type == HA2_TYPE) + s6e3ha2_dcs_write_seq_static(ctx, 0xce, 0x03, 0x3b, 0x12, 0x62, + 0x40, 0x80, 0xc0, 0x28, 0x28, 0x28, 0x28, 0x39, 0xc5); + else + s6e3ha2_dcs_write_seq_static(ctx, 0xce, 0x03, 0x3b, 0x14, 0x6d, + 0x40, 0x80, 0xc0, 0x28, 0x28, 0x28, 0x28, 0x39, 0xc5); + return 0; } @@ -583,7 +604,7 @@ static int s6e3ha2_enable(struct drm_panel *panel) return 0; } -static const struct drm_display_mode default_mode = { +static const struct drm_display_mode s6e3ha2_mode = { .clock = 222372, .hdisplay = 1440, .hsync_start = 1440 + 1, @@ -597,16 +618,41 @@ static int s6e3ha2_enable(struct drm_panel *panel) .flags = 0, }; +static const struct s6e3ha2_panel_desc samsung_s6e3ha2 = { + .mode = &s6e3ha2_mode, + .type = HA2_TYPE, +}; + +static const struct drm_display_mode s6e3hf2_mode = { + .clock = 247856, + .hdisplay = 1600, + .hsync_start = 1600 + 1, + .hsync_end = 1600 + 1 + 1, + .htotal = 1600 + 1 + 1 + 1, + .vdisplay = 2560, + .vsync_start = 2560 + 1, + .vsync_end = 2560 + 1 + 1, + .vtotal = 2560 + 1 + 1 + 15, + .vrefresh = 60, + .flags = 0, +}; + +static const struct s6e3ha2_panel_desc samsung_s6e3hf2 = { + .mode = &s6e3hf2_mode, + .type = HF2_TYPE, +}; + static int s6e3ha2_get_modes(struct drm_panel *panel) { struct drm_connector *connector = panel->connector; + struct s6e3ha2 *ctx = container_of(panel, struct s6e3ha2, panel); struct drm_display_mode *mode; - mode = drm_mode_duplicate(panel->drm, &default_mode); + mode = drm_mode_duplicate(panel->drm, ctx->desc->mode); if (!mode) { DRM_ERROR("failed to add mode %ux%ux@%u\n", - default_mode.hdisplay, default_mode.vdisplay, - default_mode.vrefresh); + ctx->desc->mode->hdisplay, ctx->desc->mode->vdisplay, + ctx->desc->mode->vrefresh); return -ENOMEM; } @@ -642,6 +688,7 @@ static int s6e3ha2_probe(struct mipi_dsi_device *dsi) mipi_dsi_set_drvdata(dsi, ctx); ctx->dev = dev; + ctx->desc = of_device_get_match_data(dev); dsi->lanes = 4; dsi->format = MIPI_DSI_FMT_RGB888; @@ -717,7 +764,10 @@ static int s6e3ha2_remove(struct mipi_dsi_device *dsi) } static const struct of_device_id s6e3ha2_of_match[] = { - { .compatible = "samsung,s6e3ha2" }, + { .compatible = "samsung,s6e3ha2", + .data = &samsung_s6e3ha2 }, + { .compatible = "samsung,s6e3hf2", + .data = &samsung_s6e3hf2 }, { } }; MODULE_DEVICE_TABLE(of, s6e3ha2_of_match);