/*1* SoC-camera Media Bus API extensions2*3* Copyright (C) 2009, Guennadi Liakhovetski <[email protected]>4*5* This program is free software; you can redistribute it and/or modify6* it under the terms of the GNU General Public License version 2 as7* published by the Free Software Foundation.8*/910#ifndef SOC_MEDIABUS_H11#define SOC_MEDIABUS_H1213#include <linux/videodev2.h>14#include <linux/v4l2-mediabus.h>1516/**17* enum soc_mbus_packing - data packing types on the media-bus18* @SOC_MBUS_PACKING_NONE: no packing, bit-for-bit transfer to RAM, one19* sample represents one pixel20* @SOC_MBUS_PACKING_2X8_PADHI: 16 bits transferred in 2 8-bit samples, in the21* possibly incomplete byte high bits are padding22* @SOC_MBUS_PACKING_2X8_PADLO: as above, but low bits are padding23* @SOC_MBUS_PACKING_EXTEND16: sample width (e.g., 10 bits) has to be extended24* to 16 bits25* @SOC_MBUS_PACKING_VARIABLE: compressed formats with variable packing26* @SOC_MBUS_PACKING_1_5X8: used for packed YUV 4:2:0 formats, where 427* pixels occupy 6 bytes in RAM28*/29enum soc_mbus_packing {30SOC_MBUS_PACKING_NONE,31SOC_MBUS_PACKING_2X8_PADHI,32SOC_MBUS_PACKING_2X8_PADLO,33SOC_MBUS_PACKING_EXTEND16,34SOC_MBUS_PACKING_VARIABLE,35SOC_MBUS_PACKING_1_5X8,36};3738/**39* enum soc_mbus_order - sample order on the media bus40* @SOC_MBUS_ORDER_LE: least significant sample first41* @SOC_MBUS_ORDER_BE: most significant sample first42*/43enum soc_mbus_order {44SOC_MBUS_ORDER_LE,45SOC_MBUS_ORDER_BE,46};4748/**49* struct soc_mbus_pixelfmt - Data format on the media bus50* @name: Name of the format51* @fourcc: Fourcc code, that will be obtained if the data is52* stored in memory in the following way:53* @packing: Type of sample-packing, that has to be used54* @order: Sample order when storing in memory55* @bits_per_sample: How many bits the bridge has to sample56*/57struct soc_mbus_pixelfmt {58const char *name;59u32 fourcc;60enum soc_mbus_packing packing;61enum soc_mbus_order order;62u8 bits_per_sample;63};6465/**66* struct soc_mbus_lookup - Lookup FOURCC IDs by mediabus codes for pass-through67* @code: mediabus pixel-code68* @fmt: pixel format description69*/70struct soc_mbus_lookup {71enum v4l2_mbus_pixelcode code;72struct soc_mbus_pixelfmt fmt;73};7475const struct soc_mbus_pixelfmt *soc_mbus_find_fmtdesc(76enum v4l2_mbus_pixelcode code,77const struct soc_mbus_lookup *lookup,78int n);79const struct soc_mbus_pixelfmt *soc_mbus_get_fmtdesc(80enum v4l2_mbus_pixelcode code);81s32 soc_mbus_bytes_per_line(u32 width, const struct soc_mbus_pixelfmt *mf);82int soc_mbus_samples_per_pixel(const struct soc_mbus_pixelfmt *mf,83unsigned int *numerator, unsigned int *denominator);8485#endif868788