public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
* PATCH: soc-camera: use flag for colour / bw camera instead of module parameter
@ 2008-07-15 13:56 Sascha Hauer
  2008-07-15 14:01 ` Sascha Hauer
  0 siblings, 1 reply; 11+ messages in thread
From: Sascha Hauer @ 2008-07-15 13:56 UTC (permalink / raw)
  To: video4linux-list

Hi,

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: include/media/soc_camera.h
===================================================================
--- include/media/soc_camera.h.orig
+++ 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: drivers/media/video/mt9v022.c
===================================================================
--- drivers/media/video/mt9v022.c.orig
+++ 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

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2008-07-16 12:26 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox