All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chris Wilson <chris@chris-wilson.co.uk>
To: intel-gfx@lists.freedesktop.org
Subject: [PATCH 03/10] drm/i915/lvds: Move the acpi_lid_notifier from drm_i915_private to the connector
Date: Fri, 22 Apr 2011 10:19:11 +0100	[thread overview]
Message-ID: <1303463958-17128-4-git-send-email-chris@chris-wilson.co.uk> (raw)
In-Reply-To: <1303463958-17128-1-git-send-email-chris@chris-wilson.co.uk>

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 drivers/gpu/drm/i915/i915_drv.h   |    3 ---
 drivers/gpu/drm/i915/intel_lvds.c |   33 +++++++++++++++++----------------
 2 files changed, 17 insertions(+), 19 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index b214709..4c96dfc 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -364,8 +364,6 @@ typedef struct drm_i915_private {
 	} edp;
 	bool no_aux_handshake;
 
-	struct notifier_block lid_notifier;
-
 	int crt_ddc_pin;
 	struct drm_i915_fence_reg fence_regs[16]; /* assume 965 */
 	int fence_reg_start; /* 4 if userland hasn't ioctl'd us yet */
@@ -682,7 +680,6 @@ typedef struct drm_i915_private {
 	u16 orig_clock;
 	int child_dev_num;
 	struct child_device_config *child_dev;
-	struct drm_connector *int_lvds_connector;
 
 	bool mchbar_need_disable;
 
diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c
index d82c8da..e0ada0c 100644
--- a/drivers/gpu/drm/i915/intel_lvds.c
+++ b/drivers/gpu/drm/i915/intel_lvds.c
@@ -56,6 +56,8 @@ struct intel_lvds_encoder {
 
 struct intel_lvds_connector {
 	struct intel_connector base;
+
+	struct notifier_block lid_notifier;
 };
 
 static struct intel_lvds_encoder *to_lvds_encoder(struct drm_encoder *encoder)
@@ -543,18 +545,18 @@ static const struct dmi_system_id intel_no_modeset_on_lid[] = {
 static int intel_lid_notify(struct notifier_block *nb, unsigned long val,
 			    void *unused)
 {
-	struct drm_i915_private *dev_priv =
-		container_of(nb, struct drm_i915_private, lid_notifier);
-	struct drm_device *dev = dev_priv->dev;
-	struct drm_connector *connector = dev_priv->int_lvds_connector;
+	struct intel_lvds_connector *lvds_connector =
+		container_of(nb, struct intel_lvds_connector, lid_notifier);
+	struct drm_device *dev = lvds_connector->base.base.dev;
+	struct drm_i915_private *dev_priv = dev->dev_private;
 
 	/*
 	 * check and update the status of LVDS connector after receiving
 	 * the LID nofication event.
 	 */
-	if (connector)
-		connector->status = connector->funcs->detect(connector,
-							     false);
+	lvds_connector->base.base.status =
+		lvds_connector->base.base.funcs->detect(&lvds_connector->base.base,
+							false);
 
 	/* Don't force modeset on machines where it causes a GPU lockup */
 	if (dmi_check_system(intel_no_modeset_on_lid))
@@ -585,11 +587,12 @@ static int intel_lid_notify(struct notifier_block *nb, unsigned long val,
  */
 static void intel_lvds_connector_destroy(struct drm_connector *connector)
 {
-	struct drm_device *dev = connector->dev;
-	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct intel_lvds_connector *lvds_connector =
+		to_lvds_connector(connector);
+
+	if (lvds_connector->lid_notifier.notifier_call)
+		acpi_lid_notifier_unregister(&lvds_connector->lid_notifier);
 
-	if (dev_priv->lid_notifier.notifier_call)
-		acpi_lid_notifier_unregister(&dev_priv->lid_notifier);
 	drm_sysfs_connector_remove(connector);
 	drm_connector_cleanup(connector);
 	kfree(connector);
@@ -1061,13 +1064,11 @@ out:
 		pwm |= PWM_PCH_ENABLE;
 		I915_WRITE(BLC_PWM_PCH_CTL1, pwm);
 	}
-	dev_priv->lid_notifier.notifier_call = intel_lid_notify;
-	if (acpi_lid_notifier_register(&dev_priv->lid_notifier)) {
+	lvds_connector->lid_notifier.notifier_call = intel_lid_notify;
+	if (acpi_lid_notifier_register(&lvds_connector->lid_notifier)) {
 		DRM_DEBUG_KMS("lid notifier registration failed\n");
-		dev_priv->lid_notifier.notifier_call = NULL;
+		lvds_connector->lid_notifier.notifier_call = NULL;
 	}
-	/* keep the LVDS connector */
-	dev_priv->int_lvds_connector = connector;
 	drm_sysfs_connector_add(connector);
 	return true;
 
-- 
1.7.4.1

  parent reply	other threads:[~2011-04-22  9:19 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-22  9:19 Share common logic between eDP and LVDS in panel Chris Wilson
2011-04-22  9:19 ` [PATCH 01/10] drm/i915/lvds: Rename intel_lvds to intel_lvds_encoder Chris Wilson
2011-04-22 16:18   ` Jesse Barnes
2011-04-22  9:19 ` [PATCH 02/10] drm/i915/lvds: Introduce intel_lvds_connector Chris Wilson
2011-04-22 16:18   ` Jesse Barnes
2011-04-22 17:50   ` Ben Widawsky
2011-04-22 18:07     ` Chris Wilson
2011-04-22  9:19 ` Chris Wilson [this message]
2011-04-22 16:19   ` [PATCH 03/10] drm/i915/lvds: Move the acpi_lid_notifier from drm_i915_private to the connector Jesse Barnes
2011-04-22  9:19 ` [PATCH 04/10] drm/i915/lvds: Move some connector specific info across from the encoder Chris Wilson
2011-04-22 16:20   ` Jesse Barnes
2011-04-22  9:19 ` [PATCH 05/10] drm/i915: Move the ACPI lid notifier away from LVDS to the generic panel Chris Wilson
2011-04-22 16:21   ` Jesse Barnes
2011-04-22  9:19 ` [PATCH 06/10] drm/i915/dp: Enable lid notifier for eDP Chris Wilson
2011-04-22  9:19 ` [PATCH 07/10] drm/i915: Move the fixed_mode away from drm_i915_private and to the panel Chris Wilson
2011-04-22 16:23   ` Jesse Barnes
2011-04-22  9:19 ` [PATCH 08/10] drm/i915/dp: If the panel has a fixed_mode, it can only be eDP Chris Wilson
2011-04-22 16:24   ` Jesse Barnes
2011-04-22  9:19 ` [PATCH 09/10] drm/i015: Share the EDID caching logic and mode query between LVDS and eDP Chris Wilson
2011-04-22 16:26   ` Jesse Barnes
2011-04-22  9:19 ` [PATCH 10/10] drm/i915: Only force a modeset on a lid event if fbcon is active Chris Wilson
2011-04-22 16:27   ` Jesse Barnes
2012-10-19 11:51 [PATCH 00/10] drm/i915: LVDS/eDP panel, EDID and fixed mode refactoring Jani Nikula
2012-10-19 11:51 ` [PATCH 03/10] drm/i915/lvds: Move the acpi_lid_notifier from drm_i915_private to the connector Jani Nikula
2012-10-19 16:48   ` Jesse Barnes

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=1303463958-17128-4-git-send-email-chris@chris-wilson.co.uk \
    --to=chris@chris-wilson.co.uk \
    --cc=intel-gfx@lists.freedesktop.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.