aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
authorHans Verkuil <hans.verkuil@cisco.com>2013-04-13 12:34:34 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2013-04-16 17:09:18 -0400
commita6aa0dc482d7aad5fc4366d4c92d07a10d712b82 (patch)
tree045dc5002d914a78d457c6523a6cc6aa2f4b6d51 /drivers/media
parent7704cfb9cde649d514029a180cdfb7ccf0a36032 (diff)
[media] cx25821: remove references to subdevices that aren't there
This driver does not have subdevices, so why call subdev ops? After removing that it became apparent that only Composite is supported as input, so remove also any reference to other inputs. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/pci/cx25821/cx25821-cards.c1
-rw-r--r--drivers/media/pci/cx25821/cx25821-video.c111
-rw-r--r--drivers/media/pci/cx25821/cx25821.h26
3 files changed, 7 insertions, 131 deletions
diff --git a/drivers/media/pci/cx25821/cx25821-cards.c b/drivers/media/pci/cx25821/cx25821-cards.c
index 2b2f1f4f87ac..3b409feb03d8 100644
--- a/drivers/media/pci/cx25821/cx25821-cards.c
+++ b/drivers/media/pci/cx25821/cx25821-cards.c
@@ -42,7 +42,6 @@ struct cx25821_board cx25821_boards[] = {
42 .name = "CX25821", 42 .name = "CX25821",
43 .portb = CX25821_RAW, 43 .portb = CX25821_RAW,
44 .portc = CX25821_264, 44 .portc = CX25821_264,
45 .input[0].type = CX25821_VMUX_COMPOSITE,
46 }, 45 },
47 46
48}; 47};
diff --git a/drivers/media/pci/cx25821/cx25821-video.c b/drivers/media/pci/cx25821/cx25821-video.c
index d3aa166740cd..49686447cc4a 100644
--- a/drivers/media/pci/cx25821/cx25821-video.c
+++ b/drivers/media/pci/cx25821/cx25821-video.c
@@ -111,37 +111,6 @@ void cx25821_video_wakeup(struct cx25821_dev *dev, struct cx25821_dmaqueue *q,
111 pr_err("%s: %d buffers handled (should be 1)\n", __func__, bc); 111 pr_err("%s: %d buffers handled (should be 1)\n", __func__, bc);
112} 112}
113 113
114static int cx25821_set_tvnorm(struct cx25821_dev *dev, v4l2_std_id norm)
115{
116 dprintk(1, "%s(norm = 0x%08x) name: [%s]\n",
117 __func__, (unsigned int)norm, v4l2_norm_to_name(norm));
118
119 dev->tvnorm = norm;
120
121 /* Tell the internal A/V decoder */
122 cx25821_call_all(dev, core, s_std, norm);
123
124 return 0;
125}
126
127static int cx25821_video_mux(struct cx25821_dev *dev, unsigned int input)
128{
129 struct v4l2_routing route;
130 memset(&route, 0, sizeof(route));
131
132 dprintk(1, "%s(): video_mux: %d [vmux=%d, gpio=0x%x,0x%x,0x%x,0x%x]\n",
133 __func__, input, INPUT(input)->vmux, INPUT(input)->gpio0,
134 INPUT(input)->gpio1, INPUT(input)->gpio2, INPUT(input)->gpio3);
135 dev->input = input;
136
137 route.input = INPUT(input)->vmux;
138
139 /* Tell the internal A/V decoder */
140 cx25821_call_all(dev, video, s_routing, INPUT(input)->vmux, 0, 0);
141
142 return 0;
143}
144
145int cx25821_start_video_dma(struct cx25821_dev *dev, 114int cx25821_start_video_dma(struct cx25821_dev *dev,
146 struct cx25821_dmaqueue *q, 115 struct cx25821_dmaqueue *q,
147 struct cx25821_buffer *buf, 116 struct cx25821_buffer *buf,
@@ -673,9 +642,8 @@ static int vidioc_s_fmt_vid_cap(struct file *file, void *priv,
673{ 642{
674 struct cx25821_channel *chan = video_drvdata(file); 643 struct cx25821_channel *chan = video_drvdata(file);
675 struct cx25821_dev *dev = chan->dev; 644 struct cx25821_dev *dev = chan->dev;
676 struct v4l2_mbus_framefmt mbus_fmt;
677 int err;
678 int pix_format = PIXEL_FRMT_422; 645 int pix_format = PIXEL_FRMT_422;
646 int err;
679 647
680 err = cx25821_vidioc_try_fmt_vid_cap(file, priv, f); 648 err = cx25821_vidioc_try_fmt_vid_cap(file, priv, f);
681 649
@@ -702,10 +670,6 @@ static int vidioc_s_fmt_vid_cap(struct file *file, void *priv,
702 670
703 chan->cif_width = chan->width; 671 chan->cif_width = chan->width;
704 medusa_set_resolution(dev, chan->width, SRAM_CH00); 672 medusa_set_resolution(dev, chan->width, SRAM_CH00);
705
706 v4l2_fill_mbus_format(&mbus_fmt, &f->fmt.pix, V4L2_MBUS_FMT_FIXED);
707 cx25821_call_all(dev, video, s_mbus_fmt, &mbus_fmt);
708
709 return 0; 673 return 0;
710} 674}
711 675
@@ -727,7 +691,6 @@ static int vidioc_log_status(struct file *file, void *priv)
727 const struct sram_channel *sram_ch = chan->sram_channels; 691 const struct sram_channel *sram_ch = chan->sram_channels;
728 u32 tmp = 0; 692 u32 tmp = 0;
729 693
730 cx25821_call_all(dev, core, log_status);
731 tmp = cx_read(sram_ch->dma_ctl); 694 tmp = cx_read(sram_ch->dma_ctl);
732 pr_info("Video input 0 is %s\n", 695 pr_info("Video input 0 is %s\n",
733 (tmp & 0x11) ? "streaming" : "stopped"); 696 (tmp & 0x11) ? "streaming" : "stopped");
@@ -806,7 +769,7 @@ int cx25821_vidioc_s_std(struct file *file, void *priv, v4l2_std_id tvnorms)
806 if (dev->tvnorm == tvnorms) 769 if (dev->tvnorm == tvnorms)
807 return 0; 770 return 0;
808 771
809 cx25821_set_tvnorm(dev, tvnorms); 772 dev->tvnorm = tvnorms;
810 chan->width = 720; 773 chan->width = 720;
811 chan->height = (dev->tvnorm & V4L2_STD_625_50) ? 576 : 480; 774 chan->height = (dev->tvnorm & V4L2_STD_625_50) ? 576 : 480;
812 775
@@ -818,81 +781,26 @@ int cx25821_vidioc_s_std(struct file *file, void *priv, v4l2_std_id tvnorms)
818static int cx25821_vidioc_enum_input(struct file *file, void *priv, 781static int cx25821_vidioc_enum_input(struct file *file, void *priv,
819 struct v4l2_input *i) 782 struct v4l2_input *i)
820{ 783{
821 static const char * const iname[] = { 784 if (i->index)
822 [CX25821_VMUX_COMPOSITE] = "Composite",
823 [CX25821_VMUX_SVIDEO] = "S-Video",
824 [CX25821_VMUX_DEBUG] = "for debug only",
825 };
826 struct cx25821_channel *chan = video_drvdata(file);
827 struct cx25821_dev *dev = chan->dev;
828 unsigned int n;
829
830 n = i->index;
831 if (n >= CX25821_NR_INPUT)
832 return -EINVAL;
833
834 if (0 == INPUT(n)->type)
835 return -EINVAL; 785 return -EINVAL;
836 786
837 i->type = V4L2_INPUT_TYPE_CAMERA; 787 i->type = V4L2_INPUT_TYPE_CAMERA;
838 strcpy(i->name, iname[INPUT(n)->type]);
839
840 i->std = CX25821_NORMS; 788 i->std = CX25821_NORMS;
789 strcpy(i->name, "Composite");
841 return 0; 790 return 0;
842} 791}
843 792
844static int cx25821_vidioc_g_input(struct file *file, void *priv, unsigned int *i) 793static int cx25821_vidioc_g_input(struct file *file, void *priv, unsigned int *i)
845{ 794{
846 struct cx25821_channel *chan = video_drvdata(file); 795 *i = 0;
847 struct cx25821_dev *dev = chan->dev;
848
849 *i = dev->input;
850 return 0; 796 return 0;
851} 797}
852 798
853static int cx25821_vidioc_s_input(struct file *file, void *priv, unsigned int i) 799static int cx25821_vidioc_s_input(struct file *file, void *priv, unsigned int i)
854{ 800{
855 struct cx25821_channel *chan = video_drvdata(file); 801 return i ? -EINVAL : 0;
856 struct cx25821_dev *dev = chan->dev;
857
858 if (i >= CX25821_NR_INPUT || INPUT(i)->type == 0)
859 return -EINVAL;
860
861 cx25821_video_mux(dev, i);
862 return 0;
863} 802}
864 803
865#ifdef CONFIG_VIDEO_ADV_DEBUG
866int cx25821_vidioc_g_register(struct file *file, void *fh,
867 struct v4l2_dbg_register *reg)
868{
869 struct cx25821_channel *chan = video_drvdata(file);
870 struct cx25821_dev *dev = chan->dev;
871
872 if (!v4l2_chip_match_host(&reg->match))
873 return -EINVAL;
874
875 cx25821_call_all(dev, core, g_register, reg);
876
877 return 0;
878}
879
880int cx25821_vidioc_s_register(struct file *file, void *fh,
881 const struct v4l2_dbg_register *reg)
882{
883 struct cx25821_channel *chan = video_drvdata(file);
884 struct cx25821_dev *dev = chan->dev;
885
886 if (!v4l2_chip_match_host(&reg->match))
887 return -EINVAL;
888
889 cx25821_call_all(dev, core, s_register, reg);
890
891 return 0;
892}
893
894#endif
895
896static int cx25821_s_ctrl(struct v4l2_ctrl *ctrl) 804static int cx25821_s_ctrl(struct v4l2_ctrl *ctrl)
897{ 805{
898 struct cx25821_channel *chan = 806 struct cx25821_channel *chan =
@@ -1088,10 +996,6 @@ static const struct v4l2_ioctl_ops video_ioctl_ops = {
1088 .vidioc_log_status = vidioc_log_status, 996 .vidioc_log_status = vidioc_log_status,
1089 .vidioc_subscribe_event = v4l2_ctrl_subscribe_event, 997 .vidioc_subscribe_event = v4l2_ctrl_subscribe_event,
1090 .vidioc_unsubscribe_event = v4l2_event_unsubscribe, 998 .vidioc_unsubscribe_event = v4l2_event_unsubscribe,
1091#ifdef CONFIG_VIDEO_ADV_DEBUG
1092 .vidioc_g_register = cx25821_vidioc_g_register,
1093 .vidioc_s_register = cx25821_vidioc_s_register,
1094#endif
1095}; 999};
1096 1000
1097static const struct video_device cx25821_video_device = { 1001static const struct video_device cx25821_video_device = {
@@ -1122,8 +1026,7 @@ int cx25821_video_register(struct cx25821_dev *dev)
1122 int i; 1026 int i;
1123 1027
1124 /* initial device configuration */ 1028 /* initial device configuration */
1125 dev->tvnorm = V4L2_STD_NTSC_M, 1029 dev->tvnorm = V4L2_STD_NTSC_M;
1126 cx25821_set_tvnorm(dev, dev->tvnorm);
1127 1030
1128 spin_lock_init(&dev->slock); 1031 spin_lock_init(&dev->slock);
1129 1032
diff --git a/drivers/media/pci/cx25821/cx25821.h b/drivers/media/pci/cx25821/cx25821.h
index cfda5ac4faaa..67b3c550e454 100644
--- a/drivers/media/pci/cx25821/cx25821.h
+++ b/drivers/media/pci/cx25821/cx25821.h
@@ -62,7 +62,6 @@
62 62
63/* Max number of inputs by card */ 63/* Max number of inputs by card */
64#define MAX_CX25821_INPUT 8 64#define MAX_CX25821_INPUT 8
65#define INPUT(nr) (&cx25821_boards[dev->board].input[nr])
66#define RESOURCE_VIDEO0 1 65#define RESOURCE_VIDEO0 1
67#define RESOURCE_VIDEO1 2 66#define RESOURCE_VIDEO1 2
68#define RESOURCE_VIDEO2 4 67#define RESOURCE_VIDEO2 4
@@ -91,7 +90,6 @@
91#define CX25821_BOARD_CONEXANT_ATHENA10 1 90#define CX25821_BOARD_CONEXANT_ATHENA10 1
92#define MAX_VID_CHANNEL_NUM 12 91#define MAX_VID_CHANNEL_NUM 12
93#define VID_CHANNEL_NUM 8 92#define VID_CHANNEL_NUM 8
94#define CX25821_NR_INPUT 2
95 93
96struct cx25821_fmt { 94struct cx25821_fmt {
97 char *name; 95 char *name;
@@ -101,14 +99,6 @@ struct cx25821_fmt {
101 u32 cxformat; 99 u32 cxformat;
102}; 100};
103 101
104struct cx25821_ctrl {
105 struct v4l2_queryctrl v;
106 u32 off;
107 u32 reg;
108 u32 mask;
109 u32 shift;
110};
111
112struct cx25821_tvnorm { 102struct cx25821_tvnorm {
113 char *name; 103 char *name;
114 v4l2_std_id id; 104 v4l2_std_id id;
@@ -116,12 +106,6 @@ struct cx25821_tvnorm {
116 u32 cxoformat; 106 u32 cxoformat;
117}; 107};
118 108
119enum cx25821_itype {
120 CX25821_VMUX_COMPOSITE = 1,
121 CX25821_VMUX_SVIDEO,
122 CX25821_VMUX_DEBUG,
123};
124
125enum cx25821_src_sel_type { 109enum cx25821_src_sel_type {
126 CX25821_SRC_SEL_EXT_656_VIDEO = 0, 110 CX25821_SRC_SEL_EXT_656_VIDEO = 0,
127 CX25821_SRC_SEL_PARALLEL_MPEG_VIDEO 111 CX25821_SRC_SEL_PARALLEL_MPEG_VIDEO
@@ -139,12 +123,6 @@ struct cx25821_buffer {
139 u32 count; 123 u32 count;
140}; 124};
141 125
142struct cx25821_input {
143 enum cx25821_itype type;
144 unsigned int vmux;
145 u32 gpio0, gpio1, gpio2, gpio3;
146};
147
148enum port { 126enum port {
149 CX25821_UNDEFINED = 0, 127 CX25821_UNDEFINED = 0,
150 CX25821_RAW, 128 CX25821_RAW,
@@ -158,7 +136,6 @@ struct cx25821_board {
158 enum port portc; 136 enum port portc;
159 137
160 u32 clk_freq; 138 u32 clk_freq;
161 struct cx25821_input input[CX25821_NR_INPUT];
162}; 139};
163 140
164struct cx25821_i2c { 141struct cx25821_i2c {
@@ -365,9 +342,6 @@ static inline struct cx25821_dev *get_cx25821(struct v4l2_device *v4l2_dev)
365 return container_of(v4l2_dev, struct cx25821_dev, v4l2_dev); 342 return container_of(v4l2_dev, struct cx25821_dev, v4l2_dev);
366} 343}
367 344
368#define cx25821_call_all(dev, o, f, args...) \
369 v4l2_device_call_all(&dev->v4l2_dev, 0, o, f, ##args)
370
371extern struct cx25821_board cx25821_boards[]; 345extern struct cx25821_board cx25821_boards[];
372 346
373#define SRAM_CH00 0 /* Video A */ 347#define SRAM_CH00 0 /* Video A */