diff --git a/contrib/freebsd/include/linux/videodev2.h b/contrib/freebsd/include/linux/videodev2.h
index 4815944b0b8c70217d8fb88eb9d34c362917827f..74c2e9c234b30fa05f90c9876e606d27ddf6d02c 100644
--- a/contrib/freebsd/include/linux/videodev2.h
+++ b/contrib/freebsd/include/linux/videodev2.h
@@ -606,6 +606,8 @@ struct v4l2_pix_format {
 #define V4L2_PIX_FMT_Y10BPACK    v4l2_fourcc('Y', '1', '0', 'B') /* 10  Greyscale bit-packed */
 #define V4L2_PIX_FMT_Y10P    v4l2_fourcc('Y', '1', '0', 'P') /* 10  Greyscale, MIPI RAW10 packed */
 #define V4L2_PIX_FMT_IPU3_Y10		v4l2_fourcc('i', 'p', '3', 'y') /* IPU3 packed 10-bit greyscale */
+#define V4L2_PIX_FMT_Y12P    v4l2_fourcc('Y', '1', '2', 'P') /* 12  Greyscale, MIPI RAW12 packed */
+#define V4L2_PIX_FMT_Y14P    v4l2_fourcc('Y', '1', '4', 'P') /* 14  Greyscale, MIPI RAW14 packed */
 
 /* Palette formats */
 #define V4L2_PIX_FMT_PAL8    v4l2_fourcc('P', 'A', 'L', '8') /*  8  8-bit palette */
@@ -846,6 +848,7 @@ struct v4l2_pix_format {
 #define V4L2_META_FMT_RK_ISP1_PARAMS	v4l2_fourcc('R', 'K', '1', 'P') /* Rockchip ISP1 3A Parameters */
 #define V4L2_META_FMT_RK_ISP1_STAT_3A	v4l2_fourcc('R', 'K', '1', 'S') /* Rockchip ISP1 3A Statistics */
 
+
 /* priv field value to indicates that subsequent fields are valid. */
 #define V4L2_PIX_FMT_PRIV_MAGIC		0xfeedcafe
 
@@ -876,6 +879,7 @@ struct v4l2_fmtdesc {
 #define V4L2_FMT_FLAG_CSC_YCBCR_ENC		0x0080
 #define V4L2_FMT_FLAG_CSC_HSV_ENC		V4L2_FMT_FLAG_CSC_YCBCR_ENC
 #define V4L2_FMT_FLAG_CSC_QUANTIZATION		0x0100
+#define V4L2_FMT_FLAG_META_LINE_BASED		0x0200
 
 	/* Frame Size and frame rate enumeration */
 /*
@@ -1824,7 +1828,7 @@ struct v4l2_ext_control {
 		struct v4l2_ctrl_hdr10_cll_info *p_hdr10_cll_info;
 		struct v4l2_ctrl_hdr10_mastering_display *p_hdr10_mastering_display;
 		void *ptr;
-	};
+	} __attribute__ ((packed));
 } __attribute__ ((packed));
 
 struct v4l2_ext_controls {
@@ -2394,10 +2398,19 @@ struct v4l2_sdr_format {
  * struct v4l2_meta_format - metadata format definition
  * @dataformat:		little endian four character code (fourcc)
  * @buffersize:		maximum size in bytes required for data
+ * @width:		number of data units of data per line (valid for line
+ *			based formats only, see format documentation)
+ * @height:		number of lines of data per buffer (valid for line based
+ *			formats only)
+ * @bytesperline:	offset between the beginnings of two adjacent lines in
+ *			bytes (valid for line based formats only)
  */
 struct v4l2_meta_format {
 	uint32_t				dataformat;
 	uint32_t				buffersize;
+	uint32_t				width;
+	uint32_t				height;
+	uint32_t				bytesperline;
 } __attribute__ ((packed));
 
 /**
diff --git a/contrib/test/ioctl_32.h b/contrib/test/ioctl_32.h
index 97f58676fce1b683fb448a928165572805c8bb8a..42997b76cf8dcb58d6187d7ac83fe4b146d668a8 100644
--- a/contrib/test/ioctl_32.h
+++ b/contrib/test/ioctl_32.h
@@ -103,7 +103,7 @@
 #define CMD32_VIDIOC_SUBDEV_G_EDID 0xc0245628
 #define CMD32_VIDIOC_SUBDEV_G_FMT 0xc0585604
 #define CMD32_VIDIOC_SUBDEV_G_FRAME_INTERVAL 0xc0305615
-#define CMD32_VIDIOC_SUBDEV_G_ROUTING 0xc0285626
+#define CMD32_VIDIOC_SUBDEV_G_ROUTING 0xc0405626
 #define CMD32_VIDIOC_SUBDEV_G_SELECTION 0xc040563d
 #define CMD32_VIDIOC_SUBDEV_G_STD 0x80085617
 #define CMD32_VIDIOC_SUBDEV_QUERYCAP 0x80405600
@@ -115,7 +115,7 @@
 #define CMD32_VIDIOC_SUBDEV_S_EDID 0xc0245629
 #define CMD32_VIDIOC_SUBDEV_S_FMT 0xc0585605
 #define CMD32_VIDIOC_SUBDEV_S_FRAME_INTERVAL 0xc0305616
-#define CMD32_VIDIOC_SUBDEV_S_ROUTING 0xc0285627
+#define CMD32_VIDIOC_SUBDEV_S_ROUTING 0xc0405627
 #define CMD32_VIDIOC_SUBDEV_S_SELECTION 0xc040563e
 #define CMD32_VIDIOC_SUBDEV_S_STD 0x40085618
 #define CMD32_VIDIOC_SUBSCRIBE_EVENT 0x4020565a
diff --git a/contrib/test/ioctl_64.h b/contrib/test/ioctl_64.h
index 2bad335dab603aa9909028d1a7492c30bcac72c6..8539622cf329bc559ed085cd149e9ee2e8da69f5 100644
--- a/contrib/test/ioctl_64.h
+++ b/contrib/test/ioctl_64.h
@@ -103,7 +103,7 @@
 #define CMD64_VIDIOC_SUBDEV_G_EDID 0xc0285628
 #define CMD64_VIDIOC_SUBDEV_G_FMT 0xc0585604
 #define CMD64_VIDIOC_SUBDEV_G_FRAME_INTERVAL 0xc0305615
-#define CMD64_VIDIOC_SUBDEV_G_ROUTING 0xc0285626
+#define CMD64_VIDIOC_SUBDEV_G_ROUTING 0xc0405626
 #define CMD64_VIDIOC_SUBDEV_G_SELECTION 0xc040563d
 #define CMD64_VIDIOC_SUBDEV_G_STD 0x80085617
 #define CMD64_VIDIOC_SUBDEV_QUERYCAP 0x80405600
@@ -115,7 +115,7 @@
 #define CMD64_VIDIOC_SUBDEV_S_EDID 0xc0285629
 #define CMD64_VIDIOC_SUBDEV_S_FMT 0xc0585605
 #define CMD64_VIDIOC_SUBDEV_S_FRAME_INTERVAL 0xc0305616
-#define CMD64_VIDIOC_SUBDEV_S_ROUTING 0xc0285627
+#define CMD64_VIDIOC_SUBDEV_S_ROUTING 0xc0405627
 #define CMD64_VIDIOC_SUBDEV_S_SELECTION 0xc040563e
 #define CMD64_VIDIOC_SUBDEV_S_STD 0x40085618
 #define CMD64_VIDIOC_SUBSCRIBE_EVENT 0x4020565a
diff --git a/include/linux/dvb/frontend.h b/include/linux/dvb/frontend.h
index 392171a7d65106d87b47c20261807d3a6f696e51..844762889343b810d4c1761e512e8563c9c6d0f6 100644
--- a/include/linux/dvb/frontend.h
+++ b/include/linux/dvb/frontend.h
@@ -854,7 +854,7 @@ struct dtv_stats {
 	union {
 		__u64 uvalue;	/* for counters and relative scales */
 		__s64 svalue;	/* for 0.001 dB measures */
-	};
+	}  __attribute__ ((packed));
 } __attribute__ ((packed));
 
 
