Ethan Chen | 7b18590 | 2014-11-16 16:48:31 -0800 | [diff] [blame^] | 1 | /* Copyright (c) 2002,2008-2013, The Linux Foundation. All rights reserved. |
Steve Kondik | f7652b3 | 2013-11-26 15:20:51 -0800 | [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 | |
| 14 | #include <linux/export.h> |
| 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" |
| 21 | #include "adreno.h" |
| 22 | #include "kgsl_cffdump.h" |
| 23 | |
| 24 | #include "a2xx_reg.h" |
| 25 | |
Steve Kondik | f7652b3 | 2013-11-26 15:20:51 -0800 | [diff] [blame] | 26 | DEFINE_SIMPLE_ATTRIBUTE(kgsl_cff_dump_enable_fops, kgsl_cff_dump_enable_get, |
| 27 | kgsl_cff_dump_enable_set, "%llu\n"); |
| 28 | |
| 29 | static int _active_count_get(void *data, u64 *val) |
| 30 | { |
| 31 | struct kgsl_device *device = data; |
| 32 | unsigned int i = atomic_read(&device->active_cnt); |
| 33 | |
| 34 | *val = (u64) i; |
| 35 | return 0; |
| 36 | } |
| 37 | |
| 38 | DEFINE_SIMPLE_ATTRIBUTE(_active_count_fops, _active_count_get, NULL, "%llu\n"); |
| 39 | |
| 40 | typedef void (*reg_read_init_t)(struct kgsl_device *device); |
| 41 | typedef void (*reg_read_fill_t)(struct kgsl_device *device, int i, |
| 42 | unsigned int *vals, int linec); |
| 43 | |
| 44 | void adreno_debugfs_init(struct kgsl_device *device) |
| 45 | { |
| 46 | struct adreno_device *adreno_dev = ADRENO_DEVICE(device); |
| 47 | |
| 48 | if (!device->d_debugfs || IS_ERR(device->d_debugfs)) |
| 49 | return; |
| 50 | |
| 51 | debugfs_create_file("cff_dump", 0644, device->d_debugfs, device, |
| 52 | &kgsl_cff_dump_enable_fops); |
| 53 | debugfs_create_u32("wait_timeout", 0644, device->d_debugfs, |
| 54 | &adreno_dev->wait_timeout); |
| 55 | debugfs_create_u32("ib_check", 0644, device->d_debugfs, |
| 56 | &adreno_dev->ib_check_level); |
Steve Kondik | f7652b3 | 2013-11-26 15:20:51 -0800 | [diff] [blame] | 57 | debugfs_create_file("active_cnt", 0444, device->d_debugfs, device, |
| 58 | &_active_count_fops); |
| 59 | } |