[prev in list] [next in list] [prev in thread] [next in thread] 

List:       haiku-commits
Subject:    [haiku-commits] haiku: hrev57705 - in src/add-ons/kernel/drivers/audio/ac97: ich ichaudio src/add-on
From:       waddlesplash <waddlesplash () gmail ! com>
Date:       2024-04-15 16:02:57
Message-ID: 20240415160257.DF55F3FCD0 () turing ! freelists ! org
[Download RAW message or body]

hrev57705 adds 13 changesets to branch 'master'
old head: c237c4ce593ee823d9867fd997e51e4c447f5623
new head: 5ea01a50c2b62a3f587166c4df12527a7919f600
overview: https://git.haiku-os.org/haiku/log/?qt=range&q=5ea01a50c2b6+%5Ec237c4ce593e

----------------------------------------------------------------------------

6f52406a739b: auich: Fix warnings, enable -Werror
  
  Change-Id: I03a686d124444d60b92b34c1b7a10d73c872c21d
  Reviewed-on: https://review.haiku-os.org/c/haiku/+/7606
  Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
  Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>

                             [ Muhamed Emad <muhamed.emadeldeen@gmail.com> ]

fe640d9339f5: pcmcia: fix compilation warnings and errors
  
  Needed for the echo indigo soundcard driver build.
  
  IRQ is used as a field name in pmcia/cs.h. The IRQ() macro should only
  be used with parameters. So we can avoid the use of IRQ in cs.h being
  accidentally replaced by the macro.
  
  Change-Id: Ib10f3c5148cfb7c87a0b258a95a590778b6e5cb4
  Reviewed-on: https://review.haiku-os.org/c/haiku/+/7608
  Reviewed-by: waddlesplash <waddlesplash@gmail.com>
  Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>

                                   [ PulkoMandy <pulkomandy@pulkomandy.tk> ]

af8ec5e1b410: echo: enable Werror
  
  Part of #9460
  
  * If there is an operation between signed and unsigned int, the unsigned is changed \
to signed one,  except for some operations (if before the operation the signed one is \
checked to be less than  zero or not, then the signed one get cast to be unsigned \
(errors due to sign error when casting  are impossible))
  * When doing operations on pointers, integers get cast to uintptr_t type
  
  Untested: I don't have the hardware.
  
  Change-Id: I6a959c004862e055ee99f6f2ad5ca3397b32cdd2
  Reviewed-on: https://review.haiku-os.org/c/haiku/+/7484
  Reviewed-by: waddlesplash <waddlesplash@gmail.com>
  Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>

                             [ Muhamed Emad <muhamed.emadeldeen@gmail.com> ]

d6e543c38874: emuxki: enable Werror
  
  Change-Id: I6ed7bfbe157bee86a8ce1dabc5829b8825e43f99
  Reviewed-on: https://review.haiku-os.org/c/haiku/+/7609
  Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
  Reviewed-by: waddlesplash <waddlesplash@gmail.com>

                                   [ PulkoMandy <pulkomandy@pulkomandy.tk> ]

464efaf40332: auvia: enable -Werror, style fixes
  
  Move util.c from auich (the most up to date version) to the parent
  directory of ac97. Use it also for auvia. This means changing several
  physical addresses to use phys_addr_t instead of pointers, and declaring
  buffers allocated by alloc_mem to be user-accessible or not.
  
  Untested, I don't have the hardware.
  
  Change-Id: I2ababc713384cbf34174fbcecfb3595547a1fd97
  Reviewed-on: https://review.haiku-os.org/c/haiku/+/7602
  Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
  Reviewed-by: Alexander von Gluck <alex@terarocket.io>

                             [ Muhamed Emad <muhamed.emadeldeen@gmail.com> ]

f5e5891bbb6a: es1370: enable -Werror
  
  - use shared (updated) util.c for memory allocation
  - disable functions that are currently not used (ac97 suopport)
  
  Untested, I don't have the hardware.
  
  Change-Id: I9c406e46af94dfc213cfa258c5f375da3c0c719d
  Reviewed-on: https://review.haiku-os.org/c/haiku/+/7603
  Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
  Reviewed-by: Alexander von Gluck <alex@terarocket.io>

                                   [ PulkoMandy <pulkomandy@pulkomandy.tk> ]

8a3e82a04d6e: ich, ichaudio: remove
  
  These have never been included in the Haiku build as far as I can see.
  All the soundcards they support are already handled in the auich dirver.
  All the IDE driver that ichaudio claims to support, I'm not sure why they
  are in an audio driver.
  
  One of them was written for BeOS and never updated for Haiku
  multi_audio, and the other was apparently some experiment that didn't
  get anywhere in the end. To avoid confusion, let's keep only one driver.
  
  Change-Id: I5bf48e7dd2c5340e84a1ab4eb3e3b079103b7988
  Reviewed-on: https://review.haiku-os.org/c/haiku/+/7604
  Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
  Reviewed-by: waddlesplash <waddlesplash@gmail.com>

                                   [ PulkoMandy <pulkomandy@pulkomandy.tk> ]

beb5d3977607: audio drivers: move util.{c,h} to generic directory
  
  Change-Id: Ied0afa5ad9f66ee6f2249715d66fb62e6206d137
  Reviewed-on: https://review.haiku-os.org/c/haiku/+/7607
  Reviewed-by: Alexander von Gluck <alex@terarocket.io>
  Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>

                                   [ PulkoMandy <pulkomandy@pulkomandy.tk> ]

d3503944f052: echo: actually fix warnings and enable -Werror
  
  The driver Jamfile had a "-w" added to the compiler command line to
  disable all warnings.
  
  Use the generic util.c/h instead of having a separate copy.
  
  Change-Id: I74e325850d573e75d652658748426c9ae353c6e7
  Reviewed-on: https://review.haiku-os.org/c/haiku/+/7617
  Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
  Reviewed-by: Alexander von Gluck <alex@terarocket.io>

                                   [ PulkoMandy <pulkomandy@pulkomandy.tk> ]

e7e9e58fbd2b: emuxki: use shared util.c instead of a separate copy
  
  Change-Id: I1ba248d442e558565e41472a6daab279ee8ee8af
  Reviewed-on: https://review.haiku-os.org/c/haiku/+/7618
  Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
  Reviewed-by: Alexander von Gluck <alex@terarocket.io>

                                   [ PulkoMandy <pulkomandy@pulkomandy.tk> ]

98afcfa72a09: geode audio: fix almost all warnings, enable -Werror
  
  The compiler complains about implicit declaration of free and calloc
  despite stdlib.h being included. I think it's because of -ffreestanding
  being used on the command line?
  
  Change-Id: I57c3899e5034d1c2ee9cb6c1ed4c92aa818b53ea
  Reviewed-on: https://review.haiku-os.org/c/haiku/+/7619
  Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
  Reviewed-by: Alexander von Gluck <alex@terarocket.io>

                                   [ PulkoMandy <pulkomandy@pulkomandy.tk> ]

99351a72d363: sb16: enable -Werror
  
  Change-Id: I990362cd764e3a219e5022a62264b76be4cdf80c
  Reviewed-on: https://review.haiku-os.org/c/haiku/+/7620
  Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
  Reviewed-by: Alexander von Gluck <alex@terarocket.io>

                                   [ PulkoMandy <pulkomandy@pulkomandy.tk> ]

5ea01a50c2b6: cmedia: enable -Werror
  
  Errors are now enabled for all audio drivers.
  
  Change-Id: Ia4e986f0ed8965376c3bbefc3d9f04bcd68ad561
  Reviewed-on: https://review.haiku-os.org/c/haiku/+/7621
  Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
  Reviewed-by: Alexander von Gluck <alex@terarocket.io>

                                   [ PulkoMandy <pulkomandy@pulkomandy.tk> ]

----------------------------------------------------------------------------

86 files changed, 316 insertions(+), 6073 deletions(-)
build/jam/ArchitectureRules                      |   20 +-
headers/os/drivers/pcmcia/k_compat.h             |    4 +-
src/add-ons/kernel/drivers/audio/ac97/Jamfile    |    2 -
.../kernel/drivers/audio/ac97/auich/Jamfile      |    2 +
.../kernel/drivers/audio/ac97/auich/auich.c      |    1 +
.../kernel/drivers/audio/ac97/auich/auich.h      |    1 +
.../kernel/drivers/audio/ac97/auich/multi.c      |   33 +-
.../kernel/drivers/audio/ac97/auvia/Jamfile      |    2 +
.../kernel/drivers/audio/ac97/auvia/auvia.c      |   69 +-
.../kernel/drivers/audio/ac97/auvia/auvia.h      |   50 +-
.../kernel/drivers/audio/ac97/auvia/multi.c      |   32 +-
.../kernel/drivers/audio/ac97/auvia/util.c       |  100 --
.../kernel/drivers/audio/ac97/auvia/util.h       |   40 -
.../kernel/drivers/audio/ac97/es1370/Jamfile     |    3 +
.../kernel/drivers/audio/ac97/es1370/es1370.c    |    2 +-
.../kernel/drivers/audio/ac97/es1370/multi.c     |   46 +-
.../kernel/drivers/audio/ac97/es1370/util.c      |  132 ---
.../kernel/drivers/audio/ac97/es1370/util.h      |   41 -
.../kernel/drivers/audio/ac97/geode/driver.h     |    2 +-
.../audio/ac97/geode/geode_controller.cpp        |   11 +-
.../drivers/audio/ac97/geode/geode_multi.cpp     |   15 +-
.../kernel/drivers/audio/ac97/ich/Jamfile        |   25 -
src/add-ons/kernel/drivers/audio/ac97/ich/ac97.c |  907 ----------------
src/add-ons/kernel/drivers/audio/ac97/ich/ac97.h |  232 ----
.../kernel/drivers/audio/ac97/ich/ac97_multi.c   |  516 ---------
.../kernel/drivers/audio/ac97/ich/ac97_multi.h   |   33 -
.../kernel/drivers/audio/ac97/ich/config.c       |  186 ----
.../kernel/drivers/audio/ac97/ich/config.h       |   67 --
.../kernel/drivers/audio/ac97/ich/debug.c        |   93 --
.../kernel/drivers/audio/ac97/ich/debug.h        |   69 --
.../drivers/audio/ac97/ich/distro/README.html    |   74 --
.../drivers/audio/ac97/ich/distro/install.sh     |   76 --
.../drivers/audio/ac97/ich/distro/uninstall.sh   |   33 -
.../kernel/drivers/audio/ac97/ich/hardware.h     |  136 ---
src/add-ons/kernel/drivers/audio/ac97/ich/ich.c  | 1019 ------------------
src/add-ons/kernel/drivers/audio/ac97/ich/ich.h  |   84 --
src/add-ons/kernel/drivers/audio/ac97/ich/io.c   |  153 ---
src/add-ons/kernel/drivers/audio/ac97/ich/io.h   |   43 -
src/add-ons/kernel/drivers/audio/ac97/ich/util.c |  128 ---
src/add-ons/kernel/drivers/audio/ac97/ich/util.h |   41 -
.../kernel/drivers/audio/ac97/ichaudio/Jamfile   |   14 -
.../drivers/audio/ac97/ichaudio/hardware.h       |  135 ---
.../drivers/audio/ac97/ichaudio/ichaudio.c       |  418 -------
.../drivers/audio/ac97/ichaudio/ichaudio.h       |   51 -
.../kernel/drivers/audio/ac97/ichaudio/io.c      |  156 ---
.../kernel/drivers/audio/ac97/ichaudio/io.h      |   44 -
.../drivers/audio/ac97/ichaudio/lala/Jamfile     |    7 -
.../drivers/audio/ac97/ichaudio/lala/driver.c    |  220 ----
.../drivers/audio/ac97/ichaudio/lala/lala.h      |  142 ---
.../drivers/audio/ac97/ichaudio/lala/util.c      |  109 --
src/add-ons/kernel/drivers/audio/cmedia/cm.c     |   20 +-
.../kernel/drivers/audio/cmedia/cm_private.h     |    4 +-
src/add-ons/kernel/drivers/audio/cmedia/mixer.c  |   15 +-
src/add-ons/kernel/drivers/audio/cmedia/pcm.c    |   16 +-
src/add-ons/kernel/drivers/audio/echo/24/Jamfile |    5 +-
src/add-ons/kernel/drivers/audio/echo/3g/Jamfile |    6 +-
src/add-ons/kernel/drivers/audio/echo/echo.cpp   |   13 +-
.../kernel/drivers/audio/echo/gals/Jamfile       |   10 +-
.../kernel/drivers/audio/echo/generic/C3g.h      |    1 +
.../kernel/drivers/audio/echo/generic/C3gDco.h   |    1 +
.../audio/echo/generic/CDarla24DspCommObject.h   |    1 +
.../drivers/audio/echo/generic/CEchoGals.cpp     |    6 +-
.../drivers/audio/echo/generic/CEchoGals.h       |    2 +-
.../audio/echo/generic/CEchoGals_mixer.cpp       |    2 +-
.../audio/echo/generic/CEchoGals_transport.cpp   |    2 -
.../audio/echo/generic/CGina24DspCommObject.h    |    1 +
.../audio/echo/generic/CLayla24DspCommObject.h   |    1 +
.../audio/echo/generic/CLaylaDspCommObject.h     |    1 +
.../audio/echo/generic/CMonaDspCommObject.h      |    1 +
.../drivers/audio/echo/generic/CPipeOutCtrl.cpp  |   12 +-
.../drivers/audio/echo/generic/OsSupportBeOS.cpp |    4 +-
.../drivers/audio/echo/generic/OsSupportBeOS.h   |    4 +-
.../kernel/drivers/audio/echo/indigo/Jamfile     |    6 +-
src/add-ons/kernel/drivers/audio/echo/multi.cpp  |    6 +-
src/add-ons/kernel/drivers/audio/echo/util.c     |  123 ---
src/add-ons/kernel/drivers/audio/echo/util.h     |   50 -
src/add-ons/kernel/drivers/audio/emuxki/Jamfile  |    6 +
src/add-ons/kernel/drivers/audio/emuxki/emuxki.c |   26 +-
src/add-ons/kernel/drivers/audio/emuxki/emuxki.h |    6 +-
src/add-ons/kernel/drivers/audio/emuxki/multi.c  |    4 +-
src/add-ons/kernel/drivers/audio/emuxki/util.c   |  107 --
src/add-ons/kernel/drivers/audio/emuxki/util.h   |   40 -
.../drivers/audio/{ac97/auich => generic}/util.c |    2 +-
.../drivers/audio/{ac97/auich => generic}/util.h |    8 +
src/add-ons/kernel/drivers/audio/sb16/sb16_hw.c  |   33 +-
.../kernel/drivers/audio/sb16/sb16_multi_audio.c |   25 +-

############################################################################

Commit:      6f52406a739b92bb09c68790fec8b76c1fc578a2
URL:         https://git.haiku-os.org/haiku/commit/?id=6f52406a739b
Author:      Muhamed Emad <muhamed.emadeldeen@gmail.com>
Date:        Sun Apr  7 09:49:35 2024 UTC
Committer:   waddlesplash <waddlesplash@gmail.com>
Commit-Date: Mon Apr 15 16:02:49 2024 UTC

auich: Fix warnings, enable -Werror

Change-Id: I03a686d124444d60b92b34c1b7a10d73c872c21d
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7606
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>

----------------------------------------------------------------------------

diff --git a/build/jam/ArchitectureRules b/build/jam/ArchitectureRules
index c3cb15b8d0..eab2cb4ceb 100644
--- a/build/jam/ArchitectureRules
+++ b/build/jam/ArchitectureRules
@@ -674,7 +674,7 @@ rule ArchitectureSetupWarnings architecture
 	EnableWerror src add-ons kernel console ;
 	EnableWerror src add-ons kernel cpu ;
 	EnableWerror src add-ons kernel debugger ;
-#	EnableWerror src add-ons kernel drivers audio ac97 ;
+	EnableWerror src add-ons kernel drivers audio ac97 auich ;
 #	EnableWerror src add-ons kernel drivers audio cmedia ;
 #	EnableWerror src add-ons kernel drivers audio echo ;
 #	EnableWerror src add-ons kernel drivers audio emuxki ;
diff --git a/src/add-ons/kernel/drivers/audio/ac97/auich/multi.c \
b/src/add-ons/kernel/drivers/audio/ac97/auich/multi.c index af4f1cf6b8..b79b6db319 \
                100644
