Lines Matching refs:fmi
47 struct fmi struct
58 static struct fmi fmi_card; argument
73 struct fmi *fmi = handle; in fmi_set_pins() local
76 if (!fmi->mute) in fmi_set_pins()
86 mutex_lock(&fmi->lock); in fmi_set_pins()
87 outb_p(bits, fmi->io); in fmi_set_pins()
88 mutex_unlock(&fmi->lock); in fmi_set_pins()
91 static inline void fmi_mute(struct fmi *fmi) in fmi_mute() argument
93 mutex_lock(&fmi->lock); in fmi_mute()
94 outb(0x00, fmi->io); in fmi_mute()
95 mutex_unlock(&fmi->lock); in fmi_mute()
98 static inline void fmi_unmute(struct fmi *fmi) in fmi_unmute() argument
100 mutex_lock(&fmi->lock); in fmi_unmute()
101 outb(0x08, fmi->io); in fmi_unmute()
102 mutex_unlock(&fmi->lock); in fmi_unmute()
105 static inline int fmi_getsigstr(struct fmi *fmi) in fmi_getsigstr() argument
110 mutex_lock(&fmi->lock); in fmi_getsigstr()
111 val = fmi->mute ? 0x00 : 0x08; /* mute/unmute */ in fmi_getsigstr()
112 outb(val, fmi->io); in fmi_getsigstr()
113 outb(val | 0x10, fmi->io); in fmi_getsigstr()
115 res = (int)inb(fmi->io + 1); in fmi_getsigstr()
116 outb(val, fmi->io); in fmi_getsigstr()
118 mutex_unlock(&fmi->lock); in fmi_getsigstr()
122 static void fmi_set_freq(struct fmi *fmi) in fmi_set_freq() argument
124 fmi->curfreq = clamp(fmi->curfreq, RSF16_MINFREQ, RSF16_MAXFREQ); in fmi_set_freq()
127 lm7000_set_freq((fmi->curfreq / 800) * 800, fmi, fmi_set_pins); in fmi_set_freq()
142 struct fmi *fmi = video_drvdata(file); in vidioc_g_tuner() local
154 v->signal = fmi_getsigstr(fmi); in vidioc_g_tuner()
167 struct fmi *fmi = video_drvdata(file); in vidioc_s_frequency() local
172 fmi->curfreq = f->frequency; in vidioc_s_frequency()
173 fmi_set_freq(fmi); in vidioc_s_frequency()
181 struct fmi *fmi = video_drvdata(file); in vidioc_g_frequency() local
186 f->frequency = fmi->curfreq; in vidioc_g_frequency()
192 struct fmi *fmi = container_of(ctrl->handler, struct fmi, hdl); in fmi_s_ctrl() local
197 fmi_mute(fmi); in fmi_s_ctrl()
199 fmi_unmute(fmi); in fmi_s_ctrl()
200 fmi->mute = ctrl->val; in fmi_s_ctrl()
274 struct fmi *fmi = &fmi_card; in fmi_init() local
275 struct v4l2_device *v4l2_dev = &fmi->v4l2_dev; in fmi_init()
276 struct v4l2_ctrl_handler *hdl = &fmi->hdl; in fmi_init()
318 fmi->io = io; in fmi_init()
322 release_region(fmi->io, 2); in fmi_init()
341 strscpy(fmi->vdev.name, v4l2_dev->name, sizeof(fmi->vdev.name)); in fmi_init()
342 fmi->vdev.v4l2_dev = v4l2_dev; in fmi_init()
343 fmi->vdev.fops = &fmi_fops; in fmi_init()
344 fmi->vdev.ioctl_ops = &fmi_ioctl_ops; in fmi_init()
345 fmi->vdev.release = video_device_release_empty; in fmi_init()
346 fmi->vdev.device_caps = V4L2_CAP_TUNER | V4L2_CAP_RADIO; in fmi_init()
347 video_set_drvdata(&fmi->vdev, fmi); in fmi_init()
349 mutex_init(&fmi->lock); in fmi_init()
352 fmi->mute = true; in fmi_init()
353 fmi->curfreq = RSF16_MINFREQ; in fmi_init()
354 fmi_set_freq(fmi); in fmi_init()
356 if (video_register_device(&fmi->vdev, VFL_TYPE_RADIO, radio_nr) < 0) { in fmi_init()
359 release_region(fmi->io, 2); in fmi_init()
365 v4l2_info(v4l2_dev, "card driver at 0x%x\n", fmi->io); in fmi_init()
371 struct fmi *fmi = &fmi_card; in fmi_exit() local
373 v4l2_ctrl_handler_free(&fmi->hdl); in fmi_exit()
374 video_unregister_device(&fmi->vdev); in fmi_exit()
375 v4l2_device_unregister(&fmi->v4l2_dev); in fmi_exit()
376 release_region(fmi->io, 2); in fmi_exit()