aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/media/video/saa7134/saa7134-core.c1
-rw-r--r--drivers/media/video/saa7134/saa7134-video.c76
-rw-r--r--drivers/media/video/saa7134/saa7134.h1
3 files changed, 28 insertions, 50 deletions
diff --git a/drivers/media/video/saa7134/saa7134-core.c b/drivers/media/video/saa7134/saa7134-core.c
index f05b0a9a5e6f..ad982a2c6fe2 100644
--- a/drivers/media/video/saa7134/saa7134-core.c
+++ b/drivers/media/video/saa7134/saa7134-core.c
@@ -734,7 +734,6 @@ static int saa7134_hwfini(struct saa7134_dev *dev)
734 saa7134_ts_fini(dev); 734 saa7134_ts_fini(dev);
735 saa7134_input_fini(dev); 735 saa7134_input_fini(dev);
736 saa7134_vbi_fini(dev); 736 saa7134_vbi_fini(dev);
737 saa7134_video_fini(dev);
738 saa7134_tvaudio_fini(dev); 737 saa7134_tvaudio_fini(dev);
739 return 0; 738 return 0;
740} 739}
diff --git a/drivers/media/video/saa7134/saa7134-video.c b/drivers/media/video/saa7134/saa7134-video.c
index e1cb273e16bc..9985ded20950 100644
--- a/drivers/media/video/saa7134/saa7134-video.c
+++ b/drivers/media/video/saa7134/saa7134-video.c
@@ -26,6 +26,7 @@
26#include <linux/moduleparam.h> 26#include <linux/moduleparam.h>
27#include <linux/kernel.h> 27#include <linux/kernel.h>
28#include <linux/slab.h> 28#include <linux/slab.h>
29#include <linux/sort.h>
29 30
30#include "saa7134-reg.h" 31#include "saa7134-reg.h"
31#include "saa7134.h" 32#include "saa7134.h"
@@ -516,14 +517,12 @@ static int res_get(struct saa7134_dev *dev, struct saa7134_fh *fh, unsigned int
516 return 1; 517 return 1;
517} 518}
518 519
519static 520static int res_check(struct saa7134_fh *fh, unsigned int bit)
520int res_check(struct saa7134_fh *fh, unsigned int bit)
521{ 521{
522 return (fh->resources & bit); 522 return (fh->resources & bit);
523} 523}
524 524
525static 525static int res_locked(struct saa7134_dev *dev, unsigned int bit)
526int res_locked(struct saa7134_dev *dev, unsigned int bit)
527{ 526{
528 return (dev->resources & bit); 527 return (dev->resources & bit);
529} 528}
@@ -739,25 +738,6 @@ struct cliplist {
739 __u8 disable; 738 __u8 disable;
740}; 739};
741 740
742static void sort_cliplist(struct cliplist *cl, int entries)
743{
744 struct cliplist swap;
745 int i,j,n;
746
747 for (i = entries-2; i >= 0; i--) {
748 for (n = 0, j = 0; j <= i; j++) {
749 if (cl[j].position > cl[j+1].position) {
750 swap = cl[j];
751 cl[j] = cl[j+1];
752 cl[j+1] = swap;
753 n++;
754 }
755 }
756 if (0 == n)
757 break;
758 }
759}
760
761static void set_cliplist(struct saa7134_dev *dev, int reg, 741static void set_cliplist(struct saa7134_dev *dev, int reg,
762 struct cliplist *cl, int entries, char *name) 742 struct cliplist *cl, int entries, char *name)
763{ 743{
@@ -791,15 +771,27 @@ static int clip_range(int val)
791 return val; 771 return val;
792} 772}
793 773
774/* Sort into smallest position first order */
775static int cliplist_cmp(const void *a, const void *b)
776{
777 const struct cliplist *cla = a;
778 const struct cliplist *clb = b;
779 if (cla->position < clb->position)
780 return -1;
781 if (cla->position > clb->position)
782 return 1;
783 return 0;
784}
785
794static int setup_clipping(struct saa7134_dev *dev, struct v4l2_clip *clips, 786static int setup_clipping(struct saa7134_dev *dev, struct v4l2_clip *clips,
795 int nclips, int interlace) 787 int nclips, int interlace)
796{ 788{
797 struct cliplist col[16], row[16]; 789 struct cliplist col[16], row[16];
798 int cols, rows, i; 790 int cols = 0, rows = 0, i;
799 int div = interlace ? 2 : 1; 791 int div = interlace ? 2 : 1;
800 792
801 memset(col,0,sizeof(col)); cols = 0; 793 memset(col, 0, sizeof(col));
802 memset(row,0,sizeof(row)); rows = 0; 794 memset(row, 0, sizeof(row));
803 for (i = 0; i < nclips && i < 8; i++) { 795 for (i = 0; i < nclips && i < 8; i++) {
804 col[cols].position = clip_range(clips[i].c.left); 796 col[cols].position = clip_range(clips[i].c.left);
805 col[cols].enable = (1 << i); 797 col[cols].enable = (1 << i);
@@ -815,8 +807,8 @@ static int setup_clipping(struct saa7134_dev *dev, struct v4l2_clip *clips,
815 row[rows].disable = (1 << i); 807 row[rows].disable = (1 << i);
816 rows++; 808 rows++;
817 } 809 }
818 sort_cliplist(col,cols); 810 sort(col, cols, sizeof col[0], cliplist_cmp, NULL);
819 sort_cliplist(row,rows); 811 sort(row, rows, sizeof row[0], cliplist_cmp, NULL);
820 set_cliplist(dev,0x380,col,cols,"cols"); 812 set_cliplist(dev,0x380,col,cols,"cols");
821 set_cliplist(dev,0x384,row,rows,"rows"); 813 set_cliplist(dev,0x384,row,rows,"rows");
822 return 0; 814 return 0;
@@ -1268,19 +1260,14 @@ static struct videobuf_queue* saa7134_queue(struct saa7134_fh *fh)
1268 1260
1269static int saa7134_resource(struct saa7134_fh *fh) 1261static int saa7134_resource(struct saa7134_fh *fh)
1270{ 1262{
1271 int res = 0; 1263 if (fh->type == V4L2_BUF_TYPE_VIDEO_CAPTURE)
1264 return RESOURCE_VIDEO;
1272 1265
1273 switch (fh->type) { 1266 if (fh->type == V4L2_BUF_TYPE_VBI_CAPTURE)
1274 case V4L2_BUF_TYPE_VIDEO_CAPTURE: 1267 return RESOURCE_VBI;
1275 res = RESOURCE_VIDEO; 1268
1276 break; 1269 BUG();
1277 case V4L2_BUF_TYPE_VBI_CAPTURE: 1270 return 0;
1278 res = RESOURCE_VBI;
1279 break;
1280 default:
1281 BUG();
1282 }
1283 return res;
1284} 1271}
1285 1272
1286static int video_open(struct inode *inode, struct file *file) 1273static int video_open(struct inode *inode, struct file *file)
@@ -1468,8 +1455,7 @@ static int video_release(struct inode *inode, struct file *file)
1468 return 0; 1455 return 0;
1469} 1456}
1470 1457
1471static int 1458static int video_mmap(struct file *file, struct vm_area_struct * vma)
1472video_mmap(struct file *file, struct vm_area_struct * vma)
1473{ 1459{
1474 struct saa7134_fh *fh = file->private_data; 1460 struct saa7134_fh *fh = file->private_data;
1475 1461
@@ -2468,12 +2454,6 @@ int saa7134_video_init2(struct saa7134_dev *dev)
2468 return 0; 2454 return 0;
2469} 2455}
2470 2456
2471int saa7134_video_fini(struct saa7134_dev *dev)
2472{
2473 /* nothing */
2474 return 0;
2475}
2476
2477void saa7134_irq_video_intl(struct saa7134_dev *dev) 2457void saa7134_irq_video_intl(struct saa7134_dev *dev)
2478{ 2458{
2479 static const char *st[] = { 2459 static const char *st[] = {
diff --git a/drivers/media/video/saa7134/saa7134.h b/drivers/media/video/saa7134/saa7134.h
index 6aeba144ff6e..07376da7ebd5 100644
--- a/drivers/media/video/saa7134/saa7134.h
+++ b/drivers/media/video/saa7134/saa7134.h
@@ -626,7 +626,6 @@ int saa7134_common_ioctl(struct saa7134_dev *dev,
626 626
627int saa7134_video_init1(struct saa7134_dev *dev); 627int saa7134_video_init1(struct saa7134_dev *dev);
628int saa7134_video_init2(struct saa7134_dev *dev); 628int saa7134_video_init2(struct saa7134_dev *dev);
629int saa7134_video_fini(struct saa7134_dev *dev);
630void saa7134_irq_video_intl(struct saa7134_dev *dev); 629void saa7134_irq_video_intl(struct saa7134_dev *dev);
631void saa7134_irq_video_done(struct saa7134_dev *dev, unsigned long status); 630void saa7134_irq_video_done(struct saa7134_dev *dev, unsigned long status);
632 631