From patchwork Wed Feb 21 11:26:29 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Fritz X-Patchwork-Id: 10232001 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 060F0602A7 for ; Wed, 21 Feb 2018 11:26:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F251D28AE7 for ; Wed, 21 Feb 2018 11:26:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E6D9028AEA; Wed, 21 Feb 2018 11:26:38 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2423028AE7 for ; Wed, 21 Feb 2018 11:26:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753898AbeBUL0g (ORCPT ); Wed, 21 Feb 2018 06:26:36 -0500 Received: from mail-wr0-f195.google.com ([209.85.128.195]:35955 "EHLO mail-wr0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753175AbeBUL0d (ORCPT ); Wed, 21 Feb 2018 06:26:33 -0500 Received: by mail-wr0-f195.google.com with SMTP id u15so3468714wrg.3 for ; Wed, 21 Feb 2018 03:26:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20161025; h=message-id:subject:from:reply-to:to:cc:date:mime-version :content-transfer-encoding; bh=JhCsS1whDFu9Kgt9UvD5OWlaH9iuZMKbgxRhn94xmZE=; b=JT8wO2YmFS4xi32cwGCqUZrptyRSc1ROwdEvDJFkCNoPaF8UsYLKZGF+u465YVKqn6 Y7lgMe5jl47is5ncj3JgYDYRfAPk6F53POj/K80aRZqULyRSOHFFqlFGUVVqBp+vpZTM kMnrtTIc2Qigvj/Zr7f8Zt+9wxcDVh6Y22Y6BKcrq19Ww4BYYX/jpKIWLErkq49fWiqa qDMXJzijit7Prcc1NQ4wt4O4JC2biBCWfoPaPTnhQ44/FlB7h/AySlXx09KOILoLp1oq hOrYOsiGBzgbV22aSGEu/ttkVq7DChgMlP24gs1h35/PtXrWh0NHHJ35UQOXfHdLBJkx WEHg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:subject:from:reply-to:to:cc:date :mime-version:content-transfer-encoding; bh=JhCsS1whDFu9Kgt9UvD5OWlaH9iuZMKbgxRhn94xmZE=; b=NNPfn3XeRSb3BzLEUh6LGvNZgHlYsIlgsH4yJFbB1y2CV+izU3Vp7BneV9u2GUSZSE YNHdlBfbrc0UjaPmMxKpszNV3YDDVQKkrxtMpT3rDnAA/gzz+xWJfzORw8XmzvTunW7J 9abbDL1EcPo06aUUvhJegC02SIjYl/cUBeCJzqBjG7hz07zYZHwmT9uiph7EhvTxmMcU ZWnlpOa3uud7NQw0r2ytldbjpLVtRwHg0fOvw7b1/C8lz0k0u84EL5FvaG0MdwQyvWGq AN0O124D+PZS0Bk6C3dthhdfvwdqaN+eF/rYNb9FwKFt7PwwVk72nu0OK1s1o9UJEzzp Q2Eg== X-Gm-Message-State: APf1xPB7iXCLtbID8vfLkiNibbnyeTuNHnxlifKQLeIENDlIBeMkkSVv gWbLZ7vX3ROxnMiR4SvOXUfT/g== X-Google-Smtp-Source: AH8x227GK/mYOY54/Y2sHxDMnjY3K2sa0zxBLWSfCKdLQ4385qHk5cdV9b3NKdh0EiMETxHotwz6Eg== X-Received: by 10.28.167.208 with SMTP id q199mr1913777wme.29.1519212391616; Wed, 21 Feb 2018 03:26:31 -0800 (PST) Received: from mars.fritz.box (HSI-KBW-109-193-021-110.hsi7.kabel-badenwuerttemberg.de. [109.193.21.110]) by smtp.gmail.com with ESMTPSA id s125sm6993563wmf.4.2018.02.21.03.26.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 21 Feb 2018 03:26:30 -0800 (PST) Message-ID: <1519212389.11643.13.camel@googlemail.com> Subject: [PATCH] uvcvideo: add quirk to force Phytec CAM 004H to GBRG From: Christoph Fritz Reply-To: chf.fritz@googlemail.com To: Laurent Pinchart , Mauro Carvalho Chehab Cc: linux-media , Norbert Wesp Date: Wed, 21 Feb 2018 12:26:29 +0100 X-Mailer: Evolution 3.12.9-1+b1 Mime-Version: 1.0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 Tested-by: Norbert Wesp --- 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