File Index
Files and directories
Sign in
FILE

debug.h

File preview with syntax highlighting.

linux-6.19.14/drivers/net/wireless/realtek/rtw89/debug.h C
  1/* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */
  2/* Copyright(c) 2019-2020  Realtek Corporation
  3 */
  4
  5#ifndef __RTW89_DEBUG_H__
  6#define __RTW89_DEBUG_H__
  7
  8#include "core.h"
  9
 10enum rtw89_debug_mask {
 11	RTW89_DBG_TXRX = BIT(0),
 12	RTW89_DBG_RFK = BIT(1),
 13	RTW89_DBG_RFK_TRACK = BIT(2),
 14	RTW89_DBG_CFO = BIT(3),
 15	RTW89_DBG_TSSI = BIT(4),
 16	RTW89_DBG_TXPWR = BIT(5),
 17	RTW89_DBG_HCI = BIT(6),
 18	RTW89_DBG_RA = BIT(7),
 19	RTW89_DBG_REGD = BIT(8),
 20	RTW89_DBG_PHY_TRACK = BIT(9),
 21	RTW89_DBG_DIG = BIT(10),
 22	RTW89_DBG_SER = BIT(11),
 23	RTW89_DBG_FW = BIT(12),
 24	RTW89_DBG_BTC = BIT(13),
 25	RTW89_DBG_BF = BIT(14),
 26	RTW89_DBG_HW_SCAN = BIT(15),
 27	RTW89_DBG_SAR = BIT(16),
 28	RTW89_DBG_STATE = BIT(17),
 29	RTW89_DBG_WOW = BIT(18),
 30	RTW89_DBG_UL_TB = BIT(19),
 31	RTW89_DBG_CHAN = BIT(20),
 32	RTW89_DBG_ACPI = BIT(21),
 33	RTW89_DBG_EDCCA = BIT(22),
 34
 35	RTW89_DBG_UNEXP = BIT(31),
 36};
 37
 38enum rtw89_debug_mac_reg_sel {
 39	RTW89_DBG_SEL_MAC_00,
 40	RTW89_DBG_SEL_MAC_30,
 41	RTW89_DBG_SEL_MAC_40,
 42	RTW89_DBG_SEL_MAC_80,
 43	RTW89_DBG_SEL_MAC_C0,
 44	RTW89_DBG_SEL_MAC_E0,
 45	RTW89_DBG_SEL_BB,
 46	RTW89_DBG_SEL_IQK,
 47	RTW89_DBG_SEL_RFC,
 48};
 49
 50#ifdef CONFIG_RTW89_DEBUGFS
 51void rtw89_debugfs_init(struct rtw89_dev *rtwdev);
 52void rtw89_debugfs_deinit(struct rtw89_dev *rtwdev);
 53#else
 54static inline void rtw89_debugfs_init(struct rtw89_dev *rtwdev) {}
 55static inline void rtw89_debugfs_deinit(struct rtw89_dev *rtwdev) {}
 56#endif
 57
 58#define rtw89_info(rtwdev, a...) dev_info((rtwdev)->dev, ##a)
 59#define rtw89_info_once(rtwdev, a...) dev_info_once((rtwdev)->dev, ##a)
 60#define rtw89_warn(rtwdev, a...) dev_warn((rtwdev)->dev, ##a)
 61#define rtw89_err(rtwdev, a...) dev_err((rtwdev)->dev, ##a)
 62
 63#ifdef CONFIG_RTW89_DEBUGMSG
 64extern unsigned int rtw89_debug_mask;
 65
 66__printf(3, 4)
 67void rtw89_debug(struct rtw89_dev *rtwdev, enum rtw89_debug_mask mask,
 68		 const char *fmt, ...);
 69static inline void rtw89_hex_dump(struct rtw89_dev *rtwdev,
 70				  enum rtw89_debug_mask mask,
 71				  const char *prefix_str,
 72				  const void *buf, size_t len)
 73{
 74	if (!(rtw89_debug_mask & mask))
 75		return;
 76
 77	print_hex_dump_bytes(prefix_str, DUMP_PREFIX_OFFSET, buf, len);
 78}
 79
 80static inline bool rtw89_debug_is_enabled(struct rtw89_dev *rtwdev,
 81					  enum rtw89_debug_mask mask)
 82{
 83	return !!(rtw89_debug_mask & mask);
 84}
 85#else
 86static inline void rtw89_debug(struct rtw89_dev *rtwdev,
 87			       enum rtw89_debug_mask mask,
 88			       const char *fmt, ...) {}
 89static inline void rtw89_hex_dump(struct rtw89_dev *rtwdev,
 90				  enum rtw89_debug_mask mask,
 91				  const char *prefix_str,
 92				  const void *buf, size_t len) {}
 93static inline bool rtw89_debug_is_enabled(struct rtw89_dev *rtwdev,
 94					  enum rtw89_debug_mask mask)
 95{
 96	return false;
 97}
 98#endif
 99
100#endif
~/ Read-only file preview.