From 93f116d595e9aa7dca5f6507376d6995f217d420 Mon Sep 17 00:00:00 2001 From: Guennadi Liakhovetski Date: Fri, 13 May 2011 13:21:36 -0300 Subject: [media] V4L: soc-camera: avoid huge arrays, caused by changed format codes Recently mediabus pixel format codes have become a part of the user- space API, at which time their values also have been changed from contiguous numbers, running from 0 to sparse numbers with values around 0x1000, 0x2000, 0x3000... This made them unsuitable for the use as array indices. This patch switches soc-camera internal format look-ups to not depend on values of those macros. Signed-off-by: Guennadi Liakhovetski Signed-off-by: Mauro Carvalho Chehab --- include/media/soc_mediabus.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'include/media/soc_mediabus.h') diff --git a/include/media/soc_mediabus.h b/include/media/soc_mediabus.h index 3b5a70b97528..3eed98ed02f2 100644 --- a/include/media/soc_mediabus.h +++ b/include/media/soc_mediabus.h @@ -58,6 +58,20 @@ struct soc_mbus_pixelfmt { u8 bits_per_sample; }; +/** + * 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); 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); -- cgit v1.2.3