From patchwork Tue Apr 16 09:30:04 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stu Hsieh X-Patchwork-Id: 10902407 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2C08A1823 for ; Tue, 16 Apr 2019 09:32:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1294C2892A for ; Tue, 16 Apr 2019 09:32:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 074742892C; Tue, 16 Apr 2019 09:32:26 +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=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id ACD992892A for ; Tue, 16 Apr 2019 09:32:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=jfT78p0QuVmqh0pAbCdoNwnUCiHmvzuRwUtiiXwOztk=; b=AQLyc7WJXnisPY EXihCyO3FpyOEycOdxwK+Er3FkxzI3JD9iDoxbzE2F3TnnmZv1+Kz8Z79k+7l2lDI9d7lqOriA2Xa kvU36CJOuKE0Dwk2G+aCJIU1rrIf1M863Zz/16ryQM+5Gisp3061KF5RNCczJbRqkGuETwdPZ1rnm ZGqa3uK6fTEAcldpUe47A7YcZgOj8S+2FHiUOWVTAC2cgBoQVmwfhi3oeP0ddqnN0SEVLsITZ1VQR cvi35sTVRrsp5z03SD8sSy/hihybbAcK+5ydKd9YfM4UKrC0tBcSldE6YoxpYyYiWT0YdoIqw680E DmityLe3FwfohVoC37XA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hGKS0-0007F5-JB; Tue, 16 Apr 2019 09:32:24 +0000 Received: from merlin.infradead.org ([2001:8b0:10b:1231::1]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hGKQN-0005Nt-JB; Tue, 16 Apr 2019 09:30:43 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=Content-Type:MIME-Version:References: In-Reply-To:Message-ID:Date:Subject:CC:To:From:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=k0O7t7IRDd+sGsmjG2cdH8o80Apal8RF0adrbe+yTUM=; b=TWy/VgTw+h1H8/Vom+LbgjHzd xMSdwjbUXWcxyAD+hvUnlGc9BSm23B4RN9DCYnIdTB7eCuHRumkEwkfUSqvhln0/G40V1AZ5YM7ns pRSJCpw6ljthpkZvR71XQXwPbDjTJiulXvhkoF8O8IaiZl1W7j/r7DHIRgUYJdmOoz7AJz+GJHHKa VPRuw+12MQgtnY1f6W5B1FAi3HKnvm3sBeWEI26fKF+/okwpo8uI0mQIH3HsM/Ongenp3RZCy1utV 5EGPPNgJ6TwdT+EPUiDgCmgN/MJ0WzOTxjtaubMq9cUZqnuu2gczPOVrOAAMqWPgo3ayQ8YIwpvMU vRZxe4TjA==; Received: from mailgw01.mediatek.com ([216.200.240.184]) by merlin.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hGKQK-0001GE-OO; Tue, 16 Apr 2019 09:30:41 +0000 X-UUID: bf856686b910414b9cb69c44f99d2e3e-20190416 X-UUID: bf856686b910414b9cb69c44f99d2e3e-20190416 Received: from mtkcas66.mediatek.inc [(172.29.193.44)] by mailgw01.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLS) with ESMTP id 1396419861; Tue, 16 Apr 2019 01:30:20 -0800 Received: from mtkmbs03n1.mediatek.inc (172.21.101.181) by MTKMBS62DR.mediatek.inc (172.29.94.18) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Tue, 16 Apr 2019 02:30:19 -0700 Received: from MTKCAS06.mediatek.inc (172.21.101.30) by mtkmbs03n1.mediatek.inc (172.21.101.181) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Tue, 16 Apr 2019 17:30:17 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by MTKCAS06.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1395.4 via Frontend Transport; Tue, 16 Apr 2019 17:30:17 +0800 From: Stu Hsieh To: Mauro Carvalho Chehab , Rob Herring , CK Hu Subject: [PATCH v2 04/15] [media] mtk-mipicsi: add color format support for mt2712 Date: Tue, 16 Apr 2019 17:30:04 +0800 Message-ID: <1555407015-18130-5-git-send-email-stu.hsieh@mediatek.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1555407015-18130-1-git-send-email-stu.hsieh@mediatek.com> References: <1555407015-18130-1-git-send-email-stu.hsieh@mediatek.com> MIME-Version: 1.0 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190416_053040_981567_BFF6BDAF X-CRM114-Status: GOOD ( 13.94 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , devicetree@vger.kernel.org, srv_heupstream@mediatek.com, linux-kernel@vger.kernel.org, linux-mediatek@lists.infradead.org, Stu Hsieh , Matthias Brugger , linux-arm-kernel@lists.infradead.org, linux-media@vger.kernel.org Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP This patch add color format support for mt2712 Signed-off-by: Stu Hsieh --- .../media/platform/mtk-mipicsi/mtk_mipicsi.c | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/drivers/media/platform/mtk-mipicsi/mtk_mipicsi.c b/drivers/media/platform/mtk-mipicsi/mtk_mipicsi.c index ec4f6b503b32..16f6bc480f4e 100644 --- a/drivers/media/platform/mtk-mipicsi/mtk_mipicsi.c +++ b/drivers/media/platform/mtk-mipicsi/mtk_mipicsi.c @@ -138,6 +138,20 @@ static void mtk_mipicsi_remove_device(struct soc_camera_device *icd) (void)pm_runtime_put_sync(icd->parent); } +static bool is_supported(const u32 pixformat) +{ + switch (pixformat) { + /* YUV422 */ + case V4L2_PIX_FMT_YUYV: + case V4L2_PIX_FMT_UYVY: + case V4L2_PIX_FMT_YVYU: + case V4L2_PIX_FMT_VYUY: + return true; + } + + return false; +} + static int mtk_mipicsi_set_fmt(struct soc_camera_device *icd, struct v4l2_format *f) { @@ -153,6 +167,12 @@ static int mtk_mipicsi_set_fmt(struct soc_camera_device *icd, struct v4l2_mbus_framefmt *mf = &format.format; int ret = 0; + if (!is_supported(pix->pixelformat)) { + dev_err(dev, "Format %x not support. set V4L2_PIX_FMT_YUYV as default\n", + pix->pixelformat); + pix->pixelformat = V4L2_PIX_FMT_YUYV; + } + xlate = soc_camera_xlate_by_fourcc(icd, pix->pixelformat); if (xlate == NULL) { dev_err(dev, "Format 0x%x not found\n", pix->pixelformat);