提交 47819ba2 编写于 作者: A Adam Jackson 提交者: Dave Airlie

drm/edid: Make the header fixup threshold tunable

6 bytes seems to be a reasonable default so far, but for the desperate
it's worth exposing this.

[airlied: change include to module.h for this]

Bugzilla: https://bugzilla.redhat.com/582559Signed-off-by: NAdam Jackson <ajax@redhat.com>
Signed-off-by: NDave Airlie <airlied@redhat.com>
上级 9b00147d
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/i2c.h> #include <linux/i2c.h>
#include <linux/export.h> #include <linux/module.h>
#include "drmP.h" #include "drmP.h"
#include "drm_edid.h" #include "drm_edid.h"
#include "drm_edid_modes.h" #include "drm_edid_modes.h"
...@@ -149,6 +149,10 @@ int drm_edid_header_is_valid(const u8 *raw_edid) ...@@ -149,6 +149,10 @@ int drm_edid_header_is_valid(const u8 *raw_edid)
} }
EXPORT_SYMBOL(drm_edid_header_is_valid); EXPORT_SYMBOL(drm_edid_header_is_valid);
static int edid_fixup __read_mostly = 6;
module_param_named(edid_fixup, edid_fixup, int, 0400);
MODULE_PARM_DESC(edid_fixup,
"Minimum number of valid EDID header bytes (0-8, default 6)");
/* /*
* Sanity check the EDID block (base or extension). Return 0 if the block * Sanity check the EDID block (base or extension). Return 0 if the block
...@@ -160,10 +164,13 @@ bool drm_edid_block_valid(u8 *raw_edid, int block) ...@@ -160,10 +164,13 @@ bool drm_edid_block_valid(u8 *raw_edid, int block)
u8 csum = 0; u8 csum = 0;
struct edid *edid = (struct edid *)raw_edid; struct edid *edid = (struct edid *)raw_edid;
if (edid_fixup > 8 || edid_fixup < 0)
edid_fixup = 6;
if (block == 0) { if (block == 0) {
int score = drm_edid_header_is_valid(raw_edid); int score = drm_edid_header_is_valid(raw_edid);
if (score == 8) ; if (score == 8) ;
else if (score >= 6) { else if (score >= edid_fixup) {
DRM_DEBUG("Fixing EDID header, your hardware may be failing\n"); DRM_DEBUG("Fixing EDID header, your hardware may be failing\n");
memcpy(raw_edid, edid_header, sizeof(edid_header)); memcpy(raw_edid, edid_header, sizeof(edid_header));
} else { } else {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册