From patchwork Tue Sep 17 07:06:27 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: archit taneja X-Patchwork-Id: 2901141 Return-Path: X-Original-To: patchwork-linux-fbdev@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 853D59F1C0 for ; Tue, 17 Sep 2013 07:08:21 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0A7A12034D for ; Tue, 17 Sep 2013 07:08:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4DABE20336 for ; Tue, 17 Sep 2013 07:08:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752229Ab3IQHHx (ORCPT ); Tue, 17 Sep 2013 03:07:53 -0400 Received: from bear.ext.ti.com ([192.94.94.41]:33446 "EHLO bear.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752157Ab3IQHHe (ORCPT ); Tue, 17 Sep 2013 03:07:34 -0400 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by bear.ext.ti.com (8.13.7/8.13.7) with ESMTP id r8H77XCP029722; Tue, 17 Sep 2013 02:07:33 -0500 Received: from DLEE71.ent.ti.com (dlee71.ent.ti.com [157.170.170.114]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id r8H77XoP024135; Tue, 17 Sep 2013 02:07:33 -0500 Received: from dflp33.itg.ti.com (10.64.6.16) by DLEE71.ent.ti.com (157.170.170.114) with Microsoft SMTP Server id 14.2.342.3; Tue, 17 Sep 2013 02:07:33 -0500 Received: from legion.dal.design.ti.com (legion.dal.design.ti.com [128.247.22.53]) by dflp33.itg.ti.com (8.14.3/8.13.8) with ESMTP id r8H77XYV028494; Tue, 17 Sep 2013 02:07:33 -0500 Received: from localhost (a0393947pc.apr.dhcp.ti.com [172.24.145.166]) by legion.dal.design.ti.com (8.11.7p1+Sun/8.11.7) with ESMTP id r8H77Wt25038; Tue, 17 Sep 2013 02:07:32 -0500 (CDT) From: Archit Taneja To: CC: , , Archit Taneja Subject: [PATCH 01/11] omapdss: HDMI: create a hdmi wrapper library Date: Tue, 17 Sep 2013 12:36:27 +0530 Message-ID: <1379401597-27222-2-git-send-email-archit@ti.com> X-Mailer: git-send-email 1.8.1.2 In-Reply-To: <1379401597-27222-1-git-send-email-archit@ti.com> References: <1379401597-27222-1-git-send-email-archit@ti.com> MIME-Version: 1.0 Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP HDMI wrapper is a block common to DSS in OMAP4, OMAP5 and DRA7x. Move the existing functions from ti_hdmi_4xxx_ip.c to a separate file. These funcs are called directly from the hdmi driver rather than hdmi_ip_ops funtion pointer calls. Add new wrapper funcs which can be used by other hdmi libraries like core, pll and phy. Move some of the enums, structs and funcs related to the wrapper from ti_hdmi_4xxx_ip.h to ti_hdmi.h. These will be shared amongst the omap4/5 hdmi platform drivers and other libraries. The old hdmi_wp_init() is removed since it didn't do anything. Timing parameters like interlace, hsync_level and vsync_level weren't copied correctly before. Those are copied correctly now. Signed-off-by: Archit Taneja --- drivers/video/omap2/dss/Makefile | 2 +- drivers/video/omap2/dss/dss_features.c | 5 - drivers/video/omap2/dss/hdmi.c | 26 +-- drivers/video/omap2/dss/hdmi_wp.c | 285 +++++++++++++++++++++++++++ drivers/video/omap2/dss/ti_hdmi.h | 131 +++++++++++-- drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c | 308 +++++------------------------- drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h | 85 --------- 7 files changed, 462 insertions(+), 380 deletions(-) create mode 100644 drivers/video/omap2/dss/hdmi_wp.c diff --git a/drivers/video/omap2/dss/Makefile b/drivers/video/omap2/dss/Makefile index 94832eb..56ce6bd 100644 --- a/drivers/video/omap2/dss/Makefile +++ b/drivers/video/omap2/dss/Makefile @@ -10,5 +10,5 @@ omapdss-$(CONFIG_OMAP2_DSS_RFBI) += rfbi.o omapdss-$(CONFIG_OMAP2_DSS_VENC) += venc.o omapdss-$(CONFIG_OMAP2_DSS_SDI) += sdi.o omapdss-$(CONFIG_OMAP2_DSS_DSI) += dsi.o -omapdss-$(CONFIG_OMAP4_DSS_HDMI) += hdmi.o ti_hdmi_4xxx_ip.o +omapdss-$(CONFIG_OMAP4_DSS_HDMI) += hdmi.o hdmi_wp.o ti_hdmi_4xxx_ip.o ccflags-$(CONFIG_OMAP2_DSS_DEBUG) += -DDEBUG diff --git a/drivers/video/omap2/dss/dss_features.c b/drivers/video/omap2/dss/dss_features.c index b9cfebb..db359e8 100644 --- a/drivers/video/omap2/dss/dss_features.c +++ b/drivers/video/omap2/dss/dss_features.c @@ -799,15 +799,10 @@ static const struct ti_hdmi_ip_ops omap4_hdmi_functions = { .read_edid = ti_hdmi_4xxx_read_edid, .pll_enable = ti_hdmi_4xxx_pll_enable, .pll_disable = ti_hdmi_4xxx_pll_disable, - .video_enable = ti_hdmi_4xxx_wp_video_start, - .video_disable = ti_hdmi_4xxx_wp_video_stop, - .dump_wrapper = ti_hdmi_4xxx_wp_dump, .dump_core = ti_hdmi_4xxx_core_dump, .dump_pll = ti_hdmi_4xxx_pll_dump, .dump_phy = ti_hdmi_4xxx_phy_dump, #if defined(CONFIG_OMAP4_DSS_HDMI_AUDIO) - .audio_enable = ti_hdmi_4xxx_wp_audio_enable, - .audio_disable = ti_hdmi_4xxx_wp_audio_disable, .audio_start = ti_hdmi_4xxx_audio_start, .audio_stop = ti_hdmi_4xxx_audio_stop, .audio_config = ti_hdmi_4xxx_audio_config, diff --git a/drivers/video/omap2/dss/hdmi.c b/drivers/video/omap2/dss/hdmi.c index 82a9640..f2475fc 100644 --- a/drivers/video/omap2/dss/hdmi.c +++ b/drivers/video/omap2/dss/hdmi.c @@ -40,7 +40,6 @@ #include "dss.h" #include "dss_features.h" -#define HDMI_WP 0x0 #define HDMI_CORE_SYS 0x400 #define HDMI_CORE_AV 0x900 #define HDMI_PLLCTRL 0x200 @@ -529,7 +528,7 @@ static int hdmi_power_on_full(struct omap_dss_device *dssdev) hdmi_compute_pll(dssdev, phy, &hdmi.ip_data.pll_data); - hdmi.ip_data.ops->video_disable(&hdmi.ip_data); + hdmi_wp_video_stop(&hdmi.ip_data.wp); /* config the PLL and PHY hdmi_set_pll_pwrfirst */ r = hdmi.ip_data.ops->pll_enable(&hdmi.ip_data); @@ -552,7 +551,7 @@ static int hdmi_power_on_full(struct omap_dss_device *dssdev) /* tv size */ dss_mgr_set_timings(mgr, p); - r = hdmi.ip_data.ops->video_enable(&hdmi.ip_data); + r = hdmi_wp_video_start(&hdmi.ip_data.wp); if (r) goto err_vid_enable; @@ -563,7 +562,7 @@ static int hdmi_power_on_full(struct omap_dss_device *dssdev) return 0; err_mgr_enable: - hdmi.ip_data.ops->video_disable(&hdmi.ip_data); + hdmi_wp_video_stop(&hdmi.ip_data.wp); err_vid_enable: hdmi.ip_data.ops->phy_disable(&hdmi.ip_data); err_phy_enable: @@ -579,7 +578,7 @@ static void hdmi_power_off_full(struct omap_dss_device *dssdev) dss_mgr_disable(mgr); - hdmi.ip_data.ops->video_disable(&hdmi.ip_data); + hdmi_wp_video_stop(&hdmi.ip_data.wp); hdmi.ip_data.ops->phy_disable(&hdmi.ip_data); hdmi.ip_data.ops->pll_disable(&hdmi.ip_data); @@ -642,7 +641,7 @@ static void hdmi_dump_regs(struct seq_file *s) return; } - hdmi.ip_data.ops->dump_wrapper(&hdmi.ip_data, s); + hdmi_wp_dump(&hdmi.ip_data.wp, s); hdmi.ip_data.ops->dump_pll(&hdmi.ip_data, s); hdmi.ip_data.ops->dump_phy(&hdmi.ip_data, s); hdmi.ip_data.ops->dump_core(&hdmi.ip_data, s); @@ -946,8 +945,7 @@ static int hdmi_audio_enable(struct omap_dss_device *dssdev) goto err; } - - r = hdmi.ip_data.ops->audio_enable(&hdmi.ip_data); + r = hdmi_wp_audio_enable(&hdmi.ip_data.wp, true); if (r) goto err; @@ -961,7 +959,7 @@ err: static void hdmi_audio_disable(struct omap_dss_device *dssdev) { - hdmi.ip_data.ops->audio_disable(&hdmi.ip_data); + hdmi_wp_audio_enable(&hdmi.ip_data.wp, false); } static int hdmi_audio_start(struct omap_dss_device *dssdev) @@ -1086,7 +1084,6 @@ static void __exit hdmi_uninit_output(struct platform_device *pdev) /* HDMI HW IP initialisation */ static int omapdss_hdmihw_probe(struct platform_device *pdev) { - struct resource *res; int r; hdmi.pdev = pdev; @@ -1094,12 +1091,9 @@ static int omapdss_hdmihw_probe(struct platform_device *pdev) mutex_init(&hdmi.lock); mutex_init(&hdmi.ip_data.lock); - res = platform_get_resource(hdmi.pdev, IORESOURCE_MEM, 0); - - /* Base address taken from platform */ - hdmi.ip_data.base_wp = devm_ioremap_resource(&pdev->dev, res); - if (IS_ERR(hdmi.ip_data.base_wp)) - return PTR_ERR(hdmi.ip_data.base_wp); + r = hdmi_wp_init(pdev, &hdmi.ip_data.wp); + if (r) + return r; hdmi.ip_data.irq = platform_get_irq(pdev, 0); if (hdmi.ip_data.irq < 0) { diff --git a/drivers/video/omap2/dss/hdmi_wp.c b/drivers/video/omap2/dss/hdmi_wp.c new file mode 100644 index 0000000..482940a --- /dev/null +++ b/drivers/video/omap2/dss/hdmi_wp.c @@ -0,0 +1,285 @@ +/* + * HDMI wrapper + * + * Copyright (C) 2013 Texas Instruments Incorporated + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published by + * the Free Software Foundation. + */ + +#include +#include +#include +#include +#include +#include