rjw | 1f88458 | 2022-01-06 17:20:42 +0800 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright (C) 2018 MediaTek Inc. |
| 3 | * |
| 4 | * This program is free software: you can redistribute it and/or modify |
| 5 | * it under the terms of the GNU General Public License version 2 as |
| 6 | * published by the Free Software Foundation. |
| 7 | * |
| 8 | * This program is distributed in the hope that it will be useful, |
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 11 | * GNU General Public License for more details. |
| 12 | */ |
| 13 | |
| 14 | #ifndef _CPU_DSU_H_ |
| 15 | #define _CPU_DSU_H_ |
| 16 | |
| 17 | #include <linux/device.h> |
| 18 | |
| 19 | #define MODE_DISABLED 0 |
| 20 | #define MODE_INTERRUPT 1 |
| 21 | #define MODE_POLLING 2 |
| 22 | |
| 23 | #define MXNR_CPU NR_CPUS |
| 24 | |
| 25 | #define MXNR_DSU_EVENTS 8 /* max number of pmu counter for armv8 is 6+1 */ |
| 26 | struct met_dsu { |
| 27 | unsigned char mode; |
| 28 | unsigned short event; |
| 29 | unsigned long freq; |
| 30 | struct kobject *kobj_cpu_dsu; |
| 31 | }; |
| 32 | |
| 33 | struct cpu_dsu_hw { |
| 34 | const char *name; |
| 35 | int nr_cnt; |
| 36 | int (*check_event)(struct met_dsu *pmu, int idx, int event); |
| 37 | void (*start)(struct met_dsu *pmu, int count); |
| 38 | void (*stop)(int count); |
| 39 | unsigned int (*polling)(struct met_dsu *pmu, int count, unsigned int *pmu_value); |
| 40 | struct met_dsu *pmu; |
| 41 | int event_count; |
| 42 | }; |
| 43 | |
| 44 | |
| 45 | struct cpu_dsu_hw *cpu_dsu_hw_init(void); |
| 46 | |
| 47 | |
| 48 | |
| 49 | #endif /* _CPU_DSU_H_ */ |