diff --git a/include/linux/media-bus-format.h b/include/linux/media-bus-format.h
index f05f747e444d668600397651bd66105f6ed08718..d4c1d991014b396f976fee646bfc51f6f864792d 100644
--- a/include/linux/media-bus-format.h
+++ b/include/linux/media-bus-format.h
@@ -174,4 +174,13 @@
  */
 #define MEDIA_BUS_FMT_METADATA_FIXED		0x7001
 
+/* Generic line based metadata formats for serial buses. Next is 0x8008. */
+#define MEDIA_BUS_FMT_META_8			0x8001
+#define MEDIA_BUS_FMT_META_10			0x8002
+#define MEDIA_BUS_FMT_META_12			0x8003
+#define MEDIA_BUS_FMT_META_14			0x8004
+#define MEDIA_BUS_FMT_META_16			0x8005
+#define MEDIA_BUS_FMT_META_20			0x8006
+#define MEDIA_BUS_FMT_META_24			0x8007
+
 #endif /* __LINUX_MEDIA_BUS_FORMAT_H */
diff --git a/include/linux/v4l2-mediabus.h b/include/linux/v4l2-mediabus.h
index 2c318de10485867b8c958a42a59e3e11473cf0a8..097ef73924f857f7ad6813ee07627833fc7b4dfc 100644
--- a/include/linux/v4l2-mediabus.h
+++ b/include/linux/v4l2-mediabus.h
@@ -19,12 +19,18 @@
  * @width:	image width
  * @height:	image height
  * @code:	data format code (from enum v4l2_mbus_pixelcode)
