Skip to contentSkip to conversation

drm/radeon/kms: isolate audio engine management, change fini order

PATCH In review Rafał Miłecki 2 participants 3 messages Feb 11, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/radeon/kms: isolate audio engine management, change fini order

We should stop audio-state-reading timer before we turn off engine

---
 drivers/gpu/drm/radeon/r600_audio.c |   16 ++++++++++++----
 1 files changed, 12 insertions(+), 4 deletions(-)
drivers/gpu/drm/radeon/r600_audio.c +12 -4
index b1c1d34..d7f6909 100644
@@ -147,6 +147,15 @@ static void r600_audio_update_hdmi(unsigned long param)
 }
 
 /*
+ * turn on/off audio engine
+ */
+static void r600_audio_engine_enable(struct radeon_device *rdev, bool enable)
+{
+	DRM_INFO("%s audio support", enable ? "Enabling" : "Disabling");
+	WREG32_P(R600_AUDIO_ENABLE, enable ? 0x81000000 : 0x0, ~0x81000000);
+}
+
+/*
  * initialize the audio vars and register the update timer
  */
 int r600_audio_init(struct radeon_device *rdev)
@@ -154,8 +163,7 @@ int r600_audio_init(struct radeon_device *rdev)
 	if (!r600_audio_chipset_supported(rdev))
 		return 0;
 
-	DRM_INFO("%s audio support", radeon_audio ? "Enabling" : "Disabling");
-	WREG32_P(R600_AUDIO_ENABLE, radeon_audio ? 0x81000000 : 0x0, ~0x81000000);
+	r600_audio_engine_enable(rdev, radeon_audio);
 
 	rdev->audio_channels = -1;
 	rdev->audio_rate = -1;
@@ -261,7 +269,7 @@ void r600_audio_fini(struct radeon_device *rdev)
 	if (!r600_audio_chipset_supported(rdev))
 		return;
 
-	WREG32_P(R600_AUDIO_ENABLE, 0x0, ~0x81000000);
-
 	del_timer(&rdev->audio_timer);
+
+	r600_audio_engine_enable(rdev, false);
 }
Signature · 12 lines
1.6.4.2


------------------------------------------------------------------------------
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
--
_______________________________________________
Dri-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/dri-devel
#1 lore raw

2010/2/11 Rafał Miłecki <[email protected]>:

Quoted 12 lines

We should stop audio-state-reading timer before we turn off engine

---
 drivers/gpu/drm/radeon/r600_audio.c |   16 ++++++++++++----

 1 files changed, 12 insertions(+), 4 deletions(-)
drivers/gpu/drm/radeon/r600_audio.c +0 -0
index b1c1d34..d7f6909 100644

drivers/gpu/drm/radeon/r600_audio.c static void r600_audio_update_hdmi(unsigned long param) · line 155

Quoted 9 lines
drivers/gpu/drm/radeon/r600_audio.c +6 -0
@@ -147,6 +147,15 @@ static void r600_audio_update_hdmi(unsigned long param)
  }
 
  /*
+ * turn on/off audio engine
+ */
+static void r600_audio_engine_enable(struct radeon_device *rdev, bool enable)
+{
+       DRM_INFO("%s audio support", enable ? "Enabling" : "Disabling");
+       WREG32_P(R600_AUDIO_ENABLE, enable ? 0x81000000 : 0x0, ~0x81000000);

Maybe a #define instead of using magic numbers?

Quoted 30 lines
drivers/gpu/drm/radeon/r600_audio.c +6 -5
+}
+
+/*
  * initialize the audio vars and register the update timer
  */
  int r600_audio_init(struct radeon_device *rdev)
@@ -154,8 +163,7 @@ int r600_audio_init(struct radeon_device *rdev)
        if (!r600_audio_chipset_supported(rdev))
                return 0;
 
-       DRM_INFO("%s audio support", radeon_audio ? "Enabling" : "Disabling");
-       WREG32_P(R600_AUDIO_ENABLE, radeon_audio ? 0x81000000 : 0x0, ~0x81000000);
+       r600_audio_engine_enable(rdev, radeon_audio);
 
        rdev->audio_channels = -1;
        rdev->audio_rate = -1;
@@ -261,7 +269,7 @@ void r600_audio_fini(struct radeon_device *rdev)
        if (!r600_audio_chipset_supported(rdev))
                return;
 
-       WREG32_P(R600_AUDIO_ENABLE, 0x0, ~0x81000000);
-
        del_timer(&rdev->audio_timer);
+
+       r600_audio_engine_enable(rdev, false);
  }
--

1.6.4.2

Quoted 10 lines

------------------------------------------------------------------------------
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace, Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
--
_______________________________________________
Dri-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/dri-devel

------------------------------------------------------------------------------
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace, Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
--
_______________________________________________
Dri-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/dri-devel

#2 lore raw
Quoted 15 lines · W dniu 11 lutego 2010 23:19 użytkownik Matt Turner <[email protected]> napisał:

2010/2/11 Rafał Miłecki <[email protected]>:

Quoted 14 lines

We should stop audio-state-reading timer before we turn off engine

---
 drivers/gpu/drm/radeon/r600_audio.c |   16 ++++++++++++----

 1 files changed, 12 insertions(+), 4 deletions(-)
drivers/gpu/drm/radeon/r600_audio.c +0 -0
index b1c1d34..d7f6909 100644
@@ -147,6 +147,15 @@ static void r600_audio_update_hdmi(unsigned long param)
  }
 
Quoted 9 lines

drivers/gpu/drm/radeon/r600_audio.c static void r600_audio_update_hdmi(unsigned long param) · line 155

Quoted 7 lines
drivers/gpu/drm/radeon/r600_audio.c +6 -0
  /*
+ * turn on/off audio engine
+ */
+static void r600_audio_engine_enable(struct radeon_device *rdev, bool enable)
+{
+       DRM_INFO("%s audio support", enable ? "Enabling" : "Disabling");
+       WREG32_P(R600_AUDIO_ENABLE, enable ? 0x81000000 : 0x0, ~0x81000000);

Maybe a #define instead of using magic numbers?

I was thinking about that, actually we have much more magics in r600_audio.c. Many masks and shifts are not defined. However I would have to just guess some names which is acceptable, but I believe we will get real names finally released soon. Alex wrote fixes for audio, patches are waiting for IP review.

In this situation I prefer to just leave it as is for now. It's probably not worth of cleaning that if this will be over-cleaned anyway.

Signature · 11 lines
Rafał

------------------------------------------------------------------------------
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
--
_______________________________________________
Dri-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/dri-devel