diff options
-rw-r--r-- | drivers/media/video/soc_mediabus.c | 14 | ||||
-rw-r--r-- | include/media/soc_mediabus.h | 1 |
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 | ||
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) { |
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 { | |||
61 | const struct soc_mbus_pixelfmt *soc_mbus_get_fmtdesc( | 61 | const struct soc_mbus_pixelfmt *soc_mbus_get_fmtdesc( |
62 | enum v4l2_mbus_pixelcode code); | 62 | enum v4l2_mbus_pixelcode code); |
63 | s32 soc_mbus_bytes_per_line(u32 width, const struct soc_mbus_pixelfmt *mf); | 63 | s32 soc_mbus_bytes_per_line(u32 width, const struct soc_mbus_pixelfmt *mf); |
64 | int soc_mbus_samples_per_pixel(const struct soc_mbus_pixelfmt *mf); | ||
64 | 65 | ||
65 | #endif | 66 | #endif |