All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 1/3] OMAPDSS: HDMI: Move Avi-infoframe struct to hdmi_ip_data
@ 2012-01-04 11:53 mythripk
  2012-01-04 11:53 ` [PATCH v2 2/3] OMAPDSS: HDMI: Add quantization range support in IP lib mythripk
  0 siblings, 1 reply; 6+ messages in thread
From: mythripk @ 2012-01-04 11:53 UTC (permalink / raw)
  To: tomi.valkeinen, linux-omap; +Cc: Mythri P K

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

With AVI infoframe various parameters of video stream such as
aspect ratio, quantization range, videocode etc will be indicated
from source to sink.Thus AVI information needs to be set/accessed
by the middle ware based on the video content.
Thus this parameter is now moved to the ip_data structure.

Signed-off-by: Mythri P K <mythripk@ti.com>
---
 drivers/video/omap2/dss/ti_hdmi.h         |   42 +++++++++++++++++++++++++++++
 drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c |    8 +++---
 drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h |   40 ---------------------------
 3 files changed, 46 insertions(+), 44 deletions(-)

diff --git a/drivers/video/omap2/dss/ti_hdmi.h b/drivers/video/omap2/dss/ti_hdmi.h
index 3cf5198..835cfb1 100644
--- a/drivers/video/omap2/dss/ti_hdmi.h
+++ b/drivers/video/omap2/dss/ti_hdmi.h
@@ -108,6 +108,47 @@ struct ti_hdmi_ip_ops {
 
 };
 
+/*
+ * Refer to section 8.2 in HDMI 1.3 specification for
+ * details about infoframe databytes
+ */
+struct hdmi_core_infoframe_avi {
+	/* Y0, Y1 rgb,yCbCr */
+	u8	db1_format;
+	/* A0  Active information Present */
+	u8	db1_active_info;
+	/* B0, B1 Bar info data valid */
+	u8	db1_bar_info_dv;
+	/* S0, S1 scan information */
+	u8	db1_scan_info;
+	/* C0, C1 colorimetry */
+	u8	db2_colorimetry;
+	/* M0, M1 Aspect ratio (4:3, 16:9) */
+	u8	db2_aspect_ratio;
+	/* R0...R3 Active format aspect ratio */
+	u8	db2_active_fmt_ar;
+	/* ITC IT content. */
+	u8	db3_itc;
+	/* EC0, EC1, EC2 Extended colorimetry */
+	u8	db3_ec;
+	/* Q1, Q0 Quantization range */
+	u8	db3_q_range;
+	/* SC1, SC0 Non-uniform picture scaling */
+	u8	db3_nup_scaling;
+	/* VIC0..6 Video format identification */
+	u8	db4_videocode;
+	/* PR0..PR3 Pixel repetition factor */
+	u8	db5_pixel_repeat;
+	/* Line number end of top bar */
+	u16	db6_7_line_eoftop;
+	/* Line number start of bottom bar */
+	u16	db8_9_line_sofbottom;
+	/* Pixel number end of left bar */
+	u16	db10_11_pixel_eofleft;
+	/* Pixel number start of right bar */
+	u16	db12_13_pixel_sofright;
+};
+
 struct hdmi_ip_data {
 	void __iomem	*base_wp;	/* HDMI wrapper */
 	unsigned long	core_sys_offset;
@@ -117,6 +158,7 @@ struct hdmi_ip_data {
 	const struct ti_hdmi_ip_ops *ops;
 	struct hdmi_config cfg;
 	struct hdmi_pll_info pll_data;
+	struct hdmi_core_infoframe_avi avi_cfg;
 };
 int ti_hdmi_4xxx_phy_enable(struct hdmi_ip_data *ip_data);
 void ti_hdmi_4xxx_phy_disable(struct hdmi_ip_data *ip_data);
diff --git a/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c b/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c
index ccc6254..b66d82e 100644
--- a/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c
+++ b/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c
@@ -534,12 +534,12 @@ static void hdmi_core_video_config(struct hdmi_ip_data *ip_data,
 			HDMI_CORE_SYS_TMDS_CTRL, cfg->tclk_sel_clkmult, 6, 5);
 }
 
-static void hdmi_core_aux_infoframe_avi_config(struct hdmi_ip_data *ip_data,
-		struct hdmi_core_infoframe_avi info_avi)
+static void hdmi_core_aux_infoframe_avi_config(struct hdmi_ip_data *ip_data)
 {
 	u32 val;
 	char sum = 0, checksum = 0;
 	void __iomem *av_base = hdmi_av_base(ip_data);
+	struct hdmi_core_infoframe_avi info_avi = ip_data->avi_cfg;
 
 	sum += 0x82 + 0x002 + 0x00D;
 	hdmi_write_reg(av_base, HDMI_CORE_AV_AVI_TYPE, 0x082);
@@ -718,7 +718,7 @@ void ti_hdmi_4xxx_basic_configure(struct hdmi_ip_data *ip_data)
 	struct omap_video_timings video_timing;
 	struct hdmi_video_format video_format;
 	/* HDMI core */
-	struct hdmi_core_infoframe_avi avi_cfg;
+	struct hdmi_core_infoframe_avi avi_cfg = ip_data->avi_cfg;
 	struct hdmi_core_video_config v_core_cfg;
 	struct hdmi_core_packet_enable_repeat repeat_cfg;
 	struct hdmi_config *cfg = &ip_data->cfg;
@@ -780,7 +780,7 @@ void ti_hdmi_4xxx_basic_configure(struct hdmi_ip_data *ip_data)
 	avi_cfg.db10_11_pixel_eofleft = 0;
 	avi_cfg.db12_13_pixel_sofright = 0;
 
-	hdmi_core_aux_infoframe_avi_config(ip_data, avi_cfg);
+	hdmi_core_aux_infoframe_avi_config(ip_data);
 
 	/* enable/repeat the infoframe */
 	repeat_cfg.avi_infoframe = HDMI_PACKETENABLE;
diff --git a/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h b/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h
index 914bec6..21f1d82 100644
--- a/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h
+++ b/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h
@@ -450,46 +450,6 @@ struct hdmi_core_video_config {
  * Refer to section 8.2 in HDMI 1.3 specification for
  * details about infoframe databytes
  */
-struct hdmi_core_infoframe_avi {
-	/* Y0, Y1 rgb,yCbCr */
-	u8	db1_format;
-	/* A0  Active information Present */
-	u8	db1_active_info;
-	/* B0, B1 Bar info data valid */
-	u8	db1_bar_info_dv;
-	/* S0, S1 scan information */
-	u8	db1_scan_info;
-	/* C0, C1 colorimetry */
-	u8	db2_colorimetry;
-	/* M0, M1 Aspect ratio (4:3, 16:9) */
-	u8	db2_aspect_ratio;
-	/* R0...R3 Active format aspect ratio */
-	u8	db2_active_fmt_ar;
-	/* ITC IT content. */
-	u8	db3_itc;
-	/* EC0, EC1, EC2 Extended colorimetry */
-	u8	db3_ec;
-	/* Q1, Q0 Quantization range */
-	u8	db3_q_range;
-	/* SC1, SC0 Non-uniform picture scaling */
-	u8	db3_nup_scaling;
-	/* VIC0..6 Video format identification */
-	u8	db4_videocode;
-	/* PR0..PR3 Pixel repetition factor */
-	u8	db5_pixel_repeat;
-	/* Line number end of top bar */
-	u16	db6_7_line_eoftop;
-	/* Line number start of bottom bar */
-	u16	db8_9_line_sofbottom;
-	/* Pixel number end of left bar */
-	u16	db10_11_pixel_eofleft;
-	/* Pixel number start of right bar */
-	u16	db12_13_pixel_sofright;
-};
-/*
- * Refer to section 8.2 in HDMI 1.3 specification for
- * details about infoframe databytes
- */
 struct hdmi_core_infoframe_audio {
 	u8 db1_coding_type;
 	u8 db1_channel_count;
-- 
1.7.5.4


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH v2 2/3] OMAPDSS: HDMI: Add quantization range support in IP lib
  2012-01-04 11:53 [PATCH v2 1/3] OMAPDSS: HDMI: Move Avi-infoframe struct to hdmi_ip_data mythripk
@ 2012-01-04 11:53 ` mythripk
  2012-01-04 11:53   ` [PATCH v2 3/3] OMAPDSS: HDMI: Sysfs support to configure quantization mythripk
  2012-01-05  7:23   ` [PATCH v2 2/3] OMAPDSS: HDMI: Add quantization range support in IP lib Tomi Valkeinen
  0 siblings, 2 replies; 6+ messages in thread
