modularize hdaudio and hdafg driversdiff -r1.8 -r1.9 src/sys/dev/pci/hdaudio/hdaudio.c
(jmcneill)
--- src/sys/dev/pci/hdaudio/Attic/hdaudio.c 2010/09/02 01:55:31 1.8
+++ src/sys/dev/pci/hdaudio/Attic/hdaudio.c 2011/01/07 15:30:29 1.9
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: hdaudio.c,v 1.8 2010/09/02 01:55:31 jmcneill Exp $ */ | 1 | /* $NetBSD: hdaudio.c,v 1.9 2011/01/07 15:30:29 jmcneill Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright (c) 2009 Precedence Technologies Ltd <support@precedence.co.uk> | 4 | * Copyright (c) 2009 Precedence Technologies Ltd <support@precedence.co.uk> | |
5 | * Copyright (c) 2009 Jared D. McNeill <jmcneill@invisible.ca> | 5 | * Copyright (c) 2009 Jared D. McNeill <jmcneill@invisible.ca> | |
6 | * All rights reserved. | 6 | * All rights reserved. | |
7 | * | 7 | * | |
8 | * This code is derived from software contributed to The NetBSD Foundation | 8 | * This code is derived from software contributed to The NetBSD Foundation | |
9 | * by Precedence Technologies Ltd | 9 | * by Precedence Technologies Ltd | |
10 | * | 10 | * | |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without | |
12 | * modification, are permitted provided that the following conditions | 12 | * modification, are permitted provided that the following conditions | |
13 | * are met: | 13 | * are met: | |
14 | * 1. Redistributions of source code must retain the above copyright | 14 | * 1. Redistributions of source code must retain the above copyright | |
@@ -20,35 +20,36 @@ | @@ -20,35 +20,36 @@ | |||
20 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | 20 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |
21 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | 21 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | |
22 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | 22 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | |
23 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, | 23 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, | |
24 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 24 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | |
25 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED | 25 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED | |
26 | * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | 26 | * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | |
27 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 27 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
29 | * SUCH DAMAGE. | 29 | * SUCH DAMAGE. | |
30 | */ | 30 | */ | |
31 | 31 | |||
32 | #include <sys/cdefs.h> | 32 | #include <sys/cdefs.h> | |
33 | __KERNEL_RCSID(0, "$NetBSD: hdaudio.c,v 1.8 2010/09/02 01:55:31 jmcneill Exp $"); | 33 | __KERNEL_RCSID(0, "$NetBSD: hdaudio.c,v 1.9 2011/01/07 15:30:29 jmcneill Exp $"); | |
34 | 34 | |||
35 | #include <sys/types.h> | 35 | #include <sys/types.h> | |
36 | #include <sys/param.h> | 36 | #include <sys/param.h> | |
37 | #include <sys/systm.h> | 37 | #include <sys/systm.h> | |
38 | #include <sys/device.h> | 38 | #include <sys/device.h> | |
39 | #include <sys/conf.h> | 39 | #include <sys/conf.h> | |
40 | #include <sys/bus.h> | 40 | #include <sys/bus.h> | |
41 | #include <sys/kmem.h> | 41 | #include <sys/kmem.h> | |
42 | #include <sys/module.h> | |||
42 | 43 | |||
43 | #include <dev/pci/hdaudio/hdaudiovar.h> | 44 | #include <dev/pci/hdaudio/hdaudiovar.h> | |
44 | #include <dev/pci/hdaudio/hdaudioreg.h> | 45 | #include <dev/pci/hdaudio/hdaudioreg.h> | |
45 | #include <dev/pci/hdaudio/hdaudioio.h> | 46 | #include <dev/pci/hdaudio/hdaudioio.h> | |
46 | 47 | |||
47 | /* #define HDAUDIO_DEBUG */ | 48 | /* #define HDAUDIO_DEBUG */ | |
48 | 49 | |||
49 | #define HDAUDIO_RESET_TIMEOUT 5000 | 50 | #define HDAUDIO_RESET_TIMEOUT 5000 | |
50 | #define HDAUDIO_CORB_TIMEOUT 1000 | 51 | #define HDAUDIO_CORB_TIMEOUT 1000 | |
51 | #define HDAUDIO_RIRB_TIMEOUT 5000 | 52 | #define HDAUDIO_RIRB_TIMEOUT 5000 | |
52 | 53 | |||
53 | #define HDAUDIO_CODEC_DELAY 1000 /* spec calls for 250 */ | 54 | #define HDAUDIO_CODEC_DELAY 1000 /* spec calls for 250 */ | |
54 | 55 | |||
@@ -855,26 +856,66 @@ hdaudio_resume(struct hdaudio_softc *sc) | @@ -855,26 +856,66 @@ hdaudio_resume(struct hdaudio_softc *sc) | |||
855 | if (hdaudio_rirb_config(sc) != 0) | 856 | if (hdaudio_rirb_config(sc) != 0) | |
856 | return false; | 857 | return false; | |
857 | if (hdaudio_corb_start(sc) != 0) | 858 | if (hdaudio_corb_start(sc) != 0) | |
858 | return false; | 859 | return false; | |
859 | if (hdaudio_rirb_start(sc) != 0) | 860 | if (hdaudio_rirb_start(sc) != 0) | |
860 | return false; | 861 | return false; | |
861 | 862 | |||
862 | hdaudio_intr_enable(sc); | 863 | hdaudio_intr_enable(sc); | |
863 | 864 | |||
864 | return true; | 865 | return true; | |
865 | } | 866 | } | |
866 | 867 | |||
867 | int | 868 | int | |
869 | hdaudio_rescan(struct hdaudio_softc *sc, const char *ifattr, const int *locs) | |||
870 | { | |||
871 | struct hdaudio_codec *co; | |||
872 | struct hdaudio_function_group *fg; | |||
873 | unsigned int codec; | |||
874 | ||||
875 | if (!ifattr_match(ifattr, "hdaudiobus")) | |||
876 | return 0; | |||
877 | ||||
878 | for (codec = 0; codec < HDAUDIO_MAX_CODECS; codec++) { | |||
879 | co = &sc->sc_codec[codec]; | |||
880 | fg = co->co_fg; | |||
881 | if (!co->co_valid || fg == NULL) | |||
882 | continue; | |||
883 | if (fg->fg_device) | |||
884 | continue; | |||
885 | hdaudio_attach_fg(fg, NULL); | |||
886 | } | |||
887 | ||||
888 | return 0; | |||
889 | } | |||
890 | ||||
891 | void | |||
892 | hdaudio_childdet(struct hdaudio_softc *sc, device_t child) | |||
893 | { | |||
894 | struct hdaudio_codec *co; | |||
895 | struct hdaudio_function_group *fg; | |||
896 | unsigned int codec; | |||
897 | ||||
898 | for (codec = 0; codec < HDAUDIO_MAX_CODECS; codec++) { | |||
899 | co = &sc->sc_codec[codec]; | |||
900 | fg = co->co_fg; | |||
901 | if (!co->co_valid || fg == NULL) | |||
902 | continue; | |||
903 | if (fg->fg_device == child) | |||
904 | fg->fg_device = NULL; | |||
905 | } | |||
906 | } | |||
907 | ||||
908 | int | |||
868 | hdaudio_intr(struct hdaudio_softc *sc) | 909 | hdaudio_intr(struct hdaudio_softc *sc) | |
869 | { | 910 | { | |
870 | struct hdaudio_stream *st; | 911 | struct hdaudio_stream *st; | |
871 | uint32_t intsts, stream_mask; | 912 | uint32_t intsts, stream_mask; | |
872 | int streamid = 0; | 913 | int streamid = 0; | |
873 | uint32_t rirbsts; | 914 | uint32_t rirbsts; | |
874 | 915 | |||
875 | intsts = hda_read4(sc, HDAUDIO_MMIO_INTSTS); | 916 | intsts = hda_read4(sc, HDAUDIO_MMIO_INTSTS); | |
876 | if (!(intsts & HDAUDIO_INTSTS_GIS)) | 917 | if (!(intsts & HDAUDIO_INTSTS_GIS)) | |
877 | return 0; | 918 | return 0; | |
878 | 919 | |||
879 | if (intsts & HDAUDIO_INTSTS_CIS) { | 920 | if (intsts & HDAUDIO_INTSTS_CIS) { | |
880 | rirbsts = hda_read4(sc, HDAUDIO_MMIO_RIRBSTS); | 921 | rirbsts = hda_read4(sc, HDAUDIO_MMIO_RIRBSTS); | |
@@ -1338,49 +1379,62 @@ hdaudioioctl_fgrp_setconfig(struct hdaud | @@ -1338,49 +1379,62 @@ hdaudioioctl_fgrp_setconfig(struct hdaud | |||
1338 | } | 1379 | } | |
1339 | hdaudio_attach_fg(fg, config); | 1380 | hdaudio_attach_fg(fg, config); | |
1340 | if (config) | 1381 | if (config) | |
1341 | prop_object_release(config); | 1382 | prop_object_release(config); | |
1342 | 1383 | |||
1343 | return 0; | 1384 | return 0; | |
1344 | } | 1385 | } | |
1345 | 1386 | |||
1346 | static int | 1387 | static int | |
1347 | hdaudio_dispatch_fgrp_ioctl(struct hdaudio_softc *sc, u_long cmd, | 1388 | hdaudio_dispatch_fgrp_ioctl(struct hdaudio_softc *sc, u_long cmd, | |
1348 | prop_dictionary_t request, prop_dictionary_t response) | 1389 | prop_dictionary_t request, prop_dictionary_t response) | |
1349 | { | 1390 | { | |
1350 | struct hdaudio_function_group *fg; | 1391 | struct hdaudio_function_group *fg; | |
1392 | int (*infocb)(void *, prop_dictionary_t, prop_dictionary_t); | |||
1393 | prop_dictionary_t fgrp_dict; | |||
1394 | uint64_t info_fn; | |||
1351 | int16_t codecid, nid; | 1395 | int16_t codecid, nid; | |
1352 | void *fgrp_sc; | 1396 | void *fgrp_sc; | |
1397 | bool rv; | |||
1353 | int err; | 1398 | int err; | |
1354 | 1399 | |||
1355 | if (!prop_dictionary_get_int16(request, "codecid", &codecid) || | 1400 | if (!prop_dictionary_get_int16(request, "codecid", &codecid) || | |
1356 | !prop_dictionary_get_int16(request, "nid", &nid)) | 1401 | !prop_dictionary_get_int16(request, "nid", &nid)) | |
1357 | return EINVAL; | 1402 | return EINVAL; | |
1358 | 1403 | |||
1359 | fg = hdaudioioctl_fgrp_lookup(sc, codecid, nid); | 1404 | fg = hdaudioioctl_fgrp_lookup(sc, codecid, nid); | |
1360 | if (fg == NULL) | 1405 | if (fg == NULL) | |
1361 | return ENODEV; | 1406 | return ENODEV; | |
1362 | fgrp_sc = device_private(fg->fg_device); | 1407 | fgrp_sc = device_private(fg->fg_device); | |
1408 | fgrp_dict = device_properties(fg->fg_device); | |||
1363 | 1409 | |||
1364 | switch (fg->fg_type) { | 1410 | switch (fg->fg_type) { | |
1365 | case HDAUDIO_GROUP_TYPE_AFG: | 1411 | case HDAUDIO_GROUP_TYPE_AFG: | |
1366 | switch (cmd) { | 1412 | switch (cmd) { | |
1367 | case HDAUDIO_FGRP_CODEC_INFO: | 1413 | case HDAUDIO_FGRP_CODEC_INFO: | |
1368 | err = hdaudio_afg_codec_info(fgrp_sc, | 1414 | rv = prop_dictionary_get_uint64(fgrp_dict, | |
1369 | request, response); | 1415 | "codecinfo-callback", &info_fn); | |
1416 | if (!rv) | |||
1417 | return ENXIO; | |||
1418 | infocb = (void *)(uintptr_t)info_fn; | |||
1419 | err = infocb(fgrp_sc, request, response); | |||
1370 | break; | 1420 | break; | |
1371 | case HDAUDIO_FGRP_WIDGET_INFO: | 1421 | case HDAUDIO_FGRP_WIDGET_INFO: | |
1372 | err = hdaudio_afg_widget_info(fgrp_sc, | 1422 | rv = prop_dictionary_get_uint64(fgrp_dict, | |
1373 | request, response); | 1423 | "widgetinfo-callback", &info_fn); | |
1424 | if (!rv) | |||
1425 | return ENXIO; | |||
1426 | infocb = (void *)(uintptr_t)info_fn; | |||
1427 | err = infocb(fgrp_sc, request, response); | |||
1374 | break; | 1428 | break; | |
1375 | default: | 1429 | default: | |
1376 | err = EINVAL; | 1430 | err = EINVAL; | |
1377 | break; | 1431 | break; | |
1378 | } | 1432 | } | |
1379 | break; | 1433 | break; | |
1380 | 1434 | |||
1381 | default: | 1435 | default: | |
1382 | err = EINVAL; | 1436 | err = EINVAL; | |
1383 | break; | 1437 | break; | |
1384 | } | 1438 | } | |
1385 | return err; | 1439 | return err; | |
1386 | } | 1440 | } | |
@@ -1442,13 +1496,53 @@ hdaudioioctl(dev_t dev, u_long cmd, void | @@ -1442,13 +1496,53 @@ hdaudioioctl(dev_t dev, u_long cmd, void | |||
1442 | default: | 1496 | default: | |
1443 | err = EINVAL; | 1497 | err = EINVAL; | |
1444 | break; | 1498 | break; | |
1445 | } | 1499 | } | |
1446 | 1500 | |||
1447 | if (!err) | 1501 | if (!err) | |
1448 | err = prop_dictionary_copyout_ioctl(pref, cmd, response); | 1502 | err = prop_dictionary_copyout_ioctl(pref, cmd, response); | |
1449 | 1503 | |||
1450 | if (response) | 1504 | if (response) | |
1451 | prop_object_release(response); | 1505 | prop_object_release(response); | |
1452 | prop_object_release(request); | 1506 | prop_object_release(request); | |
1453 | return err; | 1507 | return err; | |
1454 | } | 1508 | } | |
1509 | ||||
1510 | MODULE(MODULE_CLASS_DRIVER, hdaudio, NULL); | |||
1511 | ||||
1512 | #ifdef _MODULE | |||
1513 | #include "ioconf.c" | |||
1514 | #endif | |||
1515 | ||||
1516 | static int | |||
1517 | hdaudio_modcmd(modcmd_t cmd, void *opaque) | |||
1518 | { | |||
1519 | int error = 0; | |||
1520 | #ifdef _MODULE | |||
1521 | int bmaj = -1, cmaj = -1; | |||
1522 | #endif | |||
1523 | ||||
1524 | switch (cmd) { | |||
1525 | case MODULE_CMD_INIT: | |||
1526 | #ifdef _MODULE | |||
1527 | error = config_init_component(cfdriver_ioconf_hdaudio, | |||
1528 | cfattach_ioconf_hdaudio, cfdata_ioconf_hdaudio); | |||
1529 | if (error) | |||
1530 | return error; | |||
1531 | error = devsw_attach("hdaudio", NULL, &bmaj, | |||
1532 | &hdaudio_cdevsw, &cmaj); | |||
1533 | if (error) | |||
1534 | config_fini_component(cfdriver_ioconf_hdaudio, | |||
1535 | cfattach_ioconf_hdaudio, cfdata_ioconf_hdaudio); | |||
1536 | #endif | |||
1537 | return error; | |||
1538 | case MODULE_CMD_FINI: | |||
1539 | #ifdef _MODULE | |||
1540 | devsw_detach(NULL, &hdaudio_cdevsw); | |||
1541 | error = config_fini_component(cfdriver_ioconf_hdaudio, | |||
1542 | cfattach_ioconf_hdaudio, cfdata_ioconf_hdaudio); | |||
1543 | #endif | |||
1544 | return error; | |||
1545 | default: | |||
1546 | return ENOTTY; | |||
1547 | } | |||
1548 | } |
--- src/sys/dev/pci/hdaudio/Attic/hdaudio_afg.c 2010/09/02 01:55:31 1.27
+++ src/sys/dev/pci/hdaudio/Attic/hdaudio_afg.c 2011/01/07 15:30:29 1.28
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: hdaudio_afg.c,v 1.27 2010/09/02 01:55:31 jmcneill Exp $ */ | 1 | /* $NetBSD: hdaudio_afg.c,v 1.28 2011/01/07 15:30:29 jmcneill Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright (c) 2009 Precedence Technologies Ltd <support@precedence.co.uk> | 4 | * Copyright (c) 2009 Precedence Technologies Ltd <support@precedence.co.uk> | |
5 | * Copyright (c) 2009 Jared D. McNeill <jmcneill@invisible.ca> | 5 | * Copyright (c) 2009 Jared D. McNeill <jmcneill@invisible.ca> | |
6 | * All rights reserved. | 6 | * All rights reserved. | |
7 | * | 7 | * | |
8 | * This code is derived from software contributed to The NetBSD Foundation | 8 | * This code is derived from software contributed to The NetBSD Foundation | |
9 | * by Precedence Technologies Ltd | 9 | * by Precedence Technologies Ltd | |
10 | * | 10 | * | |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without | |
12 | * modification, are permitted provided that the following conditions | 12 | * modification, are permitted provided that the following conditions | |
13 | * are met: | 13 | * are met: | |
14 | * 1. Redistributions of source code must retain the above copyright | 14 | * 1. Redistributions of source code must retain the above copyright | |
@@ -50,36 +50,37 @@ | @@ -50,36 +50,37 @@ | |||
50 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 50 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
51 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | 51 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
52 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | 52 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | |
53 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | 53 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
54 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | 54 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
55 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | 55 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
56 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | 56 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
57 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 57 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
58 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 58 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
59 | * SUCH DAMAGE. | 59 | * SUCH DAMAGE. | |
60 | */ | 60 | */ | |
61 | 61 | |||
62 | #include <sys/cdefs.h> | 62 | #include <sys/cdefs.h> | |
63 | __KERNEL_RCSID(0, "$NetBSD: hdaudio_afg.c,v 1.27 2010/09/02 01:55:31 jmcneill Exp $"); | 63 | __KERNEL_RCSID(0, "$NetBSD: hdaudio_afg.c,v 1.28 2011/01/07 15:30:29 jmcneill Exp $"); | |
64 | 64 | |||
65 | #include <sys/types.h> | 65 | #include <sys/types.h> | |
66 | #include <sys/param.h> | 66 | #include <sys/param.h> | |
67 | #include <sys/systm.h> | 67 | #include <sys/systm.h> | |
68 | #include <sys/kernel.h> | 68 | #include <sys/kernel.h> | |
69 | #include <sys/device.h> | 69 | #include <sys/device.h> | |
70 | #include <sys/conf.h> | 70 | #include <sys/conf.h> | |
71 | #include <sys/bus.h> | 71 | #include <sys/bus.h> | |
72 | #include <sys/kmem.h> | 72 | #include <sys/kmem.h> | |
73 | #include <sys/module.h> | |||
73 | 74 | |||
74 | #include <sys/audioio.h> | 75 | #include <sys/audioio.h> | |
75 | #include <dev/audio_if.h> | 76 | #include <dev/audio_if.h> | |
76 | #include <dev/auconv.h> | 77 | #include <dev/auconv.h> | |
77 | 78 | |||
78 | #include <dev/pci/hdaudio/hdaudiovar.h> | 79 | #include <dev/pci/hdaudio/hdaudiovar.h> | |
79 | #include <dev/pci/hdaudio/hdaudioreg.h> | 80 | #include <dev/pci/hdaudio/hdaudioreg.h> | |
80 | #include <dev/pci/hdaudio/hdaudio_mixer.h> | 81 | #include <dev/pci/hdaudio/hdaudio_mixer.h> | |
81 | #include <dev/pci/hdaudio/hdaudioio.h> | 82 | #include <dev/pci/hdaudio/hdaudioio.h> | |
82 | #include <dev/pci/hdaudio/hdaudio_ids.h> | 83 | #include <dev/pci/hdaudio/hdaudio_ids.h> | |
83 | 84 | |||
84 | #ifndef AUFMT_SURROUND_7_1 | 85 | #ifndef AUFMT_SURROUND_7_1 | |
85 | #define AUFMT_SURROUND_7_1 (AUFMT_DOLBY_5_1|AUFMT_SIDE_LEFT|AUFMT_SIDE_RIGHT) | 86 | #define AUFMT_SURROUND_7_1 (AUFMT_DOLBY_5_1|AUFMT_SIDE_LEFT|AUFMT_SIDE_RIGHT) | |
@@ -311,26 +312,31 @@ struct hdaudio_afg_softc { | @@ -311,26 +312,31 @@ struct hdaudio_afg_softc { | |||
311 | uint32_t gpio_cnt; | 312 | uint32_t gpio_cnt; | |
312 | } sc_p; | 313 | } sc_p; | |
313 | 314 | |||
314 | struct hdaudio_audiodev sc_audiodev; | 315 | struct hdaudio_audiodev sc_audiodev; | |
315 | }; | 316 | }; | |
316 | 317 | |||
317 | static int hdaudio_afg_match(device_t, cfdata_t, void *); | 318 | static int hdaudio_afg_match(device_t, cfdata_t, void *); | |
318 | static void hdaudio_afg_attach(device_t, device_t, void *); | 319 | static void hdaudio_afg_attach(device_t, device_t, void *); | |
319 | static int hdaudio_afg_detach(device_t, int); | 320 | static int hdaudio_afg_detach(device_t, int); | |
320 | static void hdaudio_afg_childdet(device_t, device_t); | 321 | static void hdaudio_afg_childdet(device_t, device_t); | |
321 | static bool hdaudio_afg_suspend(device_t, const pmf_qual_t *); | 322 | static bool hdaudio_afg_suspend(device_t, const pmf_qual_t *); | |
322 | static bool hdaudio_afg_resume(device_t, const pmf_qual_t *); | 323 | static bool hdaudio_afg_resume(device_t, const pmf_qual_t *); | |
323 | 324 | |||
325 | static int hdaudio_afg_widget_info(void *, prop_dictionary_t, | |||
326 | prop_dictionary_t); | |||
327 | static int hdaudio_afg_codec_info(void *, prop_dictionary_t, | |||
328 | prop_dictionary_t); | |||
329 | ||||
324 | CFATTACH_DECL2_NEW( | 330 | CFATTACH_DECL2_NEW( | |
325 | hdafg, | 331 | hdafg, | |
326 | sizeof(struct hdaudio_afg_softc), | 332 | sizeof(struct hdaudio_afg_softc), | |
327 | hdaudio_afg_match, | 333 | hdaudio_afg_match, | |
328 | hdaudio_afg_attach, | 334 | hdaudio_afg_attach, | |
329 | hdaudio_afg_detach, | 335 | hdaudio_afg_detach, | |
330 | NULL, | 336 | NULL, | |
331 | NULL, | 337 | NULL, | |
332 | hdaudio_afg_childdet | 338 | hdaudio_afg_childdet | |
333 | ); | 339 | ); | |
334 | 340 | |||
335 | static int hdaudio_afg_query_encoding(void *, struct audio_encoding *); | 341 | static int hdaudio_afg_query_encoding(void *, struct audio_encoding *); | |
336 | static int hdaudio_afg_set_params(void *, int, int, | 342 | static int hdaudio_afg_set_params(void *, int, int, | |
@@ -368,27 +374,27 @@ static const struct audio_hw_if hdaudio_ | @@ -368,27 +374,27 @@ static const struct audio_hw_if hdaudio_ | |||
368 | .halt_output = hdaudio_afg_halt_output, | 374 | .halt_output = hdaudio_afg_halt_output, | |
369 | .halt_input = hdaudio_afg_halt_input, | 375 | .halt_input = hdaudio_afg_halt_input, | |
370 | .getdev = hdaudio_afg_getdev, | 376 | .getdev = hdaudio_afg_getdev, | |
371 | .set_port = hdaudio_afg_set_port, | 377 | .set_port = hdaudio_afg_set_port, | |
372 | .get_port = hdaudio_afg_get_port, | 378 | .get_port = hdaudio_afg_get_port, | |
373 | .query_devinfo = hdaudio_afg_query_devinfo, | 379 | .query_devinfo = hdaudio_afg_query_devinfo, | |
374 | .allocm = hdaudio_afg_allocm, | 380 | .allocm = hdaudio_afg_allocm, | |
375 | .freem = hdaudio_afg_freem, | 381 | .freem = hdaudio_afg_freem, | |
376 | .round_buffersize = hdaudio_afg_round_buffersize, | 382 | .round_buffersize = hdaudio_afg_round_buffersize, | |
377 | .mappage = hdaudio_afg_mappage, | 383 | .mappage = hdaudio_afg_mappage, | |
378 | .get_props = hdaudio_afg_get_props, | 384 | .get_props = hdaudio_afg_get_props, | |
379 | .trigger_output = hdaudio_afg_trigger_output, | 385 | .trigger_output = hdaudio_afg_trigger_output, | |
380 | .trigger_input = hdaudio_afg_trigger_input, | 386 | .trigger_input = hdaudio_afg_trigger_input, | |
381 | .dev_ioctl = hdaudio_afg_dev_ioctl | 387 | .dev_ioctl = hdaudio_afg_dev_ioctl, | |
382 | }; | 388 | }; | |
383 | 389 | |||
384 | static int | 390 | static int | |
385 | hdaudio_afg_append_formats(struct hdaudio_audiodev *ad, | 391 | hdaudio_afg_append_formats(struct hdaudio_audiodev *ad, | |
386 | const struct audio_format *format) | 392 | const struct audio_format *format) | |
387 | { | 393 | { | |
388 | if (ad->ad_nformats + 1 >= HDAUDIO_MAXFORMATS) { | 394 | if (ad->ad_nformats + 1 >= HDAUDIO_MAXFORMATS) { | |
389 | hda_print1(ad->ad_sc, "[ENOMEM] "); | 395 | hda_print1(ad->ad_sc, "[ENOMEM] "); | |
390 | return ENOMEM; | 396 | return ENOMEM; | |
391 | } | 397 | } | |
392 | ad->ad_formats[ad->ad_nformats++] = *format; | 398 | ad->ad_formats[ad->ad_nformats++] = *format; | |
393 | 399 | |||
394 | return 0; | 400 | return 0; | |
@@ -3719,27 +3725,27 @@ hdaudio_afg_trigger_input(void *opaque, | @@ -3719,27 +3725,27 @@ hdaudio_afg_trigger_input(void *opaque, | |||
3719 | return ENOMEM; | 3725 | return ENOMEM; | |
3720 | 3726 | |||
3721 | ad->ad_captureintr = intr; | 3727 | ad->ad_captureintr = intr; | |
3722 | ad->ad_captureintrarg = intrarg; | 3728 | ad->ad_captureintrarg = intrarg; | |
3723 | 3729 | |||
3724 | dmasize = (char *)end - (char *)start; | 3730 | dmasize = (char *)end - (char *)start; | |
3725 | ad->ad_sc->sc_rparam = *param; | 3731 | ad->ad_sc->sc_rparam = *param; | |
3726 | hdaudio_afg_stream_connect(ad->ad_sc, AUMODE_RECORD); | 3732 | hdaudio_afg_stream_connect(ad->ad_sc, AUMODE_RECORD); | |
3727 | hdaudio_stream_start(ad->ad_capture, blksize, dmasize, param); | 3733 | hdaudio_stream_start(ad->ad_capture, blksize, dmasize, param); | |
3728 | 3734 | |||
3729 | return 0; | 3735 | return 0; | |
3730 | } | 3736 | } | |
3731 | 3737 | |||
3732 | int | 3738 | static int | |
3733 | hdaudio_afg_widget_info(void *opaque, prop_dictionary_t request, | 3739 | hdaudio_afg_widget_info(void *opaque, prop_dictionary_t request, | |
3734 | prop_dictionary_t response) | 3740 | prop_dictionary_t response) | |
3735 | { | 3741 | { | |
3736 | struct hdaudio_afg_softc *sc = opaque; | 3742 | struct hdaudio_afg_softc *sc = opaque; | |
3737 | struct hdaudio_widget *w; | 3743 | struct hdaudio_widget *w; | |
3738 | prop_array_t connlist; | 3744 | prop_array_t connlist; | |
3739 | uint32_t config, wcap; | 3745 | uint32_t config, wcap; | |
3740 | uint16_t index; | 3746 | uint16_t index; | |
3741 | int nid; | 3747 | int nid; | |
3742 | int i; | 3748 | int i; | |
3743 | 3749 | |||
3744 | if (prop_dictionary_get_uint16(request, "index", &index) == false) | 3750 | if (prop_dictionary_get_uint16(request, "index", &index) == false) | |
3745 | return EINVAL; | 3751 | return EINVAL; | |
@@ -3764,27 +3770,27 @@ hdaudio_afg_widget_info(void *opaque, pr | @@ -3764,27 +3770,27 @@ hdaudio_afg_widget_info(void *opaque, pr | |||
3764 | return 0; | 3770 | return 0; | |
3765 | connlist = prop_array_create(); | 3771 | connlist = prop_array_create(); | |
3766 | for (i = 0; i < w->w_nconns; i++) { | 3772 | for (i = 0; i < w->w_nconns; i++) { | |
3767 | if (w->w_conns[i] == 0) | 3773 | if (w->w_conns[i] == 0) | |
3768 | continue; | 3774 | continue; | |
3769 | prop_array_add(connlist, | 3775 | prop_array_add(connlist, | |
3770 | prop_number_create_unsigned_integer(w->w_conns[i])); | 3776 | prop_number_create_unsigned_integer(w->w_conns[i])); | |
3771 | } | 3777 | } | |
3772 | prop_dictionary_set(response, "connlist", connlist); | 3778 | prop_dictionary_set(response, "connlist", connlist); | |
3773 | prop_object_release(connlist); | 3779 | prop_object_release(connlist); | |
3774 | return 0; | 3780 | return 0; | |
3775 | } | 3781 | } | |
3776 | 3782 | |||
3777 | int | 3783 | static int | |
3778 | hdaudio_afg_codec_info(void *opaque, prop_dictionary_t request, | 3784 | hdaudio_afg_codec_info(void *opaque, prop_dictionary_t request, | |
3779 | prop_dictionary_t response) | 3785 | prop_dictionary_t response) | |
3780 | { | 3786 | { | |
3781 | struct hdaudio_afg_softc *sc = opaque; | 3787 | struct hdaudio_afg_softc *sc = opaque; | |
3782 | prop_dictionary_set_uint16(response, "vendor-id", | 3788 | prop_dictionary_set_uint16(response, "vendor-id", | |
3783 | sc->sc_vendor); | 3789 | sc->sc_vendor); | |
3784 | prop_dictionary_set_uint16(response, "product-id", | 3790 | prop_dictionary_set_uint16(response, "product-id", | |
3785 | sc->sc_product); | 3791 | sc->sc_product); | |
3786 | return 0; | 3792 | return 0; | |
3787 | } | 3793 | } | |
3788 | 3794 | |||
3789 | static int | 3795 | static int | |
3790 | hdaudio_afg_dev_ioctl(void *opaque, u_long cmd, void *addr, int flag, lwp_t *l) | 3796 | hdaudio_afg_dev_ioctl(void *opaque, u_long cmd, void *addr, int flag, lwp_t *l) | |
@@ -3815,13 +3821,42 @@ hdaudio_afg_dev_ioctl(void *opaque, u_lo | @@ -3815,13 +3821,42 @@ hdaudio_afg_dev_ioctl(void *opaque, u_lo | |||
3815 | default: | 3821 | default: | |
3816 | err = EINVAL; | 3822 | err = EINVAL; | |
3817 | break; | 3823 | break; | |
3818 | } | 3824 | } | |
3819 | 3825 | |||
3820 | if (!err) | 3826 | if (!err) | |
3821 | err = prop_dictionary_copyout_ioctl(pref, cmd, response); | 3827 | err = prop_dictionary_copyout_ioctl(pref, cmd, response); | |
3822 | 3828 | |||
3823 | if (response) | 3829 | if (response) | |
3824 | prop_object_release(response); | 3830 | prop_object_release(response); | |
3825 | prop_object_release(request); | 3831 | prop_object_release(request); | |
3826 | return err; | 3832 | return err; | |
3827 | } | 3833 | } | |
3834 | ||||
3835 | MODULE(MODULE_CLASS_DRIVER, hdafg, "hdaudio"); | |||
3836 | ||||
3837 | #ifdef _MODULE | |||
3838 | #include "ioconf.c" | |||
3839 | #endif | |||
3840 | ||||
3841 | static int | |||
3842 | hdafg_modcmd(modcmd_t cmd, void *opaque) | |||
3843 | { | |||
3844 | int error; | |||
3845 | ||||
3846 | switch (cmd) { | |||
3847 | case MODULE_CMD_INIT: | |||
3848 | #ifdef _MODULE | |||
3849 | error = config_init_component(cfdriver_ioconf_hdafg, | |||
3850 | cfattach_ioconf_hdafg, cfdata_ioconf_hdafg); | |||
3851 | #endif | |||
3852 | return error; | |||
3853 | case MODULE_CMD_FINI: | |||
3854 | #ifdef _MODULE | |||
3855 | error = config_fini_component(cfdriver_ioconf_hdafg, | |||
3856 | cfattach_ioconf_hdafg, cfdata_ioconf_hdafg); | |||
3857 | #endif | |||
3858 | return error; | |||
3859 | default: | |||
3860 | return ENOTTY; | |||
3861 | } | |||
3862 | } |
--- src/sys/dev/pci/hdaudio/Attic/hdaudio_pci.c 2010/08/07 16:59:48 1.6
+++ src/sys/dev/pci/hdaudio/Attic/hdaudio_pci.c 2011/01/07 15:30:30 1.7
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: hdaudio_pci.c,v 1.6 2010/08/07 16:59:48 jmcneill Exp $ */ | 1 | /* $NetBSD: hdaudio_pci.c,v 1.7 2011/01/07 15:30:30 jmcneill Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright (c) 2009 Precedence Technologies Ltd <support@precedence.co.uk> | 4 | * Copyright (c) 2009 Precedence Technologies Ltd <support@precedence.co.uk> | |
5 | * Copyright (c) 2009 Jared D. McNeill <jmcneill@invisible.ca> | 5 | * Copyright (c) 2009 Jared D. McNeill <jmcneill@invisible.ca> | |
6 | * All rights reserved. | 6 | * All rights reserved. | |
7 | * | 7 | * | |
8 | * This code is derived from software contributed to The NetBSD Foundation | 8 | * This code is derived from software contributed to The NetBSD Foundation | |
9 | * by Precedence Technologies Ltd | 9 | * by Precedence Technologies Ltd | |
10 | * | 10 | * | |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without | |
12 | * modification, are permitted provided that the following conditions | 12 | * modification, are permitted provided that the following conditions | |
13 | * are met: | 13 | * are met: | |
14 | * 1. Redistributions of source code must retain the above copyright | 14 | * 1. Redistributions of source code must retain the above copyright | |
@@ -24,68 +24,69 @@ | @@ -24,68 +24,69 @@ | |||
24 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 24 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | |
25 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED | 25 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED | |
26 | * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | 26 | * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | |
27 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 27 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
29 | * SUCH DAMAGE. | 29 | * SUCH DAMAGE. | |
30 | */ | 30 | */ | |
31 | 31 | |||
32 | /* | 32 | /* | |
33 | * Intel High Definition Audio (Revision 1.0) device driver. | 33 | * Intel High Definition Audio (Revision 1.0) device driver. | |
34 | */ | 34 | */ | |
35 | 35 | |||
36 | #include <sys/cdefs.h> | 36 | #include <sys/cdefs.h> | |
37 | __KERNEL_RCSID(0, "$NetBSD: hdaudio_pci.c,v 1.6 2010/08/07 16:59:48 jmcneill Exp $"); | 37 | __KERNEL_RCSID(0, "$NetBSD: hdaudio_pci.c,v 1.7 2011/01/07 15:30:30 jmcneill Exp $"); | |
38 | 38 | |||
39 | #include <sys/types.h> | 39 | #include <sys/types.h> | |
40 | #include <sys/param.h> | 40 | #include <sys/param.h> | |
41 | #include <sys/systm.h> | 41 | #include <sys/systm.h> | |
42 | #include <sys/device.h> | 42 | #include <sys/device.h> | |
43 | #include <sys/conf.h> | 43 | #include <sys/conf.h> | |
44 | #include <sys/bus.h> | 44 | #include <sys/bus.h> | |
45 | #include <sys/intr.h> | 45 | #include <sys/intr.h> | |
46 | 46 | |||
47 | #include <dev/pci/pcidevs.h> | 47 | #include <dev/pci/pcidevs.h> | |
48 | #include <dev/pci/pcivar.h> | 48 | #include <dev/pci/pcivar.h> | |
49 | 49 | |||
50 | #include <dev/pci/hdaudio/hdaudioreg.h> | 50 | #include <dev/pci/hdaudio/hdaudioreg.h> | |
51 | #include <dev/pci/hdaudio/hdaudiovar.h> | 51 | #include <dev/pci/hdaudio/hdaudiovar.h> | |
52 | #include <dev/pci/hdaudio/hdaudio_pci.h> | 52 | #include <dev/pci/hdaudio/hdaudio_pci.h> | |
53 | 53 | |||
54 | struct hdaudio_pci_softc { | 54 | struct hdaudio_pci_softc { | |
55 | struct hdaudio_softc sc_hdaudio; /* must be first */ | 55 | struct hdaudio_softc sc_hdaudio; /* must be first */ | |
56 | pcitag_t sc_tag; | 56 | pcitag_t sc_tag; | |
57 | pci_chipset_tag_t sc_pc; | 57 | pci_chipset_tag_t sc_pc; | |
58 | void *sc_ih; | 58 | void *sc_ih; | |
59 | }; | 59 | }; | |
60 | 60 | |||
61 | static int hdaudio_pci_match(device_t, cfdata_t, void *); | 61 | static int hdaudio_pci_match(device_t, cfdata_t, void *); | |
62 | static void hdaudio_pci_attach(device_t, device_t, void *); | 62 | static void hdaudio_pci_attach(device_t, device_t, void *); | |
63 | static int hdaudio_pci_detach(device_t, int); | 63 | static int hdaudio_pci_detach(device_t, int); | |
64 | static int hdaudio_pci_rescan(device_t, const char *, const int *); | |||
64 | static void hdaudio_pci_childdet(device_t, device_t); | 65 | static void hdaudio_pci_childdet(device_t, device_t); | |
65 | 66 | |||
66 | static int hdaudio_pci_intr(void *); | 67 | static int hdaudio_pci_intr(void *); | |
67 | 68 | |||
68 | /* power management */ | 69 | /* power management */ | |
69 | static bool hdaudio_pci_resume(device_t, const pmf_qual_t *); | 70 | static bool hdaudio_pci_resume(device_t, const pmf_qual_t *); | |
70 | 71 | |||
71 | CFATTACH_DECL2_NEW( | 72 | CFATTACH_DECL2_NEW( | |
72 | hdaudio_pci, | 73 | hdaudio_pci, | |
73 | sizeof(struct hdaudio_pci_softc), | 74 | sizeof(struct hdaudio_pci_softc), | |
74 | hdaudio_pci_match, | 75 | hdaudio_pci_match, | |
75 | hdaudio_pci_attach, | 76 | hdaudio_pci_attach, | |
76 | hdaudio_pci_detach, | 77 | hdaudio_pci_detach, | |
77 | NULL, | 78 | NULL, | |
78 | NULL, | 79 | hdaudio_pci_rescan, | |
79 | hdaudio_pci_childdet | 80 | hdaudio_pci_childdet | |
80 | ); | 81 | ); | |
81 | 82 | |||
82 | /* | 83 | /* | |
83 | * NetBSD autoconfiguration | 84 | * NetBSD autoconfiguration | |
84 | */ | 85 | */ | |
85 | 86 | |||
86 | static int | 87 | static int | |
87 | hdaudio_pci_match(device_t parent, cfdata_t match, void *opaque) | 88 | hdaudio_pci_match(device_t parent, cfdata_t match, void *opaque) | |
88 | { | 89 | { | |
89 | struct pci_attach_args *pa = opaque; | 90 | struct pci_attach_args *pa = opaque; | |
90 | 91 | |||
91 | if (PCI_CLASS(pa->pa_class) != PCI_CLASS_MULTIMEDIA) | 92 | if (PCI_CLASS(pa->pa_class) != PCI_CLASS_MULTIMEDIA) | |
@@ -160,34 +161,40 @@ hdaudio_pci_attach(device_t parent, devi | @@ -160,34 +161,40 @@ hdaudio_pci_attach(device_t parent, devi | |||
160 | csr = pci_conf_read(sc->sc_pc, sc->sc_tag, | 161 | csr = pci_conf_read(sc->sc_pc, sc->sc_tag, | |
161 | HDAUDIO_NV_REG_SNOOP); | 162 | HDAUDIO_NV_REG_SNOOP); | |
162 | csr &= ~HDAUDIO_NV_SNOOP_MASK; | 163 | csr &= ~HDAUDIO_NV_SNOOP_MASK; | |
163 | csr |= HDAUDIO_NV_SNOOP_ENABLE; | 164 | csr |= HDAUDIO_NV_SNOOP_ENABLE; | |
164 | pci_conf_write(sc->sc_pc, sc->sc_tag, | 165 | pci_conf_write(sc->sc_pc, sc->sc_tag, | |
165 | HDAUDIO_NV_REG_SNOOP, csr); | 166 | HDAUDIO_NV_REG_SNOOP, csr); | |
166 | break; | 167 | break; | |
167 | } | 168 | } | |
168 | 169 | |||
169 | /* Attach bus-independent HD audio layer */ | 170 | /* Attach bus-independent HD audio layer */ | |
170 | hdaudio_attach(self, &sc->sc_hdaudio); | 171 | hdaudio_attach(self, &sc->sc_hdaudio); | |
171 | } | 172 | } | |
172 | 173 | |||
174 | static int | |||
175 | hdaudio_pci_rescan(device_t self, const char *ifattr, const int *locs) | |||
176 | { | |||
177 | struct hdaudio_pci_softc *sc = device_private(self); | |||
178 | ||||
179 | return hdaudio_rescan(&sc->sc_hdaudio, ifattr, locs); | |||
180 | } | |||
181 | ||||
173 | void | 182 | void | |
174 | hdaudio_pci_childdet(device_t self, device_t child) | 183 | hdaudio_pci_childdet(device_t self, device_t child) | |
175 | { | 184 | { | |
176 | #if notyet | |||
177 | struct hdaudio_pci_softc *sc = device_private(self); | 185 | struct hdaudio_pci_softc *sc = device_private(self); | |
178 | 186 | |||
179 | hdaudio_childdet(&sc->sc_hdaudio, child); | 187 | hdaudio_childdet(&sc->sc_hdaudio, child); | |
180 | #endif | |||
181 | } | 188 | } | |
182 | 189 | |||
183 | static int | 190 | static int | |
184 | hdaudio_pci_detach(device_t self, int flags) | 191 | hdaudio_pci_detach(device_t self, int flags) | |
185 | { | 192 | { | |
186 | struct hdaudio_pci_softc *sc = device_private(self); | 193 | struct hdaudio_pci_softc *sc = device_private(self); | |
187 | pcireg_t csr; | 194 | pcireg_t csr; | |
188 | 195 | |||
189 | hdaudio_detach(&sc->sc_hdaudio, flags); | 196 | hdaudio_detach(&sc->sc_hdaudio, flags); | |
190 | 197 | |||
191 | if (sc->sc_ih != NULL) { | 198 | if (sc->sc_ih != NULL) { | |
192 | pci_intr_disestablish(sc->sc_pc, sc->sc_ih); | 199 | pci_intr_disestablish(sc->sc_pc, sc->sc_ih); | |
193 | sc->sc_ih = NULL; | 200 | sc->sc_ih = NULL; |
--- src/sys/dev/pci/hdaudio/Attic/hdaudiovar.h 2010/08/15 19:39:56 1.6
+++ src/sys/dev/pci/hdaudio/Attic/hdaudiovar.h 2011/01/07 15:30:30 1.7
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: hdaudiovar.h,v 1.6 2010/08/15 19:39:56 jmcneill Exp $ */ | 1 | /* $NetBSD: hdaudiovar.h,v 1.7 2011/01/07 15:30:30 jmcneill Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright (c) 2009 Precedence Technologies Ltd <support@precedence.co.uk> | 4 | * Copyright (c) 2009 Precedence Technologies Ltd <support@precedence.co.uk> | |
5 | * Copyright (c) 2009 Jared D. McNeill <jmcneill@invisible.ca> | 5 | * Copyright (c) 2009 Jared D. McNeill <jmcneill@invisible.ca> | |
6 | * All rights reserved. | 6 | * All rights reserved. | |
7 | * | 7 | * | |
8 | * This code is derived from software contributed to The NetBSD Foundation | 8 | * This code is derived from software contributed to The NetBSD Foundation | |
9 | * by Precedence Technologies Ltd | 9 | * by Precedence Technologies Ltd | |
10 | * | 10 | * | |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without | |
12 | * modification, are permitted provided that the following conditions | 12 | * modification, are permitted provided that the following conditions | |
13 | * are met: | 13 | * are met: | |
14 | * 1. Redistributions of source code must retain the above copyright | 14 | * 1. Redistributions of source code must retain the above copyright | |
@@ -153,34 +153,34 @@ struct hdaudio_softc { | @@ -153,34 +153,34 @@ struct hdaudio_softc { | |||
153 | struct hdaudio_dma sc_rirb; | 153 | struct hdaudio_dma sc_rirb; | |
154 | uint16_t sc_rirbrp; | 154 | uint16_t sc_rirbrp; | |
155 | 155 | |||
156 | struct hdaudio_codec sc_codec[HDAUDIO_MAX_CODECS]; | 156 | struct hdaudio_codec sc_codec[HDAUDIO_MAX_CODECS]; | |
157 | 157 | |||
158 | struct hdaudio_stream sc_stream[HDAUDIO_MAX_STREAMS]; | 158 | struct hdaudio_stream sc_stream[HDAUDIO_MAX_STREAMS]; | |
159 | uint32_t sc_stream_mask; | 159 | uint32_t sc_stream_mask; | |
160 | kmutex_t sc_stream_mtx; | 160 | kmutex_t sc_stream_mtx; | |
161 | }; | 161 | }; | |
162 | 162 | |||
163 | int hdaudio_attach(device_t, struct hdaudio_softc *); | 163 | int hdaudio_attach(device_t, struct hdaudio_softc *); | |
164 | int hdaudio_detach(struct hdaudio_softc *, int); | 164 | int hdaudio_detach(struct hdaudio_softc *, int); | |
165 | bool hdaudio_resume(struct hdaudio_softc *); | 165 | bool hdaudio_resume(struct hdaudio_softc *); | |
166 | int hdaudio_rescan(struct hdaudio_softc *, const char *, const int *); | |||
167 | void hdaudio_childdet(struct hdaudio_softc *, device_t); | |||
168 | ||||
166 | uint32_t hdaudio_command(struct hdaudio_codec *, int, uint32_t, uint32_t); | 169 | uint32_t hdaudio_command(struct hdaudio_codec *, int, uint32_t, uint32_t); | |
167 | int hdaudio_intr(struct hdaudio_softc *); | 170 | int hdaudio_intr(struct hdaudio_softc *); | |
168 | 171 | |||
169 | int hdaudio_dma_alloc(struct hdaudio_softc *, struct hdaudio_dma *, int); | 172 | int hdaudio_dma_alloc(struct hdaudio_softc *, struct hdaudio_dma *, int); | |
170 | void hdaudio_dma_free(struct hdaudio_softc *, struct hdaudio_dma *); | 173 | void hdaudio_dma_free(struct hdaudio_softc *, struct hdaudio_dma *); | |
171 | 174 | |||
172 | struct hdaudio_stream * hdaudio_stream_establish(struct hdaudio_softc *, | 175 | struct hdaudio_stream * hdaudio_stream_establish(struct hdaudio_softc *, | |
173 | enum hdaudio_stream_type, | 176 | enum hdaudio_stream_type, | |
174 | int (*)(struct hdaudio_stream *), void *); | 177 | int (*)(struct hdaudio_stream *), void *); | |
175 | void hdaudio_stream_disestablish(struct hdaudio_stream *); | 178 | void hdaudio_stream_disestablish(struct hdaudio_stream *); | |
176 | void hdaudio_stream_start(struct hdaudio_stream *, int, bus_size_t, | 179 | void hdaudio_stream_start(struct hdaudio_stream *, int, bus_size_t, | |
177 | const audio_params_t *); | 180 | const audio_params_t *); | |
178 | void hdaudio_stream_stop(struct hdaudio_stream *); | 181 | void hdaudio_stream_stop(struct hdaudio_stream *); | |
179 | void hdaudio_stream_reset(struct hdaudio_stream *); | 182 | void hdaudio_stream_reset(struct hdaudio_stream *); | |
180 | int hdaudio_stream_tag(struct hdaudio_stream *); | 183 | int hdaudio_stream_tag(struct hdaudio_stream *); | |
181 | uint16_t hdaudio_stream_param(struct hdaudio_stream *, const audio_params_t *); | 184 | uint16_t hdaudio_stream_param(struct hdaudio_stream *, const audio_params_t *); | |
182 | 185 | |||
183 | int hdaudio_afg_widget_info(void *, prop_dictionary_t, prop_dictionary_t); | |||
184 | int hdaudio_afg_codec_info(void *, prop_dictionary_t, prop_dictionary_t); | |||
185 | ||||
186 | #endif /* !_HDAUDIOVAR_H */ | 186 | #endif /* !_HDAUDIOVAR_H */ |