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 if (mutex_lock_interruptible(&core->lock)) in wl1273_fm_fops_release()
1156 if (core->mode == WL1273_MODE_RX) { in wl1273_fm_fops_release()
1157 r = core->write(core, in wl1273_fm_fops_release()
1161 mutex_unlock(&core->lock); in wl1273_fm_fops_release()
1165 mutex_unlock(&core->lock); in wl1273_fm_fops_release()
1180 struct wl1273_core *core = radio->core; in wl1273_fm_fops_read() local
1186 if (core->mode != WL1273_MODE_RX) in wl1273_fm_fops_read()
1194 if (mutex_lock_interruptible(&core->lock)) in wl1273_fm_fops_read()
1207 r = core->read(core, WL1273_RDS_SYNC_GET, &val); in wl1273_fm_fops_read()
1259 mutex_unlock(&core->lock); in wl1273_fm_fops_read()
1322 struct wl1273_core *core = radio->core; in wl1273_fm_set_tx_power() local
1325 if (core->mode == WL1273_MODE_OFF || in wl1273_fm_set_tx_power()
1326 core->mode == WL1273_MODE_SUSPENDED) in wl1273_fm_set_tx_power()
1329 mutex_lock(&core->lock); in wl1273_fm_set_tx_power()
1332 r = core->write(core, WL1273_POWER_LEV_SET, 122 - power); in wl1273_fm_set_tx_power()
1339 mutex_unlock(&core->lock); in wl1273_fm_set_tx_power()
1350 struct wl1273_core *core = radio->core; in wl1273_fm_tx_set_spacing() local
1354 r = core->write(core, WL1273_SCAN_SPACING_SET, in wl1273_fm_tx_set_spacing()
1358 r = core->write(core, WL1273_SCAN_SPACING_SET, in wl1273_fm_tx_set_spacing()
1362 r = core->write(core, WL1273_SCAN_SPACING_SET, in wl1273_fm_tx_set_spacing()
1366 r = core->write(core, WL1273_SCAN_SPACING_SET, in wl1273_fm_tx_set_spacing()
1377 struct wl1273_core *core = radio->core; in wl1273_fm_g_volatile_ctrl() local
1381 if (mutex_lock_interruptible(&core->lock)) in wl1273_fm_g_volatile_ctrl()
1395 mutex_unlock(&core->lock); in wl1273_fm_g_volatile_ctrl()
1414 struct wl1273_core *core = radio->core; in wl1273_fm_vidioc_s_ctrl() local
1421 if (mutex_lock_interruptible(&core->lock)) in wl1273_fm_vidioc_s_ctrl()
1424 if (core->mode == WL1273_MODE_RX && ctrl->val) in wl1273_fm_vidioc_s_ctrl()
1425 r = core->write(core, in wl1273_fm_vidioc_s_ctrl()
1429 else if (core->mode == WL1273_MODE_RX) in wl1273_fm_vidioc_s_ctrl()
1430 r = core->write(core, in wl1273_fm_vidioc_s_ctrl()
1432 else if (core->mode == WL1273_MODE_TX && ctrl->val) in wl1273_fm_vidioc_s_ctrl()
1433 r = core->write(core, WL1273_MUTE, 1); in wl1273_fm_vidioc_s_ctrl()
1434 else if (core->mode == WL1273_MODE_TX) in wl1273_fm_vidioc_s_ctrl()
1435 r = core->write(core, WL1273_MUTE, 0); in wl1273_fm_vidioc_s_ctrl()
1437 mutex_unlock(&core->lock); in wl1273_fm_vidioc_s_ctrl()
1444 r = core->set_volume(core, core->volume); in wl1273_fm_vidioc_s_ctrl()
1501 struct wl1273_core *core = radio->core; in wl1273_fm_vidioc_g_tuner() local
1525 if (core->mode != WL1273_MODE_RX) in wl1273_fm_vidioc_g_tuner()
1528 if (mutex_lock_interruptible(&core->lock)) in wl1273_fm_vidioc_g_tuner()
1531 r = core->read(core, WL1273_STEREO_GET, &val); in wl1273_fm_vidioc_g_tuner()
1540 r = core->read(core, WL1273_RSSI_LVL_GET, &val); in wl1273_fm_vidioc_g_tuner()
1549 r = core->read(core, WL1273_RDS_SYNC_GET, &val); in wl1273_fm_vidioc_g_tuner()
1556 mutex_unlock(&core->lock); in wl1273_fm_vidioc_g_tuner()
1565 struct wl1273_core *core = radio->core; in wl1273_fm_vidioc_s_tuner() local
1579 if (mutex_lock_interruptible(&core->lock)) in wl1273_fm_vidioc_s_tuner()
1595 r = core->write(core, WL1273_MOST_MODE_SET, WL1273_RX_MONO); in wl1273_fm_vidioc_s_tuner()
1603 r = core->write(core, WL1273_MOST_MODE_SET, WL1273_RX_STEREO); in wl1273_fm_vidioc_s_tuner()
1618 mutex_unlock(&core->lock); in wl1273_fm_vidioc_s_tuner()
1627 struct wl1273_core *core = radio->core; in wl1273_fm_vidioc_g_frequency() local
1631 if (mutex_lock_interruptible(&core->lock)) in wl1273_fm_vidioc_g_frequency()
1637 mutex_unlock(&core->lock); in wl1273_fm_vidioc_g_frequency()
1646 struct wl1273_core *core = radio->core; in wl1273_fm_vidioc_s_frequency() local
1657 if (mutex_lock_interruptible(&core->lock)) in wl1273_fm_vidioc_s_frequency()
1660 if (core->mode == WL1273_MODE_RX) { in wl1273_fm_vidioc_s_frequency()
1676 mutex_unlock(&core->lock); in wl1273_fm_vidioc_s_frequency()
1688 struct wl1273_core *core = radio->core; in wl1273_fm_vidioc_s_hw_freq_seek() local
1699 if (mutex_lock_interruptible(&core->lock)) in wl1273_fm_vidioc_s_hw_freq_seek()
1716 mutex_unlock(&core->lock); in wl1273_fm_vidioc_s_hw_freq_seek()
1724 struct wl1273_core *core = radio->core; in wl1273_fm_vidioc_s_modulator() local
1732 if (mutex_lock_interruptible(&core->lock)) in wl1273_fm_vidioc_s_modulator()
1745 r = core->write(core, WL1273_MONO_SET, WL1273_TX_MONO); in wl1273_fm_vidioc_s_modulator()
1747 r = core->write(core, WL1273_MONO_SET, in wl1273_fm_vidioc_s_modulator()
1753 mutex_unlock(&core->lock); in wl1273_fm_vidioc_s_modulator()
1762 struct wl1273_core *core = radio->core; in wl1273_fm_vidioc_g_modulator() local
1777 if (core->mode != WL1273_MODE_TX) in wl1273_fm_vidioc_g_modulator()
1780 if (mutex_lock_interruptible(&core->lock)) in wl1273_fm_vidioc_g_modulator()
1783 r = core->read(core, WL1273_MONO_SET, &val); in wl1273_fm_vidioc_g_modulator()
1795 mutex_unlock(&core->lock); in wl1273_fm_vidioc_g_modulator()
1803 struct wl1273_core *core = radio->core; in wl1273_fm_vidioc_log_status() local
1810 if (core->mode == WL1273_MODE_OFF) { in wl1273_fm_vidioc_log_status()
1815 if (core->mode == WL1273_MODE_SUSPENDED) { in wl1273_fm_vidioc_log_status()
1820 r = core->read(core, WL1273_ASIC_ID_GET, &val); in wl1273_fm_vidioc_log_status()
1826 r = core->read(core, WL1273_ASIC_VER_GET, &val); in wl1273_fm_vidioc_log_status()
1832 r = core->read(core, WL1273_FIRM_VER_GET, &val); in wl1273_fm_vidioc_log_status()
1838 r = core->read(core, WL1273_BAND_SET, &val); in wl1273_fm_vidioc_log_status()
1844 if (core->mode == WL1273_MODE_TX) { in wl1273_fm_vidioc_log_status()
1845 r = core->read(core, WL1273_PUPD_SET, &val); in wl1273_fm_vidioc_log_status()
1851 r = core->read(core, WL1273_CHANL_SET, &val); in wl1273_fm_vidioc_log_status()
1856 } else if (core->mode == WL1273_MODE_RX) { in wl1273_fm_vidioc_log_status()
1859 r = core->read(core, WL1273_FREQ_SET, &val); in wl1273_fm_vidioc_log_status()
1865 r = core->read(core, WL1273_MOST_MODE_SET, &val); in wl1273_fm_vidioc_log_status()
1876 r = core->read(core, WL1273_MOST_BLEND_SET, &val); in wl1273_fm_vidioc_log_status()
1887 r = core->read(core, WL1273_STEREO_GET, &val); in wl1273_fm_vidioc_log_status()
1897 r = core->read(core, WL1273_RSSI_LVL_GET, &val); in wl1273_fm_vidioc_log_status()
1903 r = core->read(core, WL1273_POWER_SET, &val); in wl1273_fm_vidioc_log_status()
1909 r = core->read(core, WL1273_INT_MASK_SET, &val); in wl1273_fm_vidioc_log_status()
1915 r = core->read(core, WL1273_RDS_SYNC_GET, &val); in wl1273_fm_vidioc_log_status()
1927 r = core->read(core, WL1273_I2S_MODE_CONFIG_SET, &val); in wl1273_fm_vidioc_log_status()
1934 r = core->read(core, WL1273_VOLUME_SET, &val); in wl1273_fm_vidioc_log_status()
1984 struct wl1273_core *core = radio->core; in wl1273_fm_radio_remove() local
1988 free_irq(core->client->irq, radio); in wl1273_fm_radio_remove()
1989 core->pdata->free_resources(); in wl1273_fm_radio_remove()
2000 struct wl1273_core **core = pdev->dev.platform_data; in wl1273_fm_radio_probe() local
2007 if (!core) { in wl1273_fm_radio_probe()
2028 radio->core = *core; in wl1273_fm_radio_probe()
2030 radio->dev = &radio->core->client->dev; in wl1273_fm_radio_probe()
2032 radio->core->mode = WL1273_MODE_OFF; in wl1273_fm_radio_probe()
2034 radio->core->audio_mode = WL1273_AUDIO_ANALOG; in wl1273_fm_radio_probe()
2036 radio->core->i2s_mode = WL1273_I2S_DEF_MODE; in wl1273_fm_radio_probe()
2037 radio->core->channel_number = 2; in wl1273_fm_radio_probe()
2038 radio->core->volume = WL1273_DEFAULT_VOLUME; in wl1273_fm_radio_probe()
2046 if (radio->core->pdata->request_resources) { in wl1273_fm_radio_probe()
2047 r = radio->core->pdata->request_resources(radio->core->client); in wl1273_fm_radio_probe()
2054 dev_dbg(radio->dev, "irq: %d\n", radio->core->client->irq); in wl1273_fm_radio_probe()
2056 r = request_threaded_irq(radio->core->client->irq, NULL, in wl1273_fm_radio_probe()
2142 free_irq(radio->core->client->irq, radio); in wl1273_fm_radio_probe()
2144 radio->core->pdata->free_resources(); in wl1273_fm_radio_probe()