Re: high-end audio drivers [was: OSS audio drivers]

2007-10-24 Thread Alexandre Ratchov
On Wed, Oct 24, 2007 at 12:55:39AM +0200, Jan Stary wrote:
   What is the relation of OpenBSD's audio drivers to the OSS project?
   What, if anything, does opensourcing (GPL, I know) their code mean for
   our audio drivers? In particular, does that mean (future) support for
   the high-end soundcards such as M-Audio Delta?
  
  There's work in progress on adding support for Delta cards (1010,
  1010LT, 66, 44), and required features to make them usable (32bit
  encodings, 12 channel capture, higher sample rate, etc...)
 
 Where can I get in touch with this work and possibly test it?
 Is anything commited - available in curent?
 

it's not in cvs yet. Below's a diff you can test. It probably only
works on delta-1010 and delta-1010LT cards and it's enabled on i386
only. The diff adds support for 32bit samples and 10 channels.
Neither capture nor mixer are implemented yet. Feel free to contact
me privately if you have questions on that.

Anyway if you have any delta card, i'm interested in seeing your
card's eeprom contents (in dmesg), the kernel should be compiled on
i386 with these options:

option  ENVY_DEBUG

envy* at pci?
audio* at envy?

Also, let me know if you notice regression with other audio
drivers.

cheers,

-- Alexandre

Index: arch/i386/conf/GENERIC
===
RCS file: /cvs/src/sys/arch/i386/conf/GENERIC,v
retrieving revision 1.583
diff -u -p -r1.583 GENERIC
--- arch/i386/conf/GENERIC  14 Oct 2007 17:39:46 -  1.583
+++ arch/i386/conf/GENERIC  24 Oct 2007 05:54:38 -
@@ -628,6 +628,7 @@ maestro* at pci?# ESS Maestro PCI
 esa*   at pci? # ESS Maestro3 PCI
 yds*   at pci? flags 0x# Yamaha YMF Audio
 emu*   at pci? # SB Live!
+#envy* at pci? # VIA Envy24 (aka ICE1712)
 sb0at isa? port 0x220 irq 5 drq 1  # SoundBlaster
 sb*at isapnp?
 ess*   at isapnp?  # ESS Tech ES188[78], ES888
Index: dev/pci/envy.c
===
RCS file: dev/pci/envy.c
diff -N dev/pci/envy.c
--- /dev/null   1 Jan 1970 00:00:00 -
+++ dev/pci/envy.c  24 Oct 2007 05:54:38 -
@@ -0,0 +1,699 @@
+/*
+ * Copyright (c) 2007 Alexandre Ratchov [EMAIL PROTECTED]
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED AS IS AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include sys/param.h
+#include sys/systm.h
+#include sys/device.h
+#include sys/ioctl.h
+#include sys/audioio.h
+#include sys/malloc.h
+#include dev/pci/pcivar.h
+#include dev/pci/pcidevs.h
+#include dev/pci/envyvar.h
+#include dev/pci/envyreg.h
+#include dev/audio_if.h
+#include machine/bus.h
+
+#ifdef ENVY_DEBUG
+#define DPRINTF(...) do { if (envydebug) printf(__VA_ARGS__); } while(0)
+#define DPRINTFN(n, ...) do { if (envydebug  (n)) printf(__VA_ARGS__); } 
while(0)
+int envydebug = 1;
+#else
+#define DPRINTF(...) do {} while(0)
+#define DPRINTFN(n, ...) do {} while(0)
+#endif
+#define DEVNAME(sc) ((sc)-dev.dv_xname)
+
+int  envymatch(struct device *, void *, void *);
+void envyattach(struct device *, struct device *, void *);
+int  envydetach(struct device *, int);
+
+int  envy_ccs_read(struct envy_softc *sc, int reg);
+void envy_ccs_write(struct envy_softc *sc, int reg, int val);
+int  envy_cci_read(struct envy_softc *sc, int index);
+void envy_cci_write(struct envy_softc *sc, int index, int data);
+void envy_i2c_wait(struct envy_softc *sc);
+int  envy_i2c_read(struct envy_softc *sc, int dev, int addr);
+void envy_i2c_write(struct envy_softc *sc, int dev, int addr, int data);
+int  envy_gpio_read(struct envy_softc *sc);
+void envy_gpio_write(struct envy_softc *sc, int data);
+void envy_eeprom_read(struct envy_softc *sc, unsigned char *);
+void envy_reset(struct envy_softc *sc);
+void envy_ak_write(struct envy_softc *sc, int dev, int addr, int data);
+int  envy_intr(void *);
+
+int envy_open(void *, int);
+void envy_close(void *);
+void *envy_allocm(void *, int, size_t, int, int);
+void envy_freem(void *, void *, int);
+int envy_query_encoding(void *, struct audio_encoding *);
+int envy_set_params(void *, int, int, struct audio_params *, 
+struct audio_params *);
+int envy_round_blocksize(void *, int);
+size_t envy_round_buffersize(void *, 

high-end audio drivers [was: OSS audio drivers]

2007-10-23 Thread Jan Stary
  What is the relation of OpenBSD's audio drivers to the OSS project?
  What, if anything, does opensourcing (GPL, I know) their code mean for
  our audio drivers? In particular, does that mean (future) support for
  the high-end soundcards such as M-Audio Delta?
 
 There's work in progress on adding support for Delta cards (1010,
 1010LT, 66, 44), and required features to make them usable (32bit
 encodings, 12 channel capture, higher sample rate, etc...)

Where can I get in touch with this work and possibly test it?
Is anything commited - available in curent?

Thanks

Jan