Duy Truong | e833aca | 2013-02-12 13:35:08 -0800 | [diff] [blame] | 1 | /* Copyright (c) 2002,2008-2012, The Linux Foundation. All rights reserved. |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2 | * |
| 3 | * This program is free software; you can redistribute it and/or modify |
| 4 | * it under the terms of the GNU General Public License version 2 and |
| 5 | * only version 2 as published by the Free Software Foundation. |
| 6 | * |
| 7 | * This program is distributed in the hope that it will be useful, |
| 8 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 9 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 10 | * GNU General Public License for more details. |
| 11 | * |
| 12 | */ |
| 13 | |
Steve Muckle | f132c6c | 2012-06-06 18:30:57 -0700 | [diff] [blame] | 14 | #include <linux/export.h> |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 15 | #include <linux/delay.h> |
| 16 | #include <linux/debugfs.h> |
| 17 | #include <linux/uaccess.h> |
| 18 | #include <linux/io.h> |
| 19 | |
| 20 | #include "kgsl.h" |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 21 | #include "adreno.h" |
| 22 | |
Jeremy Gebben | eebc461 | 2011-08-31 10:15:21 -0700 | [diff] [blame] | 23 | #include "a2xx_reg.h" |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 24 | |
| 25 | unsigned int kgsl_cff_dump_enable; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 26 | |
| 27 | static int kgsl_cff_dump_enable_set(void *data, u64 val) |
| 28 | { |
| 29 | #ifdef CONFIG_MSM_KGSL_CFF_DUMP |
| 30 | kgsl_cff_dump_enable = (val != 0); |
| 31 | return 0; |
| 32 | #else |
| 33 | return -EINVAL; |
| 34 | #endif |
| 35 | } |
| 36 | |
| 37 | static int kgsl_cff_dump_enable_get(void *data, u64 *val) |
| 38 | { |
| 39 | *val = kgsl_cff_dump_enable; |
| 40 | return 0; |
| 41 | } |
| 42 | |
| 43 | DEFINE_SIMPLE_ATTRIBUTE(kgsl_cff_dump_enable_fops, kgsl_cff_dump_enable_get, |
| 44 | kgsl_cff_dump_enable_set, "%llu\n"); |
| 45 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 46 | typedef void (*reg_read_init_t)(struct kgsl_device *device); |
| 47 | typedef void (*reg_read_fill_t)(struct kgsl_device *device, int i, |
| 48 | unsigned int *vals, int linec); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 49 | |
| 50 | void adreno_debugfs_init(struct kgsl_device *device) |
| 51 | { |
Ranjhith Kalisamy | 823c148 | 2011-09-05 20:31:07 +0530 | [diff] [blame] | 52 | struct adreno_device *adreno_dev = ADRENO_DEVICE(device); |
| 53 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 54 | if (!device->d_debugfs || IS_ERR(device->d_debugfs)) |
| 55 | return; |
| 56 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 57 | debugfs_create_file("cff_dump", 0644, device->d_debugfs, device, |
| 58 | &kgsl_cff_dump_enable_fops); |
Ranjhith Kalisamy | 823c148 | 2011-09-05 20:31:07 +0530 | [diff] [blame] | 59 | debugfs_create_u32("wait_timeout", 0644, device->d_debugfs, |
| 60 | &adreno_dev->wait_timeout); |
Jeremy Gebben | d0ab6ad | 2012-04-06 11:13:35 -0600 | [diff] [blame] | 61 | debugfs_create_u32("ib_check", 0644, device->d_debugfs, |
| 62 | &adreno_dev->ib_check_level); |
Tarun Karra | 3335f14 | 2012-06-19 14:11:48 -0700 | [diff] [blame] | 63 | /* By Default enable fast hang detection */ |
| 64 | adreno_dev->fast_hang_detect = 1; |
| 65 | debugfs_create_u32("fast_hang_detect", 0644, device->d_debugfs, |
| 66 | &adreno_dev->fast_hang_detect); |
Tarun Karra | deeecc0 | 2013-01-21 23:42:17 -0800 | [diff] [blame] | 67 | /* |
| 68 | * FT policy can be set to any of the options below. |
| 69 | * FT_REPLAY_BAD_CTXT_CMDS -> try replay, NOP IB and skip to EOF |
| 70 | * of bad cmds |
| 71 | * FT_NOT_IB_BAD_CTXT_CMDS -> try replay and NOP IB of bad cmds |
| 72 | * FT_SKIP_EOF_BAD_CTXT_CMDS -> try skip to EOF of bad cmds |
| 73 | * by default set FT policy to FT_REPLAY_BAD_CTXT_CMDS |
| 74 | */ |
| 75 | adreno_dev->ft_policy = FT_REPLAY_BAD_CTXT_CMDS; |
| 76 | debugfs_create_u32("fault_tolerance_policy", 0644, device->d_debugfs, |
| 77 | &adreno_dev->ft_policy); |
Tarun Karra | 696f89e | 2013-01-27 21:31:40 -0800 | [diff] [blame^] | 78 | /* By default enable long IB detection */ |
| 79 | adreno_dev->long_ib_detect = 1; |
| 80 | debugfs_create_u32("long_ib_detect", 0644, device->d_debugfs, |
| 81 | &adreno_dev->long_ib_detect); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 82 | } |