From patchwork Sat Oct 31 23:15:17 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: 1924 Return-path: Envelope-to: mchehab@infradead.org Delivery-date: Sat, 31 Oct 2009 23:15:30 +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:21:59 -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 1N4NAQ-0002BA-Gs; Sat, 31 Oct 2009 23:15:30 +0000 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933369AbZJaXPY (ORCPT + 1 other); Sat, 31 Oct 2009 19:15:24 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S933353AbZJaXPY (ORCPT ); Sat, 31 Oct 2009 19:15:24 -0400 Received: from mail01a.mail.t-online.hu ([84.2.40.6]:51868 "EHLO mail01a.mail.t-online.hu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933343AbZJaXPX (ORCPT ); Sat, 31 Oct 2009 19:15:23 -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 mail01a.mail.t-online.hu (Postfix) with ESMTPSA id A45E87978FA; Sun, 1 Nov 2009 00:15:16 +0100 (CET) Message-ID: <4AECC505.4040201@freemail.hu> Date: Sun, 01 Nov 2009 00:15:17 +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 11/21] gspca pac7302/pac7311: separate contrast control X-DCC-mail.t-online.hu-Metrics: mail01a.mail.t-online.hu 32721; Body=6 Fuz1=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 contrast control. 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 k/drivers/media/video/gspca/pac7311.c l/drivers/media/video/gspca/pac7311.c --- k/drivers/media/video/gspca/pac7311.c 2009-10-31 07:13:44.000000000 +0100 +++ l/drivers/media/video/gspca/pac7311.c 2009-10-31 07:21:22.000000000 +0100 @@ -83,8 +83,10 @@ struct sd { /* V4L2 controls supported by the driver */ static int pac7302_sd_setbrightness(struct gspca_dev *gspca_dev, __s32 val); static int pac7302_sd_getbrightness(struct gspca_dev *gspca_dev, __s32 *val); -static int sd_setcontrast(struct gspca_dev *gspca_dev, __s32 val); -static int sd_getcontrast(struct gspca_dev *gspca_dev, __s32 *val); +static int pac7302_sd_setcontrast(struct gspca_dev *gspca_dev, __s32 val); +static int pac7311_sd_setcontrast(struct gspca_dev *gspca_dev, __s32 val); +static int pac7302_sd_getcontrast(struct gspca_dev *gspca_dev, __s32 *val); +static int pac7311_sd_getcontrast(struct gspca_dev *gspca_dev, __s32 *val); static int pac7302_sd_setcolors(struct gspca_dev *gspca_dev, __s32 val); static int pac7302_sd_getcolors(struct gspca_dev *gspca_dev, __s32 *val); static int sd_setautogain(struct gspca_dev *gspca_dev, __s32 val); @@ -128,8 +130,8 @@ static struct ctrl pac7302_sd_ctrls[] = #define CONTRAST_DEF 127 .default_value = CONTRAST_DEF, }, - .set = sd_setcontrast, - .get = sd_getcontrast, + .set = pac7302_sd_setcontrast, + .get = pac7302_sd_getcontrast, }, /* This control is pac7302 only */ { @@ -238,8 +240,8 @@ static struct ctrl pac7311_sd_ctrls[] = #define CONTRAST_DEF 127 .default_value = CONTRAST_DEF, }, - .set = sd_setcontrast, - .get = sd_getcontrast, + .set = pac7311_sd_setcontrast, + .get = pac7311_sd_getcontrast, }, /* All controls below are for both the 7302 and the 7311 */ { @@ -1130,21 +1132,37 @@ static int pac7302_sd_getbrightness(stru return 0; } -static int sd_setcontrast(struct gspca_dev *gspca_dev, __s32 val) +static int pac7302_sd_setcontrast(struct gspca_dev *gspca_dev, __s32 val) { struct sd *sd = (struct sd *) gspca_dev; sd->contrast = val; if (gspca_dev->streaming) { - if (sd->sensor == SENSOR_PAC7302) - pac7302_setbrightcont(gspca_dev); - else - pac7311_setcontrast(gspca_dev); + pac7302_setbrightcont(gspca_dev); + } + return 0; +} + +static int pac7311_sd_setcontrast(struct gspca_dev *gspca_dev, __s32 val) +{ + struct sd *sd = (struct sd *) gspca_dev; + + sd->contrast = val; + if (gspca_dev->streaming) { + pac7311_setcontrast(gspca_dev); } return 0; } -static int sd_getcontrast(struct gspca_dev *gspca_dev, __s32 *val) +static int pac7302_sd_getcontrast(struct gspca_dev *gspca_dev, __s32 *val) +{ + struct sd *sd = (struct sd *) gspca_dev; + + *val = sd->contrast; + return 0; +} + +static int pac7311_sd_getcontrast(struct gspca_dev *gspca_dev, __s32 *val) { struct sd *sd = (struct sd *) gspca_dev;