Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
awilliam
GitHub Repository: awilliam/linux-vfio
Path: blob/master/include/media/soc_mediabus.h
10814 views
1
/*
2
* SoC-camera Media Bus API extensions
3
*
4
* Copyright (C) 2009, Guennadi Liakhovetski <[email protected]>
5
*
6
* This program is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License version 2 as
8
* published by the Free Software Foundation.
9
*/
10
11
#ifndef SOC_MEDIABUS_H
12
#define SOC_MEDIABUS_H
13
14
#include <linux/videodev2.h>
15
#include <linux/v4l2-mediabus.h>
16
17
/**
18
* enum soc_mbus_packing - data packing types on the media-bus
19
* @SOC_MBUS_PACKING_NONE: no packing, bit-for-bit transfer to RAM, one
20
* sample represents one pixel
21
* @SOC_MBUS_PACKING_2X8_PADHI: 16 bits transferred in 2 8-bit samples, in the
22
* possibly incomplete byte high bits are padding
23
* @SOC_MBUS_PACKING_2X8_PADLO: as above, but low bits are padding
24
* @SOC_MBUS_PACKING_EXTEND16: sample width (e.g., 10 bits) has to be extended
25
* to 16 bits
26
* @SOC_MBUS_PACKING_VARIABLE: compressed formats with variable packing
27
* @SOC_MBUS_PACKING_1_5X8: used for packed YUV 4:2:0 formats, where 4
28
* pixels occupy 6 bytes in RAM
29
*/
30
enum soc_mbus_packing {
31
SOC_MBUS_PACKING_NONE,
32
SOC_MBUS_PACKING_2X8_PADHI,
33
SOC_MBUS_PACKING_2X8_PADLO,
34
SOC_MBUS_PACKING_EXTEND16,
35
SOC_MBUS_PACKING_VARIABLE,
36
SOC_MBUS_PACKING_1_5X8,
37
};
38
39
/**
40
* enum soc_mbus_order - sample order on the media bus
41
* @SOC_MBUS_ORDER_LE: least significant sample first
42
* @SOC_MBUS_ORDER_BE: most significant sample first
43
*/
44
enum soc_mbus_order {
45
SOC_MBUS_ORDER_LE,
46
SOC_MBUS_ORDER_BE,
47
};
48
49
/**
50
* struct soc_mbus_pixelfmt - Data format on the media bus
51
* @name: Name of the format
52
* @fourcc: Fourcc code, that will be obtained if the data is
53
* stored in memory in the following way:
54
* @packing: Type of sample-packing, that has to be used
55
* @order: Sample order when storing in memory
56
* @bits_per_sample: How many bits the bridge has to sample
57
*/
58
struct soc_mbus_pixelfmt {
59
const char *name;
60
u32 fourcc;
61
enum soc_mbus_packing packing;
62
enum soc_mbus_order order;
63
u8 bits_per_sample;
64
};
65
66
/**
67
* struct soc_mbus_lookup - Lookup FOURCC IDs by mediabus codes for pass-through
68
* @code: mediabus pixel-code
69
* @fmt: pixel format description
70
*/
71
struct soc_mbus_lookup {
72
enum v4l2_mbus_pixelcode code;
73
struct soc_mbus_pixelfmt fmt;
74
};
75
76
const struct soc_mbus_pixelfmt *soc_mbus_find_fmtdesc(
77
enum v4l2_mbus_pixelcode code,
78
const struct soc_mbus_lookup *lookup,
79
int n);
80
const struct soc_mbus_pixelfmt *soc_mbus_get_fmtdesc(
81
enum v4l2_mbus_pixelcode code);
82
s32 soc_mbus_bytes_per_line(u32 width, const struct soc_mbus_pixelfmt *mf);
83
int soc_mbus_samples_per_pixel(const struct soc_mbus_pixelfmt *mf,
84
unsigned int *numerator, unsigned int *denominator);
85
86
#endif
87
88