From: Keith Packard <keithp@keithp.com>
To: linux-kernel@vger.kernel.org, Dave Airlie <airlied@redhat.com>,
Daniel Vetter <daniel@ffwll.ch>
Cc: Keith Packard <keithp@keithp.com>, dri-devel@lists.freedesktop.org
Subject: [PATCH] drm: Add drm.edid_quirk_param module parameter
Date: Wed, 8 Aug 2018 23:11:23 -0700 [thread overview]
Message-ID: <20180809061123.1734-1-keithp@keithp.com> (raw)
This parameter allows the set of EDID quirks to be changed at
runtime. The syntax is
vendor/product/quirks,vendor/product/quirks,...
where vendor is the three-letter EDID vendor value, product is the
EDID product id which may be prefixed with 0x to for hex instead of
decimal values and quirks is the replacement quirks value from the
list in drm_edid.c.
Signed-off-by: Keith Packard <keithp@keithp.com>
---
drivers/gpu/drm/drm_edid.c | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
index 5dc742b27ca0..63b4587faddd 100644
--- a/drivers/gpu/drm/drm_edid.c
+++ b/drivers/gpu/drm/drm_edid.c
@@ -98,6 +98,12 @@ struct detailed_mode_closure {
#define LEVEL_GTF2 2
#define LEVEL_CVT 3
+#define EDID_QUIRK_PARAM_LEN 256
+static char edid_quirk_param[EDID_QUIRK_PARAM_LEN];
+module_param_string(edid_quirk_param, edid_quirk_param, sizeof(edid_quirk_param), 0644);
+MODULE_PARM_DESC(edid_quirk_param, "Extra EDID quirks, "
+ "format is 'vendor/product/quirks;...' ");
+
static const struct edid_quirk {
char vendor[4];
int product_id;
@@ -1774,8 +1780,24 @@ static bool edid_vendor(const struct edid *edid, const char *vendor)
static u32 edid_get_quirks(const struct edid *edid)
{
const struct edid_quirk *quirk;
+ const char *q;
int i;
+ for (q = edid_quirk_param; q && *q; q = strchr(q, ',')) {
+ char vendor[4];
+ int product_id;
+ int quirks;
+
+ while (*q == ',')
+ q++;
+
+ if (sscanf(q, "%3s/%i/%i", vendor, &product_id, &quirks) == 3) {
+ if (edid_vendor(edid, vendor) &&
+ (EDID_PRODUCT_ID(edid) == product_id))
+ return quirks;
+ }
+ }
+
for (i = 0; i < ARRAY_SIZE(edid_quirk_list); i++) {
quirk = &edid_quirk_list[i];
--
2.18.0
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
next reply other threads:[~2018-08-09 6:11 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-09 6:11 Keith Packard [this message]
2018-08-15 13:05 ` [PATCH] drm: Add drm.edid_quirk_param module parameter Jani Nikula
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180809061123.1734-1-keithp@keithp.com \
--to=keithp@keithp.com \
--cc=airlied@redhat.com \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).