summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/gp10b/gp10b_sysfs.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/nvgpu/gp10b/gp10b_sysfs.c')
-rw-r--r--drivers/gpu/nvgpu/gp10b/gp10b_sysfs.c64
1 files changed, 64 insertions, 0 deletions
diff --git a/drivers/gpu/nvgpu/gp10b/gp10b_sysfs.c b/drivers/gpu/nvgpu/gp10b/gp10b_sysfs.c
new file mode 100644
index 00000000..5035bb99
--- /dev/null
+++ b/drivers/gpu/nvgpu/gp10b/gp10b_sysfs.c
@@ -0,0 +1,64 @@
1/*
2 * GP10B specific sysfs files
3 *
4 * Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved.
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms and conditions of the GNU General Public License,
8 * version 2, as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13 * more details.
14 */
15
16#include <linux/platform_device.h>
17
18#include "gk20a/gk20a.h"
19#include "gp10b_sysfs.h"
20
21#define ROOTRW (S_IRWXU|S_IRGRP|S_IROTH)
22
23static ssize_t ecc_enable_store(struct device *dev,
24 struct device_attribute *attr, const char *buf, size_t count)
25{
26 struct gk20a *g = get_gk20a(dev);
27 u32 ecc_mask;
28 u32 err = 0;
29
30 err = sscanf(buf, "%d", &ecc_mask);
31 if (err == 1) {
32 err = g->ops.pmu.send_lrf_tex_ltc_dram_overide_en_dis_cmd
33 (g, ecc_mask);
34 if (err)
35 dev_err(dev, "ECC override did not happen\n");
36 } else
37 return -EINVAL;
38 return count;
39}
40
41static ssize_t ecc_enable_read(struct device *dev,
42 struct device_attribute *attr, char *buf)
43{
44 struct gk20a *g = get_gk20a(dev);
45
46 return sprintf(buf, "ecc override =0x%x\n",
47 g->ops.gr.get_lrf_tex_ltc_dram_override(g));
48}
49
50static DEVICE_ATTR(ecc_enable, ROOTRW, ecc_enable_read, ecc_enable_store);
51
52void gp10b_create_sysfs(struct device *dev)
53{
54 int error = 0;
55
56 error |= device_create_file(dev, &dev_attr_ecc_enable);
57 if (error)
58 dev_err(dev, "Failed to create sysfs attributes!\n");
59}
60
61void gp10b_remove_sysfs(struct device *dev)
62{
63 device_remove_file(dev, &dev_attr_ecc_enable);
64}