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

drm: Clarify definition of the DRM_BUS_FLAG_(PIXDATA|SYNC)_* macros

The DRM_BUS_FLAG_PIXDATA_POSEDGE and DRM_BUS_FLAG_PIXDATA_NEGEDGE macros
and their DRM_BUS_FLAG_SYNC_* counterparts define on which pixel clock
edge data and sync signals are driven. They are however used in some
drivers to define on which pixel clock edge data and sync signals are
sampled, which should usually (but not always) be the opposite edge of
the driving edge. This creates confusion.

Create four new macros for both PIXDATA and SYNC that explicitly state
the driving and sampling edge in their name to remove the confusion. The
driving macros are defined as the opposite of the sampling macros to
made code simpler based on the assumption that the driving and sampling
edges are opposite.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Stefan Agner <stefan@agner.ch>
Tested-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>

authored by

Laurent Pinchart and committed by
Tomi Valkeinen
a792fa0e 0dbfc396

+32 -4
+32 -4
include/drm/drm_connector.h
··· 330 330 331 331 #define DRM_BUS_FLAG_DE_LOW (1<<0) 332 332 #define DRM_BUS_FLAG_DE_HIGH (1<<1) 333 - /* drive data on pos. edge */ 333 + 334 + /* 335 + * Don't use those two flags directly, use the DRM_BUS_FLAG_PIXDATA_DRIVE_* 336 + * and DRM_BUS_FLAG_PIXDATA_SAMPLE_* variants to qualify the flags explicitly. 337 + * The DRM_BUS_FLAG_PIXDATA_SAMPLE_* flags are defined as the opposite of the 338 + * DRM_BUS_FLAG_PIXDATA_DRIVE_* flags to make code simpler, as signals are 339 + * usually to be sampled on the opposite edge of the driving edge. 340 + */ 334 341 #define DRM_BUS_FLAG_PIXDATA_POSEDGE (1<<2) 335 - /* drive data on neg. edge */ 336 342 #define DRM_BUS_FLAG_PIXDATA_NEGEDGE (1<<3) 343 + 344 + /* Drive data on rising edge */ 345 + #define DRM_BUS_FLAG_PIXDATA_DRIVE_POSEDGE DRM_BUS_FLAG_PIXDATA_POSEDGE 346 + /* Drive data on falling edge */ 347 + #define DRM_BUS_FLAG_PIXDATA_DRIVE_NEGEDGE DRM_BUS_FLAG_PIXDATA_NEGEDGE 348 + /* Sample data on rising edge */ 349 + #define DRM_BUS_FLAG_PIXDATA_SAMPLE_POSEDGE DRM_BUS_FLAG_PIXDATA_NEGEDGE 350 + /* Sample data on falling edge */ 351 + #define DRM_BUS_FLAG_PIXDATA_SAMPLE_NEGEDGE DRM_BUS_FLAG_PIXDATA_POSEDGE 352 + 337 353 /* data is transmitted MSB to LSB on the bus */ 338 354 #define DRM_BUS_FLAG_DATA_MSB_TO_LSB (1<<4) 339 355 /* data is transmitted LSB to MSB on the bus */ 340 356 #define DRM_BUS_FLAG_DATA_LSB_TO_MSB (1<<5) 341 - /* drive sync on pos. edge */ 357 + 358 + /* 359 + * Similarly to the DRM_BUS_FLAG_PIXDATA_* flags, don't use these two flags 360 + * directly, use one of the DRM_BUS_FLAG_SYNC_(DRIVE|SAMPLE)_* instead. 361 + */ 342 362 #define DRM_BUS_FLAG_SYNC_POSEDGE (1<<6) 343 - /* drive sync on neg. edge */ 344 363 #define DRM_BUS_FLAG_SYNC_NEGEDGE (1<<7) 364 + 365 + /* Drive sync on rising edge */ 366 + #define DRM_BUS_FLAG_SYNC_DRIVE_POSEDGE DRM_BUS_FLAG_SYNC_POSEDGE 367 + /* Drive sync on falling edge */ 368 + #define DRM_BUS_FLAG_SYNC_DRIVE_NEGEDGE DRM_BUS_FLAG_SYNC_NEGEDGE 369 + /* Sample sync on rising edge */ 370 + #define DRM_BUS_FLAG_SYNC_SAMPLE_POSEDGE DRM_BUS_FLAG_SYNC_NEGEDGE 371 + /* Sample sync on falling edge */ 372 + #define DRM_BUS_FLAG_SYNC_SAMPLE_NEGEDGE DRM_BUS_FLAG_SYNC_POSEDGE 345 373 346 374 /** 347 375 * @bus_flags: Additional information (like pixel signal polarity) for