aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/media/video/soc_mediabus.c14
-rw-r--r--include/media/soc_mediabus.h1
2 files changed, 15 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
135int 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}
147EXPORT_SYMBOL(soc_mbus_samples_per_pixel);
148
135s32 soc_mbus_bytes_per_line(u32 width, const struct soc_mbus_pixelfmt *mf) 149s32 soc_mbus_bytes_per_line(u32 width, const struct soc_mbus_pixelfmt *mf)
136{ 150{
137 switch (mf->packing) { 151 switch (mf->packing) {
diff --git a/include/media/soc_mediabus.h b/include/media/soc_mediabus.h
index 037cd7be001e..f5522b3f175a 100644
--- a/include/media/soc_mediabus.h
+++ b/include/media/soc_mediabus.h
@@ -61,5 +61,6 @@ struct soc_mbus_pixelfmt {
61const struct soc_mbus_pixelfmt *soc_mbus_get_fmtdesc( 61const struct soc_mbus_pixelfmt *soc_mbus_get_fmtdesc(
62 enum v4l2_mbus_pixelcode code); 62 enum v4l2_mbus_pixelcode code);
63s32 soc_mbus_bytes_per_line(u32 width, const struct soc_mbus_pixelfmt *mf); 63s32 soc_mbus_bytes_per_line(u32 width, const struct soc_mbus_pixelfmt *mf);
64int soc_mbus_samples_per_pixel(const struct soc_mbus_pixelfmt *mf);
64 65
65#endif 66#endif