static int tune_freq(u32 frequency)
{
	int ret;

	u16 channel;
	struct tune_data_t tune_data;
	mutex_lock(&(Si47xx_dev->lock));

	channel = freq_to_channel(frequency);

	Si47xx_dev_wait_flag = TUNE_WAITING;
	ret = fmTuneFreq(frequency);
	wait();
	Si47xx_dev_wait_flag = NO_WAIT;
	debug("Si47xx_dev_wait_flag = TUNE_WAITING\n");

	if (!(getIntStatus() & STCINT)) {
		dev_err(Si47xx_dev->dev, "%s tune is failed!\n", __func__);
		fmTuneStatus(1, 1, &tune_data);
		mutex_unlock(&(Si47xx_dev->lock));
		return -1;
	}

	ret = fmTuneStatus(0, 1, &tune_data);

	mutex_unlock(&(Si47xx_dev->lock));

	return ret;
}
int sme_proc_obss_scan(struct wpa_supplicant *wpa_s)
{
	struct wpa_bss *bss;
	const u8 *ie;
	u16 ht_cap;
	u8 chan_list[P2P_MAX_CHANNELS], channel;
	u8 num_channels = 0, num_intol = 0, i;

	if (!wpa_s->sme.sched_obss_scan)
		return 0;

	wpa_s->sme.sched_obss_scan = 0;
	if (!wpa_s->current_bss || wpa_s->wpa_state != WPA_COMPLETED)
		return 1;

	/*
	 * Check whether AP uses regulatory triplet or channel triplet in
	 * country info. Right now the operating class of the BSS channel
	 * width trigger event is "unknown" (IEEE Std 802.11-2012 10.15.12),
	 * based on the assumption that operating class triplet is not used in
	 * beacon frame. If the First Channel Number/Operating Extension
	 * Identifier octet has a positive integer value of 201 or greater,
	 * then its operating class triplet.
	 *
	 * TODO: If Supported Operating Classes element is present in beacon
	 * frame, have to lookup operating class in Annex E and fill them in
	 * 2040 coex frame.
	 */
	ie = wpa_bss_get_ie(wpa_s->current_bss, WLAN_EID_COUNTRY);
	if (ie && (ie[1] >= 6) && (ie[5] >= 201))
		return 1;

	os_memset(chan_list, 0, sizeof(chan_list));

	dl_list_for_each(bss, &wpa_s->bss, struct wpa_bss, list) {
		/* Skip other band bss */
		if (freq_to_channel(bss->freq, &channel) != WPAS_BAND_2GHZ)
			continue;

		ie = wpa_bss_get_ie(bss, WLAN_EID_HT_CAP);
		ht_cap = (ie && (ie[1] == 26)) ? WPA_GET_LE16(ie + 2) : 0;

		if (!ht_cap || (ht_cap & HT_CAP_INFO_40MHZ_INTOLERANT)) {
			/* Check whether the channel is already considered */
			for (i = 0; i < num_channels; i++) {
				if (channel == chan_list[i])
					break;
			}
			if (i != num_channels)
				continue;

			if (ht_cap & HT_CAP_INFO_40MHZ_INTOLERANT)
				num_intol++;

			chan_list[num_channels++] = channel;
		}
	}

	sme_send_2040_bss_coex(wpa_s, chan_list, num_channels, num_intol);
	return 1;
}