| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: audio.c,v 1.91.2.3 2021/03/21 21:09:09 thorpej Exp $ */ | | 1 | /* $NetBSD: audio.c,v 1.91.2.4 2021/03/28 19:55:37 thorpej Exp $ */ |
2 | | | 2 | |
3 | /*- | | 3 | /*- |
4 | * Copyright (c) 2008 The NetBSD Foundation, Inc. | | 4 | * Copyright (c) 2008 The NetBSD Foundation, Inc. |
5 | * All rights reserved. | | 5 | * All rights reserved. |
6 | * | | 6 | * |
7 | * This code is derived from software contributed to The NetBSD Foundation | | 7 | * This code is derived from software contributed to The NetBSD Foundation |
8 | * by Andrew Doran. | | 8 | * by Andrew Doran. |
9 | * | | 9 | * |
10 | * Redistribution and use in source and binary forms, with or without | | 10 | * Redistribution and use in source and binary forms, with or without |
11 | * modification, are permitted provided that the following conditions | | 11 | * modification, are permitted provided that the following conditions |
12 | * are met: | | 12 | * are met: |
13 | * 1. Redistributions of source code must retain the above copyright | | 13 | * 1. Redistributions of source code must retain the above copyright |
14 | * notice, this list of conditions and the following disclaimer. | | 14 | * notice, this list of conditions and the following disclaimer. |
| @@ -128,27 +128,27 @@ | | | @@ -128,27 +128,27 @@ |
128 | * get_locks - - Called at attach time | | 128 | * get_locks - - Called at attach time |
129 | * | | 129 | * |
130 | * In addition, there is an additional lock. | | 130 | * In addition, there is an additional lock. |
131 | * | | 131 | * |
132 | * - track->lock. This is an atomic variable and is similar to the | | 132 | * - track->lock. This is an atomic variable and is similar to the |
133 | * "interrupt lock". This is one for each track. If any thread context | | 133 | * "interrupt lock". This is one for each track. If any thread context |
134 | * (and software interrupt context) and hardware interrupt context who | | 134 | * (and software interrupt context) and hardware interrupt context who |
135 | * want to access some variables on this track, they must acquire this | | 135 | * want to access some variables on this track, they must acquire this |
136 | * lock before. It protects track's consistency between hardware | | 136 | * lock before. It protects track's consistency between hardware |
137 | * interrupt context and others. | | 137 | * interrupt context and others. |
138 | */ | | 138 | */ |
139 | | | 139 | |
140 | #include <sys/cdefs.h> | | 140 | #include <sys/cdefs.h> |
141 | __KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.91.2.3 2021/03/21 21:09:09 thorpej Exp $"); | | 141 | __KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.91.2.4 2021/03/28 19:55:37 thorpej Exp $"); |
142 | | | 142 | |
143 | #ifdef _KERNEL_OPT | | 143 | #ifdef _KERNEL_OPT |
144 | #include "audio.h" | | 144 | #include "audio.h" |
145 | #include "midi.h" | | 145 | #include "midi.h" |
146 | #endif | | 146 | #endif |
147 | | | 147 | |
148 | #if NAUDIO > 0 | | 148 | #if NAUDIO > 0 |
149 | | | 149 | |
150 | #include <sys/types.h> | | 150 | #include <sys/types.h> |
151 | #include <sys/param.h> | | 151 | #include <sys/param.h> |
152 | #include <sys/atomic.h> | | 152 | #include <sys/atomic.h> |
153 | #include <sys/audioio.h> | | 153 | #include <sys/audioio.h> |
154 | #include <sys/conf.h> | | 154 | #include <sys/conf.h> |
| @@ -1101,27 +1101,27 @@ audioattach(device_t parent, device_t se | | | @@ -1101,27 +1101,27 @@ audioattach(device_t parent, device_t se |
1101 | aprint_error_dev(self, "couldn't add volume up handler\n"); | | 1101 | aprint_error_dev(self, "couldn't add volume up handler\n"); |
1102 | if (!pmf_event_register(self, PMFE_AUDIO_VOLUME_TOGGLE, | | 1102 | if (!pmf_event_register(self, PMFE_AUDIO_VOLUME_TOGGLE, |
1103 | audio_volume_toggle, true)) | | 1103 | audio_volume_toggle, true)) |
1104 | aprint_error_dev(self, "couldn't add volume toggle handler\n"); | | 1104 | aprint_error_dev(self, "couldn't add volume toggle handler\n"); |
1105 | | | 1105 | |
1106 | #ifdef AUDIO_PM_IDLE | | 1106 | #ifdef AUDIO_PM_IDLE |
1107 | callout_schedule(&sc->sc_idle_counter, audio_idle_timeout * hz); | | 1107 | callout_schedule(&sc->sc_idle_counter, audio_idle_timeout * hz); |
1108 | #endif | | 1108 | #endif |
1109 | | | 1109 | |
1110 | #if defined(AUDIO_DEBUG) | | 1110 | #if defined(AUDIO_DEBUG) |
1111 | audio_mlog_init(); | | 1111 | audio_mlog_init(); |
1112 | #endif | | 1112 | #endif |
1113 | | | 1113 | |
1114 | audiorescan(self, "audio", NULL); | | 1114 | audiorescan(self, NULL, NULL); |
1115 | sc->sc_exlock = 0; | | 1115 | sc->sc_exlock = 0; |
1116 | return; | | 1116 | return; |
1117 | | | 1117 | |
1118 | bad: | | 1118 | bad: |
1119 | /* Clearing hw_if means that device is attached but disabled. */ | | 1119 | /* Clearing hw_if means that device is attached but disabled. */ |
1120 | sc->hw_if = NULL; | | 1120 | sc->hw_if = NULL; |
1121 | sc->sc_exlock = 0; | | 1121 | sc->sc_exlock = 0; |
1122 | aprint_error_dev(sc->sc_dev, "disabled\n"); | | 1122 | aprint_error_dev(sc->sc_dev, "disabled\n"); |
1123 | return; | | 1123 | return; |
1124 | } | | 1124 | } |
1125 | | | 1125 | |
1126 | /* | | 1126 | /* |
1127 | * Initialize hardware mixer. | | 1127 | * Initialize hardware mixer. |
| @@ -1406,28 +1406,26 @@ audiosearch(device_t parent, cfdata_t cf | | | @@ -1406,28 +1406,26 @@ audiosearch(device_t parent, cfdata_t cf |
1406 | if (config_match(parent, cf, aux)) | | 1406 | if (config_match(parent, cf, aux)) |
1407 | config_attach_loc(parent, cf, locs, aux, NULL); | | 1407 | config_attach_loc(parent, cf, locs, aux, NULL); |
1408 | | | 1408 | |
1409 | return 0; | | 1409 | return 0; |
1410 | } | | 1410 | } |
1411 | | | 1411 | |
1412 | static int | | 1412 | static int |
1413 | audiorescan(device_t self, const char *ifattr, const int *locators) | | 1413 | audiorescan(device_t self, const char *ifattr, const int *locators) |
1414 | { | | 1414 | { |
1415 | struct audio_softc *sc = device_private(self); | | 1415 | struct audio_softc *sc = device_private(self); |
1416 | | | 1416 | |
1417 | config_search(sc->sc_dev, NULL, | | 1417 | config_search(sc->sc_dev, NULL, |
1418 | CFARG_SUBMATCH, audiosearch, | | 1418 | CFARG_SUBMATCH, audiosearch, |
1419 | CFARG_IATTR, ifattr, | | | |
1420 | CFARG_LOCATORS, locators, | | | |
1421 | CFARG_EOL); | | 1419 | CFARG_EOL); |
1422 | | | 1420 | |
1423 | return 0; | | 1421 | return 0; |
1424 | } | | 1422 | } |
1425 | | | 1423 | |
1426 | /* | | 1424 | /* |
1427 | * Called from hardware driver. This is where the MI audio driver gets | | 1425 | * Called from hardware driver. This is where the MI audio driver gets |
1428 | * probed/attached to the hardware driver. | | 1426 | * probed/attached to the hardware driver. |
1429 | */ | | 1427 | */ |
1430 | device_t | | 1428 | device_t |
1431 | audio_attach_mi(const struct audio_hw_if *ahwp, void *hdlp, device_t dev) | | 1429 | audio_attach_mi(const struct audio_hw_if *ahwp, void *hdlp, device_t dev) |
1432 | { | | 1430 | { |
1433 | struct audio_attach_args arg; | | 1431 | struct audio_attach_args arg; |