From: mythripk @ 2012-01-04 11:53 UTC (permalink / raw)
  To: tomi.valkeinen, linux-omap; +Cc: Mythri P K

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         |    7 +++++
 drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c |   40 +++++++++++++++++++++++++++++
 2 files changed, 47 insertions(+), 0 deletions(-)

diff --git a/drivers/video/omap2/dss/ti_hdmi.h b/drivers/video/omap2/dss/ti_hdmi.h
index 835cfb1..1b485ee 100644
--- a/drivers/video/omap2/dss/ti_hdmi.h
+++ b/drivers/video/omap2/dss/ti_hdmi.h
@@ -42,6 +42,11 @@ enum hdmi_clk_refsel {
 	HDMI_REFSEL_SYSCLK = 3
 };
 
+enum hdmi_range {
+	HDMI_LIMITED_RANGE = 0,
+	HDMI_FULL_RANGE = 1,
+};
+
 /* HDMI timing structure */
 struct hdmi_video_timings {
 	u16 x_res;
@@ -159,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);
@@ -172,5 +178,6 @@ void ti_hdmi_4xxx_wp_dump(struct hdmi_ip_data *ip_data, struct seq_file *s);
 void ti_hdmi_4xxx_pll_dump(struct hdmi_ip_data *ip_data, struct seq_file *s);
 void ti_hdmi_4xxx_core_dump(struct hdmi_ip_data *ip_data, struct seq_file *s);
 void ti_hdmi_4xxx_phy_dump(struct hdmi_ip_data *ip_data, struct seq_file *s);
