All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Németh Márton" <nm127@freemail.hu>
To: Jean-Francois Moine <moinejf@free.fr>,
	Hans de Goede <hdegoede@redhat.com>,
	V4L Mailing List <linux-media@vger.kernel.org>
Cc: Thomas Kaiser <thomas@kaiser-linux.li>,
	Theodore Kilgore <kilgota@auburn.edu>,
	Kyle Guinn <elyk03@gmail.com>
Subject: [PATCH 11/21] gspca pac7302/pac7311: separate contrast control
Date: Sun, 01 Nov 2009 00:15:17 +0100	[thread overview]
Message-ID: <4AECC505.4040201@freemail.hu> (raw)

From: Márton Németh <nm127@freemail.hu>

Separate the contrast control. Remove the run-time decision for
PAC7302 and PAC7311 sensors.

Signed-off-by: Márton Németh <nm127@freemail.hu>
Cc: Thomas Kaiser <thomas@kaiser-linux.li>
Cc: Theodore Kilgore <kilgota@auburn.edu>
Cc: Kyle Guinn <elyk03@gmail.com>
---
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;


                 reply	other threads:[~2009-10-31 23:15 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4AECC505.4040201@freemail.hu \
    --to=nm127@freemail.hu \
    --cc=elyk03@gmail.com \
    --cc=hdegoede@redhat.com \
    --cc=kilgota@auburn.edu \
    --cc=linux-media@vger.kernel.org \
    --cc=moinejf@free.fr \
    --cc=thomas@kaiser-linux.li \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.