From patchwork Sat Oct 31 23:13:56 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?TsOpbWV0aCBNw6FydG9u?= X-Patchwork-Id: 1917 Return-path: Envelope-to: mchehab@infradead.org Delivery-date: Sat, 31 Oct 2009 23:14:02 +0000 Received: from bombadil.infradead.org [18.85.46.34] by caramujo.chehab.org with IMAP (fetchmail-6.3.6) for (single-drop); Sat, 31 Oct 2009 21:14:42 -0200 (BRST) Received: from vger.kernel.org ([209.132.176.167]) by bombadil.infradead.org with esmtp (Exim 4.69 #1 (Red Hat Linux)) id 1N4N90-0002BA-8B; Sat, 31 Oct 2009 23:14:02 +0000 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933351AbZJaXN4 (ORCPT + 1 other); Sat, 31 Oct 2009 19:13:56 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S933349AbZJaXN4 (ORCPT ); Sat, 31 Oct 2009 19:13:56 -0400 Received: from mail01d.mail.t-online.hu ([84.2.42.6]:51400 "EHLO mail01d.mail.t-online.hu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933340AbZJaXNz (ORCPT ); Sat, 31 Oct 2009 19:13:55 -0400 X-Authuid: nmarci Received: from [192.168.1.64] (dsl5402C4D0.pool.t-online.hu [84.2.196.208]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail01d.mail.t-online.hu (Postfix) with ESMTPSA id 76BF3758447; Sun, 1 Nov 2009 00:13:49 +0100 (CET) Message-ID: <4AECC4B4.8080401@freemail.hu> Date: Sun, 01 Nov 2009 00:13:56 +0100 From: =?UTF-8?B?TsOpbWV0aCBNw6FydG9u?= User-Agent: Mozilla/5.0 (X11; U; Linux i686; hu-HU; rv:1.8.1.21) Gecko/20090402 SeaMonkey/1.1.16 MIME-Version: 1.0 To: Jean-Francois Moine , Hans de Goede , V4L Mailing List CC: Thomas Kaiser , Theodore Kilgore , Kyle Guinn Subject: [PATCH 04/21] gspca pac7302/pac7311: separate config X-DCC-mail.t-online.hu-Metrics: mail01d.mail.t-online.hu 32711; Body=6 Fuz1=6 Fuz2=6 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org From: Márton Németh Separate the config function. Remove the run-time decision for PAC7302 and PAC7311 sensors. Signed-off-by: Márton Németh Cc: Thomas Kaiser Cc: Theodore Kilgore Cc: Kyle Guinn --- -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html 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,