]> rtime.felk.cvut.cz Git - sojka/nv-tegra/linux-3.10.git/commitdiff
video: tegra: host: Expose policies in sysfs
authorArto Merilainen <amerilainen@nvidia.com>
Sun, 16 Nov 2014 16:22:37 +0000 (18:22 +0200)
committerArto Merilainen <amerilainen@nvidia.com>
Tue, 18 Nov 2014 09:17:54 +0000 (01:17 -0800)
This patch adds support to expose current syncpoint and channel
policies through sysfs.

Bug 200039324
Bug 200041935

Change-Id: Ife2205d59a80835a934433a3e1f293d325780538
Signed-off-by: Arto Merilainen <amerilainen@nvidia.com>
Reviewed-on: http://git-master/r/603852
Reviewed-by: Automatic_Commit_Validation_User
drivers/video/tegra/host/host1x/host1x.c

index 72bccda9d257dd1b33a761c25680691a329651d9..28d27b80fca3c4879e9f8cf68f48e6ad9f384ba7 100644 (file)
@@ -64,6 +64,8 @@
 static const char *num_syncpts_name = "num_pts";
 static const char *num_mutexes_name = "num_mlocks";
 static const char *gather_filter_enabled_name = "gather_filter_enabled";
+static const char *alloc_syncpts_per_apps_name = "alloc_syncpts_per_apps";
+static const char *alloc_chs_per_submits_name = "alloc_chs_per_submits";
 
 struct nvhost_master *nvhost;
 
@@ -530,6 +532,18 @@ int nvhost_gather_filter_enabled(struct nvhost_syncpt *sp)
        return 0;
 }
 
+int alloc_syncpts_per_apps(struct nvhost_syncpt *sp)
+{
+       struct nvhost_master *host = syncpt_to_dev(sp);
+       return host->info.syncpt_policy == SYNCPT_PER_CHANNEL_INSTANCE;
+}
+
+int alloc_chs_per_submits(struct nvhost_syncpt *sp)
+{
+       struct nvhost_master *host = syncpt_to_dev(sp);
+       return host->info.channel_policy == MAP_CHANNEL_ON_SUBMIT;
+}
+
 static ssize_t nvhost_syncpt_capability_show(struct kobject *kobj,
                struct kobj_attribute *attr, char *buf)
 {
@@ -604,7 +618,7 @@ static int nvhost_user_init(struct nvhost_master *host)
        }
 
        host->caps_nodes = devm_kzalloc(&host->dev->dev,
-                       sizeof(struct nvhost_capability_node) * 3, GFP_KERNEL);
+                       sizeof(struct nvhost_capability_node) * 5, GFP_KERNEL);
        if (!host->caps_nodes) {
                err = -ENOMEM;
                goto fail;
@@ -637,6 +651,20 @@ static int nvhost_user_init(struct nvhost_master *host)
                goto fail;
        }
 
+       if (nvhost_set_sysfs_capability_node(host,
+               alloc_chs_per_submits_name, host->caps_nodes + 3,
+               alloc_chs_per_submits, NULL)) {
+               err = -EIO;
+               goto fail;
+       }
+
+       if (nvhost_set_sysfs_capability_node(host,
+               alloc_syncpts_per_apps_name, host->caps_nodes + 4,
+               alloc_syncpts_per_apps, NULL)) {
+               err = -EIO;
+               goto fail;
+       }
+
        return 0;
 fail:
        return err;