Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp2946347iob; Mon, 16 May 2022 09:33:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzoXn/FnrEqKITbVHRC0vvDcXILaOpRFQbo2i0YYokuzdRuCSs36LdooJ3FAiWg0kkUlBHg X-Received: by 2002:a17:907:a41f:b0:6f3:e75c:5a77 with SMTP id sg31-20020a170907a41f00b006f3e75c5a77mr15884764ejc.70.1652718795296; Mon, 16 May 2022 09:33:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652718795; cv=none; d=google.com; s=arc-20160816; b=MamkEuv/udy+mGJFkF87k7aq4DRlVMsrgvqGXh80kDT7QPz/4bhaQmG340hGLU3IrA K3lw+y6eLcsZoYBcWH8wFPdaeqhKgevhBIzCVRkewNhm7k1y03fg0xlugMP2WLY+rddC CUCRrOzbogRdvHpkTcwLCCjEDg5S0A9S9RV3BwZp6Xw/0PO3LuRdDsKBlGYVMXzyNKhn dCH5KVpCpGsRmbNHjEXJybj1+hQYtLDmYWpACHDCt3+9k6MKRYbmJ/9ZEQFjPDwTsg0X yoIiOlVbaa7PSr/XcmGyt2fSUfOrOBzRolZSaFDGbIf52sgmBU9Evg9ERcmFz0lNZewC 961Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=0BSoCdtIzeozy9JDSMEC2EkfA3L2AByvAuj91yhKQPw=; b=H5vE1tI79KFY7kGCCspVVBhArP+MWJRdmejOKFeUQ1r4cyB1ZIAhDG1TrGaQb6MJuu Uu9BKMRNDNrmTRKYNfFCPltK73sxz1yPJqIcDloz/J7Sd7OJ3uHJHEZ8XeHvRcQRgOZ5 YdL10BMRjCnjnyM9hc2wlivmBmwF/QSnYM9M5OStz0BeKAeVcDyewkgUb5VHrZSV3vc1 9jNe/q1VFvA2uIP26EUUH/Y27vqx1OuBVOS9fDJp14NLY6HPB7BGhqG43h7Ol6xGNFGD b8Ee2db8S9nF8yxtUqSJt7ddkeVQhqkXOClVd3GJIw4OUKQ0Jh5Bv25mQcFKGmgivBfe Y2AA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@foss.st.com header.s=selector1 header.b=43Y+VEym; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=foss.st.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z21-20020a05640235d500b00425d3e0c7a9si11899242edc.151.2022.05.16.09.32.48; Mon, 16 May 2022 09:33:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@foss.st.com header.s=selector1 header.b=43Y+VEym; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=foss.st.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242167AbiEPJVf (ORCPT + 99 others); Mon, 16 May 2022 05:21:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58164 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235036AbiEPJVP (ORCPT ); Mon, 16 May 2022 05:21:15 -0400 Received: from mx07-00178001.pphosted.com (mx08-00178001.pphosted.com [91.207.212.93]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 185D362FA; Mon, 16 May 2022 02:21:11 -0700 (PDT) Received: from pps.filterd (m0046661.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 24G7UHnR024416; Mon, 16 May 2022 11:20:02 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foss.st.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=selector1; bh=0BSoCdtIzeozy9JDSMEC2EkfA3L2AByvAuj91yhKQPw=; b=43Y+VEymvQKxUSe8/n/y16VFlxqNHOB9ddS0zgM+NFWy5WiD2+fbNfIbQzcleu4xWYvM f16DSN/UaJRUsPtpOijUs5PFwHshwkmKMTUrkkPDt54E9QrFXCqWGmAbMYOaOlt/P7m7 bPItgJBAmGAinIZsdijf+Xo6X9U5aWvQ9A/HdBE4wQzpBpFPRA06n3FsjJA0tWt9EoUh e9WxPVyGYtEJSgDmL5n3nxEwwBli7OHrI9mhnEL3UnKRCYkTgb4NZ8LS4q+ATvT4gtq7 gK1ZZI1sdvAqVzcC1dfsS5ZesW55HPUDVPqoD11CBZrHguGyCH12uBDcNEXuulwYRFV9 mg== Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com (PPS) with ESMTPS id 3g23ah9k15-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 16 May 2022 11:20:02 +0200 Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id BE60E10002A; Mon, 16 May 2022 11:20:01 +0200 (CEST) Received: from Webmail-eu.st.com (sfhdag2node2.st.com [10.75.127.5]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id B62252171DB; Mon, 16 May 2022 11:20:01 +0200 (CEST) Received: from localhost (10.75.127.47) by SFHDAG2NODE2.st.com (10.75.127.5) with Microsoft SMTP Server (TLS) id 15.0.1497.26; Mon, 16 May 2022 11:20:00 +0200 From: Hugues Fruchet To: Mauro Carvalho Chehab , Sakari Ailus , Benjamin Mugnier , Sylvain Petinot CC: , , Alain Volmat , Hugues Fruchet Subject: [PATCH 3/3] media: st-mipid02: expose 1X16 serial pixel format Date: Mon, 16 May 2022 11:19:34 +0200 Message-ID: <20220516091934.263141-4-hugues.fruchet@foss.st.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220516091934.263141-1-hugues.fruchet@foss.st.com> References: <20220516091934.263141-1-hugues.fruchet@foss.st.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.75.127.47] X-ClientProxiedBy: SFHDAG2NODE2.st.com (10.75.127.5) To SFHDAG2NODE2.st.com (10.75.127.5) X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.858,Hydra:6.0.486,FMLib:17.11.64.514 definitions=2022-05-16_05,2022-05-13_01,2022-02-23_01 X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Expose RGB & YUV 1X16 serial pixel format variants to comply with CSI-2 camera sensor pixel formats. Signed-off-by: Hugues Fruchet --- drivers/media/i2c/st-mipid02.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/drivers/media/i2c/st-mipid02.c b/drivers/media/i2c/st-mipid02.c index fe884d81b08b..16cc547976dd 100644 --- a/drivers/media/i2c/st-mipid02.c +++ b/drivers/media/i2c/st-mipid02.c @@ -62,7 +62,9 @@ static const u32 mipid02_supported_fmt_codes[] = { MEDIA_BUS_FMT_SGRBG10_1X10, MEDIA_BUS_FMT_SRGGB10_1X10, MEDIA_BUS_FMT_SBGGR12_1X12, MEDIA_BUS_FMT_SGBRG12_1X12, MEDIA_BUS_FMT_SGRBG12_1X12, MEDIA_BUS_FMT_SRGGB12_1X12, - MEDIA_BUS_FMT_UYVY8_1X16, MEDIA_BUS_FMT_BGR888_1X24, + MEDIA_BUS_FMT_YUYV8_1X16, MEDIA_BUS_FMT_YVYU8_1X16, + MEDIA_BUS_FMT_UYVY8_1X16, MEDIA_BUS_FMT_VYUY8_1X16, + MEDIA_BUS_FMT_RGB565_1X16, MEDIA_BUS_FMT_BGR888_1X24, MEDIA_BUS_FMT_RGB565_2X8_LE, MEDIA_BUS_FMT_RGB565_2X8_BE, MEDIA_BUS_FMT_YUYV8_2X8, MEDIA_BUS_FMT_YVYU8_2X8, MEDIA_BUS_FMT_UYVY8_2X8, MEDIA_BUS_FMT_VYUY8_2X8, @@ -132,7 +134,11 @@ static int bpp_from_code(__u32 code) case MEDIA_BUS_FMT_SGRBG12_1X12: case MEDIA_BUS_FMT_SRGGB12_1X12: return 12; + case MEDIA_BUS_FMT_YUYV8_1X16: + case MEDIA_BUS_FMT_YVYU8_1X16: case MEDIA_BUS_FMT_UYVY8_1X16: + case MEDIA_BUS_FMT_VYUY8_1X16: + case MEDIA_BUS_FMT_RGB565_1X16: case MEDIA_BUS_FMT_YUYV8_2X8: case MEDIA_BUS_FMT_YVYU8_2X8: case MEDIA_BUS_FMT_UYVY8_2X8: @@ -165,7 +171,10 @@ static u8 data_type_from_code(__u32 code) case MEDIA_BUS_FMT_SGRBG12_1X12: case MEDIA_BUS_FMT_SRGGB12_1X12: return 0x2c; + case MEDIA_BUS_FMT_YUYV8_1X16: + case MEDIA_BUS_FMT_YVYU8_1X16: case MEDIA_BUS_FMT_UYVY8_1X16: + case MEDIA_BUS_FMT_VYUY8_1X16: case MEDIA_BUS_FMT_YUYV8_2X8: case MEDIA_BUS_FMT_YVYU8_2X8: case MEDIA_BUS_FMT_UYVY8_2X8: @@ -173,6 +182,7 @@ static u8 data_type_from_code(__u32 code) return 0x1e; case MEDIA_BUS_FMT_BGR888_1X24: return 0x24; + case MEDIA_BUS_FMT_RGB565_1X16: case MEDIA_BUS_FMT_RGB565_2X8_LE: case MEDIA_BUS_FMT_RGB565_2X8_BE: return 0x22; @@ -207,8 +217,16 @@ static __u32 get_fmt_code(__u32 code) static __u32 serial_to_parallel_code(__u32 serial) { + if (serial == MEDIA_BUS_FMT_RGB565_1X16) + return MEDIA_BUS_FMT_RGB565_2X8_LE; + if (serial == MEDIA_BUS_FMT_YUYV8_1X16) + return MEDIA_BUS_FMT_YUYV8_2X8; + if (serial == MEDIA_BUS_FMT_YVYU8_1X16) + return MEDIA_BUS_FMT_YVYU8_2X8; if (serial == MEDIA_BUS_FMT_UYVY8_1X16) return MEDIA_BUS_FMT_UYVY8_2X8; + if (serial == MEDIA_BUS_FMT_VYUY8_1X16) + return MEDIA_BUS_FMT_VYUY8_2X8; if (serial == MEDIA_BUS_FMT_BGR888_1X24) return MEDIA_BUS_FMT_BGR888_3X8; -- 2.25.1