Lines Matching +full:reg +full:- +full:spacing
1 // SPDX-License-Identifier: GPL-2.0-only
3 * drivers/media/radio/radio-si476x.c -- V4L2 driver for SI476X chips
19 #include <media/v4l2-common.h>
20 #include <media/v4l2-ioctl.h>
21 #include <media/v4l2-ctrls.h>
22 #include <media/v4l2-event.h>
23 #include <media/v4l2-device.h>
25 #include <media/drv-intf/si476x.h>
26 #include <linux/mfd/si476x-core.h>
40 #define DRIVER_NAME "si476x-radio"
157 * - Signal's SNR(in dBuV) must be lower than
159 * - Signal's RSSI(in dBuV) must be greater than
161 * - Signal's frequency deviation(in units of 2ppm) must not be
169 .min = -128,
178 .min = -128,
193 * #V4L2_CID_SI476X_HARMONICS_COUNT -- number of harmonics
194 * built-in power-line noise supression filter is to reject
195 * during AM-mode operation.
209 * #V4L2_CID_SI476X_DIVERSITY_MODE -- configuration which
212 * - #SI476X_IDX_PHDIV_DISABLED diversity mode disabled
213 * - #SI476X_IDX_PHDIV_PRIMARY_COMBINING diversity mode is
215 * - #SI476X_IDX_PHDIV_PRIMARY_ANTENNA diversity mode is
217 * - #SI476X_IDX_PHDIV_SECONDARY_ANTENNA diversity mode is
219 * - #SI476X_IDX_PHDIV_SECONDARY_COMBINING diversity mode is
229 .max = ARRAY_SIZE(phase_diversity_modes) - 1,
233 * #V4L2_CID_SI476X_INTERCHIP_LINK -- inter-chip link in
244 .name = "Inter-Chip Link",
254 * struct si476x_radio_ops - vtable of tuner functions
289 * struct si476x_radio - radio device
322 * si476x_vidioc_querycap - query device capabilities
329 strscpy(capability->driver, radio->v4l2dev.name, in si476x_radio_querycap()
330 sizeof(capability->driver)); in si476x_radio_querycap()
331 strscpy(capability->card, DRIVER_CARD, sizeof(capability->card)); in si476x_radio_querycap()
341 if (band->tuner != 0) in si476x_radio_enum_freq_bands()
342 return -EINVAL; in si476x_radio_enum_freq_bands()
344 switch (radio->core->chip_id) { in si476x_radio_enum_freq_bands()
345 /* AM/FM tuners -- all bands are supported */ in si476x_radio_enum_freq_bands()
348 if (band->index < ARRAY_SIZE(si476x_bands)) { in si476x_radio_enum_freq_bands()
349 *band = si476x_bands[band->index]; in si476x_radio_enum_freq_bands()
352 err = -EINVAL; in si476x_radio_enum_freq_bands()
355 /* FM companion tuner chips -- only FM bands are in si476x_radio_enum_freq_bands()
358 if (band->index == SI476X_BAND_FM) { in si476x_radio_enum_freq_bands()
359 *band = si476x_bands[band->index]; in si476x_radio_enum_freq_bands()
362 err = -EINVAL; in si476x_radio_enum_freq_bands()
366 err = -EINVAL; in si476x_radio_enum_freq_bands()
387 if (tuner->index != 0) in si476x_radio_g_tuner()
388 return -EINVAL; in si476x_radio_g_tuner()
390 tuner->type = V4L2_TUNER_RADIO; in si476x_radio_g_tuner()
391 tuner->capability = V4L2_TUNER_CAP_LOW /* Measure frequencies in si476x_radio_g_tuner()
399 si476x_core_lock(radio->core); in si476x_radio_g_tuner()
401 if (si476x_core_is_a_secondary_tuner(radio->core)) { in si476x_radio_g_tuner()
402 strscpy(tuner->name, "FM (secondary)", sizeof(tuner->name)); in si476x_radio_g_tuner()
403 tuner->rxsubchans = 0; in si476x_radio_g_tuner()
404 tuner->rangelow = si476x_bands[SI476X_BAND_FM].rangelow; in si476x_radio_g_tuner()
405 } else if (si476x_core_has_am(radio->core)) { in si476x_radio_g_tuner()
406 if (si476x_core_is_a_primary_tuner(radio->core)) in si476x_radio_g_tuner()
407 strscpy(tuner->name, "AM/FM (primary)", in si476x_radio_g_tuner()
408 sizeof(tuner->name)); in si476x_radio_g_tuner()
410 strscpy(tuner->name, "AM/FM", sizeof(tuner->name)); in si476x_radio_g_tuner()
412 tuner->rxsubchans = V4L2_TUNER_SUB_MONO | V4L2_TUNER_SUB_STEREO in si476x_radio_g_tuner()
414 tuner->capability |= V4L2_TUNER_CAP_RDS in si476x_radio_g_tuner()
418 tuner->rangelow = si476x_bands[SI476X_BAND_AM].rangelow; in si476x_radio_g_tuner()
420 strscpy(tuner->name, "FM", sizeof(tuner->name)); in si476x_radio_g_tuner()
421 tuner->rxsubchans = V4L2_TUNER_SUB_RDS; in si476x_radio_g_tuner()
422 tuner->capability |= V4L2_TUNER_CAP_RDS in si476x_radio_g_tuner()
425 tuner->rangelow = si476x_bands[SI476X_BAND_FM].rangelow; in si476x_radio_g_tuner()
428 tuner->audmode = radio->audmode; in si476x_radio_g_tuner()
430 tuner->afc = 1; in si476x_radio_g_tuner()
431 tuner->rangehigh = si476x_bands[SI476X_BAND_FM].rangehigh; in si476x_radio_g_tuner()
433 err = radio->ops->rsq_status(radio->core, in si476x_radio_g_tuner()
436 tuner->signal = 0; in si476x_radio_g_tuner()
439 * tuner->signal value range: 0x0000 .. 0xFFFF, in si476x_radio_g_tuner()
440 * report.rssi: -128 .. 127 in si476x_radio_g_tuner()
442 tuner->signal = (report.rssi + 128) * 257; in si476x_radio_g_tuner()
444 si476x_core_unlock(radio->core); in si476x_radio_g_tuner()
454 if (tuner->index != 0) in si476x_radio_s_tuner()
455 return -EINVAL; in si476x_radio_s_tuner()
457 if (tuner->audmode == V4L2_TUNER_MODE_MONO || in si476x_radio_s_tuner()
458 tuner->audmode == V4L2_TUNER_MODE_STEREO) in si476x_radio_s_tuner()
459 radio->audmode = tuner->audmode; in si476x_radio_s_tuner()
461 radio->audmode = V4L2_TUNER_MODE_STEREO; in si476x_radio_s_tuner()
493 radio->ops = &fm_ops; in si476x_radio_init_vtable()
497 radio->ops = &am_ops; in si476x_radio_init_vtable()
501 return -EINVAL; in si476x_radio_init_vtable()
521 args.freq = v4l2_to_si476x(radio->core, in si476x_radio_pretune()
523 retval = radio->ops->tune_freq(radio->core, &args); in si476x_radio_pretune()
526 args.freq = v4l2_to_si476x(radio->core, in si476x_radio_pretune()
528 retval = radio->ops->tune_freq(radio->core, &args); in si476x_radio_pretune()
532 retval = -EINVAL; in si476x_radio_pretune()
542 /* regcache_mark_dirty(radio->core->regmap); */ in si476x_radio_do_post_powerup_init()
543 err = regcache_sync_region(radio->core->regmap, in si476x_radio_do_post_powerup_init()
549 err = regcache_sync_region(radio->core->regmap, in si476x_radio_do_post_powerup_init()
555 err = regcache_sync_region(radio->core->regmap, in si476x_radio_do_post_powerup_init()
565 err = regcache_sync_region(radio->core->regmap, in si476x_radio_do_post_powerup_init()
571 err = regcache_sync_region(radio->core->regmap, in si476x_radio_do_post_powerup_init()
578 if (si476x_core_has_diversity(radio->core)) { in si476x_radio_do_post_powerup_init()
579 err = si476x_core_cmd_fm_phase_diversity(radio->core, in si476x_radio_do_post_powerup_init()
580 radio->core->diversity_mode); in si476x_radio_do_post_powerup_init()
585 err = regcache_sync_region(radio->core->regmap, in si476x_radio_do_post_powerup_init()
606 if (func == radio->core->power_up_parameters.func) in si476x_radio_change_func()
610 err = si476x_core_stop(radio->core, soft); in si476x_radio_change_func()
617 err = si476x_core_stop(radio->core, soft); in si476x_radio_change_func()
624 radio->core->power_up_parameters.func = func; in si476x_radio_change_func()
626 err = si476x_core_start(radio->core, soft); in si476x_radio_change_func()
647 if (f->tuner != 0 || in si476x_radio_g_frequency()
648 f->type != V4L2_TUNER_RADIO) in si476x_radio_g_frequency()
649 return -EINVAL; in si476x_radio_g_frequency()
651 si476x_core_lock(radio->core); in si476x_radio_g_frequency()
653 if (radio->ops->rsq_status) { in si476x_radio_g_frequency()
663 err = radio->ops->rsq_status(radio->core, &args, &report); in si476x_radio_g_frequency()
665 f->frequency = si476x_to_v4l2(radio->core, in si476x_radio_g_frequency()
668 err = -EINVAL; in si476x_radio_g_frequency()
671 si476x_core_unlock(radio->core); in si476x_radio_g_frequency()
680 u32 freq = f->frequency; in si476x_radio_s_frequency()
691 if (f->tuner != 0 || in si476x_radio_s_frequency()
692 f->type != V4L2_TUNER_RADIO) in si476x_radio_s_frequency()
693 return -EINVAL; in si476x_radio_s_frequency()
695 si476x_core_lock(radio->core); in si476x_radio_s_frequency()
703 (!si476x_core_has_am(radio->core) || in si476x_radio_s_frequency()
704 si476x_core_is_a_secondary_tuner(radio->core))) { in si476x_radio_s_frequency()
705 err = -EINVAL; in si476x_radio_s_frequency()
716 args.freq = v4l2_to_si476x(radio->core, freq); in si476x_radio_s_frequency()
721 err = radio->ops->tune_freq(radio->core, &args); in si476x_radio_s_frequency()
724 si476x_core_unlock(radio->core); in si476x_radio_s_frequency()
733 u32 rangelow = seek->rangelow, rangehigh = seek->rangehigh; in si476x_radio_s_hw_freq_seek()
736 if (file->f_flags & O_NONBLOCK) in si476x_radio_s_hw_freq_seek()
737 return -EAGAIN; in si476x_radio_s_hw_freq_seek()
739 if (seek->tuner != 0 || in si476x_radio_s_hw_freq_seek()
740 seek->type != V4L2_TUNER_RADIO) in si476x_radio_s_hw_freq_seek()
741 return -EINVAL; in si476x_radio_s_hw_freq_seek()
743 si476x_core_lock(radio->core); in si476x_radio_s_hw_freq_seek()
746 err = regmap_read(radio->core->regmap, in si476x_radio_s_hw_freq_seek()
751 rangelow = si476x_to_v4l2(radio->core, rangelow); in si476x_radio_s_hw_freq_seek()
754 err = regmap_read(radio->core->regmap, in si476x_radio_s_hw_freq_seek()
759 rangehigh = si476x_to_v4l2(radio->core, rangehigh); in si476x_radio_s_hw_freq_seek()
763 err = -EINVAL; in si476x_radio_s_hw_freq_seek()
771 } else if (si476x_core_has_am(radio->core) && in si476x_radio_s_hw_freq_seek()
776 err = -EINVAL; in si476x_radio_s_hw_freq_seek()
784 if (seek->rangehigh) { in si476x_radio_s_hw_freq_seek()
785 err = regmap_write(radio->core->regmap, in si476x_radio_s_hw_freq_seek()
787 v4l2_to_si476x(radio->core, in si476x_radio_s_hw_freq_seek()
788 seek->rangehigh)); in si476x_radio_s_hw_freq_seek()
792 if (seek->rangelow) { in si476x_radio_s_hw_freq_seek()
793 err = regmap_write(radio->core->regmap, in si476x_radio_s_hw_freq_seek()
795 v4l2_to_si476x(radio->core, in si476x_radio_s_hw_freq_seek()
796 seek->rangelow)); in si476x_radio_s_hw_freq_seek()
800 if (seek->spacing) { in si476x_radio_s_hw_freq_seek()
801 err = regmap_write(radio->core->regmap, in si476x_radio_s_hw_freq_seek()
803 v4l2_to_si476x(radio->core, in si476x_radio_s_hw_freq_seek()
804 seek->spacing)); in si476x_radio_s_hw_freq_seek()
809 err = radio->ops->seek_start(radio->core, in si476x_radio_s_hw_freq_seek()
810 seek->seek_upward, in si476x_radio_s_hw_freq_seek()
811 seek->wrap_around); in si476x_radio_s_hw_freq_seek()
813 si476x_core_unlock(radio->core); in si476x_radio_s_hw_freq_seek()
823 struct si476x_radio *radio = v4l2_ctrl_handler_to_radio(ctrl->handler); in si476x_radio_g_volatile_ctrl()
825 si476x_core_lock(radio->core); in si476x_radio_g_volatile_ctrl()
827 switch (ctrl->id) { in si476x_radio_g_volatile_ctrl()
829 if (si476x_core_has_diversity(radio->core)) { in si476x_radio_g_volatile_ctrl()
830 if (radio->ops->phase_diversity) { in si476x_radio_g_volatile_ctrl()
831 retval = radio->ops->phase_div_status(radio->core); in si476x_radio_g_volatile_ctrl()
835 ctrl->val = !!SI476X_PHDIV_STATUS_LINK_LOCKED(retval); in si476x_radio_g_volatile_ctrl()
839 retval = -ENOTTY; in si476x_radio_g_volatile_ctrl()
843 retval = -EINVAL; in si476x_radio_g_volatile_ctrl()
846 retval = -EINVAL; in si476x_radio_g_volatile_ctrl()
849 si476x_core_unlock(radio->core); in si476x_radio_g_volatile_ctrl()
858 struct si476x_radio *radio = v4l2_ctrl_handler_to_radio(ctrl->handler); in si476x_radio_s_ctrl()
860 si476x_core_lock(radio->core); in si476x_radio_s_ctrl()
862 switch (ctrl->id) { in si476x_radio_s_ctrl()
864 retval = regmap_update_bits(radio->core->regmap, in si476x_radio_s_ctrl()
867 ctrl->val); in si476x_radio_s_ctrl()
870 switch (ctrl->val) { in si476x_radio_s_ctrl()
872 retval = regmap_update_bits(radio->core->regmap, in si476x_radio_s_ctrl()
878 retval = regmap_update_bits(radio->core->regmap, in si476x_radio_s_ctrl()
884 retval = regmap_update_bits(radio->core->regmap, in si476x_radio_s_ctrl()
890 retval = -EINVAL; in si476x_radio_s_ctrl()
895 retval = regmap_write(radio->core->regmap, in si476x_radio_s_ctrl()
897 ctrl->val); in si476x_radio_s_ctrl()
900 retval = regmap_write(radio->core->regmap, in si476x_radio_s_ctrl()
902 ctrl->val); in si476x_radio_s_ctrl()
905 retval = regmap_write(radio->core->regmap, in si476x_radio_s_ctrl()
907 ctrl->val); in si476x_radio_s_ctrl()
915 if (si476x_core_is_in_am_receiver_mode(radio->core)) in si476x_radio_s_ctrl()
916 regcache_cache_only(radio->core->regmap, true); in si476x_radio_s_ctrl()
918 if (ctrl->val) { in si476x_radio_s_ctrl()
919 retval = regmap_write(radio->core->regmap, in si476x_radio_s_ctrl()
921 radio->core->rds_fifo_depth); in si476x_radio_s_ctrl()
925 if (radio->core->client->irq) { in si476x_radio_s_ctrl()
926 retval = regmap_write(radio->core->regmap, in si476x_radio_s_ctrl()
934 retval = si476x_core_cmd_fm_rds_status(radio->core, in si476x_radio_s_ctrl()
942 retval = regmap_update_bits(radio->core->regmap, in si476x_radio_s_ctrl()
947 retval = regmap_update_bits(radio->core->regmap, in si476x_radio_s_ctrl()
953 if (si476x_core_is_in_am_receiver_mode(radio->core)) in si476x_radio_s_ctrl()
954 regcache_cache_only(radio->core->regmap, false); in si476x_radio_s_ctrl()
957 retval = regmap_write(radio->core->regmap, in si476x_radio_s_ctrl()
959 ctrl->val); in si476x_radio_s_ctrl()
963 mode = si476x_phase_diversity_idx_to_mode(ctrl->val); in si476x_radio_s_ctrl()
965 if (mode == radio->core->diversity_mode) { in si476x_radio_s_ctrl()
970 if (si476x_core_is_in_am_receiver_mode(radio->core)) { in si476x_radio_s_ctrl()
975 radio->core->diversity_mode = mode; in si476x_radio_s_ctrl()
978 retval = radio->ops->phase_diversity(radio->core, mode); in si476x_radio_s_ctrl()
980 radio->core->diversity_mode = mode; in si476x_radio_s_ctrl()
985 retval = -EINVAL; in si476x_radio_s_ctrl()
989 si476x_core_unlock(radio->core); in si476x_radio_s_ctrl()
996 struct v4l2_dbg_register *reg) in si476x_radio_g_register() argument
1002 si476x_core_lock(radio->core); in si476x_radio_g_register()
1003 reg->size = 2; in si476x_radio_g_register()
1004 err = regmap_read(radio->core->regmap, in si476x_radio_g_register()
1005 (unsigned int)reg->reg, &value); in si476x_radio_g_register()
1006 reg->val = value; in si476x_radio_g_register()
1007 si476x_core_unlock(radio->core); in si476x_radio_g_register()
1012 const struct v4l2_dbg_register *reg) in si476x_radio_s_register() argument
1018 si476x_core_lock(radio->core); in si476x_radio_s_register()
1019 err = regmap_write(radio->core->regmap, in si476x_radio_s_register()
1020 (unsigned int)reg->reg, in si476x_radio_s_register()
1021 (unsigned int)reg->val); in si476x_radio_s_register()
1022 si476x_core_unlock(radio->core); in si476x_radio_s_register()
1038 si476x_core_lock(radio->core); in si476x_radio_fops_open()
1039 err = si476x_core_set_power_state(radio->core, in si476x_radio_fops_open()
1045 radio->core->power_up_parameters.func); in si476x_radio_fops_open()
1050 radio->core->power_up_parameters.func); in si476x_radio_fops_open()
1054 si476x_core_unlock(radio->core); in si476x_radio_fops_open()
1056 v4l2_ctrl_handler_setup(&radio->ctrl_handler); in si476x_radio_fops_open()
1062 si476x_core_set_power_state(radio->core, in si476x_radio_fops_open()
1065 si476x_core_unlock(radio->core); in si476x_radio_fops_open()
1076 atomic_read(&radio->core->is_alive)) in si476x_radio_fops_release()
1077 si476x_core_set_power_state(radio->core, in si476x_radio_fops_release()
1093 if (kfifo_is_empty(&radio->core->rds_fifo)) { in si476x_radio_fops_read()
1094 if (file->f_flags & O_NONBLOCK) in si476x_radio_fops_read()
1095 return -EWOULDBLOCK; in si476x_radio_fops_read()
1097 rval = wait_event_interruptible(radio->core->rds_read_queue, in si476x_radio_fops_read()
1098 (!kfifo_is_empty(&radio->core->rds_fifo) || in si476x_radio_fops_read()
1099 !atomic_read(&radio->core->is_alive))); in si476x_radio_fops_read()
1101 return -EINTR; in si476x_radio_fops_read()
1103 if (!atomic_read(&radio->core->is_alive)) in si476x_radio_fops_read()
1104 return -ENODEV; in si476x_radio_fops_read()
1107 fifo_len = kfifo_len(&radio->core->rds_fifo); in si476x_radio_fops_read()
1109 if (kfifo_to_user(&radio->core->rds_fifo, buf, in si476x_radio_fops_read()
1112 dev_warn(&radio->videodev.dev, in si476x_radio_fops_read()
1114 rval = -EIO; in si476x_radio_fops_read()
1130 if (atomic_read(&radio->core->is_alive)) in si476x_radio_fops_poll()
1131 poll_wait(file, &radio->core->rds_read_queue, pts); in si476x_radio_fops_poll()
1133 if (!atomic_read(&radio->core->is_alive)) in si476x_radio_fops_poll()
1136 if (!kfifo_is_empty(&radio->core->rds_fifo)) in si476x_radio_fops_poll()
1186 struct si476x_radio *radio = file->private_data; in si476x_radio_read_acf_blob()
1189 si476x_core_lock(radio->core); in si476x_radio_read_acf_blob()
1190 if (radio->ops->acf_status) in si476x_radio_read_acf_blob()
1191 err = radio->ops->acf_status(radio->core, &report); in si476x_radio_read_acf_blob()
1193 err = -ENOENT; in si476x_radio_read_acf_blob()
1194 si476x_core_unlock(radio->core); in si476x_radio_read_acf_blob()
1214 struct si476x_radio *radio = file->private_data; in si476x_radio_read_rds_blckcnt_blob()
1217 si476x_core_lock(radio->core); in si476x_radio_read_rds_blckcnt_blob()
1218 if (radio->ops->rds_blckcnt) in si476x_radio_read_rds_blckcnt_blob()
1219 err = radio->ops->rds_blckcnt(radio->core, true, in si476x_radio_read_rds_blckcnt_blob()
1222 err = -ENOENT; in si476x_radio_read_rds_blckcnt_blob()
1223 si476x_core_unlock(radio->core); in si476x_radio_read_rds_blckcnt_blob()
1243 struct si476x_radio *radio = file->private_data; in si476x_radio_read_agc_blob()
1246 si476x_core_lock(radio->core); in si476x_radio_read_agc_blob()
1247 if (radio->ops->rds_blckcnt) in si476x_radio_read_agc_blob()
1248 err = radio->ops->agc_status(radio->core, &report); in si476x_radio_read_agc_blob()
1250 err = -ENOENT; in si476x_radio_read_agc_blob()
1251 si476x_core_unlock(radio->core); in si476x_radio_read_agc_blob()
1271 struct si476x_radio *radio = file->private_data; in si476x_radio_read_rsq_blob()
1281 si476x_core_lock(radio->core); in si476x_radio_read_rsq_blob()
1282 if (radio->ops->rds_blckcnt) in si476x_radio_read_rsq_blob()
1283 err = radio->ops->rsq_status(radio->core, &args, &report); in si476x_radio_read_rsq_blob()
1285 err = -ENOENT; in si476x_radio_read_rsq_blob()
1286 si476x_core_unlock(radio->core); in si476x_radio_read_rsq_blob()
1306 struct si476x_radio *radio = file->private_data; in si476x_radio_read_rsq_primary_blob()
1316 si476x_core_lock(radio->core); in si476x_radio_read_rsq_primary_blob()
1317 if (radio->ops->rds_blckcnt) in si476x_radio_read_rsq_primary_blob()
1318 err = radio->ops->rsq_status(radio->core, &args, &report); in si476x_radio_read_rsq_primary_blob()
1320 err = -ENOENT; in si476x_radio_read_rsq_primary_blob()
1321 si476x_core_unlock(radio->core); in si476x_radio_read_rsq_primary_blob()
1339 radio->debugfs = debugfs_create_dir(dev_name(radio->v4l2dev.dev), NULL); in si476x_radio_init_debugfs()
1341 debugfs_create_file("acf", S_IRUGO, radio->debugfs, radio, in si476x_radio_init_debugfs()
1344 debugfs_create_file("rds_blckcnt", S_IRUGO, radio->debugfs, radio, in si476x_radio_init_debugfs()
1347 debugfs_create_file("agc", S_IRUGO, radio->debugfs, radio, in si476x_radio_init_debugfs()
1350 debugfs_create_file("rsq", S_IRUGO, radio->debugfs, radio, in si476x_radio_init_debugfs()
1353 debugfs_create_file("rsq_primary", S_IRUGO, radio->debugfs, radio, in si476x_radio_init_debugfs()
1364 ctrl = v4l2_ctrl_new_custom(&radio->ctrl_handler, in si476x_radio_add_new_custom()
1367 rval = radio->ctrl_handler.error; in si476x_radio_add_new_custom()
1369 dev_err(radio->v4l2dev.dev, in si476x_radio_add_new_custom()
1384 radio = devm_kzalloc(&pdev->dev, sizeof(*radio), GFP_KERNEL); in si476x_radio_probe()
1386 return -ENOMEM; in si476x_radio_probe()
1388 radio->core = i2c_mfd_cell_to_core(&pdev->dev); in si476x_radio_probe()
1390 v4l2_device_set_name(&radio->v4l2dev, DRIVER_NAME, &instance); in si476x_radio_probe()
1392 rval = v4l2_device_register(&pdev->dev, &radio->v4l2dev); in si476x_radio_probe()
1394 dev_err(&pdev->dev, "Cannot register v4l2_device.\n"); in si476x_radio_probe()
1398 memcpy(&radio->videodev, &si476x_viddev_template, in si476x_radio_probe()
1401 radio->videodev.v4l2_dev = &radio->v4l2dev; in si476x_radio_probe()
1402 radio->videodev.ioctl_ops = &si4761_ioctl_ops; in si476x_radio_probe()
1403 radio->videodev.device_caps = V4L2_CAP_TUNER | V4L2_CAP_RADIO | in si476x_radio_probe()
1406 si476x_core_lock(radio->core); in si476x_radio_probe()
1407 if (!si476x_core_is_a_secondary_tuner(radio->core)) in si476x_radio_probe()
1408 radio->videodev.device_caps |= V4L2_CAP_RDS_CAPTURE | in si476x_radio_probe()
1410 si476x_core_unlock(radio->core); in si476x_radio_probe()
1412 video_set_drvdata(&radio->videodev, radio); in si476x_radio_probe()
1416 radio->v4l2dev.ctrl_handler = &radio->ctrl_handler; in si476x_radio_probe()
1417 v4l2_ctrl_handler_init(&radio->ctrl_handler, in si476x_radio_probe()
1420 if (si476x_core_has_am(radio->core)) { in si476x_radio_probe()
1421 ctrl = v4l2_ctrl_new_std_menu(&radio->ctrl_handler, in si476x_radio_probe()
1426 rval = radio->ctrl_handler.error; in si476x_radio_probe()
1428 dev_err(&pdev->dev, "Could not initialize V4L2_CID_POWER_LINE_FREQUENCY control %d\n", in si476x_radio_probe()
1451 ctrl = v4l2_ctrl_new_std_menu(&radio->ctrl_handler, in si476x_radio_probe()
1455 rval = radio->ctrl_handler.error; in si476x_radio_probe()
1457 dev_err(&pdev->dev, "Could not initialize V4L2_CID_TUNE_DEEMPHASIS control %d\n", in si476x_radio_probe()
1462 ctrl = v4l2_ctrl_new_std(&radio->ctrl_handler, &si476x_ctrl_ops, in si476x_radio_probe()
1465 rval = radio->ctrl_handler.error; in si476x_radio_probe()
1467 dev_err(&pdev->dev, "Could not initialize V4L2_CID_RDS_RECEPTION control %d\n", in si476x_radio_probe()
1472 if (si476x_core_has_diversity(radio->core)) { in si476x_radio_probe()
1474 si476x_phase_diversity_mode_to_idx(radio->core->diversity_mode); in si476x_radio_probe()
1485 rval = video_register_device(&radio->videodev, VFL_TYPE_RADIO, -1); in si476x_radio_probe()
1487 dev_err(&pdev->dev, "Could not register video device\n"); in si476x_radio_probe()
1495 v4l2_ctrl_handler_free(radio->videodev.ctrl_handler); in si476x_radio_probe()
1503 v4l2_ctrl_handler_free(radio->videodev.ctrl_handler); in si476x_radio_remove()
1504 video_unregister_device(&radio->videodev); in si476x_radio_remove()
1505 v4l2_device_unregister(&radio->v4l2dev); in si476x_radio_remove()
1506 debugfs_remove_recursive(radio->debugfs); in si476x_radio_remove()
1509 MODULE_ALIAS("platform:si476x-radio");