linux/drivers/net/wireless/broadcom/brcm80211/brcmfmac/btcoex.c

// SPDX-License-Identifier: ISC
/*
 * Copyright (c) 2013 Broadcom Corporation
 */
#include <linux/slab.h>
#include <linux/netdevice.h>
#include <net/cfg80211.h>

#include <brcmu_wifi.h>
#include <brcmu_utils.h>
#include <defs.h>
#include "core.h"
#include "debug.h"
#include "fwil.h"
#include "fwil_types.h"
#include "btcoex.h"
#include "p2p.h"
#include "cfg80211.h"

/* T1 start SCO/eSCO priority suppression */
#define BRCMF_BTCOEX_OPPR_WIN_TIME

/* BT registers values during DHCP */
#define BRCMF_BT_DHCP_REG50
#define BRCMF_BT_DHCP_REG51
#define BRCMF_BT_DHCP_REG64
#define BRCMF_BT_DHCP_REG65
#define BRCMF_BT_DHCP_REG71
#define BRCMF_BT_DHCP_REG66
#define BRCMF_BT_DHCP_REG41
#define BRCMF_BT_DHCP_REG68

/* number of samples for SCO detection */
#define BRCMF_BT_SCO_SAMPLES

/**
* enum brcmf_btcoex_state - BT coex DHCP state machine states
* @BRCMF_BT_DHCP_IDLE: DCHP is idle
* @BRCMF_BT_DHCP_START: DHCP started, wait before
*	boosting wifi priority
* @BRCMF_BT_DHCP_OPPR_WIN: graceful DHCP opportunity ended,
*	boost wifi priority
* @BRCMF_BT_DHCP_FLAG_FORCE_TIMEOUT: wifi priority boost end,
*	restore defaults
*/
enum brcmf_btcoex_state {};

/**
 * struct brcmf_btcoex_info - BT coex related information
 * @vif: interface for which request was done.
 * @timer: timer for DHCP state machine
 * @timeout: configured timeout.
 * @timer_on:  DHCP timer active
 * @dhcp_done: DHCP finished before T1/T2 timer expiration
 * @bt_state: DHCP state machine state
 * @work: DHCP state machine work
 * @cfg: driver private data for cfg80211 interface
 * @reg66: saved value of btc_params 66
 * @reg41: saved value of btc_params 41
 * @reg68: saved value of btc_params 68
 * @saved_regs_part1: flag indicating regs 66,41,68
 *	have been saved
 * @reg50: saved value of btc_params 50
 * @reg51: saved value of btc_params 51
 * @reg64: saved value of btc_params 64
 * @reg65: saved value of btc_params 65
 * @reg71: saved value of btc_params 71
 * @saved_regs_part2: flag indicating regs 50,51,64,65,71
 *	have been saved
 */
struct brcmf_btcoex_info {};

/**
 * brcmf_btcoex_params_write() - write btc_params firmware variable
 * @ifp: interface
 * @addr: btc_params register number
 * @data: data to write
 */
static s32 brcmf_btcoex_params_write(struct brcmf_if *ifp, u32 addr, u32 data)
{}

/**
 * brcmf_btcoex_params_read() - read btc_params firmware variable
 * @ifp: interface
 * @addr: btc_params register number
 * @data: read data
 */
static s32 brcmf_btcoex_params_read(struct brcmf_if *ifp, u32 addr, u32 *data)
{}

/**
 * brcmf_btcoex_boost_wifi() - control BT SCO/eSCO parameters
 * @btci: BT coex info
 * @trump_sco:
 *	true - set SCO/eSCO parameters for compatibility
 *		during DHCP window
 *	false - restore saved parameter values
 *
 * Enhanced BT COEX settings for eSCO compatibility during DHCP window
 */
static void brcmf_btcoex_boost_wifi(struct brcmf_btcoex_info *btci,
				    bool trump_sco)
{}

/**
 * brcmf_btcoex_is_sco_active() - check if SCO/eSCO is active
 * @ifp: interface
 *
 * return: true if SCO/eSCO session is active
 */
static bool brcmf_btcoex_is_sco_active(struct brcmf_if *ifp)
{}

/*
 * btcmf_btcoex_save_part1() - save first step parameters.
 */
static void btcmf_btcoex_save_part1(struct brcmf_btcoex_info *btci)
{}

/*
 * brcmf_btcoex_restore_part1() - restore first step parameters.
 */
static void brcmf_btcoex_restore_part1(struct brcmf_btcoex_info *btci)
{}

/*
 * brcmf_btcoex_timerfunc() - BT coex timer callback
 */
static void brcmf_btcoex_timerfunc(struct timer_list *t)
{}

/**
 * brcmf_btcoex_handler() - BT coex state machine work handler
 * @work: work
 */
static void brcmf_btcoex_handler(struct work_struct *work)
{}

/**
 * brcmf_btcoex_attach() - initialize BT coex data
 * @cfg: driver private cfg80211 data
 *
 * return: 0 on success
 */
int brcmf_btcoex_attach(struct brcmf_cfg80211_info *cfg)
{}

/**
 * brcmf_btcoex_detach - clean BT coex data
 * @cfg: driver private cfg80211 data
 */
void brcmf_btcoex_detach(struct brcmf_cfg80211_info *cfg)
{}

static void brcmf_btcoex_dhcp_start(struct brcmf_btcoex_info *btci)
{}

static void brcmf_btcoex_dhcp_end(struct brcmf_btcoex_info *btci)
{}

/*
 * brcmf_btcoex_set_mode - set BT coex mode
 * @mode: Wifi-Bluetooth coexistence mode
 *
 * return: 0 on success
 */
int brcmf_btcoex_set_mode(struct brcmf_cfg80211_vif *vif,
			  enum brcmf_btcoex_mode mode, u16 duration)
{}