From 640d0e2c3b58294cd11f420a5fc8377d490c43d3 Mon Sep 17 00:00:00 2001 From: Supriya Date: Thu, 10 Dec 2015 12:54:38 +0530 Subject: gpu: nvgpu: ECC override -sysfs functions to call into LS PMU and modify ECC overide register Bug 1699676 Change-Id: Iaf6cc3a86160b806e52ab168577caad42b2c5d22 Signed-off-by: Supriya Reviewed-on: http://git-master/r/921252 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Vijayakumar Subbu GVS: Gerrit_Virtual_Submit Reviewed-by: Terje Bergstrom Tested-by: Terje Bergstrom --- drivers/gpu/nvgpu/gp10b/gp10b_sysfs.c | 66 +++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 drivers/gpu/nvgpu/gp10b/gp10b_sysfs.c (limited to 'drivers/gpu/nvgpu/gp10b/gp10b_sysfs.c') 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 @@ +/* + * GP10B specific sysfs files + * + * Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms and conditions of the GNU General Public License, + * version 2, as published by the Free Software Foundation. + * + * This program is distributed in the hope it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + */ + +#include + +#include "gk20a/gk20a.h" +#include "gp10b_sysfs.h" + +#define ROOTRW (S_IRWXU|S_IRGRP|S_IROTH) + +static ssize_t ecc_enable_store(struct device *device, + struct device_attribute *attr, const char *buf, size_t count) +{ + struct platform_device *ndev = to_platform_device(device); + struct gk20a *g = get_gk20a(ndev); + u32 ecc_mask; + u32 err = 0; + + err = sscanf(buf, "%d", &ecc_mask); + if (err == 1) { + err = g->ops.pmu.send_lrf_tex_ltc_dram_overide_en_dis_cmd + (g, ecc_mask); + if (err) + dev_err(device, "ECC override did not happen\n"); + } else + return -EINVAL; + return count; +} + +static ssize_t ecc_enable_read(struct device *device, + struct device_attribute *attr, char *buf) +{ + struct platform_device *ndev = to_platform_device(device); + struct gk20a *g = get_gk20a(ndev); + + return sprintf(buf, "ecc override =0x%x\n", + g->ops.gr.get_lrf_tex_ltc_dram_override(g)); +} + +static DEVICE_ATTR(ecc_enable, ROOTRW, ecc_enable_read, ecc_enable_store); + +void gp10b_create_sysfs(struct platform_device *dev) +{ + int error = 0; + + error |= device_create_file(&dev->dev, &dev_attr_ecc_enable); + if (error) + dev_err(&dev->dev, "Failed to create sysfs attributes!\n"); +} + +void gp10b_remove_sysfs(struct device *dev) +{ + device_remove_file(dev, &dev_attr_ecc_enable); +} -- cgit v1.2.2