Merge remote-tracking branch 'driver-core/driver-core-next'
[linux-2.6/next.git] / include / media / soc_mediabus.h
blobfae432544b412d330bb9923eb40af7c50a5797d7
1 /*
2 * SoC-camera Media Bus API extensions
4 * Copyright (C) 2009, Guennadi Liakhovetski <g.liakhovetski@gmx.de>
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 */
11 #ifndef SOC_MEDIABUS_H
12 #define SOC_MEDIABUS_H
14 #include <linux/videodev2.h>
15 #include <linux/v4l2-mediabus.h>
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
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,
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
44 enum soc_mbus_order {
45 SOC_MBUS_ORDER_LE,
46 SOC_MBUS_ORDER_BE,
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
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;
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
71 struct soc_mbus_lookup {
72 enum v4l2_mbus_pixelcode code;
73 struct soc_mbus_pixelfmt fmt;
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);
86 #endif