mirror of
				https://github.com/torvalds/linux.git
				synced 2025-10-31 16:48:26 +02:00 
			
		
		
		
	 517e28d40c
			
		
	
	
		517e28d40c
		
	
	
	
	
		
			
			Mode lines are independent from hardware Gen or TX chip, so hide all VBIOS mode tables in ast_vbios.c. Move the look-up code for VBIOS modes from ast_vbios_get_mode_info() to ast_vbios_find_mode(). The new look-up function respects the supported-mode flags in struct ast_device. For example, if a device does not have struct ast_device.support_fullhd set, the helper does not return a valid mode for 1920x1080. Taking the supported-mode flags into account allows for making the VBIOS tables the single reference for validating and setting display modes against hardware capabilities. v2: - replace mode switch with look-up table (Jocelyn) Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Reviewed-by: Jocelyn Falempe <jfalempe@redhat.com> Link: https://patchwork.freedesktop.org/patch/msgid/20250131092257.115596-11-tzimmermann@suse.de
		
			
				
	
	
		
			169 lines
		
	
	
	
		
			5.6 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			169 lines
		
	
	
	
		
			5.6 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
| /*
 | |
|  * Copyright (c) 2005 ASPEED Technology Inc.
 | |
|  *
 | |
|  * Permission to use, copy, modify, distribute, and sell this software and its
 | |
|  * documentation for any purpose is hereby granted without fee, provided that
 | |
|  * the above copyright notice appear in all copies and that both that
 | |
|  * copyright notice and this permission notice appear in supporting
 | |
|  * documentation, and that the name of the authors not be used in
 | |
|  * advertising or publicity pertaining to distribution of the software without
 | |
|  * specific, written prior permission.  The authors makes no representations
 | |
|  * about the suitability of this software for any purpose.  It is provided
 | |
|  * "as is" without express or implied warranty.
 | |
|  *
 | |
|  * THE AUTHORS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
 | |
|  * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
 | |
|  * EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
 | |
|  * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
 | |
|  * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
 | |
|  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
 | |
|  * PERFORMANCE OF THIS SOFTWARE.
 | |
|  */
 | |
| /* Ported from xf86-video-ast driver */
 | |
| 
 | |
| #ifndef AST_TABLES_H
 | |
| #define AST_TABLES_H
 | |
| 
 | |
| #include "ast_drv.h"
 | |
| 
 | |
| /* Std. Table Index Definition */
 | |
| #define TextModeIndex		0
 | |
| #define EGAModeIndex		1
 | |
| #define VGAModeIndex		2
 | |
| #define HiCModeIndex		3
 | |
| #define TrueCModeIndex		4
 | |
| 
 | |
| static const struct ast_vbios_dclk_info dclk_table[] = {
 | |
| 	{0x2C, 0xE7, 0x03},			/* 00: VCLK25_175	*/
 | |
| 	{0x95, 0x62, 0x03},			/* 01: VCLK28_322	*/
 | |
| 	{0x67, 0x63, 0x01},			/* 02: VCLK31_5		*/
 | |
| 	{0x76, 0x63, 0x01},			/* 03: VCLK36		*/
 | |
| 	{0xEE, 0x67, 0x01},			/* 04: VCLK40		*/
 | |
| 	{0x82, 0x62, 0x01},			/* 05: VCLK49_5		*/
 | |
| 	{0xC6, 0x64, 0x01},			/* 06: VCLK50		*/
 | |
| 	{0x94, 0x62, 0x01},			/* 07: VCLK56_25	*/
 | |
| 	{0x80, 0x64, 0x00},			/* 08: VCLK65		*/
 | |
| 	{0x7B, 0x63, 0x00},			/* 09: VCLK75		*/
 | |
| 	{0x67, 0x62, 0x00},			/* 0A: VCLK78_75	*/
 | |
| 	{0x7C, 0x62, 0x00},			/* 0B: VCLK94_5		*/
 | |
| 	{0x8E, 0x62, 0x00},			/* 0C: VCLK108		*/
 | |
| 	{0x85, 0x24, 0x00},			/* 0D: VCLK135		*/
 | |
| 	{0x67, 0x22, 0x00},			/* 0E: VCLK157_5	*/
 | |
| 	{0x6A, 0x22, 0x00},			/* 0F: VCLK162		*/
 | |
| 	{0x4d, 0x4c, 0x80},			/* 10: VCLK154		*/
 | |
| 	{0x68, 0x6f, 0x80},			/* 11: VCLK83.5		*/
 | |
| 	{0x28, 0x49, 0x80},			/* 12: VCLK106.5	*/
 | |
| 	{0x37, 0x49, 0x80},			/* 13: VCLK146.25	*/
 | |
| 	{0x1f, 0x45, 0x80},			/* 14: VCLK148.5	*/
 | |
| 	{0x47, 0x6c, 0x80},			/* 15: VCLK71		*/
 | |
| 	{0x25, 0x65, 0x80},			/* 16: VCLK88.75	*/
 | |
| 	{0x77, 0x58, 0x80},			/* 17: VCLK119		*/
 | |
| 	{0x32, 0x67, 0x80},			/* 18: VCLK85_5		*/
 | |
| 	{0x6a, 0x6d, 0x80},			/* 19: VCLK97_75	*/
 | |
| 	{0x3b, 0x2c, 0x81},			/* 1A: VCLK118_25	*/
 | |
| };
 | |
