summaryrefslogtreecommitdiff
path: root/sys/dev/audio.c
diff options
context:
space:
mode:
authordyoung <dyoung@NetBSD.org>2008-03-12 18:02:21 +0000
committerdyoung <dyoung@NetBSD.org>2008-03-12 18:02:21 +0000
commit3df2b2feb5ec81dbf34ffb230078ff45e416489a (patch)
tree95e014f7e88d3c18f858be14e80133e9435df658 /sys/dev/audio.c
parent15bb494e456ec9a47b21cc5a3e96f57807f590f0 (diff)
Use device_t and its accessors throughout. Use aprint_*_dev().
Improve PMF-ability. Add a 'flags' argument to suspend/resume handlers and callers such as pmf_system_suspend(). Define a flag, PMF_F_SELF, which indicates to PMF that a device is suspending/resuming itself. Add helper routines, pmf_device_suspend_self(dev) and pmf_device_resume_self(dev), that call pmf_device_suspend(dev, PMF_F_SELF) and pmf_device_resume(dev, PMF_F_SELF), respectively. Use PMF_F_SELF to suspend/resume self in ath(4), audio(4), rtw(4), and sip(4). In ath(4) and in rtw(4), replace the icky sc_enable/sc_disable callbacks, provided by the bus front-end, with self-suspension/resumption. Also, clean up the bus front-ends. Make sure that the interrupt handler is disestablished during suspension. Get rid of driver-private flags (e.g., RTW_F_ENABLED, ath_softc->sc_invalid); use device_is_active()/device_has_power() calls, instead. In the network-class suspend handler, call if_stop(, 0) instead of if_stop(, 1), because the latter is superfluous (bus- and driver-suspension hooks will 'disable' the NIC), and it may cause recursion. In the network-class resume handler, prevent infinite recursion through if_init() by getting out early if we are self-suspending (PMF_F_SELF). rtw(4) improvements: Destroy rtw(4) callouts when we detach it. Make rtw at pci detachable. Print some more information with the "rx frame too long" warning. Remove activate() methods: Get rid of rtw_activate() and ath_activate(). The device activate() methods are not good for much these days. Make ath at cardbus resume with crypto functions intact: Introduce a boolean device property, "pmf-powerdown". If pmf-powerdown is present and false, it indicates that a bus back-end should not remove power from a device. Honor this property in cardbus_child_suspend(). Set this property to 'false' in ath_attach(), since removing power from an ath at cardbus seems to lobotomize the WPA crypto engine. XXX Should the pmf-powerdown property propagate toward the root of the device tree? Miscellaneous ath(4) changes: Warn if ath(4) tries to write crypto keys to suspended hardware. Reduce differences between FreeBSD and NetBSD in ath(4) multicast filter setup. Make ath_printrxbuf() print an rx descriptor's status & key index, to help debug crypto errors. Shorten a staircase in ath_ioctl(). Don't check for ieee80211_ioctl() return code ERESTART, it never happens.
Diffstat (limited to 'sys/dev/audio.c')
-rw-r--r--sys/dev/audio.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/sys/dev/audio.c b/sys/dev/audio.c
index 62f7b525b1d..90214df0d2b 100644
--- a/sys/dev/audio.c
+++ b/sys/dev/audio.c
@@ -1,4 +1,4 @@
-/* $NetBSD: audio.c,v 1.236 2008/03/04 18:23:44 cube Exp $ */
+/* $NetBSD: audio.c,v 1.237 2008/03/12 18:02:21 dyoung Exp $ */
/*
* Copyright (c) 1991-1993 Regents of the University of California.
@@ -61,7 +61,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.236 2008/03/04 18:23:44 cube Exp $");
+__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.237 2008/03/12 18:02:21 dyoung Exp $");
#include "audio.h"
#if NAUDIO > 0
@@ -183,8 +183,8 @@ static void audio_idle(void *);
static void audio_activity(device_t, devactive_t);
#endif
-static bool audio_suspend(device_t dv);
-static bool audio_resume(device_t dv);
+static bool audio_suspend(device_t dv PMF_FN_PROTO);
+static bool audio_resume(device_t dv PMF_FN_PROTO);
static void audio_volume_down(device_t);
static void audio_volume_up(device_t);
static void audio_volume_toggle(device_t);
@@ -3993,11 +3993,11 @@ audio_idle(void *arg)
sc->sc_idle = true;
/* XXX joerg Make pmf_device_suspend handle children? */
- if (!pmf_device_suspend(dv))
+ if (!pmf_device_suspend(dv, PMF_F_SELF))
return;
- if (!pmf_device_suspend(sc->sc_dev))
- pmf_device_resume(dv);
+ if (!pmf_device_suspend(sc->sc_dev, PMF_F_SELF))
+ pmf_device_resume(dv, PMF_F_SELF);
}
static void
@@ -4013,14 +4013,14 @@ audio_activity(device_t dv, devactive_t type)
sc->sc_idle = false;
if (!device_is_active(dv)) {
/* XXX joerg How to deal with a failing resume... */
- pmf_device_resume(sc->sc_dev);
- pmf_device_resume(dv);
+ pmf_device_resume(sc->sc_dev, PMF_F_SELF);
+ pmf_device_resume(dv, PMF_F_SELF);
}
}
#endif
static bool
-audio_suspend(device_t dv)
+audio_suspend(device_t dv PMF_FN_ARGS)
{
struct audio_softc *sc = device_private(dv);
const struct audio_hw_if *hwp = sc->hw_if;
@@ -4041,7 +4041,7 @@ audio_suspend(device_t dv)
}
static bool
-audio_resume(device_t dv)
+audio_resume(device_t dv PMF_FN_ARGS)
{
struct audio_softc *sc = device_private(dv);
int s;