es137x.c (70321) | es137x.c (71505) |
---|---|
1/* 2 * Support the ENSONIQ AudioPCI board and Creative Labs SoundBlaster PCI 3 * boards based on the ES1370, ES1371 and ES1373 chips. 4 * 5 * Copyright (c) 1999 Russell Cattelan <cattelan@thebarn.com> 6 * Copyright (c) 1999 Cameron Grant <gandalf@vilnya.demon.co.uk> 7 * Copyright (c) 1998 by Joachim Kuebart. All rights reserved. 8 * --- 24 unchanged lines hidden (view full) --- 33 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 34 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 35 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 36 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 37 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 38 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 39 * OF THE POSSIBILITY OF SUCH DAMAGE. 40 * | 1/* 2 * Support the ENSONIQ AudioPCI board and Creative Labs SoundBlaster PCI 3 * boards based on the ES1370, ES1371 and ES1373 chips. 4 * 5 * Copyright (c) 1999 Russell Cattelan <cattelan@thebarn.com> 6 * Copyright (c) 1999 Cameron Grant <gandalf@vilnya.demon.co.uk> 7 * Copyright (c) 1998 by Joachim Kuebart. All rights reserved. 8 * --- 24 unchanged lines hidden (view full) --- 33 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 34 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 35 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 36 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 37 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 38 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 39 * OF THE POSSIBILITY OF SUCH DAMAGE. 40 * |
41 * $FreeBSD: head/sys/dev/sound/pci/es137x.c 70321 2000-12-23 22:24:43Z cg $ | 41 * $FreeBSD: head/sys/dev/sound/pci/es137x.c 71505 2001-01-24 01:27:31Z cg $ |
42 */ 43 44/* 45 * Part of this code was heavily inspired by the linux driver from 46 * Thomas Sailer (sailer@ife.ee.ethz.ch) 47 * Just about everything has been touched and reworked in some way but 48 * the all the underlying sequences/timing/register values are from 49 * Thomas' code. --- 56 unchanged lines hidden (view full) --- 106 107/* prototypes */ 108static void es_intr(void *); 109 110static u_int es1371_wait_src_ready(struct es_info *); 111static void es1371_src_write(struct es_info *, u_short, unsigned short); 112static u_int es1371_adc_rate(struct es_info *, u_int, int); 113static u_int es1371_dac_rate(struct es_info *, u_int, int); | 42 */ 43 44/* 45 * Part of this code was heavily inspired by the linux driver from 46 * Thomas Sailer (sailer@ife.ee.ethz.ch) 47 * Just about everything has been touched and reworked in some way but 48 * the all the underlying sequences/timing/register values are from 49 * Thomas' code. --- 56 unchanged lines hidden (view full) --- 106 107/* prototypes */ 108static void es_intr(void *); 109 110static u_int es1371_wait_src_ready(struct es_info *); 111static void es1371_src_write(struct es_info *, u_short, unsigned short); 112static u_int es1371_adc_rate(struct es_info *, u_int, int); 113static u_int es1371_dac_rate(struct es_info *, u_int, int); |
114static int es1371_init(struct es_info *es, int); | 114static int es1371_init(struct es_info *, device_t); |
115static int es1370_init(struct es_info *); 116static int es1370_wrcodec(struct es_info *, u_char, u_char); 117 118static u_int32_t es_playfmt[] = { 119 AFMT_U8, 120 AFMT_STEREO | AFMT_U8, 121 AFMT_S16_LE, 122 AFMT_STEREO | AFMT_S16_LE, --- 346 unchanged lines hidden (view full) --- 469 es1370_wrcodec(es, CODEC_ADSEL, 0);/* Recording source is mixer */ 470 es1370_wrcodec(es, CODEC_MGAIN, 0);/* MIC amp is 0db */ 471 472 return 0; 473} 474 475/* ES1371 specific */ 476int | 115static int es1370_init(struct es_info *); 116static int es1370_wrcodec(struct es_info *, u_char, u_char); 117 118static u_int32_t es_playfmt[] = { 119 AFMT_U8, 120 AFMT_STEREO | AFMT_U8, 121 AFMT_S16_LE, 122 AFMT_STEREO | AFMT_S16_LE, --- 346 unchanged lines hidden (view full) --- 469 es1370_wrcodec(es, CODEC_ADSEL, 0);/* Recording source is mixer */ 470 es1370_wrcodec(es, CODEC_MGAIN, 0);/* MIC amp is 0db */ 471 472 return 0; 473} 474 475/* ES1371 specific */ 476int |
477es1371_init(struct es_info *es, int rev) | 477es1371_init(struct es_info *es, device_t dev) |
478{ 479 int idx; | 478{ 479 int idx; |
480 int devid = pci_get_devid(dev); 481 int revid = pci_get_revid(dev); |
|
480 481 if (debug > 0) printf("es_init\n"); 482 483 es->num = 0; 484 es->ctrl = 0; 485 es->sctrl = 0; 486 /* initialize the chips */ | 482 483 if (debug > 0) printf("es_init\n"); 484 485 es->num = 0; 486 es->ctrl = 0; 487 es->sctrl = 0; 488 /* initialize the chips */ |
487 if (rev == 7 || rev >= 9 || rev == 2) { | 489 if (revid == 7 || revid >= 9 || (devid == ES1371_PCI_ID3 && revid == 2)) { |
488#define ES1371_BINTSUMM_OFF 0x07 489 bus_space_write_4(es->st, es->sh, ES1371_BINTSUMM_OFF, 0x20); 490 if (debug > 0) printf("es_init rev == 7 || rev >= 9\n"); 491 } else { /* pre ac97 2.1 card */ 492 bus_space_write_4(es->st, es->sh, ES1370_REG_CONTROL, es->ctrl); 493 if (debug > 0) printf("es_init pre ac97 2.1\n"); 494 } 495 bus_space_write_4(es->st, es->sh, ES1370_REG_SERIAL_CONTROL, es->sctrl); --- 287 unchanged lines hidden (view full) --- 783 if (mapped == 0) { 784 device_printf(dev, "unable to map register space\n"); 785 goto bad; 786 } 787 788 if (pci_get_devid(dev) == ES1371_PCI_ID || 789 pci_get_devid(dev) == ES1371_PCI_ID2 || 790 pci_get_devid(dev) == ES1371_PCI_ID3) { | 490#define ES1371_BINTSUMM_OFF 0x07 491 bus_space_write_4(es->st, es->sh, ES1371_BINTSUMM_OFF, 0x20); 492 if (debug > 0) printf("es_init rev == 7 || rev >= 9\n"); 493 } else { /* pre ac97 2.1 card */ 494 bus_space_write_4(es->st, es->sh, ES1370_REG_CONTROL, es->ctrl); 495 if (debug > 0) printf("es_init pre ac97 2.1\n"); 496 } 497 bus_space_write_4(es->st, es->sh, ES1370_REG_SERIAL_CONTROL, es->sctrl); --- 287 unchanged lines hidden (view full) --- 785 if (mapped == 0) { 786 device_printf(dev, "unable to map register space\n"); 787 goto bad; 788 } 789 790 if (pci_get_devid(dev) == ES1371_PCI_ID || 791 pci_get_devid(dev) == ES1371_PCI_ID2 || 792 pci_get_devid(dev) == ES1371_PCI_ID3) { |
791 if(-1 == es1371_init(es, pci_get_revid(dev))) { | 793 if(-1 == es1371_init(es, dev)) { |
792 device_printf(dev, "unable to initialize the card\n"); 793 goto bad; 794 } 795 codec = AC97_CREATE(dev, es, es1371_ac97); 796 if (codec == NULL) goto bad; 797 /* our init routine does everything for us */ 798 /* set to NULL; flag mixer_init not to run the ac97_init */ 799 /* ac97_mixer.init = NULL; */ --- 91 unchanged lines hidden --- | 794 device_printf(dev, "unable to initialize the card\n"); 795 goto bad; 796 } 797 codec = AC97_CREATE(dev, es, es1371_ac97); 798 if (codec == NULL) goto bad; 799 /* our init routine does everything for us */ 800 /* set to NULL; flag mixer_init not to run the ac97_init */ 801 /* ac97_mixer.init = NULL; */ --- 91 unchanged lines hidden --- |