From: Heikki Krogerus <heikki.krogerus@linux.intel.com>
To: Jani Nikula <jani.nikula@linux.intel.com>,
Joonas Lahtinen <joonas.lahtinen@linux.intel.com>,
Rodrigo Vivi <rodrigo.vivi@intel.com>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
Maxime Ripard <maxime.ripard@bootlin.com>,
Sean Paul <sean@poorly.run>, David Airlie <airlied@linux.ie>,
Daniel Vetter <daniel@ffwll.ch>,
Hans de Goede <hdegoede@redhat.com>,
dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org,
linux-kernel@vger.kernel.org
Subject: [PATCH 2/2] drm/i915: Associate ACPI connector nodes with connector entries
Date: Mon, 25 Mar 2019 16:16:41 +0300 [thread overview]
Message-ID: <20190325131641.71076-3-heikki.krogerus@linux.intel.com> (raw)
In-Reply-To: <20190325131641.71076-1-heikki.krogerus@linux.intel.com>
On Intel platforms we know that the ACPI connector device
node order will follow the order the driver (i915) decides.
The decision is made using the custom Intel ACPI OpRegion
(intel_opregion.c), though the driver does not actually know
that the values it sends to ACPI there are used for
associating a device node for the connectors, and assigning
address for them.
In reality that custom Intel ACPI OpRegion actually violates
ACPI specification (we supply dynamic information to objects
that are defined static, for example _ADR), however, it
makes assigning correct connector node for a connector entry
straightforward (it's one-on-one mapping).
Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
---
drivers/gpu/drm/i915/intel_display.c | 40 ++++++++++++++++++++++++++++
1 file changed, 40 insertions(+)
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 008560ef4db0..27aea2ef80ac 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -15526,6 +15526,45 @@ static int intel_initial_commit(struct drm_device *dev)
return ret;
}
+/* NOTE: The connector order must be final before this is called. */
+static void intel_assign_connector_fwnodes(struct drm_device *dev)
+{
+ struct drm_connector_list_iter conn_iter;
+ struct device *kdev = &dev->pdev->dev;
+ struct fwnode_handle *fwnode = NULL;
+ struct drm_connector *connector;
+ struct acpi_device *adev;
+
+ drm_connector_list_iter_begin(dev, &conn_iter);
+ drm_for_each_connector_iter(connector, &conn_iter) {
+ /* Always getting the next, even when the last was not used. */
+ fwnode = device_get_next_child_node(kdev, fwnode);
+ if (!fwnode)
+ break;
+
+ switch (connector->connector_type) {
+ case DRM_MODE_CONNECTOR_LVDS:
+ case DRM_MODE_CONNECTOR_eDP:
+ case DRM_MODE_CONNECTOR_DSI:
+ /*
+ * Integrated displays have a specific address 0x1f on
+ * most Intel platforms, but not on all of them.
+ */
+ adev = acpi_find_child_device(ACPI_COMPANION(kdev),
+ 0x1f, 0);
+ if (adev) {
+ connector->fwnode = acpi_fwnode_handle(adev);
+ break;
+ }
+ /* fallthrough */
+ default:
+ connector->fwnode = fwnode;
+ break;
+ }
+ }
+ drm_connector_list_iter_end(&conn_iter);
+}
+
int intel_modeset_init(struct drm_device *dev)
{
struct drm_i915_private *dev_priv = to_i915(dev);
@@ -15630,6 +15669,7 @@ int intel_modeset_init(struct drm_device *dev)
drm_modeset_lock_all(dev);
intel_modeset_setup_hw_state(dev, dev->mode_config.acquire_ctx);
+ intel_assign_connector_fwnodes(dev);
drm_modeset_unlock_all(dev);
for_each_intel_crtc(dev, crtc) {
--
2.20.1
next prev parent reply other threads:[~2019-03-25 13:16 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-25 13:16 [PATCH 0/2] drm: connector firmware nodes Heikki Krogerus
2019-03-25 13:16 ` [PATCH 1/2] drm: Add fwnode member to the struct drm_connector Heikki Krogerus
2019-03-25 13:16 ` Heikki Krogerus [this message]
2019-03-25 13:47 ` ✓ Fi.CI.BAT: success for drm: connector firmware nodes Patchwork
2019-03-25 20:57 ` ✗ Fi.CI.IGT: failure " Patchwork
2019-03-26 8:32 ` Heikki Krogerus
2019-03-26 15:16 ` Saarinen, Jani
2019-03-27 15:38 ` Heikki Krogerus
2019-03-27 15:59 ` Tvrtko Ursulin
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=20190325131641.71076-3-heikki.krogerus@linux.intel.com \
--to=heikki.krogerus@linux.intel.com \
--cc=airlied@linux.ie \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=hdegoede@redhat.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=jani.nikula@linux.intel.com \
--cc=joonas.lahtinen@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=maxime.ripard@bootlin.com \
--cc=rodrigo.vivi@intel.com \
--cc=sean@poorly.run \
/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