/* SPDX-License-Identifier: GPL-2.0-only */1/*2* Copyright 2012 Steffen Trumtrar <[email protected]>3*4* description of display timings5*/67#ifndef __LINUX_DISPLAY_TIMING_H8#define __LINUX_DISPLAY_TIMING_H910#include <linux/bitops.h>11#include <linux/types.h>1213enum display_flags {14DISPLAY_FLAGS_HSYNC_LOW = BIT(0),15DISPLAY_FLAGS_HSYNC_HIGH = BIT(1),16DISPLAY_FLAGS_VSYNC_LOW = BIT(2),17DISPLAY_FLAGS_VSYNC_HIGH = BIT(3),1819/* data enable flag */20DISPLAY_FLAGS_DE_LOW = BIT(4),21DISPLAY_FLAGS_DE_HIGH = BIT(5),22/* drive data on pos. edge */23DISPLAY_FLAGS_PIXDATA_POSEDGE = BIT(6),24/* drive data on neg. edge */25DISPLAY_FLAGS_PIXDATA_NEGEDGE = BIT(7),26DISPLAY_FLAGS_INTERLACED = BIT(8),27DISPLAY_FLAGS_DOUBLESCAN = BIT(9),28DISPLAY_FLAGS_DOUBLECLK = BIT(10),29/* drive sync on pos. edge */30DISPLAY_FLAGS_SYNC_POSEDGE = BIT(11),31/* drive sync on neg. edge */32DISPLAY_FLAGS_SYNC_NEGEDGE = BIT(12),33};3435/*36* A single signal can be specified via a range of minimal and maximal values37* with a typical value, that lies somewhere inbetween.38*/39struct timing_entry {40u32 min;41u32 typ;42u32 max;43};4445/*46* Single "mode" entry. This describes one set of signal timings a display can47* have in one setting. This struct can later be converted to struct videomode48* (see include/video/videomode.h). As each timing_entry can be defined as a49* range, one struct display_timing may become multiple struct videomodes.50*51* Example: hsync active high, vsync active low52*53* Active Video54* Video ______________________XXXXXXXXXXXXXXXXXXXXXX_____________________55* |<- sync ->|<- back ->|<----- active ----->|<- front ->|<- sync..56* | | porch | | porch |57*58* HSync _|¯¯¯¯¯¯¯¯¯¯|___________________________________________|¯¯¯¯¯¯¯¯¯59*60* VSync ¯|__________|¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯|_________61*/62struct display_timing {63struct timing_entry pixelclock;6465struct timing_entry hactive; /* hor. active video */66struct timing_entry hfront_porch; /* hor. front porch */67struct timing_entry hback_porch; /* hor. back porch */68struct timing_entry hsync_len; /* hor. sync len */6970struct timing_entry vactive; /* ver. active video */71struct timing_entry vfront_porch; /* ver. front porch */72struct timing_entry vback_porch; /* ver. back porch */73struct timing_entry vsync_len; /* ver. sync len */7475enum display_flags flags; /* display flags */76};7778/*79* This describes all timing settings a display provides.80* The native_mode is the default setting for this display.81* Drivers that can handle multiple videomodes should work with this struct and82* convert each entry to the desired end result.83*/84struct display_timings {85unsigned int num_timings;86unsigned int native_mode;8788struct display_timing **timings;89};9091/* get one entry from struct display_timings */92static inline struct display_timing *display_timings_get(const struct93display_timings *disp,94unsigned int index)95{96if (disp->num_timings > index)97return disp->timings[index];98else99return NULL;100}101102void display_timings_release(struct display_timings *disp);103104#endif105106107