@@ -14,6 +14,28 @@
#include "adv748x.h"
+struct adv748x_csi2_format {
+ unsigned int code;
+ unsigned int datatype;
+};
+
+static const struct adv748x_csi2_format adv748x_csi2_formats[] = {
+ { .code = MEDIA_BUS_FMT_RGB888_1X24, .datatype = 0x24, },
+ { .code = MEDIA_BUS_FMT_UYVY8_1X16, .datatype = 0x1e, },
+ { .code = MEDIA_BUS_FMT_UYVY8_2X8, .datatype = 0x1e, },
+ { .code = MEDIA_BUS_FMT_YUYV10_2X10, .datatype = 0x1e, },
+};
+
+static unsigned int adv748x_csi2_code_to_datatype(unsigned int code)
+{
+ unsigned int i;
+
+ for (i = 0; i < ARRAY_SIZE(adv748x_csi2_formats); i++)
+ if (adv748x_csi2_formats[i].code == code)
+ return adv748x_csi2_formats[i].datatype;
+ return 0;
+}
+
static int adv748x_csi2_set_virtual_channel(struct adv748x_csi2 *tx,
unsigned int vc)
{