| 
 | |
| static const struct ast_vbios_dclk_info dclk_table_ast2500[] = {
 | |
| 	{0x2C, 0xE7, 0x03},			/* 00: VCLK25_175	*/
 | |
| 	{0x95, 0x62, 0x03},			/* 01: VCLK28_322	*/
 | |
| 	{0x67, 0x63, 0x01},			/* 02: VCLK31_5		*/
 | |
| 	{0x76, 0x63, 0x01},			/* 03: VCLK36		*/
 | |
| 	{0xEE, 0x67, 0x01},			/* 04: VCLK40		*/
 | |
| 	{0x82, 0x62, 0x01},			/* 05: VCLK49_5		*/
 | |
| 	{0xC6, 0x64, 0x01},			/* 06: VCLK50		*/
 | |
| 	{0x94, 0x62, 0x01},			/* 07: VCLK56_25	*/
 | |
| 	{0x80, 0x64, 0x00},			/* 08: VCLK65		*/
 | |
| 	{0x7B, 0x63, 0x00},			/* 09: VCLK75		*/
 | |
| 	{0x67, 0x62, 0x00},			/* 0A: VCLK78_75	*/
 | |
| 	{0x7C, 0x62, 0x00},			/* 0B: VCLK94_5		*/
 | |
| 	{0x8E, 0x62, 0x00},			/* 0C: VCLK108		*/
 | |
| 	{0x85, 0x24, 0x00},			/* 0D: VCLK135		*/
 | |
| 	{0x67, 0x22, 0x00},			/* 0E: VCLK157_5	*/
 | |
| 	{0x6A, 0x22, 0x00},			/* 0F: VCLK162		*/
 | |
| 	{0x4d, 0x4c, 0x80},			/* 10: VCLK154		*/
 | |
| 	{0x68, 0x6f, 0x80},			/* 11: VCLK83.5		*/
 | |
| 	{0x28, 0x49, 0x80},			/* 12: VCLK106.5	*/
 | |
| 	{0x37, 0x49, 0x80},			/* 13: VCLK146.25	*/
 | |
| 	{0x1f, 0x45, 0x80},			/* 14: VCLK148.5	*/
 | |
| 	{0x47, 0x6c, 0x80},			/* 15: VCLK71		*/
 | |
| 	{0x25, 0x65, 0x80},			/* 16: VCLK88.75	*/
 | |
| 	{0x58, 0x01, 0x42},			/* 17: VCLK119		*/
 | |
| 	{0x32, 0x67, 0x80},			/* 18: VCLK85_5		*/
 | |
| 	{0x6a, 0x6d, 0x80},			/* 19: VCLK97_75	*/
 | |
| 	{0x44, 0x20, 0x43},			/* 1A: VCLK118_25	*/
 | |
| };
 | |
| 
 | |
