11590Srgrimes/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
21590Srgrimes/*
31590Srgrimes * Media Bus API header
41590Srgrimes *
51590Srgrimes * Copyright (C) 2009, Guennadi Liakhovetski <g.liakhovetski@gmx.de>
61590Srgrimes *
71590Srgrimes * This program is free software; you can redistribute it and/or modify
81590Srgrimes * it under the terms of the GNU General Public License version 2 as
91590Srgrimes * published by the Free Software Foundation.
101590Srgrimes */
111590Srgrimes
121590Srgrimes#ifndef __LINUX_MEDIA_BUS_FORMAT_H
131590Srgrimes#define __LINUX_MEDIA_BUS_FORMAT_H
141590Srgrimes
151590Srgrimes/*
161590Srgrimes * These bus formats uniquely identify data formats on the data bus. Format 0
171590Srgrimes * is reserved, MEDIA_BUS_FMT_FIXED shall be used by host-client pairs, where
181590Srgrimes * the data format is fixed. Additionally, "2X8" means that one pixel is
191590Srgrimes * transferred in two 8-bit samples, "BE" or "LE" specify in which order those
201590Srgrimes * samples are transferred over the bus: "LE" means that the least significant
211590Srgrimes * bits are transferred first, "BE" means that the most significant bits are
221590Srgrimes * transferred first, and "PADHI" and "PADLO" define which bits - low or high,
231590Srgrimes * in the incomplete high byte, are filled with padding bits.
241590Srgrimes *
251590Srgrimes * The bus formats are grouped by type, bus_width, bits per component, samples
261590Srgrimes * per pixel and order of subsamples. Numerical values are sorted using generic
271590Srgrimes * numerical sort order (8 thus comes before 10).
281590Srgrimes *
291590Srgrimes * As their value can't change when a new bus format is inserted in the
301590Srgrimes * enumeration, the bus formats are explicitly given a numerical value. The next
311590Srgrimes * free values for each category are listed below, update them when inserting
321590Srgrimes * new pixel codes.
331590Srgrimes */
341590Srgrimes
3527313Scharnier#define MEDIA_BUS_FMT_FIXED			0x0001
361590Srgrimes
3727313Scharnier/* RGB - next is	0x1026 */
3827313Scharnier#define MEDIA_BUS_FMT_RGB444_1X12		0x1016
3927313Scharnier#define MEDIA_BUS_FMT_RGB444_2X8_PADHI_BE	0x1001
401590Srgrimes#define MEDIA_BUS_FMT_RGB444_2X8_PADHI_LE	0x1002
411590Srgrimes#define MEDIA_BUS_FMT_RGB555_2X8_PADHI_BE	0x1003
4227313Scharnier#define MEDIA_BUS_FMT_RGB555_2X8_PADHI_LE	0x1004
431590Srgrimes#define MEDIA_BUS_FMT_RGB565_1X16		0x1017
441590Srgrimes#define MEDIA_BUS_FMT_BGR565_2X8_BE		0x1005
451590Srgrimes#define MEDIA_BUS_FMT_BGR565_2X8_LE		0x1006
461590Srgrimes#define MEDIA_BUS_FMT_RGB565_2X8_BE		0x1007
471590Srgrimes#define MEDIA_BUS_FMT_RGB565_2X8_LE		0x1008
481590Srgrimes#define MEDIA_BUS_FMT_RGB666_1X18		0x1009
491590Srgrimes#define MEDIA_BUS_FMT_RGB666_2X9_BE		0x1025
501590Srgrimes#define MEDIA_BUS_FMT_BGR666_1X18		0x1023
511590Srgrimes#define MEDIA_BUS_FMT_RBG888_1X24		0x100e
521590Srgrimes#define MEDIA_BUS_FMT_RGB666_1X24_CPADHI	0x1015
531590Srgrimes#define MEDIA_BUS_FMT_BGR666_1X24_CPADHI	0x1024
541590Srgrimes#define MEDIA_BUS_FMT_RGB565_1X24_CPADHI	0x1022
551590Srgrimes#define MEDIA_BUS_FMT_RGB666_1X7X3_SPWG		0x1010
561590Srgrimes#define MEDIA_BUS_FMT_BGR888_1X24		0x1013
571590Srgrimes#define MEDIA_BUS_FMT_BGR888_3X8		0x101b
581590Srgrimes#define MEDIA_BUS_FMT_GBR888_1X24		0x1014
591590Srgrimes#define MEDIA_BUS_FMT_RGB888_1X24		0x100a
601590Srgrimes#define MEDIA_BUS_FMT_RGB888_2X12_BE		0x100b
611590Srgrimes#define MEDIA_BUS_FMT_RGB888_2X12_LE		0x100c
621590Srgrimes#define MEDIA_BUS_FMT_RGB888_3X8		0x101c
631590Srgrimes#define MEDIA_BUS_FMT_RGB888_3X8_DELTA		0x101d
641590Srgrimes#define MEDIA_BUS_FMT_RGB888_1X7X4_SPWG		0x1011
651590Srgrimes#define MEDIA_BUS_FMT_RGB888_1X7X4_JEIDA	0x1012
661590Srgrimes#define MEDIA_BUS_FMT_RGB666_1X30_CPADLO	0x101e
671590Srgrimes#define MEDIA_BUS_FMT_RGB888_1X30_CPADLO	0x101f
681590Srgrimes#define MEDIA_BUS_FMT_ARGB8888_1X32		0x100d
691590Srgrimes#define MEDIA_BUS_FMT_RGB888_1X32_PADHI		0x100f
701590Srgrimes#define MEDIA_BUS_FMT_RGB101010_1X30		0x1018
711590Srgrimes#define MEDIA_BUS_FMT_RGB666_1X36_CPADLO	0x1020
721590Srgrimes#define MEDIA_BUS_FMT_RGB888_1X36_CPADLO	0x1021
731590Srgrimes#define MEDIA_BUS_FMT_RGB121212_1X36		0x1019
741590Srgrimes#define MEDIA_BUS_FMT_RGB161616_1X48		0x101a
751590Srgrimes
761590Srgrimes/* YUV (including grey) - next is	0x202f */
771590Srgrimes#define MEDIA_BUS_FMT_Y8_1X8			0x2001
781590Srgrimes#define MEDIA_BUS_FMT_UV8_1X8			0x2015
791590Srgrimes#define MEDIA_BUS_FMT_UYVY8_1_5X8		0x2002
801590Srgrimes#define MEDIA_BUS_FMT_VYUY8_1_5X8		0x2003
811590Srgrimes#define MEDIA_BUS_FMT_YUYV8_1_5X8		0x2004
821590Srgrimes#define MEDIA_BUS_FMT_YVYU8_1_5X8		0x2005
831590Srgrimes#define MEDIA_BUS_FMT_UYVY8_2X8			0x2006
841590Srgrimes#define MEDIA_BUS_FMT_VYUY8_2X8			0x2007
851590Srgrimes#define MEDIA_BUS_FMT_YUYV8_2X8			0x2008
861590Srgrimes#define MEDIA_BUS_FMT_YVYU8_2X8			0x2009
871590Srgrimes#define MEDIA_BUS_FMT_Y10_1X10			0x200a
881590Srgrimes#define MEDIA_BUS_FMT_Y10_2X8_PADHI_LE		0x202c
891590Srgrimes#define MEDIA_BUS_FMT_UYVY10_2X10		0x2018
901590Srgrimes#define MEDIA_BUS_FMT_VYUY10_2X10		0x2019
911590Srgrimes#define MEDIA_BUS_FMT_YUYV10_2X10		0x200b
921590Srgrimes#define MEDIA_BUS_FMT_YVYU10_2X10		0x200c
931590Srgrimes#define MEDIA_BUS_FMT_Y12_1X12			0x2013
941590Srgrimes#define MEDIA_BUS_FMT_UYVY12_2X12		0x201c
951590Srgrimes#define MEDIA_BUS_FMT_VYUY12_2X12		0x201d
961590Srgrimes#define MEDIA_BUS_FMT_YUYV12_2X12		0x201e
971590Srgrimes#define MEDIA_BUS_FMT_YVYU12_2X12		0x201f
988874Srgrimes#define MEDIA_BUS_FMT_Y14_1X14			0x202d
991590Srgrimes#define MEDIA_BUS_FMT_Y16_1X16			0x202e
1001590Srgrimes#define MEDIA_BUS_FMT_UYVY8_1X16		0x200f
1011590Srgrimes#define MEDIA_BUS_FMT_VYUY8_1X16		0x2010
1021590Srgrimes#define MEDIA_BUS_FMT_YUYV8_1X16		0x2011
1031590Srgrimes#define MEDIA_BUS_FMT_YVYU8_1X16		0x2012
1041590Srgrimes#define MEDIA_BUS_FMT_YDYUYDYV8_1X16		0x2014
1051590Srgrimes#define MEDIA_BUS_FMT_UYVY10_1X20		0x201a
1061590Srgrimes#define MEDIA_BUS_FMT_VYUY10_1X20		0x201b
1071590Srgrimes#define MEDIA_BUS_FMT_YUYV10_1X20		0x200d
1081590Srgrimes#define MEDIA_BUS_FMT_YVYU10_1X20		0x200e
1091590Srgrimes#define MEDIA_BUS_FMT_VUY8_1X24			0x2024
1101590Srgrimes#define MEDIA_BUS_FMT_YUV8_1X24			0x2025
1111590Srgrimes#define MEDIA_BUS_FMT_UYYVYY8_0_5X24		0x2026
1121590Srgrimes#define MEDIA_BUS_FMT_UYVY12_1X24		0x2020
1131590Srgrimes#define MEDIA_BUS_FMT_VYUY12_1X24		0x2021
1141590Srgrimes#define MEDIA_BUS_FMT_YUYV12_1X24		0x2022
1151590Srgrimes#define MEDIA_BUS_FMT_YVYU12_1X24		0x2023
1161590Srgrimes#define MEDIA_BUS_FMT_YUV10_1X30		0x2016
1171590Srgrimes#define MEDIA_BUS_FMT_UYYVYY10_0_5X30		0x2027
11816227Sbde#define MEDIA_BUS_FMT_AYUV8_1X32		0x2017
11916227Sbde#define MEDIA_BUS_FMT_UYYVYY12_0_5X36		0x2028
12016227Sbde#define MEDIA_BUS_FMT_YUV12_1X36		0x2029
1211590Srgrimes#define MEDIA_BUS_FMT_YUV16_1X48		0x202a
1221590Srgrimes#define MEDIA_BUS_FMT_UYYVYY16_0_5X48		0x202b
1231590Srgrimes
1241590Srgrimes/* Bayer - next is	0x3021 */
1251590Srgrimes#define MEDIA_BUS_FMT_SBGGR8_1X8		0x3001
1261590Srgrimes#define MEDIA_BUS_FMT_SGBRG8_1X8		0x3013
1271590Srgrimes#define MEDIA_BUS_FMT_SGRBG8_1X8		0x3002
1281590Srgrimes#define MEDIA_BUS_FMT_SRGGB8_1X8		0x3014
1291590Srgrimes#define MEDIA_BUS_FMT_SBGGR10_ALAW8_1X8		0x3015
1301590Srgrimes#define MEDIA_BUS_FMT_SGBRG10_ALAW8_1X8		0x3016
1312513Sbde#define MEDIA_BUS_FMT_SGRBG10_ALAW8_1X8		0x3017
1322513Sbde#define MEDIA_BUS_FMT_SRGGB10_ALAW8_1X8		0x3018
1332513Sbde#define MEDIA_BUS_FMT_SBGGR10_DPCM8_1X8		0x300b
1342513Sbde#define MEDIA_BUS_FMT_SGBRG10_DPCM8_1X8		0x300c
1352513Sbde#define MEDIA_BUS_FMT_SGRBG10_DPCM8_1X8		0x3009
1362513Sbde#define MEDIA_BUS_FMT_SRGGB10_DPCM8_1X8		0x300d
1371590Srgrimes#define MEDIA_BUS_FMT_SBGGR10_2X8_PADHI_BE	0x3003
13816227Sbde#define MEDIA_BUS_FMT_SBGGR10_2X8_PADHI_LE	0x3004
1392513Sbde#define MEDIA_BUS_FMT_SBGGR10_2X8_PADLO_BE	0x3005
14016227Sbde#define MEDIA_BUS_FMT_SBGGR10_2X8_PADLO_LE	0x3006
14116227Sbde#define MEDIA_BUS_FMT_SBGGR10_1X10		0x3007
14216227Sbde#define MEDIA_BUS_FMT_SGBRG10_1X10		0x300e
14316227Sbde#define MEDIA_BUS_FMT_SGRBG10_1X10		0x300a
1442513Sbde#define MEDIA_BUS_FMT_SRGGB10_1X10		0x300f
1452513Sbde#define MEDIA_BUS_FMT_SBGGR12_1X12		0x3008
1462513Sbde#define MEDIA_BUS_FMT_SGBRG12_1X12		0x3010
1472513Sbde#define MEDIA_BUS_FMT_SGRBG12_1X12		0x3011
1482513Sbde#define MEDIA_BUS_FMT_SRGGB12_1X12		0x3012
1492513Sbde#define MEDIA_BUS_FMT_SBGGR14_1X14		0x3019
1501590Srgrimes#define MEDIA_BUS_FMT_SGBRG14_1X14		0x301a
1511590Srgrimes#define MEDIA_BUS_FMT_SGRBG14_1X14		0x301b
1521590Srgrimes#define MEDIA_BUS_FMT_SRGGB14_1X14		0x301c
1531590Srgrimes#define MEDIA_BUS_FMT_SBGGR16_1X16		0x301d
1541590Srgrimes#define MEDIA_BUS_FMT_SGBRG16_1X16		0x301e
1551590Srgrimes#define MEDIA_BUS_FMT_SGRBG16_1X16		0x301f
1561590Srgrimes#define MEDIA_BUS_FMT_SRGGB16_1X16		0x3020
1571590Srgrimes
1581590Srgrimes/* JPEG compressed formats - next is	0x4002 */
1591590Srgrimes#define MEDIA_BUS_FMT_JPEG_1X8			0x4001
1601590Srgrimes
1611590Srgrimes/* Vendor specific formats - next is	0x5002 */
1621590Srgrimes
1631590Srgrimes/* S5C73M3 sensor specific interleaved UYVY and JPEG */
1641590Srgrimes#define MEDIA_BUS_FMT_S5C_UYVY_JPEG_1X8		0x5001
1651590Srgrimes
1661590Srgrimes/* HSV - next is	0x6002 */
1671590Srgrimes#define MEDIA_BUS_FMT_AHSV8888_1X32		0x6001
1681590Srgrimes
1691590Srgrimes/*
1701590Srgrimes * This format should be used when the same driver handles
1711590Srgrimes * both sides of the link and the bus format is a fixed
1721590Srgrimes * metadata format that is not configurable from userspace.
1731590Srgrimes * Width and height will be set to 0 for this format.
1741590Srgrimes */
1751590Srgrimes#define MEDIA_BUS_FMT_METADATA_FIXED		0x7001
1761590Srgrimes
1771590Srgrimes#endif /* __LINUX_MEDIA_BUS_FORMAT_H */
1781590Srgrimes