diff options
author | Alberto Panizzo <maramaopercheseimorto@gmail.com> | 2011-01-12 06:16:19 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2011-03-21 19:32:13 -0400 |
commit | 48a3c77338d725d4976fa792d822eb940ce5c296 (patch) | |
tree | 908ff25858dbed62cb546139463507d471b5e609 /drivers/media/video | |
parent | 7fdbd85bce033e2d0f74e5d326ab43906653cb81 (diff) |
[media] V4L: soc_mediabus: add a method to obtain the number of samples per pixel
Add a function to calculate the number of samples on the media-bus,
required to retrieve one pixel of a certain format.
Signed-off-by: Alberto Panizzo <maramaopercheseimorto@gmail.com>
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video')
-rw-r--r-- | drivers/media/video/soc_mediabus.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/drivers/media/video/soc_mediabus.c b/drivers/media/video/soc_mediabus.c index 91391214c682..73b4138709e4 100644 --- a/drivers/media/video/soc_mediabus.c +++ b/drivers/media/video/soc_mediabus.c | |||
@@ -132,6 +132,20 @@ static const struct soc_mbus_pixelfmt mbus_fmt[] = { | |||
132 | }, | 132 | }, |
133 | }; | 133 | }; |
134 | 134 | ||
135 | int soc_mbus_samples_per_pixel(const struct soc_mbus_pixelfmt *mf) | ||
136 | { | ||
137 | switch (mf->packing) { | ||
138 | case SOC_MBUS_PACKING_NONE: | ||
139 | case SOC_MBUS_PACKING_EXTEND16: | ||
140 | return 1; | ||
141 | case SOC_MBUS_PACKING_2X8_PADHI: | ||
142 | case SOC_MBUS_PACKING_2X8_PADLO: | ||
143 | return 2; | ||
144 | } | ||
145 | return -EINVAL; | ||
146 | } | ||
147 | EXPORT_SYMBOL(soc_mbus_samples_per_pixel); | ||
148 | |||
135 | s32 soc_mbus_bytes_per_line(u32 width, const struct soc_mbus_pixelfmt *mf) | 149 | s32 soc_mbus_bytes_per_line(u32 width, const struct soc_mbus_pixelfmt *mf) |
136 | { | 150 | { |
137 | switch (mf->packing) { | 151 | switch (mf->packing) { |