1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ 2 /* 3 * 4 * (C) COPYRIGHT 2022 ARM Limited. All rights reserved. 5 * 6 * This program is free software and is provided to you under the terms of the 7 * GNU General Public License version 2 as published by the Free Software 8 * Foundation, and any use by you of this program is subject to the terms 9 * of such GNU license. 10 * 11 * This program is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU General Public License for more details. 15 * 16 * You should have received a copy of the GNU General Public License 17 * along with this program; if not, you can access it online at 18 * http://www.gnu.org/licenses/gpl-2.0.html. 19 * 20 */ 21 22 #ifndef _CORESIGHT_MALI_SOURCES_H 23 #define _CORESIGHT_MALI_SOURCES_H 24 25 #include <linux/platform_device.h> 26 #include <linux/sysfs.h> 27 #include <linux/version.h> 28 29 #include "coresight_mali_common.h" 30 31 /** 32 * struct coresight_mali_source_drvdata - Coresight mali source driver data 33 * 34 * @base: Common driver data structure between coresight mali sources and sinks 35 * @trcid: Trace id 36 * @type_name: Type name of the driver, for example "itm" or "etm" 37 */ 38 struct coresight_mali_source_drvdata { 39 struct coresight_mali_drvdata base; 40 u32 trcid; 41 #if KERNEL_VERSION(5, 3, 0) <= LINUX_VERSION_CODE 42 char *type_name; 43 #endif 44 }; 45 46 /** 47 * coresight_mali_sources_probe - Generic probe for a coresight mali source 48 * 49 * @pdev: Pointer to a platform device 50 * 51 * Return: 0 if success. Error code on failure. 52 */ 53 int coresight_mali_sources_probe(struct platform_device *pdev); 54 55 /** 56 * coresight_mali_sources_remove - Generic remove for a coresight mali source 57 * 58 * @pdev: Pointer to a platform device 59 * 60 * Return: 0 if success. Error code on failure. 61 */ 62 int coresight_mali_sources_remove(struct platform_device *pdev); 63 64 /** 65 * coresight_mali_sources_init_drvdata - Driver data initialization hook. 66 * 67 * @drvdata: Driver data structure to initialize 68 * 69 * Used for initializing source specific enable and disable sequences and other relevant data. 70 * 71 * Return: 0 if success. Error code on failure. 72 */ 73 int coresight_mali_sources_init_drvdata(struct coresight_mali_source_drvdata *drvdata); 74 75 /** 76 * coresight_mali_sources_deinit_drvdata - Driver data deinitialization hook. 77 * 78 * @drvdata: Driver data structure to deinitialize 79 * 80 * Used for releasing source specific enable and disable sequences and other relevant data. 81 */ 82 void coresight_mali_sources_deinit_drvdata(struct coresight_mali_source_drvdata *drvdata); 83 84 /** 85 * coresight_mali_source_groups_get - Getter for source groups. 86 * 87 * Return: a pointer to an array of attribute groups of the driver. Can also be NULL. 88 * 89 * Groups are drivers sysfs subnodes that can be used to read state of the coresight component 90 * or write component configuration. 91 */ 92 const struct attribute_group **coresight_mali_source_groups_get(void); 93 94 #endif /* _CORESIGHT_MALI_SOURCES_H */ 95