]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - android-sdk/kernel-video.git/commitdiff
OMAPDSS: HDMI: Add sysfs support to configure quantization range in HDMI
authorArchit Taneja <archit@ti.com>
Fri, 18 May 2012 14:16:13 +0000 (19:46 +0530)
committerArchit Taneja <archit@ti.com>
Thu, 28 Feb 2013 09:50:06 +0000 (15:20 +0530)
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>
Signed-off-by: Ricardo Neri <ricardo.neri@ti.com>
drivers/video/omap2/dss/dss.h
drivers/video/omap2/dss/dss_features.c
drivers/video/omap2/dss/hdmi.c
drivers/video/omap2/dss/hdmi_panel.c
drivers/video/omap2/dss/ti_hdmi.h

index 358556bbc7338e5ee3192eab9704e282c3acaa44..9cd28391b57fe8c95bf355276f4f631e8bac2b20 100644 (file)
@@ -456,6 +456,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 omapdss_hdmi_get_deepcolor(void);
 int omapdss_hdmi_set_deepcolor(struct omap_dss_device *dssdev, int val,
                bool hdmi_restart);
index 5a2957d68b79a271389e4c1da111d882f6c19bc5..a29f40168852c6ddf2110587802eb77d546d15d6 100644 (file)
@@ -828,6 +828,7 @@ static const struct ti_hdmi_ip_ops omap5_hdmi_functions = {
        .read_edid              =       ti_hdmi_5xxx_read_edid,
        .irq_core_handler       =       ti_hdmi_5xxx_core_irq_handler,
        .dump_core              =       ti_hdmi_5xxx_core_dump,
+       .configure_range        =       ti_hdmi_5xxx_configure_range,
 #endif
        .phy_enable             =       ti_hdmi_4xxx_phy_enable,
        .phy_disable            =       ti_hdmi_4xxx_phy_disable,
index dc97672b260241a0a945c6e42af9dd645b0def86..56d704822757323ffb94ae823342f5421f418710 100644 (file)
@@ -693,6 +693,34 @@ int omapdss_hdmi_get_deepcolor(void)
        return hdmi.ip_data.cfg.deep_color;
 }
 
+int omapdss_hdmi_set_range(int range)
+{
+       int r = 0;
+       enum hdmi_range old_range;
+
+       old_range = hdmi.ip_data.cfg.range;
+       hdmi.ip_data.cfg.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.cfg.range = old_range;
+
+       return r;
+}
+
+int omapdss_hdmi_get_range(void)
+{
+       return hdmi.ip_data.cfg.range;
+}
+
 int omapdss_hdmi_display_check_timing(struct omap_dss_device *dssdev,
                                        struct omap_video_timings *timings)
 {
index 1b53fa05c7f8fb9da1187ba606fb05f3f17b72ef..cd1944aa2cc56d7907244893acab4f35ea8836b2 100644 (file)
@@ -79,6 +79,33 @@ static ssize_t hdmi_deepcolor_store(struct device *dev,
 static DEVICE_ATTR(deepcolor, S_IRUGO | S_IWUSR, hdmi_deepcolor_show,
                        hdmi_deepcolor_store);
 
+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)
 {
        /* Initialize default timings to VGA in DVI mode */
@@ -103,6 +130,12 @@ static int hdmi_panel_probe(struct omap_dss_device *dssdev)
 
        dssdev->panel.timings = default_timings;
 
+       /* 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");
+
        /* sysfs entry to provide user space control to set deepcolor mode */
        if (device_create_file(&dssdev->dev, &dev_attr_deepcolor))
                DSSERR("failed to create sysfs file\n");
@@ -119,6 +152,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_deepcolor);
+       device_remove_file(&dssdev->dev, &dev_attr_range);
 }
 
 #if defined(CONFIG_OMAP4_DSS_HDMI_AUDIO) || \
index 7740bfe9be78cb1ffbda06b48b15948d25ae4552..0c0237d4aac23ea970431a1508e9fb61fc646442 100644 (file)
@@ -145,6 +145,7 @@ struct ti_hdmi_ip_ops {
 
        int (*irq_core_handler) (struct hdmi_ip_data *ip_data);
 
+       int (*configure_range)(struct hdmi_ip_data *ip_data);
 };
 
 /*
@@ -243,4 +244,5 @@ void ti_hdmi_5xxx_core_dump(struct hdmi_ip_data *ip_data, struct seq_file *s);
 int ti_hdmi_5xxx_read_edid(struct hdmi_ip_data *ip_data,
                                u8 *edid, int len);
 int ti_hdmi_5xxx_core_irq_handler(struct hdmi_ip_data *ip_data);
+int ti_hdmi_5xxx_configure_range(struct hdmi_ip_data *ip_data);
 #endif