127 static unsigned short space = 2;
134 static unsigned short de = 1;
139 static unsigned int tune_timeout = 3000;
144 static unsigned int seek_timeout = 5000;
157 .rangelow = 87500 * 16,
158 .rangehigh = 108000 * 16,
169 .rangelow = 76000 * 16,
170 .rangehigh = 108000 * 16,
181 .rangelow = 76000 * 16,
182 .rangehigh = 90000 * 16,
194 static int si470x_set_band(
struct si470x_device *radio,
int band)
196 if (radio->
band == band)
231 "tune timed out after %u ms\n", tune_timeout);
244 static unsigned int si470x_get_step(
struct si470x_device *radio)
273 *freq = chan * si470x_get_step(radio) + bands[radio->
band].
rangelow;
289 chan = (freq - bands[radio->
band].
rangelow) / si470x_get_step(radio);
291 return si470x_set_chan(radio, chan);
307 for (band = 0; band <
ARRAY_SIZE(bands); band++) {
317 if (radio->
band != band) {
318 retval = si470x_get_freq(radio, &freq);
321 retval = si470x_set_band(radio, band);
354 "seek failed / band limit reached\n");
361 if (retval == 0 && timed_out)
399 retval = si470x_set_chan(radio,
457 size_t count, loff_t *ppos)
465 si470x_rds_on(radio);
484 while (block_count < count) {
512 static unsigned int si470x_fops_poll(
struct file *file,
516 unsigned long req_events = poll_requested_events(pts);
522 si470x_rds_on(radio);
539 .read = si470x_fops_read,
540 .poll = si470x_fops_poll,
578 static int si470x_vidioc_g_tuner(
struct file *file,
void *
priv,
584 if (tuner->
index != 0)
624 if (tuner->
signal > 0xffff)
638 static int si470x_vidioc_s_tuner(
struct file *file,
void *priv,
643 if (tuner->
index != 0)
664 static int si470x_vidioc_g_frequency(
struct file *file,
void *priv,
669 if (freq->
tuner != 0)
673 return si470x_get_freq(radio, &freq->
frequency);
680 static int si470x_vidioc_s_frequency(
struct file *file,
void *priv,
686 if (freq->
tuner != 0)
692 retval = si470x_set_band(radio, 1);
703 static int si470x_vidioc_s_hw_freq_seek(
struct file *file,
void *priv,
708 if (seek->
tuner != 0)
714 return si470x_set_seek(radio, seek);
720 static int si470x_vidioc_enum_freq_bands(
struct file *file,
void *priv,
723 if (band->
tuner != 0)
727 *band = bands[band->
index];
732 .s_ctrl = si470x_s_ctrl,
740 .vidioc_g_tuner = si470x_vidioc_g_tuner,
741 .vidioc_s_tuner = si470x_vidioc_s_tuner,
742 .vidioc_g_frequency = si470x_vidioc_g_frequency,
743 .vidioc_s_frequency = si470x_vidioc_s_frequency,
744 .vidioc_s_hw_freq_seek = si470x_vidioc_s_hw_freq_seek,
745 .vidioc_enum_freq_bands = si470x_vidioc_enum_freq_bands,
755 .fops = &si470x_fops,
758 .ioctl_ops = &si470x_ioctl_ops,