- * @field:	used interlacing type (from enum v4l2_field)
- * @colorspace:	colorspace of the data (from enum v4l2_colorspace)
- * @ycbcr_enc:	YCbCr encoding of the data (from enum v4l2_ycbcr_encoding)
- * @hsv_enc:	HSV encoding of the data (from enum v4l2_hsv_encoding)
- * @quantization: quantization of the data (from enum v4l2_quantization)
- * @xfer_func:  transfer function of the data (from enum v4l2_xfer_func)
+ * @field:	used interlacing type (from enum v4l2_field), zero for metadata
+ *		mbus codes
+ * @colorspace:	colorspace of the data (from enum v4l2_colorspace), zero on
+ *		metadata mbus codes
+ * @ycbcr_enc:	YCbCr encoding of the data (from enum v4l2_ycbcr_encoding), zero
+ *		for metadata mbus codes
+ * @hsv_enc:	HSV encoding of the data (from enum v4l2_hsv_encoding), zero for
+ *		metadata mbus codes
+ * @quantization: quantization of the data (from enum v4l2_quantization), zero
+ *		for metadata mbus codes
+ * @xfer_func:  transfer function of the data (from enum v4l2_xfer_func), zero
+ *		for metadata mbus codes
  * @flags:	flags (V4L2_MBUS_FRAMEFMT_*)
  * @reserved:  reserved bytes that can be later used
  */
