[alsa-devel] [PATCH] hda-emu: Add support for new pm_notify callback format
David Henningsson
david.henningsson at canonical.com
Wed Sep 5 16:10:26 CEST 2012
The format of the pm_notify callback has recently changed.
Signed-off-by: David Henningsson <david.henningsson at canonical.com>
---
configure.ac | 24 ++++++++++++++++++++++++
hda-emu.c | 12 ++++++++++++
2 files changed, 36 insertions(+)
diff --git a/configure.ac b/configure.ac
index 18118f3..43db88f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -222,6 +222,30 @@ if test "$OLD_HDA_CMD" = "1"; then
AC_DEFINE(OLD_HDA_CMD)
fi
+AC_MSG_CHECKING(for new pm_notify callback)
+ac_save_CFLAGS="$CFLAGS"
+CFLAGS="$CFLAGS -Iinclude"
+HAVE_NEW_PM_NOTIFY=
+AC_TRY_COMPILE([
+#include "hda-types.h"
+#include "hda-log.h"
+#include <sound/driver.h>
+#include <sound/core.h>
+#include <sound/pcm.h>
+#include "kernel/hda_codec.h"
+],[
+ extern struct hda_bus_ops *ops;
+ ops->pm_notify(NULL, 0);
+],
+ [AC_MSG_RESULT(yes); HAVE_NEW_PM_NOTIFY="1"],
+ [AC_MSG_RESULT(no)],
+ [AC_MSG_RESULT(unknown)]
+)
+CFLAGS=$ac_save_CFLAGS
+if test "$HAVE_NEW_PM_NOTIFY" = "1"; then
+ AC_DEFINE(HAVE_NEW_PM_NOTIFY)
+fi
+
AC_MSG_CHECKING(for attach_pcm bus ops)
ac_save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -Iinclude"
diff --git a/hda-emu.c b/hda-emu.c
index b4bd8a9..2a2b3d1 100644
--- a/hda-emu.c
+++ b/hda-emu.c
@@ -776,6 +776,13 @@ static int azx_pcm_create(struct hda_codec *codec)
* power management
*/
+#ifdef HAVE_NEW_PM_NOTIFY
+static void new_pm_notify(struct hda_bus *bus, bool power_up)
+{
+ hda_log(HDA_LOG_INFO, "PM-Notified, power_up = %d\n", power_up);
+}
+#else
+
static void pm_notify(struct hda_bus *bus)
{
hda_log(HDA_LOG_INFO, "PM-Notified\n");
@@ -787,6 +794,7 @@ static void old_pm_notify(struct hda_codec *codec)
pm_notify(codec->bus);
}
#endif
+#endif /* HAVE_NEW_PM_NOTIFY */
/*
@@ -1112,7 +1120,11 @@ int main(int argc, char **argv)
#ifdef HAVE_HDA_ATTACH_PCM
temp.ops.attach_pcm = attach_pcm;
#endif
+#ifdef HAVE_NEW_PM_NOTIFY
+ temp.ops.pm_notify = new_pm_notify;
+#else
temp.ops.pm_notify = pm_notify;
+#endif
#endif /* OLD_HDA_CMD */
gather_codec_hooks();
--
1.7.9.5
More information about the Alsa-devel
mailing list