linux-omap.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: <mythripk@ti.com>
To: linux-omap@vger.kernel.org
Cc: tomi.valkeinen@ti.com, Mythri P K <mythripk@ti.com>
Subject: [PATCH v4 2/3] OMAPDSS: HDMI: Add quantization range support in IP lib
Date: Wed, 8 Feb 2012 11:54:20 +0530	[thread overview]
Message-ID: <1328682261-22493-2-git-send-email-mythripk@ti.com> (raw)
In-Reply-To: <1328682261-22493-1-git-send-email-mythripk@ti.com>

From: Mythri P K <mythripk@ti.com>

Configure the IP to support the limited range and full range quantization
mode. If the full range is configured HDMI transmitter will expand the range
of pixel data from 16-235 to full 8 bit 0-235.

Signed-off-by: Mythri P K <mythripk@ti.com>
---
 drivers/video/omap2/dss/ti_hdmi.h         |    2 +
 drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c |   41 +++++++++++++++++++++++++++++
 include/video/omapdss.h                   |    5 +++
 3 files changed, 48 insertions(+), 0 deletions(-)

diff --git a/drivers/video/omap2/dss/ti_hdmi.h b/drivers/video/omap2/dss/ti_hdmi.h
index 46e776c..ab0f2c2 100644
--- a/drivers/video/omap2/dss/ti_hdmi.h
+++ b/drivers/video/omap2/dss/ti_hdmi.h
@@ -164,6 +164,7 @@ struct hdmi_ip_data {
 	struct hdmi_config cfg;
 	struct hdmi_pll_info pll_data;
 	struct hdmi_core_infoframe_avi avi_cfg;
+	enum hdmi_range range;
 };
 int ti_hdmi_4xxx_phy_enable(struct hdmi_ip_data *ip_data);
 void ti_hdmi_4xxx_phy_disable(struct hdmi_ip_data *ip_data);
@@ -181,4 +182,5 @@ void ti_hdmi_4xxx_phy_dump(struct hdmi_ip_data *ip_data, struct seq_file *s);
 	defined(CONFIG_SND_OMAP_SOC_OMAP4_HDMI_MODULE)
 void ti_hdmi_4xxx_wp_audio_enable(struct hdmi_ip_data *ip_data, bool enable);
 #endif
+int ti_hdmi_4xxx_configure_range(struct hdmi_ip_data *ip_data);
 #endif
diff --git a/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c b/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c
index 6f93271..b0a9573 100644
--- a/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c
+++ b/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c
@@ -610,6 +610,47 @@ static void hdmi_core_aux_infoframe_avi_config(struct hdmi_ip_data *ip_data)
 	hdmi_write_reg(av_base, HDMI_CORE_AV_AVI_CHSUM, checksum);
 }
 
+int ti_hdmi_4xxx_configure_range(struct hdmi_ip_data *ip_data)
+{
+	int var;
+
+	switch (ip_data->range) {
+	/*
+	 * Setting the AVI infroframe to respective limited range
+	 * 0 if limited range 1 if full range
+	 */
+	case HDMI_LIMITED_RANGE:
+		ip_data->avi_cfg.db3_q_range = HDMI_INFOFRAME_AVI_DB3Q_LR;
+		hdmi_core_aux_infoframe_avi_config(ip_data);
+		var = hdmi_read_reg(hdmi_core_sys_base(ip_data),
+						HDMI_CORE_SYS_VID_ACEN);
+		var = FLD_MOD(var, 1, 1, 1);
+		hdmi_write_reg(hdmi_core_sys_base(ip_data),
+						HDMI_CORE_SYS_VID_ACEN, var);
+		break;
+	case HDMI_FULL_RANGE:
+		/* HDMI 1.3 section 6.6 YCBCR components shall
+		 * always be Limited Range
+		 */
+		if (ip_data->avi_cfg.db1_format ==
+					HDMI_INFOFRAME_AVI_DB1Y_YUV422) {
+			pr_err("Only limited range is supported for YUV");
+			return -EINVAL;
+		}
+		ip_data->avi_cfg.db3_q_range = HDMI_INFOFRAME_AVI_DB3Q_FR;
+		hdmi_core_aux_infoframe_avi_config(ip_data);
+			var = hdmi_read_reg(hdmi_core_sys_base(ip_data),
+						HDMI_CORE_SYS_VID_MODE);
+			var = FLD_MOD(var, 1, 4, 4);
+			hdmi_write_reg(hdmi_core_sys_base(ip_data),
+						HDMI_CORE_SYS_VID_MODE, var);
+		break;
+	default:
+		return -EINVAL;
+	}
+	return 0;
+}
+
 static void hdmi_core_av_packet_config(struct hdmi_ip_data *ip_data,
 		struct hdmi_core_packet_enable_repeat repeat_cfg)
 {
diff --git a/include/video/omapdss.h b/include/video/omapdss.h
index 062b3b2..29f4e78 100644
--- a/include/video/omapdss.h
+++ b/include/video/omapdss.h
@@ -204,6 +204,11 @@ enum omap_hdmi_flags {
 	OMAP_HDMI_SDA_SCL_EXTERNAL_PULLUP = 1 << 0,
 };
 
+enum hdmi_range {
+	HDMI_LIMITED_RANGE = 0,
+	HDMI_FULL_RANGE = 1,
+};
+
 /* RFBI */
 
 struct rfbi_timings {
-- 
1.7.5.4


  reply	other threads:[~2012-02-08  6:31 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-08  6:24 [PATCH v4 1/3] OMAPDSS: HDMI: Move Avi-infoframe struct to hdmi_ip_data mythripk
2012-02-08  6:24 ` mythripk [this message]
2012-02-08  6:24   ` [PATCH v4 3/3] OMAPDSS: HDMI: Sysfs support to configure quantization mythripk
2012-02-14 12:22     ` Tomi Valkeinen
2012-03-09 10:47       ` K, Mythri P
2012-03-09 12:26         ` Tomi Valkeinen
2012-02-14 12:30 ` [PATCH v4 1/3] OMAPDSS: HDMI: Move Avi-infoframe struct to hdmi_ip_data Tomi Valkeinen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1328682261-22493-2-git-send-email-mythripk@ti.com \
    --to=mythripk@ti.com \
    --cc=linux-omap@vger.kernel.org \
    --cc=tomi.valkeinen@ti.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).