2 #include <linux/list.h>
3 #include <linux/module.h>
4 #include <linux/kernel.h>
5 #include <linux/bitmap.h>
12 #include <linux/sched.h>
18 static int poseidon_fm_close(
struct file *filp);
19 static int poseidon_fm_open(
struct file *filp);
21 #define TUNER_FREQ_MIN_FM 76000000
22 #define TUNER_FREQ_MAX_FM 108000000
24 #define MAX_PREEMPHASIS (V4L2_PREEMPHASIS_75_uS + 1)
31 static int poseidon_check_mode_radio(
struct poseidon *
p)
59 static int pm_fm_suspend(
struct poseidon *p)
68 static int pm_fm_resume(
struct poseidon *p)
71 poseidon_check_mode_radio(p);
78 static int poseidon_fm_open(
struct file *filp)
81 struct poseidon *p = video_get_drvdata(vfd);
105 ret = poseidon_check_mode_radio(p);
120 static int poseidon_fm_close(
struct file *filp)
143 static int vidioc_querycap(
struct file *
file,
void *
priv,
157 .open = poseidon_fm_open,
158 .release = poseidon_fm_close,
162 static int tlg_fm_vidioc_g_tuner(
struct file *
file,
void *
priv,
183 &fm_stat, &status,
sizeof(fm_stat));
190 &fm_stat, &status,
sizeof(fm_stat));
205 static int fm_get_freq(
struct file *file,
void *priv,
224 freq = (frequency * 125) * 500 / 1000;
249 static int fm_set_freq(
struct file *file,
void *priv,
256 p->pm_suspend = pm_fm_suspend;
257 p->pm_resume = pm_fm_resume;
259 return set_frequency(p, argp->
frequency);
262 static int tlg_fm_vidioc_g_ctrl(
struct file *file,
void *priv,
268 static int tlg_fm_vidioc_g_exts_ctrl(
struct file *file,
void *fh,
277 for (i = 0; i < ctrls->
count; i++) {
289 static int tlg_fm_vidioc_s_exts_ctrl(
struct file *file,
void *fh,
297 for (i = 0; i < ctrls->
count; i++) {
309 pre_emphasis, &status);
316 static int tlg_fm_vidioc_s_ctrl(
struct file *file,
void *priv,
322 static int tlg_fm_vidioc_queryctrl(
struct file *file,
void *priv,
341 static int tlg_fm_vidioc_querymenu(
struct file *file,
void *fh,
347 static int vidioc_s_tuner(
struct file *file,
void *priv,
struct v4l2_tuner *vt)
351 static int vidioc_s_audio(
struct file *file,
void *priv,
const struct v4l2_audio *
va)
356 static int vidioc_g_audio(
struct file *file,
void *priv,
struct v4l2_audio *
a)
365 static int vidioc_s_input(
struct file *filp,
void *priv,
u32 i)
367 return (i != 0) ? -
EINVAL : 0;
370 static int vidioc_g_input(
struct file *filp,
void *priv,
u32 *i)
372 return (*i != 0) ? -
EINVAL : 0;
381 .vidioc_queryctrl = tlg_fm_vidioc_queryctrl,
382 .vidioc_querymenu = tlg_fm_vidioc_querymenu,
383 .vidioc_g_ctrl = tlg_fm_vidioc_g_ctrl,
384 .vidioc_s_ctrl = tlg_fm_vidioc_s_ctrl,
385 .vidioc_s_ext_ctrls = tlg_fm_vidioc_s_exts_ctrl,
386 .vidioc_g_ext_ctrls = tlg_fm_vidioc_g_exts_ctrl,
388 .vidioc_g_tuner = tlg_fm_vidioc_g_tuner,
389 .vidioc_g_frequency = fm_get_freq,
390 .vidioc_s_frequency = fm_set_freq,
394 .name =
"Telegent-Radio",
395 .fops = &poseidon_fm_fops,
398 .ioctl_ops = &poseidon_fm_ioctl_ops,
405 fm_dev =
vdev_init(p, &poseidon_fm_template);