From patchwork Thu Oct 4 15:42:49 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rahul Sharma X-Patchwork-Id: 1545181 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork2.kernel.org (Postfix) with ESMTP id 46508DF6DA for ; Thu, 4 Oct 2012 07:30:01 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1TJfqO-0004rT-2I; Thu, 04 Oct 2012 07:27:40 +0000 Received: from mailout2.samsung.com ([203.254.224.25]) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1TJfnu-00039l-FP for linux-arm-kernel@lists.infradead.org; Thu, 04 Oct 2012 07:25:09 +0000 Received: from epcpsbgm1.samsung.com (epcpsbgm1 [203.254.230.26]) by mailout2.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MBC00LFOXWSZVQ0@mailout2.samsung.com> for linux-arm-kernel@lists.infradead.org; Thu, 04 Oct 2012 16:24:54 +0900 (KST) Received: from epcpsbgm1.samsung.com ( [172.20.52.126]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id F6.B5.03783.6C93D605; Thu, 04 Oct 2012 16:24:54 +0900 (KST) X-AuditID: cbfee61a-b7f726d000000ec7-0e-506d39c629be Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id 86.B5.03783.6C93D605; Thu, 04 Oct 2012 16:24:54 +0900 (KST) Received: from localhost.localdomain ([107.108.73.106]) by mmp2.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0MBC006I9XWMLU10@mmp2.samsung.com> for linux-arm-kernel@lists.infradead.org; Thu, 04 Oct 2012 16:24:54 +0900 (KST) From: Rahul Sharma To: linux-arm-kernel@lists.infradead.org, linux-media@vger.kernel.org Subject: [PATCH v1 11/14] drm: exynos: hdmi: add support for exynos5 mixer Date: Thu, 04 Oct 2012 21:12:49 +0530 Message-id: <1349365372-21417-12-git-send-email-rahul.sharma@samsung.com> X-Mailer: git-send-email 1.7.0.4 In-reply-to: <1349365372-21417-1-git-send-email-rahul.sharma@samsung.com> References: <1349365372-21417-1-git-send-email-rahul.sharma@samsung.com> DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrFLMWRmVeSWpSXmKPExsWyRsSkTveYZW6AweyJUhabHl9jdWD02Lyk PoAxissmJTUnsyy1SN8ugSvj/ceX7AUv5Csm/brN1MA4R6qLkYNDQsBE4uaymC5GTiBTTOLC vfVsXYxcHEICSxklvqyezg6RMJH4+ngrM0RiOqPE62NzWSGcDUwSB+53M4FUsQnoSsw++IwR xBYRcJXYuuUmmM0skCTx/ecksBphAS+JD8c+MYPYLAKqEj+79oHZvAKeEh9PTGGC2KYg0brs EDvIdZxA8SM/E0HCQgIeEpM+dLBCtApIfJt8iAXiAVmJTQfAbpMQuMwmMf/LbUaIMZISB1fc YJnAKLyAkWEVo2hqQXJBcVJ6rqFecWJucWleul5yfu4mRmAAnv73TGoH48oGi0OMAhyMSjy8 ht05AUKsiWXFlbmHGCU4mJVEeDcr5gYI8aYkVlalFuXHF5XmpBYfYvQBumQis5Rocj4wOvJK 4g2NTcxNjU0tjYzMTE1xCCuJ8zZ7pAQICaQnlqRmp6YWpBbBjGPi4JRqYIyZ9VyxKVeqM2Jr WLIDm4i8upZvpPulq+r6K38eKSpYNaVC451Dhumb12pt2xdWBn5oU75wjFd4bx33x9A9Dd8V y5gsKpXnCtnJKExvCeHYGWXzy8Lik5e/dMb/Cxvffy1NvMF7cbbXh+TM1Sk75k8WcDP4qvtd 9+CeZQcdp/z6ten/Tzb5dCWW4oxEQy3mouJEABDjvpltAgAA X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFupikeLIzCtJLcpLzFFi42I5/e+xoO4xy9wAgxdT+C02Pb7G6sDosXlJ fQBjVAOjTUZqYkpqkUJqXnJ+SmZeuq2Sd3C8c7ypmYGhrqGlhbmSQl5ibqqtkotPgK5bZg7Q VCWFssScUqBQQGJxsZK+HaYJoSFuuhYwjRG6viFBcD1GBmggYQ1jxvuPL9kLXshXTPp1m6mB cY5UFyMnh4SAicTXx1uZIWwxiQv31rN1MXJxCAlMZ5R4fWwuK4SzgUniwP1uJpAqNgFdidkH nzGC2CICrhJbt9wEs5kFkiS+/5wEViMs4CXx4dgnsKksAqoSP7v2gdm8Ap4SH09MYYLYpiDR uuwQexcjBwcnUPzIz0SQsJCAh8SkDx2sExh5FzAyrGIUTS1ILihOSs811CtOzC0uzUvXS87P 3cQIDvBnUjsYVzZYHGIU4GBU4uE17M4JEGJNLCuuzD3EKMHBrCTCu1kxN0CINyWxsiq1KD++ qDQntfgQow/QUROZpUST84HRl1cSb2hsYm5qbGppYmFiZolDWEmct9kjJUBIID2xJDU7NbUg tQhmHBMHp1QDo+61mwUvxaLMNkSXZphPLPhmZNU/K/z0g6dJm85XVNzt5gruWqfSsOxp1zcu l/hKJvGg7CvXEpc+Xxm2iqvp223NOdM917pxefC/jTvmK8fQZiS7ajbrWo0eHjEW1T0BpbtO JN61db72ROB2yI7jVsmpEkdaiqJinLnOP9Q/P/PY+dSdLGLBSizFGYmGWsxFxYkAVAG1aJ0C AAA= X-CFilter-Loop: Reflected X-Spam-Note: CRM114 invocation failed X-Spam-Score: -7.1 (-------) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-7.1 points) pts rule name description ---- ---------------------- -------------------------------------------------- -5.0 RCVD_IN_DNSWL_HI RBL: Sender listed at http://www.dnswl.org/, high trust [203.254.224.25 listed in list.dnswl.org] -0.0 SPF_HELO_PASS SPF: HELO matches SPF record 1.9 DATE_IN_FUTURE_06_12 Date: is 6 to 12 hours after Received: date -2.1 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: t.stanislaws@samsung.com, inki.dae@samsung.com, kyungmin.park@samsung.com, joshi@samsung.com X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org This patch adds support for exynos5 mixer with device tree enabled. Signed-off-by: Rahul Sharma Signed-off-by: Fahad Kunnathadi --- drivers/gpu/drm/exynos/exynos_mixer.c | 49 +++++++++++++++++++++++++++++++-- drivers/gpu/drm/exynos/regs-mixer.h | 3 ++ 2 files changed, 49 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c b/drivers/gpu/drm/exynos/exynos_mixer.c index 1677345..39d2b95 100644 --- a/drivers/gpu/drm/exynos/exynos_mixer.c +++ b/drivers/gpu/drm/exynos/exynos_mixer.c @@ -481,6 +481,18 @@ static void vp_video_buffer(struct mixer_context *ctx, int win) vp_regs_dump(ctx); } +static void mixer_layer_update(struct mixer_context *ctx) +{ + struct mixer_resources *res = &ctx->mixer_res; + u32 val; + + val = mixer_reg_read(res, MXR_CFG); + + /* allow one update per vsync only */ + if (!(val & MXR_CFG_LAYER_UPDATE_COUNT_MASK)) + mixer_reg_writemask(res, MXR_CFG, ~0, MXR_CFG_LAYER_UPDATE); +} + static void mixer_graph_buffer(struct mixer_context *ctx, int win) { struct mixer_resources *res = &ctx->mixer_res; @@ -561,6 +573,11 @@ static void mixer_graph_buffer(struct mixer_context *ctx, int win) mixer_cfg_scan(ctx, win_data->mode_height); mixer_cfg_rgb_fmt(ctx, win_data->mode_height); mixer_cfg_layer(ctx, win, true); + + /* layer update mandatory for mixer 16.0.33.0 */ + if (ctx->mxr_ver == MXR_VER_16_0_33_0) + mixer_layer_update(ctx); + mixer_run(ctx); mixer_vsync_set_update(ctx, true); @@ -1065,6 +1082,11 @@ fail: return ret; } +static struct mixer_drv_data exynos5_mxr_drv_data = { + .version = MXR_VER_16_0_33_0, + .is_vp_enabled = 0, +}; + static struct mixer_drv_data exynos4_mxr_drv_data = { .version = MXR_VER_0_0_0_16, .is_vp_enabled = 1, @@ -1075,6 +1097,18 @@ static struct platform_device_id mixer_driver_types[] = { .name = "s5p-mixer", .driver_data = (unsigned long)&exynos4_mxr_drv_data, }, { + .name = "exynos5-mixer", + .driver_data = (unsigned long)&exynos5_mxr_drv_data, + }, { + /* end node */ + } +}; + +static struct of_device_id mixer_match_types[] = { + { + .compatible = "samsung,exynos5-mixer", + .data = &exynos5_mxr_drv_data, + }, { /* end node */ } }; @@ -1104,8 +1138,16 @@ static int __devinit mixer_probe(struct platform_device *pdev) mutex_init(&ctx->mixer_mutex); - drv = (struct mixer_drv_data *)platform_get_device_id( - pdev)->driver_data; + if (dev->of_node) { + const struct of_device_id *match; + match = of_match_node(of_match_ptr(mixer_match_types), + pdev->dev.of_node); + drv = match->data; + } else { + drv = (struct mixer_drv_data *) + platform_get_device_id(pdev)->driver_data; + } + ctx->dev = &pdev->dev; drm_hdmi_ctx->ctx = (void *)ctx; ctx->vp_enabled = drv->is_vp_enabled; @@ -1167,9 +1209,10 @@ static SIMPLE_DEV_PM_OPS(mixer_pm_ops, mixer_suspend, NULL); struct platform_driver mixer_driver = { .driver = { - .name = "s5p-mixer", + .name = "exynos-mixer", .owner = THIS_MODULE, .pm = &mixer_pm_ops, + .of_match_table = mixer_match_types, }, .probe = mixer_probe, .remove = __devexit_p(mixer_remove), diff --git a/drivers/gpu/drm/exynos/regs-mixer.h b/drivers/gpu/drm/exynos/regs-mixer.h index fd2f4d1..5d8dbc0 100644 --- a/drivers/gpu/drm/exynos/regs-mixer.h +++ b/drivers/gpu/drm/exynos/regs-mixer.h @@ -69,6 +69,7 @@ (((val) << (low_bit)) & MXR_MASK(high_bit, low_bit)) /* bits for MXR_STATUS */ +#define MXR_STATUS_SOFT_RESET (1 << 8) #define MXR_STATUS_16_BURST (1 << 7) #define MXR_STATUS_BURST_MASK (1 << 7) #define MXR_STATUS_BIG_ENDIAN (1 << 3) @@ -77,6 +78,8 @@ #define MXR_STATUS_REG_RUN (1 << 0) /* bits for MXR_CFG */ +#define MXR_CFG_LAYER_UPDATE (1 << 31) +#define MXR_CFG_LAYER_UPDATE_COUNT_MASK (3 << 29) #define MXR_CFG_RGB601_0_255 (0 << 9) #define MXR_CFG_RGB601_16_235 (1 << 9) #define MXR_CFG_RGB709_0_255 (2 << 9)