blob: 79eb0c3aef0910bad4cae805dc0f520cf2ac0c6e [file] [log] [blame]
Duy Truonge833aca2013-02-12 13:35:08 -08001/* Copyright (c) 2002,2008-2012, The Linux Foundation. All rights reserved.
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002 *
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 Mucklef132c6c2012-06-06 18:30:57 -070014#include <linux/export.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070015#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 Huntsman3f2bc4d2011-08-16 17:27:22 -070021#include "adreno.h"
22
Jeremy Gebbeneebc4612011-08-31 10:15:21 -070023#include "a2xx_reg.h"
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070024
25unsigned int kgsl_cff_dump_enable;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070026
27static 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
37static int kgsl_cff_dump_enable_get(void *data, u64 *val)
38{
39 *val = kgsl_cff_dump_enable;
40 return 0;
41}
42
43DEFINE_SIMPLE_ATTRIBUTE(kgsl_cff_dump_enable_fops, kgsl_cff_dump_enable_get,
44 kgsl_cff_dump_enable_set, "%llu\n");
45
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070046typedef void (*reg_read_init_t)(struct kgsl_device *device);
47typedef void (*reg_read_fill_t)(struct kgsl_device *device, int i,
48 unsigned int *vals, int linec);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070049
50void adreno_debugfs_init(struct kgsl_device *device)
51{
Ranjhith Kalisamy823c1482011-09-05 20:31:07 +053052 struct adreno_device *adreno_dev = ADRENO_DEVICE(device);
53
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070054 if (!device->d_debugfs || IS_ERR(device->d_debugfs))
55 return;
56
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070057 debugfs_create_file("cff_dump", 0644, device->d_debugfs, device,
58 &kgsl_cff_dump_enable_fops);
Ranjhith Kalisamy823c1482011-09-05 20:31:07 +053059 debugfs_create_u32("wait_timeout", 0644, device->d_debugfs,
60 &adreno_dev->wait_timeout);
Jeremy Gebbend0ab6ad2012-04-06 11:13:35 -060061 debugfs_create_u32("ib_check", 0644, device->d_debugfs,
62 &adreno_dev->ib_check_level);
Tarun Karra3335f142012-06-19 14:11:48 -070063 /* 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 Karradeeecc02013-01-21 23:42:17 -080067 /*
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 Karra696f89e2013-01-27 21:31:40 -080078 /* 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 Huntsman3f2bc4d2011-08-16 17:27:22 -070082}