From patchwork Thu Dec 6 12:08:14 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chandrasekar R X-Patchwork-Id: 1845371 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by patchwork2.kernel.org (Postfix) with ESMTP id CBFA0DF2F9 for ; Thu, 6 Dec 2012 15:41:45 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 77A3CE68E0 for ; Thu, 6 Dec 2012 07:41:45 -0800 (PST) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mailout4.samsung.com (mailout4.samsung.com [203.254.224.34]) by gabe.freedesktop.org (Postfix) with ESMTP id 57143E661B for ; Thu, 6 Dec 2012 04:11:53 -0800 (PST) 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 <0MEL005BBZ7LGIG0@mailout4.samsung.com> for dri-devel@lists.freedesktop.org; Thu, 06 Dec 2012 21:11:52 +0900 (KST) Received: from epcpsbgm2.samsung.com ( [172.20.52.122]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id 8E.44.12699.78B80C05; Thu, 06 Dec 2012 21:11:52 +0900 (KST) X-AuditID: cbfee61b-b7f616d00000319b-ad-50c08b876482 Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id ED.44.12699.78B80C05; Thu, 06 Dec 2012 21:11:51 +0900 (KST) Received: from sekar-ubuntu.sisodomain.com ([107.108.73.178]) by mmp1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0MEL008T3Z2ZPL00@mmp1.samsung.com> for dri-devel@lists.freedesktop.org; Thu, 06 Dec 2012 21:11:51 +0900 (KST) From: "R. Chandrasekar" To: linux-samsung-soc@vger.kernel.org, devicetree-discuss@lists.ozlabs.org, dri-devel@lists.freedesktop.org Subject: [PATCH 2/3] drm: fimd: add mie plugin support for dithering Date: Thu, 06 Dec 2012 17:38:14 +0530 Message-id: <1354795695-28009-3-git-send-email-rcsekar@samsung.com> X-Mailer: git-send-email 1.7.9.5 In-reply-to: <1354795695-28009-1-git-send-email-rcsekar@samsung.com> References: <1354795695-28009-1-git-send-email-rcsekar@samsung.com> DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrLLMWRmVeSWpSXmKPExsWyRsSkSrej+0CAQftzNosrX9+zOTB63O8+ zhTAGMVlk5Kak1mWWqRvl8CV8ab7GWPBXIWKW8u2MjUw/pXqYuTkkBAwkeicvJUNwhaTuHBv PZDNxSEksJRR4tWUxWwwRT0PDzNCJBYxSuxdMI0JwtnAJDH99mJWkCo2AV2J9x0PWEBsEYFc iYa/7SwgRcwC/YwSK1uugiWEBVwkPi25ww5iswioSqzd8hwszivgLHF3ThfQIA6gdQoScybZ gIQ5gcq/tD5nBrGFgEr+LljHBNEqIPFt8iEWiHJZiU0HmEFWSQhcZ5PYMm0vI8TVkhIHV9xg mcAovICRYRWjaGpBckFxUnqukV5xYm5xaV66XnJ+7iZGYBie/vdMegfjqgaLQ4wCHIxKPLwW 1fsDhFgTy4orcw8xSnAwK4nwxnQcCBDiTUmsrEotyo8vKs1JLT7E6AN0yURmKdHkfGCM5JXE GxqbmJsam1oaGZmZmuIQVhLnbfZICRASSE8sSc1OTS1ILYIZx8TBKdXAKNd378K5mc/+rNlh M2/+kV1vnj/eWRXfbz/jR2qZd/Hv1pjSfzF/V83Partg+bjxYMPl/zWFmbe+GsutWOJbdOZz yJwnx/5/l7T2vTNpdoL9iWi7Y7FSrOcajrwUS38ha3HVPH89a5TsN9n4jxdT7x4vM1r/aBX7 PNX2yG9zF+t1dPKIp5Td/qzEUpyRaKjFXFScCAB4U2adcAIAAA== X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFuphkeLIzCtJLcpLzFFi42I5/e+xgG5794EAg0UvzSyufH3P5sDocb/7 OFMAY1QDo01GamJKapFCal5yfkpmXrqtkndwvHO8qZmBoa6hpYW5kkJeYm6qrZKLT4CuW2YO 0FglhbLEnFKgUEBicbGSvh2mCaEhbroWMI0Rur4hQXA9RgZoIGENY8ab7meMBXMVKm4t28rU wPhXqouRk0NCwESi5+FhRghbTOLCvfVsXYxcHEICixgl9i6YxgThbGCSmH57MStIFZuArsT7 jgcsILaIQK5Ew992FpAiZoF+RomVLVfBEsICLhKfltxhB7FZBFQl1m55DhbnFXCWuDunC2gQ B9A6BYk5k2xAwpxA5V9anzOD2EJAJX8XrGOawMi7gJFhFaNoakFyQXFSeq6RXnFibnFpXrpe cn7uJkZwkD+T3sG4qsHiEKMAB6MSD69F9f4AIdbEsuLK3EOMEhzMSiK8MR0HAoR4UxIrq1KL 8uOLSnNSiw8x+gAdNZFZSjQ5HxiBeSXxhsYm5qbGppYmFiZmljiElcR5mz1SAoQE0hNLUrNT UwtSi2DGMXFwSjUwWnu/imHb+mOO9jvexUWHD36zErVy4V3+8mXoq+g839xN2c0PxZ76rYzg v3Gk8+kx52UN9a5H592oEdSY27/IpzuzpzBkT2jdlImrbH1NVjDODry+yqH8q+RJNtUNGtnp GU8tdmVk31i3VGvK7Qrmoqb+JZavDzm2T8pqMHZry/u8qWTJwz1flViKMxINtZiLihMBQRhp J58CAAA= X-CFilter-Loop: Reflected X-Mailman-Approved-At: Thu, 06 Dec 2012 07:30:39 -0800 Cc: kgene.kim@samsung.com, rcsekar@samsung.com, joshi@samsung.com, kyungmin.park@samsung.com, rcsekar.samsung@gmail.com X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org Errors-To: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org From: "R. Chandrasekar" mie provides the dithereing functionality, fimd need to call the mie dithering function is required when panel uses lesser bits per pixel (bpp) of fimd. This cl adds the functions to add the mie plugin, and calls the mie dithereing function. Signed-off-by: R. Chandrasekar --- drivers/gpu/drm/exynos/exynos_drm_fimd.c | 58 ++++++++++++++++++++++- drivers/gpu/drm/exynos/exynos_drm_fimd_common.h | 20 ++++++++ 2 files changed, 76 insertions(+), 2 deletions(-) create mode 100644 drivers/gpu/drm/exynos/exynos_drm_fimd_common.h diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c b/drivers/gpu/drm/exynos/exynos_drm_fimd.c index e2abae6..6e406d2 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c +++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c @@ -27,6 +27,7 @@ #include "exynos_drm_fbdev.h" #include "exynos_drm_crtc.h" #include "exynos_drm_iommu.h" +#include "exynos_drm_mie.h" /* * FIMD is stand for Fully Interactive Mobile Display and @@ -107,9 +108,59 @@ struct fimd_context { static const struct of_device_id fimd_dt_match[]; -static inline struct fimd_driver_data *drm_fimd_get_driver_data( - struct platform_device *pdev) +static struct mie_plugin *mie; + +/* This function provides the fecility to add the mie plugin with fimd */ +void fimd_add_mie_plugin(struct mie_plugin *mie_plugin_data) +{ + mie = mie_plugin_data; +} + +static int fimd_set_dithering_mode(struct fimd_context *ctx, + enum en_dither_mode dither_mode) { + struct fb_videomode *timing = &ctx->panel->timing; + struct mie_settings settings; + int ret = -1; + + DRM_DEBUG_KMS(" %s Called\n", __func__); + + if (!mie) { + DRM_DEBUG_KMS("invalid mie plugin.\n"); + return -EINVAL; + } + + if ((!mie->ops.fn_configure_dither) || (!mie->ops.fn_dither_enable)) { + DRM_DEBUG_KMS("Invalid MIE function pointers\n"); + return -EINVAL; + } + + settings.xres = timing->xres; + settings.yres = timing->yres; + settings.left_margin = timing->left_margin; + settings.right_margin = timing->right_margin; + settings.upper_margin = timing->upper_margin; + settings.lower_margin = timing->lower_margin; + settings.hsync_len = timing->hsync_len; + settings.vsync_len = timing->vsync_len; + + if (dither_mode < INVALID_DITHER_MODE) + settings.dither_mode = dither_mode; + else { + DRM_DEBUG_KMS("Invalid dithering mode[%d]\n", dither_mode); + return -EINVAL; + } + + ret = mie->ops.fn_configure_dither(mie->dev, &settings); + + if (!ret) + ret = mie->ops.fn_dither_enable(mie->dev, MIE_DITHER_EN); + + return ret; +} + +static inline struct fimd_driver_data *drm_fimd_get_driver_data( + struct platform_device *pdev) { #ifdef CONFIG_OF if (pdev->dev.of_node) { const struct of_device_id *match; @@ -558,6 +609,9 @@ static void fimd_win_commit(struct device *dev, int zpos) val |= WINCONx_ENWIN; writel(val, ctx->regs + WINCON(win)); + /* enable 6bit dithering based on pannel type TBD*/ + fimd_set_dithering_mode(ctx, DITHER_6BIT); + /* Enable DMA channel and unprotect windows */ val = readl(ctx->regs + SHADOWCON); val |= SHADOWCON_CHx_ENABLE(win); diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd_common.h b/drivers/gpu/drm/exynos/exynos_drm_fimd_common.h new file mode 100644 index 0000000..bdd4fc7 --- /dev/null +++ b/drivers/gpu/drm/exynos/exynos_drm_fimd_common.h @@ -0,0 +1,20 @@ +/* exynos_drm_fimd_common.h + * + * Copyright (C) 2012 Samsung Electronics Co.Ltd + * Authors: + * R. Chandrasekar + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + */ + +#ifndef __EXYNOS_DRM_FIMD_COMMON_H +#define __EXYNOS_DRM_FIMD_COMMON_H + + +void fimd_add_mie_plugin(struct mie_plugin *mie_plugin_data); + +#endif /*__EXYNOS_DRM_FIMD_COMMON_H */