diff --git a/include/linux/v4l2-subdev.h b/include/linux/v4l2-subdev.h
index 7048c51581c6ec61be49d1e20d783b3174a48c14..2347e266cf7516b4073c1edd43b97a3ddddb183b 100644
--- a/include/linux/v4l2-subdev.h
+++ b/include/linux/v4l2-subdev.h
@@ -50,6 +50,10 @@ struct v4l2_subdev_format {
  * @rect: pad crop rectangle boundaries
  * @stream: stream number, defined in subdev routing
  * @reserved: drivers and applications must zero this array
+ *
+ * The subdev crop API is an obsolete interface and may be removed in the
+ * future. It is superseded by the selection API. No new extensions to this
+ * structure will be accepted.
  */
 struct v4l2_subdev_crop {
 	__u32 which;
@@ -224,15 +228,19 @@ struct v4l2_subdev_route {
  * struct v4l2_subdev_routing - Subdev routing information
  *
  * @which: configuration type (from enum v4l2_subdev_format_whence)
- * @num_routes: the total number of routes in the routes array
+ * @len_routes: the length of the routes array, in routes; set by the user, not
+ *		modified by the kernel
  * @routes: pointer to the routes array
+ * @num_routes: the total number of routes, possibly more than fits in the
+ *		routes array
  * @reserved: drivers and applications must zero this array
  */
 struct v4l2_subdev_routing {
 	__u32 which;
-	__u32 num_routes;
+	__u32 len_routes;
 	__u64 routes;
-	__u32 reserved[6];
+	__u32 num_routes;
+	__u32 reserved[11];
 };
 
 /*
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h
index b21e7f2c67cdfdc35b55250999fe38d7b925204f..e1c61b855338799694225e1cc0fda98b2f84a6b3 100644
--- a/include/linux/videodev2.h
+++ b/include/linux/videodev2.h
@@ -572,6 +572,8 @@ struct v4l2_pix_format {
 #define V4L2_PIX_FMT_Y10BPACK    v4l2_fourcc('Y', '1', '0', 'B') /* 10  Greyscale bit-packed */
 #define V4L2_PIX_FMT_Y10P    v4l2_fourcc('Y', '1', '0', 'P') /* 10  Greyscale, MIPI RAW10 packed */
 #define V4L2_PIX_FMT_IPU3_Y10		v4l2_fourcc('i', 'p', '3', 'y') /* IPU3 packed 10-bit greyscale */
+#define V4L2_PIX_FMT_Y12P    v4l2_fourcc('Y', '1', '2', 'P') /* 12  Greyscale, MIPI RAW12 packed */
+#define V4L2_PIX_FMT_Y14P    v4l2_fourcc('Y', '1', '4', 'P') /* 14  Greyscale, MIPI RAW14 packed */
 
 /* Palette formats */
 #define V4L2_PIX_FMT_PAL8    v4l2_fourcc('P', 'A', 'L', '8') /*  8  8-bit palette */
@@ -812,6 +814,7 @@ struct v4l2_pix_format {
 #define V4L2_META_FMT_RK_ISP1_PARAMS	v4l2_fourcc('R', 'K', '1', 'P') /* Rockchip ISP1 3A Parameters */
 #define V4L2_META_FMT_RK_ISP1_STAT_3A	v4l2_fourcc('R', 'K', '1', 'S') /* Rockchip ISP1 3A Statistics */
 
+
 /* priv field value to indicates that subsequent fields are valid. */
 #define V4L2_PIX_FMT_PRIV_MAGIC		0xfeedcafe
 
@@ -842,6 +845,7 @@ struct v4l2_fmtdesc {
 #define V4L2_FMT_FLAG_CSC_YCBCR_ENC		0x0080
 #define V4L2_FMT_FLAG_CSC_HSV_ENC		V4L2_FMT_FLAG_CSC_YCBCR_ENC
 #define V4L2_FMT_FLAG_CSC_QUANTIZATION		0x0100
+#define V4L2_FMT_FLAG_META_LINE_BASED		0x0200
 
 	/* Frame Size and frame rate enumeration */
 /*
@@ -1790,7 +1794,7 @@ struct v4l2_ext_control {
 		struct v4l2_ctrl_hdr10_cll_info *p_hdr10_cll_info;
 		struct v4l2_ctrl_hdr10_mastering_display *p_hdr10_mastering_display;
 		void *ptr;
-	};
+	} __attribute__ ((packed));
 } __attribute__ ((packed));
 
 struct v4l2_ext_controls {
@@ -2360,10 +2364,19 @@ struct v4l2_sdr_format {
  * struct v4l2_meta_format - metadata format definition
  * @dataformat:		little endian four character code (fourcc)
  * @buffersize:		maximum size in bytes required for data
+ * @width:		number of data units of data per line (valid for line
+ *			based formats only, see format documentation)
+ * @height:		number of lines of data per buffer (valid for line based
+ *			formats only)
+ * @bytesperline:	offset between the beginnings of two adjacent lines in
+ *			bytes (valid for line based formats only)
  */
 struct v4l2_meta_format {
 	__u32				dataformat;
 	__u32				buffersize;
+	__u32				width;
+	__u32				height;
+	__u32				bytesperline;
 } __attribute__ ((packed));
 
 /**
diff --git a/lib/include/libdvbv5/dvb-frontend.h b/lib/include/libdvbv5/dvb-frontend.h
index 392171a7d65106d87b47c20261807d3a6f696e51..844762889343b810d4c1761e512e8563c9c6d0f6 100644
--- a/lib/include/libdvbv5/dvb-frontend.h
+++ b/lib/include/libdvbv5/dvb-frontend.h
@@ -854,7 +854,7 @@ struct dtv_stats {
 	union {
 		__u64 uvalue;	/* for counters and relative scales */
 		__s64 svalue;	/* for 0.001 dB measures */
-	};
+	}  __attribute__ ((packed));
 } __attribute__ ((packed));
 
 
diff --git a/utils/common/v4l2-pix-formats.h b/utils/common/v4l2-pix-formats.h
index e8d2e441fdfc14c3914ab5622dafa4d9369a3e1c..8356cbf40089bc6017b7ce04f841afc01bddb135 100644
--- a/utils/common/v4l2-pix-formats.h
+++ b/utils/common/v4l2-pix-formats.h
@@ -52,6 +52,8 @@
 	case V4L2_PIX_FMT_Y10BPACK: return "10-bit Greyscale (Packed)";
 	case V4L2_PIX_FMT_Y10P: return "10-bit Greyscale (MIPI Packed)";
 	case V4L2_PIX_FMT_IPU3_Y10: return "10-bit greyscale (IPU3 Packed)";
+	case V4L2_PIX_FMT_Y12P: return "12-bit Greyscale (MIPI Packed)";
+	case V4L2_PIX_FMT_Y14P: return "14-bit Greyscale (MIPI Packed)";
 	case V4L2_PIX_FMT_Y8I: return "Interleaved 8-bit Greyscale";
 	case V4L2_PIX_FMT_Y12I: return "Interleaved 12-bit Greyscale";
 	case V4L2_PIX_FMT_Z16: return "16-bit Depth";
diff --git a/utils/v4l2-tracer/retrace-gen.cpp b/utils/v4l2-tracer/retrace-gen.cpp
index 08ed96164c28f94d8e945e2449a46afbac526960..52323a0b0d4de70570015447ce6f8422b24c74ce 100644
--- a/utils/v4l2-tracer/retrace-gen.cpp
+++ b/utils/v4l2-tracer/retrace-gen.cpp
@@ -4101,7 +4101,7 @@ struct v4l2_ext_control *retrace_v4l2_ext_control_gen(json_object *parent_obj, s
 	//struct v4l2_ctrl_hdr10_cll_info *p_hdr10_cll_info;
 	//struct v4l2_ctrl_hdr10_mastering_display *p_hdr10_mastering_display;
 	//void *ptr;
-	//end of union 	};
+	//end of union 	} __attribute__ ((packed));
 	return p;
 }
 struct v4l2_ext_controls *retrace_v4l2_ext_controls_gen(json_object *parent_obj, std::string key_name = "")
@@ -4930,6 +4930,18 @@ struct v4l2_meta_format *retrace_v4l2_meta_format_gen(json_object *parent_obj, s
 	if (json_object_object_get_ex(v4l2_meta_format_obj, "buffersize", &buffersize_obj))
 		p->buffersize = (__u32) json_object_get_int64(buffersize_obj);
 
+	json_object *width_obj;
+	if (json_object_object_get_ex(v4l2_meta_format_obj, "width", &width_obj))
+		p->width = (__u32) json_object_get_int64(width_obj);
+
+	json_object *height_obj;
+	if (json_object_object_get_ex(v4l2_meta_format_obj, "height", &height_obj))
+		p->height = (__u32) json_object_get_int64(height_obj);
+
+	json_object *bytesperline_obj;
+	if (json_object_object_get_ex(v4l2_meta_format_obj, "bytesperline", &bytesperline_obj))
+		p->bytesperline = (__u32) json_object_get_int64(bytesperline_obj);
+
 	return p;
 }
 struct v4l2_format *retrace_v4l2_format_gen(json_object *parent_obj, std::string key_name = "")
diff --git a/utils/v4l2-tracer/trace-gen.cpp b/utils/v4l2-tracer/trace-gen.cpp
index fd58d918290596ec25a16a56e7b147ea8c9cbadc..c1075e77107852fff52845fcc63f225a1be4142c 100644
--- a/utils/v4l2-tracer/trace-gen.cpp
+++ b/utils/v4l2-tracer/trace-gen.cpp
@@ -2245,7 +2245,7 @@ void trace_v4l2_ext_control_gen(void *arg, json_object *parent_obj, std::string
 	//struct v4l2_ctrl_hdr10_cll_info *p_hdr10_cll_info;
 	//struct v4l2_ctrl_hdr10_mastering_display *p_hdr10_mastering_display;
 	//void *ptr;
-	//end of union 	};
+	//end of union 	} __attribute__ ((packed));
 
 	if (key_name.empty())
 		json_object_object_add(parent_obj, "v4l2_ext_control", v4l2_ext_control_obj);
@@ -2736,6 +2736,9 @@ void trace_v4l2_meta_format_gen(void *arg, json_object *parent_obj, std::string
 
 	json_object_object_add(v4l2_meta_format_obj, "dataformat", json_object_new_int64(p->dataformat));
 	json_object_object_add(v4l2_meta_format_obj, "buffersize", json_object_new_int64(p->buffersize));
+	json_object_object_add(v4l2_meta_format_obj, "width", json_object_new_int64(p->width));
+	json_object_object_add(v4l2_meta_format_obj, "height", json_object_new_int64(p->height));
+	json_object_object_add(v4l2_meta_format_obj, "bytesperline", json_object_new_int64(p->bytesperline));
 
 	if (key_name.empty())
 		json_object_object_add(parent_obj, "v4l2_meta_format", v4l2_meta_format_obj);
diff --git a/utils/v4l2-tracer/v4l2-tracer-info-gen.h b/utils/v4l2-tracer/v4l2-tracer-info-gen.h
index 022c435c34cf17eaf88d55070166f729f7deffa7..1ed43074407e68a086db62d159b2d5771fe0b934 100644
--- a/utils/v4l2-tracer/v4l2-tracer-info-gen.h
+++ b/utils/v4l2-tracer/v4l2-tracer-info-gen.h
@@ -1288,6 +1288,8 @@ constexpr val_def v4l2_pix_fmt_val_def[] = {
 	{ V4L2_PIX_FMT_Y10BPACK,	"V4L2_PIX_FMT_Y10BPACK" },
 	{ V4L2_PIX_FMT_Y10P,	"V4L2_PIX_FMT_Y10P" },
 	{ V4L2_PIX_FMT_IPU3_Y10,	"V4L2_PIX_FMT_IPU3_Y10" },
+	{ V4L2_PIX_FMT_Y12P,	"V4L2_PIX_FMT_Y12P" },
+	{ V4L2_PIX_FMT_Y14P,	"V4L2_PIX_FMT_Y14P" },
 	{ V4L2_PIX_FMT_PAL8,	"V4L2_PIX_FMT_PAL8" },
 	{ V4L2_PIX_FMT_UV8,	"V4L2_PIX_FMT_UV8" },
 	{ V4L2_PIX_FMT_YUYV,	"V4L2_PIX_FMT_YUYV" },
@@ -1482,6 +1484,7 @@ constexpr flag_def v4l2_fmt_flag_def[] = {
 	{ V4L2_FMT_FLAG_CSC_YCBCR_ENC, "V4L2_FMT_FLAG_CSC_YCBCR_ENC" },
 	{ V4L2_FMT_FLAG_CSC_HSV_ENC, "V4L2_FMT_FLAG_CSC_HSV_ENC" },
 	{ V4L2_FMT_FLAG_CSC_QUANTIZATION, "V4L2_FMT_FLAG_CSC_QUANTIZATION" },
+	{ V4L2_FMT_FLAG_META_LINE_BASED, "V4L2_FMT_FLAG_META_LINE_BASED" },
 	{ 0, "" }
 };