diff options
Diffstat (limited to 'drivers/media/pci/saa7134/saa7134-empress.c')
| -rw-r--r-- | drivers/media/pci/saa7134/saa7134-empress.c | 55 |
1 files changed, 28 insertions, 27 deletions
diff --git a/drivers/media/pci/saa7134/saa7134-empress.c b/drivers/media/pci/saa7134/saa7134-empress.c index 594dc3ad4750..56b932c97196 100644 --- a/drivers/media/pci/saa7134/saa7134-empress.c +++ b/drivers/media/pci/saa7134/saa7134-empress.c | |||
| @@ -17,6 +17,9 @@ | |||
| 17 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | 17 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
| 18 | */ | 18 | */ |
| 19 | 19 | ||
| 20 | #include "saa7134.h" | ||
| 21 | #include "saa7134-reg.h" | ||
| 22 | |||
| 20 | #include <linux/init.h> | 23 | #include <linux/init.h> |
| 21 | #include <linux/list.h> | 24 | #include <linux/list.h> |
| 22 | #include <linux/module.h> | 25 | #include <linux/module.h> |
| @@ -26,9 +29,6 @@ | |||
| 26 | #include <media/v4l2-common.h> | 29 | #include <media/v4l2-common.h> |
| 27 | #include <media/v4l2-event.h> | 30 | #include <media/v4l2-event.h> |
| 28 | 31 | ||
| 29 | #include "saa7134-reg.h" | ||
| 30 | #include "saa7134.h" | ||
| 31 | |||
| 32 | /* ------------------------------------------------------------------ */ | 32 | /* ------------------------------------------------------------------ */ |
| 33 | 33 | ||
| 34 | MODULE_AUTHOR("Gerd Knorr <kraxel@bytesex.org> [SuSE Labs]"); | 34 | MODULE_AUTHOR("Gerd Knorr <kraxel@bytesex.org> [SuSE Labs]"); |
| @@ -39,13 +39,6 @@ static unsigned int empress_nr[] = {[0 ... (SAA7134_MAXBOARDS - 1)] = UNSET }; | |||
| 39 | module_param_array(empress_nr, int, NULL, 0444); | 39 | module_param_array(empress_nr, int, NULL, 0444); |
| 40 | MODULE_PARM_DESC(empress_nr,"ts device number"); | 40 | MODULE_PARM_DESC(empress_nr,"ts device number"); |
| 41 | 41 | ||
| 42 | static unsigned int debug; | ||
| 43 | module_param(debug, int, 0644); | ||
| 44 | MODULE_PARM_DESC(debug,"enable debug messages"); | ||
| 45 | |||
| 46 | #define dprintk(fmt, arg...) if (debug) \ | ||
| 47 | printk(KERN_DEBUG "%s/empress: " fmt, dev->name , ## arg) | ||
| 48 | |||
| 49 | /* ------------------------------------------------------------------ */ | 42 | /* ------------------------------------------------------------------ */ |
| 50 | 43 | ||
| 51 | static int start_streaming(struct vb2_queue *vq, unsigned int count) | 44 | static int start_streaming(struct vb2_queue *vq, unsigned int count) |
| @@ -121,11 +114,14 @@ static int empress_g_fmt_vid_cap(struct file *file, void *priv, | |||
| 121 | struct v4l2_format *f) | 114 | struct v4l2_format *f) |
| 122 | { | 115 | { |
| 123 | struct saa7134_dev *dev = video_drvdata(file); | 116 | struct saa7134_dev *dev = video_drvdata(file); |
| 124 | struct v4l2_mbus_framefmt mbus_fmt; | 117 | struct v4l2_subdev_format fmt = { |
| 118 | .which = V4L2_SUBDEV_FORMAT_ACTIVE, | ||
| 119 | }; | ||
| 120 | struct v4l2_mbus_framefmt *mbus_fmt = &fmt.format; | ||
| 125 | 121 | ||
| 126 | saa_call_all(dev, video, g_mbus_fmt, &mbus_fmt); | 122 | saa_call_all(dev, pad, get_fmt, NULL, &fmt); |
| 127 | 123 | ||
| 128 | v4l2_fill_pix_format(&f->fmt.pix, &mbus_fmt); | 124 | v4l2_fill_pix_format(&f->fmt.pix, mbus_fmt); |
| 129 | f->fmt.pix.pixelformat = V4L2_PIX_FMT_MPEG; | 125 | f->fmt.pix.pixelformat = V4L2_PIX_FMT_MPEG; |
| 130 | f->fmt.pix.sizeimage = TS_PACKET_SIZE * dev->ts.nr_packets; | 126 | f->fmt.pix.sizeimage = TS_PACKET_SIZE * dev->ts.nr_packets; |
| 131 | f->fmt.pix.bytesperline = 0; | 127 | f->fmt.pix.bytesperline = 0; |
| @@ -137,11 +133,13 @@ static int empress_s_fmt_vid_cap(struct file *file, void *priv, | |||
| 137 | struct v4l2_format *f) | 133 | struct v4l2_format *f) |
| 138 | { | 134 | { |
| 139 | struct saa7134_dev *dev = video_drvdata(file); | 135 | struct saa7134_dev *dev = video_drvdata(file); |
| 140 | struct v4l2_mbus_framefmt mbus_fmt; | 136 | struct v4l2_subdev_format format = { |
| 137 | .which = V4L2_SUBDEV_FORMAT_ACTIVE, | ||
| 138 | }; | ||
| 141 | 139 | ||
| 142 | v4l2_fill_mbus_format(&mbus_fmt, &f->fmt.pix, MEDIA_BUS_FMT_FIXED); | 140 | v4l2_fill_mbus_format(&format.format, &f->fmt.pix, MEDIA_BUS_FMT_FIXED); |
| 143 | saa_call_all(dev, video, s_mbus_fmt, &mbus_fmt); | 141 | saa_call_all(dev, pad, set_fmt, NULL, &format); |
| 144 | v4l2_fill_pix_format(&f->fmt.pix, &mbus_fmt); | 142 | v4l2_fill_pix_format(&f->fmt.pix, &format.format); |
| 145 | 143 | ||
| 146 | f->fmt.pix.pixelformat = V4L2_PIX_FMT_MPEG; | 144 | f->fmt.pix.pixelformat = V4L2_PIX_FMT_MPEG; |
| 147 | f->fmt.pix.sizeimage = TS_PACKET_SIZE * dev->ts.nr_packets; | 145 | f->fmt.pix.sizeimage = TS_PACKET_SIZE * dev->ts.nr_packets; |
| @@ -154,11 +152,14 @@ static int empress_try_fmt_vid_cap(struct file *file, void *priv, | |||
| 154 | struct v4l2_format *f) | 152 | struct v4l2_format *f) |
| 155 | { | 153 | { |
| 156 | struct saa7134_dev *dev = video_drvdata(file); | 154 | struct saa7134_dev *dev = video_drvdata(file); |
| 157 | struct v4l2_mbus_framefmt mbus_fmt; | 155 | struct v4l2_subdev_pad_config pad_cfg; |
| 156 | struct v4l2_subdev_format format = { | ||
| 157 | .which = V4L2_SUBDEV_FORMAT_TRY, | ||
| 158 | }; | ||
| 158 | 159 | ||
| 159 | v4l2_fill_mbus_format(&mbus_fmt, &f->fmt.pix, MEDIA_BUS_FMT_FIXED); | 160 | v4l2_fill_mbus_format(&format.format, &f->fmt.pix, MEDIA_BUS_FMT_FIXED); |
| 160 | saa_call_all(dev, video, try_mbus_fmt, &mbus_fmt); | 161 | saa_call_all(dev, pad, set_fmt, &pad_cfg, &format); |
| 161 | v4l2_fill_pix_format(&f->fmt.pix, &mbus_fmt); | 162 | v4l2_fill_pix_format(&f->fmt.pix, &format.format); |
| 162 | 163 | ||
| 163 | f->fmt.pix.pixelformat = V4L2_PIX_FMT_MPEG; | 164 | f->fmt.pix.pixelformat = V4L2_PIX_FMT_MPEG; |
| 164 | f->fmt.pix.sizeimage = TS_PACKET_SIZE * dev->ts.nr_packets; | 165 | f->fmt.pix.sizeimage = TS_PACKET_SIZE * dev->ts.nr_packets; |
| @@ -221,9 +222,9 @@ static void empress_signal_update(struct work_struct *work) | |||
| 221 | container_of(work, struct saa7134_dev, empress_workqueue); | 222 | container_of(work, struct saa7134_dev, empress_workqueue); |
| 222 | 223 | ||
| 223 | if (dev->nosignal) { | 224 | if (dev->nosignal) { |
| 224 | dprintk("no video signal\n"); | 225 | pr_debug("no video signal\n"); |
| 225 | } else { | 226 | } else { |
| 226 | dprintk("video signal acquired\n"); | 227 | pr_debug("video signal acquired\n"); |
| 227 | } | 228 | } |
| 228 | } | 229 | } |
| 229 | 230 | ||
| @@ -255,7 +256,7 @@ static int empress_init(struct saa7134_dev *dev) | |||
| 255 | struct vb2_queue *q; | 256 | struct vb2_queue *q; |
| 256 | int err; | 257 | int err; |
| 257 | 258 | ||
| 258 | dprintk("%s: %s\n",dev->name,__func__); | 259 | pr_debug("%s: %s\n", dev->name, __func__); |
| 259 | dev->empress_dev = video_device_alloc(); | 260 | dev->empress_dev = video_device_alloc(); |
| 260 | if (NULL == dev->empress_dev) | 261 | if (NULL == dev->empress_dev) |
| 261 | return -ENOMEM; | 262 | return -ENOMEM; |
| @@ -302,13 +303,13 @@ static int empress_init(struct saa7134_dev *dev) | |||
| 302 | err = video_register_device(dev->empress_dev,VFL_TYPE_GRABBER, | 303 | err = video_register_device(dev->empress_dev,VFL_TYPE_GRABBER, |
| 303 | empress_nr[dev->nr]); | 304 | empress_nr[dev->nr]); |
| 304 | if (err < 0) { | 305 | if (err < 0) { |
| 305 | printk(KERN_INFO "%s: can't register video device\n", | 306 | pr_info("%s: can't register video device\n", |
| 306 | dev->name); | 307 | dev->name); |
| 307 | video_device_release(dev->empress_dev); | 308 | video_device_release(dev->empress_dev); |
| 308 | dev->empress_dev = NULL; | 309 | dev->empress_dev = NULL; |
| 309 | return err; | 310 | return err; |
| 310 | } | 311 | } |
| 311 | printk(KERN_INFO "%s: registered device %s [mpeg]\n", | 312 | pr_info("%s: registered device %s [mpeg]\n", |
| 312 | dev->name, video_device_node_name(dev->empress_dev)); | 313 | dev->name, video_device_node_name(dev->empress_dev)); |
| 313 | 314 | ||
| 314 | empress_signal_update(&dev->empress_workqueue); | 315 | empress_signal_update(&dev->empress_workqueue); |
| @@ -317,7 +318,7 @@ static int empress_init(struct saa7134_dev *dev) | |||
| 317 | 318 | ||
| 318 | static int empress_fini(struct saa7134_dev *dev) | 319 | static int empress_fini(struct saa7134_dev *dev) |
| 319 | { | 320 | { |
| 320 | dprintk("%s: %s\n",dev->name,__func__); | 321 | pr_debug("%s: %s\n", dev->name, __func__); |
| 321 | 322 | ||
| 322 | if (NULL == dev->empress_dev) | 323 | if (NULL == dev->empress_dev) |
| 323 | return 0; | 324 | return 0; |
