From patchwork Tue May 14 06:13:41 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stu Hsieh X-Patchwork-Id: 10942261 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 0F4A576 for ; Tue, 14 May 2019 06:14:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F008A1FF60 for ; Tue, 14 May 2019 06:14:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E40DC285D6; Tue, 14 May 2019 06:14:46 +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 75F071FF60 for ; Tue, 14 May 2019 06:14:46 +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=iZWq/03ebN6TqN2oeBw9pyZkMLa5FmoPnBsti+P9OdA=; b=Qq/Fix6xlOUT9A L+ERWsoxksMDw4O637wueIf1YN5L0BLf+QvRuJdl8RB8s08FugIGzjCSCqKjiObAfF2M5IGTlg5LJ nUzk9Yx/5MN+FM8bj99CWW3D73a1UFliWrnsyiinowa7y3wKXgW5cwBm75IVaamwOkKmYaXgo07Im JCk4yP5+2adf9pfjsrL6WC7pcl0EJN2Aj7UF2LtF5O0/9TV1dA3sC00lRZBaTmK2V1ll0i0VE/qgj N2W2xj/sg2wZbwDSoo+mknlOx/Lye3VPL6gPKW/sFKXFF1ktNhMZDvn0tFH7k5iLxY/Pbgj1oVXuj To95w62u/klkTML1LEhQ==; 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 1hQQi4-0008Fa-6p; Tue, 14 May 2019 06:14:44 +0000 Received: from mailgw01.mediatek.com ([216.200.240.184]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hQQhR-0007QT-Ft; Tue, 14 May 2019 06:14:06 +0000 X-UUID: 2a9da24f75074f3a92566861c1164411-20190513 X-UUID: 2a9da24f75074f3a92566861c1164411-20190513 Received: from mtkcas66.mediatek.inc [(172.29.193.44)] by mailgw01.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLS) with ESMTP id 1583825719; Mon, 13 May 2019 22:13:57 -0800 Received: from MTKMBS01N2.mediatek.inc (172.21.101.79) by MTKMBS62N1.mediatek.inc (172.29.193.41) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Mon, 13 May 2019 23:13:57 -0700 Received: from MTKCAS06.mediatek.inc (172.21.101.30) by mtkmbs01n2.mediatek.inc (172.21.101.79) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Tue, 14 May 2019 14:13:54 +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, 14 May 2019 14:13:54 +0800 From: Stu Hsieh To: Mauro Carvalho Chehab , Rob Herring , CK Hu Subject: [PATCH v3 04/13] [media] mtk-mipicsi: add the check for non-supported color format Date: Tue, 14 May 2019 14:13:41 +0800 Message-ID: <1557814430-9675-5-git-send-email-stu.hsieh@mediatek.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1557814430-9675-1-git-send-email-stu.hsieh@mediatek.com> References: <1557814430-9675-1-git-send-email-stu.hsieh@mediatek.com> MIME-Version: 1.0 X-TM-SNTS-SMTP: EAB881BC5B75B3FF29E97C0916E56D141406D08395B8A39BF2325F9392B3BE062000:8 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190513_231405_712041_E481D482 X-CRM114-Status: GOOD ( 12.45 ) 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 the check for non-supported color format 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 9142564baf1d..9c65b96456c4 100644 --- a/drivers/media/platform/mtk-mipicsi/mtk_mipicsi.c +++ b/drivers/media/platform/mtk-mipicsi/mtk_mipicsi.c @@ -172,6 +172,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) { @@ -187,6 +201,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);