Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-only */
0002 /*
0003  * Copyright 2012 Steffen Trumtrar <s.trumtrar@pengutronix.de>
0004  *
0005  * description of display timings
0006  */
0007 
0008 #ifndef __LINUX_DISPLAY_TIMING_H
0009 #define __LINUX_DISPLAY_TIMING_H
0010 
0011 #include <linux/bitops.h>
0012 #include <linux/types.h>
0013 
0014 enum display_flags {
0015     DISPLAY_FLAGS_HSYNC_LOW     = BIT(0),
0016     DISPLAY_FLAGS_HSYNC_HIGH    = BIT(1),
0017     DISPLAY_FLAGS_VSYNC_LOW     = BIT(2),
0018     DISPLAY_FLAGS_VSYNC_HIGH    = BIT(3),
0019 
0020     /* data enable flag */
0021     DISPLAY_FLAGS_DE_LOW        = BIT(4),
0022     DISPLAY_FLAGS_DE_HIGH       = BIT(5),
0023     /* drive data on pos. edge */
0024     DISPLAY_FLAGS_PIXDATA_POSEDGE   = BIT(6),
0025     /* drive data on neg. edge */
0026     DISPLAY_FLAGS_PIXDATA_NEGEDGE   = BIT(7),
0027     DISPLAY_FLAGS_INTERLACED    = BIT(8),
0028     DISPLAY_FLAGS_DOUBLESCAN    = BIT(9),
0029     DISPLAY_FLAGS_DOUBLECLK     = BIT(10),
0030     /* drive sync on pos. edge */
0031     DISPLAY_FLAGS_SYNC_POSEDGE  = BIT(11),
0032     /* drive sync on neg. edge */
0033     DISPLAY_FLAGS_SYNC_NEGEDGE  = BIT(12),
0034 };
0035 
0036 /*
0037  * A single signal can be specified via a range of minimal and maximal values
0038  * with a typical value, that lies somewhere inbetween.
0039  */
0040 struct timing_entry {
0041     u32 min;
0042     u32 typ;
0043     u32 max;
0044 };
0045 
0046 /*
0047  * Single "mode" entry. This describes one set of signal timings a display can
0048  * have in one setting. This struct can later be converted to struct videomode
0049  * (see include/video/videomode.h). As each timing_entry can be defined as a
0050  * range, one struct display_timing may become multiple struct videomodes.
0051  *
0052  * Example: hsync active high, vsync active low
0053  *
0054  *                  Active Video
0055  * Video  ______________________XXXXXXXXXXXXXXXXXXXXXX_____________________
0056  *    |<- sync ->|<- back ->|<----- active ----->|<- front ->|<- sync..
0057  *    |      |   porch  |            |   porch   |
0058  *
0059  * HSync _|¯¯¯¯¯¯¯¯¯¯|___________________________________________|¯¯¯¯¯¯¯¯¯
0060  *
0061  * VSync ¯|__________|¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯|_________
0062  */
0063 struct display_timing {
0064     struct timing_entry pixelclock;
0065 
0066     struct timing_entry hactive;        /* hor. active video */
0067     struct timing_entry hfront_porch;   /* hor. front porch */
0068     struct timing_entry hback_porch;    /* hor. back porch */
0069     struct timing_entry hsync_len;      /* hor. sync len */
0070 
0071     struct timing_entry vactive;        /* ver. active video */
0072     struct timing_entry vfront_porch;   /* ver. front porch */
0073     struct timing_entry vback_porch;    /* ver. back porch */
0074     struct timing_entry vsync_len;      /* ver. sync len */
0075 
0076     enum display_flags flags;       /* display flags */
0077 };
0078 
0079 /*
0080  * This describes all timing settings a display provides.
0081  * The native_mode is the default setting for this display.
0082  * Drivers that can handle multiple videomodes should work with this struct and
0083  * convert each entry to the desired end result.
0084  */
0085 struct display_timings {
0086     unsigned int num_timings;
0087     unsigned int native_mode;
0088 
0089     struct display_timing **timings;
0090 };
0091 
0092 /* get one entry from struct display_timings */
0093 static inline struct display_timing *display_timings_get(const struct
0094                              display_timings *disp,
0095                              unsigned int index)
0096 {
0097     if (disp->num_timings > index)
0098         return disp->timings[index];
0099     else
0100         return NULL;
0101 }
0102 
0103 void display_timings_release(struct display_timings *disp);
0104 
0105 #endif