X-Git-Url: https://git.openpandora.org/cgi-bin/gitweb.cgi?p=pandora-kernel.git;a=blobdiff_plain;f=drivers%2Fvideo%2Fomap2%2Fdss%2Fdisplay.c;h=8822113b3bf4954af6f2f04abe24a96c43b68931;hp=be331dc5a61bc04404f607c202315a26c668e50f;hb=f2d9dd510a3f807469835126aab619747d66c86c;hpb=40c043b077c6e377c8440d71563c055d0c4f0f0a diff --git a/drivers/video/omap2/dss/display.c b/drivers/video/omap2/dss/display.c index be331dc5a61b..8822113b3bf4 100644 --- a/drivers/video/omap2/dss/display.c +++ b/drivers/video/omap2/dss/display.c @@ -248,6 +248,44 @@ static ssize_t display_wss_store(struct device *dev, return size; } +#include + +static ssize_t display_dss_gamma_store(struct device *dev, + struct device_attribute *attr, const char *buf, size_t size) +{ + struct omap_dss_device *dssdev = to_dss_device(dev); + unsigned int table[256]; + char *end = NULL; + int i, ret; + + for (i = 0; i < 256; ) { + table[i++] = simple_strtoul(buf, &end, 0); + while (isspace(*end)) + end++; + if (*end == 0) + break; + buf = end; + } + + ret = dispc_runtime_get(); + if (ret < 0) + return ret; + + if (i == 1 && table[0] == 0) + dispc_set_gamma_table(NULL, 0); + else if (i < 256) { + dev_err(dev, "not enough gamma values supplied (%d)\n", i); + dispc_set_gamma_table(NULL, 0); + } else + dispc_set_gamma_table(table, 256 * 4); + + dispc_mgr_go(dssdev->manager->id); + + dispc_runtime_put(); + + return size; +} + static DEVICE_ATTR(enabled, S_IRUGO|S_IWUSR, display_enabled_show, display_enabled_store); static DEVICE_ATTR(tear_elim, S_IRUGO|S_IWUSR, @@ -260,6 +298,8 @@ static DEVICE_ATTR(mirror, S_IRUGO|S_IWUSR, display_mirror_show, display_mirror_store); static DEVICE_ATTR(wss, S_IRUGO|S_IWUSR, display_wss_show, display_wss_store); +static DEVICE_ATTR(dss_gamma, S_IRUGO|S_IWUSR, + NULL, display_dss_gamma_store); static struct device_attribute *display_sysfs_attrs[] = { &dev_attr_enabled, @@ -318,6 +358,13 @@ int omapdss_default_get_recommended_bpp(struct omap_dss_device *dssdev) } EXPORT_SYMBOL(omapdss_default_get_recommended_bpp); +void omapdss_default_get_timings(struct omap_dss_device *dssdev, + struct omap_video_timings *timings) +{ + *timings = dssdev->panel.timings; +} +EXPORT_SYMBOL(omapdss_default_get_timings); + /* Checks if replication logic should be used. Only use for active matrix, * when overlay is in RGB12U or RGB16 mode, and LCD interface is * 18bpp or 24bpp */ @@ -410,6 +457,12 @@ void dss_init_device(struct platform_device *pdev, DSSERR("failed to create sysfs file\n"); } + if (dssdev->channel == OMAP_DSS_CHANNEL_LCD) { + r = device_create_file(&dssdev->dev, &dev_attr_dss_gamma); + if (r) + DSSERR("failed to create sysfs file\n"); + } + /* create display? sysfs links */ r = sysfs_create_link(&pdev->dev.kobj, &dssdev->dev.kobj, dev_name(&dssdev->dev));