gpu: ipu-v3: Add ipu_mbus_code_to_colorspace()
authorSteve Longerbeam <slongerbeam@gmail.com>
Thu, 26 Jun 2014 01:05:36 +0000 (18:05 -0700)
committerPhilipp Zabel <p.zabel@pengutronix.de>
Tue, 2 Sep 2014 12:55:45 +0000 (14:55 +0200)
Add ipu_mbus_code_to_colorspace() to find ipu_color_space from a
media bus pixel format code.

Signed-off-by: Steve Longerbeam <steve_longerbeam@mentor.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
drivers/gpu/ipu-v3/ipu-common.c
include/video/imx-ipu-v3.h

index f5a4e1ac2b501774072d250458e6aa0a17e89306..49ee990b4d1fbd97cec55ab8c85637f4cb94c78a 100644 (file)
@@ -101,6 +101,19 @@ enum ipu_color_space ipu_pixelformat_to_colorspace(u32 pixelformat)
 }
 EXPORT_SYMBOL_GPL(ipu_pixelformat_to_colorspace);
 
+enum ipu_color_space ipu_mbus_code_to_colorspace(u32 mbus_code)
+{
+       switch (mbus_code & 0xf000) {
+       case 0x1000:
+               return IPUV3_COLORSPACE_RGB;
+       case 0x2000:
+               return IPUV3_COLORSPACE_YUV;
+       default:
+               return IPUV3_COLORSPACE_UNKNOWN;
+       }
+}
+EXPORT_SYMBOL_GPL(ipu_mbus_code_to_colorspace);
+
 struct ipuv3_channel *ipu_idmac_get(struct ipu_soc *ipu, unsigned num)
 {
        struct ipuv3_channel *channel;
index 49e5954ac0333a13942f96f0b26518aa085602f5..7c97ccaf39f692cb63bb60bffcd66ea32c0ec5a4 100644 (file)
@@ -300,6 +300,7 @@ int ipu_smfc_set_watermark(struct ipu_smfc *smfc, u32 set_level, u32 clr_level);
 
 enum ipu_color_space ipu_drm_fourcc_to_colorspace(u32 drm_fourcc);
 enum ipu_color_space ipu_pixelformat_to_colorspace(u32 pixelformat);
+enum ipu_color_space ipu_mbus_code_to_colorspace(u32 mbus_code);
 
 struct ipu_client_platformdata {
        int csi;