linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] uvcvideo: add quirk to force Phytec CAM 004H to GBRG
@ 2018-02-21 11:26 Christoph Fritz
  2018-02-21 19:37 ` Laurent Pinchart
  0 siblings, 1 reply; 12+ messages in thread
From: Christoph Fritz @ 2018-02-21 11:26 UTC (permalink / raw)
  To: Laurent Pinchart, Mauro Carvalho Chehab; +Cc: linux-media, Norbert Wesp

This patch adds a quirk to force Phytec CAM 004H to format GBRG because
it is announcing its format wrong.

Signed-off-by: Christoph Fritz <chf.fritz@googlemail.com>
Tested-by: Norbert Wesp <n.wesp@phytec.de>
---
 drivers/media/usb/uvc/uvc_driver.c | 16 ++++++++++++++++
 drivers/media/usb/uvc/uvcvideo.h   |  1 +
 2 files changed, 17 insertions(+)

diff --git a/drivers/media/usb/uvc/uvc_driver.c b/drivers/media/usb/uvc/uvc_driver.c
index cde43b6..8bfa40b 100644
--- a/drivers/media/usb/uvc/uvc_driver.c
+++ b/drivers/media/usb/uvc/uvc_driver.c
@@ -406,6 +406,13 @@ static int uvc_parse_format(struct uvc_device *dev,
 				width_multiplier = 2;
 			}
 		}
+		if (dev->quirks & UVC_QUIRK_FORCE_GBRG) {
+			if (format->fcc == V4L2_PIX_FMT_SGRBG8) {
+				strlcpy(format->name, "GBRG Bayer (GBRG)",
+					sizeof(format->name));
+				format->fcc = V4L2_PIX_FMT_SGBRG8;
+			}
+		}
 
 		if (buffer[2] == UVC_VS_FORMAT_UNCOMPRESSED) {
 			ftype = UVC_VS_FRAME_UNCOMPRESSED;
@@ -2631,6 +2638,15 @@ static struct usb_device_id uvc_ids[] = {
 	  .bInterfaceClass	= USB_CLASS_VENDOR_SPEC,
 	  .bInterfaceSubClass	= 1,
 	  .bInterfaceProtocol	= 0 },
+	/* PHYTEC CAM 004H cameras */
+	{ .match_flags		= USB_DEVICE_ID_MATCH_DEVICE
+				| USB_DEVICE_ID_MATCH_INT_INFO,
+	  .idVendor		= 0x199e,
+	  .idProduct		= 0x8302,
+	  .bInterfaceClass	= USB_CLASS_VIDEO,
+	  .bInterfaceSubClass	= 1,
+	  .bInterfaceProtocol	= 0,
+	  .driver_info		= UVC_QUIRK_FORCE_GBRG },
 	/* Bodelin ProScopeHR */
 	{ .match_flags		= USB_DEVICE_ID_MATCH_DEVICE
 				| USB_DEVICE_ID_MATCH_DEV_HI
diff --git a/drivers/media/usb/uvc/uvcvideo.h b/drivers/media/usb/uvc/uvcvideo.h
index 7e4d3ee..ad51002 100644
--- a/drivers/media/usb/uvc/uvcvideo.h
+++ b/drivers/media/usb/uvc/uvcvideo.h
@@ -164,6 +164,7 @@
 #define UVC_QUIRK_RESTRICT_FRAME_RATE	0x00000200
 #define UVC_QUIRK_RESTORE_CTRLS_ON_INIT	0x00000400
 #define UVC_QUIRK_FORCE_Y8		0x00000800
+#define UVC_QUIRK_FORCE_GBRG		0x00001000
 
 /* Format flags */
 #define UVC_FMT_FLAG_COMPRESSED		0x00000001
-- 
2.1.4

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

end of thread, other threads:[~2018-08-18  0:54 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-02-21 11:26 [PATCH] uvcvideo: add quirk to force Phytec CAM 004H to GBRG Christoph Fritz
2018-02-21 19:37 ` Laurent Pinchart
2018-02-21 20:42   ` Christoph Fritz
2018-02-21 21:24     ` Laurent Pinchart
2018-08-06 23:14       ` Laurent Pinchart
2018-08-16 12:48         ` Christoph Fritz
2018-08-16 16:39           ` Laurent Pinchart
2018-08-17  7:09             ` Christoph Fritz
2018-08-17  8:49               ` Laurent Pinchart
2018-08-17  9:17                 ` [PATCH] media: uvcvideo: Store device information pointer in struct uvc_device Laurent Pinchart
2018-08-17 17:46             ` [PATCH] uvcvideo: add quirk to force Phytec CAM 004H to GBRG Philipp Zabel
2018-08-17 21:50               ` Laurent Pinchart

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).