From owner-freebsd-multimedia@FreeBSD.ORG Tue Oct 31 08:30:20 2006 Return-Path: X-Original-To: freebsd-multimedia@freebsd.org Delivered-To: freebsd-multimedia@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id A710016A403 for ; Tue, 31 Oct 2006 08:30:20 +0000 (UTC) (envelope-from pyunyh@gmail.com) Received: from wx-out-0506.google.com (wx-out-0506.google.com [66.249.82.226]) by mx1.FreeBSD.org (Postfix) with ESMTP id ABE8943D46 for ; Tue, 31 Oct 2006 08:30:19 +0000 (GMT) (envelope-from pyunyh@gmail.com) Received: by wx-out-0506.google.com with SMTP id i27so1507940wxd for ; Tue, 31 Oct 2006 00:30:19 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:date:from:to:cc:subject:message-id:reply-to:references:mime-version:content-type:content-disposition:in-reply-to:user-agent; b=FW4E/eXEVRRAoSc9wP3xBAz2PjtWw/L+L2DvW9nlf6n+dIlBXngxkpfiOtXJM9PzU4lmIBEz3MQw0TmB8F5i49plSrX9m1Qx6NagQGM8HaIv+FxZ2TtGB9rmkM5H8t8K+cd3R8tzXbNX20b/1xYqeG8vuuYwX9WehYseFwMacZg= Received: by 10.70.65.5 with SMTP id n5mr6729096wxa; Tue, 31 Oct 2006 00:30:18 -0800 (PST) Received: from michelle.cdnetworks.co.kr ( [211.53.35.84]) by mx.google.com with ESMTP id 7sm6481885wrh.2006.10.31.00.30.16; Tue, 31 Oct 2006 00:30:17 -0800 (PST) Received: from michelle.cdnetworks.co.kr (localhost.cdnetworks.co.kr [127.0.0.1]) by michelle.cdnetworks.co.kr (8.13.5/8.13.5) with ESMTP id k9V8WKjB057740 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 31 Oct 2006 17:32:20 +0900 (KST) (envelope-from pyunyh@gmail.com) Received: (from yongari@localhost) by michelle.cdnetworks.co.kr (8.13.5/8.13.5/Submit) id k9V8WJK4057739; Tue, 31 Oct 2006 17:32:19 +0900 (KST) (envelope-from pyunyh@gmail.com) Date: Tue, 31 Oct 2006 17:32:19 +0900 From: Pyun YongHyeon To: Konstantin Dimitrov Message-ID: <20061031083219.GE55910@cdnetworks.co.kr> References: <200606072039.13422.shoesoft@gmx.net> <8103ad500607180035t50633780wbf585805464b8696@mail.gmail.com> <787520ee0607180732r6bcb1ae4h1591230d2db366a@mail.gmail.com> <200610111331.39605.lrntct@gmail.com> <8103ad500610111048v756778c6pcac4006746ec3f0a@mail.gmail.com> <20061028082147.GB44390@cdnetworks.co.kr> <8103ad500610291101l291c5e04xfc6874e4abda6f83@mail.gmail.com> <20061031005233.GC55910@cdnetworks.co.kr> <8103ad500610302209y4f76f8c3pdc3370097f587f94@mail.gmail.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="NDin8bjvE/0mNLFQ" Content-Disposition: inline In-Reply-To: <8103ad500610302209y4f76f8c3pdc3370097f587f94@mail.gmail.com> User-Agent: Mutt/1.4.2.1i Cc: freebsd-multimedia@freebsd.org Subject: Re: Status of VIA Envy24 audio controller X-BeenThere: freebsd-multimedia@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: pyunyh@gmail.com List-Id: Multimedia discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 31 Oct 2006 08:30:20 -0000 --NDin8bjvE/0mNLFQ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Tue, Oct 31, 2006 at 08:09:41AM +0200, Konstantin Dimitrov wrote: > On 10/31/06, Pyun YongHyeon wrote: > > > >On Sun, Oct 29, 2006 at 09:01:30PM +0200, Konstantin Dimitrov wrote: > >> sorry for my late answer, i'm too busy, but today i had some free time > >to > >> look at the problems. the two described problems are different and not > >> related. here is the new working code: > >> > >> for Envy24 (fix mutex problems on current and panic on verbose boot) : > >> http://envy24.svobodno.com/driver/envy24/current/envy24.c > >> > >> for Envy24HT(fix mutex problems on current and panic on verbose boot, > >enable > >> vchans): > >> http://envy24.svobodno.com/driver/envy24ht/current/envy24ht.c > >> http://envy24.svobodno.com/driver/envy24ht/current/envy24ht.h > >> > >> vchans support is now enabled in the Envy24HT code and hope it's working > >ok. > >> > > > >Thanks. It now loads ok on CURRENT but I can't hear anything. > >I can't sure but I have to make a cfg_table for > >"ONKYO SE-150PCI PLUS". ATM it seems that it uses generic > >configuration for the hardware. I'll let you if I mananged to > >make it work. > > > you can't hear anything, because DAC on your ONKYO SE-150PCI PLUS is not > initialized. > > Laurent Courty (lrntct at gmail.com) has ONKYO SE-90PCI and I have been > trying to get it running for more than 2 weeks now, but without success and > filling the cfg_table is not so easy at all, because it involves knowing the > hardware specific design of the board, so the process on adding support for > new unsupported card can be summarized in the following steps: > > 0) examine the board to see what ICs they use for DACs, ADCs, DITs, etc. > 1) make EEPROM dump (i wrote small kernel module that do the job: > http://www.nbritton.org/uploads/envy24/envy24_dump_v01.tar) > 2) find the hardware specific design of the board (wiring between Envy24 > chip and other important chips on the board like DACs) > 3) fill the cfg_table and if needed write the necessary card specific code > (codec init code, etc.) > > on the table here: http://envy24.svobodno.com , you can see all the above > info for supported boards till now - ICs, EEPROM dumps, wiring info, etc. > > so do the steps 0) and 1) and mail me that info, then i will try to help you > with 2) and 3). > Thanks a lot. I've checked the hardware but I can't sure what ICs are used for DAC/ADC etc. The information I can get from the vendor's site and checking the hardware indicates the following. 2ch only DAC : WM8716SEDS CODEC : WM8776S 6ch DAC : WM8766G See http://onkyo.jp/wavio/150pci/03_03.htm for their description for the hardware. I've attached EEPROM dump and patch for the dump program. Personally I think it should be included in envy24ht(4) and users can extract that information with sysctl(8) interface. You can add that information with SYSCTL_ADD_PROC. BTW, if we need EEPROM information to initialize the hardware why hardcode cfg_table for each hardware model? > >On 10/28/06, Pyun YongHyeon wrote: > >> > > >> >On Sat, Oct 28, 2006 at 02:43:53AM -0500, Nikolas Britton wrote: > >> >> Hey Konstantin, I think I found a bug in the code. If I boot FreeBSD > >> >> with verbose logging the envy24 driver will panic the system during > >> >> the boot process. fatal trap 12, page fault, and something about > >> >> "envy24(play): setmap; xxxxx", I'd have to build a debug kernel etc. > >> >> if you want the full message and backtrace but this should be easy to > >> >> reproduce. I'm using envy24 sources from -CURRENT that I manually > >> >> MFC'd to FreeBSD 6.2-PRERELEASE. Oh... I'm using an M Audio > >Audiophile > >> >> 2496. > >> >> > >> > > >> >I saw the panic on envy24ht(4) too and sent a mail to Konstantin but > >> >got no reply yet. With WITNESS enabled kernel it shows several LORs > >> >and panicked due to use of recursed mutex(channel lock can't be > >> >acquired recursively). I guess correct fix could be done by moving > >> >buffer resizing code to channel_setblocksize method instead of > >> >channel_setformat method. Unfortunately I haven't have free time > >> >to investiage further due to msk(4) work and still have little time. > >:-( > >> > > >> >-- > >> >Regards, > >> >Pyun YongHyeon > >> > > > > >-- > >Regards, > >Pyun YongHyeon > > -- Regards, Pyun YongHyeon --NDin8bjvE/0mNLFQ Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="envy24_dump.txt" envy24_dump0: port 0xdf00-0xdf1f,0xde00-0xde7f irq 17 at device 7.0 on pci1 envy24_dump0: E2PROM DUMP: | 00 01 02 03 04 05 06 07 08 09 0A 0B 0C OD 0E 0F ----+------------------------------------------------- 00 | 00 01 16 0b 1c 01 42 80 30 c3 ff 00 00 ff 00 00 01 | ff 00 00 00 0c 0d 0d 0d 0c 08 00 00 00 01 02 00 --NDin8bjvE/0mNLFQ Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="envy24_dump.diff" --- envy24_dump.c.orig Tue Oct 31 16:08:59 2006 +++ envy24_dump.c Tue Oct 31 17:01:25 2006 @@ -24,25 +24,23 @@ * SUCH DAMAGE. */ -#include -#include -#include -#include #include +#include +#include #include -#include -#include #include -#include -#include -#include -#include +#include + +#include +#include #include +#include +#include + #include -struct envy24_dump_softc -{ +struct envy24_dump_softc { bus_space_tag_t bst; bus_space_handle_t bsh; device_t dev; @@ -50,6 +48,18 @@ int rid; }; +static struct envy24_product { + uint16_t devid; + const char *envy24_name; +} envy24_products[] = { + { 0x1712, "Envy24" }, + { 0x1720, "Envy24PT" }, + { 0x1721, "Envy24HT-S" }, + { 0x1722, "Envy24GT" }, + { 0x1723, "Tremor" }, + { 0x1724, "Envy24HT" } +}; + static u_int32_t xrd(struct envy24_dump_softc *sc, int reg, int size) { @@ -87,42 +97,50 @@ u_int32_t data; int i; - for (i = 0; i < 1000; i++) { + for (i = 0; i < ENVY24_I2C_TIMEOUT; i++) { data = xrd(sc, ENVY24_CCS13, 1); - if ((data & 0x01) == 0) + if ((data & ENVY24_I2C_BUSY) == 0) break; DELAY(32); /* 31.25kHz */ } - if (i == 1000) { + if (i == ENVY24_I2C_TIMEOUT) { + device_printf(sc->dev, "E2PROM read timeout\n"); return -1; } xwr(sc, ENVY24_CCS11, addr, 1); xwr(sc, ENVY24_CCS10, (dev & 0xfe) | 0x00, 1); - for (i = 0; i < 1000; i++) { + for (i = 0; i < ENVY24_I2C_TIMEOUT; i++) { data = xrd(sc, ENVY24_CCS13, 1); - if ((data & 0x01) == 0) + if ((data & ENVY24_I2C_BUSY) == 0) break; DELAY(32); /* 31.25kHz */ } - if (i == 1000) { + if (i == ENVY24_I2C_TIMEOUT) { + device_printf(sc->dev, "E2PROM read timeout\n"); return -1; } data = xrd(sc, ENVY24_CCS12, 1); - + return (int) data; } static int envy24_dump_probe(device_t dev) { - char *s = NULL; - - if (pci_get_device(dev) == ENVY24_PCI_ID) - s = "ENVY24"; + struct envy24_product *ep; + uint16_t devid; + int i; - if (s) - device_set_desc(dev, s); - return s? 0 : ENXIO; + devid = pci_get_device(dev); + ep = envy24_products; + for (i = 0; i < sizeof(envy24_products)/sizeof(envy24_products[0]); + i++, ep++) { + if (devid == ep->devid) { + device_set_desc(dev, ep->envy24_name); + return (BUS_PROBE_DEFAULT); + } + } + return (ENXIO); } static int @@ -134,11 +152,6 @@ int k; sc = (struct envy24_dump_softc *) device_get_softc(dev); - - /*if ((sc = malloc(sizeof(*sc), M_DEVBUF, M_WAITOK | M_ZERO)) == NULL) { - device_printf(dev, "cannot allocate softc\n"); - return ENXIO; - }*/ sc->dev = dev; @@ -148,63 +161,31 @@ pci_write_config(dev, PCIR_COMMAND, data, 2); sc->rid = PCIR_CCS; - sc->res = bus_alloc_resource(dev, SYS_RES_IOPORT, &sc->rid, 0, ~0, 1, - RF_ACTIVE); + sc->res = bus_alloc_resource_any(dev, SYS_RES_IOPORT, &sc->rid, + RF_ACTIVE); if (sc->res == NULL) - return ENXIO; + return (ENXIO); sc->bst = rman_get_bustag(sc->res); sc->bsh = rman_get_bushandle(sc->res); e2prom = xrd(sc, ENVY24_CCS13, 1); - if ((e2prom & 0x80) == 0) { + if ((e2prom & 0x80) == 0) device_printf(sc->dev, "E2PROM not presented\n"); - } else { - device_printf(sc->dev, "E2PROM DUMP:\n"); - printf(" | 00 01 02 03 04 05 06 07 08 09 0A 0B 0C OD 0E 0F \n"); - printf("----+-------------------------------------------------\n"); - for (k = 0; k < 32; k++) { - e2prom = envy24_dump_rdi2c(sc, 0xa0, k); - //device_printf(sc->dev, "0x%x\n", e2prom); - if (k == 0) printf(" 00 |"); - if (k == 16) printf("\n 01 |"); - switch (e2prom) { - case 0: - printf(" 00"); - break; - case 1: - printf(" 01"); - break; - case 2: - printf(" 02"); - break; - case 3: - printf(" 03"); - break; - case 4: - printf(" 04"); - break; - case 5: - printf(" 05"); - break; - case 6: - printf(" 06"); - break; - case 7: - printf(" 07"); - break; - case 8: - printf(" 08"); - break; - case 9: - printf(" 09"); - break; - default: - printf(" %x", e2prom); - } - + device_printf(sc->dev, "E2PROM DUMP:\n"); + printf(" | 00 01 02 03 04 05 06 07 08 09 0A 0B 0C OD 0E 0F \n"); + printf("----+-------------------------------------------------\n"); + for (k = 0; k < 32; k++) { + e2prom = envy24_dump_rdi2c(sc, 0xa0, k); + if (k == 0) + printf(" 00 |"); + if (k == 16) + printf("\n 01 |"); + printf(" %02x", e2prom); + } + printf("\n"); } - } - return 0; + + return (0); } static int @@ -214,7 +195,8 @@ sc = (struct envy24_dump_softc *) device_get_softc(dev); bus_release_resource(dev, SYS_RES_IOPORT, sc->rid, sc->res); - return 0; + + return (0); } static device_method_t envy24_dump_methods[] = { @@ -223,13 +205,13 @@ DEVMETHOD(device_attach, envy24_dump_attach), DEVMETHOD(device_detach, envy24_dump_detach), - {0,0} + {0, 0} }; static driver_t envy24_dump_driver = { -"envy24_dump", -envy24_dump_methods, -sizeof(struct envy24_dump_softc), + "envy24_dump", + envy24_dump_methods, + sizeof(struct envy24_dump_softc), }; static devclass_t envy24_dump_devclass; --- envy24_dump.h.orig Tue Oct 31 16:08:59 2006 +++ envy24_dump.h Tue Oct 31 16:53:28 2006 @@ -45,3 +45,6 @@ #define ENVY24_CCS13 0x13 #define CCS_INDEX 0x03 #define CCS_DATA 0x04 + +#define ENVY24_I2C_TIMEOUT 1000 +#define ENVY24_I2C_BUSY 0x01 --NDin8bjvE/0mNLFQ--