All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@intel.com>
To: intel-gfx@lists.freedesktop.org, daniel@ffwll.ch
Cc: jani.nikula@intel.com
Subject: [PATCH 03/10] drm/i915/lvds: Move the acpi_lid_notifier from drm_i915_private to the connector
Date: Fri, 19 Oct 2012 14:51:45 +0300	[thread overview]
Message-ID: <2be782145196cee838ff0d188671c72db3c27340.1350644022.git.jani.nikula@intel.com> (raw)
In-Reply-To: <cover.1350644022.git.jani.nikula@intel.com>
In-Reply-To: <cover.1350644022.git.jani.nikula@intel.com>

Based on earlier work by Chris Wilson <chris@chris-wilson.co.uk>

CC: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
 drivers/gpu/drm/i915/i915_drv.h   |    2 --
 drivers/gpu/drm/i915/intel_lvds.c |   32 +++++++++++++++++---------------
 2 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 4728d30..f63ae1c 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -507,8 +507,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[I915_MAX_NUM_FENCES]; /* assume 965 */
 	int fence_reg_start; /* 4 if userland hasn't ioctl'd us yet */
diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c
index 4a2f6fa..f3edbf6 100644
--- a/drivers/gpu/drm/i915/intel_lvds.c
+++ b/drivers/gpu/drm/i915/intel_lvds.c
@@ -43,6 +43,8 @@
 /* Private structure for the integrated LVDS support */
 struct intel_lvds_connector {
 	struct intel_connector base;
+
+	struct notifier_block lid_notifier;
 };
 
 struct intel_lvds_encoder {
@@ -506,10 +508,11 @@ 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_connector *connector = &lvds_connector->base.base;
+	struct drm_device *dev = connector->dev;
+	struct drm_i915_private *dev_priv = dev->dev_private;
 
 	if (dev->switch_power_state != DRM_SWITCH_POWER_ON)
 		return NOTIFY_OK;
@@ -518,9 +521,7 @@ static int intel_lid_notify(struct notifier_block *nb, unsigned long val,
 	 * check and update the status of LVDS connector after receiving
 	 * the LID nofication event.
 	 */
-	if (connector)
-		connector->status = connector->funcs->detect(connector,
-							     false);
+	connector->status = connector->funcs->detect(connector, false);
 
 	/* Don't force modeset on machines where it causes a GPU lockup */
 	if (dmi_check_system(intel_no_modeset_on_lid))
@@ -551,13 +552,14 @@ static int intel_lid_notify(struct notifier_block *nb, unsigned long val,
  */
 static void intel_lvds_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);
 
-	intel_panel_destroy_backlight(dev);
+	intel_panel_destroy_backlight(connector->dev);
 
-	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);
@@ -1097,10 +1099,10 @@ out:
 		I915_WRITE(PP_CONTROL,
 			   I915_READ(PP_CONTROL) | PANEL_UNLOCK_REGS);
 	}
-	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;
-- 
1.7.9.5

  parent reply	other threads:[~2012-10-19 11:47 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 01/10] drm/i915/lvds: Rename intel_lvds to intel_lvds_encoder Jani Nikula
2012-10-19 16:46   ` Jesse Barnes
2012-10-19 11:51 ` [PATCH 02/10] drm/i915/lvds: Introduce intel_lvds_connector Jani Nikula
2012-10-19 16:47   ` Jesse Barnes
2012-10-19 11:51 ` Jani Nikula [this message]
2012-10-19 16:48   ` [PATCH 03/10] drm/i915/lvds: Move the acpi_lid_notifier from drm_i915_private to the connector Jesse Barnes
2012-10-19 11:51 ` [PATCH 04/10] drm/i915: Backlight setup requires connector so pass it as parameter Jani Nikula
2012-10-19 16:54   ` Jesse Barnes
2012-10-19 11:51 ` [PATCH 05/10] drm/i915/lvds: Move some connector specific info across from the encoder Jani Nikula
2012-10-19 16:55   ` Jesse Barnes
2012-10-19 11:51 ` [PATCH 06/10] drm/i915/dp: Initialize eDP fixed mode in intel_dp_init Jani Nikula
2012-10-19 17:00   ` Jesse Barnes
2012-10-19 11:51 ` [PATCH 07/10] drm/i915: Create generic intel_panel for LVDS and eDP Jani Nikula
2012-10-19 17:04   ` Jesse Barnes
2012-10-19 11:51 ` [PATCH 08/10] drm/i915: Move the fixed mode to intel_panel Jani Nikula
2012-10-19 17:09   ` Jesse Barnes
2012-10-19 11:51 ` [PATCH 09/10] drm/i915: Do not free the passed EDID in intel_connector_update_modes() Jani Nikula
2012-10-19 17:10   ` Jesse Barnes
2012-10-19 11:51 ` [PATCH 10/10] drm/i915: Move cached EDID to intel_connector Jani Nikula
2012-10-19 17:13   ` Jesse Barnes
2012-10-19 17:58 ` [PATCH 00/10] drm/i915: LVDS/eDP panel, EDID and fixed mode refactoring Chris Wilson
2012-10-22 17:37   ` Daniel Vetter
  -- strict thread matches above, loose matches on Subject: below --
2011-04-22  9:19 Share common logic between eDP and LVDS in panel Chris Wilson
2011-04-22  9:19 ` [PATCH 03/10] drm/i915/lvds: Move the acpi_lid_notifier from drm_i915_private to the connector Chris Wilson
2011-04-22 16:19   ` 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=2be782145196cee838ff0d188671c72db3c27340.1350644022.git.jani.nikula@intel.com \
    --to=jani.nikula@intel.com \
    --cc=daniel@ffwll.ch \
    --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.