aboutsummaryrefslogtreecommitdiffstats
path: root/include/media/soc_mediabus.h
diff options
context:
space:
mode:
authorGuennadi Liakhovetski <g.liakhovetski@gmx.de>2009-12-11 09:41:28 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2009-12-16 06:27:27 -0500
commit9a74251d8bee7a25fee89a0be3ccea73e01c1a05 (patch)
tree5bffc0457e8fb4e39ac98e7d41423a1512aae498 /include/media/soc_mediabus.h
parentfaa582610d87edf3ae1d07710a8f7e11c105686c (diff)
V4L/DVB (13658): v4l: add a media-bus API for configuring v4l2 subdev pixel and frame formats
Video subdevices, like cameras, decoders, connect to video bridges over specialised busses. Data is being transferred over these busses in various formats, which only loosely correspond to fourcc codes, describing how video data is stored in RAM. This is not a one-to-one correspondence, therefore we cannot use fourcc codes to configure subdevice output data formats. This patch adds codes for several such on-the-bus formats and an API, similar to the familiar .s_fmt(), .g_fmt(), .try_fmt(), .enum_fmt() API for configuring those codes. After all users of the old API in struct v4l2_subdev_video_ops are converted, it will be removed. Also add helper routines to support generic pass-through mode for the soc-camera framework. create mode 100644 drivers/media/video/soc_mediabus.c create mode 100644 include/media/soc_mediabus.h create mode 100644 include/media/v4l2-mediabus.h Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de> Acked-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'include/media/soc_mediabus.h')
-rw-r--r--include/media/soc_mediabus.h65
1 files changed, 65 insertions, 0 deletions
diff --git a/include/media/soc_mediabus.h b/include/media/soc_mediabus.h
new file mode 100644
index 000000000000..037cd7be001e
--- /dev/null
+++ b/include/media/soc_mediabus.h
@@ -0,0 +1,65 @@
1/*
2 * SoC-camera Media Bus API extensions
3 *
4 * Copyright (C) 2009, Guennadi Liakhovetski <g.liakhovetski@gmx.de>
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
16#include <media/v4l2-mediabus.h>
17
18/**
19 * enum soc_mbus_packing - data packing types on the media-bus
20 * @SOC_MBUS_PACKING_NONE: no packing, bit-for-bit transfer to RAM
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 */
27enum soc_mbus_packing {
28 SOC_MBUS_PACKING_NONE,
29 SOC_MBUS_PACKING_2X8_PADHI,
30 SOC_MBUS_PACKING_2X8_PADLO,
31 SOC_MBUS_PACKING_EXTEND16,
32};
33
34/**
35 * enum soc_mbus_order - sample order on the media bus
36 * @SOC_MBUS_ORDER_LE: least significant sample first
37 * @SOC_MBUS_ORDER_BE: most significant sample first
38 */
39enum soc_mbus_order {
40 SOC_MBUS_ORDER_LE,
41 SOC_MBUS_ORDER_BE,
42};
43
44/**
45 * struct soc_mbus_pixelfmt - Data format on the media bus
46 * @name: Name of the format
47 * @fourcc: Fourcc code, that will be obtained if the data is
48 * stored in memory in the following way:
49 * @packing: Type of sample-packing, that has to be used
50 * @order: Sample order when storing in memory
51 * @bits_per_sample: How many bits the bridge has to sample
52 */
53struct soc_mbus_pixelfmt {
54 const char *name;
55 u32 fourcc;
56 enum soc_mbus_packing packing;
57 enum soc_mbus_order order;
58 u8 bits_per_sample;
59};
60
61const struct soc_mbus_pixelfmt *soc_mbus_get_fmtdesc(
62 enum v4l2_mbus_pixelcode code);
63s32 soc_mbus_bytes_per_line(u32 width, const struct soc_mbus_pixelfmt *mf);
64
65#endif