11bc11497SRachit Kankane /* 22c6d25c0SJingxiang Ge * Copyright (c) 2018,2020-2021, The Linux Foundation. All rights reserved. 31bc11497SRachit Kankane * 41bc11497SRachit Kankane * Permission to use, copy, modify, and/or distribute this software for 51bc11497SRachit Kankane * any purpose with or without fee is hereby granted, provided that the 61bc11497SRachit Kankane * above copyright notice and this permission notice appear in all 71bc11497SRachit Kankane * copies. 81bc11497SRachit Kankane * 91bc11497SRachit Kankane * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL 101bc11497SRachit Kankane * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED 111bc11497SRachit Kankane * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE 121bc11497SRachit Kankane * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL 131bc11497SRachit Kankane * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR 141bc11497SRachit Kankane * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER 151bc11497SRachit Kankane * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 161bc11497SRachit Kankane * PERFORMANCE OF THIS SOFTWARE. 171bc11497SRachit Kankane */ 181bc11497SRachit Kankane 191bc11497SRachit Kankane #ifndef _HTC_CREDIT_HISTORY_H_ 201bc11497SRachit Kankane #define _HTC_CREDIT_HISTORY_H_ 211bc11497SRachit Kankane 221bc11497SRachit Kankane #include "htc_internal.h" 231bc11497SRachit Kankane 241bc11497SRachit Kankane #ifdef FEATURE_HTC_CREDIT_HISTORY 251bc11497SRachit Kankane 261bc11497SRachit Kankane /** 27*45daa78cSAditya Kodukula * htc_credit_history_init() - Init helper function 28*45daa78cSAditya Kodukula * 29*45daa78cSAditya Kodukula * The htc_credit_history_init() function, helps to initialize 30*45daa78cSAditya Kodukula * HTC credit history buffers and variable. 31*45daa78cSAditya Kodukula * 321bc11497SRachit Kankane * Return: None 331bc11497SRachit Kankane */ 341bc11497SRachit Kankane void htc_credit_history_init(void); 35*45daa78cSAditya Kodukula 36*45daa78cSAditya Kodukula /** 37*45daa78cSAditya Kodukula * htc_credit_history_deinit() - Deinit helper function 38*45daa78cSAditya Kodukula * 39*45daa78cSAditya Kodukula * The htc_credit_history_deinit() function, helps to remove 40*45daa78cSAditya Kodukula * the HTC credit history buffers from minidump. 41*45daa78cSAditya Kodukula * 42*45daa78cSAditya Kodukula * Return: None 43*45daa78cSAditya Kodukula */ 44*45daa78cSAditya Kodukula void htc_credit_history_deinit(void); 451bc11497SRachit Kankane void htc_credit_record(enum htc_credit_exchange_type type, uint32_t tx_credit, 461bc11497SRachit Kankane uint32_t htc_tx_queue_depth); 471f76b826SArun Kumar Khandavalli #ifdef WLAN_HANG_EVENT 481f76b826SArun Kumar Khandavalli /** 49*45daa78cSAditya Kodukula * htc_log_hang_credit_history() - Log the credit history into a buffer 501f76b826SArun Kumar Khandavalli * @block: Notifier block 511f76b826SArun Kumar Khandavalli * @data: Private data of the block. 521f76b826SArun Kumar Khandavalli * 531f76b826SArun Kumar Khandavalli * HTC hang event notifier callback inovked when the recovery is triggered 541f76b826SArun Kumar Khandavalli * to log the credit information to understand the reason for recovery. 551f76b826SArun Kumar Khandavalli * 56*45daa78cSAditya Kodukula * Return: None 571f76b826SArun Kumar Khandavalli */ 581f76b826SArun Kumar Khandavalli void htc_log_hang_credit_history(struct notifier_block *block, void *data); 591f76b826SArun Kumar Khandavalli #else 601f76b826SArun Kumar Khandavalli static inline 611f76b826SArun Kumar Khandavalli void htc_log_hang_credit_history(struct notifier_block *block, void *data) 621f76b826SArun Kumar Khandavalli { 631f76b826SArun Kumar Khandavalli } 641f76b826SArun Kumar Khandavalli #endif 651bc11497SRachit Kankane #else /* FEATURE_HTC_CREDIT_HISTORY */ 661bc11497SRachit Kankane 671bc11497SRachit Kankane static inline 681bc11497SRachit Kankane void htc_credit_history_init(void) 691bc11497SRachit Kankane { 701bc11497SRachit Kankane } 711bc11497SRachit Kankane 721bc11497SRachit Kankane static inline 73*45daa78cSAditya Kodukula void htc_credit_history_deinit(void) 74*45daa78cSAditya Kodukula { 75*45daa78cSAditya Kodukula } 76*45daa78cSAditya Kodukula 77*45daa78cSAditya Kodukula static inline 781bc11497SRachit Kankane void htc_credit_record(enum htc_credit_exchange_type type, uint32_t tx_credit, 791bc11497SRachit Kankane uint32_t htc_tx_queue_depth) 801bc11497SRachit Kankane { } 811bc11497SRachit Kankane #endif /* FEATURE_HTC_CREDIT_HISTORY */ 821bc11497SRachit Kankane #endif /* _HTC_CREDIT_HISTORY_H_ */ 83