1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ 2 /* 3 * 4 * (C) COPYRIGHT 2021-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 /* 23 * Virtual interface for hardware counter watchdog. 24 */ 25 26 #ifndef _KBASE_HWCNT_WATCHDOG_IF_H_ 27 #define _KBASE_HWCNT_WATCHDOG_IF_H_ 28 29 #include <linux/types.h> 30 31 /* 32 * Opaque structure of information used to create a watchdog timer interface. 33 */ 34 struct kbase_hwcnt_watchdog_info; 35 36 /** 37 * typedef kbase_hwcnt_watchdog_callback_fn - Callback function when watchdog timer is done 38 * 39 * @user_data: Pointer to the callback user data. 40 */ 41 typedef void kbase_hwcnt_watchdog_callback_fn(void *user_data); 42 43 /** 44 * typedef kbase_hwcnt_watchdog_enable_fn - Enable watchdog timer 45 * 46 * @timer: Non-NULL pointer to a watchdog timer interface context 47 * @period_ms: Period in milliseconds of the watchdog timer 48 * @callback: Non-NULL pointer to a watchdog callback function 49 * @user_data: Pointer to the user data, used when watchdog timer callback is called 50 * 51 * Return: 0 if the watchdog timer enabled successfully, error code otherwise. 52 */ 53 typedef int kbase_hwcnt_watchdog_enable_fn(const struct kbase_hwcnt_watchdog_info *timer, 54 u32 period_ms, 55 kbase_hwcnt_watchdog_callback_fn *callback, 56 void *user_data); 57 58 /** 59 * typedef kbase_hwcnt_watchdog_disable_fn - Disable watchdog timer 60 * 61 * @timer: Non-NULL pointer to a watchdog timer interface context 62 */ 63 typedef void kbase_hwcnt_watchdog_disable_fn(const struct kbase_hwcnt_watchdog_info *timer); 64 65 /** 66 * typedef kbase_hwcnt_watchdog_modify_fn - Modify watchdog timer's timeout 67 * 68 * @timer: Non-NULL pointer to a watchdog timer interface context 69 * @delay_ms: Watchdog timer expiration in milliseconds 70 */ 71 typedef void kbase_hwcnt_watchdog_modify_fn(const struct kbase_hwcnt_watchdog_info *timer, 72 u32 delay_ms); 73 74 /** 75 * struct kbase_hwcnt_watchdog_interface - Hardware counter watchdog virtual interface. 76 * 77 * @timer: Immutable watchdog timer info 78 * @enable: Function ptr to enable watchdog 79 * @disable: Function ptr to disable watchdog 80 * @modify: Function ptr to modify watchdog 81 */ 82 struct kbase_hwcnt_watchdog_interface { 83 const struct kbase_hwcnt_watchdog_info *timer; 84 kbase_hwcnt_watchdog_enable_fn *enable; 85 kbase_hwcnt_watchdog_disable_fn *disable; 86 kbase_hwcnt_watchdog_modify_fn *modify; 87 }; 88 89 #endif /* _KBASE_HWCNT_WATCHDOG_IF_H_ */ 90