fix various AD1848/PSS misfeatures; from Jason Baker in PR kern/2045.
also did some misc cleanup of my own.
This commit is contained in:
parent
3b5054739d
commit
8147d1718f
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: ad1848reg.h,v 1.1 1995/07/07 02:11:45 brezak Exp $ */
|
||||
/* $NetBSD: ad1848reg.h,v 1.2 1997/03/13 08:34:49 mikel Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994 John Brezak
|
||||
|
@ -87,9 +87,7 @@
|
|||
/* AD1848 Sound Port bit defines */
|
||||
#define SP_IN_INIT 0x80
|
||||
#define MODE_CHANGE_ENABLE 0x40
|
||||
#define MODE_CHANGE_MASK 0xbf
|
||||
#define TRANSFER_DISABLE 0x20
|
||||
#define TRANSFER_DISABLE_MASK 0xdf
|
||||
#define ADDRESS_MASK 0xe0
|
||||
|
||||
/* Status bits */
|
||||
|
@ -99,65 +97,52 @@
|
|||
/* pbright is not left */
|
||||
#define PLAYBACK_UPPER 0x08
|
||||
/* bplower is not upper */
|
||||
|
||||
#define SAMPLE_ERROR 0x10
|
||||
#define CAPTURE_READY 0x20
|
||||
#define CAPTURE_LEFT 0x40
|
||||
/* cpright is not left */
|
||||
#define CAPTURE_UPPER 0x08
|
||||
#define CAPTURE_UPPER 0x80
|
||||
/* cplower is not upper */
|
||||
|
||||
/* Input & Output regs bits */
|
||||
#define LINE_INPUT 0x00
|
||||
#define AUX_INPUT 0x40
|
||||
#define MIC_INPUT 0x80
|
||||
#define MIXED_DAC_INPUT 0xC0
|
||||
#define MIXED_DAC_INPUT 0xc0
|
||||
#define INPUT_GAIN_MASK 0xf0
|
||||
#define INPUT_MIC_GAIN_ENABLE 0x20
|
||||
#define INPUT_MIC_GAIN_MASK 0xdf
|
||||
#define INPUT_SOURCE_MASK 0x3f
|
||||
#define AUX_INPUT_ATTEN_BITS 0x1f
|
||||
#define AUX_INPUT_ATTEN_MASK 0xe0
|
||||
#define AUX_INPUT_MUTE 0x80
|
||||
#define AUX_INPUT_MUTE_MASK 0x7f
|
||||
#define OUTPUT_MUTE 0x80
|
||||
#define OUTPUT_MUTE_MASK 0x7f
|
||||
#define OUTPUT_ATTEN_BITS 0x3f
|
||||
#define OUTPUT_ATTEN_MASK 0xc0
|
||||
|
||||
/* Clock and Data format reg bits (some also Capture Data format) */
|
||||
#define CLOCK_SELECT_MASK 0xfe
|
||||
#define CLOCK_XTAL2 0x01
|
||||
#define CLOCK_XTAL1 0x00
|
||||
#define CLOCK_FREQ_MASK 0xf1
|
||||
#define STEREO_MONO_MASK 0xef
|
||||
#define FMT_STEREO 0x10
|
||||
#define FMT_MONO 0x00
|
||||
#define FMT_STEREO 0x10
|
||||
#define FORMAT_MASK 0x1f
|
||||
#define FMT_PCM8 0x00 /* 8-bit unsigned */
|
||||
#define FMT_ULAW 0x20 /* 8-bit mu-law */
|
||||
#define FMT_TWOS_COMP 0x40 /* 16-bit signed */
|
||||
#define FMT_ALAW 0x60 /* 8-bit alaw */
|
||||
#define FMT_TWOS_COMP_BE 0xC0 /* 16-bit signed, big endian */
|
||||
#define FMT_TWOS_COMP_BE 0xc0 /* 16-bit signed, big endian */
|
||||
|
||||
/* Interface Configuration reg bits */
|
||||
#define PLAYBACK_ENABLE 0x01
|
||||
#define PLAYBACK_ENABLE_MASK 0xfe
|
||||
#define CAPTURE_ENABLE 0x02
|
||||
#define CAPTURE_ENABLE_MASK 0xfd
|
||||
#define SINGLE_DMA 0x04
|
||||
#define SINGLE_DMA_MASK 0xfb
|
||||
#define DUAL_DMA 0x00
|
||||
#define SINGLE_DMA 0x04
|
||||
#define AUTO_CAL_ENABLE 0x08
|
||||
#define AUTO_CAL_DISABLE_MASK 0xf7
|
||||
#define PLAYBACK_PIO_ENABLE 0x40
|
||||
#define PLAYBACK_DMA_MASK 0xbf
|
||||
#define CAPTURE_PIO_ENABLE 0x80
|
||||
#define CAPTURE_DMA_MASK 0x7f
|
||||
|
||||
/* Pin control bits */
|
||||
#define INTERRUPT_ENABLE 0x02
|
||||
#define INTERRUPT_MASK 0xfd
|
||||
#define XCTL0_ENABLE 0x40
|
||||
#define XCTL1_ENABLE 0x80
|
||||
|
||||
|
@ -174,7 +159,6 @@
|
|||
#define MODE2 0x40
|
||||
|
||||
/* Digital Mix Control reg bits */
|
||||
#define DIGITAL_MIX1_MUTE_MASK 0xfe
|
||||
#define DIGITAL_MIX1_ENABLE 0x01
|
||||
#define MIX_ATTEN_MASK 0xfc
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: ad1848.c,v 1.15 1997/03/13 02:19:51 mycroft Exp $ */
|
||||
/* $NetBSD: ad1848.c,v 1.16 1997/03/13 08:34:50 mikel Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994 John Brezak
|
||||
|
@ -123,7 +123,7 @@ static int ad1848_init_values[] = {
|
|||
SINGLE_DMA|AUTO_CAL_ENABLE,
|
||||
INTERRUPT_ENABLE, /* Pin control */
|
||||
0x00, /* Test and Init */
|
||||
0xca, /* Misc control */
|
||||
MODE2, /* Misc control */
|
||||
ATTEN_0<<2, /* Digital Mix Control */
|
||||
0, /* Upper base Count */
|
||||
0, /* Lower base Count */
|
||||
|
@ -488,12 +488,8 @@ ad1848_attach(sc)
|
|||
ad_write(sc, i, ad1848_init_values[i]);
|
||||
/* ...and additional CS4231 stuff too */
|
||||
if (sc->mode == 2) {
|
||||
#if 0
|
||||
ad_write(sc, SP_INTERFACE_CONFIG, 0); /* disable SINGLE_DMA feature */
|
||||
#else
|
||||
/* XXX SINGLE_DMA is cleared in ad1848_reset(), due to #if 0 */
|
||||
#endif
|
||||
for (i = 0x10; i <= 0x1F; i++)
|
||||
ad_write(sc, SP_INTERFACE_CONFIG, 0); /* disable SINGLE_DMA */
|
||||
for (i = 0x10; i <= 0x1f; i++)
|
||||
if (ad1848_init_values[i] != 0)
|
||||
ad_write(sc, i, ad1848_init_values[i]);
|
||||
}
|
||||
|
@ -1274,20 +1270,15 @@ void
|
|||
ad1848_reset(sc)
|
||||
register struct ad1848_softc *sc;
|
||||
{
|
||||
#if 0
|
||||
u_char r;
|
||||
#endif
|
||||
|
||||
DPRINTF(("ad1848_reset\n"));
|
||||
|
||||
/* Clear the PEN and CEN bits */
|
||||
#if 0
|
||||
r = ad_read(sc, SP_INTERFACE_CONFIG);
|
||||
r &= ~(CAPTURE_ENABLE|PLAYBACK_ENABLE);
|
||||
ad_write(sc, SP_INTERFACE_CONFIG, r);
|
||||
#else
|
||||
ad_write(sc, SP_INTERFACE_CONFIG, 0);
|
||||
#endif
|
||||
|
||||
if (sc->mode == 2) {
|
||||
outb(sc->sc_iobase+AD1848_IADDR, CS_IRQ_STATUS);
|
||||
outb(sc->sc_iobase+AD1848_IDATA, 0);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: pss.c,v 1.18 1997/03/13 02:20:05 mycroft Exp $ */
|
||||
/* $NetBSD: pss.c,v 1.19 1997/03/13 08:34:51 mikel Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994 John Brezak
|
||||
|
@ -156,16 +156,20 @@ void pssattach __P((struct device *, struct device *, void *));
|
|||
int spprobe __P((struct device *, void *, void *));
|
||||
void spattach __P((struct device *, struct device *, void *));
|
||||
|
||||
#ifdef notyet
|
||||
int mpuprobe __P((struct device *, void *, void *));
|
||||
void mpuattach __P((struct device *, struct device *, void *));
|
||||
|
||||
int pcdprobe __P((struct device *, void *, void *));
|
||||
void pcdattach __P((struct device *, struct device *, void *));
|
||||
#endif
|
||||
|
||||
int spopen __P((dev_t, int));
|
||||
|
||||
int pssintr __P((void *));
|
||||
#ifdef notyet
|
||||
int mpuintr __P((void *));
|
||||
#endif
|
||||
|
||||
int pss_speaker_ctl __P((void *, int));
|
||||
|
||||
|
@ -247,18 +251,15 @@ struct audio_hw_if pss_audio_if = {
|
|||
|
||||
|
||||
/* Interrupt translation for WSS config */
|
||||
static u_char wss_interrupt_bits[12] = {
|
||||
static u_char wss_interrupt_bits[16] = {
|
||||
0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0x08,
|
||||
0xff, 0x10, 0x18, 0x20
|
||||
0xff, 0x10, 0x18, 0x20,
|
||||
0xff, 0xff, 0xff, 0xff
|
||||
};
|
||||
/* ditto for WSS DMA channel */
|
||||
static u_char wss_dma_bits[4] = {1, 2, 0, 3};
|
||||
|
||||
#ifndef NEWCONFIG
|
||||
#define at_dma(flags, ptr, cc, chan) isa_dmastart(flags, ptr, cc, chan)
|
||||
#endif
|
||||
|
||||
struct cfattach pss_ca = {
|
||||
sizeof(struct pss_softc), pssprobe, pssattach
|
||||
};
|
||||
|
@ -275,6 +276,7 @@ struct cfdriver sp_cd = {
|
|||
NULL, "sp", DV_DULL
|
||||
};
|
||||
|
||||
#ifdef notyet
|
||||
struct cfattach mpu_ca = {
|
||||
sizeof(struct mpu_softc), mpuprobe, mpuattach
|
||||
};
|
||||
|
@ -290,6 +292,7 @@ struct cfattach pcd_ca = {
|
|||
struct cfdriver pcd_cd = {
|
||||
NULL, "pcd", DV_DULL
|
||||
};
|
||||
#endif
|
||||
|
||||
struct audio_device pss_device = {
|
||||
"pss,ad1848",
|
||||
|
@ -453,8 +456,8 @@ pss_setdma(dmaNum, configAddress)
|
|||
|
||||
/*
|
||||
* This function tests an interrupt number to see if
|
||||
* it is availible. It takes the interrupt button
|
||||
* as it's argument and returns TRUE if the interrupt
|
||||
* it is available. It takes the interrupt button
|
||||
* as its argument and returns TRUE if the interrupt
|
||||
* is ok.
|
||||
*/
|
||||
static int
|
||||
|
@ -938,6 +941,7 @@ spprobe(parent, match, aux)
|
|||
return 1;
|
||||
}
|
||||
|
||||
#ifdef notyet
|
||||
int
|
||||
mpuprobe(parent, match, aux)
|
||||
struct device *parent;
|
||||
|
@ -1033,6 +1037,7 @@ pcdprobe(parent, match, aux)
|
|||
|
||||
return 1;
|
||||
}
|
||||
#endif /* notyet */
|
||||
|
||||
/*
|
||||
* Attach hardware to driver, attach hardware driver to audio
|
||||
|
@ -1107,6 +1112,7 @@ spattach(parent, self, aux)
|
|||
printf("\n");
|
||||
}
|
||||
|
||||
#ifdef notyet
|
||||
void
|
||||
mpuattach(parent, self, aux)
|
||||
struct device *parent, *self;
|
||||
|
@ -1157,6 +1163,7 @@ pcdattach(parent, self, aux)
|
|||
sc->sc_iobase, sc->sc_iobase+2,
|
||||
cf->cf_irq);
|
||||
}
|
||||
#endif /* notyet */
|
||||
|
||||
static int
|
||||
pss_to_vol(cp, vol)
|
||||
|
@ -1376,6 +1383,7 @@ pssintr(arg)
|
|||
return 0;
|
||||
}
|
||||
|
||||
#ifdef notyet
|
||||
int
|
||||
mpuintr(arg)
|
||||
void *arg;
|
||||
|
@ -1390,6 +1398,7 @@ mpuintr(arg)
|
|||
/* XXX Need to clear intr */
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
int
|
||||
pss_getdev(addr, retp)
|
||||
|
|
Loading…
Reference in New Issue