diff options
author | Bertrand Jacquin <beber@meleeweb.net> | 2008-06-02 23:44:05 +0200 |
---|---|---|
committer | Bertrand Jacquin <beber@meleeweb.net> | 2008-06-02 23:44:05 +0200 |
commit | 33b08f77c909953290dc1eac1d4a0eb844e3e9cb (patch) | |
tree | b290aeb2363445c0495baa3269df4201a57e8bc6 /media-sound/alsa-driver | |
parent | Add cross-compiling toolchains (diff) | |
download | portage-33b08f77c909953290dc1eac1d4a0eb844e3e9cb.tar.xz |
alsa-driver: add working release
Diffstat (limited to 'media-sound/alsa-driver')
7 files changed, 632 insertions, 0 deletions
diff --git a/media-sound/alsa-driver/Manifest b/media-sound/alsa-driver/Manifest new file mode 100644 index 00000000..d83fb80d --- /dev/null +++ b/media-sound/alsa-driver/Manifest @@ -0,0 +1,7 @@ +AUX 1.0.14_rc3-configure.in-core2.patch 843 RMD160 c64d41133b7e93fa1842c45b18f3332c42e38eec SHA1 ffbe56bb87d41b60dc0ac9852e3cb61ad181292e SHA256 6f8f462a654a0f56b49c520be7c0d832903966176f48309d4c82c2bc5be5aef8 +AUX alsa-driver-1.0.11-kernel-2.6.17.patch 953 RMD160 8790da12c78912a4dec53f287838846e303a18dd SHA1 71b552329bc6ab179956b3f7d65f92fa393dec4c SHA256 517f494c5fe3039d62a18268f2c3d03cbcd6b2bff09771bfaafd439c39642c2c +AUX alsa-driver-1.0.14-seq_file.patch 11129 RMD160 ac02481afc9d9b4cab1cb56a5c0cd8e11c32fd25 SHA1 5ffa287584464c57bbe3eee2fc512bccddcd749f SHA256 37f8020632147d89f2c97c9b6ea88abd2000efa2abafd2711652f22c8c6b20b0 +AUX alsa-driver-1.0.14_rc2-tumbler-ppc.patch 1105 RMD160 ae270a067ba51e4e580373465d698dd8aa872c5f SHA1 c4dd46e302417272b1123fc435d742e89677ee8d SHA256 1c154e2235697383fae4b06a0d3ec9e5c437188481711e639a186d0d920aeb76 +AUX alsa-driver-1.0.15-linux-2.4.patch 278 RMD160 13b53ecf56b11de3d6ae4683578b12b3fdc8c649 SHA1 4bfb7c3bf4980cbe26a33ef271f3ea3813c46d0f SHA256 e7584aedf46dcbfbc6ee5afaa998991e5adaea3057b69b747d2cd403dccac877 +DIST alsa-driver-1.0.16rc2.tar.bz2 2721795 RMD160 99ac2c1cd7ad7d520d70909b0be88f72588a2ac1 SHA1 f63a2163d526e3aa4e563c5f543b5525da664270 SHA256 5951c039c02530503afa667e6b60bdece6a29eb351ec5653fa7dd7d5a0fa6b6e +EBUILD alsa-driver-1.0.16_rc2.ebuild 7055 RMD160 03d69abe625af9da885dbec390cb17c77547b186 SHA1 3fd3629bc67d03177dbccea9f26d01bc60a537cc SHA256 1041d340617773855d7909a23a786040601a4d492e71ead3790c79ae7f51d14b diff --git a/media-sound/alsa-driver/alsa-driver-1.0.16_rc2.ebuild b/media-sound/alsa-driver/alsa-driver-1.0.16_rc2.ebuild new file mode 100644 index 00000000..b32c27a9 --- /dev/null +++ b/media-sound/alsa-driver/alsa-driver-1.0.16_rc2.ebuild @@ -0,0 +1,181 @@ +# Copyright 1999-2007 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/media-sound/alsa-driver/alsa-driver-1.0.15.ebuild,v 1.4 2007/10/22 20:31:01 armin76 Exp $ + +inherit autotools linux-mod flag-o-matic eutils multilib linux-info + +MY_P="${P/_rc/rc}" +S="${WORKDIR}/${MY_P}" + +DESCRIPTION="Advanced Linux Sound Architecture kernel modules" +HOMEPAGE="http://www.alsa-project.org/" + +if [[ ${MY_P} == ${MY_P/_p*/} ]]; then + SRC_URI="mirror://alsaproject/driver/${MY_P}.tar.bz2" +else # Gentoo snapshots + SRC_URI="mirror://gentoo/${MY_P}.tar.bz2" +fi + +LICENSE="GPL-2 LGPL-2.1" +SLOT="0" + +KEYWORDS="~alpha ~amd64 ~mips ~ppc ~ppc64 ~x86" +IUSE="oss debug midi" + +IUSE_CARDS="seq-dummy dummy virmidi mtpav mts64 serial-u16550 mpu401 +loopback portman2x4 pcsp ad1848-lib cs4231-lib adlib ad1816a ad1848 +als100 azt2320 cmi8330 cs4231 cs4232 cs4236 dt019x es968 es1688 es18xx +gusclassic gusextreme gusmax interwave interwave-stb opl3sa2 +opti92x-ad1848 opti92x-cs4231 opti93x miro sb8 sb16 sbawe sgalaxy +sscape wavefront pc98-cs4232 msnd-pinnacle ad1889 als300 als4000 +ali5451 atiixp atiixp-modem au8810 au8820 au8830 azt3328 bt87x ca0106 +cmipci cs4281 cs46xx cs5535audio darla20 gina20 layla20 darla24 gina24 +layla24 mona mia echo3g indigo indigoio indigodj emu10k1 emu10k1x +ens1370 ens1371 es1938 es1968 fm801 fm801-tea575x hda-intel hdsp hdspm +ice1712 ice1724 intel8x0 intel8x0m korg1212 maestro3 mixart nm256 +pcxhr riptide rme32 rme96 rme9652 sonicvibes trident via82xx +via82xx-modem vx222 ymfpci pdplus asihpi powermac aoa +aoa-fabric-layout aoa-onyx aoa-tas aoa-toonie aoa-soundbus +aoa-soundbus-i2s sa11xx-uda1341 armaaci s3c2410 pxa2xx-i2sound au1x00 +usb-audio usb-usx2y vxpocket pdaudiocf sun-amd7930 sun-cs4231 sun-dbri +harmony soc at91-soc at91-soc-eti-b1-wm8731 pxa2xx-soc +pxa2xx-soc-corgi pxa2xx-soc-spitz pxa2xx-soc-poodle pxa2xx-soc-tosa" + +for iuse_card in ${IUSE_CARDS}; do + IUSE="${IUSE} alsa_cards_${iuse_card}" +done + +RDEPEND="virtual/modutils + !media-sound/snd-aoa" +DEPEND="${RDEPEND} + >=media-sound/alsa-headers-1.0.14 + virtual/linux-sources + sys-apps/debianutils" + +PROVIDE="virtual/alsa" + +pkg_setup() { + # By default, drivers for all supported cards will be compiled. + # If you want to only compile for specific card(s), set ALSA_CARDS + # environment to a space-separated list of drivers that you want to build. + # For example: + # + # env ALSA_CARDS='emu10k1 intel8x0 ens1370' emerge alsa-driver + # + ALSA_CARDS=${ALSA_CARDS:-${IUSE_ALSA_CARDS}} + + local PNP_DRIVERS="interwave interwave-stb" + local PNP_ERROR="Some of the drivers you selected require PnP support in your kernel (${PNP_DRIVERS}). Either enable PnP in your kernel or trim which drivers get compiled using ALSA_CARDS in /etc/make.conf." + + local ISA_DRIVERS="cs4232 msnd-pinnacle cs4231-lib adlib ad1816a ad1848 als100 azt2320 + cmi8330 cs4231 cs4236 dt019x es968 es1688 es18xx gusclassic gusextreme gusmax + interwave interwave-stb opl3sa2 opti92x-ad1848 opti92x-cs4231 opti93x miro sb8 + sb16 sbawe sb16_csp sgalaxy sscape wavefront" + local ISA_ERROR="Some of the drivers you selected require ISA support in your kernel ($(echo $ISA_DRIVERS)). Either enable ISA in your kernel or trim which drivers get compiled using ALSA_CARDS in /etc/make.conf." + + local FW_DRIVERS="darla20 gina20 layla20 darla24 gina24 layla24 mona mia echo3g indigo + indigoio indigodj emu10k1 korg1212 maestro3 riptide ymfpci asihpi" + local FW_LOADER_ERROR="Some of the drivers you selected require 'Userspace firmware loading support' in your kernel (${FW_DRIVERS}). Either enable that feature or trim which drivers get compiled using ALSA_CARDS in /etc/make.conf." + + local PARPORT_DRIVERS="portman2x4" + local PARPORT_ERROR="Some if the drivers you selected require Parallel Port support (${PARPORT_DRIVERS}). Either enable that feature or trim which drivers get compiled using ALSA_CARDS in /etc/make.conf." + + local TMP_ALSA_CARDS + local CHECK_PNP + local CHECK_ISA + local CHECK_FW + local CHECK_PARPORT + for card in ${ALSA_CARDS}; do + if has alsa_cards_${card} ${IUSE} && use alsa_cards_${card}; then + TMP_ALSA_CARDS="${TMP_ALSA_CARDS} ${card}" + has ${card} ${PNP_DRIVERS} && CHECK_PNP="PNP" + has ${card} ${ISA_DRIVERS} && CHECK_ISA="ISA" + has ${card} ${FW_DRIVERS} && CHECK_FW="FW_LOADER" + has ${card} ${PARPORT_DRIVERS} && CHECK_PARPORT="PARPORT" + fi + done + ALSA_CARDS="${TMP_ALSA_CARDS}" + + local CONFIG_CHECK="!SND SOUND ${CHECK_PNP} ${CHECK_ISA} ${CHECK_FW} ${CHECK_PARPORT}" + local SND_ERROR="ALSA is already compiled into the kernel. This is the recommended configuration, don't emerge alsa-driver." + local SOUND_ERROR="Your kernel doesn't have sound support enabled." + local SOUND_PRIME_ERROR="Your kernel is configured to use the deprecated OSS drivers. Please disable them and re-emerge alsa-driver." + + linux-mod_pkg_setup + + if [[ ${PROFILE_ARCH} == "sparc64" ]] ; then + export CBUILD=${CBUILD-${CHOST}} + export CHOST="sparc64-unknown-linux-gnu" + fi +} + +src_unpack() { + unpack ${A} + + cd "${S}" + + #kernel_is 2 4 && epatch "${FILESDIR}"/alsa-driver-1.0.15-linux-2.4.patch + + convert_to_m "${S}/Makefile" + sed -i -e 's:\(.*depmod\):#\1:' "${S}/Makefile" + eautoconf +} + +src_compile() { + local myABI=${ABI:-${DEFAULT_ABI}} + + # Should fix bug #46901 + is-flag "-malign-double" && filter-flags "-fomit-frame-pointer" + append-flags "-I${KV_DIR}/arch/$(tc-arch-kernel)/include" + + econf $(use_with oss) \ + $(use_with debug debug full) \ + --with-kernel="${KV_DIR}" \ + --with-build="${KV_OUT_DIR}" \ + --with-isapnp=yes \ + $(use_with midi sequencer) \ + --with-cards="${ALSA_CARDS}" || die "econf failed" + + # linux-mod_src_compile doesn't work well with alsa + + ARCH=$(tc-arch-kernel) + ABI=${KERNEL_ABI} + emake LDFLAGS="$(raw-ldflags)" HOSTCC="$(tc-getBUILD_CC)" CC="$(tc-getCC)" || die "Make Failed" + ARCH=$(tc-arch) + ABI=${myABI} +} + +src_install() { + emake DESTDIR="${D}" install-modules || die "make install failed" + + dodoc CARDS-STATUS FAQ README WARNING TODO + + if kernel_is 2 6; then + # mv the drivers somewhere they won't be killed by the kernel's make modules_install + mv "${D}/lib/modules/${KV_FULL}/kernel/sound" "${D}/lib/modules/${KV_FULL}/${PN}" + rmdir "${D}/lib/modules/${KV_FULL}/kernel" &> /dev/null + fi +} + +pkg_postinst() { + elog + elog "Remember that all mixer channels will be MUTED by default." + elog "Use the 'alsamixer' program to unmute them, then save your" + elog "mixer settings with /etc/init.d/alsasound save" + elog + elog "If you experience problems, please try building the in-kernel" + elog "ALSA drivers instead. This ebuild is not recommended and is" + elog "likely to be removed from portage at a later date." + elog + + linux-mod_pkg_postinst + + if kernel_is 2 6 && [ -e "${ROOT}/lib/modules/${KV_FULL}/kernel/sound" ]; then + # Cleanup if they had older alsa installed + for file in $(find "${ROOT}/lib/modules/${KV_FULL}/${PN}" -type f); do + rm -f ${file//${KV_FULL}\/${PN}/${KV_FULL}\/kernel\/sound} + done + + find "${ROOT}/lib/modules/${KV_FULL}/kernel/sound" -type d -print0 | xargs --null rmdir + fi +} diff --git a/media-sound/alsa-driver/files/1.0.14_rc3-configure.in-core2.patch b/media-sound/alsa-driver/files/1.0.14_rc3-configure.in-core2.patch new file mode 100644 index 00000000..f4818361 --- /dev/null +++ b/media-sound/alsa-driver/files/1.0.14_rc3-configure.in-core2.patch @@ -0,0 +1,20 @@ +diff -r 4a485db25506 configure.in +--- a/configure.in Tue Mar 06 13:18:02 2007 +0100 ++++ b/configure.in Sat Mar 17 19:25:53 2007 +0200 +@@ -844,6 +844,7 @@ fi + fi + AC_TRY_RUN([ + #include <stdio.h> ++#include <stdlib.h> + #include "$KERNDIR/include/linux/autoconf.h" + int main(void) { + FILE *file = fopen("processor.id", "w+"); +@@ -861,7 +862,7 @@ int main(void) { + fprintf(file, "i586tsc"); + #elif defined(CONFIG_M586MMX) + fprintf(file, "i586mmx"); +-#elif defined(CONFIG_M686) || defined(CONFIG_MPENTIUMII) || defined(CONFIG_MPENTIUMIII) || defined(CONFIG_MPENTIUM4) || defined(CONFIG_MPENTIUMM) ++#elif defined(CONFIG_M686) || defined(CONFIG_MPENTIUMII) || defined(CONFIG_MPENTIUMIII) || defined(CONFIG_MPENTIUM4) || defined(CONFIG_MPENTIUMM) || defined(CONFIG_MCORE2) + fprintf(file, "i686"); + #elif defined(CONFIG_MK6) + fprintf(file, "k6"); diff --git a/media-sound/alsa-driver/files/alsa-driver-1.0.11-kernel-2.6.17.patch b/media-sound/alsa-driver/files/alsa-driver-1.0.11-kernel-2.6.17.patch new file mode 100644 index 00000000..825d87f7 --- /dev/null +++ b/media-sound/alsa-driver/files/alsa-driver-1.0.11-kernel-2.6.17.patch @@ -0,0 +1,30 @@ +In kernel 2.6.17 non-counting semaphores are replaced by mutexes, this patch +makes serialmidi driver to work with the changes. +Index: alsa-driver-1.0.11/drivers/serialmidi.c +=================================================================== +--- alsa-driver-1.0.11.orig/drivers/serialmidi.c ++++ alsa-driver-1.0.11/drivers/serialmidi.c +@@ -314,12 +314,12 @@ static void tx_loop(serialmidi_t *serial + if (driver == NULL) + return; + +- if (down_trylock(&tty->atomic_write)) ++ if (!mutex_trylock(&tty->atomic_write_lock)) + return; + while (1) { + count = driver->write_room(tty); + if (count <= 0) { +- up(&tty->atomic_write); ++ mutex_unlock(&tty->atomic_write_lock); + return; + } + count = count > TX_BUF_SIZE ? TX_BUF_SIZE : count; +@@ -336,7 +336,7 @@ static void tx_loop(serialmidi_t *serial + break; + } + } +- up(&tty->atomic_write); ++ mutex_unlock(&tty->atomic_write_lock); + } + + static void ldisc_write_wakeup(struct tty_struct *tty) diff --git a/media-sound/alsa-driver/files/alsa-driver-1.0.14-seq_file.patch b/media-sound/alsa-driver/files/alsa-driver-1.0.14-seq_file.patch new file mode 100644 index 00000000..0dc6635e --- /dev/null +++ b/media-sound/alsa-driver/files/alsa-driver-1.0.14-seq_file.patch @@ -0,0 +1,342 @@ +--- a/alsa-kernel/core/memalloc.c ++++ b/alsa-kernel/core/memalloc.c +@@ -1,3 +1,4 @@ ++#include "memalloc.inc" + /* + * Copyright (c) by Jaroslav Kysela <perex@suse.cz> + * Takashi Iwai <tiwai@suse.de> +@@ -27,6 +28,7 @@ + #include <linux/pci.h> + #include <linux/slab.h> + #include <linux/mm.h> ++#include <linux/seq_file.h> + #include <asm/uaccess.h> + #include <linux/dma-mapping.h> + #include <linux/moduleparam.h> +@@ -82,7 +84,50 @@ struct snd_mem_list { + * Hacks + */ + +-#if defined(__i386__) ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0) ++#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 5) ++static void *snd_dma_alloc_coherent1(struct device *dev, size_t size, ++ dma_addr_t *dma_handle, int flags) ++{ ++ if (dev) ++ return dma_alloc_coherent(dev, size, dma_handle, flags); ++ else /* FIXME: dma_alloc_coherent does't always accept dev=NULL */ ++ return pci_alloc_consistent(NULL, size, dma_handle); ++} ++ ++static void snd_dma_free_coherent1(struct device *dev, size_t size, void *dma_addr, ++ dma_addr_t dma_handle) ++{ ++ if (dev) ++ return dma_free_coherent(dev, size, dma_addr, dma_handle); ++ else ++ return pci_free_consistent(NULL, size, dma_addr, dma_handle); ++} ++ ++#undef dma_alloc_coherent ++#define dma_alloc_coherent snd_dma_alloc_coherent1 ++#undef dma_free_coherent ++#define dma_free_coherent snd_dma_free_coherent1 ++#endif /* < 2.6.5 */ ++ ++#else ++ ++/* for 2.2/2.4 kernels */ ++#if defined(CONFIG_PCI) || defined(CONFIG_ISA) || defined(__i386__) ++#define dma_alloc_coherent(dev,size,addr,flags) pci_alloc_consistent((struct pci_dev *)(dev),size,addr) ++#define dma_free_coherent(dev,size,ptr,addr) pci_free_consistent((struct pci_dev *)(dev),size,ptr,addr) ++#elif CONFIG_SBUS ++#define dma_alloc_coherent(dev,size,addr,flags) sbus_alloc_consistent((struct sbus_dev *)(dev),size,addr) ++#define dma_free_coherent(dev,size,ptr,addr) sbus_free_consistent((struct sbus_dev *)(dev),size,ptr,addr) ++#else ++#error "Need a bus for dma_alloc_coherent()" ++#endif ++ ++#endif /* >= 2.6.0 */ ++ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 4, 0) ++#if defined(__i386__) || defined(__ppc__) || defined(__x86_64__) ++ + /* + * A hack to allocate large buffers via dma_alloc_coherent() + * +@@ -99,6 +144,30 @@ struct snd_mem_list { + * so dma_mask doesn't have to be messed with. + */ + ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0) ++#define VALID_DMA_MASK(dev) (dev)->dma_mask ++#define GET_DMA_MASK(dev) *(dev)->dma_mask ++#define SET_DMA_MASK(dev,val) (*(dev)->dma_mask = (val)) ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 5) ++#define GET_COHERENT_DMA_MASK(dev) (dev)->coherent_dma_mask ++#define SET_COHERENT_DMA_MASK(dev,val) ((dev)->coherent_dma_mask = (val)) ++#else ++#define GET_COHERENT_DMA_MASK(dev) 0 /* dummy */ ++#define SET_COHERENT_DMA_MASK(dev,val) ++#endif ++#else /* 2.4.x */ ++#define VALID_DMA_MASK(dev) 1 ++#define GET_DMA_MASK(dev) ((struct pci_dev *)(dev))->dma_mask ++#define SET_DMA_MASK(dev,val) (((struct pci_dev *)(dev))->dma_mask = (val)) ++#ifdef CONFIG_HAVE_PCI_CONSISTENT_DMA_MASK ++#define GET_COHERENT_DMA_MASK(dev) ((struct pci_dev *)(dev))->consistent_dma_mask ++#define SET_COHERENT_DMA_MASK(dev,val) (((struct pci_dev *)(dev))->consistent_dma_mask = (val)) ++#else ++#define GET_COHERENT_DMA_MASK(dev) 0 /* dummy */ ++#define SET_COHERENT_DMA_MASK(dev,val) ++#endif ++#endif ++ + static void *snd_dma_hack_alloc_coherent(struct device *dev, size_t size, + dma_addr_t *dma_handle, + gfp_t flags) +@@ -106,15 +175,15 @@ static void *snd_dma_hack_alloc_coherent + void *ret; + u64 dma_mask, coherent_dma_mask; + +- if (dev == NULL || !dev->dma_mask) ++ if (dev == NULL || !VALID_DMA_MASK(dev)) + return dma_alloc_coherent(dev, size, dma_handle, flags); +- dma_mask = *dev->dma_mask; +- coherent_dma_mask = dev->coherent_dma_mask; +- *dev->dma_mask = 0xffffffff; /* do without masking */ +- dev->coherent_dma_mask = 0xffffffff; /* do without masking */ ++ dma_mask = GET_DMA_MASK(dev); ++ coherent_dma_mask = GET_COHERENT_DMA_MASK(dev); ++ SET_DMA_MASK(dev, 0xffffffff); /* do without masking */ ++ SET_COHERENT_DMA_MASK(dev, 0xffffffff); /* do without masking */ + ret = dma_alloc_coherent(dev, size, dma_handle, flags); +- *dev->dma_mask = dma_mask; /* restore */ +- dev->coherent_dma_mask = coherent_dma_mask; /* restore */ ++ SET_DMA_MASK(dev, dma_mask); /* restore */ ++ SET_COHERENT_DMA_MASK(dev, coherent_dma_mask) /* restore */; + if (ret) { + /* obtained address is out of range? */ + if (((unsigned long)*dma_handle + size - 1) & ~dma_mask) { +@@ -139,6 +208,8 @@ static void *snd_dma_hack_alloc_coherent + #define dma_alloc_coherent snd_dma_hack_alloc_coherent + + #endif /* arch */ ++#endif /* >= 2.4.0 */ ++ + + /* + * +@@ -158,6 +229,24 @@ static inline void dec_snd_pages(int ord + snd_allocated_pages -= 1 << order; + } + ++static void mark_pages(struct page *page, int order) ++{ ++#if ! defined(__arm__) && LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 16) ++ struct page *last_page = page + (1 << order); ++ while (page < last_page) ++ SetPageReserved(page++); ++#endif ++} ++ ++static void unmark_pages(struct page *page, int order) ++{ ++#if ! defined(__arm__) && LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 16) ++ struct page *last_page = page + (1 << order); ++ while (page < last_page) ++ ClearPageReserved(page++); ++#endif ++} ++ + /** + * snd_malloc_pages - allocate pages with the given size + * @size: the size to allocate in bytes +@@ -176,8 +265,10 @@ void *snd_malloc_pages(size_t size, gfp_ + snd_assert(gfp_flags != 0, return NULL); + gfp_flags |= __GFP_COMP; /* compound page lets parts be mapped */ + pg = get_order(size); +- if ((res = (void *) __get_free_pages(gfp_flags, pg)) != NULL) ++ if ((res = (void *) __get_free_pages(gfp_flags, pg)) != NULL) { ++ mark_pages(virt_to_page(res), pg); + inc_snd_pages(pg); ++ } + return res; + } + +@@ -196,6 +287,7 @@ void snd_free_pages(void *ptr, size_t si + return; + pg = get_order(size); + dec_snd_pages(pg); ++ unmark_pages(virt_to_page(ptr), pg); + free_pages((unsigned long) ptr, pg); + } + +@@ -220,8 +312,10 @@ static void *snd_malloc_dev_pages(struct + | __GFP_NORETRY /* don't trigger OOM-killer */ + | __GFP_NOWARN; /* no stack trace print - this call is non-critical */ + res = dma_alloc_coherent(dev, PAGE_SIZE << pg, dma, gfp_flags); +- if (res != NULL) ++ if (res != NULL) { ++ mark_pages(virt_to_page(res), pg); + inc_snd_pages(pg); ++ } + + return res; + } +@@ -236,6 +330,7 @@ static void snd_free_dev_pages(struct de + return; + pg = get_order(size); + dec_snd_pages(pg); ++ unmark_pages(virt_to_page(ptr), pg); + dma_free_coherent(dev, PAGE_SIZE << pg, ptr, dma); + } + +@@ -481,53 +576,55 @@ static void free_all_reserved_pages(void + #define SND_MEM_PROC_FILE "driver/snd-page-alloc" + static struct proc_dir_entry *snd_mem_proc; + +-static int snd_mem_proc_read(char *page, char **start, off_t off, +- int count, int *eof, void *data) ++static int snd_mem_proc_read(struct seq_file *seq, void *offset) + { +- int len = 0; + long pages = snd_allocated_pages >> (PAGE_SHIFT-12); + struct snd_mem_list *mem; + int devno; + static char *types[] = { "UNKNOWN", "CONT", "DEV", "DEV-SG", "SBUS" }; + + mutex_lock(&list_mutex); +- len += snprintf(page + len, count - len, +- "pages : %li bytes (%li pages per %likB)\n", +- pages * PAGE_SIZE, pages, PAGE_SIZE / 1024); ++ seq_printf(seq, "pages : %li bytes (%li pages per %likB)\n", ++ pages * PAGE_SIZE, pages, PAGE_SIZE / 1024); + devno = 0; + list_for_each_entry(mem, &mem_list_head, list) { + devno++; +- len += snprintf(page + len, count - len, +- "buffer %d : ID %08x : type %s\n", +- devno, mem->id, types[mem->buffer.dev.type]); +- len += snprintf(page + len, count - len, +- " addr = 0x%lx, size = %d bytes\n", +- (unsigned long)mem->buffer.addr, (int)mem->buffer.bytes); ++ seq_printf(seq, "buffer %d : ID %08x : type %s\n", ++ devno, mem->id, types[mem->buffer.dev.type]); ++ seq_printf(seq, " addr = 0x%lx, size = %d bytes\n", ++ (unsigned long)mem->buffer.addr, ++ (int)mem->buffer.bytes); + } + mutex_unlock(&list_mutex); +- return len; ++ return 0; ++} ++ ++static int snd_mem_proc_open(struct inode *inode, struct file *file) ++{ ++ return single_open(file, snd_mem_proc_read, NULL); + } + + /* FIXME: for pci only - other bus? */ + #ifdef CONFIG_PCI ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 4, 0) + #define gettoken(bufp) strsep(bufp, " \t\n") + +-static int snd_mem_proc_write(struct file *file, const char __user *buffer, +- unsigned long count, void *data) ++static ssize_t snd_mem_proc_write(struct file *file, const char __user * buffer, ++ size_t count, loff_t * ppos) + { + char buf[128]; + char *token, *p; + +- if (count > ARRAY_SIZE(buf) - 1) +- count = ARRAY_SIZE(buf) - 1; ++ if (count > sizeof(buf) - 1) ++ return -EINVAL; + if (copy_from_user(buf, buffer, count)) + return -EFAULT; +- buf[ARRAY_SIZE(buf) - 1] = '\0'; ++ buf[count] = '\0'; + + p = buf; + token = gettoken(&p); + if (! token || *token == '#') +- return (int)count; ++ return count; + if (strcmp(token, "add") == 0) { + char *endp; + int vendor, device, size, buffers; +@@ -548,7 +645,7 @@ static int snd_mem_proc_write(struct fil + (buffers = simple_strtol(token, NULL, 0)) <= 0 || + buffers > 4) { + printk(KERN_ERR "snd-page-alloc: invalid proc write format\n"); +- return (int)count; ++ return count; + } + vendor &= 0xffff; + device &= 0xffff; +@@ -560,7 +657,7 @@ static int snd_mem_proc_write(struct fil + if (pci_set_dma_mask(pci, mask) < 0 || + pci_set_consistent_dma_mask(pci, mask) < 0) { + printk(KERN_ERR "snd-page-alloc: cannot set DMA mask %lx for pci %04x:%04x\n", mask, vendor, device); +- return (int)count; ++ return count; + } + } + for (i = 0; i < buffers; i++) { +@@ -570,7 +667,7 @@ static int snd_mem_proc_write(struct fil + size, &dmab) < 0) { + printk(KERN_ERR "snd-page-alloc: cannot allocate buffer pages (size = %d)\n", size); + pci_dev_put(pci); +- return (int)count; ++ return count; + } + snd_dma_reserve_buf(&dmab, snd_dma_pci_buf_id(pci)); + } +@@ -596,9 +693,22 @@ static int snd_mem_proc_write(struct fil + free_all_reserved_pages(); + else + printk(KERN_ERR "snd-page-alloc: invalid proc cmd\n"); +- return (int)count; ++ return count; + } ++#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(2, 4, 0) */ + #endif /* CONFIG_PCI */ ++ ++static const struct file_operations snd_mem_proc_fops = { ++ .owner = THIS_MODULE, ++ .open = snd_mem_proc_open, ++ .read = seq_read, ++#ifdef CONFIG_PCI ++ .write = snd_mem_proc_write, ++#endif ++ .llseek = seq_lseek, ++ .release = single_release, ++}; ++ + #endif /* CONFIG_PROC_FS */ + + /* +@@ -609,12 +719,8 @@ static int __init snd_mem_init(void) + { + #ifdef CONFIG_PROC_FS + snd_mem_proc = create_proc_entry(SND_MEM_PROC_FILE, 0644, NULL); +- if (snd_mem_proc) { +- snd_mem_proc->read_proc = snd_mem_proc_read; +-#ifdef CONFIG_PCI +- snd_mem_proc->write_proc = snd_mem_proc_write; +-#endif +- } ++ if (snd_mem_proc) ++ snd_mem_proc->proc_fops = &snd_mem_proc_fops; + #endif + return 0; + } +@@ -644,3 +750,5 @@ EXPORT_SYMBOL(snd_dma_reserve_buf); + + EXPORT_SYMBOL(snd_malloc_pages); + EXPORT_SYMBOL(snd_free_pages); ++ ++#include "memalloc.inc1" diff --git a/media-sound/alsa-driver/files/alsa-driver-1.0.14_rc2-tumbler-ppc.patch b/media-sound/alsa-driver/files/alsa-driver-1.0.14_rc2-tumbler-ppc.patch new file mode 100644 index 00000000..7fa8d10e --- /dev/null +++ b/media-sound/alsa-driver/files/alsa-driver-1.0.14_rc2-tumbler-ppc.patch @@ -0,0 +1,41 @@ +Index: alsa-driver-1.0.14rc2/ppc/tumbler.patch +=================================================================== +--- alsa-driver-1.0.14rc2.orig/ppc/tumbler.patch ++++ alsa-driver-1.0.14rc2/ppc/tumbler.patch +@@ -5,7 +5,7 @@ + /* + * PMac Tumbler/Snapper lowlevel functions + * +-@@ -940,7 +941,11 @@ ++@@ -940,8 +941,12 @@ + } + } + +@@ -14,6 +14,7 @@ + +#else + static struct work_struct device_change; + +#endif ++ static struct snd_pmac *device_change_chip; + + static void device_change_handler(void *self) + { +@@ -29,15 +30,16 @@ + } + } + #endif /* PMAC_SUPPORT_AUTOMUTE */ +-@@ -1416,7 +1425,11 @@ ++@@ -1416,8 +1425,12 @@ + chip->resume = tumbler_resume; + #endif + + +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) +-+ INIT_TQUEUE(&device_change, device_change_handler, (void *)chip); +++ INIT_TQUEUE(&device_change, device_change_handler); + +#else +- INIT_WORK(&device_change, device_change_handler, (void *)chip); ++ INIT_WORK(&device_change, device_change_handler); + +#endif ++ device_change_chip = chip; + + #ifdef PMAC_SUPPORT_AUTOMUTE + if ((mix->headphone_irq >=0 || mix->lineout_irq >= 0) diff --git a/media-sound/alsa-driver/files/alsa-driver-1.0.15-linux-2.4.patch b/media-sound/alsa-driver/files/alsa-driver-1.0.15-linux-2.4.patch new file mode 100644 index 00000000..16980fa9 --- /dev/null +++ b/media-sound/alsa-driver/files/alsa-driver-1.0.15-linux-2.4.patch @@ -0,0 +1,11 @@ +--- a/alsa-kernel/core/sound.c ++++ b/alsa-kernel/core/sound.c +@@ -168,7 +168,7 @@ static int snd_open(struct inode *inode, + return err; + } + +-static const struct file_operations snd_fops = ++const struct file_operations snd_fops = + { + .owner = THIS_MODULE, + .open = snd_open |