summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHemant Gupta <hemant.gupta@stericsson.com>2011-09-28 21:10:39 +0530
committerPhilippe Langlais <philippe.langlais@stericsson.com>2012-05-22 11:06:02 +0200
commit1b0ab9fe1fdc2e67886e86e9720c12a2088f8455 (patch)
tree11bdbceeeb2bcbf76809fac384b1fdd503ea737a
parent0cd0b6e36ef740a9cf4759439537d36928a57133 (diff)
CG2900 FM Radio: Block Scan not working for non EU bands.
This patch fixes the issue of improper results while performing block scan on non EU bands. ST-Ericsson Linux next: NA ST-Ericsson ID: 363911 ST-Ericsson FOSS-OUT ID: Trivial Change-Id: I15d3ab6816e8f291f5b2ac87acd5a54f66d348ca Signed-off-by: Hemant Gupta <hemant.gupta@stericsson.com> Reviewed-on: http://gerrit.lud.stericsson.com/gerrit/32408 Tested-by: Johan PALMAEUS <johan.xj.palmaeus@stericsson.com> Reviewed-by: Anupam ROY <anupam.roy@stericsson.com> Reviewed-by: Anurag SRIVASTAVA <anurag.srivastava@stericsson.com> Reviewed-by: Johan PALMAEUS <johan.xj.palmaeus@stericsson.com>
-rw-r--r--drivers/media/radio/CG2900/cg2900_fm_api.c4
-rw-r--r--drivers/media/radio/CG2900/cg2900_fm_driver.c51
-rw-r--r--drivers/media/radio/CG2900/cg2900_fm_driver.h8
3 files changed, 46 insertions, 17 deletions
diff --git a/drivers/media/radio/CG2900/cg2900_fm_api.c b/drivers/media/radio/CG2900/cg2900_fm_api.c
index a50a4577f7d..9d809406687 100644
--- a/drivers/media/radio/CG2900/cg2900_fm_api.c
+++ b/drivers/media/radio/CG2900/cg2900_fm_api.c
@@ -1732,7 +1732,7 @@ int cg2900_fm_start_block_scan(
}
result = fmd_get_antenna(
&antenna);
- result = fmd_rx_block_scan(
+ result = fmd_block_scan(
start_freq/FREQUENCY_CONVERTOR_KHZ_HZ,
end_freq/FREQUENCY_CONVERTOR_KHZ_HZ,
antenna);
@@ -1771,7 +1771,7 @@ int cg2900_fm_get_block_scan_result(
cnt = 33;
while ((cnt--) && (result == 0)) {
/* Get all channels, including empty ones */
- result = fmd_rx_get_block_scan_result(
+ result = fmd_get_block_scan_result(
cnt * 6,
num_of_scanchan,
rssi);
diff --git a/drivers/media/radio/CG2900/cg2900_fm_driver.c b/drivers/media/radio/CG2900/cg2900_fm_driver.c
index acbdf63de0a..1d3a2552da2 100644
--- a/drivers/media/radio/CG2900/cg2900_fm_driver.c
+++ b/drivers/media/radio/CG2900/cg2900_fm_driver.c
@@ -190,6 +190,7 @@ struct fmd_rds_group {
* available for processing or not.
* @interrupt_queue: Circular Queue to store the received interrupt from chip.
* @gocmd: Command which is in progress.
+ * @mode: Current Mode of FM Radio.
* @rds_group: Array of RDS group Buffer
* @callback: Callback registered by upper layers.
*/
@@ -213,6 +214,7 @@ struct fmd_states_info {
bool interrupt_available_for_processing;
u16 interrupt_queue[MAX_COUNT_OF_IRQS];
enum fmd_gocmd gocmd;
+ enum fmd_mode mode;
struct fmd_rds_group rds_group[MAX_RDS_GROUPS];
fmd_radio_cb callback;
};
@@ -1788,6 +1790,7 @@ int fmd_init(void)
memset(&fmd_state_info, 0, sizeof(fmd_state_info));
fmd_state_info.fmd_initialized = true;
fmd_state_info.gocmd = FMD_STATE_NONE;
+ fmd_state_info.mode = FMD_MODE_IDLE;
fmd_state_info.callback = NULL;
fmd_state_info.rx_freq_range = FMD_FREQRANGE_EUROAMERICA;
fmd_state_info.rx_stereo_mode = FMD_STEREOMODE_BLENDING;
@@ -1926,10 +1929,12 @@ int fmd_set_mode(
goto error;
}
- if (fmd_get_cmd_sem())
+ if (fmd_get_cmd_sem()) {
err = -ETIME;
- else
- err = 0;
+ goto error;
+ }
+ fmd_state_info.mode = mode;
+ err = 0;
error:
return err;
@@ -2620,7 +2625,7 @@ error:
return err;
}
-int fmd_rx_block_scan(
+int fmd_block_scan(
u32 start_freq,
u32 stop_freq,
u8 antenna
@@ -2660,9 +2665,21 @@ int fmd_rx_block_scan(
}
/* Convert the start frequency to corresponsing channel */
- io_result = fmd_rx_frequency_to_channel(
- start_freq,
- &start_channel);
+ switch (fmd_state_info.mode) {
+ case FMD_MODE_RX:
+ io_result = fmd_rx_frequency_to_channel(
+ start_freq,
+ &start_channel);
+ break;
+ case FMD_MODE_TX:
+ io_result = fmd_tx_frequency_to_channel(
+ start_freq,
+ &start_channel);
+ break;
+ default:
+ err = -EINVAL;
+ goto error;
+ }
if (io_result != 0) {
err = io_result;
@@ -2670,9 +2687,21 @@ int fmd_rx_block_scan(
}
/* Convert the end frequency to corresponsing channel */
- io_result = fmd_rx_frequency_to_channel(
- stop_freq,
- &stop_channel);
+ switch (fmd_state_info.mode) {
+ case FMD_MODE_RX:
+ io_result = fmd_rx_frequency_to_channel(
+ stop_freq,
+ &stop_channel);
+ break;
+ case FMD_MODE_TX:
+ io_result = fmd_tx_frequency_to_channel(
+ stop_freq,
+ &stop_channel);
+ break;
+ default:
+ err = -EINVAL;
+ goto error;
+ }
if (io_result != 0) {
err = io_result;
@@ -2703,7 +2732,7 @@ error:
return err;
}
-int fmd_rx_get_block_scan_result(
+int fmd_get_block_scan_result(
u32 index,
u16 *num_channels,
u16 *rssi
diff --git a/drivers/media/radio/CG2900/cg2900_fm_driver.h b/drivers/media/radio/CG2900/cg2900_fm_driver.h
index 0c04bbaae23..fc5ec682714 100644
--- a/drivers/media/radio/CG2900/cg2900_fm_driver.h
+++ b/drivers/media/radio/CG2900/cg2900_fm_driver.h
@@ -1013,7 +1013,7 @@ int fmd_rx_get_scan_band_info(
);
/**
- * fmd_rx_block_scan() - Starts Block Scan.
+ * fmd_block_scan() - Starts Block Scan.
*
* Starts block scan for retriving the RSSI level of channels
* in the given block.
@@ -1029,14 +1029,14 @@ int fmd_rx_get_scan_band_info(
* -EBUSY, if FM Driver is not in idle state.
* -EINVAL, if wrong response received from chip.
*/
-int fmd_rx_block_scan(
+int fmd_block_scan(
u32 start_freq,
u32 stop_freq,
u8 antenna
);
/**
- * fmd_rx_get_block_scan_result() - Retrieves RSSI Level of channels.
+ * fmd_get_block_scan_result() - Retrieves RSSI Level of channels.
*
* Retrieves the RSSI level of the channels in the block.
* @index: (out) Index value to retrieve the channels.
@@ -1049,7 +1049,7 @@ int fmd_rx_block_scan(
* -EINVAL, if parameter is invalid.
* -EINVAL, if wrong response received from chip.
*/
-int fmd_rx_get_block_scan_result(
+int fmd_get_block_scan_result(
u32 index,
u16 *numchannels,
u16 *rssi