From: Ramkumar Ramachandra <artagnon@gmail.com>
To: LKML <linux-kernel@vger.kernel.org>
Cc: Chris Wilson <chris@chris-wilson.co.uk>,
Andreas Heider <andreas@meetr.de>,
Seth Forshee <seth.forshee@canonical.com>
Subject: [PATCH v2 2/4] drm/i915: factor out intel_lvds_get_edid()
Date: Tue, 7 Jan 2014 20:24:30 +0530 [thread overview]
Message-ID: <1389106472-11389-3-git-send-email-artagnon@gmail.com> (raw)
In-Reply-To: <1389106472-11389-1-git-send-email-artagnon@gmail.com>
Corresponding to
intel_crt_get_edid()
intel_sdvo_get_edid()
intel_dp_get_edid()
add a intel_lvds_get_edid(). We plan to call this during a
switcheroo-reprobe in later patches.
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Andreas Heider <andreas@meetr.de>
Cc: Seth Forshee <seth.forshee@canonical.com>
Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
---
drivers/gpu/drm/i915/intel_lvds.c | 100 ++++++++++++++++++++++----------------
1 file changed, 57 insertions(+), 43 deletions(-)
diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c
index c3b4da7..e7aa285 100644
--- a/drivers/gpu/drm/i915/intel_lvds.c
+++ b/drivers/gpu/drm/i915/intel_lvds.c
@@ -921,6 +921,60 @@ static bool intel_lvds_supported(struct drm_device *dev)
return false;
}
+static struct edid *intel_lvds_get_edid(struct drm_connector *connector,
+ struct i2c_adapter *i2c)
+{
+ struct edid *edid;
+ struct intel_lvds_connector *lvds_connector = to_lvds_connector(connector);
+ struct drm_device *dev = connector->dev;
+ struct drm_display_mode *scan; /* *modes, *bios_mode; */
+ struct drm_display_mode *fixed_mode = NULL;
+
+ /*
+ * Attempt to get the fixed panel mode from DDC. Assume that the
+ * preferred mode is the right one.
+ */
+ edid = drm_get_edid(connector, i2c);
+ if (edid) {
+ if (drm_add_edid_modes(connector, edid)) {
+ drm_mode_connector_update_edid_property(connector,
+ edid);
+ } else {
+ kfree(edid);
+ edid = ERR_PTR(-EINVAL);
+ }
+ } else {
+ edid = ERR_PTR(-ENOENT);
+ }
+ lvds_connector->base.edid = edid;
+
+ if (IS_ERR_OR_NULL(edid)) {
+ /* Didn't get an EDID, so
+ * Set wide sync ranges so we get all modes
+ * handed to valid_mode for checking
+ */
+ connector->display_info.min_vfreq = 0;
+ connector->display_info.max_vfreq = 200;
+ connector->display_info.min_hfreq = 0;
+ connector->display_info.max_hfreq = 200;
+ }
+
+ list_for_each_entry(scan, &connector->probed_modes, head) {
+ if (scan->type & DRM_MODE_TYPE_PREFERRED) {
+ DRM_DEBUG_KMS("using preferred mode from EDID: ");
+ drm_mode_debug_printmodeline(scan);
+
+ fixed_mode = drm_mode_duplicate(dev, scan);
+ if (fixed_mode) {
+ intel_find_lvds_downclock(dev, fixed_mode,
+ connector);
+ return edid;
+ }
+ }
+ }
+ return NULL;
+}
+
/**
* intel_lvds_init - setup LVDS connectors on this device
* @dev: drm device
@@ -937,7 +991,6 @@ void intel_lvds_init(struct drm_device *dev)
struct intel_connector *intel_connector;
struct drm_connector *connector;
struct drm_encoder *encoder;
- struct drm_display_mode *scan; /* *modes, *bios_mode; */
struct drm_display_mode *fixed_mode = NULL;
struct edid *edid;
struct drm_crtc *crtc;
@@ -1036,48 +1089,9 @@ void intel_lvds_init(struct drm_device *dev)
* if closed, act like it's not there for now
*/
- /*
- * Attempt to get the fixed panel mode from DDC. Assume that the
- * preferred mode is the right one.
- */
- edid = drm_get_edid(connector, intel_gmbus_get_adapter(dev_priv, pin));
- if (edid) {
- if (drm_add_edid_modes(connector, edid)) {
- drm_mode_connector_update_edid_property(connector,
- edid);
- } else {
- kfree(edid);
- edid = ERR_PTR(-EINVAL);
- }
- } else {
- edid = ERR_PTR(-ENOENT);
- }
- lvds_connector->base.edid = edid;
-
- if (IS_ERR_OR_NULL(edid)) {
- /* Didn't get an EDID, so
- * Set wide sync ranges so we get all modes
- * handed to valid_mode for checking
- */
- connector->display_info.min_vfreq = 0;
- connector->display_info.max_vfreq = 200;
- connector->display_info.min_hfreq = 0;
- connector->display_info.max_hfreq = 200;
- }
-
- list_for_each_entry(scan, &connector->probed_modes, head) {
- if (scan->type & DRM_MODE_TYPE_PREFERRED) {
- DRM_DEBUG_KMS("using preferred mode from EDID: ");
- drm_mode_debug_printmodeline(scan);
-
- fixed_mode = drm_mode_duplicate(dev, scan);
- if (fixed_mode) {
- intel_find_lvds_downclock(dev, fixed_mode,
- connector);
- goto out;
- }
- }
- }
+ edid = intel_lvds_get_edid(connector, intel_gmbus_get_adapter(dev_priv, pin));
+ if (edid)
+ goto out;
/* Failed to get EDID, what about VBT? */
if (dev_priv->vbt.lfp_lvds_vbt_mode) {
--
1.8.5.2.229.g4448466
next prev parent reply other threads:[~2014-01-07 14:55 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-07 14:54 [INCOMPLETE PATCH v2 0/4] Get EDID late for VGA switcheroo Ramkumar Ramachandra
2014-01-07 14:54 ` [PATCH v2 1/4] drm/i915: add support for vga_switcheroo reprobe Ramkumar Ramachandra
2014-01-07 14:54 ` Ramkumar Ramachandra [this message]
2014-01-07 14:54 ` [PATCH v2 3/4] drm/i915: change intel_sdvo_get_edid() prototype Ramkumar Ramachandra
2014-01-07 14:54 ` [PATCH v2 4/4] drm/i915: introduce intel_connector->reprobe Ramkumar Ramachandra
2014-01-07 14:56 ` [INCOMPLETE PATCH v2 0/4] Get EDID late for VGA switcheroo Ramkumar Ramachandra
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=1389106472-11389-3-git-send-email-artagnon@gmail.com \
--to=artagnon@gmail.com \
--cc=andreas@meetr.de \
--cc=chris@chris-wilson.co.uk \
--cc=linux-kernel@vger.kernel.org \
--cc=seth.forshee@canonical.com \
/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
all inboxes | Powered by JetHome®