Commit 60e3cac4 authored by Trent Piepho's avatar Trent Piepho Committed by Mauro Carvalho Chehab

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: default avatarTrent Piepho <xyzzy@speakeasy.org>
Acked-by: default avatarRonald S. Bultje <rbultje@ronald.bitfreak.net>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@infradead.org>
parent 18b548ca
...@@ -64,15 +64,15 @@ ...@@ -64,15 +64,15 @@
extern const struct zoran_format zoran_formats[]; extern const struct zoran_format zoran_formats[];
static int card[BUZ_MAX] = { -1, -1, -1, -1 }; static int card[BUZ_MAX] = { -1, -1, -1, -1 };
module_param_array(card, int, NULL, 0); module_param_array(card, int, NULL, 0444);
MODULE_PARM_DESC(card, "The type of card"); MODULE_PARM_DESC(card, "The type of card");
static int encoder[BUZ_MAX] = { -1, -1, -1, -1 }; static int encoder[BUZ_MAX] = { -1, -1, -1, -1 };
module_param_array(encoder, int, NULL, 0); module_param_array(encoder, int, NULL, 0444);
MODULE_PARM_DESC(encoder, "i2c TV encoder"); MODULE_PARM_DESC(encoder, "i2c TV encoder");
static int decoder[BUZ_MAX] = { -1, -1, -1, -1 }; static int decoder[BUZ_MAX] = { -1, -1, -1, -1 };
module_param_array(decoder, int, NULL, 0); module_param_array(decoder, int, NULL, 0444);
MODULE_PARM_DESC(decoder, "i2c TV decoder"); MODULE_PARM_DESC(decoder, "i2c TV decoder");
/* /*
...@@ -84,29 +84,31 @@ MODULE_PARM_DESC(decoder, "i2c TV decoder"); ...@@ -84,29 +84,31 @@ MODULE_PARM_DESC(decoder, "i2c TV decoder");
*/ */
static unsigned long vidmem = 0; /* Video memory base address */ static unsigned long vidmem = 0; /* Video memory base address */
module_param(vidmem, ulong, 0); module_param(vidmem, ulong, 0444);
MODULE_PARM_DESC(vidmem, "Default video memory base address");
/* /*
Default input and video norm at startup of the driver. Default input and video norm at startup of the driver.
*/ */
static int default_input = 0; /* 0=Composite, 1=S-Video */ static unsigned int default_input = 0; /* 0=Composite, 1=S-Video */
module_param(default_input, int, 0); module_param(default_input, uint, 0444);
MODULE_PARM_DESC(default_input, MODULE_PARM_DESC(default_input,
"Default input (0=Composite, 1=S-Video, 2=Internal)"); "Default input (0=Composite, 1=S-Video, 2=Internal)");
static int default_mux = 1; /* 6 Eyes input selection */ static int default_mux = 1; /* 6 Eyes input selection */
module_param(default_mux, int, 0); module_param(default_mux, int, 0644);
MODULE_PARM_DESC(default_mux, MODULE_PARM_DESC(default_mux,
"Default 6 Eyes mux setting (Input selection)"); "Default 6 Eyes mux setting (Input selection)");
static int default_norm = 0; /* 0=PAL, 1=NTSC 2=SECAM */ static int default_norm = 0; /* 0=PAL, 1=NTSC 2=SECAM */
module_param(default_norm, int, 0); module_param(default_norm, int, 0444);
MODULE_PARM_DESC(default_norm, "Default norm (0=PAL, 1=NTSC, 2=SECAM)"); MODULE_PARM_DESC(default_norm, "Default norm (0=PAL, 1=NTSC, 2=SECAM)");
static int video_nr = -1; /* /dev/videoN, -1 for autodetect */ /* /dev/videoN, -1 for autodetect */
module_param(video_nr, int, 0); static int video_nr[BUZ_MAX] = {-1, -1, -1, -1};
MODULE_PARM_DESC(video_nr, "video device number"); module_param_array(video_nr, int, NULL, 0444);
MODULE_PARM_DESC(video_nr, "video device number (-1=Auto)");
/* /*
Number and size of grab buffers for Video 4 Linux Number and size of grab buffers for Video 4 Linux
...@@ -127,21 +129,21 @@ MODULE_PARM_DESC(video_nr, "video device number"); ...@@ -127,21 +129,21 @@ MODULE_PARM_DESC(video_nr, "video device number");
int v4l_nbufs = 2; int v4l_nbufs = 2;
int v4l_bufsize = 128; /* Everybody should be able to work with this setting */ int v4l_bufsize = 128; /* Everybody should be able to work with this setting */
module_param(v4l_nbufs, int, 0); module_param(v4l_nbufs, int, 0644);
MODULE_PARM_DESC(v4l_nbufs, "Maximum number of V4L buffers to use"); MODULE_PARM_DESC(v4l_nbufs, "Maximum number of V4L buffers to use");
module_param(v4l_bufsize, int, 0); module_param(v4l_bufsize, int, 0644);
MODULE_PARM_DESC(v4l_bufsize, "Maximum size per V4L buffer (in kB)"); MODULE_PARM_DESC(v4l_bufsize, "Maximum size per V4L buffer (in kB)");
int jpg_nbufs = 32; int jpg_nbufs = 32;
int jpg_bufsize = 512; /* max size for 100% quality full-PAL frame */ int jpg_bufsize = 512; /* max size for 100% quality full-PAL frame */
module_param(jpg_nbufs, int, 0); module_param(jpg_nbufs, int, 0644);
MODULE_PARM_DESC(jpg_nbufs, "Maximum number of JPG buffers to use"); MODULE_PARM_DESC(jpg_nbufs, "Maximum number of JPG buffers to use");
module_param(jpg_bufsize, int, 0); module_param(jpg_bufsize, int, 0644);
MODULE_PARM_DESC(jpg_bufsize, "Maximum size per JPG buffer (in kB)"); MODULE_PARM_DESC(jpg_bufsize, "Maximum size per JPG buffer (in kB)");
int pass_through = 0; /* 1=Pass through TV signal when device is not used */ int pass_through = 0; /* 1=Pass through TV signal when device is not used */
/* 0=Show color bar when device is not used (LML33: only if lml33dpath=1) */ /* 0=Show color bar when device is not used (LML33: only if lml33dpath=1) */
module_param(pass_through, int, 0); module_param(pass_through, int, 0644);
MODULE_PARM_DESC(pass_through, MODULE_PARM_DESC(pass_through,
"Pass TV signal through to TV-out when idling"); "Pass TV signal through to TV-out when idling");
...@@ -1114,7 +1116,14 @@ zr36057_init (struct zoran *zr) ...@@ -1114,7 +1116,14 @@ zr36057_init (struct zoran *zr)
zr->timing = zr->card.tvn[zr->norm]; zr->timing = zr->card.tvn[zr->norm];
} }
zr->input = default_input = (default_input ? 1 : 0); if (default_input > zr->card.inputs-1) {
dprintk(1,
KERN_WARNING
"%s: default_input value %d out of range (0-%d)\n",
ZR_DEVNAME(zr), default_input, zr->card.inputs-1);
default_input = 0;
}
zr->input = default_input;
/* Should the following be reset at every open ? */ /* Should the following be reset at every open ? */
zr->hue = 32768; zr->hue = 32768;
...@@ -1146,7 +1155,7 @@ zr36057_init (struct zoran *zr) ...@@ -1146,7 +1155,7 @@ zr36057_init (struct zoran *zr)
*/ */
memcpy(zr->video_dev, &zoran_template, sizeof(zoran_template)); memcpy(zr->video_dev, &zoran_template, sizeof(zoran_template));
strcpy(zr->video_dev->name, ZR_DEVNAME(zr)); strcpy(zr->video_dev->name, ZR_DEVNAME(zr));
err = video_register_device(zr->video_dev, VFL_TYPE_GRABBER, video_nr); err = video_register_device(zr->video_dev, VFL_TYPE_GRABBER, video_nr[zr->id]);
if (err < 0) if (err < 0)
goto exit_unregister; goto exit_unregister;
......
...@@ -69,7 +69,7 @@ static int lml33dpath = 0; /* 1 will use digital path in capture ...@@ -69,7 +69,7 @@ static int lml33dpath = 0; /* 1 will use digital path in capture
* load on Bt819 input, there will be * load on Bt819 input, there will be
* some image imperfections */ * some image imperfections */
module_param(lml33dpath, bool, 0); module_param(lml33dpath, bool, 0644);
MODULE_PARM_DESC(lml33dpath, MODULE_PARM_DESC(lml33dpath,
"Use digital path capture mode (on LML33 cards)"); "Use digital path capture mode (on LML33 cards)");
......
...@@ -207,8 +207,8 @@ extern int jpg_bufsize; ...@@ -207,8 +207,8 @@ extern int jpg_bufsize;
extern int pass_through; extern int pass_through;
static int lock_norm = 0; /* 1=Don't change TV standard (norm) */ static int lock_norm = 0; /* 1=Don't change TV standard (norm) */
module_param(lock_norm, int, 0); module_param(lock_norm, int, 0644);
MODULE_PARM_DESC(lock_norm, "Users can't change norm"); MODULE_PARM_DESC(lock_norm, "Prevent norm changes (1 = ignore, >1 = fail)");
#ifdef CONFIG_VIDEO_V4L2 #ifdef CONFIG_VIDEO_V4L2
/* small helper function for calculating buffersizes for v4l2 /* small helper function for calculating buffersizes for v4l2
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment