These changes are the raw update to linux-4.4.6-rt14. Kernel sources
[kvmfornfv.git] / kernel / drivers / media / pci / saa7134 / saa7134-empress.c
index 594dc3a..56b932c 100644 (file)
@@ -17,6 +17,9 @@
  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
+#include "saa7134.h"
+#include "saa7134-reg.h"
+
 #include <linux/init.h>
 #include <linux/list.h>
 #include <linux/module.h>
@@ -26,9 +29,6 @@
 #include <media/v4l2-common.h>
 #include <media/v4l2-event.h>
 
-#include "saa7134-reg.h"
-#include "saa7134.h"
-
 /* ------------------------------------------------------------------ */
 
 MODULE_AUTHOR("Gerd Knorr <kraxel@bytesex.org> [SuSE Labs]");
@@ -39,13 +39,6 @@ static unsigned int empress_nr[] = {[0 ... (SAA7134_MAXBOARDS - 1)] = UNSET };
 module_param_array(empress_nr, int, NULL, 0444);
 MODULE_PARM_DESC(empress_nr,"ts device number");
 
-static unsigned int debug;
-module_param(debug, int, 0644);
-MODULE_PARM_DESC(debug,"enable debug messages");
-
-#define dprintk(fmt, arg...)   if (debug)                      \
-       printk(KERN_DEBUG "%s/empress: " fmt, dev->name , ## arg)
-
 /* ------------------------------------------------------------------ */
 
 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,
                                struct v4l2_format *f)
 {
        struct saa7134_dev *dev = video_drvdata(file);
-       struct v4l2_mbus_framefmt mbus_fmt;
+       struct v4l2_subdev_format fmt = {
+               .which = V4L2_SUBDEV_FORMAT_ACTIVE,
+       };
+       struct v4l2_mbus_framefmt *mbus_fmt = &fmt.format;
 
-       saa_call_all(dev, video, g_mbus_fmt, &mbus_fmt);
+       saa_call_all(dev, pad, get_fmt, NULL, &fmt);
 
-       v4l2_fill_pix_format(&f->fmt.pix, &mbus_fmt);
+       v4l2_fill_pix_format(&f->fmt.pix, mbus_fmt);
        f->fmt.pix.pixelformat  = V4L2_PIX_FMT_MPEG;
        f->fmt.pix.sizeimage    = TS_PACKET_SIZE * dev->ts.nr_packets;
        f->fmt.pix.bytesperline = 0;
@@ -137,11 +133,13 @@ static int empress_s_fmt_vid_cap(struct file *file, void *priv,
                                struct v4l2_format *f)
 {
        struct saa7134_dev *dev = video_drvdata(file);
-       struct v4l2_mbus_framefmt mbus_fmt;
+       struct v4l2_subdev_format format = {
+               .which = V4L2_SUBDEV_FORMAT_ACTIVE,
+       };
 
-       v4l2_fill_mbus_format(&mbus_fmt, &f->fmt.pix, MEDIA_BUS_FMT_FIXED);
-       saa_call_all(dev, video, s_mbus_fmt, &mbus_fmt);
-       v4l2_fill_pix_format(&f->fmt.pix, &mbus_fmt);
+       v4l2_fill_mbus_format(&format.format, &f->fmt.pix, MEDIA_BUS_FMT_FIXED);
+       saa_call_all(dev, pad, set_fmt, NULL, &format);
+       v4l2_fill_pix_format(&f->fmt.pix, &format.format);
 
        f->fmt.pix.pixelformat  = V4L2_PIX_FMT_MPEG;
        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,
                                struct v4l2_format *f)
 {
        struct saa7134_dev *dev = video_drvdata(file);
-       struct v4l2_mbus_framefmt mbus_fmt;
+       struct v4l2_subdev_pad_config pad_cfg;
+       struct v4l2_subdev_format format = {
+               .which = V4L2_SUBDEV_FORMAT_TRY,
+       };
 
-       v4l2_fill_mbus_format(&mbus_fmt, &f->fmt.pix, MEDIA_BUS_FMT_FIXED);
-       saa_call_all(dev, video, try_mbus_fmt, &mbus_fmt);
-       v4l2_fill_pix_format(&f->fmt.pix, &mbus_fmt);
+       v4l2_fill_mbus_format(&format.format, &f->fmt.pix, MEDIA_BUS_FMT_FIXED);
+       saa_call_all(dev, pad, set_fmt, &pad_cfg, &format);
+       v4l2_fill_pix_format(&f->fmt.pix, &format.format);
 
        f->fmt.pix.pixelformat  = V4L2_PIX_FMT_MPEG;
        f->fmt.pix.sizeimage    = TS_PACKET_SIZE * dev->ts.nr_packets;
@@ -221,9 +222,9 @@ static void empress_signal_update(struct work_struct *work)
                container_of(work, struct saa7134_dev, empress_workqueue);
 
        if (dev->nosignal) {
-               dprintk("no video signal\n");
+               pr_debug("no video signal\n");
        } else {
-               dprintk("video signal acquired\n");
+               pr_debug("video signal acquired\n");
        }
 }
 
@@ -255,7 +256,7 @@ static int empress_init(struct saa7134_dev *dev)
        struct vb2_queue *q;
        int err;
 
-       dprintk("%s: %s\n",dev->name,__func__);
+       pr_debug("%s: %s\n", dev->name, __func__);
        dev->empress_dev = video_device_alloc();
        if (NULL == dev->empress_dev)
                return -ENOMEM;
@@ -302,13 +303,13 @@ static int empress_init(struct saa7134_dev *dev)
        err = video_register_device(dev->empress_dev,VFL_TYPE_GRABBER,
                                    empress_nr[dev->nr]);
        if (err < 0) {
-               printk(KERN_INFO "%s: can't register video device\n",
+               pr_info("%s: can't register video device\n",
                       dev->name);
                video_device_release(dev->empress_dev);
                dev->empress_dev = NULL;
                return err;
        }
-       printk(KERN_INFO "%s: registered device %s [mpeg]\n",
+       pr_info("%s: registered device %s [mpeg]\n",
               dev->name, video_device_node_name(dev->empress_dev));
 
        empress_signal_update(&dev->empress_workqueue);
@@ -317,7 +318,7 @@ static int empress_init(struct saa7134_dev *dev)
 
 static int empress_fini(struct saa7134_dev *dev)
 {
-       dprintk("%s: %s\n",dev->name,__func__);
+       pr_debug("%s: %s\n", dev->name, __func__);
 
        if (NULL == dev->empress_dev)
                return 0;