Lines Matching refs:radio
131 static int wl1273_fm_rds(struct wl1273_device *radio) in wl1273_fm_rds() argument
133 struct wl1273_core *core = radio->core; in wl1273_fm_rds()
170 dev_err(radio->dev, WL1273_FM_DRIVER_NAME in wl1273_fm_rds()
194 memcpy(&radio->buffer[radio->wr_index], &rds, RDS_BLOCK_SIZE); in wl1273_fm_rds()
195 radio->wr_index += 3; in wl1273_fm_rds()
198 if (radio->wr_index >= radio->buf_size) in wl1273_fm_rds()
199 radio->wr_index = 0; in wl1273_fm_rds()
202 if (radio->wr_index == radio->rd_index) { in wl1273_fm_rds()
203 dev_dbg(radio->dev, "RDS OVERFLOW"); in wl1273_fm_rds()
205 radio->rd_index = 0; in wl1273_fm_rds()
206 radio->wr_index = 0; in wl1273_fm_rds()
212 if (radio->wr_index != radio->rd_index) in wl1273_fm_rds()
213 wake_up_interruptible(&radio->read_queue); in wl1273_fm_rds()
220 struct wl1273_device *radio = dev_id; in wl1273_fm_irq_thread_handler() local
221 struct wl1273_core *core = radio->core; in wl1273_fm_irq_thread_handler()
230 radio->irq_received = flags; in wl1273_fm_irq_thread_handler()
231 dev_dbg(radio->dev, "IRQ: BL\n"); in wl1273_fm_irq_thread_handler()
237 wl1273_fm_rds(radio); in wl1273_fm_irq_thread_handler()
241 dev_dbg(radio->dev, "IRQ: BBLK\n"); in wl1273_fm_irq_thread_handler()
244 dev_dbg(radio->dev, "IRQ: LSYNC\n"); in wl1273_fm_irq_thread_handler()
254 dev_dbg(radio->dev, "IRQ: LEV: 0x%x04\n", level); in wl1273_fm_irq_thread_handler()
258 dev_dbg(radio->dev, "IRQ: IFFR\n"); in wl1273_fm_irq_thread_handler()
261 dev_dbg(radio->dev, "IRQ: PI\n"); in wl1273_fm_irq_thread_handler()
264 dev_dbg(radio->dev, "IRQ: PD\n"); in wl1273_fm_irq_thread_handler()
267 dev_dbg(radio->dev, "IRQ: STIC\n"); in wl1273_fm_irq_thread_handler()
270 dev_dbg(radio->dev, "IRQ: MAL\n"); in wl1273_fm_irq_thread_handler()
273 complete(&radio->busy); in wl1273_fm_irq_thread_handler()
274 dev_dbg(radio->dev, "NOT BUSY\n"); in wl1273_fm_irq_thread_handler()
275 dev_dbg(radio->dev, "IRQ: POW_ENB\n"); in wl1273_fm_irq_thread_handler()
279 dev_dbg(radio->dev, "IRQ: SCAN_OVER\n"); in wl1273_fm_irq_thread_handler()
282 dev_dbg(radio->dev, "IRQ: ERROR\n"); in wl1273_fm_irq_thread_handler()
287 dev_dbg(radio->dev, "IRQ: FR:\n"); in wl1273_fm_irq_thread_handler()
293 dev_err(radio->dev, in wl1273_fm_irq_thread_handler()
303 if (radio->band == WL1273_BAND_JAPAN) in wl1273_fm_irq_thread_handler()
304 radio->rx_frequency = WL1273_BAND_JAPAN_LOW + in wl1273_fm_irq_thread_handler()
307 radio->rx_frequency = WL1273_BAND_OTHER_LOW + in wl1273_fm_irq_thread_handler()
315 dev_dbg(radio->dev, "%dkHz\n", radio->rx_frequency); in wl1273_fm_irq_thread_handler()
322 dev_dbg(radio->dev, "%dkHz\n", freq); in wl1273_fm_irq_thread_handler()
324 dev_dbg(radio->dev, "%s: NOT BUSY\n", __func__); in wl1273_fm_irq_thread_handler()
328 core->write(core, WL1273_INT_MASK_SET, radio->irq_flags); in wl1273_fm_irq_thread_handler()
329 complete(&radio->busy); in wl1273_fm_irq_thread_handler()
334 static int wl1273_fm_set_tx_freq(struct wl1273_device *radio, unsigned int freq) in wl1273_fm_set_tx_freq() argument
336 struct wl1273_core *core = radio->core; in wl1273_fm_set_tx_freq()
341 dev_err(radio->dev, in wl1273_fm_set_tx_freq()
348 dev_err(radio->dev, in wl1273_fm_set_tx_freq()
360 dev_dbg(radio->dev, "%s: freq: %d kHz\n", __func__, freq); in wl1273_fm_set_tx_freq()
367 reinit_completion(&radio->busy); in wl1273_fm_set_tx_freq()
370 t = wait_for_completion_timeout(&radio->busy, msecs_to_jiffies(2000)); in wl1273_fm_set_tx_freq()
374 dev_dbg(radio->dev, "WL1273_CHANL_SET: %lu\n", t); in wl1273_fm_set_tx_freq()
381 reinit_completion(&radio->busy); in wl1273_fm_set_tx_freq()
384 t = wait_for_completion_timeout(&radio->busy, msecs_to_jiffies(1000)); in wl1273_fm_set_tx_freq()
388 radio->tx_frequency = freq; in wl1273_fm_set_tx_freq()
389 dev_dbg(radio->dev, "WL1273_POWER_ENB_SET: %lu\n", t); in wl1273_fm_set_tx_freq()
394 static int wl1273_fm_set_rx_freq(struct wl1273_device *radio, unsigned int freq) in wl1273_fm_set_rx_freq() argument
396 struct wl1273_core *core = radio->core; in wl1273_fm_set_rx_freq()
400 if (freq < radio->rangelow) { in wl1273_fm_set_rx_freq()
401 dev_err(radio->dev, in wl1273_fm_set_rx_freq()
403 radio->rangelow); in wl1273_fm_set_rx_freq()
408 if (freq > radio->rangehigh) { in wl1273_fm_set_rx_freq()
409 dev_err(radio->dev, in wl1273_fm_set_rx_freq()
411 radio->rangehigh); in wl1273_fm_set_rx_freq()
416 dev_dbg(radio->dev, "%s: %dkHz\n", __func__, freq); in wl1273_fm_set_rx_freq()
418 core->write(core, WL1273_INT_MASK_SET, radio->irq_flags); in wl1273_fm_set_rx_freq()
420 if (radio->band == WL1273_BAND_JAPAN) in wl1273_fm_set_rx_freq()
427 dev_err(radio->dev, "FREQ_SET fails\n"); in wl1273_fm_set_rx_freq()
433 dev_err(radio->dev, "TUNER_MODE_SET fails\n"); in wl1273_fm_set_rx_freq()
437 reinit_completion(&radio->busy); in wl1273_fm_set_rx_freq()
439 t = wait_for_completion_timeout(&radio->busy, msecs_to_jiffies(2000)); in wl1273_fm_set_rx_freq()
441 dev_err(radio->dev, "%s: TIMEOUT\n", __func__); in wl1273_fm_set_rx_freq()
445 radio->rd_index = 0; in wl1273_fm_set_rx_freq()
446 radio->wr_index = 0; in wl1273_fm_set_rx_freq()
447 radio->rx_frequency = freq; in wl1273_fm_set_rx_freq()
453 static int wl1273_fm_get_freq(struct wl1273_device *radio) in wl1273_fm_get_freq() argument
455 struct wl1273_core *core = radio->core; in wl1273_fm_get_freq()
465 dev_dbg(radio->dev, "Freq get: 0x%04x\n", f); in wl1273_fm_get_freq()
466 if (radio->band == WL1273_BAND_JAPAN) in wl1273_fm_get_freq()
489 static int wl1273_fm_upload_firmware_patch(struct wl1273_device *radio) in wl1273_fm_upload_firmware_patch() argument
491 struct wl1273_core *core = radio->core; in wl1273_fm_upload_firmware_patch()
495 struct device *dev = radio->dev; in wl1273_fm_upload_firmware_patch()
530 static int wl1273_fm_stop(struct wl1273_device *radio) in wl1273_fm_stop() argument
532 struct wl1273_core *core = radio->core; in wl1273_fm_stop()
538 dev_err(radio->dev, "%s: POWER_SET fails: %d\n", in wl1273_fm_stop()
544 dev_err(radio->dev, in wl1273_fm_stop()
550 dev_dbg(radio->dev, "Back to reset\n"); in wl1273_fm_stop()
556 static int wl1273_fm_start(struct wl1273_device *radio, int new_mode) in wl1273_fm_start() argument
558 struct wl1273_core *core = radio->core; in wl1273_fm_start()
560 struct device *dev = radio->dev; in wl1273_fm_start()
564 dev_dbg(radio->dev, "Out of reset\n"); in wl1273_fm_start()
573 if (radio->rds_on) in wl1273_fm_start()
589 radio->wr_index = 0; in wl1273_fm_start()
590 radio->rd_index = 0; in wl1273_fm_start()
605 if (radio->rds_on) { in wl1273_fm_start()
625 r = wl1273_fm_upload_firmware_patch(radio); in wl1273_fm_start()
636 if (radio->rds_on) in wl1273_fm_start()
663 static int wl1273_fm_suspend(struct wl1273_device *radio) in wl1273_fm_suspend() argument
665 struct wl1273_core *core = radio->core; in wl1273_fm_suspend()
679 dev_err(radio->dev, "%s: POWER_SET fails: %d\n", __func__, r); in wl1273_fm_suspend()
687 static int wl1273_fm_set_mode(struct wl1273_device *radio, int mode) in wl1273_fm_set_mode() argument
689 struct wl1273_core *core = radio->core; in wl1273_fm_set_mode()
690 struct device *dev = radio->dev; in wl1273_fm_set_mode()
695 dev_dbg(dev, "Forbidden modes: 0x%02x\n", radio->forbidden); in wl1273_fm_set_mode()
698 if (mode & radio->forbidden) { in wl1273_fm_set_mode()
706 r = wl1273_fm_start(radio, mode); in wl1273_fm_set_mode()
709 wl1273_fm_stop(radio); in wl1273_fm_set_mode()
714 r = core->write(core, WL1273_INT_MASK_SET, radio->irq_flags); in wl1273_fm_set_mode()
722 r = wl1273_fm_set_rx_freq(radio, radio->rx_frequency); in wl1273_fm_set_mode()
737 r = wl1273_fm_set_tx_freq(radio, radio->tx_frequency); in wl1273_fm_set_mode()
744 dev_dbg(radio->dev, "%s: Set audio mode.\n", __func__); in wl1273_fm_set_mode()
752 r = wl1273_fm_stop(radio); in wl1273_fm_set_mode()
761 r = wl1273_fm_suspend(radio); in wl1273_fm_set_mode()
781 static int wl1273_fm_set_seek(struct wl1273_device *radio, in wl1273_fm_set_seek() argument
786 struct wl1273_core *core = radio->core; in wl1273_fm_set_seek()
791 f = radio->rx_frequency; in wl1273_fm_set_seek()
792 dev_dbg(radio->dev, "rx_frequency: %d\n", f); in wl1273_fm_set_seek()
794 if (dir && f + radio->spacing <= radio->rangehigh) in wl1273_fm_set_seek()
795 r = wl1273_fm_set_rx_freq(radio, f + radio->spacing); in wl1273_fm_set_seek()
797 r = wl1273_fm_set_rx_freq(radio, radio->rangelow); in wl1273_fm_set_seek()
798 else if (f - radio->spacing >= radio->rangelow) in wl1273_fm_set_seek()
799 r = wl1273_fm_set_rx_freq(radio, f - radio->spacing); in wl1273_fm_set_seek()
801 r = wl1273_fm_set_rx_freq(radio, radio->rangehigh); in wl1273_fm_set_seek()
809 reinit_completion(&radio->busy); in wl1273_fm_set_seek()
810 dev_dbg(radio->dev, "%s: BUSY\n", __func__); in wl1273_fm_set_seek()
812 r = core->write(core, WL1273_INT_MASK_SET, radio->irq_flags); in wl1273_fm_set_seek()
816 dev_dbg(radio->dev, "%s\n", __func__); in wl1273_fm_set_seek()
831 wait_for_completion_timeout(&radio->busy, msecs_to_jiffies(1000)); in wl1273_fm_set_seek()
832 if (!(radio->irq_received & WL1273_BL_EVENT)) { in wl1273_fm_set_seek()
837 radio->irq_received &= ~WL1273_BL_EVENT; in wl1273_fm_set_seek()
843 dev_dbg(radio->dev, "Wrap around in HW seek.\n"); in wl1273_fm_set_seek()
846 f = radio->rangelow; in wl1273_fm_set_seek()
848 f = radio->rangehigh; in wl1273_fm_set_seek()
850 r = wl1273_fm_set_rx_freq(radio, f); in wl1273_fm_set_seek()
854 reinit_completion(&radio->busy); in wl1273_fm_set_seek()
855 dev_dbg(radio->dev, "%s: BUSY\n", __func__); in wl1273_fm_set_seek()
862 if (!wait_for_completion_timeout(&radio->busy, msecs_to_jiffies(1000))) in wl1273_fm_set_seek()
865 dev_dbg(radio->dev, "%s: Err: %d\n", __func__, r); in wl1273_fm_set_seek()
873 static unsigned int wl1273_fm_get_tx_ctune(struct wl1273_device *radio) in wl1273_fm_get_tx_ctune() argument
875 struct wl1273_core *core = radio->core; in wl1273_fm_get_tx_ctune()
876 struct device *dev = radio->dev; in wl1273_fm_get_tx_ctune()
902 static int wl1273_fm_set_preemphasis(struct wl1273_device *radio, in wl1273_fm_set_preemphasis() argument
905 struct wl1273_core *core = radio->core; in wl1273_fm_set_preemphasis()
934 radio->preemphasis = preemphasis; in wl1273_fm_set_preemphasis()
941 static int wl1273_fm_rds_on(struct wl1273_device *radio) in wl1273_fm_rds_on() argument
943 struct wl1273_core *core = radio->core; in wl1273_fm_rds_on()
946 dev_dbg(radio->dev, "%s\n", __func__); in wl1273_fm_rds_on()
947 if (radio->rds_on) in wl1273_fm_rds_on()
955 r = wl1273_fm_set_rx_freq(radio, radio->rx_frequency); in wl1273_fm_rds_on()
957 dev_err(radio->dev, "set freq fails: %d.\n", r); in wl1273_fm_rds_on()
962 static int wl1273_fm_rds_off(struct wl1273_device *radio) in wl1273_fm_rds_off() argument
964 struct wl1273_core *core = radio->core; in wl1273_fm_rds_off()
967 if (!radio->rds_on) in wl1273_fm_rds_off()
970 radio->irq_flags &= ~WL1273_RDS_EVENT; in wl1273_fm_rds_off()
972 r = core->write(core, WL1273_INT_MASK_SET, radio->irq_flags); in wl1273_fm_rds_off()
977 wake_up_interruptible(&radio->read_queue); in wl1273_fm_rds_off()
979 dev_dbg(radio->dev, "%s\n", __func__); in wl1273_fm_rds_off()
985 r = wl1273_fm_set_rx_freq(radio, radio->rx_frequency); in wl1273_fm_rds_off()
987 dev_err(radio->dev, "set freq fails: %d.\n", r); in wl1273_fm_rds_off()
989 dev_dbg(radio->dev, "%s: exiting...\n", __func__); in wl1273_fm_rds_off()
994 static int wl1273_fm_set_rds(struct wl1273_device *radio, unsigned int new_mode) in wl1273_fm_set_rds() argument
997 struct wl1273_core *core = radio->core; in wl1273_fm_set_rds()
1013 r = wl1273_fm_rds_off(radio); in wl1273_fm_set_rds()
1015 r = wl1273_fm_rds_on(radio); in wl1273_fm_set_rds()
1017 dev_err(radio->dev, "%s: Unknown mode: %d\n", in wl1273_fm_set_rds()
1023 radio->rds_on = (new_mode == WL1273_RDS_ON) ? true : false; in wl1273_fm_set_rds()
1031 struct wl1273_device *radio = video_get_drvdata(video_devdata(file)); in wl1273_fm_fops_write() local
1032 struct wl1273_core *core = radio->core; in wl1273_fm_fops_write()
1036 dev_dbg(radio->dev, "%s\n", __func__); in wl1273_fm_fops_write()
1041 if (radio->rds_users == 0) { in wl1273_fm_fops_write()
1042 dev_warn(radio->dev, "%s: RDS not on.\n", __func__); in wl1273_fm_fops_write()
1052 if (radio->owner && radio->owner != file) { in wl1273_fm_fops_write()
1056 radio->owner = file; in wl1273_fm_fops_write()
1066 if (copy_from_user(radio->write_buf + 1, buf, val)) { in wl1273_fm_fops_write()
1071 dev_dbg(radio->dev, "Count: %d\n", val); in wl1273_fm_fops_write()
1072 dev_dbg(radio->dev, "From user: \"%s\"\n", radio->write_buf); in wl1273_fm_fops_write()
1074 radio->write_buf[0] = WL1273_RDS_DATA_SET; in wl1273_fm_fops_write()
1075 core->write_data(core, radio->write_buf, val + 1); in wl1273_fm_fops_write()
1087 struct wl1273_device *radio = video_get_drvdata(video_devdata(file)); in wl1273_fm_fops_poll() local
1088 struct wl1273_core *core = radio->core; in wl1273_fm_fops_poll()
1090 if (radio->owner && radio->owner != file) in wl1273_fm_fops_poll()
1093 radio->owner = file; in wl1273_fm_fops_poll()
1096 poll_wait(file, &radio->read_queue, pts); in wl1273_fm_fops_poll()
1098 if (radio->rd_index != radio->wr_index) in wl1273_fm_fops_poll()
1110 struct wl1273_device *radio = video_get_drvdata(video_devdata(file)); in wl1273_fm_fops_open() local
1111 struct wl1273_core *core = radio->core; in wl1273_fm_fops_open()
1114 dev_dbg(radio->dev, "%s\n", __func__); in wl1273_fm_fops_open()
1116 if (core->mode == WL1273_MODE_RX && radio->rds_on && in wl1273_fm_fops_open()
1117 !radio->rds_users) { in wl1273_fm_fops_open()
1118 dev_dbg(radio->dev, "%s: Mode: %d\n", __func__, core->mode); in wl1273_fm_fops_open()
1123 radio->irq_flags |= WL1273_RDS_EVENT; in wl1273_fm_fops_open()
1126 radio->irq_flags); in wl1273_fm_fops_open()
1132 radio->rds_users++; in wl1273_fm_fops_open()
1142 struct wl1273_device *radio = video_get_drvdata(video_devdata(file)); in wl1273_fm_fops_release() local
1143 struct wl1273_core *core = radio->core; in wl1273_fm_fops_release()
1146 dev_dbg(radio->dev, "%s\n", __func__); in wl1273_fm_fops_release()
1148 if (radio->rds_users > 0) { in wl1273_fm_fops_release()
1149 radio->rds_users--; in wl1273_fm_fops_release()
1150 if (radio->rds_users == 0) { in wl1273_fm_fops_release()
1153 radio->irq_flags &= ~WL1273_RDS_EVENT; in wl1273_fm_fops_release()
1158 radio->irq_flags); in wl1273_fm_fops_release()
1168 if (file == radio->owner) in wl1273_fm_fops_release()
1169 radio->owner = NULL; in wl1273_fm_fops_release()
1178 struct wl1273_device *radio = video_get_drvdata(video_devdata(file)); in wl1273_fm_fops_read() local
1179 struct wl1273_core *core = radio->core; in wl1273_fm_fops_read()
1183 dev_dbg(radio->dev, "%s\n", __func__); in wl1273_fm_fops_read()
1188 if (radio->rds_users == 0) { in wl1273_fm_fops_read()
1189 dev_warn(radio->dev, "%s: RDS not on.\n", __func__); in wl1273_fm_fops_read()
1200 if (radio->owner && radio->owner != file) { in wl1273_fm_fops_read()
1204 radio->owner = file; in wl1273_fm_fops_read()
1208 dev_err(radio->dev, "%s: Get RDS_SYNC fails.\n", __func__); in wl1273_fm_fops_read()
1211 dev_info(radio->dev, "RDS_SYNC: Not synchronized\n"); in wl1273_fm_fops_read()
1217 while (radio->wr_index == radio->rd_index) { in wl1273_fm_fops_read()
1223 dev_dbg(radio->dev, "%s: Wait for RDS data.\n", __func__); in wl1273_fm_fops_read()
1224 if (wait_event_interruptible(radio->read_queue, in wl1273_fm_fops_read()
1225 radio->wr_index != in wl1273_fm_fops_read()
1226 radio->rd_index) < 0) { in wl1273_fm_fops_read()
1237 if (radio->rd_index == radio->wr_index) in wl1273_fm_fops_read()
1241 if (copy_to_user(buf, &radio->buffer[radio->rd_index], in wl1273_fm_fops_read()
1246 radio->rd_index += RDS_BLOCK_SIZE; in wl1273_fm_fops_read()
1247 if (radio->rd_index >= radio->buf_size) in wl1273_fm_fops_read()
1248 radio->rd_index = 0; in wl1273_fm_fops_read()
1257 dev_dbg(radio->dev, "%s: exit\n", __func__); in wl1273_fm_fops_read()
1276 struct wl1273_device *radio = video_get_drvdata(video_devdata(file)); in wl1273_fm_vidioc_querycap() local
1278 dev_dbg(radio->dev, "%s\n", __func__); in wl1273_fm_vidioc_querycap()
1284 strscpy(capability->bus_info, radio->bus_type, in wl1273_fm_vidioc_querycap()
1292 struct wl1273_device *radio = video_get_drvdata(video_devdata(file)); in wl1273_fm_vidioc_g_input() local
1294 dev_dbg(radio->dev, "%s\n", __func__); in wl1273_fm_vidioc_g_input()
1304 struct wl1273_device *radio = video_get_drvdata(video_devdata(file)); in wl1273_fm_vidioc_s_input() local
1306 dev_dbg(radio->dev, "%s\n", __func__); in wl1273_fm_vidioc_s_input()
1319 static int wl1273_fm_set_tx_power(struct wl1273_device *radio, u16 power) in wl1273_fm_set_tx_power() argument
1321 struct wl1273_core *core = radio->core; in wl1273_fm_set_tx_power()
1335 radio->tx_power = power; in wl1273_fm_set_tx_power()
1346 static int wl1273_fm_tx_set_spacing(struct wl1273_device *radio, in wl1273_fm_tx_set_spacing() argument
1349 struct wl1273_core *core = radio->core; in wl1273_fm_tx_set_spacing()
1355 radio->spacing = 100; in wl1273_fm_tx_set_spacing()
1359 radio->spacing = 50; in wl1273_fm_tx_set_spacing()
1363 radio->spacing = 100; in wl1273_fm_tx_set_spacing()
1367 radio->spacing = 200; in wl1273_fm_tx_set_spacing()
1375 struct wl1273_device *radio = ctrl->priv; in wl1273_fm_g_volatile_ctrl() local
1376 struct wl1273_core *core = radio->core; in wl1273_fm_g_volatile_ctrl()
1378 dev_dbg(radio->dev, "%s\n", __func__); in wl1273_fm_g_volatile_ctrl()
1385 ctrl->val = wl1273_fm_get_tx_ctune(radio); in wl1273_fm_g_volatile_ctrl()
1389 dev_warn(radio->dev, "%s: Unknown IOCTL: %d\n", in wl1273_fm_g_volatile_ctrl()
1412 struct wl1273_device *radio = to_radio(ctrl); in wl1273_fm_vidioc_s_ctrl() local
1413 struct wl1273_core *core = radio->core; in wl1273_fm_vidioc_s_ctrl()
1416 dev_dbg(radio->dev, "%s\n", __func__); in wl1273_fm_vidioc_s_ctrl()
1441 r = wl1273_fm_set_mode(radio, WL1273_MODE_OFF); in wl1273_fm_vidioc_s_ctrl()
1447 r = wl1273_fm_set_preemphasis(radio, ctrl->val); in wl1273_fm_vidioc_s_ctrl()
1451 r = wl1273_fm_set_tx_power(radio, ctrl->val); in wl1273_fm_vidioc_s_ctrl()
1455 dev_warn(radio->dev, "%s: Unknown IOCTL: %d\n", in wl1273_fm_vidioc_s_ctrl()
1460 dev_dbg(radio->dev, "%s\n", __func__); in wl1273_fm_vidioc_s_ctrl()
1467 struct wl1273_device *radio = video_get_drvdata(video_devdata(file)); in wl1273_fm_vidioc_g_audio() local
1469 dev_dbg(radio->dev, "%s\n", __func__); in wl1273_fm_vidioc_g_audio()
1483 struct wl1273_device *radio = video_get_drvdata(video_devdata(file)); in wl1273_fm_vidioc_s_audio() local
1485 dev_dbg(radio->dev, "%s\n", __func__); in wl1273_fm_vidioc_s_audio()
1499 struct wl1273_device *radio = video_get_drvdata(video_devdata(file)); in wl1273_fm_vidioc_g_tuner() local
1500 struct wl1273_core *core = radio->core; in wl1273_fm_vidioc_g_tuner()
1504 dev_dbg(radio->dev, "%s\n", __func__); in wl1273_fm_vidioc_g_tuner()
1519 if (radio->stereo) in wl1273_fm_vidioc_g_tuner()
1544 dev_dbg(radio->dev, "Signal: %d\n", tuner->signal); in wl1273_fm_vidioc_g_tuner()
1563 struct wl1273_device *radio = video_get_drvdata(video_devdata(file)); in wl1273_fm_vidioc_s_tuner() local
1564 struct wl1273_core *core = radio->core; in wl1273_fm_vidioc_s_tuner()
1567 dev_dbg(radio->dev, "%s\n", __func__); in wl1273_fm_vidioc_s_tuner()
1568 dev_dbg(radio->dev, "tuner->index: %d\n", tuner->index); in wl1273_fm_vidioc_s_tuner()
1569 dev_dbg(radio->dev, "tuner->name: %s\n", tuner->name); in wl1273_fm_vidioc_s_tuner()
1570 dev_dbg(radio->dev, "tuner->capability: 0x%04x\n", tuner->capability); in wl1273_fm_vidioc_s_tuner()
1571 dev_dbg(radio->dev, "tuner->rxsubchans: 0x%04x\n", tuner->rxsubchans); in wl1273_fm_vidioc_s_tuner()
1572 dev_dbg(radio->dev, "tuner->rangelow: %d\n", tuner->rangelow); in wl1273_fm_vidioc_s_tuner()
1573 dev_dbg(radio->dev, "tuner->rangehigh: %d\n", tuner->rangehigh); in wl1273_fm_vidioc_s_tuner()
1581 r = wl1273_fm_set_mode(radio, WL1273_MODE_RX); in wl1273_fm_vidioc_s_tuner()
1586 r = wl1273_fm_set_rds(radio, WL1273_RDS_ON); in wl1273_fm_vidioc_s_tuner()
1588 r = wl1273_fm_set_rds(radio, WL1273_RDS_OFF); in wl1273_fm_vidioc_s_tuner()
1591 dev_warn(radio->dev, "%s: RDS fails: %d\n", __func__, r); in wl1273_fm_vidioc_s_tuner()
1596 dev_warn(radio->dev, "%s: MOST_MODE fails: %d\n", in wl1273_fm_vidioc_s_tuner()
1600 radio->stereo = false; in wl1273_fm_vidioc_s_tuner()
1604 dev_warn(radio->dev, "%s: MOST_MODE fails: %d\n", in wl1273_fm_vidioc_s_tuner()
1608 radio->stereo = true; in wl1273_fm_vidioc_s_tuner()
1610 dev_err(radio->dev, "%s: tuner->audmode: %d\n", in wl1273_fm_vidioc_s_tuner()
1625 struct wl1273_device *radio = video_get_drvdata(video_devdata(file)); in wl1273_fm_vidioc_g_frequency() local
1626 struct wl1273_core *core = radio->core; in wl1273_fm_vidioc_g_frequency()
1628 dev_dbg(radio->dev, "%s\n", __func__); in wl1273_fm_vidioc_g_frequency()
1634 freq->frequency = WL1273_FREQ(wl1273_fm_get_freq(radio)); in wl1273_fm_vidioc_g_frequency()
1644 struct wl1273_device *radio = video_get_drvdata(video_devdata(file)); in wl1273_fm_vidioc_s_frequency() local
1645 struct wl1273_core *core = radio->core; in wl1273_fm_vidioc_s_frequency()
1648 dev_dbg(radio->dev, "%s: %d\n", __func__, freq->frequency); in wl1273_fm_vidioc_s_frequency()
1651 dev_dbg(radio->dev, in wl1273_fm_vidioc_s_frequency()
1660 dev_dbg(radio->dev, "freq: %d\n", freq->frequency); in wl1273_fm_vidioc_s_frequency()
1662 r = wl1273_fm_set_rx_freq(radio, in wl1273_fm_vidioc_s_frequency()
1665 dev_warn(radio->dev, WL1273_FM_DRIVER_NAME in wl1273_fm_vidioc_s_frequency()
1668 r = wl1273_fm_set_tx_freq(radio, in wl1273_fm_vidioc_s_frequency()
1671 dev_warn(radio->dev, WL1273_FM_DRIVER_NAME in wl1273_fm_vidioc_s_frequency()
1677 dev_dbg(radio->dev, "wl1273_vidioc_s_frequency: DONE\n"); in wl1273_fm_vidioc_s_frequency()
1686 struct wl1273_device *radio = video_get_drvdata(video_devdata(file)); in wl1273_fm_vidioc_s_hw_freq_seek() local
1687 struct wl1273_core *core = radio->core; in wl1273_fm_vidioc_s_hw_freq_seek()
1690 dev_dbg(radio->dev, "%s\n", __func__); in wl1273_fm_vidioc_s_hw_freq_seek()
1701 r = wl1273_fm_set_mode(radio, WL1273_MODE_RX); in wl1273_fm_vidioc_s_hw_freq_seek()
1705 r = wl1273_fm_tx_set_spacing(radio, seek->spacing); in wl1273_fm_vidioc_s_hw_freq_seek()
1707 dev_warn(radio->dev, "HW seek failed: %d\n", r); in wl1273_fm_vidioc_s_hw_freq_seek()
1709 r = wl1273_fm_set_seek(radio, seek->wrap_around, seek->seek_upward, in wl1273_fm_vidioc_s_hw_freq_seek()
1712 dev_warn(radio->dev, "HW seek failed: %d\n", r); in wl1273_fm_vidioc_s_hw_freq_seek()
1722 struct wl1273_device *radio = video_get_drvdata(video_devdata(file)); in wl1273_fm_vidioc_s_modulator() local
1723 struct wl1273_core *core = radio->core; in wl1273_fm_vidioc_s_modulator()
1726 dev_dbg(radio->dev, "%s\n", __func__); in wl1273_fm_vidioc_s_modulator()
1734 r = wl1273_fm_set_mode(radio, WL1273_MODE_TX); in wl1273_fm_vidioc_s_modulator()
1739 r = wl1273_fm_set_rds(radio, WL1273_RDS_ON); in wl1273_fm_vidioc_s_modulator()
1741 r = wl1273_fm_set_rds(radio, WL1273_RDS_OFF); in wl1273_fm_vidioc_s_modulator()
1749 dev_warn(radio->dev, WL1273_FM_DRIVER_NAME in wl1273_fm_vidioc_s_modulator()
1760 struct wl1273_device *radio = video_get_drvdata(video_devdata(file)); in wl1273_fm_vidioc_g_modulator() local
1761 struct wl1273_core *core = radio->core; in wl1273_fm_vidioc_g_modulator()
1765 dev_dbg(radio->dev, "%s\n", __func__); in wl1273_fm_vidioc_g_modulator()
1791 if (radio->rds_on) in wl1273_fm_vidioc_g_modulator()
1801 struct wl1273_device *radio = video_get_drvdata(video_devdata(file)); in wl1273_fm_vidioc_log_status() local
1802 struct wl1273_core *core = radio->core; in wl1273_fm_vidioc_log_status()
1803 struct device *dev = radio->dev; in wl1273_fm_vidioc_log_status()
1856 int bf = radio->rangelow; in wl1273_fm_vidioc_log_status()
1982 struct wl1273_device *radio = platform_get_drvdata(pdev); in wl1273_fm_radio_remove() local
1983 struct wl1273_core *core = radio->core; in wl1273_fm_radio_remove()
1987 free_irq(core->client->irq, radio); in wl1273_fm_radio_remove()
1990 v4l2_ctrl_handler_free(&radio->ctrl_handler); in wl1273_fm_radio_remove()
1991 video_unregister_device(&radio->videodev); in wl1273_fm_radio_remove()
1992 v4l2_device_unregister(&radio->v4l2dev); in wl1273_fm_radio_remove()
2000 struct wl1273_device *radio; in wl1273_fm_radio_probe() local
2012 radio = devm_kzalloc(&pdev->dev, sizeof(*radio), GFP_KERNEL); in wl1273_fm_radio_probe()
2013 if (!radio) { in wl1273_fm_radio_probe()
2019 radio->buf_size = rds_buf * RDS_BLOCK_SIZE; in wl1273_fm_radio_probe()
2020 radio->buffer = devm_kzalloc(&pdev->dev, radio->buf_size, GFP_KERNEL); in wl1273_fm_radio_probe()
2021 if (!radio->buffer) { in wl1273_fm_radio_probe()
2027 radio->core = *core; in wl1273_fm_radio_probe()
2028 radio->irq_flags = WL1273_IRQ_MASK; in wl1273_fm_radio_probe()
2029 radio->dev = &radio->core->client->dev; in wl1273_fm_radio_probe()
2030 radio->rds_on = false; in wl1273_fm_radio_probe()
2031 radio->core->mode = WL1273_MODE_OFF; in wl1273_fm_radio_probe()
2032 radio->tx_power = 118; in wl1273_fm_radio_probe()
2033 radio->core->audio_mode = WL1273_AUDIO_ANALOG; in wl1273_fm_radio_probe()
2034 radio->band = WL1273_BAND_OTHER; in wl1273_fm_radio_probe()
2035 radio->core->i2s_mode = WL1273_I2S_DEF_MODE; in wl1273_fm_radio_probe()
2036 radio->core->channel_number = 2; in wl1273_fm_radio_probe()
2037 radio->core->volume = WL1273_DEFAULT_VOLUME; in wl1273_fm_radio_probe()
2038 radio->rx_frequency = WL1273_BAND_OTHER_LOW; in wl1273_fm_radio_probe()
2039 radio->tx_frequency = WL1273_BAND_OTHER_HIGH; in wl1273_fm_radio_probe()
2040 radio->rangelow = WL1273_BAND_OTHER_LOW; in wl1273_fm_radio_probe()
2041 radio->rangehigh = WL1273_BAND_OTHER_HIGH; in wl1273_fm_radio_probe()
2042 radio->stereo = true; in wl1273_fm_radio_probe()
2043 radio->bus_type = "I2C"; in wl1273_fm_radio_probe()
2045 if (radio->core->pdata->request_resources) { in wl1273_fm_radio_probe()
2046 r = radio->core->pdata->request_resources(radio->core->client); in wl1273_fm_radio_probe()
2048 dev_err(radio->dev, WL1273_FM_DRIVER_NAME in wl1273_fm_radio_probe()
2053 dev_dbg(radio->dev, "irq: %d\n", radio->core->client->irq); in wl1273_fm_radio_probe()
2055 r = request_threaded_irq(radio->core->client->irq, NULL, in wl1273_fm_radio_probe()
2058 "wl1273-fm", radio); in wl1273_fm_radio_probe()
2060 dev_err(radio->dev, WL1273_FM_DRIVER_NAME in wl1273_fm_radio_probe()
2065 dev_err(radio->dev, WL1273_FM_DRIVER_NAME ": Core WL1273 IRQ not configured"); in wl1273_fm_radio_probe()
2070 init_completion(&radio->busy); in wl1273_fm_radio_probe()
2071 init_waitqueue_head(&radio->read_queue); in wl1273_fm_radio_probe()
2073 radio->write_buf = devm_kzalloc(&pdev->dev, 256, GFP_KERNEL); in wl1273_fm_radio_probe()
2074 if (!radio->write_buf) { in wl1273_fm_radio_probe()
2079 radio->dev = &pdev->dev; in wl1273_fm_radio_probe()
2080 radio->v4l2dev.ctrl_handler = &radio->ctrl_handler; in wl1273_fm_radio_probe()
2081 radio->rds_users = 0; in wl1273_fm_radio_probe()
2083 r = v4l2_device_register(&pdev->dev, &radio->v4l2dev); in wl1273_fm_radio_probe()
2090 radio->videodev = wl1273_viddev_template; in wl1273_fm_radio_probe()
2092 radio->videodev.v4l2_dev = &radio->v4l2dev; in wl1273_fm_radio_probe()
2094 v4l2_ctrl_handler_init(&radio->ctrl_handler, 6); in wl1273_fm_radio_probe()
2097 v4l2_ctrl_new_std(&radio->ctrl_handler, &wl1273_ctrl_ops, in wl1273_fm_radio_probe()
2101 v4l2_ctrl_new_std(&radio->ctrl_handler, &wl1273_ctrl_ops, in wl1273_fm_radio_probe()
2104 v4l2_ctrl_new_std_menu(&radio->ctrl_handler, &wl1273_ctrl_ops, in wl1273_fm_radio_probe()
2109 v4l2_ctrl_new_std(&radio->ctrl_handler, &wl1273_ctrl_ops, in wl1273_fm_radio_probe()
2112 ctrl = v4l2_ctrl_new_std(&radio->ctrl_handler, &wl1273_ctrl_ops, in wl1273_fm_radio_probe()
2118 if (radio->ctrl_handler.error) { in wl1273_fm_radio_probe()
2119 r = radio->ctrl_handler.error; in wl1273_fm_radio_probe()
2124 video_set_drvdata(&radio->videodev, radio); in wl1273_fm_radio_probe()
2125 platform_set_drvdata(pdev, radio); in wl1273_fm_radio_probe()
2128 r = video_register_device(&radio->videodev, VFL_TYPE_RADIO, radio_nr); in wl1273_fm_radio_probe()
2138 v4l2_ctrl_handler_free(&radio->ctrl_handler); in wl1273_fm_radio_probe()
2139 v4l2_device_unregister(&radio->v4l2dev); in wl1273_fm_radio_probe()
2141 free_irq(radio->core->client->irq, radio); in wl1273_fm_radio_probe()
2143 radio->core->pdata->free_resources(); in wl1273_fm_radio_probe()