From nobody Thu Oct 2 13:00:42 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4DCE027B341; Wed, 17 Sep 2025 11:16:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758107792; cv=none; b=JF/zR/22kTvR43WQ5V/NcpctzAp0DBbeaan/VmcxDrZtEWmAExmD4MCUJLB8QS+4uirI3gw93Qh0H0+JN/v2XitEkRbyNxYwxvkYZtBEnKo0GiCIlU6RNXeQcI0U6JUxUGU7MhWafZNIjfKBd002j6fxmCnbheVoMrULSmMZkJg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758107792; c=relaxed/simple; bh=iMHuHlG6q411YG0e3jmZQFv19cMjrMhM2NPTCdKopC8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=hQlnRGvIx88xHdoThIXSv/JmbpVMk5tE1X1Ig4+0mjf2BbNEKSiIp3/9E2LaxTBueAQIk2w5C9v/FGXOHJGisYMMbgaR2EEXUwH/QKgh8oO8cIXH3K9KR813XYUBKYa+/4fxg/Pa6wdzivgrEGLzjK5qcIPkNQ8cK3HRaoYRqUY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=MO9J3wOd; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="MO9J3wOd" Received: by smtp.kernel.org (Postfix) with ESMTPSA id D505FC4CEF0; Wed, 17 Sep 2025 11:16:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1758107791; bh=iMHuHlG6q411YG0e3jmZQFv19cMjrMhM2NPTCdKopC8=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=MO9J3wOd4tc+T5RVk15uV68rKx4Ze6zI8qLKXZAYleQIS7W2HxfyaUvKlMw2RuUDD r43+GTTkHG5iycbGMMtDtXqqF5/dxqjtD3VUuwUPyHLs/tpO1EpnPFeAt0zEtYY6ll 9jaFPS49BzdGLzwNIWAqaoywDYDp9JJsrd/pBM0cwjcShDRs6I13xPHCXIH3dBYVOW K+KFdXdMbzAjkC2o/IFW3Ol8zXwGxtEVLltobYn/TBP6fKtfGzKLSsX5EE2jOuJ/cd yXBrBe4BkCX9sWbxKm48NpinUyF/NEzZ80CaPEZwo+Fy6UcOlDWtu34x7aCOTCN33x 27c8uLAJ/qc5A== From: Maxime Ripard Date: Wed, 17 Sep 2025 13:16:12 +0200 Subject: [PATCH v3 2/4] media: uapi: Introduce MEDIA_BUS_FMT_BGR565_1X16 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250917-csi-bgr-rgb-v3-2-0145571b3aa4@kernel.org> References: <20250917-csi-bgr-rgb-v3-0-0145571b3aa4@kernel.org> In-Reply-To: <20250917-csi-bgr-rgb-v3-0-0145571b3aa4@kernel.org> To: Mauro Carvalho Chehab , Mats Randgaard , Alain Volmat , Sakari Ailus , Hans Verkuil Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Hans Verkuil , Dave Stevenson , Maxime Ripard X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=3098; i=mripard@kernel.org; h=from:subject:message-id; bh=iMHuHlG6q411YG0e3jmZQFv19cMjrMhM2NPTCdKopC8=; b=owGbwMvMwCmsHn9OcpHtvjLG02pJDBmnZrQeiwnw8dsyKfmBse3E6dyXcsWevfsx46u4iOehW faueySiO6ayMAhzMsiKKbI8kQk7vbx9cZWD/cofMHNYmUCGMHBxCsBEeIQZ64wl1k66rMv8y2P/ ZO/4T5HfnrQ6bGXWPO468/NenjefxRaKfnh0ZrHFmsLvyzVlCycYizLWZ08+y+PswjDrcVDe+7V yv9tPHp+0otPi8VNDBQ/bi3Xyx12TJ+q+aJ7Nc+vgweAlwhPcAA== X-Developer-Key: i=mripard@kernel.org; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D MIPI-CSI2 sends its RGB format on the wire with the blue component first, then green, then red. MIPI calls that format "RGB", but by v4l2 conventions it would be BGR. MIPI-CSI2 supports three RGB variants: 444, 555, 565, 666 and 888. We already have BGR666 and BGR888 media bus formats, we don't have any CSI transceivers using the 444 and 555 variants, but some transceivers use the CSI RGB565 format, while using the RGB565 media bus code. That's a mistake, but since we don't have a BGR565 media bus code we need to introduce one before fixing it. Signed-off-by: Maxime Ripard --- .../userspace-api/media/v4l/subdev-formats.rst | 37 ++++++++++++++++++= ++++ include/uapi/linux/media-bus-format.h | 3 +- 2 files changed, 39 insertions(+), 1 deletion(-) diff --git a/Documentation/userspace-api/media/v4l/subdev-formats.rst b/Doc= umentation/userspace-api/media/v4l/subdev-formats.rst index 8e92f784abd8123f9ea950f954a60af56ee76dbe..def0d24ef6cdb1a2ec9395af146= 8f56adf31a8de 100644 --- a/Documentation/userspace-api/media/v4l/subdev-formats.rst +++ b/Documentation/userspace-api/media/v4l/subdev-formats.rst @@ -625,10 +625,47 @@ The following tables list existing packed RGB formats. - b\ :sub:`4` - b\ :sub:`3` - b\ :sub:`2` - b\ :sub:`1` - b\ :sub:`0` + * .. _MEDIA-BUS-FMT-BGR565-1X16: + + - MEDIA_BUS_FMT_BGR565_1X16 + - 0x1028 + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - b\ :sub:`4` + - b\ :sub:`3` + - b\ :sub:`2` + - b\ :sub:`1` + - b\ :sub:`0` + - g\ :sub:`5` + - g\ :sub:`4` + - g\ :sub:`3` + - g\ :sub:`2` + - g\ :sub:`1` + - g\ :sub:`0` + - r\ :sub:`4` + - r\ :sub:`3` + - r\ :sub:`2` + - r\ :sub:`1` + - r\ :sub:`0` * .. _MEDIA-BUS-FMT-BGR565-2X8-BE: =20 - MEDIA_BUS_FMT_BGR565_2X8_BE - 0x1005 - diff --git a/include/uapi/linux/media-bus-format.h b/include/uapi/linux/med= ia-bus-format.h index ff62056feed5b6588bfcfdff178f5b68eecd3a26..a73d91876d31844bf8c2da91dde= a541181840bd2 100644 --- a/include/uapi/linux/media-bus-format.h +++ b/include/uapi/linux/media-bus-format.h @@ -32,17 +32,18 @@ * new pixel codes. */ =20 #define MEDIA_BUS_FMT_FIXED 0x0001 =20 -/* RGB - next is 0x1028 */ +/* RGB - next is 0x1029 */ #define MEDIA_BUS_FMT_RGB444_1X12 0x1016 #define MEDIA_BUS_FMT_RGB444_2X8_PADHI_BE 0x1001 #define MEDIA_BUS_FMT_RGB444_2X8_PADHI_LE 0x1002 #define MEDIA_BUS_FMT_RGB555_2X8_PADHI_BE 0x1003 #define MEDIA_BUS_FMT_RGB555_2X8_PADHI_LE 0x1004 #define MEDIA_BUS_FMT_RGB565_1X16 0x1017 +#define MEDIA_BUS_FMT_BGR565_1X16 0x1028 #define MEDIA_BUS_FMT_BGR565_2X8_BE 0x1005 #define MEDIA_BUS_FMT_BGR565_2X8_LE 0x1006 #define MEDIA_BUS_FMT_RGB565_2X8_BE 0x1007 #define MEDIA_BUS_FMT_RGB565_2X8_LE 0x1008 #define MEDIA_BUS_FMT_RGB666_1X18 0x1009 --=20 2.50.1