From d2d7e9ae3138307284c815e1c37ea0b7b8834692 Mon Sep 17 00:00:00 2001 From: Erik Andren Date: Fri, 3 Oct 2008 15:29:02 -0300 Subject: [PATCH] V4L/DVB (9095): gspca: Moves some sensor initialization to each sensor in m5602. Signed-off-by: Erik Andren Signed-off-by: Jean-Francois Moine Signed-off-by: Mauro Carvalho Chehab --- .../media/video/gspca/m5602/m5602_bridge.h | 2 ++ drivers/media/video/gspca/m5602/m5602_core.c | 28 +++++-------------- .../media/video/gspca/m5602/m5602_mt9m111.c | 2 ++ .../media/video/gspca/m5602/m5602_ov9650.c | 2 ++ .../media/video/gspca/m5602/m5602_po1030.c | 2 ++ .../media/video/gspca/m5602/m5602_s5k4aa.c | 3 ++ .../media/video/gspca/m5602/m5602_s5k83a.c | 2 ++ 7 files changed, 20 insertions(+), 21 deletions(-) diff --git a/drivers/media/video/gspca/m5602/m5602_bridge.h b/drivers/media/video/gspca/m5602/m5602_bridge.h index fcbc37bfea5..18ca19a9436 100644 --- a/drivers/media/video/gspca/m5602/m5602_bridge.h +++ b/drivers/media/video/gspca/m5602/m5602_bridge.h @@ -152,6 +152,8 @@ struct sd { /* A pointer to the currently connected sensor */ struct m5602_sensor *sensor; + struct sd_desc *desc; + /* The current frame's id, used to detect frame boundaries */ u8 frame_id; diff --git a/drivers/media/video/gspca/m5602/m5602_core.c b/drivers/media/video/gspca/m5602/m5602_core.c index 58ebffdcaae..47507350111 100644 --- a/drivers/media/video/gspca/m5602/m5602_core.c +++ b/drivers/media/video/gspca/m5602/m5602_core.c @@ -108,44 +108,28 @@ int m5602_probe_sensor(struct sd *sd) { /* Try the po1030 */ sd->sensor = &po1030; - if (!sd->sensor->probe(sd)) { - sd_desc.ctrls = po1030.ctrls; - sd_desc.nctrls = po1030.nctrls; + if (!sd->sensor->probe(sd)) return 0; - } /* Try the mt9m111 sensor */ sd->sensor = &mt9m111; - if (!sd->sensor->probe(sd)) { - sd_desc.ctrls = mt9m111.ctrls; - sd_desc.nctrls = mt9m111.nctrls; + if (!sd->sensor->probe(sd)) return 0; - } /* Try the s5k4aa */ sd->sensor = &s5k4aa; - if (!sd->sensor->probe(sd)) { - sd_desc.ctrls = s5k4aa.ctrls; - sd_desc.nctrls = s5k4aa.nctrls; + if (!sd->sensor->probe(sd)) return 0; - } /* Try the ov9650 */ sd->sensor = &ov9650; - if (!sd->sensor->probe(sd)) { - sd_desc.ctrls = ov9650.ctrls; - sd_desc.nctrls = ov9650.nctrls; + if (!sd->sensor->probe(sd)) return 0; - } /* Try the s5k83a */ sd->sensor = &s5k83a; - if (!sd->sensor->probe(sd)) { - sd_desc.ctrls = s5k83a.ctrls; - sd_desc.nctrls = s5k83a.nctrls; + if (!sd->sensor->probe(sd)) return 0; - } - /* More sensor probe function goes here */ info("Failed to find a sensor"); @@ -246,8 +230,10 @@ int m5602_configure(struct gspca_dev *gspca_dev, int err; PDEBUG(DBG_GSPCA, "m5602_configure start"); + cam = &gspca_dev->cam; cam->epaddr = M5602_ISOC_ENDPOINT_ADDR; + sd->desc = &sd_desc; if (dump_bridge) m5602_dump_bridge(sd); diff --git a/drivers/media/video/gspca/m5602/m5602_mt9m111.c b/drivers/media/video/gspca/m5602/m5602_mt9m111.c index 17f04dd5e1d..ea2250217b0 100644 --- a/drivers/media/video/gspca/m5602/m5602_mt9m111.c +++ b/drivers/media/video/gspca/m5602/m5602_mt9m111.c @@ -62,6 +62,8 @@ int mt9m111_probe(struct sd *sd) sensor_found: sd->gspca_dev.cam.cam_mode = mt9m111.modes; sd->gspca_dev.cam.nmodes = mt9m111.nmodes; + sd->desc->ctrls = mt9m111.ctrls; + sd->desc->nctrls = mt9m111.nctrls; return 0; } diff --git a/drivers/media/video/gspca/m5602/m5602_ov9650.c b/drivers/media/video/gspca/m5602/m5602_ov9650.c index 74c3ffec0ca..31c5896250e 100644 --- a/drivers/media/video/gspca/m5602/m5602_ov9650.c +++ b/drivers/media/video/gspca/m5602/m5602_ov9650.c @@ -132,6 +132,8 @@ int ov9650_probe(struct sd *sd) sensor_found: sd->gspca_dev.cam.cam_mode = ov9650.modes; sd->gspca_dev.cam.nmodes = ov9650.nmodes; + sd->desc->ctrls = ov9650.ctrls; + sd->desc->nctrls = ov9650.nctrls; return 0; } diff --git a/drivers/media/video/gspca/m5602/m5602_po1030.c b/drivers/media/video/gspca/m5602/m5602_po1030.c index 14a8f929dd1..08c015bde11 100644 --- a/drivers/media/video/gspca/m5602/m5602_po1030.c +++ b/drivers/media/video/gspca/m5602/m5602_po1030.c @@ -59,6 +59,8 @@ int po1030_probe(struct sd *sd) sensor_found: sd->gspca_dev.cam.cam_mode = po1030.modes; sd->gspca_dev.cam.nmodes = po1030.nmodes; + sd->desc->ctrls = po1030.ctrls; + sd->desc->nctrls = po1030.nctrls; return 0; } diff --git a/drivers/media/video/gspca/m5602/m5602_s5k4aa.c b/drivers/media/video/gspca/m5602/m5602_s5k4aa.c index 3a2ae7a2e26..68202565325 100644 --- a/drivers/media/video/gspca/m5602/m5602_s5k4aa.c +++ b/drivers/media/video/gspca/m5602/m5602_s5k4aa.c @@ -78,6 +78,9 @@ int s5k4aa_probe(struct sd *sd) sensor_found: sd->gspca_dev.cam.cam_mode = s5k4aa.modes; sd->gspca_dev.cam.nmodes = s5k4aa.nmodes; + sd->desc->ctrls = s5k4aa.ctrls; + sd->desc->nctrls = s5k4aa.nctrls; + return 0; } diff --git a/drivers/media/video/gspca/m5602/m5602_s5k83a.c b/drivers/media/video/gspca/m5602/m5602_s5k83a.c index a4d6a816312..c1ff967b1c3 100644 --- a/drivers/media/video/gspca/m5602/m5602_s5k83a.c +++ b/drivers/media/video/gspca/m5602/m5602_s5k83a.c @@ -63,6 +63,8 @@ int s5k83a_probe(struct sd *sd) sensor_found: sd->gspca_dev.cam.cam_mode = s5k83a.modes; sd->gspca_dev.cam.nmodes = s5k83a.nmodes; + sd->desc->ctrls = s5k83a.ctrls; + sd->desc->nctrls = s5k83a.nctrls; return 0; } -- 2.41.1