Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  1) /* SPDX-License-Identifier: GPL-2.0-only */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  2) /*****************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  3) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  4)     AudioScience HPI driver
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  5)     Copyright (C) 1997-2011  AudioScience Inc. <support@audioscience.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  6) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  7) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  8) Debug macros.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  9) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) *****************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) #ifndef _HPIDEBUG_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) #define _HPIDEBUG_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) #include "hpi_internal.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) /* Define debugging levels.  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) enum { HPI_DEBUG_LEVEL_ERROR = 0,	/* always log errors */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) 	HPI_DEBUG_LEVEL_WARNING = 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) 	HPI_DEBUG_LEVEL_NOTICE = 2,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) 	HPI_DEBUG_LEVEL_INFO = 3,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) 	HPI_DEBUG_LEVEL_DEBUG = 4,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) 	HPI_DEBUG_LEVEL_VERBOSE = 5	/* same printk level as DEBUG */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) #define HPI_DEBUG_LEVEL_DEFAULT HPI_DEBUG_LEVEL_NOTICE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) /* an OS can define an extra flag string that is appended to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29)    the start of each message, eg see linux kernel hpios.h */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) #ifdef SOURCEFILE_NAME
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) #define FILE_LINE  SOURCEFILE_NAME ":" __stringify(__LINE__) " "
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) #define FILE_LINE  __FILE__ ":" __stringify(__LINE__) " "
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) #define HPI_DEBUG_ASSERT(expression) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) 	do { \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) 		if (!(expression)) { \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) 			printk(KERN_ERR  FILE_LINE \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) 				"ASSERT " __stringify(expression)); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) 		} \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) 	} while (0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) #define HPI_DEBUG_LOG(level, ...) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) 	do { \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) 		if (hpi_debug_level >= HPI_DEBUG_LEVEL_##level) { \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) 			printk(HPI_DEBUG_FLAG_##level \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) 			FILE_LINE  __VA_ARGS__); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) 		} \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) 	} while (0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) void hpi_debug_init(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) int hpi_debug_level_set(int level);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) int hpi_debug_level_get(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) /* needed by Linux driver for dynamic debug level changes */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) extern int hpi_debug_level;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) void hpi_debug_message(struct hpi_message *phm, char *sz_fileline);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) void hpi_debug_data(u16 *pdata, u32 len);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) #define HPI_DEBUG_DATA(pdata, len) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) 	do { \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) 		if (hpi_debug_level >= HPI_DEBUG_LEVEL_VERBOSE) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) 			hpi_debug_data(pdata, len); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) 	} while (0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) #define HPI_DEBUG_MESSAGE(level, phm) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) 	do { \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) 		if (hpi_debug_level >= HPI_DEBUG_LEVEL_##level) { \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) 			hpi_debug_message(phm, HPI_DEBUG_FLAG_##level \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) 				FILE_LINE __stringify(level)); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) 		} \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) 	} while (0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) #define HPI_DEBUG_RESPONSE(phr) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) 	do { \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) 		if (((hpi_debug_level >= HPI_DEBUG_LEVEL_DEBUG) && \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) 			(phr->error)) ||\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) 		(hpi_debug_level >= HPI_DEBUG_LEVEL_VERBOSE)) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) 			printk(KERN_DEBUG "HPI_RES%d,%d,%d\n", \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) 				phr->version, phr->error, phr->specific_error); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) 	} while (0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) #ifndef compile_time_assert
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) #define compile_time_assert(cond, msg) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88)     typedef char msg[(cond) ? 1 : -1]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) #endif				/* _HPIDEBUG_H_  */