aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/usb
diff options
context:
space:
mode:
authorFrank Schaefer <fschaefer.oss@googlemail.com>2014-03-24 15:33:22 -0400
committerMauro Carvalho Chehab <m.chehab@samsung.com>2014-05-23 12:39:38 -0400
commit3854b0d847d558bdc820b93ae8a93c0923d0211d (patch)
tree9d7151bcc74859a8a0a7bd9e50b9533375894ea9 /drivers/media/usb
parent8139a4d583abad45eb987b5a99b3281b6d435b7e (diff)
[media] em28xx: move tuner frequency field from struct em28xx to struct v4l2
Move V4L2-specific frequency cache to struct em28xx_v4l2. Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Diffstat (limited to 'drivers/media/usb')
-rw-r--r--drivers/media/usb/em28xx/em28xx-video.c16
-rw-r--r--drivers/media/usb/em28xx/em28xx.h3
2 files changed, 11 insertions, 8 deletions
diff --git a/drivers/media/usb/em28xx/em28xx-video.c b/drivers/media/usb/em28xx/em28xx-video.c
index 110673a4db10..46c42c6f34f6 100644
--- a/drivers/media/usb/em28xx/em28xx-video.c
+++ b/drivers/media/usb/em28xx/em28xx-video.c
@@ -963,7 +963,7 @@ int em28xx_start_analog_streaming(struct vb2_queue *vq, unsigned int count)
963 963
964 /* Ask tuner to go to analog or radio mode */ 964 /* Ask tuner to go to analog or radio mode */
965 memset(&f, 0, sizeof(f)); 965 memset(&f, 0, sizeof(f));
966 f.frequency = dev->ctl_freq; 966 f.frequency = v4l2->frequency;
967 if (vq->owner && vq->owner->vdev->vfl_type == VFL_TYPE_RADIO) 967 if (vq->owner && vq->owner->vdev->vfl_type == VFL_TYPE_RADIO)
968 f.type = V4L2_TUNER_RADIO; 968 f.type = V4L2_TUNER_RADIO;
969 else 969 else
@@ -1593,11 +1593,12 @@ static int vidioc_g_frequency(struct file *file, void *priv,
1593{ 1593{
1594 struct em28xx_fh *fh = priv; 1594 struct em28xx_fh *fh = priv;
1595 struct em28xx *dev = fh->dev; 1595 struct em28xx *dev = fh->dev;
1596 struct em28xx_v4l2 *v4l2 = dev->v4l2;
1596 1597
1597 if (0 != f->tuner) 1598 if (0 != f->tuner)
1598 return -EINVAL; 1599 return -EINVAL;
1599 1600
1600 f->frequency = dev->ctl_freq; 1601 f->frequency = v4l2->frequency;
1601 return 0; 1602 return 0;
1602} 1603}
1603 1604
@@ -1614,7 +1615,7 @@ static int vidioc_s_frequency(struct file *file, void *priv,
1614 1615
1615 v4l2_device_call_all(&v4l2->v4l2_dev, 0, tuner, s_frequency, f); 1616 v4l2_device_call_all(&v4l2->v4l2_dev, 0, tuner, s_frequency, f);
1616 v4l2_device_call_all(&v4l2->v4l2_dev, 0, tuner, g_frequency, &new_freq); 1617 v4l2_device_call_all(&v4l2->v4l2_dev, 0, tuner, g_frequency, &new_freq);
1617 dev->ctl_freq = new_freq.frequency; 1618 v4l2->frequency = new_freq.frequency;
1618 1619
1619 return 0; 1620 return 0;
1620} 1621}
@@ -2220,9 +2221,10 @@ static struct video_device *em28xx_vdev_init(struct em28xx *dev,
2220 2221
2221static void em28xx_tuner_setup(struct em28xx *dev) 2222static void em28xx_tuner_setup(struct em28xx *dev)
2222{ 2223{
2223 struct v4l2_device *v4l2_dev = &dev->v4l2->v4l2_dev; 2224 struct em28xx_v4l2 *v4l2 = dev->v4l2;
2224 struct tuner_setup tun_setup; 2225 struct v4l2_device *v4l2_dev = &v4l2->v4l2_dev;
2225 struct v4l2_frequency f; 2226 struct tuner_setup tun_setup;
2227 struct v4l2_frequency f;
2226 2228
2227 if (dev->tuner_type == TUNER_ABSENT) 2229 if (dev->tuner_type == TUNER_ABSENT)
2228 return; 2230 return;
@@ -2277,7 +2279,7 @@ static void em28xx_tuner_setup(struct em28xx *dev)
2277 f.tuner = 0; 2279 f.tuner = 0;
2278 f.type = V4L2_TUNER_ANALOG_TV; 2280 f.type = V4L2_TUNER_ANALOG_TV;
2279 f.frequency = 9076; /* just a magic number */ 2281 f.frequency = 9076; /* just a magic number */
2280 dev->ctl_freq = f.frequency; 2282 v4l2->frequency = f.frequency;
2281 v4l2_device_call_all(v4l2_dev, 0, tuner, s_frequency, &f); 2283 v4l2_device_call_all(v4l2_dev, 0, tuner, s_frequency, &f);
2282} 2284}
2283 2285
diff --git a/drivers/media/usb/em28xx/em28xx.h b/drivers/media/usb/em28xx/em28xx.h
index 998be42c0f70..1ea809587c93 100644
--- a/drivers/media/usb/em28xx/em28xx.h
+++ b/drivers/media/usb/em28xx/em28xx.h
@@ -527,6 +527,8 @@ struct em28xx_v4l2 {
527 int users; /* user count for exclusive use */ 527 int users; /* user count for exclusive use */
528 int streaming_users; /* number of actively streaming users */ 528 int streaming_users; /* number of actively streaming users */
529 529
530 u32 frequency; /* selected tuner frequency */
531
530 struct em28xx_fmt *format; 532 struct em28xx_fmt *format;
531 v4l2_std_id norm; /* selected tv norm */ 533 v4l2_std_id norm; /* selected tv norm */
532 534
@@ -645,7 +647,6 @@ struct em28xx {
645 struct rt_mutex i2c_bus_lock; 647 struct rt_mutex i2c_bus_lock;
646 648
647 /* video for linux */ 649 /* video for linux */
648 int ctl_freq; /* selected frequency */
649 unsigned int ctl_input; /* selected input */ 650 unsigned int ctl_input; /* selected input */
650 unsigned int ctl_ainput;/* selected audio input */ 651 unsigned int ctl_ainput;/* selected audio input */
651 unsigned int ctl_aoutput;/* selected audio output */ 652 unsigned int ctl_aoutput;/* selected audio output */