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.c66
1 files changed, 66 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..800f39c3
--- /dev/null
+++ b/drivers/gpu/nvgpu/gp10b/gp10b_sysfs.c
@@ -0,0 +1,66 @@
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 *device,
24 struct device_attribute *attr, const char *buf, size_t count)
25{
26 struct platform_device *ndev = to_platform_device(device);
27 struct gk20a *g = get_gk20a(ndev);
28 u32 ecc_mask;
29 u32 err = 0;
30
31 err = sscanf(buf, "%d", &ecc_mask);
32 if (err == 1) {
33 err = g->ops.pmu.send_lrf_tex_ltc_dram_overide_en_dis_cmd
34 (g, ecc_mask);
35 if (err)
36 dev_err(device, "ECC override did not happen\n");
37 } else
38 return -EINVAL;
39 return count;
40}
41
42static ssize_t ecc_enable_read(struct device *device,
43 struct device_attribute *attr, char *buf)
44{
45 struct platform_device *ndev = to_platform_device(device);
46 struct gk20a *g = get_gk20a(ndev);
47
48 return sprintf(buf, "ecc override =0x%x\n",
49 g->ops.gr.get_lrf_tex_ltc_dram_override(g));
50}
51
52static DEVICE_ATTR(ecc_enable, ROOTRW, ecc_enable_read, ecc_enable_store);
53
54void gp10b_create_sysfs(struct platform_device *dev)
55{
56 int error = 0;
57
58 error |= device_create_file(&dev->dev, &dev_attr_ecc_enable);
59 if (error)
60 dev_err(&dev->dev, "Failed to create sysfs attributes!\n");
61}
62
63void gp10b_remove_sysfs(struct device *dev)
64{
65 device_remove_file(dev, &dev_attr_ecc_enable);
66}