Date:2011-10-09 01:44:12 (12 years 2 months ago)
Author:Maarten ter Huurne
Commit:6e2603c6b0f15c7bb1083be8a04e83f1f1534338
Message:media: radio: RDA5807: Implemented VIDIOC_S_HW_FREQ_SEEK ioctl.

This enables hardware seeking.
The seek threshold is not configurable yet though, for lack of an API.
Files: drivers/media/radio/radio-rda5807.c (3 diffs)

Change Details

drivers/media/radio/radio-rda5807.c
257257    return rda5807_update_reg(radio, RDA5807_REG_CHAN, mask, val);
258258}
259259
260static int rda5807_seek_frequency(struct rda5807_driver *radio,
261                  int upward, int wrap)
262{
263    u16 mask = 0;
264    u16 val = 0;
265
266    /* TODO: Seek threshold is configurable. How should the driver handle
267     * this configuration?
268     */
269    /* seek up or down? */
270    mask |= RDA5807_MASK_CTRL_SEEKUP;
271    if (upward)
272        val |= RDA5807_MASK_CTRL_SEEKUP;
273    /* wrap around at band limit? */
274    mask |= RDA5807_MASK_CTRL_SKMODE;
275    if (!wrap)
276        val |= RDA5807_MASK_CTRL_SKMODE;
277    /* seek command */
278    mask |= RDA5807_MASK_CTRL_SEEK;
279    val |= RDA5807_MASK_CTRL_SEEK;
280
281    return rda5807_update_reg(radio, RDA5807_REG_CTRL, mask, val);
282}
283
260284static inline struct rda5807_driver *ctrl_to_radio(struct v4l2_ctrl *ctrl)
261285{
262286    return container_of(ctrl->handler, struct rda5807_driver, ctrl_handler);
...... 
296320        .driver = "rda5807",
297321        .card = "RDA5807 FM receiver",
298322        .bus_info = "I2C",
299        .capabilities = V4L2_CAP_RADIO | V4L2_CAP_TUNER,
323        .capabilities = V4L2_CAP_RADIO | V4L2_CAP_TUNER
324                    | V4L2_CAP_HW_FREQ_SEEK,
300325    };
301326
302327    return 0;
...... 
395420    return rda5807_set_frequency(radio, (a->frequency * 625) / 10000);
396421}
397422
423static int rda5807_vidioc_s_hw_freq_seek(struct file *file, void *fh,
424                     struct v4l2_hw_freq_seek *a)
425{
426    struct rda5807_driver *radio = video_drvdata(file);
427
428    if (a->tuner != 0)
429        return -EINVAL;
430    if (a->type != V4L2_TUNER_RADIO)
431        return -EINVAL;
432
433    return rda5807_seek_frequency(radio, a->seek_upward, a->wrap_around);
434}
435
398436static const struct v4l2_ioctl_ops rda5807_ioctl_ops = {
399437    .vidioc_querycap = rda5807_vidioc_querycap,
400438    .vidioc_g_audio = rda5807_vidioc_g_audio,
401439    .vidioc_g_tuner = rda5807_vidioc_g_tuner,
402440    .vidioc_g_frequency = rda5807_vidioc_g_frequency,
403441    .vidioc_s_frequency = rda5807_vidioc_s_frequency,
442    .vidioc_s_hw_freq_seek = rda5807_vidioc_s_hw_freq_seek,
404443};
405444
406445static int __devinit rda5807_i2c_probe(struct i2c_client *client,

Archive Download the corresponding diff file



interactive