From patchwork Wed Dec 26 06:37:34 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leela Krishna Amudala X-Patchwork-Id: 1910851 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 73C12DFAC4 for ; Wed, 26 Dec 2012 09:28:51 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 62329E60BF for ; Wed, 26 Dec 2012 01:28:51 -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 4D8A6E5E52 for ; Tue, 25 Dec 2012 22:15:13 -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 <0MFM00FH6K16FYQ0@mailout4.samsung.com> for dri-devel@lists.freedesktop.org; Wed, 26 Dec 2012 15:15:11 +0900 (KST) Received: from epcpsbgm2.samsung.com ( [172.20.52.124]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id FD.B9.12699.FE59AD05; Wed, 26 Dec 2012 15:15:11 +0900 (KST) X-AuditID: cbfee61b-b7f616d00000319b-fd-50da95ef6d63 Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id 9D.B9.12699.FE59AD05; Wed, 26 Dec 2012 15:15:11 +0900 (KST) Received: from chrome-ubuntu.sisodomain.com ([107.108.73.106]) by mmp1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0MFM00CQ9K15TP40@mmp1.samsung.com> for dri-devel@lists.freedesktop.org; Wed, 26 Dec 2012 15:15:11 +0900 (KST) From: Leela Krishna Amudala To: dri-devel@lists.freedesktop.org, linux-samsung-soc@vger.kernel.org Subject: [PATCH] video: drm: exynos: mie bypass enable for fimd Date: Wed, 26 Dec 2012 01:37:34 -0500 Message-id: <1356503854-28100-1-git-send-email-l.krishna@samsung.com> X-Mailer: git-send-email 1.8.0 DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrCLMWRmVeSWpSXmKPExsWyRsSkRvf91FsBBlN2Gllc+fqezYHR4373 caYAxigum5TUnMyy1CJ9uwSujBfL7rIVnJKoeL5oEVsD43WRLkZODgkBE4nWnq0sELaYxIV7 69m6GLk4hASWMkpsf/GZBaZozpxWqMQiRonO19dYIZyNTBLXp65lBqliEzCWuD93MxOILSLg JtF0eCZQEQcHs4C+xKEpuiBhYQF7idX/GthAbBYBVYklFxrYQWxeAVeJzq+32CCWyUl82POI HaJGQOLb5EMsIGMkBGQlNh1gBlkrIbCFTeLfzE6o4yQlDq64wTKBUXABI8MqRtHUguSC4qT0 XCO94sTc4tK8dL3k/NxNjMCgOv3vmfQOxlUNFocYBTgYlXh4OX/dDBBiTSwrrsw9xCjBwawk wuv8ESjEm5JYWZValB9fVJqTWnyI0QfokonMUqLJ+cCAzyuJNzQ2MTc1NrU0MjIzNcUhrCTO 2+yREiAkkJ5YkpqdmlqQWgQzjomDU6qBMbNU6h+beG7txLdzD29QOBfL3jKT9ZP4yjieQwWy RV/7grZZXTrmrG1x617FuaZ93F8dz9ac9bitvGzCMYXMO+9uCW+ZwcF7Lf/NE68FZtM37JRY 666ddMfnfssLcSbPhT/sudfpLrvdUL0h79sz02iHtXsTfwl2bhIMX9r6Ygrr7oO7Jqok3FRi Kc5INNRiLipOBAAwbl+iVwIAAA== X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrMLMWRmVeSWpSXmKPExsVy+t9jAd33U28FGOz9oWpx5et7NgdGj/vd x5kCGKMaGG0yUhNTUosUUvOS81My89JtlbyD453jTc0MDHUNLS3MlRTyEnNTbZVcfAJ03TJz gMYqKZQl5pQChQISi4uV9O0wTQgNcdO1gGmM0PUNCYLrMTJAAwlrGDNeLLvLVnBKouL5okVs DYzXRboYOTkkBEwk5sxpZYOwxSQu3FsPZHNxCAksYpTofH2NFcLZyCRxfepaZpAqNgFjiftz NzOB2CICbhJNh2cCFXFwMAvoSxyaogsSFhawl1j9rwFsKIuAqsSSCw3sIDavgKtE59dbUMvk JD7secQ+gZF7ASPDKkbR1ILkguKk9FwjveLE3OLSvHS95PzcTYzgkH0mvYNxVYPFIUYBDkYl Hl7OXzcDhFgTy4orcw8xSnAwK4nwOn8ECvGmJFZWpRblxxeV5qQWH2L0Ado+kVlKNDkfGE95 JfGGxibmpsamliYWJmaWOISVxHmbPVIChATSE0tSs1NTC1KLYMYxcXBKNTB2eNkJGLvy/U6w P/6tpe1ybvMVe7ark9XmNNbsk3/vprM6/9QzxVzHog8yfJxS4kUKfy57b89676dfVRik9y/C LtesTa7hYlru1J9Sof6ajiWfmzJdztT43nQtf2sr1Xn+QNLt2FmXv39YUGfXOvP3gshTc3Yc cK++0dTkd1rSa6Ng+rNXW5VYijMSDbWYi4oTATy8Bn+GAgAA X-CFilter-Loop: Reflected X-Mailman-Approved-At: Wed, 26 Dec 2012 01:25:58 -0800 Cc: kgene.kim@samsung.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 Bypasses the mie for fimd by parsing the register and bit offset values from "mie-bypass" node, if "mie-bypass" node is present in the dts file. Signed-off-by: Leela Krishna Amudala --- drivers/gpu/drm/exynos/exynos_drm_fimd.c | 55 ++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c b/drivers/gpu/drm/exynos/exynos_drm_fimd.c index bf0d9ba..f8ad259 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c +++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c @@ -118,6 +118,12 @@ static const struct of_device_id fimd_driver_dt_match[] = { MODULE_DEVICE_TABLE(of, fimd_driver_dt_match); #endif +struct mie_bypass { + u32 enable_bypass; + void __iomem *bypass_reg; + u32 bypass_bit_offset; +}; + static inline struct fimd_driver_data *drm_fimd_get_driver_data( struct platform_device *pdev) { @@ -133,6 +139,41 @@ static inline struct fimd_driver_data *drm_fimd_get_driver_data( platform_get_device_id(pdev)->driver_data; } +static struct mie_bypass *parse_mie_bypass_for_fimd(struct device *dev, + struct device_node *mie_bypass_node) +{ + struct mie_bypass *bypass_data; + u32 phy_address; + + bypass_data = devm_kzalloc(dev, sizeof(*bypass_data), GFP_KERNEL); + if (!bypass_data) { + dev_err(dev, "memory allocation for bypass data failed\n"); + return ERR_PTR(-ENOMEM); + } + of_property_read_u32(mie_bypass_node, "samsung,mie-bypass-enable", + &bypass_data->enable_bypass); + of_property_read_u32(mie_bypass_node, "samsung,disp1blk-cfg-reg", + &phy_address); + of_property_read_u32(mie_bypass_node, "samsung,bypass-bit-offset", + &bypass_data->bypass_bit_offset); + + bypass_data->bypass_reg = ioremap(phy_address, SZ_4); + if (!bypass_data->bypass_reg) { + dev_err(dev, "failed to ioremap phy_address\n"); + return ERR_PTR(-ENOMEM); + } + return bypass_data; +} + +static void mie_bypass_for_fimd(struct mie_bypass *bypass_data) +{ + u32 reg; + + reg = __raw_readl(bypass_data->bypass_reg); + reg |= (1 << bypass_data->bypass_bit_offset); + __raw_writel(reg, bypass_data->bypass_reg); +} + static bool fimd_display_is_connected(struct device *dev) { DRM_DEBUG_KMS("%s\n", __FILE__); @@ -906,12 +947,26 @@ static int __devinit fimd_probe(struct platform_device *pdev) struct exynos_drm_fimd_pdata *pdata; struct exynos_drm_panel_info *panel; struct resource *res; + struct device_node *mie_bypass_node; + struct mie_bypass *bypass_data = NULL; int win; int ret = -EINVAL; DRM_DEBUG_KMS("%s\n", __FILE__); pdata = pdev->dev.platform_data; + if (pdev->dev.of_node) { + mie_bypass_node = of_find_node_by_name(pdev->dev.of_node, + "mie-bypass"); + if (mie_bypass_node) { + bypass_data = parse_mie_bypass_for_fimd(&pdev->dev, + mie_bypass_node); + if (IS_ERR(bypass_data)) + return PTR_ERR(bypass_data); + if (bypass_data->enable_bypass) + mie_bypass_for_fimd(bypass_data); + } + } if (!pdata) { dev_err(dev, "no platform data specified\n"); return -EINVAL;