From patchwork Fri Jun 27 18:38:46 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jyri Sarha X-Patchwork-Id: 4437391 Return-Path: X-Original-To: patchwork-alsa-devel@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 683BF9F319 for ; Fri, 27 Jun 2014 18:43:24 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 63495203A9 for ; Fri, 27 Jun 2014 18:43:23 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 0CC01202BE for ; Fri, 27 Jun 2014 18:43:22 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 1B0BC2654B2; Fri, 27 Jun 2014 20:43:21 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,NO_DNS_FOR_FROM, UNPARSEABLE_RELAY autolearn=no version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id 079A52654B2; Fri, 27 Jun 2014 20:39:23 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id B5B1626546B; Fri, 27 Jun 2014 20:39:15 +0200 (CEST) Received: from comal.ext.ti.com (comal.ext.ti.com [198.47.26.152]) by alsa0.perex.cz (Postfix) with ESMTP id 4385726537B for ; Fri, 27 Jun 2014 20:39:07 +0200 (CEST) Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by comal.ext.ti.com (8.13.7/8.13.7) with ESMTP id s5RId5IR023438; Fri, 27 Jun 2014 13:39:05 -0500 Received: from DFLE72.ent.ti.com (dfle72.ent.ti.com [128.247.5.109]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id s5RId45b020726; Fri, 27 Jun 2014 13:39:04 -0500 Received: from dflp33.itg.ti.com (10.64.6.16) by DFLE72.ent.ti.com (128.247.5.109) with Microsoft SMTP Server id 14.3.174.1; Fri, 27 Jun 2014 13:39:04 -0500 Received: from localhost (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp33.itg.ti.com (8.14.3/8.13.8) with ESMTP id s5RId3ZE007225; Fri, 27 Jun 2014 13:39:04 -0500 From: Jyri Sarha To: , , Date: Fri, 27 Jun 2014 21:38:46 +0300 Message-ID: <536afa4069bd73195b05aee3097c86d7e517ae7e.1403894190.git.jsarha@ti.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: References: MIME-Version: 1.0 Cc: liam.r.girdwood@linux.intel.com, detheridge@ti.com, broonie@kernel.org, Jyri Sarha , peter.ujfalusi@ti.com, tomi.valkeinen@ti.com, jyri.sarha@iki.fi Subject: [alsa-devel] [PATCH v2 04/13] OMAPDSS: hdmi: Make hdmi structure public X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP Name the anonymous hdmi struct as omap_hdmi. Move the struct definition to hdmi.h and turn core member into a pointer to deal with it's different definitions for omap4 and omap5. Make associated changes to hdmi4.c and hdmi5.c. Signed-off-by: Jyri Sarha --- drivers/video/fbdev/omap2/dss/hdmi.h | 24 +++++++++++++++++++ drivers/video/fbdev/omap2/dss/hdmi4.c | 41 +++++++++++---------------------- drivers/video/fbdev/omap2/dss/hdmi5.c | 30 +++++++----------------- 3 files changed, 46 insertions(+), 49 deletions(-) diff --git a/drivers/video/fbdev/omap2/dss/hdmi.h b/drivers/video/fbdev/omap2/dss/hdmi.h index 9e85b86..075357e 100644 --- a/drivers/video/fbdev/omap2/dss/hdmi.h +++ b/drivers/video/fbdev/omap2/dss/hdmi.h @@ -349,5 +349,29 @@ static inline bool hdmi_mode_has_audio(int mode) { return mode == HDMI_HDMI ? true : false; } + +/* HDMI DRV data */ +struct omap_hdmi { + struct mutex lock; + struct platform_device *pdev; + + struct hdmi_wp_data wp; + struct hdmi_pll_data pll; + struct hdmi_phy_data phy; + struct hdmi_core_data *core; + + struct hdmi_config cfg; + + struct clk *sys_clk; + struct regulator *vdda_reg; + +#if defined(CONFIG_OMAP_DSS_HDMI_AUDIO) + struct hdmi_audio_data audio; +#endif + bool core_enabled; + + struct omap_dss_device output; +}; + #endif #endif diff --git a/drivers/video/fbdev/omap2/dss/hdmi4.c b/drivers/video/fbdev/omap2/dss/hdmi4.c index 6a8550c..58f1295 100644 --- a/drivers/video/fbdev/omap2/dss/hdmi4.c +++ b/drivers/video/fbdev/omap2/dss/hdmi4.c @@ -37,25 +37,10 @@ #include "hdmi4_core.h" #include "dss.h" #include "dss_features.h" +#include "hdmi.h" -static struct { - struct mutex lock; - struct platform_device *pdev; - - struct hdmi_wp_data wp; - struct hdmi_pll_data pll; - struct hdmi_phy_data phy; - struct hdmi_core_data core; - - struct hdmi_config cfg; - - struct clk *sys_clk; - struct regulator *vdda_hdmi_dac_reg; - - bool core_enabled; - - struct omap_dss_device output; -} hdmi; +static struct omap_hdmi hdmi; +static struct hdmi_core_data hdmi4_core; static int hdmi_runtime_get(void) { @@ -117,7 +102,7 @@ static int hdmi_init_regulator(void) int r; struct regulator *reg; - if (hdmi.vdda_hdmi_dac_reg != NULL) + if (hdmi.vdda_reg != NULL) return 0; reg = devm_regulator_get(&hdmi.pdev->dev, "vdda"); @@ -137,7 +122,7 @@ static int hdmi_init_regulator(void) } } - hdmi.vdda_hdmi_dac_reg = reg; + hdmi.vdda_reg = reg; return 0; } @@ -146,7 +131,7 @@ static int hdmi_power_on_core(struct omap_dss_device *dssdev) { int r; - r = regulator_enable(hdmi.vdda_hdmi_dac_reg); + r = regulator_enable(hdmi.vdda_reg); if (r) return r; @@ -162,7 +147,7 @@ static int hdmi_power_on_core(struct omap_dss_device *dssdev) return 0; err_runtime_get: - regulator_disable(hdmi.vdda_hdmi_dac_reg); + regulator_disable(hdmi.vdda_reg); return r; } @@ -172,7 +157,7 @@ static void hdmi_power_off_core(struct omap_dss_device *dssdev) hdmi.core_enabled = false; hdmi_runtime_put(); - regulator_disable(hdmi.vdda_hdmi_dac_reg); + regulator_disable(hdmi.vdda_reg); } static int hdmi_power_on_full(struct omap_dss_device *dssdev) @@ -217,7 +202,7 @@ static int hdmi_power_on_full(struct omap_dss_device *dssdev) if (r) goto err_phy_pwr; - hdmi4_configure(&hdmi.core, &hdmi.wp, &hdmi.cfg); + hdmi4_configure(hdmi.core, &hdmi.wp, &hdmi.cfg); /* bypass TV gamma table */ dispc_enable_gamma_table(0); @@ -308,7 +293,7 @@ static void hdmi_dump_regs(struct seq_file *s) hdmi_wp_dump(&hdmi.wp, s); hdmi_pll_dump(&hdmi.pll, s); hdmi_phy_dump(&hdmi.phy, s); - hdmi4_core_dump(&hdmi.core, s); + hdmi4_core_dump(hdmi.core, s); hdmi_runtime_put(); mutex_unlock(&hdmi.lock); @@ -323,7 +308,7 @@ static int read_edid(u8 *buf, int len) r = hdmi_runtime_get(); BUG_ON(r); - r = hdmi4_read_edid(&hdmi.core, buf, len); + r = hdmi4_read_edid(hdmi.core, buf, len); hdmi_runtime_put(); mutex_unlock(&hdmi.lock); @@ -678,6 +663,8 @@ static int omapdss_hdmihw_probe(struct platform_device *pdev) int irq; hdmi.pdev = pdev; + hdmi.core = &hdmi4_core; + dev_set_drvdata(&pdev->dev, &hdmi); mutex_init(&hdmi.lock); @@ -699,7 +686,7 @@ static int omapdss_hdmihw_probe(struct platform_device *pdev) if (r) return r; - r = hdmi4_core_init(pdev, &hdmi.core); + r = hdmi4_core_init(pdev, hdmi.core); if (r) return r; diff --git a/drivers/video/fbdev/omap2/dss/hdmi5.c b/drivers/video/fbdev/omap2/dss/hdmi5.c index 32d02ec..83925a9 100644 --- a/drivers/video/fbdev/omap2/dss/hdmi5.c +++ b/drivers/video/fbdev/omap2/dss/hdmi5.c @@ -43,24 +43,8 @@ #include "dss.h" #include "dss_features.h" -static struct { - struct mutex lock; - struct platform_device *pdev; - - struct hdmi_wp_data wp; - struct hdmi_pll_data pll; - struct hdmi_phy_data phy; - struct hdmi_core_data core; - - struct hdmi_config cfg; - - struct clk *sys_clk; - struct regulator *vdda_reg; - - bool core_enabled; - - struct omap_dss_device output; -} hdmi; +static struct omap_hdmi hdmi; +static struct hdmi_core_data hdmi5_core; static int hdmi_runtime_get(void) { @@ -235,7 +219,7 @@ static int hdmi_power_on_full(struct omap_dss_device *dssdev) if (r) goto err_phy_pwr; - hdmi5_configure(&hdmi.core, &hdmi.wp, &hdmi.cfg); + hdmi5_configure(hdmi.core, &hdmi.wp, &hdmi.cfg); /* bypass TV gamma table */ dispc_enable_gamma_table(0); @@ -326,7 +310,7 @@ static void hdmi_dump_regs(struct seq_file *s) hdmi_wp_dump(&hdmi.wp, s); hdmi_pll_dump(&hdmi.pll, s); hdmi_phy_dump(&hdmi.phy, s); - hdmi5_core_dump(&hdmi.core, s); + hdmi5_core_dump(hdmi.core, s); hdmi_runtime_put(); mutex_unlock(&hdmi.lock); @@ -346,7 +330,7 @@ static int read_edid(u8 *buf, int len) /* No-idle mode */ REG_FLD_MOD(hdmi.wp.base, HDMI_WP_SYSCONFIG, 1, 3, 2); - r = hdmi5_read_edid(&hdmi.core, buf, len); + r = hdmi5_read_edid(hdmi.core, buf, len); REG_FLD_MOD(hdmi.wp.base, HDMI_WP_SYSCONFIG, idlemode, 3, 2); @@ -703,6 +687,8 @@ static int omapdss_hdmihw_probe(struct platform_device *pdev) int irq; hdmi.pdev = pdev; + hdmi.core = &hdmi5_core; + dev_set_drvdata(&pdev->dev, &hdmi); mutex_init(&hdmi.lock); @@ -724,7 +710,7 @@ static int omapdss_hdmihw_probe(struct platform_device *pdev) if (r) return r; - r = hdmi5_core_init(pdev, &hdmi.core); + r = hdmi5_core_init(pdev, hdmi.core); if (r) return r;