--- a/src/add-ons/kernel/drivers/audio/ac97/auich/multi.c
+++ b/src/add-ons/kernel/drivers/audio/ac97/auich/multi.c
@@ -182,9 +182,10 @@ auich_ac97_set_mix(void *card, const void *cookie, int32 type, \
float *values) {  
 
 static int32
-auich_create_group_control(multi_dev *multi, int32 *index, int32 parent,
-	int32 string, const char* name) {
-	int32 i = *index;
+auich_create_group_control(multi_dev *multi, uint32 *index, int32 parent, int32 \
string, +	const char* name)
+{
+	uint32 i = *index;
 	(*index)++;
 	multi->controls[i].mix_control.id = EMU_MULTI_CONTROL_FIRSTID + i;
 	multi->controls[i].mix_control.parent = parent;
@@ -201,7 +202,7 @@ auich_create_group_control(multi_dev *multi, int32 *index, int32 \
parent,  static status_t
 auich_create_controls_list(multi_dev *multi)
 {
-	uint32 	i = 0, index = 0, count, id, parent, parent2, parent3;
+	uint32 i = 0, index = 0, count, id, parent, parent2, parent3;
 	const ac97_source_info *info;
 
 	/* AC97 Mixer */
@@ -397,7 +398,7 @@ auich_get_mix(auich_dev *card, multi_mix_value_info * mmvi)
 	multi_mixer_control *control = NULL;
 	for (i = 0; i < mmvi->item_count; i++) {
 		id = mmvi->values[i].id - EMU_MULTI_CONTROL_FIRSTID;
-		if (id < 0 || id >= card->multi.control_count) {
+		if (id < 0 || (uint32)id >= card->multi.control_count) {
 			PRINT(("auich_get_mix : "
 				"invalid control id requested : %" B_PRIi32 "\n", id));
 			continue;
@@ -438,7 +439,7 @@ auich_set_mix(auich_dev *card, multi_mix_value_info * mmvi)
 	multi_mixer_control *control = NULL;
 	for (i = 0; i < mmvi->item_count; i++) {
 		id = mmvi->values[i].id - EMU_MULTI_CONTROL_FIRSTID;
-		if (id < 0 || id >= card->multi.control_count) {
+		if (id < 0 || (uint32)id >= card->multi.control_count) {
 			PRINT(("auich_set_mix : "
 				"invalid control id requested : %" B_PRIi32 "\n", id));
 			continue;
@@ -449,7 +450,7 @@ auich_set_mix(auich_dev *card, multi_mix_value_info * mmvi)
 			multi_mixer_control *control2 = NULL;
 			if (i+1<mmvi->item_count) {
 				id = mmvi->values[i + 1].id - EMU_MULTI_CONTROL_FIRSTID;
-				if (id < 0 || id >= card->multi.control_count) {
+				if (id < 0 || (uint32)id >= card->multi.control_count) {
 					PRINT(("auich_set_mix : "
 						"invalid control id requested : %" B_PRIi32 "\n", id));
 				} else {
@@ -501,7 +502,7 @@ static status_t
 auich_list_mix_controls(auich_dev *card, multi_mix_control_info * mmci)
 {
 	multi_mix_control	*mmc;
-	int32 i;
+	uint32 i;
 
 	mmc = mmci->controls;
 	if (mmci->control_count < 24)
@@ -509,9 +510,9 @@ auich_list_mix_controls(auich_dev *card, multi_mix_control_info * \
mmci)  
 	if (auich_create_controls_list(&card->multi) < B_OK)
 		return B_ERROR;
-	for (i = 0; i < card->multi.control_count; i++) {
+
+	for (i = 0; i < card->multi.control_count; i++)
 		mmc[i] = card->multi.controls[i].mix_control;
-	}
 
 	mmci->control_count = card->multi.control_count;
 	return B_OK;
@@ -582,7 +583,7 @@ auich_create_channels_list(multi_dev *multi)
 	chans = multi->chans;
 	index = 0;
 
-	for (mode=AUICH_USE_PLAY; mode!=-1;
+	for (mode = AUICH_USE_PLAY; (int32)mode != -1;
 		mode = (mode == AUICH_USE_PLAY) ? AUICH_USE_RECORD : -1) {
 		LIST_FOREACH(stream, &((auich_dev*)multi->card)->streams, next) {
 			if ((stream->use & mode) == 0)
@@ -595,18 +596,18 @@ auich_create_channels_list(multi_dev *multi)
 
 			for (i = 0; i < stream->channels; i++) {
 				chans[index].channel_id = index;
-				chans[index].kind = (mode == AUICH_USE_PLAY) ? B_MULTI_OUTPUT_CHANNEL : \
B_MULTI_INPUT_CHANNEL; +				chans[index].kind
+					= (mode == AUICH_USE_PLAY) ? B_MULTI_OUTPUT_CHANNEL : B_MULTI_INPUT_CHANNEL;
 				chans[index].designations = designations | chan_designations[i];
 				chans[index].connectors = 0;
 				index++;
 			}
 		}
 
-		if (mode==AUICH_USE_PLAY) {
+		if (mode == AUICH_USE_PLAY)
 			multi->output_channel_count = index;
-		} else {
+		else
 			multi->input_channel_count = index - multi->output_channel_count;
-		}
 	}
 
 	chans[index].channel_id = index;
@@ -690,7 +691,7 @@ auich_get_description(auich_dev *card, multi_description *data)
 	// channels and input bus channels and finally auxillary channels,
 
 	LOG(("request_channel_count = %d\n",data->request_channel_count));
-	if (data->request_channel_count >= size) {
+	if (data->request_channel_count >= (int32)size) {
 		LOG(("copying data\n"));
 		memcpy(data->channels, card->multi.chans, size * sizeof(card->multi.chans[0]));
 	}
diff --git a/src/add-ons/kernel/drivers/audio/ac97/auich/util.c \
b/src/add-ons/kernel/drivers/audio/ac97/auich/util.c index 827728bd3d..de988c2e3a \
                100644
--- a/src/add-ons/kernel/drivers/audio/ac97/auich/util.c
+++ b/src/add-ons/kernel/drivers/audio/ac97/auich/util.c
@@ -121,7 +121,7 @@ map_mem(void **log, phys_addr_t phy, size_t size, const char \
*name)  size = round_to_pagesize(size + offset);
 	area = map_physical_memory(name, phyadr, size, B_ANY_KERNEL_ADDRESS,
 		B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA, &mapadr);
-	*log = mapadr + offset;
+	*log = (void *)((uintptr_t)mapadr + (uintptr_t)offset);
 
 	LOG(("physical = %p, logical = %p, offset = %#x, phyadr = %p, mapadr = %p, size = \
%#x, area = %#x\n",  phy, *log, offset, phyadr, mapadr, size, area));

############################################################################

Commit:      fe640d9339f5a243da017baa32cb51b600e47d4b
URL:         https://git.haiku-os.org/haiku/commit/?id=fe640d9339f5
Author:      PulkoMandy <pulkomandy@pulkomandy.tk>
Date:        Sun Apr  7 18:58:47 2024 UTC
Committer:   waddlesplash <waddlesplash@gmail.com>
Commit-Date: Mon Apr 15 16:02:49 2024 UTC

pcmcia: fix compilation warnings and errors

Needed for the echo indigo soundcard driver build.

IRQ is used as a field name in pmcia/cs.h. The IRQ() macro should only
be used with parameters. So we can avoid the use of IRQ in cs.h being
accidentally replaced by the macro.

Change-Id: Ib10f3c5148cfb7c87a0b258a95a590778b6e5cb4
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7608
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>

----------------------------------------------------------------------------

diff --git a/headers/os/drivers/pcmcia/k_compat.h \
b/headers/os/drivers/pcmcia/k_compat.h index c19d762918..779d26c6d3 100644
--- a/headers/os/drivers/pcmcia/k_compat.h
+++ b/headers/os/drivers/pcmcia/k_compat.h
@@ -79,7 +79,7 @@ static inline void *ioremap(u_long base, u_long size)
     area_id id;
     void *virt;
     sprintf(tag, "pccard %08lx", base);
-    id = map_physical_memory(tag, (void *)base,
+    id = map_physical_memory(tag, (phys_addr_t)base,
 			     size, B_ANY_KERNEL_ADDRESS,
 			     B_READ_AREA | B_WRITE_AREA, &virt);
     return (id < 0) ? NULL : virt;
@@ -184,7 +184,7 @@ void free(void *);
 //#define REQUEST_IRQ(i,h,f,n,d)	install_io_interrupt_handler(i,h,d,0)
 //#define FREE_IRQ(i,h,d)		remove_io_interrupt(i,h)
 //#define IRQ(i,d,r)		(d)
-#define IRQ
+#define IRQ(i,d,r)
 #define DEV_ID			dev_id
 #define NR_IRQS			16
 #define SA_SHIRQ		1

############################################################################

Commit:      af8ec5e1b410ea1587e16d7260573783b88af2c3
URL:         https://git.haiku-os.org/haiku/commit/?id=af8ec5e1b410
Author:      Muhamed Emad <muhamed.emadeldeen@gmail.com>
Date:        Sun Apr  7 18:33:08 2024 UTC
Committer:   waddlesplash <waddlesplash@gmail.com>
Commit-Date: Mon Apr 15 16:02:49 2024 UTC

Ticket:      https://dev.haiku-os.org/ticket/9460

echo: enable Werror

Part of #9460

* If there is an operation between signed and unsigned int, the unsigned is changed \
to signed one,  except for some operations (if before the operation the signed one is \
checked to be less than  zero or not, then the signed one get cast to be unsigned \
(errors due to sign error when casting  are impossible))
* When doing operations on pointers, integers get cast to uintptr_t type

Untested: I don't have the hardware.

Change-Id: I6a959c004862e055ee99f6f2ad5ca3397b32cdd2
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7484
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>

----------------------------------------------------------------------------

diff --git a/src/add-ons/kernel/drivers/audio/echo/multi.cpp \
b/src/add-ons/kernel/drivers/audio/echo/multi.cpp index 6b5dfcda1b..17dbb06658 100644
--- a/src/add-ons/kernel/drivers/audio/echo/multi.cpp
+++ b/src/add-ons/kernel/drivers/audio/echo/multi.cpp
@@ -255,7 +255,7 @@ echo_get_mix(echo_dev *card, multi_mix_value_info * mmvi)
 	multi_mixer_control *control = NULL;
 	for (i = 0; i < mmvi->item_count; i++) {
 		id = mmvi->values[i].id - MULTI_CONTROL_FIRSTID;
-		if (id < 0 || id >= card->multi.control_count) {
+		if (id < 0 || (uint32)id >= card->multi.control_count) {
 			PRINT(("echo_get_mix : invalid control id requested : %" B_PRIu32
 				"\n", id));
 			continue;
@@ -297,7 +297,7 @@ echo_set_mix(echo_dev *card, multi_mix_value_info * mmvi)
 	multi_mixer_control *control = NULL;
 	for (i = 0; i < mmvi->item_count; i++) {
 		id = mmvi->values[i].id - MULTI_CONTROL_FIRSTID;
-		if (id < 0 || id >= card->multi.control_count) {
+		if (id < 0 || (uint32)id >= card->multi.control_count) {
 			PRINT(("echo_set_mix : invalid control id requested : %" B_PRIu32
 				"\n", id));
 			continue;
@@ -308,7 +308,7 @@ echo_set_mix(echo_dev *card, multi_mix_value_info * mmvi)
 			multi_mixer_control *control2 = NULL;
 			if (i + 1 < mmvi->item_count) {
 				id = mmvi->values[i + 1].id - MULTI_CONTROL_FIRSTID;
-				if (id < 0 || id >= card->multi.control_count) {
+				if (id < 0 || (uint32)id >= card->multi.control_count) {
 					PRINT(("echo_set_mix : invalid control id requested : %"
 						B_PRIu32 "\n", id));
 				} else {
diff --git a/src/add-ons/kernel/drivers/audio/echo/util.c \
b/src/add-ons/kernel/drivers/audio/echo/util.c index b76abf46d7..d4b4648d64 100644
--- a/src/add-ons/kernel/drivers/audio/echo/util.c
+++ b/src/add-ons/kernel/drivers/audio/echo/util.c
@@ -114,7 +114,7 @@ map_mem(void **log, phys_addr_t phy, size_t size, const char \
*name)  size = round_to_pagesize(size + offset);
 	area = map_physical_memory(name, phyadr, size, B_ANY_KERNEL_ADDRESS,
 		B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA, &mapadr);
-	*log = mapadr + offset;
+	*log = (void *)((uintptr_t)mapadr + (uintptr_t)offset);
 
 	LOG(("physical = %p, logical = %p, offset = %#x, phyadr = %p, mapadr = %p, size = \
%#x, area = %#x\n",  phy, *log, offset, phyadr, mapadr, size, area));

############################################################################

Commit:      d6e543c38874a9f109552a34d35f3c2ddaf6ebd3
URL:         https://git.haiku-os.org/haiku/commit/?id=d6e543c38874
Author:      PulkoMandy <pulkomandy@pulkomandy.tk>
Date:        Sun Apr  7 18:33:37 2024 UTC
Committer:   waddlesplash <waddlesplash@gmail.com>
Commit-Date: Mon Apr 15 16:02:49 2024 UTC

emuxki: enable Werror

Change-Id: I6ed7bfbe157bee86a8ce1dabc5829b8825e43f99
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7609
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>

----------------------------------------------------------------------------

diff --git a/build/jam/ArchitectureRules b/build/jam/ArchitectureRules
index eab2cb4ceb..e4170febb5 100644
--- a/build/jam/ArchitectureRules
+++ b/build/jam/ArchitectureRules
@@ -674,10 +674,17 @@ rule ArchitectureSetupWarnings architecture
 	EnableWerror src add-ons kernel console ;
 	EnableWerror src add-ons kernel cpu ;
 	EnableWerror src add-ons kernel debugger ;
+#	EnableWerror src add-ons kernel drivers audio ac97 ;
 	EnableWerror src add-ons kernel drivers audio ac97 auich ;
+#	EnableWerror src add-ons kernel drivers audio ac97 auvia ;
+#	EnableWerror src add-ons kernel drivers audio ac97 es1370 ;
+#	EnableWerror src add-ons kernel drivers audio ac97 geode ;
+#	EnableWerror src add-ons kernel drivers audio ac97 ich ;
+#	EnableWerror src add-ons kernel drivers audio ac97 ichaudio ;
+	EnableWerror src add-ons kernel drivers audio ac97 sis7018 ;
 #	EnableWerror src add-ons kernel drivers audio cmedia ;
-#	EnableWerror src add-ons kernel drivers audio echo ;
-#	EnableWerror src add-ons kernel drivers audio emuxki ;
+	EnableWerror src add-ons kernel drivers audio echo ;
+	EnableWerror src add-ons kernel drivers audio emuxki ;
 	EnableWerror src add-ons kernel drivers audio generic ;
 	EnableWerror src add-ons kernel drivers audio hda ;
 	EnableWerror src add-ons kernel drivers audio ice1712 ;
diff --git a/src/add-ons/kernel/drivers/audio/emuxki/emuxki.c \
b/src/add-ons/kernel/drivers/audio/emuxki/emuxki.c index 965a97e16e..246e156de5 \
                100644
--- a/src/add-ons/kernel/drivers/audio/emuxki/emuxki.c
+++ b/src/add-ons/kernel/drivers/audio/emuxki/emuxki.c
@@ -252,7 +252,7 @@ emuxki_pmem_alloc(emuxki_dev *card, size_t size)
 	uint32      j, *ptb, silentpage;
 
 	ptb = card->ptb_log_base;
-	silentpage = ((uint32)card->silentpage_phy_base) << 1;
+	silentpage = ((uintptr_t)card->silentpage_phy_base) << 1;
 	numblocks = size / EMU_PTESIZE;
 	if (size % EMU_PTESIZE)
 		numblocks++;
@@ -278,7 +278,7 @@ emuxki_pmem_alloc(emuxki_dev *card, size_t size)
 				PRINT(("emuxki_pmem_alloc : j == numblocks emuxki_mem_new ok\n"));
 				for (j = 0; j < numblocks; j++)
 					ptb[i + j] = B_HOST_TO_LENDIAN_INT32((uint32) (
-						(( ((uint32)mem->phy_base) +
+						(( ((uintptr_t)mem->phy_base) +
 						 j * EMU_PTESIZE) << 1)
 						| (i + j)));
 				LIST_INSERT_HEAD(&(card->mem), mem, next);
@@ -324,7 +324,7 @@ emuxki_mem_free(emuxki_dev *card, void *ptr)
 	uint32      	i, *ptb, silentpage;
 
 	ptb = card->ptb_log_base;
-	silentpage = ((uint32)card->silentpage_phy_base) << 1;
+	silentpage = ((uintptr_t)card->silentpage_phy_base) << 1;
 	LOG(("emuxki_mem_free 1\n"));
 	LIST_FOREACH(mem, &card->mem, next) {
 		LOG(("emuxki_mem_free 2\n"));
@@ -542,7 +542,7 @@ emuxki_channel_commit_parms(emuxki_channel *chan)
 
 	start = chan->loop.start +
 		(voice->stereo ? 28 : 30) * (voice->b16 + 1);
-	mapval = ((uint32)card->silentpage_phy_base) << 1 | EMU_CHAN_MAP_PTI_MASK;
+	mapval = ((uintptr_t)card->silentpage_phy_base) << 1 | EMU_CHAN_MAP_PTI_MASK;
 
 	//s = splaudio();
 	emuxki_chan_write(&card->config, chano, EMU_CHAN_CPF_STEREO, voice->stereo);
@@ -1196,7 +1196,7 @@ emuxki_voice_commit_parms(emuxki_voice *voice)
 			default:
 				return B_ERROR;
 		}
-		emuxki_chan_write(&voice->stream->card->config, 0, buffaddr_reg, \
(uint32)voice->buffer->phy_base); +		emuxki_chan_write(&voice->stream->card->config, \
0, buffaddr_reg, (uintptr_t)voice->buffer->phy_base);  \
emuxki_chan_write(&voice->stream->card->config, 0, buffsize_reg, \
EMU_RECBS_BUFSIZE_NONE);  emuxki_chan_write(&voice->stream->card->config, 0, \
buffsize_reg, EMU_RECBS_BUFSIZE_4096);  
@@ -1810,6 +1810,7 @@ emuxki_gpr_get(emuxki_dev *card, emuxki_gpr *gpr, int32 type, \
float *values)  }
 
 
+#if DEBUG > 0
 void
 emuxki_gpr_dump(emuxki_dev * card, uint16 count)
 {
@@ -1823,6 +1824,7 @@ emuxki_gpr_dump(emuxki_dev * card, uint16 count)
 		LOG(("dsp_gpr pc=%x, value=%x\n", pc, value));
 	}
 }
+#endif
 
 
 static emuxki_gpr *
@@ -2828,13 +2830,13 @@ emuxki_init(emuxki_dev * card)
 	 * address by one and OR it with the page number. I don't know what
 	 * the ORed index is for, might be a very useful unused feature...
 	 */
-	silentpage = ((uint32)card->silentpage_phy_base) << 1;
+	silentpage = ((uintptr_t)card->silentpage_phy_base) << 1;
 	ptb = card->ptb_log_base;
 	for (i = 0; i < EMU_MAXPTE; i++)
 		ptb[i] = B_HOST_TO_LENDIAN_INT32(silentpage | i);
 
 	/* Write PTB address and set TCB to none */
-	emuxki_chan_write(&card->config, 0, EMU_PTB, (uint32)card->ptb_phy_base);
+	emuxki_chan_write(&card->config, 0, EMU_PTB, (uintptr_t)card->ptb_phy_base);
 	emuxki_chan_write(&card->config, 0, EMU_TCBS, 0);	/* This means 16K TCB */
 	emuxki_chan_write(&card->config, 0, EMU_TCB, 0);	/* No TCB use for now */
 
diff --git a/src/add-ons/kernel/drivers/audio/emuxki/multi.c \
b/src/add-ons/kernel/drivers/audio/emuxki/multi.c index 288bbb7280..1f0c82703a 100644
--- a/src/add-ons/kernel/drivers/audio/emuxki/multi.c
+++ b/src/add-ons/kernel/drivers/audio/emuxki/multi.c
@@ -200,7 +200,7 @@ emuxki_parameter_set_mix(void *card, const void *cookie, int32 \
type, float *valu  }
 
 static int32
-emuxki_create_group_control(multi_dev *multi, int32 *index, int32 parent,
+emuxki_create_group_control(multi_dev *multi, uint32 *index, int32 parent,
 	int32 string, const char* name) {
 	int32 i = *index;
 	(*index)++;
@@ -216,7 +216,7 @@ emuxki_create_group_control(multi_dev *multi, int32 *index, int32 \
parent,  }
 
 static void
-emuxki_create_gpr_control(multi_dev *multi, int32 *index, int32 parent, int32 \
string, +emuxki_create_gpr_control(multi_dev *multi, uint32 *index, int32 parent, \
int32 string,  const emuxki_gpr *gpr) {
 	int32 i = *index, id;
 	multi_mixer_control control;

############################################################################

Commit:      464efaf403323c5accae19049acd21a7c38e4af1
URL:         https://git.haiku-os.org/haiku/commit/?id=464efaf40332
Author:      Muhamed Emad <muhamed.emadeldeen@gmail.com>
Date:        Sat Apr  6 12:06:12 2024 UTC
Committer:   waddlesplash <waddlesplash@gmail.com>
Commit-Date: Mon Apr 15 16:02:49 2024 UTC

auvia: enable -Werror, style fixes

Move util.c from auich (the most up to date version) to the parent
directory of ac97. Use it also for auvia. This means changing several
physical addresses to use phys_addr_t instead of pointers, and declaring
buffers allocated by alloc_mem to be user-accessible or not.

Untested, I don't have the hardware.

Change-Id: I2ababc713384cbf34174fbcecfb3595547a1fd97
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7602
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Alexander von Gluck <alex@terarocket.io>

----------------------------------------------------------------------------

diff --git a/build/jam/ArchitectureRules b/build/jam/ArchitectureRules
index e4170febb5..1b316221ff 100644
--- a/build/jam/ArchitectureRules
+++ b/build/jam/ArchitectureRules
@@ -676,7 +676,7 @@ rule ArchitectureSetupWarnings architecture
 	EnableWerror src add-ons kernel debugger ;
 #	EnableWerror src add-ons kernel drivers audio ac97 ;
 	EnableWerror src add-ons kernel drivers audio ac97 auich ;
-#	EnableWerror src add-ons kernel drivers audio ac97 auvia ;
+	EnableWerror src add-ons kernel drivers audio ac97 auvia ;
 #	EnableWerror src add-ons kernel drivers audio ac97 es1370 ;
 #	EnableWerror src add-ons kernel drivers audio ac97 geode ;
 #	EnableWerror src add-ons kernel drivers audio ac97 ich ;
diff --git a/src/add-ons/kernel/drivers/audio/ac97/auvia/auvia.c \
b/src/add-ons/kernel/drivers/audio/ac97/auvia/auvia.c index 3a698e561a..63bbec115b \
                100644
--- a/src/add-ons/kernel/drivers/audio/ac97/auvia/auvia.c
+++ b/src/add-ons/kernel/drivers/audio/ac97/auvia/auvia.c
@@ -73,7 +73,7 @@ auvia_mem_new(auvia_dev *card, size_t size)
 	if ((mem = malloc(sizeof(*mem))) == NULL)
 		return (NULL);
 
-	mem->area = alloc_mem(&mem->phy_base, &mem->log_base, size, "auvia buffer");
+	mem->area = alloc_mem(&mem->phy_base, &mem->log_base, size, "auvia buffer", false);
 	mem->size = size;
 	if (mem->area < B_OK) {
 		free(mem);
@@ -145,14 +145,14 @@ auvia_stream_set_audioparms(auvia_stream *stream, uint8 \
channels,  
 	sample_size = stream->b16 + 1;
 	frame_size = sample_size * stream->channels;
-	
+
 	stream->buffer = auvia_mem_alloc(stream->card, stream->bufframes 
 		* frame_size * stream->bufcount);
-	
+
 	stream->trigblk = 0;	/* This shouldn't be needed */
 	stream->blkmod = stream->bufcount;
 	stream->blksize = stream->bufframes * frame_size;
-		
+
 	return B_OK;
 }
 
@@ -160,50 +160,49 @@ auvia_stream_set_audioparms(auvia_stream *stream, uint8 \
channels,  status_t
 auvia_stream_commit_parms(auvia_stream *stream)
 {
-	int             i;
-	uint32      	*page;
-	uint32			value;
+	int i;
+	uint32* page;
+	uint32 value;
 	LOG(("auvia_stream_commit_parms\n"));
-	
+
 	page = stream->dmaops_log_base;
-	
+
 	for(i = 0; i < stream->bufcount; i++) {
-		page[2*i] = ((uint32)stream->buffer->phy_base) + 
-			i * stream->blksize;
-		page[2*i + 1] = AUVIA_DMAOP_FLAG | stream->blksize;
+		page[2 * i] = stream->buffer->phy_base + i * stream->blksize;
+		page[2 * i + 1] = AUVIA_DMAOP_FLAG | stream->blksize;
 	}
-	
-	page[2*stream->bufcount - 1] &= ~AUVIA_DMAOP_FLAG;
-	page[2*stream->bufcount - 1] |= AUVIA_DMAOP_EOL;
-	
-	auvia_reg_write_32(&stream->card->config, stream->base + AUVIA_RP_DMAOPS_BASE, 
-		(uint32)stream->dmaops_phy_base);
-		
+
+	page[2 * stream->bufcount - 1] &= ~AUVIA_DMAOP_FLAG;
+	page[2 * stream->bufcount - 1] |= AUVIA_DMAOP_EOL;
+
+	auvia_reg_write_32(&stream->card->config, stream->base + AUVIA_RP_DMAOPS_BASE,
+		stream->dmaops_phy_base);
+
 	if(stream->use & AUVIA_USE_RECORD)
-		auvia_codec_write(&stream->card->config, AC97_PCM_L_R_ADC_RATE, 
+		auvia_codec_write(&stream->card->config, AC97_PCM_L_R_ADC_RATE,
 			(uint16)stream->sample_rate);
 	else
-		auvia_codec_write(&stream->card->config, AC97_PCM_FRONT_DAC_RATE, 
+		auvia_codec_write(&stream->card->config, AC97_PCM_FRONT_DAC_RATE,
 			(uint16)stream->sample_rate);
-	
+
 	if(IS_8233(&stream->card->config)) {
 		if(stream->base != AUVIA_8233_MP_BASE) {
-			value = auvia_reg_read_32(&stream->card->config, stream->base 
+			value = auvia_reg_read_32(&stream->card->config, stream->base
 				+ AUVIA_8233_RP_RATEFMT);
-			value &= ~(AUVIA_8233_RATEFMT_48K | AUVIA_8233_RATEFMT_STEREO 
+			value &= ~(AUVIA_8233_RATEFMT_48K | AUVIA_8233_RATEFMT_STEREO
 				| AUVIA_8233_RATEFMT_16BIT);
 			if(stream->use & AUVIA_USE_PLAY)
-				value |= AUVIA_8233_RATEFMT_48K * (stream->sample_rate / 20) 
+				value |= AUVIA_8233_RATEFMT_48K * (stream->sample_rate / 20)
 					/ (48000 / 20);
 			value |= (stream->channels == 2 ? AUVIA_8233_RATEFMT_STEREO : 0)
 				| (stream->b16 ? AUVIA_8233_RATEFMT_16BIT : 0);
-			auvia_reg_write_32(&stream->card->config, stream->base 
+			auvia_reg_write_32(&stream->card->config, stream->base
 				+ AUVIA_8233_RP_RATEFMT, value);
 		} else {
-			static const uint32 slottab[7] = {0, 0xff000011, 0xff000021, 
+			static const uint32 slottab[7] = {0, 0xff000011, 0xff000021,
 				0xff000521, 0xff004321, 0xff054321, 0xff654321};
 			value = (stream->b16 ? AUVIA_8233_MP_FORMAT_16BIT : AUVIA_8233_MP_FORMAT_8BIT)
-				| ((stream->channels << 4) & AUVIA_8233_MP_FORMAT_CHANNEL_MASK) ;
+				| ((stream->channels << 4) & AUVIA_8233_MP_FORMAT_CHANNEL_MASK);
 			auvia_reg_write_8(&stream->card->config, stream->base 
 				+ AUVIA_8233_OFF_MP_FORMAT, value);
 			auvia_reg_write_32(&stream->card->config, stream->base 
@@ -211,7 +210,7 @@ auvia_stream_commit_parms(auvia_stream *stream)
 		}
 	}
 	//auvia_codec_write(&stream->card->config, AC97_SPDIF_CONTROL, \
                (uint16)stream->sample_rate);
-		
+
 	return B_OK;
 }
 
@@ -226,7 +225,7 @@ auvia_stream_get_nth_buffer(auvia_stream *stream, uint8 chan, \
uint8 buf,  sample_size = stream->b16 + 1;
 	frame_size = sample_size * stream->channels;
 	
-	*buffer = stream->buffer->log_base + (buf * stream->bufframes * frame_size)
+	*buffer =(char *)((addr_t)stream->buffer->log_base + (uintptr_t)(buf * \
stream->bufframes * frame_size))  + chan * sample_size;
 	*stride = frame_size;
 	
@@ -240,12 +239,12 @@ auvia_stream_curaddr(auvia_stream *stream)
 	uint32 addr;
 	if(IS_8233(&stream->card->config)) {
 		addr = auvia_reg_read_32(&stream->card->config, stream->base + \
                AUVIA_RP_DMAOPS_BASE);
-		TRACE(("stream_curaddr %p, phy_base %p\n", addr, \
                (uint32)stream->dmaops_phy_base));
-		return (addr - (uint32)stream->dmaops_phy_base - 4) / 8;
+		TRACE(("stream_curaddr %p, phy_base %p\n", addr, stream->dmaops_phy_base));
+		return (addr - stream->dmaops_phy_base - 4) / 8;
 	} else {
 		addr = auvia_reg_read_32(&stream->card->config, stream->base + \
                AUVIA_RP_DMAOPS_BASE);
-		TRACE(("stream_curaddr %p, phy_base %p\n", addr, \
                (uint32)stream->dmaops_phy_base));
-		return (addr - (uint32)stream->dmaops_phy_base - 8) / 8;
+		TRACE(("stream_curaddr %p, phy_base %p\n", addr, stream->dmaops_phy_base));
+		return (addr - stream->dmaops_phy_base - 8) / 8;
 	}
 }
 
@@ -336,7 +335,7 @@ auvia_stream_new(auvia_dev *card, uint8 use, uint32 bufframes, \
uint8 bufcount)  
 	/* allocate memory for our dma ops */
 	stream->dmaops_area = alloc_mem(&stream->dmaops_phy_base, &stream->dmaops_log_base, \
                
-		VIA_TABLE_SIZE, "auvia dmaops");
+		VIA_TABLE_SIZE, "auvia dmaops", false);
 		
 	if (stream->dmaops_area < B_OK) {
 		PRINT(("couldn't allocate memory\n"));
diff --git a/src/add-ons/kernel/drivers/audio/ac97/auvia/auvia.h \
b/src/add-ons/kernel/drivers/audio/ac97/auvia/auvia.h index 3cc0138cdd..26b6b9090d \
                100644
--- a/src/add-ons/kernel/drivers/audio/ac97/auvia/auvia.h
+++ b/src/add-ons/kernel/drivers/audio/ac97/auvia/auvia.h
@@ -82,10 +82,10 @@
 
 typedef struct _auvia_mem {
 	LIST_ENTRY(_auvia_mem) next;
-	void	*log_base;
-	void	*phy_base;
-	area_id area;
-	size_t	size;
+	void*		log_base;
+	phys_addr_t	phy_base;
+	area_id		area;
+	size_t		size;
 } auvia_mem;
 
 /*
@@ -93,37 +93,37 @@ typedef struct _auvia_mem {
  */
 
 typedef struct _auvia_stream {
-	struct _auvia_dev 	*card;
-	uint8        		use;
-	uint8        		state;
-	uint8        		b16;
-	uint32       		sample_rate;
+	struct _auvia_dev	*card;
+	uint8				use;
+	uint8				state;
+	uint8				b16;
+	uint32				sample_rate;
 	uint8				channels;
-	uint32 				bufframes;
-	uint8 				bufcount;
+	uint32				bufframes;
+	uint8				bufcount;
 
 	uint32				base;
 
 	LIST_ENTRY(_auvia_stream)	next;
 
-	void            	(*inth) (void *);
-	void           		*inthparam;
+	void				(*inth) (void *);
+	void				*inthparam;
 
-	void	*dmaops_log_base;
-	void	*dmaops_phy_base;
-	area_id dmaops_area;
+	void*				dmaops_log_base;
+	phys_addr_t			dmaops_phy_base;
+	area_id				dmaops_area;
 
-	auvia_mem *buffer;
-	uint16       blksize;	/* in samples */
-	uint16       trigblk;	/* blk on which to trigger inth */
-	uint16       blkmod;	/* Modulo value to wrap trigblk */
+	auvia_mem*			buffer;
+	uint16				blksize;	/* in samples */
+	uint16				trigblk;	/* blk on which to trigger inth */
+	uint16				blkmod;	/* Modulo value to wrap trigblk */
 
 	/* multi_audio */
-	volatile int64	frames_count;	// for play or record
-	volatile bigtime_t real_time;	// for play or record
-	volatile int32	buffer_cycle;	// for play or record
-	int32 first_channel;
-	bool update_needed;
+	volatile int64		frames_count;	// for play or record
+	volatile bigtime_t	real_time;	// for play or record
+	volatile int32		buffer_cycle;	// for play or record
+	int32				first_channel;
+	bool				update_needed;
 } auvia_stream;
 
 /*
diff --git a/src/add-ons/kernel/drivers/audio/ac97/auvia/multi.c \
b/src/add-ons/kernel/drivers/audio/ac97/auvia/multi.c index f5af596814..94b1c76dcb \
                100644
--- a/src/add-ons/kernel/drivers/audio/ac97/auvia/multi.c
+++ b/src/add-ons/kernel/drivers/audio/ac97/auvia/multi.c
@@ -176,8 +176,8 @@ auvia_ac97_set_mix(void *card, const void *cookie, int32 type, \
float *values) {  
 
 static int32
-auvia_create_group_control(multi_dev *multi, int32 *index, int32 parent,
-	int32 string, const char* name)
+auvia_create_group_control(multi_dev* multi, uint32* index, int32 parent, int32 \
string, +	const char* name)
 {
 	int32 i = *index;
 	(*index)++;
@@ -186,9 +186,10 @@ auvia_create_group_control(multi_dev *multi, int32 *index, int32 \
parent,  multi->controls[i].mix_control.flags = B_MULTI_MIX_GROUP;
 	multi->controls[i].mix_control.master = EMU_MULTI_CONTROL_MASTERID;
 	multi->controls[i].mix_control.string = string;
-	if (name)
+	if (name) {
 		strlcpy(multi->controls[i].mix_control.name, name,
 			sizeof(multi->controls[i].mix_control.name));
+	}
 
 	return multi->controls[i].mix_control.id;
 }
@@ -198,7 +199,6 @@ static status_t
 auvia_create_controls_list(multi_dev *multi)
 {
 	uint32 	i = 0, index = 0, count, id, parent, parent2, parent3;
-	auvia_dev *card = (auvia_dev*)multi->card;
 	const ac97_source_info *info;
 
 	parent = auvia_create_group_control(multi, &index, 0, 0, "Record");
@@ -402,7 +402,7 @@ auvia_get_mix(auvia_dev *card, multi_mix_value_info * mmvi)
 	multi_mixer_control *control = NULL;
 	for (i = 0; i < mmvi->item_count; i++) {
 		id = mmvi->values[i].id - EMU_MULTI_CONTROL_FIRSTID;
-		if (id < 0 || id >= card->multi.control_count) {
+		if (id < 0 || (uint32)id >= card->multi.control_count) {
 			PRINT(("auvia_get_mix : "
 				"invalid control id requested : %" B_PRIi32 "\n", id));
 			continue;
@@ -443,7 +443,7 @@ auvia_set_mix(auvia_dev *card, multi_mix_value_info * mmvi)
 	multi_mixer_control *control = NULL;
 	for (i = 0; i < mmvi->item_count; i++) {
 		id = mmvi->values[i].id - EMU_MULTI_CONTROL_FIRSTID;
-		if (id < 0 || id >= card->multi.control_count) {
+		if (id < 0 || (uint32)id >= card->multi.control_count) {
 			PRINT(("auvia_set_mix : "
 				"invalid control id requested : %" B_PRIi32 "\n", id));
 			continue;
@@ -454,7 +454,7 @@ auvia_set_mix(auvia_dev *card, multi_mix_value_info * mmvi)
 			multi_mixer_control *control2 = NULL;
 			if (i + 1 < mmvi->item_count) {
 				id = mmvi->values[i + 1].id - EMU_MULTI_CONTROL_FIRSTID;
-				if (id < 0 || id >= card->multi.control_count) {
+				if (id < 0 || (uint32)id >= card->multi.control_count) {
 					PRINT(("auvia_set_mix : "
 						"invalid control id requested : %" B_PRIi32 "\n", id));
 				} else {
@@ -506,7 +506,7 @@ static status_t
 auvia_list_mix_controls(auvia_dev *card, multi_mix_control_info * mmci)
 {
 	multi_mix_control	*mmc;
-	int32 i;
+	uint32 i;
 
 	mmc = mmci->controls;
 	if (mmci->control_count < 24)
@@ -573,7 +573,8 @@ static void
 auvia_create_channels_list(multi_dev *multi)
 {
 	auvia_stream *stream;
-	uint32 index, i, mode, designations;
+	uint32 index, i, designations;
+	int32 mode;
 	multi_channel_info *chans;
 	uint32 chan_designations[] = {
 		B_CHANNEL_LEFT,
@@ -600,7 +601,8 @@ auvia_create_channels_list(multi_dev *multi)
 
 			for (i = 0; i < stream->channels; i++) {
 				chans[index].channel_id = index;
-				chans[index].kind = (mode == AUVIA_USE_PLAY) ? B_MULTI_OUTPUT_CHANNEL : \
B_MULTI_INPUT_CHANNEL; +				chans[index].kind =
+					(mode == AUVIA_USE_PLAY) ? B_MULTI_OUTPUT_CHANNEL : B_MULTI_INPUT_CHANNEL;
 				chans[index].designations = designations | chan_designations[i];
 				chans[index].connectors = 0;
 				index++;
@@ -706,7 +708,7 @@ auvia_get_description(auvia_dev *card, multi_description *data)
 	// channels and input bus channels and finally auxillary channels,
 
 	LOG(("request_channel_count = %d\n",data->request_channel_count));
-	if (data->request_channel_count >= size) {
+	if (data->request_channel_count >= (int32)size) {
 		LOG(("copying data\n"));
 		memcpy(data->channels, card->multi.chans, size * sizeof(card->multi.chans[0]));
 	}
@@ -799,10 +801,10 @@ auvia_get_buffers(auvia_dev *card, multi_buffer_list *data)
 	pchannels = card->pstream->channels;
 	rchannels = card->rstream->channels;
 
-	if (data->request_playback_buffers < BUFFER_COUNT ||
-		data->request_playback_channels < (pchannels) ||
-		data->request_record_buffers < BUFFER_COUNT ||
-		data->request_record_channels < (rchannels)) {
+	if (data->request_playback_buffers < BUFFER_COUNT
+		|| data->request_playback_channels < (int32)(pchannels)
+		|| data->request_record_buffers < BUFFER_COUNT
+		|| data->request_record_channels < (int32)(rchannels)) {
 		LOG(("not enough channels/buffers\n"));
 	}
 
diff --git a/src/add-ons/kernel/drivers/audio/ac97/auvia/util.c \
b/src/add-ons/kernel/drivers/audio/ac97/auvia/util.c deleted file mode 100644
index 25394fd919..0000000000
--- a/src/add-ons/kernel/drivers/audio/ac97/auvia/util.c
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * BeOS Driver for Intel ICH AC'97 Link interface
- *
- * Copyright (c) 2002, Marcus Overhagen <marcus@overhagen.de>
- *
- * All rights reserved.
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- *
- * - Redistributions of source code must retain the above copyright notice,
- *   this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright notice,
- *   this list of conditions and the following disclaimer in the documentation
- *   and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
- * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
- * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- */
-#include <Errors.h>
-#include <OS.h>
-#include <string.h>
-
-//#define DEBUG 2
-
-#include "debug.h"
-#include "util.h"
-
-spinlock slock = B_SPINLOCK_INITIALIZER;
-
-uint32 round_to_pagesize(uint32 size);
-
-
-cpu_status
-lock(void)
-{
-	cpu_status status = disable_interrupts();
-	acquire_spinlock(&slock);
-	return status;
-}
-
-
-void
-unlock(cpu_status status)
-{
-	release_spinlock(&slock);
-	restore_interrupts(status);
-}
-
-
-uint32
-round_to_pagesize(uint32 size)
-{
-	return (size + B_PAGE_SIZE - 1) & ~(B_PAGE_SIZE - 1);
-}
-
-
-area_id
-alloc_mem(void **phy, void **log, size_t size, const char *name)
-{
-// TODO: phy should be phys_addr_t*!
-	physical_entry pe;
-	void * logadr;
-	area_id areaid;
-	status_t rv;
-
-	LOG(("allocating %d bytes for %s\n",size,name));
-
-	size = round_to_pagesize(size);
-	areaid = create_area(name, &logadr, B_ANY_KERNEL_ADDRESS, size,
-		B_32_BIT_CONTIGUOUS, B_READ_AREA | B_WRITE_AREA);
-		// TODO: The rest of the code doesn't deal correctly with physical
-		// addresses > 4 GB, so we have to force 32 bit addresses here.
-	if (areaid < B_OK) {
-		PRINT(("couldn't allocate area %s\n",name));
-		return B_ERROR;
-	}
-	rv = get_memory_map(logadr,size,&pe,1);
-	if (rv < B_OK) {
-		delete_area(areaid);
-		PRINT(("couldn't map %s\n",name));
-		return B_ERROR;
-	}
-	memset(logadr,0,size);
-	if (log)
-		*log = logadr;
-	if (phy)
-		*phy = (void*)(addr_t)pe.address;
-	LOG(("area = %d, size = %d, log = %#08X, phy = \
                %#08X\n",areaid,size,logadr,pe.address));
-	return areaid;
-}
-
diff --git a/src/add-ons/kernel/drivers/audio/ac97/auvia/util.h \
b/src/add-ons/kernel/drivers/audio/ac97/auvia/util.h deleted file mode 100644
index 7a367042ca..0000000000
--- a/src/add-ons/kernel/drivers/audio/ac97/auvia/util.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * BeOS Driver for Intel ICH AC'97 Link interface
- *
- * Copyright (c) 2002, Marcus Overhagen <marcus@overhagen.de>
- *
- * All rights reserved.
- * Redistribution and use in source and binary forms, with or without modification, 
- * are permitted provided that the following conditions are met:
- *
- * - Redistributions of source code must retain the above copyright notice, 
- *   this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright notice,
- *   this list of conditions and the following disclaimer in the documentation 
- *   and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 
- * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS \
                
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 
- * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- */
-#ifndef _UTIL_H_
-#define _UTIL_H_
-
-#include <KernelExport.h>
-
-area_id alloc_mem(void **phy, void **log, size_t size, const char *name);
-
-cpu_status lock(void);
-void unlock(cpu_status status);
-
-extern spinlock	slock;
-
-#endif
diff --git a/src/add-ons/kernel/drivers/audio/ac97/auich/util.c \
b/src/add-ons/kernel/drivers/audio/ac97/util.c similarity index 100%
rename from src/add-ons/kernel/drivers/audio/ac97/auich/util.c
rename to src/add-ons/kernel/drivers/audio/ac97/util.c
diff --git a/src/add-ons/kernel/drivers/audio/ac97/auich/util.h \
b/src/add-ons/kernel/drivers/audio/ac97/util.h similarity index 100%
rename from src/add-ons/kernel/drivers/audio/ac97/auich/util.h
rename to src/add-ons/kernel/drivers/audio/ac97/util.h

############################################################################

Commit:      f5e5891bbb6a35282e04292e7d513a61fa138e2d
URL:         https://git.haiku-os.org/haiku/commit/?id=f5e5891bbb6a
Author:      PulkoMandy <pulkomandy@pulkomandy.tk>
Date:        Sun Apr  7 18:34:18 2024 UTC
Committer:   waddlesplash <waddlesplash@gmail.com>
Commit-Date: Mon Apr 15 16:02:49 2024 UTC

es1370: enable -Werror

- use shared (updated) util.c for memory allocation
- disable functions that are currently not used (ac97 suopport)

Untested, I don't have the hardware.

Change-Id: I9c406e46af94dfc213cfa258c5f375da3c0c719d
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7603
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Alexander von Gluck <alex@terarocket.io>

----------------------------------------------------------------------------

diff --git a/build/jam/ArchitectureRules b/build/jam/ArchitectureRules
index 1b316221ff..c04221bb68 100644
--- a/build/jam/ArchitectureRules
+++ b/build/jam/ArchitectureRules
@@ -677,7 +677,7 @@ rule ArchitectureSetupWarnings architecture
 #	EnableWerror src add-ons kernel drivers audio ac97 ;
 	EnableWerror src add-ons kernel drivers audio ac97 auich ;
 	EnableWerror src add-ons kernel drivers audio ac97 auvia ;
-#	EnableWerror src add-ons kernel drivers audio ac97 es1370 ;
+	EnableWerror src add-ons kernel drivers audio ac97 es1370 ;
 #	EnableWerror src add-ons kernel drivers audio ac97 geode ;
 #	EnableWerror src add-ons kernel drivers audio ac97 ich ;
 #	EnableWerror src add-ons kernel drivers audio ac97 ichaudio ;
diff --git a/src/add-ons/kernel/drivers/audio/ac97/es1370/Jamfile \
b/src/add-ons/kernel/drivers/audio/ac97/es1370/Jamfile index 8867a36466..5a5b488b4f \
                100644
--- a/src/add-ons/kernel/drivers/audio/ac97/es1370/Jamfile
+++ b/src/add-ons/kernel/drivers/audio/ac97/es1370/Jamfile
@@ -3,6 +3,7 @@ SubDir HAIKU_TOP src add-ons kernel drivers audio ac97 es1370 ;
 UsePrivateKernelHeaders ;
 UsePrivateHeaders libroot audio system ;
 SubDirHdrs [ FDirName $(SUBDIR) $(DOTDOT) ] ;
+SEARCH_SOURCE += [ FDirName $(SUBDIR) $(DOTDOT) ] ;
 
 KernelAddon es1370 :
 	debug.c
diff --git a/src/add-ons/kernel/drivers/audio/ac97/es1370/es1370.c \
b/src/add-ons/kernel/drivers/audio/ac97/es1370/es1370.c index d3685460db..cd9712696d \
                100644
--- a/src/add-ons/kernel/drivers/audio/ac97/es1370/es1370.c
+++ b/src/add-ons/kernel/drivers/audio/ac97/es1370/es1370.c
@@ -57,7 +57,7 @@ es1370_mem_new(es1370_dev *card, size_t size)
 	if ((mem = malloc(sizeof(*mem))) == NULL)
 		return (NULL);
 
-	mem->area = alloc_mem(&mem->phy_base, &mem->log_base, size, "es1370 buffer");
+	mem->area = alloc_mem(&mem->phy_base, &mem->log_base, size, "es1370 buffer", \
false);  mem->size = size;
 	if (mem->area < B_OK) {
 		free(mem);
diff --git a/src/add-ons/kernel/drivers/audio/ac97/es1370/multi.c \
b/src/add-ons/kernel/drivers/audio/ac97/es1370/multi.c index bb6d57a2c8..b0d8de332b \
                100644
--- a/src/add-ons/kernel/drivers/audio/ac97/es1370/multi.c
+++ b/src/add-ons/kernel/drivers/audio/ac97/es1370/multi.c
@@ -18,7 +18,6 @@
 
 #include "hmulti_audio.h"
 #include "multi.h"
-#include "ac97.h"
 
 //#define DEBUG 1
 
@@ -27,6 +26,7 @@
 #include "util.h"
 #include "io.h"
 
+#if 0
 static void	
 es1370_ac97_get_mix(void *card, const void *cookie, int32 type, float *values) {
 	es1370_dev *dev = (es1370_dev*)card;
@@ -157,6 +157,7 @@ es1370_ac97_set_mix(void *card, const void *cookie, int32 type, \
float *values) {  
 }
 
+
 static int32
 es1370_create_group_control(multi_dev *multi, int32 *index, int32 parent, 
 	int32 string, const char* name) {
@@ -172,6 +173,8 @@ es1370_create_group_control(multi_dev *multi, int32 *index, int32 \
parent,  
 	return multi->controls[i].mix_control.id;
 }
+#endif
+
 
 static status_t
 es1370_create_controls_list(multi_dev *multi)
@@ -181,6 +184,7 @@ es1370_create_controls_list(multi_dev *multi)
 	return B_OK;
 }
 
+
 static status_t 
 es1370_get_mix(es1370_dev *card, multi_mix_value_info * mmvi)
 {
@@ -188,7 +192,7 @@ es1370_get_mix(es1370_dev *card, multi_mix_value_info * mmvi)
 	multi_mixer_control *control = NULL;
 	for (i = 0; i < mmvi->item_count; i++) {
 		id = mmvi->values[i].id - EMU_MULTI_CONTROL_FIRSTID;
-		if (id < 0 || id >= card->multi.control_count) {
+		if (id < 0 || (uint32)id >= card->multi.control_count) {
 			PRINT(("es1370_get_mix : invalid control id requested : %" B_PRId32
 				"\n", id));
 			continue;
@@ -228,7 +232,7 @@ es1370_set_mix(es1370_dev *card, multi_mix_value_info * mmvi)
 	multi_mixer_control *control = NULL;
 	for (i = 0; i < mmvi->item_count; i++) {
 		id = mmvi->values[i].id - EMU_MULTI_CONTROL_FIRSTID;
-		if (id < 0 || id >= card->multi.control_count) {
+		if (id < 0 || (uint32)id >= card->multi.control_count) {
 			PRINT(("es1370_set_mix : invalid control id requested : %" B_PRId32
 				"\n", id));
 			continue;
@@ -239,7 +243,7 @@ es1370_set_mix(es1370_dev *card, multi_mix_value_info * mmvi)
 			multi_mixer_control *control2 = NULL;
 			if (i+1<mmvi->item_count) {
 				id = mmvi->values[i + 1].id - EMU_MULTI_CONTROL_FIRSTID;
-				if (id < 0 || id >= card->multi.control_count) {
+				if (id < 0 || (uint32)id >= card->multi.control_count) {
 					PRINT(("es1370_set_mix : invalid control id requested : %"
 						B_PRId32 "\n", id));
 				} else {
@@ -290,8 +294,8 @@ static status_t
 es1370_list_mix_controls(es1370_dev *card, multi_mix_control_info * mmci)
 {
 	multi_mix_control	*mmc;
-	int32 i;
-	
+	uint32 i;
+
 	mmc = mmci->controls;
 	if (mmci->control_count < 24)
 		return B_ERROR;
@@ -365,11 +369,11 @@ es1370_create_channels_list(multi_dev *multi)
 		B_CHANNEL_CENTER,
 		B_CHANNEL_SUB
 	};
-	
+
 	chans = multi->chans;
 	index = 0;
 
-	for (mode=ES1370_USE_PLAY; mode!=-1; 
+	for (mode = ES1370_USE_PLAY; (int32)mode != -1;
 		mode = (mode == ES1370_USE_PLAY) ? ES1370_USE_RECORD : -1) {
 		LIST_FOREACH(stream, &((es1370_dev*)multi->card)->streams, next) {
 			if ((stream->use & mode) == 0)
@@ -395,37 +399,38 @@ es1370_create_channels_list(multi_dev *multi)
 			multi->input_channel_count = index - multi->output_channel_count;
 		}
 	}
-	
+
 	chans[index].channel_id = index;
+
 	chans[index].kind = B_MULTI_OUTPUT_BUS;
 	chans[index].designations = B_CHANNEL_LEFT | B_CHANNEL_STEREO_BUS;
 	chans[index].connectors = B_CHANNEL_MINI_JACK_STEREO;
 	index++;
-	
+
 	chans[index].channel_id = index;
 	chans[index].kind = B_MULTI_OUTPUT_BUS;
 	chans[index].designations = B_CHANNEL_RIGHT | B_CHANNEL_STEREO_BUS;
 	chans[index].connectors = B_CHANNEL_MINI_JACK_STEREO;
 	index++;
-	
+
 	multi->output_bus_channel_count = index - multi->output_channel_count 
 		- multi->input_channel_count;
-	
+
 	chans[index].channel_id = index;
 	chans[index].kind = B_MULTI_INPUT_BUS;
 	chans[index].designations = B_CHANNEL_LEFT | B_CHANNEL_STEREO_BUS;
 	chans[index].connectors = B_CHANNEL_MINI_JACK_STEREO;
 	index++;
-	
+
 	chans[index].channel_id = index;
 	chans[index].kind = B_MULTI_INPUT_BUS;
 	chans[index].designations = B_CHANNEL_RIGHT | B_CHANNEL_STEREO_BUS;
 	chans[index].connectors = B_CHANNEL_MINI_JACK_STEREO;
 	index++;
-	
+
 	multi->input_bus_channel_count = index - multi->output_channel_count 
 		- multi->input_channel_count - multi->output_bus_channel_count;
-		
+
 	multi->aux_bus_channel_count = 0;
 }
 
@@ -458,7 +463,7 @@ es1370_get_description(es1370_dev *card, multi_description *data)
 
 	LOG(("request_channel_count = %" B_PRId32 "\n",
 		data->request_channel_count));
-	if (data->request_channel_count >= size) {
+	if (data->request_channel_count >= (int32)size) {
 		LOG(("copying data\n"));
 		memcpy(data->channels, card->multi.chans, size * sizeof(card->multi.chans[0]));
 	}
@@ -482,6 +487,7 @@ es1370_get_description(es1370_dev *card, multi_description *data)
 	return B_OK;
 }
 
+
 static status_t 
 es1370_get_enabled_channels(es1370_dev *card, multi_channel_enable *data)
 {
@@ -499,6 +505,8 @@ es1370_get_enabled_channels(es1370_dev *card, \
multi_channel_enable *data)  return B_OK;
 }
 
+
+#if 0
 static status_t 
 es1370_set_enabled_channels(es1370_dev *card, multi_channel_enable *data)
 {
@@ -508,8 +516,10 @@ es1370_set_enabled_channels(es1370_dev *card, \
multi_channel_enable *data)  PRINT(("set_enabled_channels 3 : %s\n", \
B_TEST_CHANNEL(data->enable_bits, 3) ? "enabled": "disabled"));  return B_OK;
 }
+#endif
 
-static status_t 
+
+static status_t
 es1370_get_global_format(es1370_dev *card, multi_format_info *data)
 {
 	data->output_latency = 0;
@@ -524,6 +534,7 @@ es1370_get_global_format(es1370_dev *card, multi_format_info \
*data)  return B_OK;
 }
 
+
 static status_t
 es1370_set_global_format(es1370_dev *card, multi_format_info *data)
 {
@@ -533,6 +544,7 @@ es1370_set_global_format(es1370_dev *card, multi_format_info \
*data)  return B_OK;
 }
 
+
 static status_t 
 es1370_get_buffers(es1370_dev *card, multi_buffer_list *data)
 {
diff --git a/src/add-ons/kernel/drivers/audio/ac97/es1370/util.c \
b/src/add-ons/kernel/drivers/audio/ac97/es1370/util.c deleted file mode 100644
index a1fe674edb..0000000000
--- a/src/add-ons/kernel/drivers/audio/ac97/es1370/util.c
+++ /dev/null
@@ -1,132 +0,0 @@
-/*
- * BeOS Driver for Intel ICH AC'97 Link interface
- *
- * Copyright (c) 2002, Marcus Overhagen <marcus@overhagen.de>
- *
- * All rights reserved.
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- *
- * - Redistributions of source code must retain the above copyright notice,
- *   this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright notice,
- *   this list of conditions and the following disclaimer in the documentation
- *   and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
- * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
- * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- */
-#include <Errors.h>
-#include <KernelExport.h>
-#include <OS.h>
-#include <string.h>
-
-//#define DEBUG 2
-
-#include "debug.h"
-#include "util.h"
-
-spinlock slock = B_SPINLOCK_INITIALIZER;
-
-uint32 round_to_pagesize(uint32 size);
-
-
-cpu_status
-lock(void)
-{
-	cpu_status status = disable_interrupts();
-	acquire_spinlock(&slock);
-	return status;
-}
-
-
-void
-unlock(cpu_status status)
-{
-	release_spinlock(&slock);
-	restore_interrupts(status);
-}
-
-
-uint32
-round_to_pagesize(uint32 size)
-{
-	return (size + B_PAGE_SIZE - 1) & ~(B_PAGE_SIZE - 1);
-}
-
-
-area_id
-alloc_mem(phys_addr_t *phy, void **log, size_t size, const char *name)
-{
-	physical_entry pe;
-	void * logadr;
-	area_id areaid;
-	status_t rv;
-
-	LOG(("allocating %" B_PRIuSIZE " bytes for %s\n", size, name));
-
-	size = round_to_pagesize(size);
-	areaid = create_area(name, &logadr, B_ANY_KERNEL_ADDRESS, size,
-		B_32_BIT_CONTIGUOUS, B_READ_AREA | B_WRITE_AREA);
-		// TODO: The rest of the code doesn't deal correctly with physical
-		// addresses > 4 GB, so we have to force 32 bit addresses here.
-	if (areaid < B_OK) {
-		PRINT(("couldn't allocate area %s\n",name));
-		return B_ERROR;
-	}
-	rv = get_memory_map(logadr, size, &pe, 1);
-	if (rv < B_OK) {
-		delete_area(areaid);
-		PRINT(("couldn't map %s\n", name));
-		return B_ERROR;
-	}
-	user_memset(logadr, 0, size);
-	if (log)
-		*log = logadr;
-	if (phy)
-		*phy = pe.address;
-	LOG(("area = %" B_PRId32 ", size = %" B_PRIuSIZE ", log = %p, phy = %#08"
-		B_PRIxPHYSADDR "\n", areaid, size, logadr, pe.address));
-	return areaid;
-}
-
-
-/* This is not the most advanced method to map physical memory for io access.
- * Perhaps using B_ANY_KERNEL_ADDRESS instead of B_ANY_KERNEL_BLOCK_ADDRESS
- * makes the whole offset calculation and relocation obsolete. But the code
- * below does work, and I can't test if using B_ANY_KERNEL_ADDRESS also works.
- */
-area_id
-map_mem(void **log, phys_addr_t phy, size_t size, const char *name)
-{
-	uint32 offset;
-	phys_addr_t phyadr;
-	void *mapadr;
-	area_id area;
-
-	LOG(("mapping physical address %" B_PRIxPHYSADDR " with %" B_PRIxSIZE
-		" bytes for %s\n", phy, size, name));
-
-	offset = (uint32)phy & (B_PAGE_SIZE - 1);
-	phyadr = phy - offset;
-	size = round_to_pagesize(size + offset);
-	area = map_physical_memory(name, phyadr, size, B_ANY_KERNEL_BLOCK_ADDRESS,
-		B_READ_AREA | B_WRITE_AREA, &mapadr);
-	*log = (uint8 *)mapadr + offset;
-
-	LOG(("physical = %" B_PRIxPHYSADDR ", logical = %p, offset = %" B_PRIu32
-		", phyadr = %" B_PRIxPHYSADDR ", mapadr = %p, size = %" B_PRIxSIZE
-		", area = %" B_PRId32 "\n", phy, *log, offset, phyadr, mapadr, size,
-		area));
-
-	return area;
-}
diff --git a/src/add-ons/kernel/drivers/audio/ac97/es1370/util.h \
b/src/add-ons/kernel/drivers/audio/ac97/es1370/util.h deleted file mode 100644
index 2f97928831..0000000000
--- a/src/add-ons/kernel/drivers/audio/ac97/es1370/util.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * BeOS Driver for Intel ICH AC'97 Link interface
- *
- * Copyright (c) 2002, Marcus Overhagen <marcus@overhagen.de>
- *
- * All rights reserved.
- * Redistribution and use in source and binary forms, with or without modification, 
- * are permitted provided that the following conditions are met:
- *
- * - Redistributions of source code must retain the above copyright notice, 
- *   this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright notice,
- *   this list of conditions and the following disclaimer in the documentation 
- *   and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 
- * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS \
                
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 
- * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- */
-#ifndef _UTIL_H_
-#define _UTIL_H_
-
-#include <KernelExport.h>
-
-area_id alloc_mem(phys_addr_t *phy, void **log, size_t size, const char *name);
-area_id map_mem(void **log, phys_addr_t phy, size_t size, const char *name);
-
-cpu_status lock(void);
-void unlock(cpu_status status);
-
-extern spinlock	slock;
-
-#endif

############################################################################

Commit:      8a3e82a04d6eea7ea8aee00e06db9530b6864228
URL:         https://git.haiku-os.org/haiku/commit/?id=8a3e82a04d6e
Author:      PulkoMandy <pulkomandy@pulkomandy.tk>
Date:        Sat Apr  6 15:08:29 2024 UTC
Committer:   waddlesplash <waddlesplash@gmail.com>
Commit-Date: Mon Apr 15 16:02:49 2024 UTC

ich, ichaudio: remove

These have never been included in the Haiku build as far as I can see.
All the soundcards they support are already handled in the auich dirver.
All the IDE driver that ichaudio claims to support, I'm not sure why they
are in an audio driver.

One of them was written for BeOS and never updated for Haiku
multi_audio, and the other was apparently some experiment that didn't
get anywhere in the end. To avoid confusion, let's keep only one driver.

Change-Id: I5bf48e7dd2c5340e84a1ab4eb3e3b079103b7988
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7604
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>

----------------------------------------------------------------------------

diff --git a/build/jam/ArchitectureRules b/build/jam/ArchitectureRules
index c04221bb68..2066c17be6 100644
--- a/build/jam/ArchitectureRules
+++ b/build/jam/ArchitectureRules
@@ -679,8 +679,6 @@ rule ArchitectureSetupWarnings architecture
 	EnableWerror src add-ons kernel drivers audio ac97 auvia ;
 	EnableWerror src add-ons kernel drivers audio ac97 es1370 ;
 #	EnableWerror src add-ons kernel drivers audio ac97 geode ;
-#	EnableWerror src add-ons kernel drivers audio ac97 ich ;
-#	EnableWerror src add-ons kernel drivers audio ac97 ichaudio ;
 	EnableWerror src add-ons kernel drivers audio ac97 sis7018 ;
 #	EnableWerror src add-ons kernel drivers audio cmedia ;
 	EnableWerror src add-ons kernel drivers audio echo ;
diff --git a/src/add-ons/kernel/drivers/audio/ac97/Jamfile \
b/src/add-ons/kernel/drivers/audio/ac97/Jamfile index 02e175f84f..292c0cf110 100644
--- a/src/add-ons/kernel/drivers/audio/ac97/Jamfile
+++ b/src/add-ons/kernel/drivers/audio/ac97/Jamfile
@@ -4,6 +4,4 @@ SubInclude HAIKU_TOP src add-ons kernel drivers audio ac97 auich ;
 SubInclude HAIKU_TOP src add-ons kernel drivers audio ac97 auvia ;
 SubInclude HAIKU_TOP src add-ons kernel drivers audio ac97 es1370 ;
 SubInclude HAIKU_TOP src add-ons kernel drivers audio ac97 geode ;
-SubInclude HAIKU_TOP src add-ons kernel drivers audio ac97 ich ;
-# SubInclude HAIKU_TOP src add-ons kernel drivers audio ac97 ichaudio ;
 SubInclude HAIKU_TOP src add-ons kernel drivers audio ac97 sis7018 ;
diff --git a/src/add-ons/kernel/drivers/audio/ac97/auich/auich.c \
b/src/add-ons/kernel/drivers/audio/ac97/auich/auich.c index e5c33464e6..99bbf6062d \
                100644
--- a/src/add-ons/kernel/drivers/audio/ac97/auich/auich.c
+++ b/src/add-ons/kernel/drivers/audio/ac97/auich/auich.c
@@ -556,6 +556,7 @@ init_hardware(void)
 			|| info.device_id == INTEL_82801FB_AC97_DEVICE_ID
 			|| info.device_id == INTEL_82801GB_AC97_DEVICE_ID
 			|| info.device_id == INTEL_6300ESB_AC97_DEVICE_ID
+			|| info.device_id == INTEL_631xESB_AC97_DEVICE_ID
 			))
 		|| (info.vendor_id == SIS_VENDOR_ID &&
 			(info.device_id == SIS_SI7012_AC97_DEVICE_ID
diff --git a/src/add-ons/kernel/drivers/audio/ac97/auich/auich.h \
b/src/add-ons/kernel/drivers/audio/ac97/auich/auich.h index 2d97a3391f..0adc76032c \
                100644
--- a/src/add-ons/kernel/drivers/audio/ac97/auich/auich.h
+++ b/src/add-ons/kernel/drivers/audio/ac97/auich/auich.h
@@ -47,6 +47,7 @@
 #define INTEL_82801DB_AC97_DEVICE_ID	0x24c5
 #define INTEL_82801EB_AC97_DEVICE_ID	0x24d5
 #define INTEL_82801FB_AC97_DEVICE_ID	0x266e
+#define INTEL_631xESB_AC97_DEVICE_ID	0x2698
 #define INTEL_82801GB_AC97_DEVICE_ID	0x27de
 #define INTEL_6300ESB_AC97_DEVICE_ID	0x25a6
 #define SIS_VENDOR_ID		0x1039	/* Sis */
diff --git a/src/add-ons/kernel/drivers/audio/ac97/ich/Jamfile \
b/src/add-ons/kernel/drivers/audio/ac97/ich/Jamfile deleted file mode 100644
index 7a598308e4..0000000000
--- a/src/add-ons/kernel/drivers/audio/ac97/ich/Jamfile
+++ /dev/null
@@ -1,25 +0,0 @@
-SubDir HAIKU_TOP src add-ons kernel drivers audio ac97 ich ;
-
-UsePrivateHeaders libroot audio ;
-
-KernelAddon ich_ac97 :
-	ac97_multi.c
-	config.c
-	debug.c
-	ich.c
-	io.c
-	util.c
-	ac97.c
-;
-
-#KernelObjects
-#	ac97_multi.c
-#	config.c
-#	debug.c
-#	ich.c
-#	io.c
-#	util.c   
-#	ac97.c
-#	:
-#	-fno-pic -D_KERNEL_MODE
-#	;
diff --git a/src/add-ons/kernel/drivers/audio/ac97/ich/ac97.c \
b/src/add-ons/kernel/drivers/audio/ac97/ich/ac97.c deleted file mode 100644
index d33ff3c367..0000000000
--- a/src/add-ons/kernel/drivers/audio/ac97/ich/ac97.c
+++ /dev/null
@@ -1,907 +0,0 @@
-/*
- * BeOS Driver for Intel ICH AC'97 Link interface
- *
- * Copyright (c) 2002, Marcus Overhagen <marcus@overhagen.de>
- *
- * All rights reserved.
- * Redistribution and use in source and binary forms, with or without modification, 
- * are permitted provided that the following conditions are met:
- *
- * - Redistributions of source code must retain the above copyright notice, 
- *   this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright notice,
- *   this list of conditions and the following disclaimer in the documentation 
- *   and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 
- * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS \
                
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 
- * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- */
-#include <OS.h>
-#include <stdio.h>
-#include <malloc.h>
-#include <MediaDefs.h>
-#include "ac97.h"
-#include "debug.h"
-
-#define B_UTF8_REGISTERED	"\xC2\xAE"
-
-bool ac97_reg_is_valid(ac97_dev *dev, uint8 reg);
-void ac97_amp_enable(ac97_dev *dev, bool onoff);
-void ac97_dump_capabilities(ac97_dev *dev);
-void ac97_detect_capabilities(ac97_dev *dev);
-void ac97_detect_rates(ac97_dev *dev);
-void ac97_update_register_cache(ac97_dev *dev);
-
-const char * stereo_enhancement_technique[] =
-{
-	"No 3D Stereo Enhancement",
-	"Analog Devices",
-	"Creative Technology",
-	"National Semiconductor",
-	"Yamaha",
-	"BBE Sound",
-	"Crystal Semiconductor",
-	"Qsound Labs",
-	"Spatializer Audio Laboratories",
-	"SRS Labs",
-	"Platform Tech",
-	"AKM Semiconductor",
-	"Aureal",
-	"Aztech Labs",
-	"Binaura",
-	"ESS Technology",
-	"Harman International",
-	"Nvidea",
-	"Philips"
-	"Texas Instruments",
-	"VLSI Technology",
-	"TriTech",
-	"Realtek",
-	"Samsung",
-	"Wolfson Microelectronics",
-	"Delta Integration",
-	"SigmaTel",
-	"KS Waves",
-	"Rockwell",
-	"Unknown (29)",
-	"Unknown (30)",
-	"Unknown (31)"
-};
-
-void default_init(ac97_dev *dev);
-void ad1819_init(ac97_dev *dev);
-void ad1881_init(ac97_dev *dev);
-void ad1885_init(ac97_dev *dev);
-void ad1886_init(ac97_dev *dev);
-void ad1980_init(ac97_dev *dev);
-void alc650_init(ac97_dev *dev);
-void stac9708_init(ac97_dev *dev);
-void stac9721_init(ac97_dev *dev);
-void stac9744_init(ac97_dev *dev);
-void stac9756_init(ac97_dev *dev);
-void tr28028_init(ac97_dev *dev);
-void wm9701_init(ac97_dev *dev);
-void wm9703_init(ac97_dev *dev);
-void wm9704_init(ac97_dev *dev);
-
-bool ad1819_set_rate(ac97_dev *dev, uint8 reg, uint32 rate);
-bool ad1819_get_rate(ac97_dev *dev, uint8 reg, uint32 *rate);
-
-typedef struct
-{
-	uint32 id;
-	uint32 mask;
-	codec_init init;
-	const char *info;
-} codec_table;
-
-codec_table codecs[] = 
-{
-	{ CODEC_ID_AD1819,	0xffffffff, ad1819_init,	"Analog Devices AD1819A, AD1819B \
                SoundPort" B_UTF8_REGISTERED },
-	{ CODEC_ID_AD1881,	0xffffffff, ad1881_init,	"Analog Devices AD1881 SoundMAX" \
                B_UTF8_REGISTERED },
-	{ CODEC_ID_AD1881A,	0xffffffff, ad1881_init,	"Analog Devices AD1881A SoundMAX" \
                B_UTF8_REGISTERED },
-	{ CODEC_ID_AD1885,	0xffffffff, ad1885_init,	"Analog Devices AD1885 SoundMAX" \
                B_UTF8_REGISTERED },
-	{ CODEC_ID_AD1886,	0xffffffff, ad1886_init,	"Analog Devices AD1886 SoundMAX" \
                B_UTF8_REGISTERED },
-	{ CODEC_ID_AD1886A,	0xffffffff, ad1881_init,	"Analog Devices AD1886A SoundMAX" \
                B_UTF8_REGISTERED },
-	{ CODEC_ID_AD1887,	0xffffffff, ad1881_init,	"Analog Devices AD1887 SoundMAX" \
                B_UTF8_REGISTERED },
-	{ CODEC_ID_AD1980,	0xffffffff, ad1980_init,	"Analog Devices AD1980 SoundMAX" \
                B_UTF8_REGISTERED },
-	{ 0x41445371,		0xffffffff, default_init,	"Analog Devices 0x41445371 (\?\?\?)" },
-	{ 0x41445372,		0xffffffff, default_init,	"Analog Devices AD1981A SoundMAX" \
                B_UTF8_REGISTERED },
-	{ CODEC_ID_AD1981B,	0xffffffff, default_init,	"Analog Devices AD1981B SoundMAX" \
                B_UTF8_REGISTERED },
-	{ CODEC_ID_AD1985,	0xffffffff, default_init,	"Analog Devices AD1985 SoundMAX" \
                B_UTF8_REGISTERED },
-	{ CODEC_ID_AK4540,	0xffffffff, default_init,	"Asahi Kasei AK4540" },
-	{ CODEC_ID_AK4542,	0xffffffff, default_init,	"Asahi Kasei AK4542" },
-	{ 0x414b4d02,		0xffffffff, default_init,	"Asahi Kasei AK4543" },
-	{ 0x414c4320,		0xfffffff0, default_init,	"Avance Logic (Realtek) ALC100/ALC100P, \
                RL5383/RL5522" },
-	{ 0x414c4730,		0xffffffff, default_init,	"Avance Logic (Realtek) ALC101" },
-	{ CODEC_ID_ALC201A,	0xffffffff, default_init,	"Avance Logic (Realtek) \
                ALC200/ALC200A, ALC201/ALC201A" }, /* 0x4710 = ALC201A */
-	{ 0x414c4720,		0xffffffff, alc650_init,	"Avance Logic (Realtek) ALC650" }, /* \
                0x4720 = ALC650 */
-	{ 0x414c4740,		0xffffffff, default_init,	"Avance Logic (Realtek) ALC202/ALC202A" },
-	{ 0x434d4941,		0xffffffff, default_init,	"C-Media CMI9738" },
-	{ 0x434d4961,		0xffffffff, default_init,	"C-Media CMI9739" },
-	{ 0x43525900,		0xffffffff, default_init,	"Cirrus Logic CS4297" },
-	{ 0x43525903,		0xffffffff, default_init,	"Cirrus Logic CS4297" },
-	{ 0x43525913,		0xffffffff, default_init,	"Cirrus Logic CS4297A" },
-	{ 0x43525914,		0xffffffff, default_init,	"Cirrus Logic CS4297B" },
-	{ 0x43525923,		0xffffffff, default_init,	"Cirrus Logic CS4294C" },
-	{ 0x4352592b,		0xffffffff, default_init,	"Cirrus Logic CS4298C" },
-	{ CODEC_ID_CS4299A,	0xffffffff, default_init,	"Cirrus Logic CS4299A" },
-	{ CODEC_ID_CS4299C,	0xffffffff, default_init,	"Cirrus Logic CS4299C" },
-	{ CODEC_ID_CS4299D,	0xffffffff, default_init,	"Cirrus Logic CS4299D" },
-	{ 0x43525941,		0xffffffff, default_init,	"Cirrus Logic CS4201A" },
-	{ 0x43525951,		0xffffffff, default_init,	"Cirrus Logic CS4205A" },
-	{ 0x43525961,		0xffffffff, default_init,	"Cirrus Logic CS4291A" },
-	{ 0x45838308,		0xffffffff, default_init,	"ESS Technology ES1921" },
-	{ 0x49434511,		0xffffffff, default_init,	"ICEnsemble ICE1232" },
-	{ 0x4e534331,		0xffffffff, default_init,	"National Semiconductor LM4549" },
-	{ CODEC_ID_STAC9700,0xffffffff, default_init,	"SigmaTel STAC9700/9783/9784" },
-	{ CODEC_ID_STAC9704,0xffffffff, default_init,	"SigmaTel STAC9701/03, STAC9704/07, \
                STAC9705 (\?\?\?)" },
-	{ CODEC_ID_STAC9705,0xffffffff, default_init,	"SigmaTel STAC9704 (\?\?\?)" },
-	{ CODEC_ID_STAC9708,0xffffffff, stac9708_init,	"SigmaTel STAC9708/9711" },
-	{ CODEC_ID_STAC9721,0xffffffff, stac9721_init,	"SigmaTel STAC9721/9723" },
-	{ CODEC_ID_STAC9744,0xffffffff, stac9744_init,	"SigmaTel STAC9744" },
-	{ CODEC_ID_STAC9752,0xffffffff, default_init,	"SigmaTel STAC9752/53" },
-	{ CODEC_ID_STAC9756,0xffffffff, stac9756_init,	"SigmaTel STAC9756/9757" },
-	{ CODEC_ID_STAC9766,0xffffffff, default_init,	"SigmaTel STAC9766/67" },
-	{ 0x53494c22,		0xffffffff, default_init,	"Silicon Laboratory Si3036" },
-	{ 0x53494c23,		0xffffffff, default_init,	"Silicon Laboratory Si3038" },
-	{ 0x54524103,		0xffffffff, default_init,	"TriTech TR?????" },
-	{ 0x54524106,		0xffffffff, default_init,	"TriTech TR28026" },
-	{ 0x54524108,		0xffffffff, tr28028_init,	"TriTech TR28028" },
-	{ 0x54524123,		0xffffffff, default_init,	"TriTech TR28602" },
-	{ 0x574d4c00,		0xffffffff, wm9701_init,	"Wolfson WM9701A" },
-	{ 0x574d4c03,		0xffffffff, wm9703_init,	"Wolfson WM9703/9704" },
-	{ 0x574d4c04,		0xffffffff, wm9704_init,	"Wolfson WM9704 (quad)" },	
-	/* Vendors only: */
-	{ 0x41445300,		0xffffff00, default_init,	"Analog Devices" },
-	{ 0x414b4d00,		0xffffff00, default_init,	"Asahi Kasei" },
-	{ 0x414c4700,		0xffffff00, default_init,	"Avance Logic (Realtek)" },
-	{ 0x434d4900,		0xffffff00, default_init,	"C-Media" },
-	{ 0x43525900,		0xffffff00, default_init,	"Cirrus Logic" },
-	{ 0x45838300,		0xffffff00, default_init,	"ESS Technology" },
-	{ 0x49434500,		0xffffff00, default_init,	"ICEnsemble" },
-	{ 0x4e534300,		0xffffff00, default_init,	"National Semiconductor" },
-	{ 0x83847600,		0xffffff00, default_init,	"SigmaTel" },
-	{ 0x53494c00,		0xffffff00, default_init,	"Silicon Laboratory" },
-	{ 0x54524100,		0xffffff00, default_init,	"TriTech" },
-	{ 0x574d4c00,		0xffffff00, default_init,	"Wolfson" },
-	{ 0x00000000,		0x00000000, default_init,	"Unknown" } /* must be last one, matches \
                every codec */
-};
-
-codec_table *find_codec_table(uint32 codecid);
-
-codec_table *
-find_codec_table(uint32 codecid)
-{
-	codec_table *codec;
-	for (codec = codecs; codec->id; codec++)
-		if ((codec->id & codec->mask) == (codecid & codec->mask))
-			break;
-	return codec;
-}
-
-void
-ac97_attach(ac97_dev **_dev, codec_reg_read reg_read, codec_reg_write reg_write, \
                void *cookie)
-{
-	ac97_dev *dev;
-	codec_table *codec;
-	
-	*_dev = dev = (ac97_dev *) malloc(sizeof(ac97_dev));
-	dev->cookie = cookie;
-	dev->reg_read = reg_read;
-	dev->reg_write = reg_write;
-	dev->codec_id = (reg_read(cookie, AC97_VENDOR_ID1) << 16) | reg_read(cookie, \
                AC97_VENDOR_ID2);
-	codec = find_codec_table(dev->codec_id);
-	dev->codec_info = codec->info;
-	dev->init = codec->init;
-	dev->set_rate = 0;
-	dev->get_rate = 0;
-	dev->clock = 48000; /* default clock on non-broken motherboards */
-	dev->min_vsr = 0x0001;	
-	dev->max_vsr = 0xffff;
-	dev->reversed_eamp_polarity = false;
-
-	/* reset the codec */	
-	LOG(("codec reset\n"));
-	ac97_reg_uncached_write(dev, AC97_RESET, 0x0000);
-	snooze(50000); // 50 ms
-
-	/* setup register cache */
-	ac97_update_register_cache(dev);
-
-	dev->codec_3d_stereo_enhancement = \
                stereo_enhancement_technique[(ac97_reg_cached_read(dev, AC97_RESET) \
                >> 10) & 31];
-	dev->capabilities = 0;
-
-	ac97_reg_update_bits(dev, AC97_EXTENDED_STAT_CTRL, 1, 1); // enable variable rate \
                audio
-
-	ac97_detect_capabilities(dev);
-
-	dev->init(dev);
-	ac97_amp_enable(dev, true);
-	
-	/* set mixer defaults, enabled Line-out sources are PCM-out, CD-in, Line-in */
-	ac97_reg_update(dev, AC97_CENTER_LFE_VOLUME, 0x0000);	/* set LFE & center volume \
                0dB */
-	ac97_reg_update(dev, AC97_SURR_VOLUME, 0x0000);			/* set surround volume 0dB */
-	ac97_reg_update(dev, AC97_MASTER_VOLUME, 0x0000);		/* set master output 0dB */
-	ac97_reg_update(dev, AC97_AUX_OUT_VOLUME, 0x0000);		/* set aux output 0dB */
-	ac97_reg_update(dev, AC97_MONO_VOLUME, 0x0000);			/* set mono output 0dB */
-	ac97_reg_update(dev, AC97_PCM_OUT_VOLUME, 0x0808);		/* enable pcm-out */
-	ac97_reg_update(dev, AC97_CD_VOLUME, 0x0808);			/* enable cd-in */
-	ac97_reg_update(dev, AC97_LINE_IN_VOLUME, 0x0808);		/* enable line-in */
-	
-	ac97_dump_capabilities(dev);
-}
-
-void
-ac97_detach(ac97_dev *dev)
-{
-	/* Mute everything */
-	ac97_reg_update_bits(dev, AC97_CENTER_LFE_VOLUME, 0x8000, 0x8000);
-	ac97_reg_update_bits(dev, AC97_SURR_VOLUME, 0x8000, 0x8000);
-	ac97_reg_update_bits(dev, AC97_MASTER_VOLUME, 0x8000, 0x8000);
-	ac97_reg_update_bits(dev, AC97_AUX_OUT_VOLUME, 0x8000, 0x8000);
-	ac97_reg_update_bits(dev, AC97_MONO_VOLUME, 0x8000, 0x8000);
-	ac97_reg_update_bits(dev, AC97_PCM_OUT_VOLUME, 0x8000, 0x8000);
-	ac97_reg_update_bits(dev, AC97_CD_VOLUME, 0x8000, 0x8000);
-	ac97_reg_update_bits(dev, AC97_LINE_IN_VOLUME, 0x8000, 0x8000);
-
-	free(dev);
-}
-
-void
-ac97_suspend(ac97_dev *dev)
-{
-	ac97_amp_enable(dev, false);
-}
-
-void
-ac97_resume(ac97_dev *dev)
-{
-	ac97_amp_enable(dev, true);
-}
-
-void
-ac97_reg_cached_write(ac97_dev *dev, uint8 reg, uint16 value)
-{
-	if (!ac97_reg_is_valid(dev, reg))
-		return;
-	dev->reg_write(dev->cookie, reg, value);
-	dev->reg_cache[reg] = value;
-}
-
-uint16
-ac97_reg_cached_read(ac97_dev *dev, uint8 reg)
-{
-	if (!ac97_reg_is_valid(dev, reg))
-		return 0;
-	return dev->reg_cache[reg];
-}
-
-void
-ac97_reg_uncached_write(ac97_dev *dev, uint8 reg, uint16 value)
-{
-	if (!ac97_reg_is_valid(dev, reg))
-		return;
-	dev->reg_write(dev->cookie, reg, value);
-}
-
-uint16
-ac97_reg_uncached_read(ac97_dev *dev, uint8 reg)
-{
-	if (!ac97_reg_is_valid(dev, reg))
-		return 0;
-	return dev->reg_read(dev->cookie, reg);
-}
-
-bool
-ac97_reg_update(ac97_dev *dev, uint8 reg, uint16 value)
-{
-	if (!ac97_reg_is_valid(dev, reg))
-		return false;
-	if (ac97_reg_cached_read(dev, reg) == value)
-		return false;
-	ac97_reg_cached_write(dev, reg, value);
-	return true;
-}
-
-bool
-ac97_reg_update_bits(ac97_dev *dev, uint8 reg, uint16 mask, uint16 value)
-{
-	uint16 old;
-	if (!ac97_reg_is_valid(dev, reg))
-		return false;
-	old = ac97_reg_cached_read(dev, reg);
-	value &= mask;
-	value |= (old & ~mask);
-	if (old == value)
-		return false;
-	ac97_reg_cached_write(dev, reg, value);
-	return true;
-}
-
-void
-ac97_update_register_cache(ac97_dev *dev)
-{
-	int reg;
-	for (reg = 0; reg <= 0x7e; reg += 2)
-		dev->reg_cache[reg] = ac97_reg_uncached_read(dev, reg);
-}
-
-bool
-ac97_set_rate(ac97_dev *dev, uint8 reg, uint32 rate)
-{
-	uint32 value;
-	uint32 old;
-	
-	if (dev->set_rate)
-		return dev->set_rate(dev, reg, rate);
-
-	value = (uint32)((rate * 48000ULL) / dev->clock); /* need 64 bit calculation for \
                rates 96000 or higher */
-
-	LOG(("ac97_set_rate: clock = %d, rate = %d, value = %d\n", dev->clock, rate, \
                value));
-	
-	/* if double rate audio is currently enabled, divide value by 2 */
-	if (ac97_reg_cached_read(dev, AC97_EXTENDED_STAT_CTRL) & 0x0002)
-		value /= 2;
-		
-	if (value < dev->min_vsr || value > dev->max_vsr)
-		return false;
-
-	old = ac97_reg_cached_read(dev, reg);
-	ac97_reg_cached_write(dev, reg, value);
-	if (value != ac97_reg_uncached_read(dev, reg)) {
-		LOG(("ac97_set_rate failed, new rate %d\n", ac97_reg_uncached_read(dev, reg)));
-		ac97_reg_cached_write(dev, reg, old);
-		return false;
-	}
-	LOG(("ac97_set_rate done\n"));
-	return true;
-}
-
-bool
-ac97_get_rate(ac97_dev *dev, uint8 reg, uint32 *rate)
-{
-	uint32 value;
-
-	if (dev->get_rate)
-		return dev->get_rate(dev, reg, rate);
-
-	value = ac97_reg_cached_read(dev, reg);
-	if (value == 0)
-		return false;
-
-	/* if double rate audio is currently enabled, multiply value by 2 */
-	if (ac97_reg_cached_read(dev, AC97_EXTENDED_STAT_CTRL) & 0x0002)
-		value *= 2;
-
-	*rate = (uint32)((value * (uint64)dev->clock) / 48000); /* need 64 bit calculation \
                to avoid overflow*/
-	return true;
-}
-
-void
-ac97_set_clock(ac97_dev *dev, uint32 clock)
-{
-	LOG(("ac97_set_clock: clock = %d\n", clock));
-	dev->clock = clock;
-	ac97_detect_rates(dev);
-	ac97_dump_capabilities(dev);
-}
-
-void
-ac97_detect_capabilities(ac97_dev *dev)
-{
-	uint16 val;
-	
-	val = ac97_reg_cached_read(dev, AC97_RESET);
-	if (val & 0x0001)
-		dev->capabilities |= CAP_PCM_MIC;
-	if (val & 0x0004)
-		dev->capabilities |= CAP_BASS_TREBLE_CTRL;
-	if (val & 0x0008)
-		dev->capabilities |= CAP_SIMULATED_STEREO;
-	if (val & 0x0010)
-		dev->capabilities |= CAP_HEADPHONE_OUT;
-	if (val & 0x0020)
-		dev->capabilities |= CAP_LAUDNESS;
-	if (val & 0x0040)
-		dev->capabilities |= CAP_DAC_18BIT;
-	if (val & 0x0080)
-		dev->capabilities |= CAP_DAC_20BIT;
-	if (val & 0x0100)
-		dev->capabilities |= CAP_ADC_18BIT;
-	if (val & 0x0200)
-		dev->capabilities |= CAP_ADC_20BIT;
-	if (val & 0x7C00)
-		dev->capabilities |= CAP_3D_ENHANCEMENT;
-
-	val = ac97_reg_cached_read(dev, AC97_EXTENDED_ID);
-	if (val & EXID_VRA)
-		dev->capabilities |= CAP_VARIABLE_PCM;
-	if (val & EXID_DRA)
-		dev->capabilities |= CAP_DOUBLE_PCM;
-	if (val & EXID_SPDIF)
-		dev->capabilities |= CAP_SPDIF;
-	if (val & EXID_VRM)
-		dev->capabilities |= CAP_VARIABLE_MIC;
-	if (val & EXID_CDAC)
-		dev->capabilities |= CAP_CENTER_DAC;
-	if (val & EXID_SDAC)
-		dev->capabilities |= CAP_SURR_DAC;
-	if (val & EXID_LDAC)
-		dev->capabilities |= CAP_LFE_DAC;
-	if (val & EXID_AMAP)
-		dev->capabilities |= CAP_AMAP;
-	if ((val & (EXID_REV0 | EXID_REV1)) == 0)
-		dev->capabilities |= CAP_REV21;
-	if ((val & (EXID_REV0 | EXID_REV1)) == EXID_REV0)
-		dev->capabilities |= CAP_REV22;
-	if ((val & (EXID_REV0 | EXID_REV1)) == EXID_REV1)
-		dev->capabilities |= CAP_REV23;
-		
-	ac97_detect_rates(dev);
-}		
-
-void
-ac97_detect_rates(ac97_dev *dev)
-{
-	uint32 oldrate;
-	
-	dev->capabilities &= ~CAP_PCM_RATE_MASK;
-
-	if (!ac97_get_rate(dev, AC97_PCM_FRONT_DAC_RATE, &oldrate))
-		oldrate = 48000;
-	
-	if (ac97_set_rate(dev, AC97_PCM_FRONT_DAC_RATE, 20000))
-		dev->capabilities |= CAP_PCM_RATE_CONTINUOUS;
-	if (ac97_set_rate(dev, AC97_PCM_FRONT_DAC_RATE, 8000))
-		dev->capabilities |= CAP_PCM_RATE_8000;
-	if (ac97_set_rate(dev, AC97_PCM_FRONT_DAC_RATE, 11025))
-		dev->capabilities |= CAP_PCM_RATE_11025;
-	if (ac97_set_rate(dev, AC97_PCM_FRONT_DAC_RATE, 12000))
-		dev->capabilities |= CAP_PCM_RATE_12000;
-	if (ac97_set_rate(dev, AC97_PCM_FRONT_DAC_RATE, 16000))
-		dev->capabilities |= CAP_PCM_RATE_16000;
-	if (ac97_set_rate(dev, AC97_PCM_FRONT_DAC_RATE, 22050))
-		dev->capabilities |= CAP_PCM_RATE_22050;
-	if (ac97_set_rate(dev, AC97_PCM_FRONT_DAC_RATE, 24000))
-		dev->capabilities |= CAP_PCM_RATE_24000;
-	if (ac97_set_rate(dev, AC97_PCM_FRONT_DAC_RATE, 32000))
-		dev->capabilities |= CAP_PCM_RATE_32000;
-	if (ac97_set_rate(dev, AC97_PCM_FRONT_DAC_RATE, 44100))
-		dev->capabilities |= CAP_PCM_RATE_44100;
-	if (ac97_set_rate(dev, AC97_PCM_FRONT_DAC_RATE, 48000))
-		dev->capabilities |= CAP_PCM_RATE_48000;
-
-	if (dev->capabilities & CAP_DOUBLE_PCM) {
-		// enable double rate mode
-		if (ac97_reg_update_bits(dev, AC97_EXTENDED_STAT_CTRL, 0x0002, 0x0002)) {
-			if (ac97_set_rate(dev, AC97_PCM_FRONT_DAC_RATE, 88200))
-				dev->capabilities |= CAP_PCM_RATE_88200;	
-			if (ac97_set_rate(dev, AC97_PCM_FRONT_DAC_RATE, 96000))
-				dev->capabilities |= CAP_PCM_RATE_96000;
-			// disable double rate mode
-			ac97_reg_update_bits(dev, AC97_EXTENDED_STAT_CTRL, 0x0002, 0x0000);
-		}
-	}
-		
-	ac97_set_rate(dev, AC97_PCM_FRONT_DAC_RATE, oldrate);
-}
-
-void
-ac97_dump_capabilities(ac97_dev *dev)
-{
-	LOG(("AC97 capabilities:\n"));
-	if (ac97_has_capability(dev, CAP_PCM_MIC))
-		LOG(("CAP_PCM_MIC\n"));
-	if (ac97_has_capability(dev, CAP_BASS_TREBLE_CTRL))
-		LOG(("CAP_BASS_TREBLE_CTRL\n"));
-	if (ac97_has_capability(dev, CAP_SIMULATED_STEREO))
-		LOG(("CAP_SIMULATED_STEREO\n"));
-	if (ac97_has_capability(dev, CAP_HEADPHONE_OUT))
-		LOG(("CAP_HEADPHONE_OUT\n"));
-	if (ac97_has_capability(dev, CAP_LAUDNESS))
-		LOG(("CAP_LAUDNESS\n"));
-	if (ac97_has_capability(dev, CAP_DAC_18BIT))
-		LOG(("CAP_DAC_18BIT\n"));
-	if (ac97_has_capability(dev, CAP_DAC_20BIT))
-		LOG(("CAP_DAC_20BIT\n"));
-	if (ac97_has_capability(dev, CAP_ADC_18BIT))
-		LOG(("CAP_ADC_18BIT\n"));
-	if (ac97_has_capability(dev, CAP_ADC_20BIT))
-		LOG(("CAP_ADC_20BIT\n"));
-	if (ac97_has_capability(dev, CAP_3D_ENHANCEMENT))
-		LOG(("CAP_3D_ENHANCEMENT\n"));
-	if (ac97_has_capability(dev, CAP_VARIABLE_PCM))
-		LOG(("CAP_VARIABLE_PCM\n"));
-	if (ac97_has_capability(dev, CAP_DOUBLE_PCM))
-		LOG(("CAP_DOUBLE_PCM\n"));
-	if (ac97_has_capability(dev, CAP_VARIABLE_MIC))
-		LOG(("CAP_VARIABLE_MIC\n"));
-	if (ac97_has_capability(dev, CAP_CENTER_DAC))
-		LOG(("CAP_CENTER_DAC\n"));
-	if (ac97_has_capability(dev, CAP_SURR_DAC))
-		LOG(("CAP_SURR_DAC\n"));
-	if (ac97_has_capability(dev, CAP_LFE_DAC))
-		LOG(("CAP_LFE_DAC\n"));
-	if (ac97_has_capability(dev, CAP_AMAP))
-		LOG(("CAP_AMAP\n"));
-	if (ac97_has_capability(dev, CAP_REV21))
-		LOG(("CAP_REV21\n"));
-	if (ac97_has_capability(dev, CAP_REV22))
-		LOG(("CAP_REV22\n"));
-	if (ac97_has_capability(dev, CAP_REV23))
-		LOG(("CAP_REV23\n"));
-	if (ac97_has_capability(dev, CAP_PCM_RATE_CONTINUOUS))
-		LOG(("CAP_PCM_RATE_CONTINUOUS\n"));
-	if (ac97_has_capability(dev, CAP_PCM_RATE_8000))
-		LOG(("CAP_PCM_RATE_8000\n"));
-	if (ac97_has_capability(dev, CAP_PCM_RATE_11025))
-		LOG(("CAP_PCM_RATE_11025\n"));
-	if (ac97_has_capability(dev, CAP_PCM_RATE_12000))
-		LOG(("CAP_PCM_RATE_12000\n"));
-	if (ac97_has_capability(dev, CAP_PCM_RATE_16000))
-		LOG(("CAP_PCM_RATE_16000\n"));
-	if (ac97_has_capability(dev, CAP_PCM_RATE_22050))
-		LOG(("CAP_PCM_RATE_22050\n"));
-	if (ac97_has_capability(dev, CAP_PCM_RATE_24000))
-		LOG(("CAP_PCM_RATE_24000\n"));
-	if (ac97_has_capability(dev, CAP_PCM_RATE_32000))
-		LOG(("CAP_PCM_RATE_32000\n"));
-	if (ac97_has_capability(dev, CAP_PCM_RATE_44100))
-		LOG(("CAP_PCM_RATE_44100\n"));
-	if (ac97_has_capability(dev, CAP_PCM_RATE_48000))
-		LOG(("CAP_PCM_RATE_48000\n"));
-	if (ac97_has_capability(dev, CAP_PCM_RATE_88200))
-		LOG(("CAP_PCM_RATE_88200\n"));
-	if (ac97_has_capability(dev, CAP_PCM_RATE_96000))
-		LOG(("CAP_PCM_RATE_96000\n"));
-}
-
-bool
-ac97_has_capability(ac97_dev *dev, uint64 cap)
-{
-	// return (dev->capabilities & cap); // does not work because of 64 bit to integer \
                trucation 
-	return (dev->capabilities & cap) != 0;
-}
-
-/*************************************************
- * Codec specific initialization, etc.
- */
-
-bool
-ac97_reg_is_valid(ac97_dev *dev, uint8 reg)
-{
-	if (reg & 1)
-		return false;
-	if (reg > 0x7e)
-		return false;
-
-	switch (dev->codec_id) {
-		case CODEC_ID_AK4540:
-		case CODEC_ID_AK4542:
-			if (reg < 0x1e || reg == 0x20 || reg == 0x26 || reg > 0x7a)
-				return true;
-			return false;
-
-		case CODEC_ID_AD1819:
-		case CODEC_ID_AD1881:
-		case CODEC_ID_AD1881A:
-			if (reg < 0x3a || reg > 0x6e)
-				return true;
-			return false;
-
-		case CODEC_ID_AD1885:
-		case CODEC_ID_AD1886:
-		case CODEC_ID_AD1886A:
-		case CODEC_ID_AD1887:
-			if (reg < 0x3c || reg == 0x5a || reg > 0x6e)
-				return true;
-			return false;
-
-		case CODEC_ID_STAC9700:
-		case CODEC_ID_STAC9704:
-		case CODEC_ID_STAC9705:
-		case CODEC_ID_STAC9708:
-		case CODEC_ID_STAC9721:
-		case CODEC_ID_STAC9744:
-		case CODEC_ID_STAC9756:
-			if (reg < 0x3c || reg > 0x58)
-				return true;
-			return false;
-		
-		default:
-			return true;
-	}
-}
-
-void ac97_amp_enable(ac97_dev *dev, bool yesno)
-{
-	switch (dev->codec_id) {	
-		case CODEC_ID_CS4299A:
-		case CODEC_ID_CS4299C:
-		case CODEC_ID_CS4299D:
-			LOG(("cs4299_amp_enable\n"));
-			if (yesno)
-				ac97_reg_cached_write(dev, 0x68, 0x8004);
-			else
-				ac97_reg_cached_write(dev, 0x68, 0);
-			break;
-		
-		default:
-			LOG(("ac97_amp_enable, reverse eamp = %d\n", dev->reversed_eamp_polarity));
-			LOG(("powerdown register was = %#04x\n", ac97_reg_uncached_read(dev, \
                AC97_POWERDOWN)));
-			if (dev->reversed_eamp_polarity)
-				yesno = !yesno;
-			if (yesno)
-				ac97_reg_cached_write(dev, AC97_POWERDOWN, ac97_reg_uncached_read(dev, \
                AC97_POWERDOWN) & ~0x8000); /* switch on (low active) */
-			else
-				ac97_reg_cached_write(dev, AC97_POWERDOWN, ac97_reg_uncached_read(dev, \
                AC97_POWERDOWN) | 0x8000); /* switch off */
-			LOG(("powerdown register is = %#04x\n", ac97_reg_uncached_read(dev, \
                AC97_POWERDOWN)));
-		break;
-	}
-}
-
-bool
-ad1819_set_rate(ac97_dev *dev, uint8 reg, uint32 rate)
-{
-	uint32 value;
-	
-	value = (uint32)((rate * 48000ULL) / dev->clock); /* need 64 bit calculation for \
                rates 96000 or higher */
-
-	LOG(("ad1819_set_rate: clock = %d, rate = %d, value = %d\n", dev->clock, rate, \
                value));
-	
-	if (value < 0x1B58 || value > 0xBB80)
-		return false;
-
-	switch (reg) {
-		case AC97_PCM_FRONT_DAC_RATE:
-			ac97_reg_cached_write(dev, AC97_AD_SAMPLE_RATE_0, value);
-			return true;
-		
-		case AC97_PCM_L_R_ADC_RATE:
-			ac97_reg_cached_write(dev, AC97_AD_SAMPLE_RATE_1, value);
-			return true;
-
-		default:
-			return false;
-	}
-}
-
-bool
-ad1819_get_rate(ac97_dev *dev, uint8 reg, uint32 *rate)
-{
-	uint32 value;
-	
-	switch (reg) {
-		case AC97_PCM_FRONT_DAC_RATE:
-			value = ac97_reg_cached_read(dev, AC97_AD_SAMPLE_RATE_0);
-			break;
-		
-		case AC97_PCM_L_R_ADC_RATE:
-			value = ac97_reg_cached_read(dev, AC97_AD_SAMPLE_RATE_1);
-			break;
-
-		default:
-			return false;
-	}
-
-	*rate = (uint32)((value * (uint64)dev->clock) / 48000); /* need 64 bit calculation \
                to avoid overflow*/
-	return true;
-}
-
-
-void default_init(ac97_dev *dev)
-{
-	LOG(("default_init\n"));
-}
-
-void ad1819_init(ac97_dev *dev)
-{
-	LOG(("ad1819_init\n"));
-
-	/* Default config for system with single AD1819 codec */
-	ac97_reg_cached_write(dev, AC97_AD_SERIAL_CONFIG, 0x7000);
-	ac97_update_register_cache(dev);
-
-	/* The AD1819 chip has proprietary  sample rate controls
-	 * Setup sample rate 0 generator for DAC,
-	 * Setup sample rate 1 generator for ADC,
-	 * ARSR=1, DRSR=0, ALSR=1, DLSR=0
-	 */
-	ac97_reg_cached_write(dev, AC97_AD_MISC_CONTROL, 0x0101);
-	/* connect special rate set/get functions */
-	dev->set_rate = ad1819_set_rate;
-	dev->get_rate = ad1819_get_rate;
-	ac97_detect_rates(dev);
-	ac97_set_rate(dev, AC97_PCM_FRONT_DAC_RATE, 48000);
-	ac97_set_rate(dev, AC97_PCM_L_R_ADC_RATE, 48000);
-}
-
-void ad1881_init(ac97_dev *dev)
-{
-	LOG(("ad1881_init\n"));
-	
-	/* Default config for system with single AD1819 codec,
-	 * BROKEN on systems with master & slave codecs */
-	ac97_reg_cached_write(dev, AC97_AD_SERIAL_CONFIG, 0x7000);
-	ac97_update_register_cache(dev);
-
-	/* Setup DAC and ADC rate generator assignments compatible with AC97 */
-	ac97_reg_cached_write(dev, AC97_AD_MISC_CONTROL, 0x0404);
-
-	/* Setup variable frame rate limits */
-	dev->min_vsr = 0x1B58;	/*  7kHz */
-	dev->max_vsr = 0xBB80;	/* 48kHz */
-}
-
-void ad1885_init(ac97_dev *dev)
-{
-	LOG(("ad1885_init\n"));
-	ad1881_init(dev);
-	
-	/* disable jack sense 0 and 1 (JS0, JS1) to turn off automatic mute */
-	ac97_reg_cached_write(dev, AC97_AD_JACK_SENSE, ac97_reg_cached_read(dev, \
                AC97_AD_JACK_SENSE) | 0x0300);
-}
-
-void ad1886_init(ac97_dev *dev)
-{
-	LOG(("ad1886_init\n"));
-	ad1881_init(dev);
-	
-	/* change jack sense to always activate outputs*/
-	ac97_reg_cached_write(dev, AC97_AD_JACK_SENSE, 0x0010);
-	/* change SPDIF to a valid value */
-	ac97_reg_cached_write(dev, AC97_SPDIF_CONTROL, 0x2a20);
-}
-
-void ad1980_init(ac97_dev *dev)
-{
-	LOG(("ad1980_init\n"));
-
-	/* Select only master codec,
-	 * SPDIF and DAC are linked
-	 */
-	ac97_reg_cached_write(dev, AC97_AD_SERIAL_CONFIG, 0x1001);
-	ac97_update_register_cache(dev);
-	
-	/* Select Line-out driven with mixer data (not surround data)
-	 * Select Headphone-out driven with mixer data (not surround data),
-	 * LOSEL = 0, HPSEL = 1
-	 * XXX this one needs to be changed to support surround	out
-	 */
-	ac97_reg_cached_write(dev, AC97_AD_MISC_CONTROL, 0x0400);
-}
-
-void alc650_init(ac97_dev *dev)
-{
-	LOG(("alc650_init\n"));
-
-	/* Enable Surround, LFE and Center downmix into Line-out,
-	 * Set Surround-out as duplicated Line-out.
-	 */
-	ac97_reg_cached_write(dev, AC97_ALC650_MULTI_CHAN_CTRL, 0x0007);
-
-	/* Set Surround DAC Volume to 0dB
-	 * Set Center/LFE DAC Volume to 0dB
-	 * (but both should already be set, as these are hardware reset defaults)
-	 */
-	ac97_reg_cached_write(dev, AC97_ALC650_SURR_VOLUME, 0x0808);
-	ac97_reg_cached_write(dev, AC97_ALC650_CEN_LFE_VOLUME, 0x0808);
-}
-
-void stac9708_init(ac97_dev *dev)
-{
-	LOG(("stac9708_init\n"));
-	/* ALSA initializes some registers that according to the
-	 * documentation for this codec do not exist. If the
-	 * following doesn't work, we may need to do that, too.
-	 */
-	/* The Analog Special reg is at 0x6C, other codecs have it at 0x6E */
-	/* Set Analog Special to default (DAC/ADC -6dB disabled) */
-	ac97_reg_cached_write(dev, 0x6C, 0x0000);
-	/* Set Multi Channel to default */
-	ac97_reg_cached_write(dev, 0x74, 0x0000);
-}
-
-void stac9721_init(ac97_dev *dev)
-{
-	LOG(("stac9721_init\n"));
-	/* Set Analog Special to default (DAC/ADC -6dB disabled) */
-	ac97_reg_cached_write(dev, 0x6E, 0x0000);
-	/* Enable register 0x72 */
-	ac97_reg_cached_write(dev, 0x70, 0xabba);
-	/* Set Analog Current to -50% */
-	ac97_reg_cached_write(dev, 0x72, 0x0002);
-	/* Set Multi Channel to default */
-	ac97_reg_cached_write(dev, 0x74, 0x0000);
-	/* Enable register 0x78 */
-	ac97_reg_cached_write(dev, 0x76, 0xabba);
-	/* Set Clock Access to default */
-	ac97_reg_cached_write(dev, 0x78, 0x0000);
-}
-
-void stac9744_init(ac97_dev *dev)
-{
-	LOG(("stac9744_init\n"));
-	/* Set Analog Special to default (DAC/ADC -6dB disabled) */
-	ac97_reg_cached_write(dev, 0x6E, 0x0000);
-	/* Enable register 0x72 */
-	ac97_reg_cached_write(dev, 0x70, 0xabba);
-	/* Set Analog Current to -50% */
-	ac97_reg_cached_write(dev, 0x72, 0x0002);
-	/* Set Multi Channel to default */
-	ac97_reg_cached_write(dev, 0x74, 0x0000);
-	/* Enable register 0x78 */
-	ac97_reg_cached_write(dev, 0x76, 0xabba);
-	/* Set Clock Access to default */
-	ac97_reg_cached_write(dev, 0x78, 0x0000);
-}
-
-void stac9756_init(ac97_dev *dev)
-{
-	LOG(("stac9756_init\n"));
-	/* Set Analog Special to default (AC97 all-mix, DAC/ADC -6dB disabled) */
-	ac97_reg_cached_write(dev, 0x6E, 0x1000);
-	/* Enable register 0x72 */
-	ac97_reg_cached_write(dev, 0x70, 0xabba);
-	/* Set Analog Current to -50% */
-	ac97_reg_cached_write(dev, 0x72, 0x0002);
-	/* Set Multi Channel to default */
-	ac97_reg_cached_write(dev, 0x74, 0x0000);
-	/* Enable register 0x78 */
-	ac97_reg_cached_write(dev, 0x76, 0xabba);
-	/* Set Clock Access to default */
-	ac97_reg_cached_write(dev, 0x78, 0x0000);
-}
-
-void tr28028_init(ac97_dev *dev)
-{
-	LOG(("tr28028_init\n"));
-	ac97_reg_cached_write(dev, AC97_POWERDOWN, 0x0300);
-	ac97_reg_cached_write(dev, AC97_POWERDOWN, 0x0000);
-	ac97_reg_cached_write(dev, AC97_SURR_VOLUME, 0x0000);
-	ac97_reg_cached_write(dev, AC97_SPDIF_CONTROL, 0x0000);
-}
-
-void wm9701_init(ac97_dev *dev)
-{
-	LOG(("wm9701_init\n"));
-	/* ALSA writes some of these registers, but the codec
-	 * documentation states explicitly that 0x38 and 0x70 to 0x74
-	 * are not used in the WM9701A
-	 */
-
-	/* DVD noise patch (?) */
-	ac97_reg_cached_write(dev, 0x5a, 0x0200);
-}
-
-void wm9703_init(ac97_dev *dev)
-{
-	LOG(("wm9703_init\n"));
-	/* Set front mixer value to unmuted */
-	ac97_reg_cached_write(dev, 0x72, 0x0808);
-	/* Disable loopback, etc */
-	ac97_reg_cached_write(dev, AC97_GENERAL_PURPOSE, 0x8000);
-}
-
-void wm9704_init(ac97_dev *dev)
-{
-	LOG(("wm9704_init\n"));
-	/* Set read DAC value to unmuted */
-	ac97_reg_cached_write(dev, 0x70, 0x0808);
-	/* Set front mixer value to unmuted */
-	ac97_reg_cached_write(dev, 0x72, 0x0808);
-	/* Set rear mixer value to unmuted */
-	ac97_reg_cached_write(dev, 0x74, 0x0808);
-	/* DVD noise patch (?) */
-	ac97_reg_cached_write(dev, 0x5a, 0x0200);
-}
diff --git a/src/add-ons/kernel/drivers/audio/ac97/ich/ac97.h \
b/src/add-ons/kernel/drivers/audio/ac97/ich/ac97.h deleted file mode 100644
index f764e8139e..0000000000
--- a/src/add-ons/kernel/drivers/audio/ac97/ich/ac97.h
+++ /dev/null
@@ -1,232 +0,0 @@
-/*
- * BeOS Driver for Intel ICH AC'97 Link interface
- *
- * Copyright (c) 2002, Marcus Overhagen <marcus@overhagen.de>
- *
- * All rights reserved.
- * Redistribution and use in source and binary forms, with or without modification, 
- * are permitted provided that the following conditions are met:
- *
- * - Redistributions of source code must retain the above copyright notice, 
- *   this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright notice,
- *   this list of conditions and the following disclaimer in the documentation 
- *   and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 
- * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS \
                
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 
- * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- */
-#ifndef _AC97_H_
-#define _AC97_H_
-
-enum AC97_REGISTER {
-	/* Baseline audio register set */
-	AC97_RESET				= 0x00,
-	AC97_MASTER_VOLUME		= 0x02,
-	AC97_AUX_OUT_VOLUME		= 0x04,
-	AC97_MONO_VOLUME		= 0x06,
-	AC97_MASTER_TONE		= 0x08,
-	AC97_PC_BEEP_VOLUME		= 0x0A,
-	AC97_PHONE_VOLUME		= 0x0C,
-	AC97_MIC_VOLUME			= 0x0E,
-	AC97_LINE_IN_VOLUME		= 0x10,
-	AC97_CD_VOLUME			= 0x12,
-	AC97_VIDEO_VOLUME		= 0x14,
-	AC97_AUX_IN_VOLUME		= 0x16,
-	AC97_PCM_OUT_VOLUME		= 0x18,
-	AC97_RECORD_SELECT		= 0x1A,
-	AC97_RECORD_GAIN		= 0x1C,
-	AC97_RECORD_GAIN_MIC	= 0x1E,
-	AC97_GENERAL_PURPOSE	= 0x20,
-	AC97_3D_CONTROL			= 0x22,
-	AC97_PAGING				= 0x24,
-	AC97_POWERDOWN			= 0x26,
-	
-	/* Extended audio register set */
-	AC97_EXTENDED_ID		= 0x28,
-	AC97_EXTENDED_STAT_CTRL = 0x2A,
-	AC97_PCM_FRONT_DAC_RATE = 0x2C,
-	AC97_PCM_SURR_DAC_RATE	= 0x2E,
-	AC97_PCM_LFE_DAC_RATE	= 0x30,
-	AC97_PCM_L_R_ADC_RATE	= 0x32,
-	AC97_MIC_ADC_RATE		= 0x34,
-	AC97_CENTER_LFE_VOLUME	= 0x36,
-	AC97_SURR_VOLUME		= 0x38,
-	AC97_SPDIF_CONTROL		= 0x3A,
-
-	/* Vendor ID */
-	AC97_VENDOR_ID1			= 0x7C,
-	AC97_VENDOR_ID2			= 0x7E,
-	
-	/* Analog Devices */
-	AC97_AD_JACK_SENSE		= 0x72,
-	AC97_AD_SERIAL_CONFIG	= 0x74,
-	AC97_AD_MISC_CONTROL	= 0x76,
-	AC97_AD_SAMPLE_RATE_0	= 0x78,
-	AC97_AD_SAMPLE_RATE_1	= 0x7a,
-	
-	/* Realtek ALC650 */
-	AC97_ALC650_SPDIF_INPUT_CHAN_STATUS_LO = 0x60, /* only ALC650 Rev. E and later */
-	AC97_ALC650_SPDIF_INPUT_CHAN_STATUS_HI = 0x62, /* only ALC650 Rev. E and later */
-	AC97_ALC650_SURR_VOLUME		= 0x64,
-	AC97_ALC650_CEN_LFE_VOLUME	= 0x66,
-	AC97_ALC650_MULTI_CHAN_CTRL	= 0x6A,
-	AC97_ALC650_MISC_CONTROL	= 0x74,
-	AC97_ALC650_GPIO_SETUP		= 0x76,
-	AC97_ALC650_GPIO_STATUS		= 0x78,
-	AC97_ALC650_CLOCK_SOURCE	= 0x7A
-};
-
-// AC97_EXTENDED_ID bits
-enum {
-	EXID_VRA 	= 0x0001,
-	EXID_DRA 	= 0x0002,
-	EXID_SPDIF 	= 0x0004,
-	EXID_VRM 	= 0x0008,
-	EXID_DSA0 	= 0x0010,
-	EXID_DSA1 	= 0x0020,
-	EXID_CDAC 	= 0x0040,
-	EXID_SDAC 	= 0x0080,
-	EXID_LDAC 	= 0x0100,
-	EXID_AMAP 	= 0x0200,
-	EXID_REV0 	= 0x0400,
-	EXID_REV1 	= 0x0800,
-	EXID_bit12 	= 0x1000,
-	EXID_bit13 	= 0x2000,
-	EXID_ID0 	= 0x4000,
-	EXID_ID1 	= 0x8000
-};
-
-// some codec_ids
-enum {
-	CODEC_ID_ALC201A	= 0x414c4710,
-	CODEC_ID_AK4540		= 0x414b4d00,
-	CODEC_ID_AK4542		= 0x414b4d01,
-	CODEC_ID_AD1819 	= 0x41445303, // ok, AD1819A, AD1819B
-	CODEC_ID_AD1881		= 0x41445340, // ok, AD1881
-	CODEC_ID_AD1881A	= 0x41445348, // ok, AD1881A
-	CODEC_ID_AD1885		= 0x41445360, // ok, AD1885
-	CODEC_ID_AD1886		= 0x41445361, // ok, AD1886
-	CODEC_ID_AD1886A 	= 0x41445363, // ok, AD1886A
-	CODEC_ID_AD1887		= 0x41445362, // ok, AD1887
-	CODEC_ID_AD1980		= 0x41445370, // ok, AD1980
-	CODEC_ID_AD1981B	= 0x41445374, // ok, AD1981B
-	CODEC_ID_AD1985		= 0x41445375, // ok, AD1985
-	CODEC_ID_CS4299A	= 0x43525931,
-	CODEC_ID_CS4299C	= 0x43525933,
-	CODEC_ID_CS4299D	= 0x43525934,
-	CODEC_ID_STAC9700	= 0x83847600, // ok, STAC9700
-	CODEC_ID_STAC9704	= 0x83847604, // STAC9701/03, STAC9704/07, STAC9705 (???)
-	CODEC_ID_STAC9705	= 0x83847605, // ???
-	CODEC_ID_STAC9708	= 0x83847608, // ok, STAC9708/11
-	CODEC_ID_STAC9721	= 0x83847609, // ok, STAC9721/23
-	CODEC_ID_STAC9744	= 0x83847644, // ok, STAC9744
-	CODEC_ID_STAC9752	= 0x83847652, // ok, STAC9752/53
-	CODEC_ID_STAC9756	= 0x83847656, // ok, STAC9756/57
-	CODEC_ID_STAC9766	= 0x83847666, // ok, STAC9766/67
-};
-
-// capabilities
-enum ac97_capability {
-	CAP_PCM_MIC				= 0x0000000000000001ULL, /* dedicated mic PCM channel */
-	CAP_BASS_TREBLE_CTRL	= 0x0000000000000002ULL,
-	CAP_SIMULATED_STEREO	= 0x0000000000000004ULL,
-	CAP_HEADPHONE_OUT		= 0x0000000000000008ULL,
-	CAP_LAUDNESS			= 0x0000000000000010ULL,
-	CAP_DAC_18BIT			= 0x0000000000000020ULL,
-	CAP_DAC_20BIT			= 0x0000000000000040ULL,
-	CAP_ADC_18BIT			= 0x0000000000000080ULL,
-	CAP_ADC_20BIT			= 0x0000000000000100ULL,
-	CAP_3D_ENHANCEMENT		= 0x0000000000000200ULL,
-	CAP_VARIABLE_PCM		= 0x0000000000000400ULL, /* variable rate PCM */
-	CAP_DOUBLE_PCM			= 0x0000000000000800ULL, /* double rate PCM */
-	CAP_SPDIF				= 0x0000000000001000ULL,
-	CAP_VARIABLE_MIC		= 0x0000000000002000ULL, /* variable rate mic PCM */
-	CAP_CENTER_DAC			= 0x0000000000004000ULL,
-	CAP_SURR_DAC			= 0x0000000000008000ULL,
-	CAP_LFE_DAC				= 0x0000000000010000ULL,
-	CAP_AMAP				= 0x0000000000020000ULL,
-	CAP_REV21				= 0x0000000000040000ULL,
-	CAP_REV22				= 0x0000000000080000ULL,
-	CAP_REV23				= 0x0000000000100000ULL,
-	CAP_PCM_RATE_CONTINUOUS	= 0x0000000000200000ULL,
-	CAP_PCM_RATE_8000		= 0x0000000000400000ULL,
-	CAP_PCM_RATE_11025		= 0x0000000000800000ULL,
-	CAP_PCM_RATE_12000		= 0x0000000001000000ULL,
-	CAP_PCM_RATE_16000		= 0x0000000002000000ULL,
-	CAP_PCM_RATE_22050		= 0x0000000004000000ULL,
-	CAP_PCM_RATE_24000		= 0x0000000008000000ULL,
-	CAP_PCM_RATE_32000		= 0x0000000010000000ULL,
-	CAP_PCM_RATE_44100		= 0x0000000020000000ULL,
-	CAP_PCM_RATE_48000		= 0x0000000040000000ULL,
-	CAP_PCM_RATE_88200		= 0x0000000080000000ULL,
-	CAP_PCM_RATE_96000		= 0x0000000100000000ULL,
-	CAP_PCM_RATE_MASK		= ( CAP_PCM_RATE_CONTINUOUS | CAP_PCM_RATE_8000 | \
                CAP_PCM_RATE_11025 |
-								CAP_PCM_RATE_12000 | CAP_PCM_RATE_16000 | CAP_PCM_RATE_22050 |
-								CAP_PCM_RATE_24000 | CAP_PCM_RATE_32000 | CAP_PCM_RATE_44100 |
-								CAP_PCM_RATE_48000 | CAP_PCM_RATE_88200 | CAP_PCM_RATE_96000)
-};
-
-
-struct ac97_dev;
-typedef struct ac97_dev ac97_dev;
-
-typedef void	(* codec_init)(ac97_dev * dev);
-typedef	uint16	(* codec_reg_read)(void * cookie, uint8 reg);
-typedef	void	(* codec_reg_write)(void * cookie, uint8 reg, uint16 value);
-typedef bool	(* codec_set_rate)(ac97_dev *dev, uint8 reg, uint32 rate);
-typedef bool	(* codec_get_rate)(ac97_dev *dev, uint8 reg, uint32 *rate);
-
-struct ac97_dev {
-	uint16				reg_cache[0x7f];
-
-	void *				cookie;
-	
-	uint32				codec_id;
-	const char *		codec_info;
-	const char *		codec_3d_stereo_enhancement;
-	
-	codec_init			init;
-	codec_reg_read		reg_read;
-	codec_reg_write		reg_write;
-	codec_set_rate		set_rate;
-	codec_get_rate		get_rate;
-
-	uint32				max_vsr;	
-	uint32				min_vsr;	
-	uint32 				clock;
-	uint64				capabilities;
-	bool				reversed_eamp_polarity;	
-};
-
-
-void	ac97_attach(ac97_dev **dev, codec_reg_read reg_read, codec_reg_write reg_write, \
                void *cookie);
-void	ac97_detach(ac97_dev *dev);
-void	ac97_suspend(ac97_dev *dev);
-void	ac97_resume(ac97_dev *dev);
-
-void	ac97_reg_cached_write(ac97_dev *dev, uint8 reg, uint16 value);
-uint16	ac97_reg_cached_read(ac97_dev *dev, uint8 reg);
-void	ac97_reg_uncached_write(ac97_dev *dev, uint8 reg, uint16 value);
-uint16	ac97_reg_uncached_read(ac97_dev *dev, uint8 reg);
-
-bool	ac97_reg_update(ac97_dev *dev, uint8 reg, uint16 value);
-bool	ac97_reg_update_bits(ac97_dev *dev, uint8 reg, uint16 mask, uint16 value);
-
-bool	ac97_set_rate(ac97_dev *dev, uint8 reg, uint32 rate);
-bool	ac97_get_rate(ac97_dev *dev, uint8 reg, uint32 *rate);
-
-bool	ac97_has_capability(ac97_dev *dev, uint64 cap);
-
-void	ac97_set_clock(ac97_dev *dev, uint32 clock);
-
-#endif

[ *** diff truncated: 4203 lines dropped *** ]


############################################################################

Commit:      beb5d397760790b5632d6c8bba0c5551b347f92e
URL:         https://git.haiku-os.org/haiku/commit/?id=beb5d3977607
Author:      PulkoMandy <pulkomandy@pulkomandy.tk>
Date:        Fri Apr 12 16:35:25 2024 UTC
Committer:   waddlesplash <waddlesplash@gmail.com>
Commit-Date: Mon Apr 15 16:02:49 2024 UTC

audio drivers: move util.{c,h} to generic directory

Change-Id: Ied0afa5ad9f66ee6f2249715d66fb62e6206d137
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7607
Reviewed-by: Alexander von Gluck <alex@terarocket.io>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>

----------------------------------------------------------------------------

############################################################################

Commit:      d3503944f052536d75afff2b89c0a9f0fdc9e83e
URL:         https://git.haiku-os.org/haiku/commit/?id=d3503944f052
Author:      PulkoMandy <pulkomandy@pulkomandy.tk>
Date:        Fri Apr 12 17:18:02 2024 UTC
Committer:   waddlesplash <waddlesplash@gmail.com>
Commit-Date: Mon Apr 15 16:02:49 2024 UTC

echo: actually fix warnings and enable -Werror

The driver Jamfile had a "-w" added to the compiler command line to
disable all warnings.

Use the generic util.c/h instead of having a separate copy.

Change-Id: I74e325850d573e75d652658748426c9ae353c6e7
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7617
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Alexander von Gluck <alex@terarocket.io>

----------------------------------------------------------------------------

############################################################################

Commit:      e7e9e58fbd2b1d75fa1bc159741aee9cb8342be1
URL:         https://git.haiku-os.org/haiku/commit/?id=e7e9e58fbd2b
Author:      PulkoMandy <pulkomandy@pulkomandy.tk>
Date:        Fri Apr 12 17:27:59 2024 UTC
Committer:   waddlesplash <waddlesplash@gmail.com>
Commit-Date: Mon Apr 15 16:02:49 2024 UTC

emuxki: use shared util.c instead of a separate copy

Change-Id: I1ba248d442e558565e41472a6daab279ee8ee8af
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7618
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Alexander von Gluck <alex@terarocket.io>

----------------------------------------------------------------------------

############################################################################

Commit:      98afcfa72a09e221278cf63b7c4cc366f38ebeaa
URL:         https://git.haiku-os.org/haiku/commit/?id=98afcfa72a09
Author:      PulkoMandy <pulkomandy@pulkomandy.tk>
Date:        Fri Apr 12 17:47:31 2024 UTC
Committer:   waddlesplash <waddlesplash@gmail.com>
Commit-Date: Mon Apr 15 16:02:49 2024 UTC

geode audio: fix almost all warnings, enable -Werror

The compiler complains about implicit declaration of free and calloc
despite stdlib.h being included. I think it's because of -ffreestanding
being used on the command line?

Change-Id: I57c3899e5034d1c2ee9cb6c1ed4c92aa818b53ea
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7619
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Alexander von Gluck <alex@terarocket.io>

----------------------------------------------------------------------------

############################################################################

Commit:      99351a72d3638705c3323c36fd551f1d3cd2111c
URL:         https://git.haiku-os.org/haiku/commit/?id=99351a72d363
Author:      PulkoMandy <pulkomandy@pulkomandy.tk>
Date:        Fri Apr 12 17:54:15 2024 UTC
Committer:   waddlesplash <waddlesplash@gmail.com>
Commit-Date: Mon Apr 15 16:02:49 2024 UTC

sb16: enable -Werror

Change-Id: I990362cd764e3a219e5022a62264b76be4cdf80c
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7620
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Alexander von Gluck <alex@terarocket.io>

----------------------------------------------------------------------------

############################################################################

Revision:    hrev57705
Commit:      5ea01a50c2b62a3f587166c4df12527a7919f600
URL:         https://git.haiku-os.org/haiku/commit/?id=5ea01a50c2b6
Author:      PulkoMandy <pulkomandy@pulkomandy.tk>
Date:        Sat Apr 13 12:32:38 2024 UTC
Committer:   waddlesplash <waddlesplash@gmail.com>
Commit-Date: Mon Apr 15 16:02:49 2024 UTC

cmedia: enable -Werror

Errors are now enabled for all audio drivers.

Change-Id: Ia4e986f0ed8965376c3bbefc3d9f04bcd68ad561
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7621
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Alexander von Gluck <alex@terarocket.io>

----------------------------------------------------------------------------


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic