[PATCH 04/21] gspca pac7302/pac7311: separate config

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Márton Németh <nm127@xxxxxxxxxxx>

Separate the config function. Remove the run-time decision for
PAC7302 and PAC7311 sensors.

Signed-off-by: Márton Németh <nm127@xxxxxxxxxxx>
Cc: Thomas Kaiser <thomas@xxxxxxxxxxxxxxx>
Cc: Theodore Kilgore <kilgota@xxxxxxxxxx>
Cc: Kyle Guinn <elyk03@xxxxxxxxx>
---
diff -uprN d/drivers/media/video/gspca/pac7311.c e/drivers/media/video/gspca/pac7311.c
--- d/drivers/media/video/gspca/pac7311.c	2009-10-30 17:15:51.000000000 +0100
+++ e/drivers/media/video/gspca/pac7311.c	2009-10-30 17:27:57.000000000 +0100
@@ -509,8 +509,8 @@ static void reg_w_var(struct gspca_dev *
 	/* not reached */
 }

-/* this function is called at probe time */
-static int sd_config(struct gspca_dev *gspca_dev,
+/* this function is called at probe time for pac7302 */
+static int pac7302_sd_config(struct gspca_dev *gspca_dev,
 			const struct usb_device_id *id)
 {
 	struct sd *sd = (struct sd *) gspca_dev;
@@ -519,17 +519,36 @@ static int sd_config(struct gspca_dev *g
 	cam = &gspca_dev->cam;

 	sd->sensor = id->driver_info;
-	if (sd->sensor == SENSOR_PAC7302) {
-		PDEBUG(D_CONF, "Find Sensor PAC7302");
-		cam->cam_mode = &vga_mode[2];	/* only 640x480 */
-		cam->nmodes = 1;
-	} else {
-		PDEBUG(D_CONF, "Find Sensor PAC7311");
-		cam->cam_mode = vga_mode;
-		cam->nmodes = ARRAY_SIZE(vga_mode);
-		gspca_dev->ctrl_dis = (1 << BRIGHTNESS_IDX)
-				| (1 << SATURATION_IDX);
-	}
+	PDEBUG(D_CONF, "Find Sensor PAC7302");
+	cam->cam_mode = &vga_mode[2];	/* only 640x480 */
+	cam->nmodes = 1;
+
+	sd->brightness = BRIGHTNESS_DEF;
+	sd->contrast = CONTRAST_DEF;
+	sd->colors = COLOR_DEF;
+	sd->gain = GAIN_DEF;
+	sd->exposure = EXPOSURE_DEF;
+	sd->autogain = AUTOGAIN_DEF;
+	sd->hflip = HFLIP_DEF;
+	sd->vflip = VFLIP_DEF;
+	return 0;
+}
+
+/* this function is called at probe time for pac7311 */
+static int pac7311_sd_config(struct gspca_dev *gspca_dev,
+			const struct usb_device_id *id)
+{
+	struct sd *sd = (struct sd *) gspca_dev;
+	struct cam *cam;
+
+	cam = &gspca_dev->cam;
+
+	sd->sensor = id->driver_info;
+	PDEBUG(D_CONF, "Find Sensor PAC7311");
+	cam->cam_mode = vga_mode;
+	cam->nmodes = ARRAY_SIZE(vga_mode);
+	gspca_dev->ctrl_dis = (1 << BRIGHTNESS_IDX)
+			| (1 << SATURATION_IDX);

 	sd->brightness = BRIGHTNESS_DEF;
 	sd->contrast = CONTRAST_DEF;
@@ -1136,7 +1155,7 @@ static struct sd_desc pac7302_sd_desc =
 	.name = MODULE_NAME,
 	.ctrls = sd_ctrls,
 	.nctrls = ARRAY_SIZE(sd_ctrls),
-	.config = sd_config,
+	.config = pac7302_sd_config,
 	.init = sd_init,
 	.start = sd_start,
 	.stopN = sd_stopN,
@@ -1150,7 +1169,7 @@ static struct sd_desc pac7311_sd_desc =
 	.name = MODULE_NAME,
 	.ctrls = sd_ctrls,
 	.nctrls = ARRAY_SIZE(sd_ctrls),
-	.config = sd_config,
+	.config = pac7311_sd_config,
 	.init = sd_init,
 	.start = sd_start,
 	.stopN = sd_stopN,
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux