1e2be04c7SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2edcf58bcSBoris BREZILLON /*
3edcf58bcSBoris BREZILLON  * Media Bus API header
4edcf58bcSBoris BREZILLON  *
5edcf58bcSBoris BREZILLON  * Copyright (C) 2009, Guennadi Liakhovetski <g.liakhovetski@gmx.de>
6edcf58bcSBoris BREZILLON  *
7edcf58bcSBoris BREZILLON  * This program is free software; you can redistribute it and/or modify
8edcf58bcSBoris BREZILLON  * it under the terms of the GNU General Public License version 2 as
9edcf58bcSBoris BREZILLON  * published by the Free Software Foundation.
10edcf58bcSBoris BREZILLON  */
11edcf58bcSBoris BREZILLON 
12edcf58bcSBoris BREZILLON #ifndef __LINUX_MEDIA_BUS_FORMAT_H
13edcf58bcSBoris BREZILLON #define __LINUX_MEDIA_BUS_FORMAT_H
14edcf58bcSBoris BREZILLON 
15edcf58bcSBoris BREZILLON /*
16edcf58bcSBoris BREZILLON  * These bus formats uniquely identify data formats on the data bus. Format 0
17edcf58bcSBoris BREZILLON  * is reserved, MEDIA_BUS_FMT_FIXED shall be used by host-client pairs, where
18edcf58bcSBoris BREZILLON  * the data format is fixed. Additionally, "2X8" means that one pixel is
19edcf58bcSBoris BREZILLON  * transferred in two 8-bit samples, "BE" or "LE" specify in which order those
20edcf58bcSBoris BREZILLON  * samples are transferred over the bus: "LE" means that the least significant
21edcf58bcSBoris BREZILLON  * bits are transferred first, "BE" means that the most significant bits are
22edcf58bcSBoris BREZILLON  * transferred first, and "PADHI" and "PADLO" define which bits - low or high,
23edcf58bcSBoris BREZILLON  * in the incomplete high byte, are filled with padding bits.
24edcf58bcSBoris BREZILLON  *
25edcf58bcSBoris BREZILLON  * The bus formats are grouped by type, bus_width, bits per component, samples
26edcf58bcSBoris BREZILLON  * per pixel and order of subsamples. Numerical values are sorted using generic
27edcf58bcSBoris BREZILLON  * numerical sort order (8 thus comes before 10).
28edcf58bcSBoris BREZILLON  *
29edcf58bcSBoris BREZILLON  * As their value can't change when a new bus format is inserted in the
30edcf58bcSBoris BREZILLON  * enumeration, the bus formats are explicitly given a numerical value. The next
31edcf58bcSBoris BREZILLON  * free values for each category are listed below, update them when inserting
32edcf58bcSBoris BREZILLON  * new pixel codes.
33edcf58bcSBoris BREZILLON  */
34edcf58bcSBoris BREZILLON 
35edcf58bcSBoris BREZILLON #define MEDIA_BUS_FMT_FIXED			0x0001
36edcf58bcSBoris BREZILLON 
37*1113f644SJoerg Quinten /* RGB - next is	0x1025 */
38cec32a47SPhilipp Zabel #define MEDIA_BUS_FMT_RGB444_1X12		0x1016
39edcf58bcSBoris BREZILLON #define MEDIA_BUS_FMT_RGB444_2X8_PADHI_BE	0x1001
40edcf58bcSBoris BREZILLON #define MEDIA_BUS_FMT_RGB444_2X8_PADHI_LE	0x1002
41edcf58bcSBoris BREZILLON #define MEDIA_BUS_FMT_RGB555_2X8_PADHI_BE	0x1003
42edcf58bcSBoris BREZILLON #define MEDIA_BUS_FMT_RGB555_2X8_PADHI_LE	0x1004
43cec32a47SPhilipp Zabel #define MEDIA_BUS_FMT_RGB565_1X16		0x1017
44edcf58bcSBoris BREZILLON #define MEDIA_BUS_FMT_BGR565_2X8_BE		0x1005
45edcf58bcSBoris BREZILLON #define MEDIA_BUS_FMT_BGR565_2X8_LE		0x1006
46edcf58bcSBoris BREZILLON #define MEDIA_BUS_FMT_RGB565_2X8_BE		0x1007
47edcf58bcSBoris BREZILLON #define MEDIA_BUS_FMT_RGB565_2X8_LE		0x1008
48edcf58bcSBoris BREZILLON #define MEDIA_BUS_FMT_RGB666_1X18		0x1009
492468e019SJoerg Quinten #define MEDIA_BUS_FMT_BGR666_1X18		0x1023
507b0fd456SLaurent Pinchart #define MEDIA_BUS_FMT_RBG888_1X24		0x100e
51203508efSPhilipp Zabel #define MEDIA_BUS_FMT_RGB666_1X24_CPADHI	0x1015
52*1113f644SJoerg Quinten #define MEDIA_BUS_FMT_BGR666_1X24_CPADHI	0x1024
53a0af74f3SChris Morgan #define MEDIA_BUS_FMT_RGB565_1X24_CPADHI	0x1022
54b295c229SPhilipp Zabel #define MEDIA_BUS_FMT_RGB666_1X7X3_SPWG		0x1010
5508c38458SPhilipp Zabel #define MEDIA_BUS_FMT_BGR888_1X24		0x1013
56e3521f56SMickael Guene #define MEDIA_BUS_FMT_BGR888_3X8		0x101b
5708c38458SPhilipp Zabel #define MEDIA_BUS_FMT_GBR888_1X24		0x1014
58edcf58bcSBoris BREZILLON #define MEDIA_BUS_FMT_RGB888_1X24		0x100a
59edcf58bcSBoris BREZILLON #define MEDIA_BUS_FMT_RGB888_2X12_BE		0x100b
60edcf58bcSBoris BREZILLON #define MEDIA_BUS_FMT_RGB888_2X12_LE		0x100c
610565ae92SPaul Cercueil #define MEDIA_BUS_FMT_RGB888_3X8		0x101c
6263ee07d5SPaul Cercueil #define MEDIA_BUS_FMT_RGB888_3X8_DELTA		0x101d
63b295c229SPhilipp Zabel #define MEDIA_BUS_FMT_RGB888_1X7X4_SPWG		0x1011
64b295c229SPhilipp Zabel #define MEDIA_BUS_FMT_RGB888_1X7X4_JEIDA	0x1012
65e6445be4SLiu Ying #define MEDIA_BUS_FMT_RGB666_1X30_CPADLO	0x101e
66e6445be4SLiu Ying #define MEDIA_BUS_FMT_RGB888_1X30_CPADLO	0x101f
67edcf58bcSBoris BREZILLON #define MEDIA_BUS_FMT_ARGB8888_1X32		0x100d
687b0fd456SLaurent Pinchart #define MEDIA_BUS_FMT_RGB888_1X32_PADHI		0x100f
69d0353118SNeil Armstrong #define MEDIA_BUS_FMT_RGB101010_1X30		0x1018
70e6445be4SLiu Ying #define MEDIA_BUS_FMT_RGB666_1X36_CPADLO	0x1020
71e6445be4SLiu Ying #define MEDIA_BUS_FMT_RGB888_1X36_CPADLO	0x1021
72d0353118SNeil Armstrong #define MEDIA_BUS_FMT_RGB121212_1X36		0x1019
73d0353118SNeil Armstrong #define MEDIA_BUS_FMT_RGB161616_1X48		0x101a
74edcf58bcSBoris BREZILLON 
75573a7508SDaniel Glöckner /* YUV (including grey) - next is	0x202f */
76edcf58bcSBoris BREZILLON #define MEDIA_BUS_FMT_Y8_1X8			0x2001
77edcf58bcSBoris BREZILLON #define MEDIA_BUS_FMT_UV8_1X8			0x2015
78edcf58bcSBoris BREZILLON #define MEDIA_BUS_FMT_UYVY8_1_5X8		0x2002
79edcf58bcSBoris BREZILLON #define MEDIA_BUS_FMT_VYUY8_1_5X8		0x2003
80edcf58bcSBoris BREZILLON #define MEDIA_BUS_FMT_YUYV8_1_5X8		0x2004
81edcf58bcSBoris BREZILLON #define MEDIA_BUS_FMT_YVYU8_1_5X8		0x2005
82edcf58bcSBoris BREZILLON #define MEDIA_BUS_FMT_UYVY8_2X8			0x2006
83edcf58bcSBoris BREZILLON #define MEDIA_BUS_FMT_VYUY8_2X8			0x2007
84edcf58bcSBoris BREZILLON #define MEDIA_BUS_FMT_YUYV8_2X8			0x2008
85edcf58bcSBoris BREZILLON #define MEDIA_BUS_FMT_YVYU8_2X8			0x2009
86edcf58bcSBoris BREZILLON #define MEDIA_BUS_FMT_Y10_1X10			0x200a
87451af0bfSTodor Tomov #define MEDIA_BUS_FMT_Y10_2X8_PADHI_LE		0x202c
88edcf58bcSBoris BREZILLON #define MEDIA_BUS_FMT_UYVY10_2X10		0x2018
89edcf58bcSBoris BREZILLON #define MEDIA_BUS_FMT_VYUY10_2X10		0x2019
90edcf58bcSBoris BREZILLON #define MEDIA_BUS_FMT_YUYV10_2X10		0x200b
91edcf58bcSBoris BREZILLON #define MEDIA_BUS_FMT_YVYU10_2X10		0x200c
92edcf58bcSBoris BREZILLON #define MEDIA_BUS_FMT_Y12_1X12			0x2013
93e8b2d7a5SHyun Kwon #define MEDIA_BUS_FMT_UYVY12_2X12		0x201c
94e8b2d7a5SHyun Kwon #define MEDIA_BUS_FMT_VYUY12_2X12		0x201d
95e8b2d7a5SHyun Kwon #define MEDIA_BUS_FMT_YUYV12_2X12		0x201e
96e8b2d7a5SHyun Kwon #define MEDIA_BUS_FMT_YVYU12_2X12		0x201f
97573a7508SDaniel Glöckner #define MEDIA_BUS_FMT_Y14_1X14			0x202d
98edcf58bcSBoris BREZILLON #define MEDIA_BUS_FMT_Y16_1X16			0x202e
99edcf58bcSBoris BREZILLON #define MEDIA_BUS_FMT_UYVY8_1X16		0x200f
100edcf58bcSBoris BREZILLON #define MEDIA_BUS_FMT_VYUY8_1X16		0x2010
101edcf58bcSBoris BREZILLON #define MEDIA_BUS_FMT_YUYV8_1X16		0x2011
102edcf58bcSBoris BREZILLON #define MEDIA_BUS_FMT_YVYU8_1X16		0x2012
103edcf58bcSBoris BREZILLON #define MEDIA_BUS_FMT_YDYUYDYV8_1X16		0x2014
104edcf58bcSBoris BREZILLON #define MEDIA_BUS_FMT_UYVY10_1X20		0x201a
105edcf58bcSBoris BREZILLON #define MEDIA_BUS_FMT_VYUY10_1X20		0x201b
106edcf58bcSBoris BREZILLON #define MEDIA_BUS_FMT_YUYV10_1X20		0x200d
1072dca0551SHyun Kwon #define MEDIA_BUS_FMT_YVYU10_1X20		0x200e
108cec32a47SPhilipp Zabel #define MEDIA_BUS_FMT_VUY8_1X24			0x2024
109d0353118SNeil Armstrong #define MEDIA_BUS_FMT_YUV8_1X24			0x2025
110edcf58bcSBoris BREZILLON #define MEDIA_BUS_FMT_UYYVYY8_0_5X24		0x2026
111edcf58bcSBoris BREZILLON #define MEDIA_BUS_FMT_UYVY12_1X24		0x2020
112edcf58bcSBoris BREZILLON #define MEDIA_BUS_FMT_VYUY12_1X24		0x2021
113edcf58bcSBoris BREZILLON #define MEDIA_BUS_FMT_YUYV12_1X24		0x2022
114e8b2d7a5SHyun Kwon #define MEDIA_BUS_FMT_YVYU12_1X24		0x2023
115d0353118SNeil Armstrong #define MEDIA_BUS_FMT_YUV10_1X30		0x2016
116e8b2d7a5SHyun Kwon #define MEDIA_BUS_FMT_UYYVYY10_0_5X30		0x2027
117d0353118SNeil Armstrong #define MEDIA_BUS_FMT_AYUV8_1X32		0x2017
118d0353118SNeil Armstrong #define MEDIA_BUS_FMT_UYYVYY12_0_5X36		0x2028
119d0353118SNeil Armstrong #define MEDIA_BUS_FMT_YUV12_1X36		0x2029
120d0353118SNeil Armstrong #define MEDIA_BUS_FMT_YUV16_1X48		0x202a
121edcf58bcSBoris BREZILLON #define MEDIA_BUS_FMT_UYYVYY16_0_5X48		0x202b
12282dec0a7SSakari Ailus 
123edcf58bcSBoris BREZILLON /* Bayer - next is	0x3021 */
124edcf58bcSBoris BREZILLON #define MEDIA_BUS_FMT_SBGGR8_1X8		0x3001
125edcf58bcSBoris BREZILLON #define MEDIA_BUS_FMT_SGBRG8_1X8		0x3013
126edcf58bcSBoris BREZILLON #define MEDIA_BUS_FMT_SGRBG8_1X8		0x3002
127edcf58bcSBoris BREZILLON #define MEDIA_BUS_FMT_SRGGB8_1X8		0x3014
128edcf58bcSBoris BREZILLON #define MEDIA_BUS_FMT_SBGGR10_ALAW8_1X8		0x3015
129edcf58bcSBoris BREZILLON #define MEDIA_BUS_FMT_SGBRG10_ALAW8_1X8		0x3016
130edcf58bcSBoris BREZILLON #define MEDIA_BUS_FMT_SGRBG10_ALAW8_1X8		0x3017
131edcf58bcSBoris BREZILLON #define MEDIA_BUS_FMT_SRGGB10_ALAW8_1X8		0x3018
132edcf58bcSBoris BREZILLON #define MEDIA_BUS_FMT_SBGGR10_DPCM8_1X8		0x300b
133edcf58bcSBoris BREZILLON #define MEDIA_BUS_FMT_SGBRG10_DPCM8_1X8		0x300c
134edcf58bcSBoris BREZILLON #define MEDIA_BUS_FMT_SGRBG10_DPCM8_1X8		0x3009
135edcf58bcSBoris BREZILLON #define MEDIA_BUS_FMT_SRGGB10_DPCM8_1X8		0x300d
136edcf58bcSBoris BREZILLON #define MEDIA_BUS_FMT_SBGGR10_2X8_PADHI_BE	0x3003
137edcf58bcSBoris BREZILLON #define MEDIA_BUS_FMT_SBGGR10_2X8_PADHI_LE	0x3004
138edcf58bcSBoris BREZILLON #define MEDIA_BUS_FMT_SBGGR10_2X8_PADLO_BE	0x3005
139edcf58bcSBoris BREZILLON #define MEDIA_BUS_FMT_SBGGR10_2X8_PADLO_LE	0x3006
140edcf58bcSBoris BREZILLON #define MEDIA_BUS_FMT_SBGGR10_1X10		0x3007
141edcf58bcSBoris BREZILLON #define MEDIA_BUS_FMT_SGBRG10_1X10		0x300e
142edcf58bcSBoris BREZILLON #define MEDIA_BUS_FMT_SGRBG10_1X10		0x300a
143edcf58bcSBoris BREZILLON #define MEDIA_BUS_FMT_SRGGB10_1X10		0x300f
144edcf58bcSBoris BREZILLON #define MEDIA_BUS_FMT_SBGGR12_1X12		0x3008
145edcf58bcSBoris BREZILLON #define MEDIA_BUS_FMT_SGBRG12_1X12		0x3010
146edcf58bcSBoris BREZILLON #define MEDIA_BUS_FMT_SGRBG12_1X12		0x3011
147cfe41359SJouni Ukkonen #define MEDIA_BUS_FMT_SRGGB12_1X12		0x3012
148cfe41359SJouni Ukkonen #define MEDIA_BUS_FMT_SBGGR14_1X14		0x3019
149cfe41359SJouni Ukkonen #define MEDIA_BUS_FMT_SGBRG14_1X14		0x301a
150cfe41359SJouni Ukkonen #define MEDIA_BUS_FMT_SGRBG14_1X14		0x301b
15182dec0a7SSakari Ailus #define MEDIA_BUS_FMT_SRGGB14_1X14		0x301c
15282dec0a7SSakari Ailus #define MEDIA_BUS_FMT_SBGGR16_1X16		0x301d
15382dec0a7SSakari Ailus #define MEDIA_BUS_FMT_SGBRG16_1X16		0x301e
15482dec0a7SSakari Ailus #define MEDIA_BUS_FMT_SGRBG16_1X16		0x301f
155edcf58bcSBoris BREZILLON #define MEDIA_BUS_FMT_SRGGB16_1X16		0x3020
156edcf58bcSBoris BREZILLON 
157edcf58bcSBoris BREZILLON /* JPEG compressed formats - next is	0x4002 */
158edcf58bcSBoris BREZILLON #define MEDIA_BUS_FMT_JPEG_1X8			0x4001
159edcf58bcSBoris BREZILLON 
160edcf58bcSBoris BREZILLON /* Vendor specific formats - next is	0x5002 */
161edcf58bcSBoris BREZILLON 
162edcf58bcSBoris BREZILLON /* S5C73M3 sensor specific interleaved UYVY and JPEG */
163edcf58bcSBoris BREZILLON #define MEDIA_BUS_FMT_S5C_UYVY_JPEG_1X8		0x5001
164edcf58bcSBoris BREZILLON 
165edcf58bcSBoris BREZILLON /* HSV - next is	0x6002 */
166edcf58bcSBoris BREZILLON #define MEDIA_BUS_FMT_AHSV8888_1X32		0x6001
1676ad253ccSDafna Hirschfeld 
1686ad253ccSDafna Hirschfeld /*
1696ad253ccSDafna Hirschfeld  * This format should be used when the same driver handles
1706ad253ccSDafna Hirschfeld  * both sides of the link and the bus format is a fixed
1716ad253ccSDafna Hirschfeld  * metadata format that is not configurable from userspace.
1726ad253ccSDafna Hirschfeld  * Width and height will be set to 0 for this format.
1736ad253ccSDafna Hirschfeld  */
1746ad253ccSDafna Hirschfeld #define MEDIA_BUS_FMT_METADATA_FIXED		0x7001
175edcf58bcSBoris BREZILLON 
176 #endif /* __LINUX_MEDIA_BUS_FORMAT_H */
177