Lines Matching refs:core
77 struct wl1273_core *core; member
95 static int wl1273_fm_write_fw(struct wl1273_core *core, in wl1273_fm_write_fw() argument
98 struct i2c_client *client = core->client; in wl1273_fm_write_fw()
133 struct wl1273_core *core = radio->core; in wl1273_fm_rds() local
134 struct i2c_client *client = core->client; in wl1273_fm_rds()
154 if (core->mode != WL1273_MODE_RX) in wl1273_fm_rds()
157 r = core->read(core, WL1273_RDS_SYNC_GET, &val); in wl1273_fm_rds()
221 struct wl1273_core *core = radio->core; in wl1273_fm_irq_thread_handler() local
225 r = core->read(core, WL1273_FLAG_GET, &flags); in wl1273_fm_irq_thread_handler()
249 r = core->read(core, WL1273_RSSI_LVL_GET, &level); in wl1273_fm_irq_thread_handler()
289 if (core->mode == WL1273_MODE_RX) { in wl1273_fm_irq_thread_handler()
290 r = core->write(core, WL1273_TUNER_MODE_SET, in wl1273_fm_irq_thread_handler()
299 r = core->read(core, WL1273_FREQ_SET, &freq); in wl1273_fm_irq_thread_handler()
318 r = core->read(core, WL1273_CHANL_SET, &freq); in wl1273_fm_irq_thread_handler()
328 core->write(core, WL1273_INT_MASK_SET, radio->irq_flags); in wl1273_fm_irq_thread_handler()
336 struct wl1273_core *core = radio->core; in wl1273_fm_set_tx_freq() local
363 r = core->write(core, WL1273_CHANL_SET, freq / 10); in wl1273_fm_set_tx_freq()
377 r = core->write(core, WL1273_POWER_ENB_SET, 1); in wl1273_fm_set_tx_freq()
396 struct wl1273_core *core = radio->core; in wl1273_fm_set_rx_freq() local
418 core->write(core, WL1273_INT_MASK_SET, radio->irq_flags); in wl1273_fm_set_rx_freq()
425 r = core->write(core, WL1273_FREQ_SET, f); in wl1273_fm_set_rx_freq()
431 r = core->write(core, WL1273_TUNER_MODE_SET, TUNER_MODE_PRESET); in wl1273_fm_set_rx_freq()
455 struct wl1273_core *core = radio->core; in wl1273_fm_get_freq() local
460 if (core->mode == WL1273_MODE_RX) { in wl1273_fm_get_freq()
461 r = core->read(core, WL1273_FREQ_SET, &f); in wl1273_fm_get_freq()
471 r = core->read(core, WL1273_CHANL_SET, &f); in wl1273_fm_get_freq()
491 struct wl1273_core *core = radio->core; in wl1273_fm_upload_firmware_patch() local
515 r = wl1273_fm_write_fw(core, ptr + 1, packet_num); in wl1273_fm_upload_firmware_patch()
522 core->write(core, WL1273_RESET, 0); in wl1273_fm_upload_firmware_patch()
532 struct wl1273_core *core = radio->core; in wl1273_fm_stop() local
534 if (core->mode == WL1273_MODE_RX) { in wl1273_fm_stop()
535 int r = core->write(core, WL1273_POWER_SET, in wl1273_fm_stop()
540 } else if (core->mode == WL1273_MODE_TX) { in wl1273_fm_stop()
541 int r = core->write(core, WL1273_PUPD_SET, in wl1273_fm_stop()
548 if (core->pdata->disable) { in wl1273_fm_stop()
549 core->pdata->disable(); in wl1273_fm_stop()
558 struct wl1273_core *core = radio->core; in wl1273_fm_start() local
559 struct wl1273_fm_platform_data *pdata = core->pdata; in wl1273_fm_start()
563 if (pdata->enable && core->mode == WL1273_MODE_OFF) { in wl1273_fm_start()
577 r = core->write(core, WL1273_POWER_SET, val); in wl1273_fm_start()
581 r = core->write(core, WL1273_POWER_SET, val); in wl1273_fm_start()
594 r = core->write(core, WL1273_PUPD_SET, WL1273_PUPD_SET_ON); in wl1273_fm_start()
597 r = core->write(core, WL1273_PUPD_SET, in wl1273_fm_start()
606 r = core->write(core, WL1273_RDS_DATA_ENB, 1); in wl1273_fm_start()
613 r = core->write(core, WL1273_RDS_DATA_ENB, 0); in wl1273_fm_start()
624 if (core->mode == WL1273_MODE_OFF) { in wl1273_fm_start()
639 r = core->write(core, WL1273_POWER_SET, val); in wl1273_fm_start()
645 r = core->write(core, WL1273_PUPD_SET, in wl1273_fm_start()
665 struct wl1273_core *core = radio->core; in wl1273_fm_suspend() local
669 if (core->mode == WL1273_MODE_RX) in wl1273_fm_suspend()
670 r = core->write(core, WL1273_POWER_SET, in wl1273_fm_suspend()
672 else if (core->mode == WL1273_MODE_TX) in wl1273_fm_suspend()
673 r = core->write(core, WL1273_PUPD_SET, in wl1273_fm_suspend()
689 struct wl1273_core *core = radio->core; in wl1273_fm_set_mode() local
697 old_mode = core->mode; in wl1273_fm_set_mode()
713 core->mode = mode; in wl1273_fm_set_mode()
714 r = core->write(core, WL1273_INT_MASK_SET, radio->irq_flags); in wl1273_fm_set_mode()
728 r = core->set_volume(core, core->volume); in wl1273_fm_set_mode()
735 core->volume); in wl1273_fm_set_mode()
746 r = core->set_audio(core, core->audio_mode); in wl1273_fm_set_mode()
756 core->mode = WL1273_MODE_OFF; in wl1273_fm_set_mode()
765 core->mode = WL1273_MODE_SUSPENDED; in wl1273_fm_set_mode()
776 core->mode = old_mode; in wl1273_fm_set_mode()
786 struct wl1273_core *core = radio->core; in wl1273_fm_set_seek() local
812 r = core->write(core, WL1273_INT_MASK_SET, radio->irq_flags); in wl1273_fm_set_seek()
818 r = core->write(core, WL1273_SEARCH_LVL_SET, level); in wl1273_fm_set_seek()
822 r = core->write(core, WL1273_SEARCH_DIR_SET, dir); in wl1273_fm_set_seek()
826 r = core->write(core, WL1273_TUNER_MODE_SET, TUNER_MODE_AUTO_SEEK); in wl1273_fm_set_seek()
857 r = core->write(core, WL1273_TUNER_MODE_SET, TUNER_MODE_AUTO_SEEK); in wl1273_fm_set_seek()
875 struct wl1273_core *core = radio->core; in wl1273_fm_get_tx_ctune() local
880 if (core->mode == WL1273_MODE_OFF || in wl1273_fm_get_tx_ctune()
881 core->mode == WL1273_MODE_SUSPENDED) in wl1273_fm_get_tx_ctune()
884 r = core->read(core, WL1273_READ_FMANT_TUNE_VALUE, &val); in wl1273_fm_get_tx_ctune()
905 struct wl1273_core *core = radio->core; in wl1273_fm_set_preemphasis() local
909 if (core->mode == WL1273_MODE_OFF || in wl1273_fm_set_preemphasis()
910 core->mode == WL1273_MODE_SUSPENDED) in wl1273_fm_set_preemphasis()
913 mutex_lock(&core->lock); in wl1273_fm_set_preemphasis()
930 r = core->write(core, WL1273_PREMPH_SET, em); in wl1273_fm_set_preemphasis()
937 mutex_unlock(&core->lock); in wl1273_fm_set_preemphasis()
943 struct wl1273_core *core = radio->core; in wl1273_fm_rds_on() local
950 r = core->write(core, WL1273_POWER_SET, in wl1273_fm_rds_on()
964 struct wl1273_core *core = radio->core; in wl1273_fm_rds_off() local
972 r = core->write(core, WL1273_INT_MASK_SET, radio->irq_flags); in wl1273_fm_rds_off()
981 r = core->write(core, WL1273_POWER_SET, WL1273_POWER_SET_FM); in wl1273_fm_rds_off()
997 struct wl1273_core *core = radio->core; in wl1273_fm_set_rds() local
999 if (core->mode == WL1273_MODE_OFF || in wl1273_fm_set_rds()
1000 core->mode == WL1273_MODE_SUSPENDED) in wl1273_fm_set_rds()
1004 r = core->write(core, WL1273_RDS_CNTRL_SET, 1); in wl1273_fm_set_rds()
1008 if (core->mode == WL1273_MODE_TX && new_mode == WL1273_RDS_OFF) { in wl1273_fm_set_rds()
1009 r = core->write(core, WL1273_RDS_DATA_ENB, 0); in wl1273_fm_set_rds()
1010 } else if (core->mode == WL1273_MODE_TX && new_mode == WL1273_RDS_ON) { in wl1273_fm_set_rds()
1011 r = core->write(core, WL1273_RDS_DATA_ENB, 1); in wl1273_fm_set_rds()
1012 } else if (core->mode == WL1273_MODE_RX && new_mode == WL1273_RDS_OFF) { in wl1273_fm_set_rds()
1014 } else if (core->mode == WL1273_MODE_RX && new_mode == WL1273_RDS_ON) { in wl1273_fm_set_rds()
1032 struct wl1273_core *core = radio->core; in wl1273_fm_fops_write() local
1038 if (core->mode != WL1273_MODE_TX) in wl1273_fm_fops_write()
1046 if (mutex_lock_interruptible(&core->lock)) in wl1273_fm_fops_write()
1064 core->write(core, WL1273_RDS_CONFIG_DATA_SET, val); in wl1273_fm_fops_write()
1075 core->write_data(core, radio->write_buf, val + 1); in wl1273_fm_fops_write()
1079 mutex_unlock(&core->lock); in wl1273_fm_fops_write()
1088 struct wl1273_core *core = radio->core; in wl1273_fm_fops_poll() local
1095 if (core->mode == WL1273_MODE_RX) { in wl1273_fm_fops_poll()
1101 } else if (core->mode == WL1273_MODE_TX) { in wl1273_fm_fops_poll()
1111 struct wl1273_core *core = radio->core; in wl1273_fm_fops_open() local
1116 if (core->mode == WL1273_MODE_RX && radio->rds_on && in wl1273_fm_fops_open()
1118 dev_dbg(radio->dev, "%s: Mode: %d\n", __func__, core->mode); in wl1273_fm_fops_open()
1120 if (mutex_lock_interruptible(&core->lock)) in wl1273_fm_fops_open()
1125 r = core->write(core, WL1273_INT_MASK_SET, in wl1273_fm_fops_open()
1128 mutex_unlock(&core->lock); in wl1273_fm_fops_open()
1134 mutex_unlock(&core->lock); in wl1273_fm_fops_open()
1143 struct wl1273_core *core = radio->core; in wl1273_fm_fops_release() local
1151 mutex_lock(&core->lock); in wl1273_fm_fops_release()
1155 if (core->mode == WL1273_MODE_RX) { in wl1273_fm_fops_release()
1156 r = core->write(core, in wl1273_fm_fops_release()
1160 mutex_unlock(&core->lock); in wl1273_fm_fops_release()
1164 mutex_unlock(&core->lock); in wl1273_fm_fops_release()
1179 struct wl1273_core *core = radio->core; in wl1273_fm_fops_read() local
1185 if (core->mode != WL1273_MODE_RX) in wl1273_fm_fops_read()
1193 if (mutex_lock_interruptible(&core->lock)) in wl1273_fm_fops_read()
1206 r = core->read(core, WL1273_RDS_SYNC_GET, &val); in wl1273_fm_fops_read()
1258 mutex_unlock(&core->lock); in wl1273_fm_fops_read()
1321 struct wl1273_core *core = radio->core; in wl1273_fm_set_tx_power() local
1324 if (core->mode == WL1273_MODE_OFF || in wl1273_fm_set_tx_power()
1325 core->mode == WL1273_MODE_SUSPENDED) in wl1273_fm_set_tx_power()
1328 mutex_lock(&core->lock); in wl1273_fm_set_tx_power()
1331 r = core->write(core, WL1273_POWER_LEV_SET, 122 - power); in wl1273_fm_set_tx_power()
1338 mutex_unlock(&core->lock); in wl1273_fm_set_tx_power()
1349 struct wl1273_core *core = radio->core; in wl1273_fm_tx_set_spacing() local
1353 r = core->write(core, WL1273_SCAN_SPACING_SET, in wl1273_fm_tx_set_spacing()
1357 r = core->write(core, WL1273_SCAN_SPACING_SET, in wl1273_fm_tx_set_spacing()
1361 r = core->write(core, WL1273_SCAN_SPACING_SET, in wl1273_fm_tx_set_spacing()
1365 r = core->write(core, WL1273_SCAN_SPACING_SET, in wl1273_fm_tx_set_spacing()
1376 struct wl1273_core *core = radio->core; in wl1273_fm_g_volatile_ctrl() local
1380 if (mutex_lock_interruptible(&core->lock)) in wl1273_fm_g_volatile_ctrl()
1394 mutex_unlock(&core->lock); in wl1273_fm_g_volatile_ctrl()
1413 struct wl1273_core *core = radio->core; in wl1273_fm_vidioc_s_ctrl() local
1420 if (mutex_lock_interruptible(&core->lock)) in wl1273_fm_vidioc_s_ctrl()
1423 if (core->mode == WL1273_MODE_RX && ctrl->val) in wl1273_fm_vidioc_s_ctrl()
1424 r = core->write(core, in wl1273_fm_vidioc_s_ctrl()
1428 else if (core->mode == WL1273_MODE_RX) in wl1273_fm_vidioc_s_ctrl()
1429 r = core->write(core, in wl1273_fm_vidioc_s_ctrl()
1431 else if (core->mode == WL1273_MODE_TX && ctrl->val) in wl1273_fm_vidioc_s_ctrl()
1432 r = core->write(core, WL1273_MUTE, 1); in wl1273_fm_vidioc_s_ctrl()
1433 else if (core->mode == WL1273_MODE_TX) in wl1273_fm_vidioc_s_ctrl()
1434 r = core->write(core, WL1273_MUTE, 0); in wl1273_fm_vidioc_s_ctrl()
1436 mutex_unlock(&core->lock); in wl1273_fm_vidioc_s_ctrl()
1443 r = core->set_volume(core, core->volume); in wl1273_fm_vidioc_s_ctrl()
1500 struct wl1273_core *core = radio->core; in wl1273_fm_vidioc_g_tuner() local
1524 if (core->mode != WL1273_MODE_RX) in wl1273_fm_vidioc_g_tuner()
1527 if (mutex_lock_interruptible(&core->lock)) in wl1273_fm_vidioc_g_tuner()
1530 r = core->read(core, WL1273_STEREO_GET, &val); in wl1273_fm_vidioc_g_tuner()
1539 r = core->read(core, WL1273_RSSI_LVL_GET, &val); in wl1273_fm_vidioc_g_tuner()
1548 r = core->read(core, WL1273_RDS_SYNC_GET, &val); in wl1273_fm_vidioc_g_tuner()
1555 mutex_unlock(&core->lock); in wl1273_fm_vidioc_g_tuner()
1564 struct wl1273_core *core = radio->core; in wl1273_fm_vidioc_s_tuner() local
1578 if (mutex_lock_interruptible(&core->lock)) in wl1273_fm_vidioc_s_tuner()
1594 r = core->write(core, WL1273_MOST_MODE_SET, WL1273_RX_MONO); in wl1273_fm_vidioc_s_tuner()
1602 r = core->write(core, WL1273_MOST_MODE_SET, WL1273_RX_STEREO); in wl1273_fm_vidioc_s_tuner()
1617 mutex_unlock(&core->lock); in wl1273_fm_vidioc_s_tuner()
1626 struct wl1273_core *core = radio->core; in wl1273_fm_vidioc_g_frequency() local
1630 if (mutex_lock_interruptible(&core->lock)) in wl1273_fm_vidioc_g_frequency()
1636 mutex_unlock(&core->lock); in wl1273_fm_vidioc_g_frequency()
1645 struct wl1273_core *core = radio->core; in wl1273_fm_vidioc_s_frequency() local
1656 if (mutex_lock_interruptible(&core->lock)) in wl1273_fm_vidioc_s_frequency()
1659 if (core->mode == WL1273_MODE_RX) { in wl1273_fm_vidioc_s_frequency()
1675 mutex_unlock(&core->lock); in wl1273_fm_vidioc_s_frequency()
1687 struct wl1273_core *core = radio->core; in wl1273_fm_vidioc_s_hw_freq_seek() local
1698 if (mutex_lock_interruptible(&core->lock)) in wl1273_fm_vidioc_s_hw_freq_seek()
1715 mutex_unlock(&core->lock); in wl1273_fm_vidioc_s_hw_freq_seek()
1723 struct wl1273_core *core = radio->core; in wl1273_fm_vidioc_s_modulator() local
1731 if (mutex_lock_interruptible(&core->lock)) in wl1273_fm_vidioc_s_modulator()
1744 r = core->write(core, WL1273_MONO_SET, WL1273_TX_MONO); in wl1273_fm_vidioc_s_modulator()
1746 r = core->write(core, WL1273_MONO_SET, in wl1273_fm_vidioc_s_modulator()
1752 mutex_unlock(&core->lock); in wl1273_fm_vidioc_s_modulator()
1761 struct wl1273_core *core = radio->core; in wl1273_fm_vidioc_g_modulator() local
1776 if (core->mode != WL1273_MODE_TX) in wl1273_fm_vidioc_g_modulator()
1779 if (mutex_lock_interruptible(&core->lock)) in wl1273_fm_vidioc_g_modulator()
1782 r = core->read(core, WL1273_MONO_SET, &val); in wl1273_fm_vidioc_g_modulator()
1794 mutex_unlock(&core->lock); in wl1273_fm_vidioc_g_modulator()
1802 struct wl1273_core *core = radio->core; in wl1273_fm_vidioc_log_status() local
1809 if (core->mode == WL1273_MODE_OFF) { in wl1273_fm_vidioc_log_status()
1814 if (core->mode == WL1273_MODE_SUSPENDED) { in wl1273_fm_vidioc_log_status()
1819 r = core->read(core, WL1273_ASIC_ID_GET, &val); in wl1273_fm_vidioc_log_status()
1825 r = core->read(core, WL1273_ASIC_VER_GET, &val); in wl1273_fm_vidioc_log_status()
1831 r = core->read(core, WL1273_FIRM_VER_GET, &val); in wl1273_fm_vidioc_log_status()
1837 r = core->read(core, WL1273_BAND_SET, &val); in wl1273_fm_vidioc_log_status()
1843 if (core->mode == WL1273_MODE_TX) { in wl1273_fm_vidioc_log_status()
1844 r = core->read(core, WL1273_PUPD_SET, &val); in wl1273_fm_vidioc_log_status()
1850 r = core->read(core, WL1273_CHANL_SET, &val); in wl1273_fm_vidioc_log_status()
1855 } else if (core->mode == WL1273_MODE_RX) { in wl1273_fm_vidioc_log_status()
1858 r = core->read(core, WL1273_FREQ_SET, &val); in wl1273_fm_vidioc_log_status()
1864 r = core->read(core, WL1273_MOST_MODE_SET, &val); in wl1273_fm_vidioc_log_status()
1875 r = core->read(core, WL1273_MOST_BLEND_SET, &val); in wl1273_fm_vidioc_log_status()
1886 r = core->read(core, WL1273_STEREO_GET, &val); in wl1273_fm_vidioc_log_status()
1896 r = core->read(core, WL1273_RSSI_LVL_GET, &val); in wl1273_fm_vidioc_log_status()
1902 r = core->read(core, WL1273_POWER_SET, &val); in wl1273_fm_vidioc_log_status()
1908 r = core->read(core, WL1273_INT_MASK_SET, &val); in wl1273_fm_vidioc_log_status()
1914 r = core->read(core, WL1273_RDS_SYNC_GET, &val); in wl1273_fm_vidioc_log_status()
1926 r = core->read(core, WL1273_I2S_MODE_CONFIG_SET, &val); in wl1273_fm_vidioc_log_status()
1933 r = core->read(core, WL1273_VOLUME_SET, &val); in wl1273_fm_vidioc_log_status()
1983 struct wl1273_core *core = radio->core; in wl1273_fm_radio_remove() local
1987 free_irq(core->client->irq, radio); in wl1273_fm_radio_remove()
1988 core->pdata->free_resources(); in wl1273_fm_radio_remove()
1999 struct wl1273_core **core = pdev->dev.platform_data; in wl1273_fm_radio_probe() local
2006 if (!core) { in wl1273_fm_radio_probe()
2027 radio->core = *core; in wl1273_fm_radio_probe()
2029 radio->dev = &radio->core->client->dev; in wl1273_fm_radio_probe()
2031 radio->core->mode = WL1273_MODE_OFF; in wl1273_fm_radio_probe()
2033 radio->core->audio_mode = WL1273_AUDIO_ANALOG; 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()
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()
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()
2141 free_irq(radio->core->client->irq, radio); in wl1273_fm_radio_probe()
2143 radio->core->pdata->free_resources(); in wl1273_fm_radio_probe()