mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 10:40:15 +02:00 
			
		
		
		
	drm/edid: Add a workaround for 1366x768 HD panel
HD panel (1366x768) found most commonly on laptops can't be represented exactly in CVT/DMT expression, which leads to 1368x768 instead, because 1366 can't be divided by 8. Add a hack to convert to 1366x768 manually as an exception. Signed-off-by: Takashi Iwai <tiwai@suse.de> Acked-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
This commit is contained in:
		
							parent
							
								
									02809179bb
								
							
						
					
					
						commit
						c09dedb7a5
					
				
					 1 changed files with 15 additions and 0 deletions
				
			
		| 
						 | 
					@ -1039,6 +1039,19 @@ drm_dmt_modes_for_range(struct drm_connector *connector, struct edid *edid,
 | 
				
			||||||
	return modes;
 | 
						return modes;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/* fix up 1366x768 mode from 1368x768;
 | 
				
			||||||
 | 
					 * GFT/CVT can't express 1366 width which isn't dividable by 8
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					static void fixup_mode_1366x768(struct drm_display_mode *mode)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						if (mode->hdisplay == 1368 && mode->vdisplay == 768) {
 | 
				
			||||||
 | 
							mode->hdisplay = 1366;
 | 
				
			||||||
 | 
							mode->hsync_start--;
 | 
				
			||||||
 | 
							mode->hsync_end--;
 | 
				
			||||||
 | 
							drm_mode_set_name(mode);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int
 | 
					static int
 | 
				
			||||||
drm_gtf_modes_for_range(struct drm_connector *connector, struct edid *edid,
 | 
					drm_gtf_modes_for_range(struct drm_connector *connector, struct edid *edid,
 | 
				
			||||||
			struct detailed_timing *timing)
 | 
								struct detailed_timing *timing)
 | 
				
			||||||
| 
						 | 
					@ -1053,6 +1066,7 @@ drm_gtf_modes_for_range(struct drm_connector *connector, struct edid *edid,
 | 
				
			||||||
		if (!newmode)
 | 
							if (!newmode)
 | 
				
			||||||
			return modes;
 | 
								return modes;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							fixup_mode_1366x768(newmode);
 | 
				
			||||||
		if (!mode_in_range(newmode, edid, timing)) {
 | 
							if (!mode_in_range(newmode, edid, timing)) {
 | 
				
			||||||
			drm_mode_destroy(dev, newmode);
 | 
								drm_mode_destroy(dev, newmode);
 | 
				
			||||||
			continue;
 | 
								continue;
 | 
				
			||||||
| 
						 | 
					@ -1080,6 +1094,7 @@ drm_cvt_modes_for_range(struct drm_connector *connector, struct edid *edid,
 | 
				
			||||||
		if (!newmode)
 | 
							if (!newmode)
 | 
				
			||||||
			return modes;
 | 
								return modes;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							fixup_mode_1366x768(newmode);
 | 
				
			||||||
		if (!mode_in_range(newmode, edid, timing)) {
 | 
							if (!mode_in_range(newmode, edid, timing)) {
 | 
				
			||||||
			drm_mode_destroy(dev, newmode);
 | 
								drm_mode_destroy(dev, newmode);
 | 
				
			||||||
			continue;
 | 
								continue;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue