summaryrefslogtreecommitdiff
path: root/drivers/video/tegra/dc/dc_sysfs.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/video/tegra/dc/dc_sysfs.c')
-rw-r--r--drivers/video/tegra/dc/dc_sysfs.c63
1 files changed, 54 insertions, 9 deletions
diff --git a/drivers/video/tegra/dc/dc_sysfs.c b/drivers/video/tegra/dc/dc_sysfs.c
index 184353d43324..36294c60907f 100644
--- a/drivers/video/tegra/dc/dc_sysfs.c
+++ b/drivers/video/tegra/dc/dc_sysfs.c
@@ -124,6 +124,53 @@ static ssize_t enable_store(struct device *dev,
static DEVICE_ATTR(enable, S_IRUGO|S_IWUSR, enable_show, enable_store);
+static ssize_t crc_checksum_latched_show(struct device *device,
+ struct device_attribute *attr, char *buf)
+{
+ struct nvhost_device *ndev = to_nvhost_device(device);
+ struct tegra_dc *dc = nvhost_get_drvdata(ndev);
+
+ u32 crc;
+
+ if (!dc->enabled) {
+ dev_err(&dc->ndev->dev, "Failed to get dc.\n");
+ return -EFAULT;
+ }
+
+ crc = tegra_dc_read_checksum_latched(dc);
+
+ return snprintf(buf, PAGE_SIZE, "%u", crc);
+}
+
+static ssize_t crc_checksum_latched_store(struct device *dev,
+ struct device_attribute *attr, const char *buf, size_t count)
+{
+ struct nvhost_device *ndev = to_nvhost_device(dev);
+ struct tegra_dc *dc = nvhost_get_drvdata(ndev);
+ unsigned long val = 0;
+
+ if (!dc->enabled) {
+ dev_err(&dc->ndev->dev, "Failed to get dc.\n");
+ return -EFAULT;
+ }
+
+ if (strict_strtoul(buf, 10, &val) < 0)
+ return -EINVAL;
+
+ if (val == 1) {
+ tegra_dc_enable_crc(dc);
+ dev_err(&dc->ndev->dev, "crc is enabled.\n");
+ } else if (val == 0) {
+ tegra_dc_disable_crc(dc);
+ dev_err(&dc->ndev->dev, "crc is disabled.\n");
+ } else
+ dev_err(&dc->ndev->dev, "Invalid input.\n");
+
+ return count;
+}
+static DEVICE_ATTR(crc_checksum_latched, S_IRUGO|S_IWUSR|S_IWGRP,
+ crc_checksum_latched_show, crc_checksum_latched_store);
+
#define ORIENTATION_PORTRAIT "portrait"
#define ORIENTATION_LANDSCAPE "landscape"
@@ -235,18 +282,18 @@ void __devexit tegra_dc_remove_sysfs(struct device *dev)
struct tegra_dc *dc = nvhost_get_drvdata(ndev);
struct tegra_dc_sd_settings *sd_settings = dc->out->sd_settings;
- device_remove_file(dev, &dev_attr_stats_enable);
device_remove_file(dev, &dev_attr_mode);
device_remove_file(dev, &dev_attr_enable);
+ device_remove_file(dev, &dev_attr_stats_enable);
+ device_remove_file(dev, &dev_attr_crc_checksum_latched);
if (dc->out->stereo) {
device_remove_file(dev, &dev_attr_stereo_orientation);
device_remove_file(dev, &dev_attr_stereo_mode);
}
- if(sd_settings) {
+ if (sd_settings)
nvsd_remove_sysfs(dev);
- }
}
void tegra_dc_create_sysfs(struct device *dev)
@@ -259,18 +306,16 @@ void tegra_dc_create_sysfs(struct device *dev)
error |= device_create_file(dev, &dev_attr_mode);
error |= device_create_file(dev, &dev_attr_enable);
error |= device_create_file(dev, &dev_attr_stats_enable);
+ error |= device_create_file(dev, &dev_attr_crc_checksum_latched);
if (dc->out->stereo) {
error |= device_create_file(dev, &dev_attr_stereo_orientation);
error |= device_create_file(dev, &dev_attr_stereo_mode);
}
- if(sd_settings) {
+ if (sd_settings)
error |= nvsd_create_sysfs(dev);
- }
- if(error) {
- printk("Failed to create sysfs attributes!\n");
- }
+ if (error)
+ dev_err(&ndev->dev, "Failed to create sysfs attributes!\n");
}
-