aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/zoran_card.c
diff options
context:
space:
mode:
authorTrent Piepho <xyzzy@speakeasy.org>2007-07-17 17:29:42 -0400
committerMauro Carvalho Chehab <mchehab@infradead.org>2007-10-09 21:02:58 -0400
commit60e3cac47a442fae74d3429f706350229623bcce (patch)
tree1173a45c6f8d30fe1939c0bf7e0e5adc912d6daa /drivers/media/video/zoran_card.c
parent18b548ca580838a2cc5813a941e6dab28660bb22 (diff)
V4L/DVB (5885): zr36067: Fix problems with module parameters
Add permissions to all the module parameters so they can be queried and set (when possible) via sysfs. Add description for the vidmem parameter. Change the video_nr parameter to an array, so that the video number can be specified when a user has more than one card. The driver would try to give all cards the same number otherwise, which will fail for all cards after the first. The default_input option would only allow values of 0 or 1, contrary to the description. Allow values up to the number of inputs defined for the card. Add description of lock_norm's different behavior for 1 and >1. Signed-off-by: Trent Piepho <xyzzy@speakeasy.org> Acked-by: Ronald S. Bultje <rbultje@ronald.bitfreak.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/video/zoran_card.c')
-rw-r--r--drivers/media/video/zoran_card.c45
1 files changed, 27 insertions, 18 deletions
diff --git a/drivers/media/video/zoran_card.c b/drivers/media/video/zoran_card.c
index 8e12ff80550..48da36a15fc 100644
--- a/drivers/media/video/zoran_card.c
+++ b/drivers/media/video/zoran_card.c
@@ -64,15 +64,15 @@
64extern const struct zoran_format zoran_formats[]; 64extern const struct zoran_format zoran_formats[];
65 65
66static int card[BUZ_MAX] = { -1, -1, -1, -1 }; 66static int card[BUZ_MAX] = { -1, -1, -1, -1 };
67module_param_array(card, int, NULL, 0); 67module_param_array(card, int, NULL, 0444);
68MODULE_PARM_DESC(card, "The type of card"); 68MODULE_PARM_DESC(card, "The type of card");
69 69
70static int encoder[BUZ_MAX] = { -1, -1, -1, -1 }; 70static int encoder[BUZ_MAX] = { -1, -1, -1, -1 };
71module_param_array(encoder, int, NULL, 0); 71module_param_array(encoder, int, NULL, 0444);
72MODULE_PARM_DESC(encoder, "i2c TV encoder"); 72MODULE_PARM_DESC(encoder, "i2c TV encoder");
73 73
74static int decoder[BUZ_MAX] = { -1, -1, -1, -1 }; 74static int decoder[BUZ_MAX] = { -1, -1, -1, -1 };
75module_param_array(decoder, int, NULL, 0); 75module_param_array(decoder, int, NULL, 0444);
76MODULE_PARM_DESC(decoder, "i2c TV decoder"); 76MODULE_PARM_DESC(decoder, "i2c TV decoder");
77 77
78/* 78/*
@@ -84,29 +84,31 @@ MODULE_PARM_DESC(decoder, "i2c TV decoder");
84 */ 84 */
85 85
86static unsigned long vidmem = 0; /* Video memory base address */ 86static unsigned long vidmem = 0; /* Video memory base address */
87module_param(vidmem, ulong, 0); 87module_param(vidmem, ulong, 0444);
88MODULE_PARM_DESC(vidmem, "Default video memory base address");
88 89
89/* 90/*
90 Default input and video norm at startup of the driver. 91 Default input and video norm at startup of the driver.
91*/ 92*/
92 93
93static int default_input = 0; /* 0=Composite, 1=S-Video */ 94static unsigned int default_input = 0; /* 0=Composite, 1=S-Video */
94module_param(default_input, int, 0); 95module_param(default_input, uint, 0444);
95MODULE_PARM_DESC(default_input, 96MODULE_PARM_DESC(default_input,
96 "Default input (0=Composite, 1=S-Video, 2=Internal)"); 97 "Default input (0=Composite, 1=S-Video, 2=Internal)");
97 98
98static int default_mux = 1; /* 6 Eyes input selection */ 99static int default_mux = 1; /* 6 Eyes input selection */
99module_param(default_mux, int, 0); 100module_param(default_mux, int, 0644);
100MODULE_PARM_DESC(default_mux, 101MODULE_PARM_DESC(default_mux,
101 "Default 6 Eyes mux setting (Input selection)"); 102 "Default 6 Eyes mux setting (Input selection)");
102 103
103static int default_norm = 0; /* 0=PAL, 1=NTSC 2=SECAM */ 104static int default_norm = 0; /* 0=PAL, 1=NTSC 2=SECAM */
104module_param(default_norm, int, 0); 105module_param(default_norm, int, 0444);
105MODULE_PARM_DESC(default_norm, "Default norm (0=PAL, 1=NTSC, 2=SECAM)"); 106MODULE_PARM_DESC(default_norm, "Default norm (0=PAL, 1=NTSC, 2=SECAM)");
106 107
107static int video_nr = -1; /* /dev/videoN, -1 for autodetect */ 108/* /dev/videoN, -1 for autodetect */
108module_param(video_nr, int, 0); 109static int video_nr[BUZ_MAX] = {-1, -1, -1, -1};
109MODULE_PARM_DESC(video_nr, "video device number"); 110module_param_array(video_nr, int, NULL, 0444);
111MODULE_PARM_DESC(video_nr, "video device number (-1=Auto)");
110 112
111/* 113/*
112 Number and size of grab buffers for Video 4 Linux 114 Number and size of grab buffers for Video 4 Linux
@@ -127,21 +129,21 @@ MODULE_PARM_DESC(video_nr, "video device number");
127 129
128int v4l_nbufs = 2; 130int v4l_nbufs = 2;
129int v4l_bufsize = 128; /* Everybody should be able to work with this setting */ 131int v4l_bufsize = 128; /* Everybody should be able to work with this setting */
130module_param(v4l_nbufs, int, 0); 132module_param(v4l_nbufs, int, 0644);
131MODULE_PARM_DESC(v4l_nbufs, "Maximum number of V4L buffers to use"); 133MODULE_PARM_DESC(v4l_nbufs, "Maximum number of V4L buffers to use");
132module_param(v4l_bufsize, int, 0); 134module_param(v4l_bufsize, int, 0644);
133MODULE_PARM_DESC(v4l_bufsize, "Maximum size per V4L buffer (in kB)"); 135MODULE_PARM_DESC(v4l_bufsize, "Maximum size per V4L buffer (in kB)");
134 136
135int jpg_nbufs = 32; 137int jpg_nbufs = 32;
136int jpg_bufsize = 512; /* max size for 100% quality full-PAL frame */ 138int jpg_bufsize = 512; /* max size for 100% quality full-PAL frame */
137module_param(jpg_nbufs, int, 0); 139module_param(jpg_nbufs, int, 0644);
138MODULE_PARM_DESC(jpg_nbufs, "Maximum number of JPG buffers to use"); 140MODULE_PARM_DESC(jpg_nbufs, "Maximum number of JPG buffers to use");
139module_param(jpg_bufsize, int, 0); 141module_param(jpg_bufsize, int, 0644);
140MODULE_PARM_DESC(jpg_bufsize, "Maximum size per JPG buffer (in kB)"); 142MODULE_PARM_DESC(jpg_bufsize, "Maximum size per JPG buffer (in kB)");
141 143
142int pass_through = 0; /* 1=Pass through TV signal when device is not used */ 144int pass_through = 0; /* 1=Pass through TV signal when device is not used */
143 /* 0=Show color bar when device is not used (LML33: only if lml33dpath=1) */ 145 /* 0=Show color bar when device is not used (LML33: only if lml33dpath=1) */
144module_param(pass_through, int, 0); 146module_param(pass_through, int, 0644);
145MODULE_PARM_DESC(pass_through, 147MODULE_PARM_DESC(pass_through,
146 "Pass TV signal through to TV-out when idling"); 148 "Pass TV signal through to TV-out when idling");
147 149
@@ -1114,7 +1116,14 @@ zr36057_init (struct zoran *zr)
1114 zr->timing = zr->card.tvn[zr->norm]; 1116 zr->timing = zr->card.tvn[zr->norm];
1115 } 1117 }
1116 1118
1117 zr->input = default_input = (default_input ? 1 : 0); 1119 if (default_input > zr->card.inputs-1) {
1120 dprintk(1,
1121 KERN_WARNING
1122 "%s: default_input value %d out of range (0-%d)\n",
1123 ZR_DEVNAME(zr), default_input, zr->card.inputs-1);
1124 default_input = 0;
1125 }
1126 zr->input = default_input;
1118 1127
1119 /* Should the following be reset at every open ? */ 1128 /* Should the following be reset at every open ? */
1120 zr->hue = 32768; 1129 zr->hue = 32768;
@@ -1146,7 +1155,7 @@ zr36057_init (struct zoran *zr)
1146 */ 1155 */
1147 memcpy(zr->video_dev, &zoran_template, sizeof(zoran_template)); 1156 memcpy(zr->video_dev, &zoran_template, sizeof(zoran_template));
1148 strcpy(zr->video_dev->name, ZR_DEVNAME(zr)); 1157 strcpy(zr->video_dev->name, ZR_DEVNAME(zr));
1149 err = video_register_device(zr->video_dev, VFL_TYPE_GRABBER, video_nr); 1158 err = video_register_device(zr->video_dev, VFL_TYPE_GRABBER, video_nr[zr->id]);
1150 if (err < 0) 1159 if (err < 0)
1151 goto exit_unregister; 1160 goto exit_unregister;
1152 1161