]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - android-sdk/arm-ds5-gator.git/blob - driver/gator_events_mali_common.c
2dd9ad6eb6c3df27854e984277eefdcaf4f8b836
[android-sdk/arm-ds5-gator.git] / driver / gator_events_mali_common.c
1 /*
2  * This confidential and proprietary software may be used only as
3  * authorised by a licensing agreement from ARM Limited
4  * (C) COPYRIGHT 2011-2012 ARM Limited
5  * ALL RIGHTS RESERVED
6  * The entire notice above must be reproduced on all authorised
7  * copies and copies may only be made to the extent permitted
8  * by a licensing agreement from ARM Limited.
9  */
10 #include "gator_events_mali_common.h"
12 static u32 gator_mali_get_id(void)
13 {
14     return MALI_SUPPORT;
15 }
17 extern const char* gator_mali_get_mali_name(void)
18 {
19     u32 id = gator_mali_get_id();
21     switch (id) {
22     case MALI_T6xx:
23         return "Mali-T6xx";
24     case MALI_400:
25         return "Mali-400";
26     default:
27         pr_debug("gator: Mali-T6xx: unknown Mali ID (%d)\n", id);
28         return "Mali-Unknown";
29     }
30 }
32 extern int gator_mali_create_file_system(const char* mali_name, const char* event_name, struct super_block *sb, struct dentry *root, mali_counter *counter)
33 {
34     int err;
35     char buf[255];
36     struct dentry *dir;
38     /* If the counter name is empty ignore it*/
39     if (strlen(event_name) != 0)
40     {
41         /* Set up the filesystem entry for this event. */
42         snprintf(buf, sizeof(buf), "ARM_%s_%s", mali_name, event_name);
44         dir = gatorfs_mkdir(sb, root, buf);
46         if (dir == NULL)
47         {
48             pr_debug("gator: Mali-T6xx: error creating file system for: %s (%s)", event_name, buf);
49             return -1;
50         }
52         err = gatorfs_create_ulong(sb, dir, "enabled", &counter->enabled);
53         if (err != 0)
54         {
55             pr_debug("gator: Mali-T6xx: error calling gatorfs_create_ulong for: %s (%s)", event_name, buf);
56             return -1;
57         }
58         err = gatorfs_create_ro_ulong(sb, dir, "key", &counter->key);
59         if (err != 0)
60         {
61             pr_debug("gator: Mali-T6xx: error calling gatorfs_create_ro_ulong for: %s (%s)", event_name, buf);
62             return -1;
63         }
64     }
66     return 0;
67 }
69 extern void gator_mali_initialise_counters(mali_counter counters[], unsigned int n_counters)
70 {
71     unsigned int cnt;
73     for (cnt = 0; cnt < n_counters; cnt++) {
74         mali_counter *counter = &counters[cnt];
76         counter->key = gator_events_get_key();
77         counter->enabled = 0;
78     }
79 }