diff mbox

[2/6] drm/i915: manage opregion asle driver readiness properly

Message ID 9738af3e4d9304e1d56dcd8631f0552e8e13d2a8.1367223972.git.jani.nikula@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Jani Nikula April 29, 2013, 10:02 a.m. UTC
Only set ASLE driver readiness (ARDY) and technology enabled indicator
(TCHE) once per opregion init. There should be no need to do that at irq
postinstall time. Also clear driver readiness at fini.

While at it, add defines for driver readiness.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
 drivers/gpu/drm/i915/intel_opregion.c |   18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

Comments

Lespiau, Damien April 29, 2013, 11:23 a.m. UTC | #1
On Mon, Apr 29, 2013 at 01:02:51PM +0300, Jani Nikula wrote:
> Only set ASLE driver readiness (ARDY) and technology enabled indicator
> (TCHE) once per opregion init. There should be no need to do that at irq
> postinstall time. Also clear driver readiness at fini.
> 
> While at it, add defines for driver readiness.
> 
> Signed-off-by: Jani Nikula <jani.nikula@intel.com>

Reviewed-by: Damien Lespiau <damien.lespiau@intel.com>
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/intel_opregion.c b/drivers/gpu/drm/i915/intel_opregion.c
index 75062e0..5b6d202 100644
--- a/drivers/gpu/drm/i915/intel_opregion.c
+++ b/drivers/gpu/drm/i915/intel_opregion.c
@@ -110,6 +110,10 @@  struct opregion_asle {
 	u8 rsvd[102];
 } __attribute__((packed));
 
+/* Driver readiness indicator */
+#define ASLE_ARDY_READY		(1 << 0)
+#define ASLE_ARDY_NOT_READY	(0 << 0)
+
 /* ASLE irq request bits */
 #define ASLE_SET_ALS_ILLUM     (1 << 0)
 #define ASLE_SET_BACKLIGHT     (1 << 1)
@@ -236,9 +240,6 @@  void intel_opregion_enable_asle(struct drm_device *dev)
 	if (asle) {
 		if (IS_MOBILE(dev))
 			intel_enable_asle(dev);
-
-		iowrite32(ASLE_TCHE_BLC_EN, &asle->tche);
-		iowrite32(1, &asle->ardy);
 	}
 }
 
@@ -425,8 +426,12 @@  void intel_opregion_init(struct drm_device *dev)
 		register_acpi_notifier(&intel_opregion_notifier);
 	}
 
-	if (opregion->asle)
+	if (opregion->asle) {
 		intel_opregion_enable_asle(dev);
+
+		iowrite32(ASLE_TCHE_BLC_EN, &opregion->asle->tche);
+		iowrite32(ASLE_ARDY_READY, &opregion->asle->ardy);
+	}
 }
 
 void intel_opregion_fini(struct drm_device *dev)
@@ -437,6 +442,9 @@  void intel_opregion_fini(struct drm_device *dev)
 	if (!opregion->header)
 		return;
 
+	if (opregion->asle)
+		iowrite32(ASLE_ARDY_NOT_READY, &opregion->asle->ardy);
+
 	if (opregion->acpi) {
 		iowrite32(0, &opregion->acpi->drdy);
 
@@ -499,6 +507,8 @@  int intel_opregion_setup(struct drm_device *dev)
 	if (mboxes & MBOX_ASLE) {
 		DRM_DEBUG_DRIVER("ASLE supported\n");
 		opregion->asle = base + OPREGION_ASLE_OFFSET;
+
+		iowrite32(ASLE_ARDY_NOT_READY, &opregion->asle->ardy);
 	}
 
 	return 0;