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>
2009-12-11 15:41:28 +01:00
|
|
|
/*
|
|
|
|
* SoC-camera Media Bus API extensions
|
|
|
|
*
|
|
|
|
* Copyright (C) 2009, Guennadi Liakhovetski <g.liakhovetski@gmx.de>
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License version 2 as
|
|
|
|
* published by the Free Software Foundation.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef SOC_MEDIABUS_H
|
|
|
|
#define SOC_MEDIABUS_H
|
|
|
|
|
|
|
|
#include <linux/videodev2.h>
|
2010-03-15 23:33:31 +01:00
|
|
|
#include <linux/v4l2-mediabus.h>
|
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>
2009-12-11 15:41:28 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* enum soc_mbus_packing - data packing types on the media-bus
|
2011-05-20 09:25:09 +02:00
|
|
|
* @SOC_MBUS_PACKING_NONE: no packing, bit-for-bit transfer to RAM, one
|
|
|
|
* sample represents one pixel
|
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>
2009-12-11 15:41:28 +01:00
|
|
|
* @SOC_MBUS_PACKING_2X8_PADHI: 16 bits transferred in 2 8-bit samples, in the
|
|
|
|
* possibly incomplete byte high bits are padding
|
|
|
|
* @SOC_MBUS_PACKING_2X8_PADLO: as above, but low bits are padding
|
|
|
|
* @SOC_MBUS_PACKING_EXTEND16: sample width (e.g., 10 bits) has to be extended
|
|
|
|
* to 16 bits
|
2011-05-20 09:25:09 +02:00
|
|
|
* @SOC_MBUS_PACKING_VARIABLE: compressed formats with variable packing
|
|
|
|
* @SOC_MBUS_PACKING_1_5X8: used for packed YUV 4:2:0 formats, where 4
|
|
|
|
* pixels occupy 6 bytes in RAM
|
2013-03-18 12:47:59 +01:00
|
|
|
* @SOC_MBUS_PACKING_EXTEND32: sample width (e.g., 24 bits) has to be extended
|
|
|
|
* to 32 bits
|
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>
2009-12-11 15:41:28 +01:00
|
|
|
*/
|
|
|
|
enum soc_mbus_packing {
|
|
|
|
SOC_MBUS_PACKING_NONE,
|
|
|
|
SOC_MBUS_PACKING_2X8_PADHI,
|
|
|
|
SOC_MBUS_PACKING_2X8_PADLO,
|
|
|
|
SOC_MBUS_PACKING_EXTEND16,
|
2011-05-20 09:08:39 +02:00
|
|
|
SOC_MBUS_PACKING_VARIABLE,
|
2011-05-20 09:25:09 +02:00
|
|
|
SOC_MBUS_PACKING_1_5X8,
|
2013-03-18 12:47:59 +01:00
|
|
|
SOC_MBUS_PACKING_EXTEND32,
|
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>
2009-12-11 15:41:28 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* enum soc_mbus_order - sample order on the media bus
|
|
|
|
* @SOC_MBUS_ORDER_LE: least significant sample first
|
|
|
|
* @SOC_MBUS_ORDER_BE: most significant sample first
|
|
|
|
*/
|
|
|
|
enum soc_mbus_order {
|
|
|
|
SOC_MBUS_ORDER_LE,
|
|
|
|
SOC_MBUS_ORDER_BE,
|
|
|
|
};
|
|
|
|
|
2012-03-21 12:03:23 +01:00
|
|
|
/**
|
|
|
|
* enum soc_mbus_layout - planes layout in memory
|
|
|
|
* @SOC_MBUS_LAYOUT_PACKED: color components packed
|
|
|
|
* @SOC_MBUS_LAYOUT_PLANAR_2Y_U_V: YUV components stored in 3 planes (4:2:2)
|
|
|
|
* @SOC_MBUS_LAYOUT_PLANAR_2Y_C: YUV components stored in a luma and a
|
|
|
|
* chroma plane (C plane is half the size
|
|
|
|
* of Y plane)
|
|
|
|
* @SOC_MBUS_LAYOUT_PLANAR_Y_C: YUV components stored in a luma and a
|
|
|
|
* chroma plane (C plane is the same size
|
|
|
|
* as Y plane)
|
|
|
|
*/
|
|
|
|
enum soc_mbus_layout {
|
|
|
|
SOC_MBUS_LAYOUT_PACKED = 0,
|
|
|
|
SOC_MBUS_LAYOUT_PLANAR_2Y_U_V,
|
|
|
|
SOC_MBUS_LAYOUT_PLANAR_2Y_C,
|
|
|
|
SOC_MBUS_LAYOUT_PLANAR_Y_C,
|
|
|
|
};
|
|
|
|
|
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>
2009-12-11 15:41:28 +01:00
|
|
|
/**
|
|
|
|
* struct soc_mbus_pixelfmt - Data format on the media bus
|
|
|
|
* @name: Name of the format
|
|
|
|
* @fourcc: Fourcc code, that will be obtained if the data is
|
|
|
|
* stored in memory in the following way:
|
|
|
|
* @packing: Type of sample-packing, that has to be used
|
|
|
|
* @order: Sample order when storing in memory
|
|
|
|
* @bits_per_sample: How many bits the bridge has to sample
|
|
|
|
*/
|
|
|
|
struct soc_mbus_pixelfmt {
|
|
|
|
const char *name;
|
|
|
|
u32 fourcc;
|
|
|
|
enum soc_mbus_packing packing;
|
|
|
|
enum soc_mbus_order order;
|
2012-03-21 12:03:23 +01:00
|
|
|
enum soc_mbus_layout layout;
|
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>
2009-12-11 15:41:28 +01:00
|
|
|
u8 bits_per_sample;
|
|
|
|
};
|
|
|
|
|
2011-05-13 18:21:36 +02:00
|
|
|
/**
|
|
|
|
* struct soc_mbus_lookup - Lookup FOURCC IDs by mediabus codes for pass-through
|
|
|
|
* @code: mediabus pixel-code
|
|
|
|
* @fmt: pixel format description
|
|
|
|
*/
|
|
|
|
struct soc_mbus_lookup {
|
|
|
|
enum v4l2_mbus_pixelcode code;
|
|
|
|
struct soc_mbus_pixelfmt fmt;
|
|
|
|
};
|
|
|
|
|
|
|
|
const struct soc_mbus_pixelfmt *soc_mbus_find_fmtdesc(
|
|
|
|
enum v4l2_mbus_pixelcode code,
|
|
|
|
const struct soc_mbus_lookup *lookup,
|
|
|
|
int n);
|
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>
2009-12-11 15:41:28 +01:00
|
|
|
const struct soc_mbus_pixelfmt *soc_mbus_get_fmtdesc(
|
|
|
|
enum v4l2_mbus_pixelcode code);
|
|
|
|
s32 soc_mbus_bytes_per_line(u32 width, const struct soc_mbus_pixelfmt *mf);
|
2012-03-21 12:03:25 +01:00
|
|
|
s32 soc_mbus_image_size(const struct soc_mbus_pixelfmt *mf,
|
|
|
|
u32 bytes_per_line, u32 height);
|
2011-05-20 09:25:09 +02:00
|
|
|
int soc_mbus_samples_per_pixel(const struct soc_mbus_pixelfmt *mf,
|
|
|
|
unsigned int *numerator, unsigned int *denominator);
|
2011-07-26 16:38:01 +02:00
|
|
|
unsigned int soc_mbus_config_compatible(const struct v4l2_mbus_config *cfg,
|
|
|
|
unsigned int flags);
|
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>
2009-12-11 15:41:28 +01:00
|
|
|
|
|
|
|
#endif
|