Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

media: v4l2-mediabus: add support for dual edge sampling

Some devices support sampling of the parallel data at both edges of the
interface pixel clock in order to reduce the pixel clock by two.
Add a mediabus flag that represents this feature.

Signed-off-by: Michael Riesch <michael.riesch@wolfvision.net>
Reviewed-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>

authored by

Michael Riesch and committed by
Hans Verkuil
10694700 55f6f743

+28 -12
+19 -4
drivers/media/v4l2-core/v4l2-fwnode.c
··· 298 298 299 299 if (!fwnode_property_read_u32(fwnode, "pclk-sample", &v)) { 300 300 flags &= ~(V4L2_MBUS_PCLK_SAMPLE_RISING | 301 - V4L2_MBUS_PCLK_SAMPLE_FALLING); 302 - flags |= v ? V4L2_MBUS_PCLK_SAMPLE_RISING : 303 - V4L2_MBUS_PCLK_SAMPLE_FALLING; 304 - pr_debug("pclk-sample %s\n", v ? "high" : "low"); 301 + V4L2_MBUS_PCLK_SAMPLE_FALLING | 302 + V4L2_MBUS_PCLK_SAMPLE_DUALEDGE); 303 + switch (v) { 304 + case 0: 305 + flags |= V4L2_MBUS_PCLK_SAMPLE_FALLING; 306 + pr_debug("pclk-sample low\n"); 307 + break; 308 + case 1: 309 + flags |= V4L2_MBUS_PCLK_SAMPLE_RISING; 310 + pr_debug("pclk-sample high\n"); 311 + break; 312 + case 2: 313 + flags |= V4L2_MBUS_PCLK_SAMPLE_DUALEDGE; 314 + pr_debug("pclk-sample dual edge\n"); 315 + break; 316 + default: 317 + pr_warn("invalid argument for pclk-sample"); 318 + break; 319 + } 305 320 } 306 321 307 322 if (!fwnode_property_read_u32(fwnode, "data-active", &v)) {
+9 -8
include/media/v4l2-mediabus.h
··· 54 54 #define V4L2_MBUS_VSYNC_ACTIVE_LOW BIT(5) 55 55 #define V4L2_MBUS_PCLK_SAMPLE_RISING BIT(6) 56 56 #define V4L2_MBUS_PCLK_SAMPLE_FALLING BIT(7) 57 - #define V4L2_MBUS_DATA_ACTIVE_HIGH BIT(8) 58 - #define V4L2_MBUS_DATA_ACTIVE_LOW BIT(9) 57 + #define V4L2_MBUS_PCLK_SAMPLE_DUALEDGE BIT(8) 58 + #define V4L2_MBUS_DATA_ACTIVE_HIGH BIT(9) 59 + #define V4L2_MBUS_DATA_ACTIVE_LOW BIT(10) 59 60 /* FIELD = 0/1 - Field1 (odd)/Field2 (even) */ 60 - #define V4L2_MBUS_FIELD_EVEN_HIGH BIT(10) 61 + #define V4L2_MBUS_FIELD_EVEN_HIGH BIT(11) 61 62 /* FIELD = 1/0 - Field1 (odd)/Field2 (even) */ 62 - #define V4L2_MBUS_FIELD_EVEN_LOW BIT(11) 63 + #define V4L2_MBUS_FIELD_EVEN_LOW BIT(12) 63 64 /* Active state of Sync-on-green (SoG) signal, 0/1 for LOW/HIGH respectively. */ 64 - #define V4L2_MBUS_VIDEO_SOG_ACTIVE_HIGH BIT(12) 65 - #define V4L2_MBUS_VIDEO_SOG_ACTIVE_LOW BIT(13) 66 - #define V4L2_MBUS_DATA_ENABLE_HIGH BIT(14) 67 - #define V4L2_MBUS_DATA_ENABLE_LOW BIT(15) 65 + #define V4L2_MBUS_VIDEO_SOG_ACTIVE_HIGH BIT(13) 66 + #define V4L2_MBUS_VIDEO_SOG_ACTIVE_LOW BIT(14) 67 + #define V4L2_MBUS_DATA_ENABLE_HIGH BIT(15) 68 + #define V4L2_MBUS_DATA_ENABLE_LOW BIT(16) 68 69 69 70 /* Serial flags */ 70 71 /* Clock non-continuous mode support. */