public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: video4linux-list@redhat.com
Subject: Re: PATCH: soc-camera: use flag for colour / bw camera instead of module parameter
Date: Tue, 15 Jul 2008 16:01:41 +0200	[thread overview]
Message-ID: <20080715140141.GG6739@pengutronix.de> (raw)
In-Reply-To: <20080715135618.GE6739@pengutronix.de>


Also in -p1 fashion:


Use a flag in struct soc_camera_link for differentiation between
a black/white and a colour camera rather than a module parameter.
This allows for having colour and black/white cameras in the same
system.
Note that this one breaks the phytec pcm027 pxa board as it makes it
impossible to switch between cameras on the command line. I will send
an updated version of this patch once I know this patch is acceptable
this way.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>

---
 drivers/media/video/mt9v022.c |    7 +------
 include/media/soc_camera.h    |    8 ++++++++
 2 files changed, 9 insertions(+), 6 deletions(-)

Index: linux-2.6/include/media/soc_camera.h
===================================================================
--- linux-2.6.orig/include/media/soc_camera.h
+++ linux-2.6/include/media/soc_camera.h
@@ -80,6 +80,12 @@ struct soc_camera_host_ops {
 	void (*spinlock_free)(spinlock_t *);
 };
 
+/* There are several cameras out there which come in a black/white
+ * and a colour variant. They are logically the same cameras and thus
+ * can't be detected in software
+ */
+#define SOCAM_LINK_COLOUR	(1 << 0)
+
 struct soc_camera_link {
 	/* Camera bus id, used to match a camera and a bus */
 	int bus_id;
@@ -88,6 +94,8 @@ struct soc_camera_link {
 	/* (de-)activate this camera. Can be left empty if only one camera is
 	 * connected to this bus. */
 	void (*activate)(struct soc_camera_link *, int);
+
+	unsigned long flags;
 };
 
 static inline struct soc_camera_device *to_soc_camera_dev(struct device *dev)
Index: linux-2.6/drivers/media/video/mt9v022.c
===================================================================
--- linux-2.6.orig/drivers/media/video/mt9v022.c
+++ linux-2.6/drivers/media/video/mt9v022.c
@@ -23,10 +23,6 @@
  * The platform has to define i2c_board_info
  * and call i2c_register_board_info() */
 
-static char *sensor_type;
-module_param(sensor_type, charp, S_IRUGO);
-MODULE_PARM_DESC(sensor_type, "Sensor type: \"colour\" or \"monochrome\"\n");
-
 /* mt9v022 selected register addresses */
 #define MT9V022_CHIP_VERSION		0x00
 #define MT9V022_COLUMN_START		0x01
@@ -698,8 +694,7 @@ static int mt9v022_video_probe(struct so
 	}
 
 	/* Set monochrome or colour sensor type */
-	if (sensor_type && (!strcmp("colour", sensor_type) ||
-			    !strcmp("color", sensor_type))) {
+	if (icd->link->flags & SOCAM_LINK_COLOUR) {
 		ret = reg_write(icd, MT9V022_PIXEL_OPERATION_MODE, 4 | 0x11);
 		mt9v022->model = V4L2_IDENT_MT9V022IX7ATC;
 		icd->formats = mt9v022_colour_formats;

-- 
-- 
 Pengutronix - Linux Solutions for Science and Industry
   Handelsregister:  Amtsgericht Hildesheim, HRA 2686
     Hannoversche Str. 2, 31134 Hildesheim, Germany
   Phone: +49-5121-206917-0 |  Fax: +49-5121-206917-9

--
video4linux-list mailing list
Unsubscribe mailto:video4linux-list-request@redhat.com?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list

  reply	other threads:[~2008-07-15 13:56 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-15 13:56 PATCH: soc-camera: use flag for colour / bw camera instead of module parameter Sascha Hauer
2008-07-15 14:01 ` Sascha Hauer [this message]
2008-07-15 14:24   ` Paulius Zaleckas
2008-07-15 20:43   ` Guennadi Liakhovetski
2008-07-16  5:49     ` Sascha Hauer
2008-07-16  6:43       ` Sascha Hauer
2008-07-16  7:19         ` Guennadi Liakhovetski
2008-07-16  7:32           ` Robert Schwebel
2008-07-16  9:12           ` Sascha Hauer
     [not found]             ` <Pine.LNX.4.64.0807161117120.12100@axis700.grange>
     [not found]               ` <20080716104506.GO6739@pengutronix.de>
2008-07-16 11:16                 ` Guennadi Liakhovetski
2008-07-16 12:32                   ` Sascha Hauer

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=20080715140141.GG6739@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=video4linux-list@redhat.com \
    /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