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: 1545021 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 6BEFEDF6DA for ; Thu, 4 Oct 2012 07:25:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753204Ab2JDHZI (ORCPT ); Thu, 4 Oct 2012 03:25:08 -0400 Received: from mailout4.samsung.com ([203.254.224.34]:33859 "EHLO mailout4.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753020Ab2JDHZB (ORCPT ); Thu, 4 Oct 2012 03:25:01 -0400 Received: from epcpsbgm2.samsung.com (epcpsbgm2 [203.254.230.27]) by mailout4.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MBC00CTLXVK9PN0@mailout4.samsung.com> for linux-media@vger.kernel.org; Thu, 04 Oct 2012 16:24:54 +0900 (KST) Received: from epcpsbgm2.samsung.com ( [172.20.52.125]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id 37.69.03860.6C93D605; Thu, 04 Oct 2012 16:24:54 +0900 (KST) X-AuditID: cbfee61b-b7f2b6d000000f14-83-506d39c6ac32 Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id 96.69.03860.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-media@vger.kernel.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 Cc: t.stanislaws@samsung.com, inki.dae@samsung.com, kyungmin.park@samsung.com, joshi@samsung.com 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+NgFrrNLMWRmVeSWpSXmKPExsWyRsSkVveYZW6AwbfbkhY9G7ayOjB6fN4k F8AYxWWTkpqTWZZapG+XwJXx/uNL9oIX8hWTft1mamCcI9XFyMkhIWAiMW19DzOELSZx4d56 ti5GLg4hgaWMEmtWzWSHKVp86iw7RGI6o8SL94uhnOVMEvOfLmcCqWIT0JWYffAZI4gtIuAq sXXLTTCbWSBJ4vvPSWA1wgJeEh+OfQJbxyKgKvGzax+YzSvgKfHxxBQmiG0KEq3LDgEt4ODg BIof+ZkIEhYS8JCY9KGDFaJVQOLb5EMsICUSArISmw4wg5wjIXCZTaLxzEyoMZISB1fcYJnA KLyAkWEVo2hqQXJBcVJ6rpFecWJucWleul5yfu4mRmAInv73THoH46oGi0OMAhyMSjy8FpNy AoRYE8uKK3MPMUpwMCuJ8G5WzA0Q4k1JrKxKLcqPLyrNSS0+xOgDdMlEZinR5HxgfOSVxBsa m5ibGptaGhmZmZriEFYS5232SAkQEkhPLEnNTk0tSC2CGcfEwSnVwOjr9K7jRPDaqIzZbdbs 198uSOuy7Fgt7J76yOHz+TJpldaLQlf3TLvV+fev0L/0w5umqW/J12JMcFA8rbjxTtqpYNbz n9YdXqyg3LJj84rPP1MNplTlBK9awr3GZt+HR2FFD/Rqj068dOjT9xNmP7YfCAxX/vTnptd8 8YCEAmmfhnOPLFk/TlBWYinOSDTUYi4qTgQAupRtZm4CAAA= X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFupikeLIzCtJLcpLzFFi42I5/e+xoO4xy9wAgwVrBCx6NmxldWD0+LxJ LoAxqoHRJiM1MSW1SCE1Lzk/JTMv3VbJOzjeOd7UzMBQ19DSwlxJIS8xN9VWycUnQNctMwdo qpJCWWJOKVAoILG4WEnfDtOE0BA3XQuYxghd35AguB4jAzSQsIYx4/3Hl+wFL+QrJv26zdTA OEeqi5GTQ0LARGLxqbPsELaYxIV769m6GLk4hASmM0q8eL+YHcJZziQx/+lyJpAqNgFdidkH nzGC2CICrhJbt9wEs5kFkiS+/5wEViMs4CXx4dgnZhCbRUBV4mfXPjCbV8BT4uOJKUwQ2xQk WpcdAlrAwcEJFD/yMxEkLCTgITHpQwfrBEbeBYwMqxhFUwuSC4qT0nON9IoTc4tL89L1kvNz NzGCA/yZ9A7GVQ0WhxgFOBiVeHgtJuUECLEmlhVX5h5ilOBgVhLh3ayYGyDEm5JYWZValB9f VJqTWnyI0QfoqInMUqLJ+cDoyyuJNzQ2MTc1NrU0sTAxs8QhrCTO2+yREiAkkJ5YkpqdmlqQ WgQzjomDU6qBMafasjS2Uc03ZFP8nUcOzQ29f3f+zk+1lxK7rHp8WXXM0bZVTGmvd37nvH/m b3k2Z+hP01W/s5c8vuvuL/tHhMHw0Iu38keqDHesfS20bcvxQIHbJb6nOByvmm7TnjNnAT+z t+3XTXMXmh1gu7D33me/Q38cGw4tWl+9XCHVX+WT/aq0vlqdCiWW4oxEQy3mouJEAD26R1yd AgAA X-CFilter-Loop: Reflected Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.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)