Lines Matching refs:fmdev

15 void fm_rx_reset_rds_cache(struct fmdev *fmdev)  in fm_rx_reset_rds_cache()  argument
17 fmdev->rx.rds.flag = FM_RDS_DISABLE; in fm_rx_reset_rds_cache()
18 fmdev->rx.rds.last_blk_idx = 0; in fm_rx_reset_rds_cache()
19 fmdev->rx.rds.wr_idx = 0; in fm_rx_reset_rds_cache()
20 fmdev->rx.rds.rd_idx = 0; in fm_rx_reset_rds_cache()
22 if (fmdev->rx.af_mode == FM_RX_RDS_AF_SWITCH_MODE_ON) in fm_rx_reset_rds_cache()
23 fmdev->irq_info.mask |= FM_LEV_EVENT; in fm_rx_reset_rds_cache()
26 void fm_rx_reset_station_info(struct fmdev *fmdev) in fm_rx_reset_station_info() argument
28 fmdev->rx.stat_info.picode = FM_NO_PI_CODE; in fm_rx_reset_station_info()
29 fmdev->rx.stat_info.afcache_size = 0; in fm_rx_reset_station_info()
30 fmdev->rx.stat_info.af_list_max = 0; in fm_rx_reset_station_info()
33 int fm_rx_set_freq(struct fmdev *fmdev, u32 freq) in fm_rx_set_freq() argument
41 if (freq < fmdev->rx.region.bot_freq || freq > fmdev->rx.region.top_freq) { in fm_rx_set_freq()
49 ret = fmc_send_cmd(fmdev, AUDIO_ENABLE_SET, REG_WR, &payload, in fm_rx_set_freq()
56 ret = fmc_send_cmd(fmdev, HILO_SET, REG_WR, &payload, in fm_rx_set_freq()
62 payload = (freq - fmdev->rx.region.bot_freq) / FM_FREQ_MUL; in fm_rx_set_freq()
64 ret = fmc_send_cmd(fmdev, FREQ_SET, REG_WR, &payload, in fm_rx_set_freq()
70 ret = fmc_send_cmd(fmdev, FLAG_GET, REG_RD, NULL, 2, NULL, NULL); in fm_rx_set_freq()
75 intr_flag = fmdev->irq_info.mask; in fm_rx_set_freq()
76 fmdev->irq_info.mask = (FM_FR_EVENT | FM_BL_EVENT); in fm_rx_set_freq()
77 payload = fmdev->irq_info.mask; in fm_rx_set_freq()
78 ret = fmc_send_cmd(fmdev, INT_MASK_SET, REG_WR, &payload, in fm_rx_set_freq()
85 ret = fmc_send_cmd(fmdev, TUNER_MODE_SET, REG_WR, &payload, in fm_rx_set_freq()
91 init_completion(&fmdev->maintask_comp); in fm_rx_set_freq()
92 timeleft = wait_for_completion_timeout(&fmdev->maintask_comp, in fm_rx_set_freq()
102 ret = fmc_send_cmd(fmdev, FREQ_SET, REG_RD, NULL, 2, &curr_frq, &resp_len); in fm_rx_set_freq()
107 curr_frq_in_khz = (fmdev->rx.region.bot_freq + ((u32)curr_frq * FM_FREQ_MUL)); in fm_rx_set_freq()
115 fmdev->rx.freq = curr_frq_in_khz; in fm_rx_set_freq()
118 fmdev->irq_info.mask = intr_flag; in fm_rx_set_freq()
119 payload = fmdev->irq_info.mask; in fm_rx_set_freq()
120 ret = fmc_send_cmd(fmdev, INT_MASK_SET, REG_WR, &payload, in fm_rx_set_freq()
126 fm_rx_reset_rds_cache(fmdev); in fm_rx_set_freq()
127 fm_rx_reset_station_info(fmdev); in fm_rx_set_freq()
132 static int fm_rx_set_channel_spacing(struct fmdev *fmdev, u32 spacing) in fm_rx_set_channel_spacing() argument
146 ret = fmc_send_cmd(fmdev, CHANL_BW_SET, REG_WR, &payload, in fm_rx_set_channel_spacing()
151 fmdev->rx.region.chanl_space = spacing * FM_FREQ_MUL; in fm_rx_set_channel_spacing()
156 int fm_rx_seek(struct fmdev *fmdev, u32 seek_upward, in fm_rx_seek() argument
167 ret = fm_rx_set_channel_spacing(fmdev, spacing); in fm_rx_seek()
174 ret = fmc_send_cmd(fmdev, FREQ_SET, REG_RD, NULL, in fm_rx_seek()
180 last_frq = (fmdev->rx.region.top_freq - fmdev->rx.region.bot_freq) / FM_FREQ_MUL; in fm_rx_seek()
183 space_idx = fmdev->rx.region.chanl_space / FM_FREQ_MUL; in fm_rx_seek()
201 ret = fmc_send_cmd(fmdev, FREQ_SET, REG_WR, &payload, in fm_rx_seek()
208 ret = fmc_send_cmd(fmdev, SEARCH_DIR_SET, REG_WR, &payload, in fm_rx_seek()
214 ret = fmc_send_cmd(fmdev, FLAG_GET, REG_RD, NULL, 2, NULL, NULL); in fm_rx_seek()
219 intr_flag = fmdev->irq_info.mask; in fm_rx_seek()
220 fmdev->irq_info.mask = (FM_FR_EVENT | FM_BL_EVENT); in fm_rx_seek()
221 payload = fmdev->irq_info.mask; in fm_rx_seek()
222 ret = fmc_send_cmd(fmdev, INT_MASK_SET, REG_WR, &payload, in fm_rx_seek()
229 ret = fmc_send_cmd(fmdev, TUNER_MODE_SET, REG_WR, &payload, in fm_rx_seek()
235 init_completion(&fmdev->maintask_comp); in fm_rx_seek()
236 timeleft = wait_for_completion_timeout(&fmdev->maintask_comp, in fm_rx_seek()
244 int_reason = fmdev->irq_info.flag & (FM_TUNE_COMPLETE | FM_BAND_LIMIT); in fm_rx_seek()
247 fmdev->irq_info.mask = intr_flag; in fm_rx_seek()
248 payload = fmdev->irq_info.mask; in fm_rx_seek()
249 ret = fmc_send_cmd(fmdev, INT_MASK_SET, REG_WR, &payload, in fm_rx_seek()
256 fmdev->rx.freq = seek_upward ? in fm_rx_seek()
257 fmdev->rx.region.top_freq : in fm_rx_seek()
258 fmdev->rx.region.bot_freq; in fm_rx_seek()
260 fmdev->rx.freq = seek_upward ? in fm_rx_seek()
261 fmdev->rx.region.bot_freq : in fm_rx_seek()
262 fmdev->rx.region.top_freq; in fm_rx_seek()
264 next_frq = (fmdev->rx.freq - in fm_rx_seek()
265 fmdev->rx.region.bot_freq) / FM_FREQ_MUL; in fm_rx_seek()
270 ret = fmc_send_cmd(fmdev, FREQ_SET, REG_RD, NULL, 2, in fm_rx_seek()
276 fmdev->rx.freq = (fmdev->rx.region.bot_freq + in fm_rx_seek()
281 fm_rx_reset_rds_cache(fmdev); in fm_rx_seek()
282 fm_rx_reset_station_info(fmdev); in fm_rx_seek()
287 int fm_rx_set_volume(struct fmdev *fmdev, u16 vol_to_set) in fm_rx_set_volume() argument
292 if (fmdev->curr_fmmode != FM_MODE_RX) in fm_rx_set_volume()
303 ret = fmc_send_cmd(fmdev, VOLUME_SET, REG_WR, &payload, in fm_rx_set_volume()
308 fmdev->rx.volume = vol_to_set; in fm_rx_set_volume()
313 int fm_rx_get_volume(struct fmdev *fmdev, u16 *curr_vol) in fm_rx_get_volume() argument
315 if (fmdev->curr_fmmode != FM_MODE_RX) in fm_rx_get_volume()
323 *curr_vol = fmdev->rx.volume / FM_RX_VOLUME_GAIN_STEP; in fm_rx_get_volume()
329 int fm_rx_get_band_freq_range(struct fmdev *fmdev, u32 *bot_freq, u32 *top_freq) in fm_rx_get_band_freq_range() argument
332 *bot_freq = fmdev->rx.region.bot_freq; in fm_rx_get_band_freq_range()
335 *top_freq = fmdev->rx.region.top_freq; in fm_rx_get_band_freq_range()
341 void fm_rx_get_region(struct fmdev *fmdev, u8 *region) in fm_rx_get_region() argument
343 *region = fmdev->rx.region.fm_band; in fm_rx_get_region()
347 int fm_rx_set_region(struct fmdev *fmdev, u8 region_to_set) in fm_rx_set_region() argument
359 if (fmdev->rx.region.fm_band == region_to_set) { in fm_rx_set_region()
366 ret = fmc_send_cmd(fmdev, BAND_SET, REG_WR, &payload, in fm_rx_set_region()
371 fmc_update_region_info(fmdev, region_to_set); in fm_rx_set_region()
374 if (fmdev->rx.freq < fmdev->rx.region.bot_freq) in fm_rx_set_region()
375 new_frq = fmdev->rx.region.bot_freq; in fm_rx_set_region()
376 else if (fmdev->rx.freq > fmdev->rx.region.top_freq) in fm_rx_set_region()
377 new_frq = fmdev->rx.region.top_freq; in fm_rx_set_region()
383 ret = fm_rx_set_freq(fmdev, new_frq); in fm_rx_set_region()
390 int fm_rx_get_mute_mode(struct fmdev *fmdev, u8 *curr_mute_mode) in fm_rx_get_mute_mode() argument
392 if (fmdev->curr_fmmode != FM_MODE_RX) in fm_rx_get_mute_mode()
400 *curr_mute_mode = fmdev->rx.mute_mode; in fm_rx_get_mute_mode()
405 static int fm_config_rx_mute_reg(struct fmdev *fmdev) in fm_config_rx_mute_reg() argument
411 switch (fmdev->rx.mute_mode) { in fm_config_rx_mute_reg()
424 if (fmdev->rx.rf_depend_mute == FM_RX_RF_DEPENDENT_MUTE_ON) in fm_config_rx_mute_reg()
430 ret = fmc_send_cmd(fmdev, MUTE_STATUS_SET, REG_WR, &payload, in fm_config_rx_mute_reg()
439 int fm_rx_set_mute_mode(struct fmdev *fmdev, u8 mute_mode_toset) in fm_rx_set_mute_mode() argument
444 if (fmdev->rx.mute_mode == mute_mode_toset) in fm_rx_set_mute_mode()
447 org_state = fmdev->rx.mute_mode; in fm_rx_set_mute_mode()
448 fmdev->rx.mute_mode = mute_mode_toset; in fm_rx_set_mute_mode()
450 ret = fm_config_rx_mute_reg(fmdev); in fm_rx_set_mute_mode()
452 fmdev->rx.mute_mode = org_state; in fm_rx_set_mute_mode()
460 int fm_rx_get_rfdepend_softmute(struct fmdev *fmdev, u8 *curr_mute_mode) in fm_rx_get_rfdepend_softmute() argument
462 if (fmdev->curr_fmmode != FM_MODE_RX) in fm_rx_get_rfdepend_softmute()
470 *curr_mute_mode = fmdev->rx.rf_depend_mute; in fm_rx_get_rfdepend_softmute()
476 int fm_rx_set_rfdepend_softmute(struct fmdev *fmdev, u8 rfdepend_mute) in fm_rx_set_rfdepend_softmute() argument
481 if (fmdev->curr_fmmode != FM_MODE_RX) in fm_rx_set_rfdepend_softmute()
489 if (fmdev->rx.rf_depend_mute == rfdepend_mute) in fm_rx_set_rfdepend_softmute()
492 org_state = fmdev->rx.rf_depend_mute; in fm_rx_set_rfdepend_softmute()
493 fmdev->rx.rf_depend_mute = rfdepend_mute; in fm_rx_set_rfdepend_softmute()
495 ret = fm_config_rx_mute_reg(fmdev); in fm_rx_set_rfdepend_softmute()
497 fmdev->rx.rf_depend_mute = org_state; in fm_rx_set_rfdepend_softmute()
505 int fm_rx_get_rssi_level(struct fmdev *fmdev, u16 *rssilvl) in fm_rx_get_rssi_level() argument
516 ret = fmc_send_cmd(fmdev, RSSI_LVL_GET, REG_RD, NULL, 2, in fm_rx_get_rssi_level()
530 int fm_rx_set_rssi_threshold(struct fmdev *fmdev, short rssi_lvl_toset) in fm_rx_set_rssi_threshold() argument
541 ret = fmc_send_cmd(fmdev, SEARCH_LVL_SET, REG_WR, &payload, in fm_rx_set_rssi_threshold()
546 fmdev->rx.rssi_threshold = rssi_lvl_toset; in fm_rx_set_rssi_threshold()
552 int fm_rx_get_rssi_threshold(struct fmdev *fmdev, short *curr_rssi_lvl) in fm_rx_get_rssi_threshold() argument
554 if (fmdev->curr_fmmode != FM_MODE_RX) in fm_rx_get_rssi_threshold()
562 *curr_rssi_lvl = fmdev->rx.rssi_threshold; in fm_rx_get_rssi_threshold()
568 int fm_rx_set_stereo_mono(struct fmdev *fmdev, u16 mode) in fm_rx_set_stereo_mono() argument
580 ret = fmc_send_cmd(fmdev, MOST_MODE_SET, REG_WR, &payload, in fm_rx_set_stereo_mono()
587 ret = fmc_send_cmd(fmdev, MOST_BLEND_SET, REG_WR, &payload, in fm_rx_set_stereo_mono()
596 int fm_rx_get_stereo_mono(struct fmdev *fmdev, u16 *mode) in fm_rx_get_stereo_mono() argument
607 ret = fmc_send_cmd(fmdev, MOST_MODE_SET, REG_RD, NULL, 2, in fm_rx_get_stereo_mono()
618 int fm_rx_set_deemphasis_mode(struct fmdev *fmdev, u16 mode) in fm_rx_set_deemphasis_mode() argument
623 if (fmdev->curr_fmmode != FM_MODE_RX) in fm_rx_set_deemphasis_mode()
633 ret = fmc_send_cmd(fmdev, DEMPH_MODE_SET, REG_WR, &payload, in fm_rx_set_deemphasis_mode()
638 fmdev->rx.deemphasis_mode = mode; in fm_rx_set_deemphasis_mode()
644 int fm_rx_get_deemph_mode(struct fmdev *fmdev, u16 *curr_deemphasis_mode) in fm_rx_get_deemph_mode() argument
646 if (fmdev->curr_fmmode != FM_MODE_RX) in fm_rx_get_deemph_mode()
654 *curr_deemphasis_mode = fmdev->rx.deemphasis_mode; in fm_rx_get_deemph_mode()
660 int fm_rx_set_rds_mode(struct fmdev *fmdev, u8 rds_en_dis) in fm_rx_set_rds_mode() argument
671 && fmdev->rx.rds.flag == FM_RDS_DISABLE) { in fm_rx_set_rds_mode()
674 ret = fmc_send_cmd(fmdev, POWER_SET, REG_WR, &payload, in fm_rx_set_rds_mode()
681 ret = fmc_send_cmd(fmdev, RDS_CNTRL_SET, REG_WR, &payload, in fm_rx_set_rds_mode()
687 ret = fmc_send_cmd(fmdev, FLAG_GET, REG_RD, NULL, 2, in fm_rx_set_rds_mode()
694 ret = fmc_send_cmd(fmdev, RDS_MEM_SET, REG_WR, &payload, in fm_rx_set_rds_mode()
700 fmdev->irq_info.mask |= FM_RDS_EVENT; in fm_rx_set_rds_mode()
701 payload = fmdev->irq_info.mask; in fm_rx_set_rds_mode()
702 ret = fmc_send_cmd(fmdev, INT_MASK_SET, REG_WR, &payload, in fm_rx_set_rds_mode()
705 fmdev->irq_info.mask &= ~FM_RDS_EVENT; in fm_rx_set_rds_mode()
710 fmdev->rx.rds.flag = FM_RDS_ENABLE; in fm_rx_set_rds_mode()
712 && fmdev->rx.rds.flag == FM_RDS_ENABLE) { in fm_rx_set_rds_mode()
715 ret = fmc_send_cmd(fmdev, POWER_SET, REG_WR, &payload, in fm_rx_set_rds_mode()
721 fmdev->rx.rds.last_blk_idx = 0; in fm_rx_set_rds_mode()
722 fmdev->rx.rds.wr_idx = 0; in fm_rx_set_rds_mode()
723 fmdev->rx.rds.rd_idx = 0; in fm_rx_set_rds_mode()
724 fm_rx_reset_station_info(fmdev); in fm_rx_set_rds_mode()
727 fmdev->irq_info.mask &= ~(FM_RDS_EVENT); in fm_rx_set_rds_mode()
728 fmdev->rx.rds.flag = FM_RDS_DISABLE; in fm_rx_set_rds_mode()
735 int fm_rx_get_rds_mode(struct fmdev *fmdev, u8 *curr_rds_en_dis) in fm_rx_get_rds_mode() argument
737 if (fmdev->curr_fmmode != FM_MODE_RX) in fm_rx_get_rds_mode()
745 *curr_rds_en_dis = fmdev->rx.rds.flag; in fm_rx_get_rds_mode()
751 int fm_rx_set_rds_system(struct fmdev *fmdev, u8 rds_mode) in fm_rx_set_rds_system() argument
756 if (fmdev->curr_fmmode != FM_MODE_RX) in fm_rx_set_rds_system()
765 ret = fmc_send_cmd(fmdev, RDS_SYSTEM_SET, REG_WR, &payload, in fm_rx_set_rds_system()
770 fmdev->rx.rds_mode = rds_mode; in fm_rx_set_rds_system()
776 int fm_rx_set_af_switch(struct fmdev *fmdev, u8 af_mode) in fm_rx_set_af_switch() argument
781 if (fmdev->curr_fmmode != FM_MODE_RX) in fm_rx_set_af_switch()
791 fmdev->irq_info.mask |= FM_LEV_EVENT; in fm_rx_set_af_switch()
793 fmdev->irq_info.mask &= ~FM_LEV_EVENT; in fm_rx_set_af_switch()
795 payload = fmdev->irq_info.mask; in fm_rx_set_af_switch()
796 ret = fmc_send_cmd(fmdev, INT_MASK_SET, REG_WR, &payload, in fm_rx_set_af_switch()
801 fmdev->rx.af_mode = af_mode; in fm_rx_set_af_switch()
807 int fm_rx_get_af_switch(struct fmdev *fmdev, u8 *af_mode) in fm_rx_get_af_switch() argument
809 if (fmdev->curr_fmmode != FM_MODE_RX) in fm_rx_get_af_switch()
817 *af_mode = fmdev->rx.af_mode; in fm_rx_get_af_switch()