software/drivers/sd8887/src/bluetooth/bt/bt_proc.c
/**
 *  @brief Proc read function for histogram
 *
 *  @param sfp     pointer to seq_file structure
 *  @param data
 *
 *  @return        Number of output data or MLAN_STATUS_FAILURE
 */
@brief Proc read function for histogram
@param sfp     pointer to seq_file structure
@param data

@return        Number of output data or MLAN_STATUS_FAILURE
@brief Proc read function for histogram @param sfp pointer to seq_file structure @param data @return Number of output data or MLAN_STATUS_FAILURE
static int
bt_histogram_read(struct seq_file *sfp, void *data)
{
	bt_hist_proc_data *pdata = (bt_hist_proc_data *) sfp->private;
	bt_private *priv = (bt_private *)pdata->pbt;
	u8 ant_num;
	int i, j;
	ENTER();
	if (!priv) {
		LEAVE();
		return -EFAULT;
	}
	bt_get_histogram(priv);
	ant_num = priv->hist_data_len / sizeof(bt_histogram_data);
	seq_printf(sfp, "BT histogram:\n");
	seq_printf(sfp, "antenna: 0=2.4G antenna a,  1=2.4G antenna b\n\n");
	if (ant_num < 1) {
		seq_printf(sfp, "no histogram data from FW\n");
		LEAVE();
		return 0;
	}
	for (i = 0; i < ant_num; i++) {
		if (pdata->antenna != priv->hist_data[i].antenna)
			continue;
		seq_printf(sfp, "antenna %d\n", priv->hist_data[i].antenna);
		switch (priv->hist_data[i].powerclass) {
		case 2:
			seq_printf(sfp, "Power class=1.5\n");
			break;
		case 5:
			seq_printf(sfp, "Power class=2\n");
			break;
		case 6:
			seq_printf(sfp, "Power class=1\n");
			break;
		default:
			seq_printf(sfp, "Power class=%d\n",
				   priv->hist_data[i].powerclass);
			break;
		}
		for (j = 0; j < (MAX_BT_LINK + MAX_BLE_LINK); j++) {
			switch (priv->hist_data[i].link[j].txrxrate) {
			case BDR_RATE_1M:
				seq_printf(sfp,
					   "BT link[%d]: TxPower=%d dBm, TxRx Rate=BDR(1 mbps), RSSI=%d dBm\n",
					   j + 1,
					   priv->hist_data[i].link[j].txpower,
					   priv->hist_data[i].link[j].rssi);
				break;
			case EDR_RATE_2_3M:
				seq_printf(sfp,
					   "BT link[%d]: TxPower=%d dBm, TxRx Rate=EDR(2/3 mbps), RSSI=%d dBm\n",
					   j + 1,
					   priv->hist_data[i].link[j].txpower,
					   priv->hist_data[i].link[j].rssi);
				break;
			case BLE_RATE_1M:
				seq_printf(sfp,
					   "BLE link[%d]: TxPower=%d dBm, TxRx Rate=BLE(1 mbps), RSSI=%d dBm\n",
					   j - MAX_BT_LINK + 0x80,
					   priv->hist_data[i].link[j].txpower,
					   priv->hist_data[i].link[j].rssi);
				break;
			default:
				if (j < MAX_BT_LINK)
					seq_printf(sfp,
						   "BT link[%d]: TxPower=%d dBm, TxRx Rate=(%d), RSSI=%d dBm\n",
						   j + 1,
						   priv->hist_data[i].link[j].
						   txpower,
						   priv->hist_data[i].link[j].
						   txrxrate,
						   priv->hist_data[i].link[j].
						   rssi);
				else
					seq_printf(sfp,
						   "BLE link[%d]: TxPower=%d dBm, TxRx Rate=(%d), RSSI=%d dBm\n",
						   j - MAX_BT_LINK + 0x80,
						   priv->hist_data[i].link[j].
						   txpower,
						   priv->hist_data[i].link[j].
						   txrxrate,
						   priv->hist_data[i].link[j].
						   rssi);
				break;
			}
		}
		seq_printf(sfp, "\n");
	}
	LEAVE();
	return 0;
}
static int bt_histogram_read ( struct seq_file * sfp , void * data ) { bt_hist_proc_data * pdata = ( bt_hist_proc_data * ) sfp -> private ; bt_private * priv = ( bt_private * ) pdata -> pbt ; u8 ant_num ; int i , j ; ENTER ( ) ; if ( ! priv ) { LEAVE ( ) ; return - EFAULT ; } bt_get_histogram ( priv ) ; ant_num = priv -> hist_data_len / sizeof ( bt_histogram_data ) ; seq_printf ( sfp , " \n " ) ; seq_printf ( sfp , " \n \n " ) ; if ( ant_num < 1 ) { seq_printf ( sfp , " \n " ) ; LEAVE ( ) ; return 0 ; } for ( i = 0 ; i < ant_num ; i ++ ) { if ( pdata -> antenna != priv -> hist_data [ i ] . antenna ) continue ; seq_printf ( sfp , " \n " , priv -> hist_data [ i ] . antenna ) ; switch ( priv -> hist_data [ i ] . powerclass ) { case 2 : seq_printf ( sfp , " \n " ) ; break ; case 5 : seq_printf ( sfp , " \n " ) ; break ; case 6 : seq_printf ( sfp , " \n " ) ; break ; default : seq_printf ( sfp , " \n " , priv -> hist_data [ i ] . powerclass ) ; break ; } for ( j = 0 ; j < ( MAX_BT_LINK + MAX_BLE_LINK ) ; j ++ ) { switch ( priv -> hist_data [ i ] . link [ j ] . txrxrate ) { case BDR_RATE_1M : seq_printf ( sfp , " \n " , j + 1 , priv -> hist_data [ i ] . link [ j ] . txpower , priv -> hist_data [ i ] . link [ j ] . rssi ) ; break ; case EDR_RATE_2_3M : seq_printf ( sfp , " \n " , j + 1 , priv -> hist_data [ i ] . link [ j ] . txpower , priv -> hist_data [ i ] . link [ j ] . rssi ) ; break ; case BLE_RATE_1M : seq_printf ( sfp , " \n " , j - MAX_BT_LINK + 0x80 , priv -> hist_data [ i ] . link [ j ] . txpower , priv -> hist_data [ i ] . link [ j ] . rssi ) ; break ; default : if ( j < MAX_BT_LINK ) seq_printf ( sfp , " \n " , j + 1 , priv -> hist_data [ i ] . link [ j ] . txpower , priv -> hist_data [ i ] . link [ j ] . txrxrate , priv -> hist_data [ i ] . link [ j ] . rssi ) ; else seq_printf ( sfp , " \n " , j - MAX_BT_LINK + 0x80 , priv -> hist_data [ i ] . link [ j ] . txpower , priv -> hist_data [ i ] . link [ j ] . txrxrate , priv -> hist_data [ i ] . link [ j ] . rssi ) ; break ; } } seq_printf ( sfp , " \n " ) ; } LEAVE ( ) ; return 0 ; }
@brief Proc read function for histogram
  @param sfp     pointer to seq_file structure
  @param data
@brief Proc read function for histogram @param sfp pointer to seq_file structure @param data