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 06/21] gspca pac7302/pac7311: separate start
Date: Sun, 01 Nov 2009 00:14:17 +0100 [thread overview]
Message-ID: <4AECC4C9.5080709@freemail.hu> (raw)
From: Márton Németh <nm127@freemail.hu>
Separate the start function. 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 f/drivers/media/video/gspca/pac7311.c g/drivers/media/video/gspca/pac7311.c
--- f/drivers/media/video/gspca/pac7311.c 2009-10-30 18:04:30.000000000 +0100
+++ g/drivers/media/video/gspca/pac7311.c 2009-10-30 18:03:15.000000000 +0100
@@ -714,20 +714,40 @@ static int pac7311_sd_init(struct gspca_
return 0;
}
-static int sd_start(struct gspca_dev *gspca_dev)
+static int pac7302_sd_start(struct gspca_dev *gspca_dev)
{
struct sd *sd = (struct sd *) gspca_dev;
sd->sof_read = 0;
- if (sd->sensor == SENSOR_PAC7302) {
- reg_w_var(gspca_dev, start_7302);
- pac7302_setbrightcont(gspca_dev);
- pac7302_setcolors(gspca_dev);
- } else {
- reg_w_var(gspca_dev, start_7311);
- pac7311_setcontrast(gspca_dev);
- }
+ reg_w_var(gspca_dev, start_7302);
+ pac7302_setbrightcont(gspca_dev);
+ pac7302_setcolors(gspca_dev);
+ setgain(gspca_dev);
+ setexposure(gspca_dev);
+ sethvflip(gspca_dev);
+
+ /* only resolution 640x480 is supported for pac7302 */
+
+ sd->sof_read = 0;
+ sd->autogain_ignore_frames = 0;
+ atomic_set(&sd->avg_lum, -1);
+
+ /* start stream */
+ reg_w(gspca_dev, 0xff, 0x01);
+ reg_w(gspca_dev, 0x78, 0x01);
+
+ return 0;
+}
+
+static int pac7311_sd_start(struct gspca_dev *gspca_dev)
+{
+ struct sd *sd = (struct sd *) gspca_dev;
+
+ sd->sof_read = 0;
+
+ reg_w_var(gspca_dev, start_7311);
+ pac7311_setcontrast(gspca_dev);
setgain(gspca_dev);
setexposure(gspca_dev);
sethvflip(gspca_dev);
@@ -745,8 +765,6 @@ static int sd_start(struct gspca_dev *gs
reg_w(gspca_dev, 0x87, 0x11);
break;
case 0: /* 640x480 */
- if (sd->sensor == SENSOR_PAC7302)
- break;
reg_w(gspca_dev, 0xff, 0x01);
reg_w(gspca_dev, 0x17, 0x00);
reg_w(gspca_dev, 0x87, 0x12);
@@ -759,10 +777,8 @@ static int sd_start(struct gspca_dev *gs
/* start stream */
reg_w(gspca_dev, 0xff, 0x01);
- if (sd->sensor == SENSOR_PAC7302)
- reg_w(gspca_dev, 0x78, 0x01);
- else
- reg_w(gspca_dev, 0x78, 0x05);
+ reg_w(gspca_dev, 0x78, 0x05);
+
return 0;
}
@@ -1160,7 +1176,7 @@ static struct sd_desc pac7302_sd_desc =
.nctrls = ARRAY_SIZE(sd_ctrls),
.config = pac7302_sd_config,
.init = pac7302_sd_init,
- .start = sd_start,
+ .start = pac7302_sd_start,
.stopN = sd_stopN,
.stop0 = sd_stop0,
.pkt_scan = pac7302_sd_pkt_scan,
@@ -1174,7 +1190,7 @@ static struct sd_desc pac7311_sd_desc =
.nctrls = ARRAY_SIZE(sd_ctrls),
.config = pac7311_sd_config,
.init = pac7311_sd_init,
- .start = sd_start,
+ .start = pac7311_sd_start,
.stopN = sd_stopN,
.stop0 = sd_stop0,
.pkt_scan = pac7311_sd_pkt_scan,
reply other threads:[~2009-10-31 23:14 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=4AECC4C9.5080709@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox