From patchwork Mon Apr 17 06:02:13 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hoegeun Kwon X-Patchwork-Id: 9683531 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 56675600C5 for ; Mon, 17 Apr 2017 06:03:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 454E627317 for ; Mon, 17 Apr 2017 06:03:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 39F0E27BA5; Mon, 17 Apr 2017 06:03:25 +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=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 9596227317 for ; Mon, 17 Apr 2017 06:03:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-reply-to:Message-id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=cqcZPgoY89rrhlyyfYyKMXNHN/KesdXdsKLpfTMiovo=; b=qIDMWtCvUfanyuaQcmUTqDaW8A /SAvfjjufWIxeBmUdz2GaKQR8YCqx3l/QQgLVY0Xahbge3b7VXjlHajbwU2O3MhfHsU3sbPUdomo1 MfNxy/Sq4aYTvK2yu0VqAA4Ml8PL2++55eqEj/Rd/GQQAG9Q8eN6Xayut3OoxCnXBP0zrWzvAhKCY EoMAcYWKeAE87aoJ3uqSP+xAkm3Pnwmz16wlrla2V4EdeVFHHU5LG4tCffQjRFCWh05D3uvhOjpo/ c10uKK9y+2JkQbauUZP9DNjSJWNFf3oD2WE5fS33HiWCxZ2iVCEsNd49tMQMGqNPz0NXWppFg8uP2 9F6BjtqA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1czzkx-0007eu-Nj; Mon, 17 Apr 2017 06:03:23 +0000 Received: from mailout4.samsung.com ([203.254.224.34]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1czzkL-0006xP-AL for linux-arm-kernel@lists.infradead.org; Mon, 17 Apr 2017 06:02:49 +0000 Received: from epcas1p4.samsung.com (unknown [182.195.41.48]) by mailout4.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0OOJ01S8VI3W2X90@mailout4.samsung.com> for linux-arm-kernel@lists.infradead.org; Mon, 17 Apr 2017 15:02:20 +0900 (KST) Received: from epsmges5p4.samsung.com (unknown [182.195.40.68]) by epcas1p4.samsung.com (KnoxPortal) with ESMTP id 20170417060220epcas1p44871502594a2fe03fd61e92d2f0445fe~2GgY1lv0F0618506185epcas1p4o; Mon, 17 Apr 2017 06:02:20 +0000 (GMT) Received: from epcas5p3.samsung.com ( [182.195.41.41]) by epsmges5p4.samsung.com (EPCPMTA) with SMTP id FB.1E.07232.C6A54F85; Mon, 17 Apr 2017 15:02:20 +0900 (KST) Received: from epcpsbgm2new.samsung.com (u27.gpu120.samsung.co.kr [203.254.230.27]) by epcas5p4.samsung.com (KnoxPortal) with ESMTP id 20170417060219epcas5p4726fab1b7a58ac3d832e2be86873a37d~2GgYTofry2129021290epcas5p4K; Mon, 17 Apr 2017 06:02:19 +0000 (GMT) X-AuditID: b6c32a58-f79586d000001c40-a1-58f45a6c00f7 Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm2new.samsung.com (EPCPMTA) with SMTP id 8F.A6.05013.B6A54F85; Mon, 17 Apr 2017 15:02:19 +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 <0OOJ00IQJI3RD090@mmp1.samsung.com>; Mon, 17 Apr 2017 15:02:19 +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 v2 2/3] drm/panel: s6e3ha2: Add support for s6e3hf2 panel on TM2e board Date: Mon, 17 Apr 2017 15:02:13 +0900 Message-id: <1492408934-22096-3-git-send-email-hoegeun.kwon@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1492408934-22096-1-git-send-email-hoegeun.kwon@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFmpmk+LIzCtJLcpLzFFi42LZdlhTUzcn6kuEwZUuKYtb686xWvSeO8lk sf3IM1aL98t6GC3mHwGKXfn6ns3i/fIuNos3b9cwWfQ/fs1scf78BnaLTY+vsVpc3jWHzWLG +X1MFkuvX2SyaN17hN3i5655LBYvP55gcRD0WDNvDaPHzll32T02repk89j+7QGrx/3u40we m5fUe2zpB4r3bVnF6PF5k1wAZ1SqTUZqYkpqkUJqXnJ+SmZeuq2Sd3C8c7ypmYGhrqGlhbmS Ql5ibqqtkotPgK5bZg7QL0oKZYk5pUChgMTiYiV9O5ui/NKSVIWM/OISW6VoQ0MjPUMDcz0j IyM9E+NYKyNToJKE1Iwrv2axF8xTqXg1aQJTA+N12S5GTg4JAROJ100n2CFsMYkL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JGYuPYd E4QtJnHh3nq2LkYuDiGBpYwS/7d+ZIVwvjNKPNhzgRGkik1AV+Jrz3UmkISIwFpGiY1LLoO1 MAvMYpL4v/AcUBUHh7BApMTk54YgJouAqsTTPVogvbwCHhKzz+1khNgmJ3Hy2GRWkBJOAU+J Y7cNQMJCQCVflr9hn8DIu4CRYRWjRGpBckFxUnquUV5quV5xYm5xaV66XnJ+7iZGcHQ9k97B eHiX+yFGAQ5GJR7eB4c/RwixJpYVV+YeYpTgYFYS4Q0M/xIhxJuSWFmVWpQfX1Sak1p8iNEU 6KyJzFKiyfnAyM8riTc0MTcxNzawMLe0NDFSEudtnP0sXEggPbEkNTs1tSC1CKaPiYNTqoHR Ktywu+pedvEataumi7fMXLwmaPtVk7VnY1qUVpZf/XG6Ikucg+f74z/my3QTC8UMtHYv+Xbc SelUrq8zg2TWOq8es/b3U8Od5v2ryz4eUeGZd3PnubMskvKb9m2Nb9129mgzp26Lju6Tmhl8 n6Kckz48Zn993sdq70nvtzqaepzHs2b5Nm1SYinOSDTUYi4qTgQAcxJfKMQCAAA= X-MTR: 20000000000000000@CPGS X-CMS-MailID: 20170417060219epcas5p4726fab1b7a58ac3d832e2be86873a37d 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-HopCount: 7 X-CMS-RootMailID: 20170417060219epcas5p4726fab1b7a58ac3d832e2be86873a37d X-RootMTR: 20170417060219epcas5p4726fab1b7a58ac3d832e2be86873a37d References: <1492408934-22096-1-git-send-email-hoegeun.kwon@samsung.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170416_230245_540162_FE28C883 X-CRM114-Status: GOOD ( 16.04 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, linux-samsung-soc@vger.kernel.org, a.hajda@samsung.com, 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 MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org 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);