| static const struct ast_vbios_stdtable vbios_stdtable[] = {
 | |
| 	/* MD_2_3_400 */
 | |
| 	{
 | |
| 		0x67,
 | |
| 		{0x00,0x03,0x00,0x02},
 | |
| 		{0x5f,0x4f,0x50,0x82,0x55,0x81,0xbf,0x1f,
 | |
| 		 0x00,0x4f,0x0d,0x0e,0x00,0x00,0x00,0x00,
 | |
| 		 0x9c,0x8e,0x8f,0x28,0x1f,0x96,0xb9,0xa3,
 | |
| 		 0xff},
 | |
| 		{0x00,0x01,0x02,0x03,0x04,0x05,0x14,0x07,
 | |
| 		 0x38,0x39,0x3a,0x3b,0x3c,0x3d,0x3e,0x3f,
 | |
| 		 0x0c,0x00,0x0f,0x08},
 | |
| 		{0x00,0x00,0x00,0x00,0x00,0x10,0x0e,0x00,
 | |
| 		 0xff}
 | |
| 	},
 | |
| 	/* Mode12/ExtEGATable */
 | |
| 	{
 | |
| 		0xe3,
 | |
| 		{0x01,0x0f,0x00,0x06},
 | |
| 		{0x5f,0x4f,0x50,0x82,0x55,0x81,0x0b,0x3e,
 | |
| 		 0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00,
 | |
| 		 0xe9,0x8b,0xdf,0x28,0x00,0xe7,0x04,0xe3,
 | |
| 		 0xff},
 | |
| 		{0x00,0x01,0x02,0x03,0x04,0x05,0x14,0x07,
 | |
| 		 0x38,0x39,0x3a,0x3b,0x3c,0x3d,0x3e,0x3f,
 | |
| 		 0x01,0x00,0x0f,0x00},
 | |
| 		{0x00,0x00,0x00,0x00,0x00,0x00,0x05,0x0f,
 | |
| 		 0xff}
 | |
| 	},
 | |
| 	/* ExtVGATable */
 | |
| 	{
 | |
| 		0x2f,
 | |
| 		{0x01,0x0f,0x00,0x0e},
 | |
| 		{0x5f,0x4f,0x50,0x82,0x54,0x80,0x0b,0x3e,
 | |
| 		 0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00,
 | |
| 		 0xea,0x8c,0xdf,0x28,0x40,0xe7,0x04,0xa3,
 | |
| 		 0xff},
 | |
| 		{0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,
 | |
| 		 0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f,
 | |
| 		 0x01,0x00,0x00,0x00},
 | |
| 		{0x00,0x00,0x00,0x00,0x00,0x40,0x05,0x0f,
 | |
| 		 0xff}
 | |
| 	},
 | |
| 	/* ExtHiCTable */
 | |
| 	{
 | |
| 		0x2f,
 | |
| 		{0x01,0x0f,0x00,0x0e},
 | |
| 		{0x5f,0x4f,0x50,0x82,0x54,0x80,0x0b,0x3e,
 | |
| 		 0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00,
 | |
| 		 0xea,0x8c,0xdf,0x28,0x40,0xe7,0x04,0xa3,
 | |
| 		 0xff},
 | |
| 		{0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,
 | |
| 		 0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f,
 | |
| 		 0x01,0x00,0x00,0x00},
 | |
| 		{0x00,0x00,0x00,0x00,0x00,0x00,0x05,0x0f,
 | |
| 		 0xff}
 | |
| 	},
 | |
| 	/* ExtTrueCTable */
 | |
| 	{
 | |
| 		0x2f,
 | |
| 		{0x01,0x0f,0x00,0x0e},
 | |
| 		{0x5f,0x4f,0x50,0x82,0x54,0x80,0x0b,0x3e,
 | |
| 		 0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00,
 | |
| 		 0xea,0x8c,0xdf,0x28,0x40,0xe7,0x04,0xa3,
 | |
| 		 0xff},
 | |
| 		{0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,
 | |
| 		 0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f,
 | |
| 		 0x01,0x00,0x00,0x00},
 | |
| 		{0x00,0x00,0x00,0x00,0x00,0x00,0x05,0x0f,
 | |
| 		 0xff}
 | |
| 	},
 | |
| };
 | |
| 
 | |
| #endif
 |