1494N/A * Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved. 1494N/A * Copyright © 1997-2003 by The XFree86 Project, Inc. 1494N/A * Copyright © 2007 Dave Airlie 1494N/A * Copyright (c) 2007-2008, 2013, Intel Corporation 1494N/A * Jesse Barnes <jesse.barnes@intel.com> 1494N/A * Copyright 2005-2006 Luc Verhaegen 1494N/A * Copyright (c) 2001, Andy Ritger aritger@nvidia.com 1494N/A * Permission is hereby granted, free of charge, to any person obtaining a 1494N/A * copy of this software and associated documentation files (the "Software"), 1494N/A * to deal in the Software without restriction, including without limitation 1494N/A * the rights to use, copy, modify, merge, publish, distribute, sublicense, 1494N/A * and/or sell copies of the Software, and to permit persons to whom the 1494N/A * Software is furnished to do so, subject to the following conditions: 1494N/A * The above copyright notice and this permission notice shall be included in 1494N/A * all copies or substantial portions of the Software. 1494N/A * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 1494N/A * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 1494N/A * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 1494N/A * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR 1494N/A * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 1494N/A * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 1494N/A * OTHER DEALINGS IN THE SOFTWARE. 1494N/A * Except as contained in this notice, the name of the copyright holder(s) 1494N/A * and author(s) shall not be used in advertising or otherwise to promote 1494N/A * the sale, use or other dealings in this Software without prior written 1494N/A * authorization from the copyright holder(s) and author(s). 1494N/A * drm_mode_debug_printmodeline - debug print a mode 1494N/A * Describe @mode using DRM_DEBUG. 1494N/A * drm_cvt_mode -create a modeline based on CVT algorithm 1494N/A * @vrefresh : vrefresh rate 1494N/A * @reduced : Whether the GTF calculation is simplified 1494N/A * @interlaced:Whether the interlace is supported 1494N/A * return the modeline based on CVT algorithm 1494N/A * This function is called to generate the modeline based on CVT algorithm 1494N/A * according to the hdisplay, vdisplay, vrefresh. 1494N/A * It is based from the VESA(TM) Coordinated Video Timing Generator by 1494N/A * Graham Loveridge April 9, 2003 available at 1494N/A * What I have done is to translate it by using integer calculation. 1494N/A /* 2) character cell horizontal granularity (pixels) - default 8 */ 1494N/A /* 3) Minimum vertical porch (lines) - default 3 */ 1494N/A /* 4) Minimum number of vertical back porch lines - default 6 */ 1494N/A /* Pixel Clock step (kHz) */ 1494N/A /* allocate the drm_display_mode structure. If failure, we will 1494N/A /* the CVT default refresh rate is 60Hz */ 1494N/A /* the required field fresh rate */ 1494N/A /* determine the left&right borders */ 1494N/A /* find the total active pixels */ 1494N/A /* find the number of lines per field */ 1494N/A /* find the top & bottom borders */ 1494N/A /* Determine VSync Width from aspect ratio */ 1494N/A /* simplify the GTF calculation */ 1494N/A /* 4) Minimum time of vertical sync + back porch interval (µs) 1494N/A /* 3) Nominal HSync width (% of line period) - default 8 */ 1494N/A /* estimated the horizontal period */ 1494N/A /* 9. Find number of lines in sync + backporch */ 1494N/A /* 10. Find number of lines in back porch */ 1494N/A /* 5) Definition of Horizontal blanking time limitation */ 1494N/A /* Gradient (%/kHz) - default 600 */ 1494N/A /* Offset (%) - default 40 */ 1494N/A /* Blanking time scaling factor - default 128 */ 1494N/A /* Scaling factor weighting - default 20 */ 1494N/A /* 12. Find ideal blanking duty cycle from formula */ 1494N/A /* 14. find the total pixes per line */ 1494N/A /* fill the Vsync values */ 1494N/A /* Minimum vertical blanking interval time (µs)- default 460 */ 1494N/A /* Fixed number of clocks for horizontal sync */ 1494N/A /* Fixed number of clocks for horizontal blanking */ 1494N/A /* Fixed number of lines for vertical front porch - default 3*/ 1494N/A /* 8. Estimate Horizontal period. */ 1494N/A /* 9. Find number of lines in vertical blanking */ 1494N/A /* 10. Check if vertical blanking is sufficient */ 1494N/A /* 11. Find total number of lines in vertical field */ 1494N/A /* 12. Find total number of pixels in a line */ 1494N/A /* 15/13. Find pixel clock frequency (kHz for xf86) */ 1494N/A /* 18/16. Find actual vertical frame frequency */ 1494N/A /* ignore - just set the mode flag for interlaced */ 1494N/A /* Fill the mode line name */ 1494N/A * drm_gtf_mode - create the modeline based on GTF algorithm 1494N/A * @vrefresh :vrefresh rate. 1494N/A * @interlaced :whether the interlace is supported 1494N/A * @margins :whether the margin is supported 1494N/A * @GTF_[MCKJ] :extended GTF formula parameters 1494N/A * return the modeline based on GTF algorithm 1494N/A * GTF feature blocks specify C and J in multiples of 0.5, so we pass them 1494N/A * in here multiplied by two. For a C of 40, pass in 80. 1494N/A /* 2) character cell horizontal granularity (pixels) - default 8 */ 1494N/A /* 3) Minimum vertical porch (lines) - default 3 */ 1494N/A /* width of vsync in lines */ 1494N/A /* width of hsync as % of total line */ 1494N/A /* min time of vsync + back porch (microsec) */ 1494N/A /* C' and M' are part of the Blanking Duty Cycle computation */ 1494N/A /* 1. In order to give correct results, the number of horizontal 1494N/A * pixels requested is first processed to ensure that it is divisible 1494N/A * by the character size, by rounding it to the nearest character 1494N/A /* 2. If interlace is requested, the number of vertical lines assumed 1494N/A * by the calculation must be halved, as the computation calculates 1494N/A * the number of vertical lines per field. 1494N/A /* 3. Find the frame rate required: */ 1494N/A /* 4. Find number of lines in Top margin: */ 1494N/A /* 5. Find number of lines in bottom margin: */ 1494N/A /* 6. If interlace is required, then set variable interlace: */ 1494N/A /* 7. Estimate the Horizontal frequency */ 1494N/A /* 8. Find the number of lines in V sync + back porch */ 1494N/A /* [V SYNC+BP] = RINT(([MIN VSYNC+BP] * hfreq_est / 1000000)) */ 1494N/A /* 9. Find the number of lines in V back porch alone: */ 1494N/A /* 10. Find the total number of lines in Vertical field period: */ 1494N/A /* 11. Estimate the Vertical field frequency: */ 1494N/A /* 12. Find the actual horizontal period: */ 1494N/A /* 13. Find the actual Vertical field frequency: */ 1494N/A /* 14. Find the Vertical frame frequency: */ 1494N/A /* 15. Find number of pixels in left margin: */ 1494N/A /* 16.Find number of pixels in right margin: */ 1494N/A /* 17.Find total number of active pixels in image and left and right */ 1494N/A /* 18.Find the ideal blanking duty cycle from blanking duty cycle */ 1494N/A /* 19.Find the number of pixels in the blanking time to the nearest 1494N/A * double character cell: */ 1494N/A /* 20.Find total number of pixels: */ 1494N/A /* 21.Find pixel clock frequency: */ 1494N/A /* Stage 1 computations are now complete; I should really pass 1494N/A * the results to another function and do the Stage 2 computations, 1494N/A * but I only need a few more values so I'll just append the 1494N/A * computations here for now */ 1494N/A /* 17. Find the number of pixels in the horizontal sync period: */ 1494N/A /* 18. Find the number of pixels in horizontal front porch period */ 1494N/A /* 36. Find the number of lines in the odd front porch period: */ 1494N/A /* finally, pack the results in the mode struct */ 1494N/A * drm_gtf_mode - create the modeline based on GTF algorithm 1494N/A * @vrefresh :vrefresh rate. 1494N/A * @interlaced :whether the interlace is supported 1494N/A * @margins :whether the margin is supported 1494N/A * return the modeline based on GTF algorithm 1494N/A * This function is to create the modeline based on the GTF algorithm. 1494N/A * Generalized Timing Formula is derived from: 1494N/A * GTF Spreadsheet by Andy Morrish (1/5/97) 1494N/A * What I have done is to translate it by using integer calculation. 1494N/A * I also refer to the function of fb_get_mode in the file of 1494N/A * of_get_drm_display_mode - get a drm_display_mode from devicetree 1494N/A * @np: device_node with the timing specification 1494N/A * @dmode: will be set to the return value 1494N/A * @index: index into the list of display timings in devicetree 1494N/A * This function is expensive and should only be used, if only one mode is to be 1494N/A * read from DT. To get multiple modes start with of_get_display_timings and 1494N/A#
endif /* CONFIG_VIDEOMODE_HELPERS */ 1494N/A * drm_mode_set_name - set the name on a mode 1494N/A * @mode: name will be set in this mode 1494N/A * Set the name of @mode to a standard format. 1494N/A * drm_mode_list_concat - move modes from one list to another 1494N/A * Caller must ensure both lists are locked. 1494N/A * Move all the modes from @head to @new. 1494N/A * drm_mode_width - get the width of a mode 1494N/A * Return @mode's width (hdisplay) value. 1494N/A * drm_mode_height - get the height of a mode 1494N/A * Return @mode's height (vdisplay) value. 1494N/A/** drm_mode_hsync - get the hsync of a mode 1494N/A * Return @modes's hsync rate in kHz, rounded to the nearest int. 1494N/A * drm_mode_vrefresh - get the vrefresh of a mode 1494N/A * Return @mode's vrefresh rate in Hz or calculate it if necessary. 1494N/A * FIXME: why is this needed? shouldn't vrefresh be set already? 1494N/A * Vertical refresh rate. It will be the result of actual value plus 0.5. 1494N/A * If it is 70.288, it will return 70Hz. 1494N/A * If it is 59.6, it will return 60Hz. 1494N/A /* work out vrefresh the value will be x1000 */ 1494N/A * drm_mode_set_crtcinfo - set CRTC modesetting parameters 1494N/A * @adjust_flags: unused? (FIXME) 1494N/A * Setup the CRTC modesetting parameters for @p, adjusting if necessary. 1494N/A * drm_mode_copy - copy the mode 1494N/A * Copy an existing mode into another mode, preserving the object id 1494N/A * drm_mode_duplicate - allocate and duplicate an existing mode 1494N/A * Just allocate a new mode, copy the existing mode into it, and return 1494N/A * a pointer to it. Used to create new instances of established modes. 1494N/A * drm_mode_equal - test modes for equality 1494N/A * Check to see if @mode1 and @mode2 are equivalent. 1494N/A * True if the modes are equal, false otherwise. 1494N/A /* do clock check convert to PICOS so fb modes get matched 1494N/A * drm_mode_equal_no_clocks - test modes for equality 1494N/A * Check to see if @mode1 and @mode2 are equivalent, but 1494N/A * don't check the pixel clocks. 1494N/A * True if the modes are equal, false otherwise. 1494N/A * drm_mode_validate_size - make sure modes adhere to size constraints 1494N/A * @mode_list: list of modes to check 1494N/A * Caller must hold a lock protecting @mode_list. 1494N/A * The DRM device (@dev) has size and pitch limits. Here we validate the 1494N/A * modes we probed for @dev against those limits and set their status as 1494N/A * drm_mode_validate_clocks - validate modes against clock limits 1494N/A * @mode_list: list of modes to check 1494N/A * @min: minimum clock rate array 1494N/A * @max: maximum clock rate array 1494N/A * @n_ranges: number of clock ranges (size of arrays) 1494N/A * Caller must hold a lock protecting @mode_list. 1494N/A * Some code may need to check a mode list against the clock limits of the 1494N/A * device in question. This function walks the mode list, testing to make 1494N/A * sure each mode falls within a given range (defined by @min and @max 1494N/A * arrays) and sets @mode->status as needed. 1494N/A * drm_mode_prune_invalid - remove invalid modes from mode list 1494N/A * @mode_list: list of modes to check 1494N/A * @verbose: be verbose about it 1494N/A * Caller must hold a lock protecting @mode_list. 1494N/A * Once mode list generation is complete, a caller can use this routine to 1494N/A * remove invalid modes from a mode list. If any of the modes have a 1494N/A * status other than %MODE_OK, they are removed from @mode_list and freed. 1494N/A * drm_mode_compare - compare modes for favorability 1494N/A * @lh_a: list_head for first mode 1494N/A * @lh_b: list_head for second mode 1494N/A * Compare two modes, given by @lh_a and @lh_b, returning a value indicating 1494N/A * Negative if @lh_a is better than @lh_b, zero if they're equivalent, or 1494N/A * positive if @lh_b is better than @lh_a. 1494N/A * drm_mode_sort - sort mode list 1494N/A * Caller must hold a lock protecting @mode_list. 1494N/A * Sort @mode_list by favorability, putting good modes first. 1494N/A /* Pre-check the mode order 1494N/A * In most cases, the modes is ordered. 1494N/A * drm_mode_connector_list_update - update the mode list for the connector 1494N/A * @connector: the connector to update 1494N/A * Caller must hold a lock protecting @mode_list. 1494N/A * This moves the modes from the @connector probed_modes list 1494N/A * to the actual mode list. It compares the probed mode against the current 1494N/A * list and only adds different modes. All modes unverified after this point 1494N/A * will be removed by the prune invalid modes. 1494N/A /* go through current modes checking for the new probed mode */ 1494N/A /* if equal delete the probed mode */ 1494N/A /* Merge type bits together */