+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 b66d82e..a98ce8a 100644
--- a/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c
+++ b/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c
@@ -610,6 +610,46 @@ 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:
+	default:
+		/* 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;
+	}
+	return 0;
+}
+
 static void hdmi_core_av_packet_config(struct hdmi_ip_data *ip_data,
 		struct hdmi_core_packet_enable_repeat repeat_cfg)
 {
-- 
1.7.5.4


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH v2 3/3] OMAPDSS: HDMI: Sysfs support to configure quantization
  2012-01-04 11:53 ` [PATCH v2 2/3] OMAPDSS: HDMI: Add quantization range support in IP lib mythripk
@ 2012-01-04 11:53   ` mythripk
  2012-01-05  7:21     ` Tomi Valkeinen
  2012-01-05  7:23   ` [PATCH v2 2/3] OMAPDSS: HDMI: Add quantization range support in IP lib Tomi Valkeinen
  1 sibling, 1 reply; 6+ messages in thread
From: mythripk @ 2012-01-04 11:53 UTC (permalink / raw)
  To: tomi.valkeinen, linux-omap; +Cc: Mythri P K

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

Add sysfs support for the uset space to configure limited range or full range
quantization for HDMI.

Signed-off-by: Mythri P K <mythripk@ti.com>
---
 drivers/video/omap2/dss/dss.h          |    2 +
 drivers/video/omap2/dss/dss_features.c |    1 +
 drivers/video/omap2/dss/hdmi.c         |   28 +++++++++++++++++++++++++
 drivers/video/omap2/dss/hdmi_panel.c   |   35 +++++++++++++++++++++++++++++++-
 drivers/video/omap2/dss/ti_hdmi.h      |    2 +
 5 files changed, 67 insertions(+), 1 deletions(-)

diff --git a/drivers/video/omap2/dss/dss.h b/drivers/video/omap2/dss/dss.h
index 6308fc5..cf1f0f9 100644
--- a/drivers/video/omap2/dss/dss.h
+++ b/drivers/video/omap2/dss/dss.h
@@ -498,6 +498,8 @@ int omapdss_hdmi_display_check_timing(struct omap_dss_device *dssdev,
 					struct omap_video_timings *timings);
 int omapdss_hdmi_read_edid(u8 *buf, int len);
 bool omapdss_hdmi_detect(void);
+int omapdss_hdmi_get_range(void);
+int omapdss_hdmi_set_range(int range);
 int hdmi_panel_init(void);
 void hdmi_panel_exit(void);
 
diff --git a/drivers/video/omap2/dss/dss_features.c b/drivers/video/omap2/dss/dss_features.c
index b402699..c7e71b9 100644
--- a/drivers/video/omap2/dss/dss_features.c
+++ b/drivers/video/omap2/dss/dss_features.c
@@ -465,6 +465,7 @@ static const struct ti_hdmi_ip_ops omap4_hdmi_functions = {
 	.dump_core		=	ti_hdmi_4xxx_core_dump,
 	.dump_pll		=	ti_hdmi_4xxx_pll_dump,
 	.dump_phy		=	ti_hdmi_4xxx_phy_dump,
+	.configure_range	=	ti_hdmi_4xxx_configure_range,
 
 };
 
diff --git a/drivers/video/omap2/dss/hdmi.c b/drivers/video/omap2/dss/hdmi.c
index 4bb7678..ae7918e 100644
--- a/drivers/video/omap2/dss/hdmi.c
+++ b/drivers/video/omap2/dss/hdmi.c
@@ -378,6 +378,34 @@ static void hdmi_power_off(struct omap_dss_device *dssdev)
 	hdmi_runtime_put();
 }
 
+int omapdss_hdmi_set_range(int range)
+{
+	int r = 0;
+	enum hdmi_range old_range;
+
+	old_range = hdmi.ip_data.range;
+	hdmi.ip_data.range = range;
+
+	/* HDMI 1.3 section 6.6 VGA (640x480) format requires Full Range */
+	if ((range == 0) &&
+		((hdmi.ip_data.cfg.cm.code == 4 &&
+		hdmi.ip_data.cfg.cm.mode == HDMI_DVI) ||
+		(hdmi.ip_data.cfg.cm.code == 1 &&
+		hdmi.ip_data.cfg.cm.mode == HDMI_HDMI)))
+			return -EINVAL;
+
+	r = hdmi.ip_data.ops->configure_range(&hdmi.ip_data);
+	if (r)
+		hdmi.ip_data.range = old_range;
+
+	return r;
+}
+
+int omapdss_hdmi_get_range(void)
+{
+	return hdmi.ip_data.range;
+}
+
 int omapdss_hdmi_display_check_timing(struct omap_dss_device *dssdev,
 					struct omap_video_timings *timings)
 {
diff --git a/drivers/video/omap2/dss/hdmi_panel.c b/drivers/video/omap2/dss/hdmi_panel.c
index 533d5dc..c0aa922 100644
--- a/drivers/video/omap2/dss/hdmi_panel.c
+++ b/drivers/video/omap2/dss/hdmi_panel.c
@@ -33,6 +33,33 @@ static struct {
 	struct mutex hdmi_lock;
 } hdmi;
 
+static ssize_t hdmi_range_show(struct device *dev,
+	struct device_attribute *attr, char *buf)
+{
+	int r;
+
+	r = omapdss_hdmi_get_range();
+	return snprintf(buf, PAGE_SIZE, "%d\n", r);
+}
+
+static ssize_t hdmi_range_store(struct device *dev,
+	struct device_attribute *attr,
+	const char *buf, size_t size)
+{
+	unsigned long range;
+	int r = kstrtoul(buf, 0, &range);
+
+	if (r || range > 1)
+		return -EINVAL;
+
+	r = omapdss_hdmi_set_range(range);
+	if (r)
+		return r;
+
+	return size;
+}
+
+static DEVICE_ATTR(range, S_IRUGO | S_IWUSR, hdmi_range_show, hdmi_range_store);
 
 static int hdmi_panel_probe(struct omap_dss_device *dssdev)
 {
@@ -41,6 +68,12 @@ static int hdmi_panel_probe(struct omap_dss_device *dssdev)
 	dssdev->panel.config = OMAP_DSS_LCD_TFT |
 			OMAP_DSS_LCD_IVS | OMAP_DSS_LCD_IHS;
 
+	/* sysfs entry to provide user space control to set
+	 * quantization range
+	 */
+	if (device_create_file(&dssdev->dev, &dev_attr_range))
+		DSSERR("failed to create sysfs file\n");
+
 	dssdev->panel.timings = (struct omap_video_timings){640, 480, 25175, 96, 16, 48, 2 , 11, 31};
 
 	DSSDBG("hdmi_panel_probe x_res= %d y_res = %d\n",
@@ -51,7 +84,7 @@ static int hdmi_panel_probe(struct omap_dss_device *dssdev)
 
 static void hdmi_panel_remove(struct omap_dss_device *dssdev)
 {
-
+	device_remove_file(&dssdev->dev, &dev_attr_range);
 }
 
 static int hdmi_panel_enable(struct omap_dss_device *dssdev)
diff --git a/drivers/video/omap2/dss/ti_hdmi.h b/drivers/video/omap2/dss/ti_hdmi.h
index 1b485ee..1f15d74 100644
--- a/drivers/video/omap2/dss/ti_hdmi.h
+++ b/drivers/video/omap2/dss/ti_hdmi.h
@@ -111,6 +111,8 @@ struct ti_hdmi_ip_ops {
 
 	void (*dump_phy)(struct hdmi_ip_data *ip_data, struct seq_file *s);
 
+	int (*configure_range)(struct hdmi_ip_data *ip_data);
+
 };
 
 /*
-- 
1.7.5.4


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH v2 3/3] OMAPDSS: HDMI: Sysfs support to configure quantization
  2012-01-04 11:53   ` [PATCH v2 3/3] OMAPDSS: HDMI: Sysfs support to configure quantization mythripk
@ 2012-01-05  7:21     ` Tomi Valkeinen
  2012-01-06 12:53       ` K, Mythri P
  0 siblings, 1 reply; 6+ messages in thread
From: Tomi Valkeinen @ 2012-01-05  7:21 UTC (permalink / raw)
  To: mythripk; +Cc: linux-omap

[-- Attachment #1: Type: text/plain, Size: 4305 bytes --]

On Wed, 2012-01-04 at 17:23 +0530, mythripk@ti.com wrote:
> From: Mythri P K <mythripk@ti.com>
> 
> Add sysfs support for the uset space to configure limited range or full range
> quantization for HDMI.
> 
> Signed-off-by: Mythri P K <mythripk@ti.com>
> ---
>  drivers/video/omap2/dss/dss.h          |    2 +
>  drivers/video/omap2/dss/dss_features.c |    1 +
>  drivers/video/omap2/dss/hdmi.c         |   28 +++++++++++++++++++++++++
>  drivers/video/omap2/dss/hdmi_panel.c   |   35 +++++++++++++++++++++++++++++++-
>  drivers/video/omap2/dss/ti_hdmi.h      |    2 +
>  5 files changed, 67 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/video/omap2/dss/dss.h b/drivers/video/omap2/dss/dss.h
> index 6308fc5..cf1f0f9 100644
> --- a/drivers/video/omap2/dss/dss.h
> +++ b/drivers/video/omap2/dss/dss.h
> @@ -498,6 +498,8 @@ int omapdss_hdmi_display_check_timing(struct omap_dss_device *dssdev,
>  					struct omap_video_timings *timings);
>  int omapdss_hdmi_read_edid(u8 *buf, int len);
>  bool omapdss_hdmi_detect(void);
> +int omapdss_hdmi_get_range(void);
> +int omapdss_hdmi_set_range(int range);
>  int hdmi_panel_init(void);
>  void hdmi_panel_exit(void);
>  
> diff --git a/drivers/video/omap2/dss/dss_features.c b/drivers/video/omap2/dss/dss_features.c
> index b402699..c7e71b9 100644
> --- a/drivers/video/omap2/dss/dss_features.c
> +++ b/drivers/video/omap2/dss/dss_features.c
> @@ -465,6 +465,7 @@ static const struct ti_hdmi_ip_ops omap4_hdmi_functions = {
>  	.dump_core		=	ti_hdmi_4xxx_core_dump,
>  	.dump_pll		=	ti_hdmi_4xxx_pll_dump,
>  	.dump_phy		=	ti_hdmi_4xxx_phy_dump,
> +	.configure_range	=	ti_hdmi_4xxx_configure_range,
>  
>  };
>  
> diff --git a/drivers/video/omap2/dss/hdmi.c b/drivers/video/omap2/dss/hdmi.c
> index 4bb7678..ae7918e 100644
> --- a/drivers/video/omap2/dss/hdmi.c
> +++ b/drivers/video/omap2/dss/hdmi.c
> @@ -378,6 +378,34 @@ static void hdmi_power_off(struct omap_dss_device *dssdev)
>  	hdmi_runtime_put();
>  }
>  
> +int omapdss_hdmi_set_range(int range)

Range is an enum, not an int.

> +{
> +	int r = 0;
> +	enum hdmi_range old_range;
> +
> +	old_range = hdmi.ip_data.range;
> +	hdmi.ip_data.range = range;
> +
> +	/* HDMI 1.3 section 6.6 VGA (640x480) format requires Full Range */
> +	if ((range == 0) &&

Range is an enum, not an int.

> +		((hdmi.ip_data.cfg.cm.code == 4 &&
> +		hdmi.ip_data.cfg.cm.mode == HDMI_DVI) ||
> +		(hdmi.ip_data.cfg.cm.code == 1 &&
> +		hdmi.ip_data.cfg.cm.mode == HDMI_HDMI)))
> +			return -EINVAL;
> +
> +	r = hdmi.ip_data.ops->configure_range(&hdmi.ip_data);
> +	if (r)
> +		hdmi.ip_data.range = old_range;
> +
> +	return r;
> +}
> +
> +int omapdss_hdmi_get_range(void)

Range is an enum, not an int... I won't comment on any more of these
cases, please check all uses of range.

> +{
> +	return hdmi.ip_data.range;
> +}
> +
>  int omapdss_hdmi_display_check_timing(struct omap_dss_device *dssdev,
>  					struct omap_video_timings *timings)
>  {
> diff --git a/drivers/video/omap2/dss/hdmi_panel.c b/drivers/video/omap2/dss/hdmi_panel.c
> index 533d5dc..c0aa922 100644
> --- a/drivers/video/omap2/dss/hdmi_panel.c
> +++ b/drivers/video/omap2/dss/hdmi_panel.c
> @@ -33,6 +33,33 @@ static struct {
>  	struct mutex hdmi_lock;
>  } hdmi;
>  
> +static ssize_t hdmi_range_show(struct device *dev,
> +	struct device_attribute *attr, char *buf)
> +{
> +	int r;
> +
> +	r = omapdss_hdmi_get_range();
> +	return snprintf(buf, PAGE_SIZE, "%d\n", r);
> +}
> +
> +static ssize_t hdmi_range_store(struct device *dev,
> +	struct device_attribute *attr,
> +	const char *buf, size_t size)
> +{
> +	unsigned long range;
> +	int r = kstrtoul(buf, 0, &range);
> +
> +	if (r || range > 1)
> +		return -EINVAL;
> +
> +	r = omapdss_hdmi_set_range(range);
> +	if (r)
> +		return r;
> +
> +	return size;
> +}

I don't like to add a new custom userspace API, but I guess we don't
have much choice.

However, I don't think using 0 and 1 in the API is very good. The
choices with range should probably be "full" and "limited".

Btw, I tried to apply this patch set on top of dss master with and
without the "improve the timings..." patch set, and failed both. What
are these patches based on?

 Tomi


[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2 2/3] OMAPDSS: HDMI: Add quantization range support in IP lib
  2012-01-04 11:53 ` [PATCH v2 2/3] OMAPDSS: HDMI: Add quantization range support in IP lib mythripk
  2012-01-04 11:53   ` [PATCH v2 3/3] OMAPDSS: HDMI: Sysfs support to configure quantization mythripk
@ 2012-01-05  7:23   ` Tomi Valkeinen
  1 sibling, 0 replies; 6+ messages in thread
From: Tomi Valkeinen @ 2012-01-05  7:23 UTC (permalink / raw)
  To: mythripk; +Cc: linux-omap

[-- Attachment #1: Type: text/plain, Size: 3028 bytes --]

On Wed, 2012-01-04 at 17:23 +0530, mythripk@ti.com wrote:
> 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         |    7 +++++
>  drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c |   40 +++++++++++++++++++++++++++++
>  2 files changed, 47 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/video/omap2/dss/ti_hdmi.h b/drivers/video/omap2/dss/ti_hdmi.h
> index 835cfb1..1b485ee 100644
> --- a/drivers/video/omap2/dss/ti_hdmi.h
> +++ b/drivers/video/omap2/dss/ti_hdmi.h
> @@ -42,6 +42,11 @@ enum hdmi_clk_refsel {
>  	HDMI_REFSEL_SYSCLK = 3
>  };
>  
> +enum hdmi_range {
> +	HDMI_LIMITED_RANGE = 0,
> +	HDMI_FULL_RANGE = 1,
> +};
> +
>  /* HDMI timing structure */
>  struct hdmi_video_timings {
>  	u16 x_res;
> @@ -159,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);
> @@ -172,5 +178,6 @@ void ti_hdmi_4xxx_wp_dump(struct hdmi_ip_data *ip_data, struct seq_file *s);
>  void ti_hdmi_4xxx_pll_dump(struct hdmi_ip_data *ip_data, struct seq_file *s);
>  void ti_hdmi_4xxx_core_dump(struct hdmi_ip_data *ip_data, struct seq_file *s);
>  void ti_hdmi_4xxx_phy_dump(struct hdmi_ip_data *ip_data, struct seq_file *s);
> +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 b66d82e..a98ce8a 100644
> --- a/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c
> +++ b/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c
> @@ -610,6 +610,46 @@ 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:
> +	default:

I don't think you should have HDMI_FULL_RANGE and default at the same
case. If the range is not limited or full, the value is illegal and you
should give an error.

 Tomi


[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2 3/3] OMAPDSS: HDMI: Sysfs support to configure quantization
  2012-01-05  7:21     ` Tomi Valkeinen
@ 2012-01-06 12:53       ` K, Mythri P
  0 siblings, 0 replies; 6+ messages in thread
From: K, Mythri P @ 2012-01-06 12:53 UTC (permalink / raw)
  To: Tomi Valkeinen; +Cc: linux-omap

Hi Tomi,


On Thu, Jan 5, 2012 at 12:51 PM, Tomi Valkeinen <tomi.valkeinen@ti.com> wrote:
> On Wed, 2012-01-04 at 17:23 +0530, mythripk@ti.com wrote:
>> From: Mythri P K <mythripk@ti.com>
>>
>> Add sysfs support for the uset space to configure limited range or full range
>> quantization for HDMI.
>>
>> Signed-off-by: Mythri P K <mythripk@ti.com>
>> ---
>>  drivers/video/omap2/dss/dss.h          |    2 +
>>  drivers/video/omap2/dss/dss_features.c |    1 +
>>  drivers/video/omap2/dss/hdmi.c         |   28 +++++++++++++++++++++++++
>>  drivers/video/omap2/dss/hdmi_panel.c   |   35 +++++++++++++++++++++++++++++++-
>>  drivers/video/omap2/dss/ti_hdmi.h      |    2 +
>>  5 files changed, 67 insertions(+), 1 deletions(-)
>>
>> diff --git a/drivers/video/omap2/dss/dss.h b/drivers/video/omap2/dss/dss.h
>> index 6308fc5..cf1f0f9 100644
>> --- a/drivers/video/omap2/dss/dss.h
>> +++ b/drivers/video/omap2/dss/dss.h
>> @@ -498,6 +498,8 @@ int omapdss_hdmi_display_check_timing(struct omap_dss_device *dssdev,
>>                                       struct omap_video_timings *timings);
>>  int omapdss_hdmi_read_edid(u8 *buf, int len);
>>  bool omapdss_hdmi_detect(void);
>> +int omapdss_hdmi_get_range(void);
>> +int omapdss_hdmi_set_range(int range);
>>  int hdmi_panel_init(void);
>>  void hdmi_panel_exit(void);
>>
>> diff --git a/drivers/video/omap2/dss/dss_features.c b/drivers/video/omap2/dss/dss_features.c
>> index b402699..c7e71b9 100644
>> --- a/drivers/video/omap2/dss/dss_features.c
>> +++ b/drivers/video/omap2/dss/dss_features.c
>> @@ -465,6 +465,7 @@ static const struct ti_hdmi_ip_ops omap4_hdmi_functions = {
>>       .dump_core              =       ti_hdmi_4xxx_core_dump,
>>       .dump_pll               =       ti_hdmi_4xxx_pll_dump,
>>       .dump_phy               =       ti_hdmi_4xxx_phy_dump,
>> +     .configure_range        =       ti_hdmi_4xxx_configure_range,
>>
>>  };
>>
>> diff --git a/drivers/video/omap2/dss/hdmi.c b/drivers/video/omap2/dss/hdmi.c
>> index 4bb7678..ae7918e 100644
>> --- a/drivers/video/omap2/dss/hdmi.c
>> +++ b/drivers/video/omap2/dss/hdmi.c
>> @@ -378,6 +378,34 @@ static void hdmi_power_off(struct omap_dss_device *dssdev)
>>       hdmi_runtime_put();
>>  }
>>
>> +int omapdss_hdmi_set_range(int range)
>
> Range is an enum, not an int.
>
>> +{
>> +     int r = 0;
>> +     enum hdmi_range old_range;
>> +
>> +     old_range = hdmi.ip_data.range;
>> +     hdmi.ip_data.range = range;
>> +
>> +     /* HDMI 1.3 section 6.6 VGA (640x480) format requires Full Range */
>> +     if ((range == 0) &&
>
> Range is an enum, not an int.
>
>> +             ((hdmi.ip_data.cfg.cm.code == 4 &&
>> +             hdmi.ip_data.cfg.cm.mode == HDMI_DVI) ||
>> +             (hdmi.ip_data.cfg.cm.code == 1 &&
>> +             hdmi.ip_data.cfg.cm.mode == HDMI_HDMI)))
>> +                     return -EINVAL;
>> +
>> +     r = hdmi.ip_data.ops->configure_range(&hdmi.ip_data);
>> +     if (r)
>> +             hdmi.ip_data.range = old_range;
>> +
>> +     return r;
>> +}
>> +
>> +int omapdss_hdmi_get_range(void)
>
> Range is an enum, not an int... I won't comment on any more of these
> cases, please check all uses of range.
>
>> +{
>> +     return hdmi.ip_data.range;
>> +}
>> +
>>  int omapdss_hdmi_display_check_timing(struct omap_dss_device *dssdev,
>>                                       struct omap_video_timings *timings)
>>  {
>> diff --git a/drivers/video/omap2/dss/hdmi_panel.c b/drivers/video/omap2/dss/hdmi_panel.c
>> index 533d5dc..c0aa922 100644
>> --- a/drivers/video/omap2/dss/hdmi_panel.c
>> +++ b/drivers/video/omap2/dss/hdmi_panel.c
>> @@ -33,6 +33,33 @@ static struct {
>>       struct mutex hdmi_lock;
>>  } hdmi;
>>
>> +static ssize_t hdmi_range_show(struct device *dev,
>> +     struct device_attribute *attr, char *buf)
>> +{
>> +     int r;
>> +
>> +     r = omapdss_hdmi_get_range();
>> +     return snprintf(buf, PAGE_SIZE, "%d\n", r);
>> +}
>> +
>> +static ssize_t hdmi_range_store(struct device *dev,
>> +     struct device_attribute *attr,
>> +     const char *buf, size_t size)
>> +{
>> +     unsigned long range;
>> +     int r = kstrtoul(buf, 0, &range);
>> +
>> +     if (r || range > 1)
>> +             return -EINVAL;
>> +
>> +     r = omapdss_hdmi_set_range(range);
>> +     if (r)
>> +             return r;
>> +
>> +     return size;
>> +}
>
> I don't like to add a new custom userspace API, but I guess we don't
> have much choice.
>
> However, I don't think using 0 and 1 in the API is very good. The
> choices with range should probably be "full" and "limited".
>
> Btw, I tried to apply this patch set on top of dss master with and
> without the "improve the timings..." patch set, and failed both. What
> are these patches based on?
>
changes incorporated.
Thanks and regards,
Mythri.
>  Tomi
>
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2012-01-06 12:54 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-04 11:53 [PATCH v2 1/3] OMAPDSS: HDMI: Move Avi-infoframe struct to hdmi_ip_data mythripk
2012-01-04 11:53 ` [PATCH v2 2/3] OMAPDSS: HDMI: Add quantization range support in IP lib mythripk
2012-01-04 11:53   ` [PATCH v2 3/3] OMAPDSS: HDMI: Sysfs support to configure quantization mythripk
2012-01-05  7:21     ` Tomi Valkeinen
2012-01-06 12:53       ` K, Mythri P
2012-01-05  7:23   ` [PATCH v2 2/3] OMAPDSS: HDMI: Add quantization range support in IP lib Tomi Valkeinen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.