V4L/DVB (8822): gspca: Change some subdriver functions for suspend/resume.

- new function 'init' called on probe and resume
- remove the functions 'open' and 'closed'
- 'stopN' and 'stop0' are optional

Signed-off-by: Jean-Francois Moine <moinejf@free.fr>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
This commit is contained in:
Jean-Francois Moine 2008-09-03 17:12:16 -03:00 committed by Mauro Carvalho Chehab
parent 66e4124f41
commit 012d6b029e
22 changed files with 89 additions and 298 deletions

View File

@ -826,8 +826,8 @@ static int sd_config(struct gspca_dev *gspca_dev,
return 0;
}
/* this function is called at open time */
static int sd_open(struct gspca_dev *gspca_dev)
/* this function is called at probe and resume time */
static int sd_init(struct gspca_dev *gspca_dev)
{
cx11646_init1(gspca_dev);
cx11646_initsize(gspca_dev);
@ -845,10 +845,6 @@ static void sd_start(struct gspca_dev *gspca_dev)
cx11646_jpeg(gspca_dev);
}
static void sd_stopN(struct gspca_dev *gspca_dev)
{
}
static void sd_stop0(struct gspca_dev *gspca_dev)
{
int retry = 50;
@ -871,10 +867,6 @@ static void sd_stop0(struct gspca_dev *gspca_dev)
reg_w_val(gspca_dev, 0x00fc, 0xe0);
}
static void sd_close(struct gspca_dev *gspca_dev)
{
}
static void sd_pkt_scan(struct gspca_dev *gspca_dev,
struct gspca_frame *frame, /* target */
__u8 *data, /* isoc packet */
@ -998,11 +990,9 @@ static struct sd_desc sd_desc = {
.ctrls = sd_ctrls,
.nctrls = ARRAY_SIZE(sd_ctrls),
.config = sd_config,
.open = sd_open,
.init = sd_init,
.start = sd_start,
.stopN = sd_stopN,
.stop0 = sd_stop0,
.close = sd_close,
.pkt_scan = sd_pkt_scan,
};

View File

@ -676,8 +676,8 @@ static int sd_config(struct gspca_dev *gspca_dev,
return 0;
}
/* this function is called at open time */
static int sd_open(struct gspca_dev *gspca_dev)
/* this function is called at probe and resume time */
static int sd_init(struct gspca_dev *gspca_dev)
{
struct sd *sd = (struct sd *) gspca_dev;
@ -711,14 +711,6 @@ static void sd_stopN(struct gspca_dev *gspca_dev)
et_video(gspca_dev, 0); /* video off */
}
static void sd_stop0(struct gspca_dev *gspca_dev)
{
}
static void sd_close(struct gspca_dev *gspca_dev)
{
}
static __u8 Et_getgainG(struct gspca_dev *gspca_dev)
{
struct sd *sd = (struct sd *) gspca_dev;
@ -895,11 +887,9 @@ static struct sd_desc sd_desc = {
.ctrls = sd_ctrls,
.nctrls = ARRAY_SIZE(sd_ctrls),
.config = sd_config,
.open = sd_open,
.init = sd_init,
.start = sd_start,
.stopN = sd_stopN,
.stop0 = sd_stop0,
.close = sd_close,
.pkt_scan = sd_pkt_scan,
.dq_callback = do_autogain,
};

View File

@ -558,10 +558,12 @@ static void gspca_stream_off(struct gspca_dev *gspca_dev)
gspca_dev->streaming = 0;
atomic_set(&gspca_dev->nevent, 0);
if (gspca_dev->present) {
gspca_dev->sd_desc->stopN(gspca_dev);
if (gspca_dev->sd_desc->stopN)
gspca_dev->sd_desc->stopN(gspca_dev);
destroy_urbs(gspca_dev);
gspca_set_alt0(gspca_dev);
gspca_dev->sd_desc->stop0(gspca_dev);
if (gspca_dev->sd_desc->stop0)
gspca_dev->sd_desc->stop0(gspca_dev);
PDEBUG(D_STREAM, "stream off OK");
}
}
@ -770,19 +772,7 @@ static int dev_open(struct inode *inode, struct file *file)
goto out;
}
/* if not done yet, initialize the sensor */
if (gspca_dev->users == 0) {
if (mutex_lock_interruptible(&gspca_dev->usb_lock)) {
ret = -ERESTARTSYS;
goto out;
}
ret = gspca_dev->sd_desc->open(gspca_dev);
mutex_unlock(&gspca_dev->usb_lock);
if (ret != 0) {
PDEBUG(D_ERR|D_CONF, "init device failed %d", ret);
goto out;
}
} else if (gspca_dev->users > 4) { /* (arbitrary value) */
if (gspca_dev->users > 4) { /* (arbitrary value) */
ret = -EBUSY;
goto out;
}
@ -795,6 +785,7 @@ static int dev_open(struct inode *inode, struct file *file)
else
gspca_dev->vdev.debug &= ~3;
#endif
ret = 0;
out:
mutex_unlock(&gspca_dev->queue_lock);
if (ret != 0)
@ -815,11 +806,6 @@ static int dev_close(struct inode *inode, struct file *file)
/* if the file did the capture, free the streaming resources */
if (gspca_dev->capt_file == file) {
mutex_lock(&gspca_dev->usb_lock);
if (gspca_dev->streaming)
gspca_stream_off(gspca_dev);
gspca_dev->sd_desc->close(gspca_dev);
mutex_unlock(&gspca_dev->usb_lock);
frame_free(gspca_dev);
gspca_dev->capt_file = NULL;
gspca_dev->memory = GSPCA_MEMORY_NO;
@ -1747,8 +1733,11 @@ int gspca_dev_probe(struct usb_interface *intf,
/* gspca_dev->users = 0; (done by kzalloc) */
gspca_dev->nbufread = 2;
/* configure the subdriver */
/* configure the subdriver and initialize the USB device */
ret = gspca_dev->sd_desc->config(gspca_dev, id);
if (ret < 0)
goto out;
ret = gspca_dev->sd_desc->init(gspca_dev);
if (ret < 0)
goto out;
ret = gspca_set_alt0(gspca_dev);
@ -1825,10 +1814,12 @@ int gspca_suspend(struct usb_interface *intf, pm_message_t message)
if (!gspca_dev->streaming)
return 0;
gspca_dev->frozen = 1; /* avoid urb error messages */
gspca_dev->sd_desc->stopN(gspca_dev);
if (gspca_dev->sd_desc->stopN)
gspca_dev->sd_desc->stopN(gspca_dev);
destroy_urbs(gspca_dev);
gspca_set_alt0(gspca_dev);
gspca_dev->sd_desc->stop0(gspca_dev);
if (gspca_dev->sd_desc->stop0)
gspca_dev->sd_desc->stop0(gspca_dev);
return 0;
}
EXPORT_SYMBOL(gspca_suspend);
@ -1838,11 +1829,9 @@ int gspca_resume(struct usb_interface *intf)
struct gspca_dev *gspca_dev = usb_get_intfdata(intf);
gspca_dev->frozen = 0;
if (gspca_dev->users != 0) {
gspca_dev->sd_desc->open(gspca_dev);
if (gspca_dev->streaming)
return gspca_init_transfer(gspca_dev);
}
gspca_dev->sd_desc->init(gspca_dev);
if (gspca_dev->streaming)
return gspca_init_transfer(gspca_dev);
return 0;
}
EXPORT_SYMBOL(gspca_resume);

View File

@ -90,15 +90,14 @@ struct sd_desc {
/* controls */
const struct ctrl *ctrls;
int nctrls;
/* operations */
/* mandatory operations */
cam_cf_op config; /* called on probe */
cam_op open; /* called on open */
cam_op init; /* called on probe and resume */
cam_v_op start; /* called on stream on */
cam_v_op stopN; /* called on stream off - main alt */
cam_v_op stop0; /* called on stream off - alt 0 */
cam_v_op close; /* called on close */
cam_pkt_op pkt_scan;
/* optional operations */
cam_v_op stopN; /* called on stream off - main alt */
cam_v_op stop0; /* called on stream off - alt 0 */
cam_v_op dq_callback; /* called when a frame has been dequeued */
cam_jpg_op get_jcomp;
cam_jpg_op set_jcomp;

View File

@ -144,8 +144,8 @@ static int sd_config(struct gspca_dev *gspca_dev,
return 0;
}
/* this function is called at open time */
static int sd_open(struct gspca_dev *gspca_dev)
/* this function is called at probe and resume time */
static int sd_init(struct gspca_dev *gspca_dev)
{
return 0;
}
@ -358,14 +358,6 @@ static void sd_stopN(struct gspca_dev *gspca_dev)
PDEBUG(D_ERR, "Camera Stop failed");
}
static void sd_stop0(struct gspca_dev *gspca_dev)
{
}
static void sd_close(struct gspca_dev *gspca_dev)
{
}
static void sd_pkt_scan(struct gspca_dev *gspca_dev,
struct gspca_frame *frame, /* target */
__u8 *data, /* isoc packet */
@ -411,11 +403,9 @@ static const struct sd_desc sd_desc = {
.ctrls = sd_ctrls,
.nctrls = ARRAY_SIZE(sd_ctrls),
.config = sd_config,
.open = sd_open,
.init = sd_init,
.start = sd_start,
.stopN = sd_stopN,
.stop0 = sd_stop0,
.close = sd_close,
.pkt_scan = sd_pkt_scan,
};

View File

@ -1376,8 +1376,8 @@ static int sd_config(struct gspca_dev *gspca_dev,
return -EBUSY;
}
/* this function is called at open time */
static int sd_open(struct gspca_dev *gspca_dev)
/* this function is called at probe and resume time */
static int sd_init(struct gspca_dev *gspca_dev)
{
struct sd *sd = (struct sd *) gspca_dev;
@ -1877,14 +1877,6 @@ static void sd_stopN(struct gspca_dev *gspca_dev)
ov51x_led_control((struct sd *) gspca_dev, 0);
}
static void sd_stop0(struct gspca_dev *gspca_dev)
{
}
static void sd_close(struct gspca_dev *gspca_dev)
{
}
static void sd_pkt_scan(struct gspca_dev *gspca_dev,
struct gspca_frame *frame, /* target */
__u8 *data, /* isoc packet */
@ -2141,11 +2133,9 @@ static const struct sd_desc sd_desc = {
.ctrls = sd_ctrls,
.nctrls = ARRAY_SIZE(sd_ctrls),
.config = sd_config,
.open = sd_open,
.init = sd_init,
.start = sd_start,
.stopN = sd_stopN,
.stop0 = sd_stop0,
.close = sd_close,
.pkt_scan = sd_pkt_scan,
};

View File

@ -273,8 +273,8 @@ static int sd_config(struct gspca_dev *gspca_dev,
return 0;
}
/* this function is called at open time */
static int sd_open(struct gspca_dev *gspca_dev)
/* this function is called at probe and resume time */
static int sd_init(struct gspca_dev *gspca_dev)
{
pac207_write_reg(gspca_dev, 0x41, 0x00);
/* Bit_0=Image Format,
@ -338,15 +338,6 @@ static void sd_stopN(struct gspca_dev *gspca_dev)
pac207_write_reg(gspca_dev, 0x0f, 0x00); /* Power Control */
}
static void sd_stop0(struct gspca_dev *gspca_dev)
{
}
/* this function is called at close time */
static void sd_close(struct gspca_dev *gspca_dev)
{
}
static void pac207_do_auto_gain(struct gspca_dev *gspca_dev)
{
struct sd *sd = (struct sd *) gspca_dev;
@ -532,11 +523,9 @@ static const struct sd_desc sd_desc = {
.ctrls = sd_ctrls,
.nctrls = ARRAY_SIZE(sd_ctrls),
.config = sd_config,
.open = sd_open,
.init = sd_init,
.start = sd_start,
.stopN = sd_stopN,
.stop0 = sd_stop0,
.close = sd_close,
.dq_callback = pac207_do_auto_gain,
.pkt_scan = sd_pkt_scan,
};

View File

@ -590,8 +590,8 @@ static void sethvflip(struct gspca_dev *gspca_dev)
reg_w(gspca_dev, 0x11, 0x01);
}
/* this function is called at open time */
static int sd_open(struct gspca_dev *gspca_dev)
/* this function is called at probe and resume time */
static int sd_init(struct gspca_dev *gspca_dev)
{
return 0;
}
@ -691,11 +691,6 @@ static void sd_stop0(struct gspca_dev *gspca_dev)
}
}
/* this function is called at close time */
static void sd_close(struct gspca_dev *gspca_dev)
{
}
static void do_autogain(struct gspca_dev *gspca_dev)
{
}
@ -902,11 +897,10 @@ static struct sd_desc sd_desc = {
.ctrls = sd_ctrls,
.nctrls = ARRAY_SIZE(sd_ctrls),
.config = sd_config,
.open = sd_open,
.init = sd_init,
.start = sd_start,
.stopN = sd_stopN,
.stop0 = sd_stop0,
.close = sd_close,
.pkt_scan = sd_pkt_scan,
.dq_callback = do_autogain,
};

View File

@ -799,8 +799,8 @@ static int sd_config(struct gspca_dev *gspca_dev,
return 0;
}
/* this function is called at open time */
static int sd_open(struct gspca_dev *gspca_dev)
/* this function is called at probe and resume time */
static int sd_init(struct gspca_dev *gspca_dev)
{
return 0;
}
@ -963,14 +963,6 @@ static void sd_stopN(struct gspca_dev *gspca_dev)
reg_w(gspca_dev, 0x01, &ByteSend, 1);
}
static void sd_stop0(struct gspca_dev *gspca_dev)
{
}
static void sd_close(struct gspca_dev *gspca_dev)
{
}
static void sd_pkt_scan(struct gspca_dev *gspca_dev,
struct gspca_frame *frame, /* target */
unsigned char *data, /* isoc packet */
@ -1162,11 +1154,9 @@ static const struct sd_desc sd_desc = {
.ctrls = sd_ctrls,
.nctrls = ARRAY_SIZE(sd_ctrls),
.config = sd_config,
.open = sd_open,
.init = sd_init,
.start = sd_start,
.stopN = sd_stopN,
.stop0 = sd_stop0,
.close = sd_close,
.pkt_scan = sd_pkt_scan,
.querymenu = sd_querymenu,
.dq_callback = do_autogain,

View File

@ -948,8 +948,8 @@ static int sd_config(struct gspca_dev *gspca_dev,
return 0;
}
/* this function is called at open time */
static int sd_open(struct gspca_dev *gspca_dev)
/* this function is called at probe and resume time */
static int sd_init(struct gspca_dev *gspca_dev)
{
struct sd *sd = (struct sd *) gspca_dev;
/* const __u8 *sn9c1xx; */
@ -1353,14 +1353,6 @@ static void sd_stopN(struct gspca_dev *gspca_dev)
reg_w1(gspca_dev, 0xf1, 0x00);
}
static void sd_stop0(struct gspca_dev *gspca_dev)
{
}
static void sd_close(struct gspca_dev *gspca_dev)
{
}
static void do_autogain(struct gspca_dev *gspca_dev)
{
struct sd *sd = (struct sd *) gspca_dev;
@ -1548,11 +1540,9 @@ static const struct sd_desc sd_desc = {
.ctrls = sd_ctrls,
.nctrls = ARRAY_SIZE(sd_ctrls),
.config = sd_config,
.open = sd_open,
.init = sd_init,
.start = sd_start,
.stopN = sd_stopN,
.stop0 = sd_stop0,
.close = sd_close,
.pkt_scan = sd_pkt_scan,
.dq_callback = do_autogain,
};

View File

@ -645,8 +645,8 @@ static int sd_config(struct gspca_dev *gspca_dev,
return 0;
}
/* this function is called at open time */
static int sd_open(struct gspca_dev *gspca_dev)
/* this function is called at probe and resume time */
static int sd_init(struct gspca_dev *gspca_dev)
{
struct sd *sd = (struct sd *) gspca_dev;
@ -880,14 +880,6 @@ static void sd_stopN(struct gspca_dev *gspca_dev)
gspca_dev->usb_buf[0]);
}
static void sd_stop0(struct gspca_dev *gspca_dev)
{
}
static void sd_close(struct gspca_dev *gspca_dev)
{
}
static void sd_pkt_scan(struct gspca_dev *gspca_dev,
struct gspca_frame *frame, /* target */
__u8 *data, /* isoc packet */
@ -1051,11 +1043,9 @@ static struct sd_desc sd_desc = {
.ctrls = sd_ctrls,
.nctrls = ARRAY_SIZE(sd_ctrls),
.config = sd_config,
.open = sd_open,
.init = sd_init,
.start = sd_start,
.stopN = sd_stopN,
.stop0 = sd_stop0,
.close = sd_close,
.pkt_scan = sd_pkt_scan,
};

View File

@ -1953,8 +1953,8 @@ static int sd_config(struct gspca_dev *gspca_dev,
return -EINVAL;
}
/* this function is called at open time */
static int sd_open(struct gspca_dev *gspca_dev)
/* this function is called at probe and resume time */
static int sd_init(struct gspca_dev *gspca_dev)
{
struct sd *sd = (struct sd *) gspca_dev;
@ -2022,11 +2022,6 @@ static void sd_stopN(struct gspca_dev *gspca_dev)
}
static void sd_stop0(struct gspca_dev *gspca_dev)
{
}
/* this function is called at close time */
static void sd_close(struct gspca_dev *gspca_dev)
{
reg_write(gspca_dev->dev, SPCA501_REG_CTLRL, 0x05, 0x00);
}
@ -2120,11 +2115,10 @@ static const struct sd_desc sd_desc = {
.ctrls = sd_ctrls,
.nctrls = ARRAY_SIZE(sd_ctrls),
.config = sd_config,
.open = sd_open,
.init = sd_init,
.start = sd_start,
.stopN = sd_stopN,
.stop0 = sd_stop0,
.close = sd_close,
.pkt_scan = sd_pkt_scan,
};

View File

@ -655,8 +655,8 @@ static int sd_config(struct gspca_dev *gspca_dev,
return 0;
}
/* this function is called at open time */
static int sd_open(struct gspca_dev *gspca_dev)
/* this function is called at probe and resume time */
static int sd_init(struct gspca_dev *gspca_dev)
{
struct sd *sd = (struct sd *) gspca_dev;
int ret;
@ -742,11 +742,6 @@ static void sd_stopN(struct gspca_dev *gspca_dev)
}
static void sd_stop0(struct gspca_dev *gspca_dev)
{
}
/* this function is called at close time */
static void sd_close(struct gspca_dev *gspca_dev)
{
/* This maybe reset or power control */
reg_write(gspca_dev->dev, 0x03, 0x03, 0x20);
@ -825,11 +820,10 @@ static const struct sd_desc sd_desc = {
.ctrls = sd_ctrls,
.nctrls = ARRAY_SIZE(sd_ctrls),
.config = sd_config,
.open = sd_open,
.init = sd_init,
.start = sd_start,
.stopN = sd_stopN,
.stop0 = sd_stop0,
.close = sd_close,
.pkt_scan = sd_pkt_scan,
};

View File

@ -313,8 +313,8 @@ static int sd_config(struct gspca_dev *gspca_dev,
return 0;
}
/* this function is called at open time */
static int sd_open(struct gspca_dev *gspca_dev)
/* this function is called at probe and resume time */
static int sd_init(struct gspca_dev *gspca_dev)
{
struct usb_device *dev = gspca_dev->dev;
@ -560,14 +560,6 @@ static void sd_stopN(struct gspca_dev *gspca_dev)
reg_w(dev, 0x03, 0x00, 0x0003);
}
static void sd_stop0(struct gspca_dev *gspca_dev)
{
}
static void sd_close(struct gspca_dev *gspca_dev)
{
}
static void sd_pkt_scan(struct gspca_dev *gspca_dev,
struct gspca_frame *frame, /* target */
__u8 *data, /* isoc packet */
@ -740,11 +732,9 @@ static struct sd_desc sd_desc = {
.ctrls = sd_ctrls,
.nctrls = ARRAY_SIZE(sd_ctrls),
.config = sd_config,
.open = sd_open,
.init = sd_init,
.start = sd_start,
.stopN = sd_stopN,
.stop0 = sd_stop0,
.close = sd_close,
.pkt_scan = sd_pkt_scan,
};

View File

@ -1521,8 +1521,8 @@ static int sd_config(struct gspca_dev *gspca_dev,
return 0; /* success */
}
/* this function is called at open time */
static int sd_open(struct gspca_dev *gspca_dev)
/* this function is called at probe and resume time */
static int sd_init(struct gspca_dev *gspca_dev)
{
/* write_vector(gspca_dev, spca508_open_data); */
return 0;
@ -1554,15 +1554,6 @@ static void sd_stopN(struct gspca_dev *gspca_dev)
reg_write(gspca_dev->dev, 0x8112, 0x20);
}
static void sd_stop0(struct gspca_dev *gspca_dev)
{
}
/* this function is called at close time */
static void sd_close(struct gspca_dev *gspca_dev)
{
}
static void sd_pkt_scan(struct gspca_dev *gspca_dev,
struct gspca_frame *frame, /* target */
__u8 *data, /* isoc packet */
@ -1633,11 +1624,9 @@ static const struct sd_desc sd_desc = {
.ctrls = sd_ctrls,
.nctrls = ARRAY_SIZE(sd_ctrls),
.config = sd_config,
.open = sd_open,
.init = sd_init,
.start = sd_start,
.stopN = sd_stopN,
.stop0 = sd_stop0,
.close = sd_close,
.pkt_scan = sd_pkt_scan,
};

View File

@ -560,14 +560,14 @@ static int sd_config(struct gspca_dev *gspca_dev,
return 0;
}
/* this function is called at open time */
static int sd_open_12a(struct gspca_dev *gspca_dev)
/* this function is called at probe and resume time */
static int sd_init_12a(struct gspca_dev *gspca_dev)
{
PDEBUG(D_STREAM, "Chip revision: 012a");
init_161rev12A(gspca_dev);
return 0;
}
static int sd_open_72a(struct gspca_dev *gspca_dev)
static int sd_init_72a(struct gspca_dev *gspca_dev)
{
PDEBUG(D_STREAM, "Chip revision: 072a");
write_vector(gspca_dev, spca561_init_data);
@ -733,12 +733,7 @@ static void sd_stop0(struct gspca_dev *gspca_dev)
reg_w_val(gspca_dev->dev, 0x8118, 0x29);
reg_w_val(gspca_dev->dev, 0x8114, 0x08);
}
}
/* this function is called at close time */
static void sd_close(struct gspca_dev *gspca_dev)
{
reg_w_val(gspca_dev->dev, 0x8114, 0);
/* reg_w_val(gspca_dev->dev, 0x8114, 0); */
}
static void do_autogain(struct gspca_dev *gspca_dev)
@ -1121,11 +1116,10 @@ static const struct sd_desc sd_desc_12a = {
.ctrls = sd_ctrls_12a,
.nctrls = ARRAY_SIZE(sd_ctrls_12a),
.config = sd_config,
.open = sd_open_12a,
.init = sd_init_12a,
.start = sd_start_12a,
.stopN = sd_stopN,
.stop0 = sd_stop0,
.close = sd_close,
.pkt_scan = sd_pkt_scan,
/* .dq_callback = do_autogain, * fixme */
};
@ -1134,11 +1128,10 @@ static const struct sd_desc sd_desc_72a = {
.ctrls = sd_ctrls_72a,
.nctrls = ARRAY_SIZE(sd_ctrls_72a),
.config = sd_config,
.open = sd_open_72a,
.init = sd_init_72a,
.start = sd_start_72a,
.stopN = sd_stopN,
.stop0 = sd_stop0,
.close = sd_close,
.pkt_scan = sd_pkt_scan,
.dq_callback = do_autogain,
};

View File

@ -306,8 +306,8 @@ static int sd_config(struct gspca_dev *gspca_dev,
return 0;
}
/* this function is called at open time */
static int sd_open(struct gspca_dev *gspca_dev)
/* this function is called at probe and resume time */
static int sd_init(struct gspca_dev *gspca_dev)
{
int ret;
@ -398,14 +398,6 @@ static void sd_stopN(struct gspca_dev *gspca_dev)
PDEBUG(D_STREAM, "camera stopped");
}
static void sd_stop0(struct gspca_dev *gspca_dev)
{
}
static void sd_close(struct gspca_dev *gspca_dev)
{
}
static void sd_pkt_scan(struct gspca_dev *gspca_dev,
struct gspca_frame *frame, /* target */
__u8 *data, /* isoc packet */
@ -535,11 +527,9 @@ static const struct sd_desc sd_desc = {
.ctrls = sd_ctrls,
.nctrls = ARRAY_SIZE(sd_ctrls),
.config = sd_config,
.open = sd_open,
.init = sd_init,
.start = sd_start,
.stopN = sd_stopN,
.stop0 = sd_stop0,
.close = sd_close,
.pkt_scan = sd_pkt_scan,
.querymenu = sd_querymenu,
};

View File

@ -848,8 +848,8 @@ static int sd_config(struct gspca_dev *gspca_dev,
return 0;
}
/* this function is called at open time */
static int sd_open(struct gspca_dev *gspca_dev)
/* this function is called at probe and resume time */
static int sd_init(struct gspca_dev *gspca_dev)
{
struct sd *sd = (struct sd *) gspca_dev;
struct usb_device *dev = gspca_dev->dev;
@ -1069,14 +1069,6 @@ static void sd_stopN(struct gspca_dev *gspca_dev)
}
}
static void sd_stop0(struct gspca_dev *gspca_dev)
{
}
static void sd_close(struct gspca_dev *gspca_dev)
{
}
static void sd_pkt_scan(struct gspca_dev *gspca_dev,
struct gspca_frame *frame, /* target */
__u8 *data, /* isoc packet */
@ -1369,11 +1361,9 @@ static const struct sd_desc sd_desc = {
.ctrls = sd_ctrls,
.nctrls = ARRAY_SIZE(sd_ctrls),
.config = sd_config,
.open = sd_open,
.init = sd_init,
.start = sd_start,
.stopN = sd_stopN,
.stop0 = sd_stop0,
.close = sd_close,
.pkt_scan = sd_pkt_scan,
};

View File

@ -552,6 +552,13 @@ static int init_default_parameters(struct gspca_dev *gspca_dev)
return 0;
}
/* this function is called at probe and resume time */
static int sd_init(struct gspca_dev *gspca_dev)
{
init_default_parameters(gspca_dev);
return 0;
}
static void setbrightness(struct gspca_dev *gspca_dev)
{
struct sd *sd = (struct sd *) gspca_dev;
@ -893,18 +900,6 @@ static void sd_start(struct gspca_dev *gspca_dev)
setcolors(gspca_dev);
}
static void sd_stopN(struct gspca_dev *gspca_dev)
{
}
static void sd_stop0(struct gspca_dev *gspca_dev)
{
}
static void sd_close(struct gspca_dev *gspca_dev)
{
}
static void sd_pkt_scan(struct gspca_dev *gspca_dev,
struct gspca_frame *frame, /* target */
__u8 *data, /* isoc packet */
@ -972,24 +967,14 @@ static int sd_querymenu(struct gspca_dev *gspca_dev,
return -EINVAL;
}
/* this function is called at open time */
static int sd_open(struct gspca_dev *gspca_dev)
{
init_default_parameters(gspca_dev);
return 0;
}
/* sub-driver description */
static const struct sd_desc sd_desc = {
.name = MODULE_NAME,
.ctrls = sd_ctrls,
.nctrls = ARRAY_SIZE(sd_ctrls),
.config = sd_config,
.open = sd_open,
.init = sd_init,
.start = sd_start,
.stopN = sd_stopN,
.stop0 = sd_stop0,
.close = sd_close,
.pkt_scan = sd_pkt_scan,
.querymenu = sd_querymenu,
};

View File

@ -331,8 +331,8 @@ static void tv_8532_PollReg(struct gspca_dev *gspca_dev)
}
}
/* this function is called at open time */
static int sd_open(struct gspca_dev *gspca_dev)
/* this function is called at probe and resume time */
static int sd_init(struct gspca_dev *gspca_dev)
{
reg_w_1(gspca_dev, TV8532_AD_SLOPE, 0x32);
reg_w_1(gspca_dev, TV8532_AD_BITCTRL, 0x00);
@ -450,14 +450,6 @@ static void sd_stopN(struct gspca_dev *gspca_dev)
reg_w_1(gspca_dev, TV8532_GPIO_OE, 0x0b);
}
static void sd_stop0(struct gspca_dev *gspca_dev)
{
}
static void sd_close(struct gspca_dev *gspca_dev)
{
}
static void tv8532_preprocess(struct gspca_dev *gspca_dev)
{
struct sd *sd = (struct sd *) gspca_dev;
@ -611,11 +603,9 @@ static const struct sd_desc sd_desc = {
.ctrls = sd_ctrls,
.nctrls = ARRAY_SIZE(sd_ctrls),
.config = sd_config,
.open = sd_open,
.init = sd_init,
.start = sd_start,
.stopN = sd_stopN,
.stop0 = sd_stop0,
.close = sd_close,
.pkt_scan = sd_pkt_scan,
};

View File

@ -1477,8 +1477,8 @@ static int sd_config(struct gspca_dev *gspca_dev,
return 0;
}
/* this function is called at open time */
static int sd_open(struct gspca_dev *gspca_dev)
/* this function is called at probe and time */
static int sd_init(struct gspca_dev *gspca_dev)
{
return 0;
}
@ -1640,19 +1640,6 @@ static void sd_stop0(struct gspca_dev *gspca_dev)
reg_w(dev, 0x89, 0xffff, 0xffff);
}
/* this function is called at close time */
static void sd_close(struct gspca_dev *gspca_dev)
{
/* struct usb_device *dev = gspca_dev->dev;
__u8 buffread;
reg_w(dev, 0x89, 0xffff, 0xffff);
reg_w(dev, 0xa0, 0x01, 0xb301);
reg_w(dev, 0xa0, 0x09, 0xb303);
reg_w(dev, 0x89, 0xffff, 0xffff);
*/
}
static void sd_pkt_scan(struct gspca_dev *gspca_dev,
struct gspca_frame *frame, /* target */
__u8 *data, /* isoc packet */
@ -1741,11 +1728,10 @@ static const struct sd_desc sd_desc = {
.ctrls = sd_ctrls,
.nctrls = ARRAY_SIZE(sd_ctrls),
.config = sd_config,
.open = sd_open,
.init = sd_init,
.start = sd_start,
.stopN = sd_stopN,
.stop0 = sd_stop0,
.close = sd_close,
.pkt_scan = sd_pkt_scan,
.querymenu = sd_querymenu,
};

View File

@ -7171,8 +7171,8 @@ static int sd_config(struct gspca_dev *gspca_dev,
return 0;
}
/* this function is called at open time */
static int sd_open(struct gspca_dev *gspca_dev)
/* this function is called at probe and resume time */
static int sd_init(struct gspca_dev *gspca_dev)
{
reg_w(gspca_dev->dev, 0x01, 0x0000);
return 0;
@ -7333,10 +7333,6 @@ static void sd_start(struct gspca_dev *gspca_dev)
}
}
static void sd_stopN(struct gspca_dev *gspca_dev)
{
}
static void sd_stop0(struct gspca_dev *gspca_dev)
{
struct sd *sd = (struct sd *) gspca_dev;
@ -7344,11 +7340,6 @@ static void sd_stop0(struct gspca_dev *gspca_dev)
send_unknown(gspca_dev->dev, sd->sensor);
}
/* this function is called at close time */
static void sd_close(struct gspca_dev *gspca_dev)
{
}
static void sd_pkt_scan(struct gspca_dev *gspca_dev,
struct gspca_frame *frame,
__u8 *data,
@ -7508,11 +7499,9 @@ static const struct sd_desc sd_desc = {
.ctrls = sd_ctrls,
.nctrls = sizeof sd_ctrls / sizeof sd_ctrls[0],
.config = sd_config,
.open = sd_open,
.init = sd_init,
.start = sd_start,
.stopN = sd_stopN,
.stop0 = sd_stop0,
.close = sd_close,
.pkt_scan = sd_pkt_scan,
.querymenu = sd_querymenu,
};