mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-14 16:46:15 -04:00
ion: msm: enable debugfs for ion heaps
Add debugfs node for ion which prints out the debug_show of all the heaps within ion. Change-Id: I8499967c8f202b079b6ccbe1c31cb38ee6a51374 Signed-off-by: Sudarshan Rajagopalan <sudaraja@codeaurora.org> [isaacm@codeaurora.org: Rework to move logic out of ION core] Signed-off-by: Isaac J. Manjarres <isaacm@codeaurora.org>
This commit is contained in:
parent
2b78a1e427
commit
016daf243e
2 changed files with 47 additions and 0 deletions
|
|
@ -4,6 +4,8 @@
|
|||
*/
|
||||
|
||||
#include <linux/err.h>
|
||||
#include <linux/debugfs.h>
|
||||
#include <linux/file.h>
|
||||
#include <linux/io.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/slab.h>
|
||||
|
|
@ -95,6 +97,46 @@ static struct heap_types_info {
|
|||
MAKE_HEAP_TYPE_MAPPING(HYP_CMA),
|
||||
};
|
||||
|
||||
static int msm_ion_debug_heap_show(struct seq_file *s, void *unused)
|
||||
{
|
||||
struct msm_ion_heap *msm_heap = s->private;
|
||||
|
||||
if (msm_heap && msm_heap->debug_show)
|
||||
msm_heap->debug_show(&msm_heap->ion_heap, s, unused);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int msm_ion_debug_heap_open(struct inode *inode, struct file *file)
|
||||
{
|
||||
return single_open(file, msm_ion_debug_heap_show, inode->i_private);
|
||||
}
|
||||
|
||||
static const struct file_operations msm_ion_debug_heap_fops = {
|
||||
.open = msm_ion_debug_heap_open,
|
||||
.read = seq_read,
|
||||
.llseek = seq_lseek,
|
||||
.release = single_release,
|
||||
};
|
||||
|
||||
static void msm_ion_debugfs_create_file(struct msm_ion_heap *msm_heap)
|
||||
{
|
||||
char debug_name[64], buf[256];
|
||||
struct dentry *debugfs_root;
|
||||
struct ion_heap *heap;
|
||||
|
||||
if (msm_heap && msm_heap->debug_show &&
|
||||
msm_heap->ion_heap.debugfs_dir) {
|
||||
heap = &msm_heap->ion_heap;
|
||||
debugfs_root = heap->debugfs_dir;
|
||||
scnprintf(debug_name, 64, "%s_stats", heap->name);
|
||||
if (!debugfs_create_file(debug_name, 0664, debugfs_root,
|
||||
msm_heap, &msm_ion_debug_heap_fops))
|
||||
pr_err("Failed to create heap debugfs at %s/%s\n",
|
||||
dentry_path(debugfs_root, buf, 256), debug_name);
|
||||
}
|
||||
}
|
||||
|
||||
static struct ion_heap *ion_heap_create(struct ion_platform_heap *heap_data)
|
||||
{
|
||||
struct ion_heap *heap = NULL;
|
||||
|
|
@ -451,6 +493,7 @@ static int msm_ion_probe(struct platform_device *pdev)
|
|||
}
|
||||
|
||||
ion_device_add_heap(heaps[i]);
|
||||
msm_ion_debugfs_create_file(to_msm_ion_heap(heaps[i]));
|
||||
}
|
||||
free_pdata(pdata);
|
||||
|
||||
|
|
|
|||
|
|
@ -81,11 +81,15 @@ struct ion_platform_heap {
|
|||
* struct msm_ion_heap - defines an ion heap, as well as additional information
|
||||
* relevant to the heap.
|
||||
* @dev: the device structure associated with the heap
|
||||
* @debug_show: called when the heap debug file is read to add any heap specific
|
||||
* debug info to output
|
||||
* @ion_heap: ion heap
|
||||
*
|
||||
*/
|
||||
struct msm_ion_heap {
|
||||
struct device *dev;
|
||||
int (*debug_show)(struct ion_heap *heap, struct seq_file *s,
|
||||
void *unused);
|
||||
struct ion_heap ion_heap;
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue