From patchwork Fri Apr 14 05:19:38 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hoegeun Kwon X-Patchwork-Id: 9680685 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 BC9F760132 for ; Fri, 14 Apr 2017 05:20:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id ADAFB285EB for ; Fri, 14 Apr 2017 05:20:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A1F6128673; Fri, 14 Apr 2017 05:20:24 +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 1C48928698 for ; Fri, 14 Apr 2017 05:20:09 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E84896E96C; Fri, 14 Apr 2017 05:20:03 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from epoutp02.samsung.com (mailout2.samsung.com [203.254.224.25]) by gabe.freedesktop.org (Postfix) with ESMTPS id 1A5C96E971 for ; Fri, 14 Apr 2017 05:20:01 +0000 (UTC) Received: from epcas1p1.samsung.com (unknown [182.195.41.45]) by epoutp02.samsung.com (KnoxPortal) with ESMTP id 20170414052000epoutp022072388fe283aeb1a25c8580dcc76171~1K-kTsva21535515355epoutp02Q; Fri, 14 Apr 2017 05:20:00 +0000 (GMT) Received: from epsmges5p1.samsung.com (unknown [182.195.40.66]) by epcas1p4.samsung.com (KnoxPortal) with ESMTP id 20170414051959epcas1p4b9d7690eaa5658584b9753bb1a8bf506~1K-j9kBgD0548305483epcas1p4m; Fri, 14 Apr 2017 05:19:59 +0000 (GMT) Received: from epcas5p1.samsung.com ( [182.195.41.39]) by epsmges5p1.samsung.com (EPCPMTA) with SMTP id EF.38.20983.FFB50F85; Fri, 14 Apr 2017 14:19:59 +0900 (KST) Received: from epcpsbgm2new.samsung.com (u27.gpu120.samsung.co.kr [203.254.230.27]) by epcas5p3.samsung.com (KnoxPortal) with ESMTP id 20170414051959epcas5p338f72abbf841233f6f1f0a240df2a1e9~1K-jU4DoE3142531425epcas5p3j; Fri, 14 Apr 2017 05:19:59 +0000 (GMT) X-AuditID: b6c32a2c-f79be6d0000051f7-46-58f05bffc2d5 Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm2new.samsung.com (EPCPMTA) with SMTP id 3C.0E.05013.FFB50F85; Fri, 14 Apr 2017 14:19:59 +0900 (KST) Received: from localhost.localdomain ([10.113.63.38]) by mmp1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0OOD001J1W57SZ00@mmp1.samsung.com>; Fri, 14 Apr 2017 14:19:58 +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 2/3] drm/panel: s6e3ha2: Add support for S6eHEA2 edge panel on TM2e board Date: Fri, 14 Apr 2017 14:19:38 +0900 Message-id: <1492147179-7824-3-git-send-email-hoegeun.kwon@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1492147179-7824-1-git-send-email-hoegeun.kwon@samsung.com> X-Brightmail-Tracker: H4sIAA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vFM9300Do6K5DKucXcxe/uPPsZtdpEwlJJZbijERDLeai4kQA0RfYnpoDAAA= X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrMIsWRmVeSWpSXmKPExsVy+t9jAd3/0R8iDGbf47W4te4cq0XvuZNM FtuPPGO1eL+sh9Fi/hGg2JWv79ks3i/vYrN483YNk0X/49fMFufPb2C32PT4GqvF5V1z2Cxm nN/HZLH0+kUmi9a9R9gtfu6ax2Lx8uMJFgdBjzXz1jB67Jx1l91j06pONo/t3x6wetzvPs7k sXlJvceWfqB435ZVjB6fN8kFcEa52WSkJqakFimk5iXnp2TmpdsqhYa46VooKeQl5qbaKkXo +oYEKSmUJeaUAnlGBmjAwTnAPVhJ3y7BLWN7/37WgutKFbMvHGdsYNwv08XIwSEhYCLx6Kl0 FyMnkCkmceHeerYuRi4OIYGljBINdy+yQjjfGSU6tjxlBqliE9CV+NpznQkkISKwllFi45LL YC3MArOYJP4vPMcIUiUsEC1x4tlBMJtFQFXi38kuFhCbV8BdYs2yflaIfXISJ49NBrM5BTwk fh8/ygZiCwHVPHl7g2kCI+8CRoZVjBKpBckFxUnpuUZ5qeV6xYm5xaV56XrJ+bmbGMER9kx6 B+PhXe6HGAU4GJV4eCNq30cIsSaWFVfmHmKU4GBWEuHdH/AhQog3JbGyKrUoP76oNCe1+BCj KdBhE5mlRJPzgdGfVxJvaGJuYm5sYGFuaWlipCTO2zj7WbiQQHpiSWp2ampBahFMHxMHp1QD o5BpXMq0Rcd69jS1C3AWnt4z7cWl4CurxFnnn30zYccskfYW1cVnFtb07531THhtjXnFVabJ G5YubZsuuPhUlew06V82j68+TPgWss4tNreLw2lF/I/Ddj4/L1poLWkVmF/wMUJVTeObSeDR e3cStRQu6Dt9uWgx/+mBuElCXXycOxvu/bvrXaXEUpyRaKjFXFScCACjioO9xgIAAA== X-MTR: 20000000000000000@CPGS X-CMS-MailID: 20170414051959epcas5p338f72abbf841233f6f1f0a240df2a1e9 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: 20170414051959epcas5p338f72abbf841233f6f1f0a240df2a1e9 X-RootMTR: 20170414051959epcas5p338f72abbf841233f6f1f0a240df2a1e9 References: <1492147179-7824-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 considers edge type of panel on TM2e board and The panel has 1600x2560 resolution in 5.65" physical panel in the TM2e device. This identify panel type with compatibility string, also invoke display mode that matches the type. So add the check code for default compatibility and edge type and select the drm_display_mode of default and edge type. Signed-off-by: Hoegeun Kwon --- drivers/gpu/drm/panel/panel-samsung-s6e3ha2.c | 62 ++++++++++++++++++++++++--- 1 file changed, 56 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/panel/panel-samsung-s6e3ha2.c b/drivers/gpu/drm/panel/panel-samsung-s6e3ha2.c index 4cc08d7..b4a064a 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 { + DEFAULT_TYPE, + EDGE_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 == EDGE_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 == DEFAULT_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; } @@ -597,16 +618,41 @@ static int s6e3ha2_enable(struct drm_panel *panel) .flags = 0, }; +static const struct s6e3ha2_panel_desc samsung_s6e3ha2_tm2 = { + .mode = &default_mode, + .type = DEFAULT_TYPE, +}; + +static const struct drm_display_mode edge_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_s6e3ha2_tm2e = { + .mode = &edge_mode, + .type = EDGE_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_tm2 }, + { .compatible = "samsung,s6e3ha2-e", + .data = &samsung_s6e3ha2_tm2e }, { } }; MODULE_DEVICE_TABLE(of, s6e3ha2_of_match);