From 5cac5aee18568579931267d3211371a176efa476 Mon Sep 17 00:00:00 2001 From: Archit Taneja Date: Tue, 8 Oct 2013 13:07:00 +0530 Subject: [PATCH] omapdss: HDMI: create a PHY library HDMI PHY 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 function pointer calls. Add the PHY library function declarations to ti_hdmi.h. These will be shared amongst the omap4/5 hdmi platform drivers. Remove the PHY function pointer ops from the ti_hdmi_ip_ops struct. The DT/hwmod information for hdmi doesn't split the address space according to the required sub blocks. Keep the address offset and size information in the driver for now. This will be removed when the driver gets the information correctly from DT/hwmod. Signed-off-by: Archit Taneja Signed-off-by: Tomi Valkeinen --- drivers/video/omap2/dss/Makefile | 3 +- drivers/video/omap2/dss/dss_features.c | 3 - drivers/video/omap2/dss/hdmi.c | 19 +-- drivers/video/omap2/dss/hdmi_phy.c | 194 ++++++++++++++++++++++ drivers/video/omap2/dss/ti_hdmi.h | 26 +-- drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c | 109 ------------ 6 files changed, 219 insertions(+), 135 deletions(-) create mode 100644 drivers/video/omap2/dss/hdmi_phy.c diff --git a/drivers/video/omap2/dss/Makefile b/drivers/video/omap2/dss/Makefile index 5ea65d327cfb..d88e93870e15 100644 --- a/drivers/video/omap2/dss/Makefile +++ b/drivers/video/omap2/dss/Makefile @@ -10,5 +10,6 @@ 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 hdmi_wp.o hdmi_pll.o ti_hdmi_4xxx_ip.o +omapdss-$(CONFIG_OMAP4_DSS_HDMI) += hdmi.o hdmi_wp.o hdmi_pll.o hdmi_phy.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 9ee92e90caff..2777eb6d603b 100644 --- a/drivers/video/omap2/dss/dss_features.c +++ b/drivers/video/omap2/dss/dss_features.c @@ -794,11 +794,8 @@ static const struct omap_dss_features omap5_dss_features = { static const struct ti_hdmi_ip_ops omap4_hdmi_functions = { .video_configure = ti_hdmi_4xxx_basic_configure, - .phy_enable = ti_hdmi_4xxx_phy_enable, - .phy_disable = ti_hdmi_4xxx_phy_disable, .read_edid = ti_hdmi_4xxx_read_edid, .dump_core = ti_hdmi_4xxx_core_dump, - .dump_phy = ti_hdmi_4xxx_phy_dump, #if defined(CONFIG_OMAP4_DSS_HDMI_AUDIO) .audio_start = ti_hdmi_4xxx_audio_start, .audio_stop = ti_hdmi_4xxx_audio_stop, diff --git a/drivers/video/omap2/dss/hdmi.c b/drivers/video/omap2/dss/hdmi.c index f6a2eba244e7..f7e2ac6861b6 100644 --- a/drivers/video/omap2/dss/hdmi.c +++ b/drivers/video/omap2/dss/hdmi.c @@ -42,7 +42,6 @@ #define HDMI_CORE_SYS 0x400 #define HDMI_CORE_AV 0x900 -#define HDMI_PHY 0x300 /* HDMI EDID Length move this */ #define HDMI_EDID_MAX_LENGTH 256 @@ -487,7 +486,8 @@ static int hdmi_power_on_full(struct omap_dss_device *dssdev) goto err_pll_enable; } - r = hdmi.ip_data.ops->phy_enable(&hdmi.ip_data); + r = hdmi_phy_enable(&hdmi.ip_data.phy, &hdmi.ip_data.wp, + &hdmi.ip_data.cfg); if (r) { DSSDBG("Failed to start PHY\n"); goto err_phy_enable; @@ -514,7 +514,7 @@ static int hdmi_power_on_full(struct omap_dss_device *dssdev) err_mgr_enable: hdmi_wp_video_stop(&hdmi.ip_data.wp); err_vid_enable: - hdmi.ip_data.ops->phy_disable(&hdmi.ip_data); + hdmi_phy_disable(&hdmi.ip_data.phy, &hdmi.ip_data.wp); err_phy_enable: hdmi_pll_disable(&hdmi.ip_data.pll, &hdmi.ip_data.wp); err_pll_enable: @@ -529,7 +529,7 @@ static void hdmi_power_off_full(struct omap_dss_device *dssdev) dss_mgr_disable(mgr); hdmi_wp_video_stop(&hdmi.ip_data.wp); - hdmi.ip_data.ops->phy_disable(&hdmi.ip_data); + hdmi_phy_disable(&hdmi.ip_data.phy, &hdmi.ip_data.wp); hdmi_pll_disable(&hdmi.ip_data.pll, &hdmi.ip_data.wp); hdmi_power_off_core(dssdev); @@ -593,7 +593,7 @@ static void hdmi_dump_regs(struct seq_file *s) hdmi_wp_dump(&hdmi.ip_data.wp, s); hdmi_pll_dump(&hdmi.ip_data.pll, s); - hdmi.ip_data.ops->dump_phy(&hdmi.ip_data, s); + hdmi_phy_dump(&hdmi.ip_data.phy, s); hdmi.ip_data.ops->dump_core(&hdmi.ip_data, s); hdmi_runtime_put(); @@ -1049,11 +1049,9 @@ static int omapdss_hdmihw_probe(struct platform_device *pdev) if (r) return r; - hdmi.ip_data.irq = platform_get_irq(pdev, 0); - if (hdmi.ip_data.irq < 0) { - DSSERR("platform_get_irq failed\n"); - return -ENODEV; - } + r = hdmi_phy_init(pdev, &hdmi.ip_data.phy); + if (r) + return r; r = hdmi_get_clocks(pdev); if (r) { @@ -1065,7 +1063,6 @@ static int omapdss_hdmihw_probe(struct platform_device *pdev) hdmi.ip_data.core_sys_offset = HDMI_CORE_SYS; hdmi.ip_data.core_av_offset = HDMI_CORE_AV; - hdmi.ip_data.phy_offset = HDMI_PHY; hdmi_init_output(pdev); diff --git a/drivers/video/omap2/dss/hdmi_phy.c b/drivers/video/omap2/dss/hdmi_phy.c new file mode 100644 index 000000000000..48bdba8d7031 --- /dev/null +++ b/drivers/video/omap2/dss/hdmi_phy.c @@ -0,0 +1,194 @@ +/* + * HDMI PHY + * + * 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