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;
}
static int seek(u32 *frequency, int up, int mode)
{
	int ret = 0;
	struct tune_data_t tune_data;

	Si47xx_dev_wait_flag = SEEK_WAITING;
	ret = fmSeekStart(up, mode); /* mode 0 is full scan */
	wait();

	if (Si47xx_dev_wait_flag == SEEK_CANCEL) {
		ret = fmTuneStatus(1, 1, &tune_data);

		*frequency = 0;

		Si47xx_dev_wait_flag = NO_WAIT;

		return ret;
	}

	Si47xx_dev_wait_flag = NO_WAIT;

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

	ret = fmTuneStatus(0, 1, &tune_data);
	if (tune_data.bltf != 1)
		*frequency = tune_data.freq;

	else {
		if (tune_data.valid)
			*frequency = tune_data.freq;
		else
			*frequency = 0;
	}
	return ret;
}
int Si47xx_dev_chan_get(u32 *frequency)
{
	int ret = 0;
	struct tune_data_t tune_data;

	debug("Si47xx_dev_chan_get called\n");

	mutex_lock(&(Si47xx_dev->lock));

	if (Si47xx_dev->valid == eFALSE) {
		dev_err(Si47xx_dev->dev, "Si47xx_dev_chan_get called when DS is invalid");
		ret = -1;
	} else {
		ret = fmTuneStatus(0, 1, &tune_data);
		*frequency = tune_data.freq;
	}
	mutex_unlock(&(Si47xx_dev->lock));
	return ret;
}
int Si4709_dev_chan_get(u32 *frequency)
{
	int ret = 0;

	debug("Si4709_dev_chan_get called");

	mutex_lock(&(Si4709_dev.lock));

	if (Si4709_dev.valid == eFALSE) {
		debug("Si4709_dev_chan_get called when DS is invalid");
		ret = -1;
	} else {
		if (ret < 0)
			debug("Si4709_dev_chan_get i2c_read failed");
		else {
			fmTuneStatus(0, 0);
			*frequency = Freq;
		}
	}
	mutex_unlock(&(Si4709_dev.lock));
	return ret;
}