#define AD1848_CALIB_IN_PROGRESS 0x20 /* auto calibrate in progress */
#define AD1848_DMA_REQUEST 0x10 /* DMA request in progress */
-/* defines for codec.mode */
-
-#define AD1848_MODE_NONE 0x0000
-#define AD1848_MODE_PLAY 0x0001
-#define AD1848_MODE_CAPTURE 0x0002
-#define AD1848_MODE_TIMER 0x0004
-#define AD1848_MODE_OPEN (AD1848_MODE_PLAY|AD1848_MODE_CAPTURE|AD1848_MODE_TIMER)
-#define AD1848_MODE_RUNNING 0x0010
-
-/* defines for codec.hardware */
-
-#define AD1848_HW_DETECT 0x0000 /* let AD1848 driver detect chip */
-#define AD1848_HW_AD1847 0x0001 /* AD1847 chip */
-#define AD1848_HW_AD1848 0x0002 /* AD1848 chip */
-#define AD1848_HW_CS4248 0x0003 /* CS4248 chip */
-#define AD1848_HW_CMI8330 0x0004 /* CMI8330 chip */
-#define AD1848_HW_THINKPAD 0x0005 /* Thinkpad 360/750/755 */
-
/* IBM Thinkpad specific stuff */
#define AD1848_THINKPAD_CTL_PORT1 0x15e8
#define AD1848_THINKPAD_CTL_PORT2 0x15e9
.type = AD1848_MIX_SINGLE, \
.private_value = AD1848_MIXVAL_SINGLE(reg, shift, mask, invert) }
-#define AD1848_SINGLE_TLV(xname, xindex, reg, shift, mask, invert, xtlv) \
-{ .name = xname, \
- .index = xindex, \
- .type = AD1848_MIX_SINGLE, \
- .private_value = AD1848_MIXVAL_SINGLE(reg, shift, mask, invert), \
- .tlv = xtlv }
-
#define AD1848_DOUBLE(xname, xindex, left_reg, right_reg, shift_left, shift_right, mask, invert) \
{ .name = xname, \
.index = xindex, \
.type = AD1848_MIX_DOUBLE, \
.private_value = AD1848_MIXVAL_DOUBLE(left_reg, right_reg, shift_left, shift_right, mask, invert) }
-#define AD1848_DOUBLE_TLV(xname, xindex, left_reg, right_reg, shift_left, shift_right, mask, invert, xtlv) \
-{ .name = xname, \
- .index = xindex, \
- .type = AD1848_MIX_DOUBLE, \
- .private_value = AD1848_MIXVAL_DOUBLE(left_reg, right_reg, shift_left, shift_right, mask, invert), \
- .tlv = xtlv }
-
int snd_ad1848_add_ctl_elem(struct snd_wss *chip,
const struct ad1848_mix_elem *c);
return 0;
}
snd_ad1848_out(chip, AD1848_IFACE_CTRL, chip->image[AD1848_IFACE_CTRL] |= what);
- chip->mode |= AD1848_MODE_RUNNING;
} else if (cmd == SNDRV_PCM_TRIGGER_STOP) {
if (!(chip->image[AD1848_IFACE_CTRL] & what)) {
spin_unlock(&chip->reg_lock);
return 0;
}
snd_ad1848_out(chip, AD1848_IFACE_CTRL, chip->image[AD1848_IFACE_CTRL] &= ~what);
- chip->mode &= ~AD1848_MODE_RUNNING;
} else {
result = -EINVAL;
}
{
unsigned long flags;
- if (chip->mode & AD1848_MODE_OPEN)
+ if (chip->mode & WSS_MODE_OPEN)
return -EAGAIN;
snd_ad1848_mce_down(chip);
{
struct snd_wss *chip = dev_id;
- if ((chip->mode & AD1848_MODE_PLAY) && chip->playback_substream &&
- (chip->mode & AD1848_MODE_RUNNING))
+ if ((chip->mode & WSS_MODE_PLAY) && chip->playback_substream)
snd_pcm_period_elapsed(chip->playback_substream);
- if ((chip->mode & AD1848_MODE_CAPTURE) && chip->capture_substream &&
- (chip->mode & AD1848_MODE_RUNNING))
+ if ((chip->mode & WSS_MODE_RECORD) && chip->capture_substream)
snd_pcm_period_elapsed(chip->capture_substream);
outb(0, AD1848P(chip, STATUS)); /* clear global interrupt bit */
return IRQ_HANDLED;
}
if (id != 1)
return -ENODEV; /* no valid device found */
- if (chip->hardware == AD1848_HW_DETECT) {
+ if (chip->hardware == WSS_HW_DETECT) {
if (ad1847) {
- chip->hardware = AD1848_HW_AD1847;
+ chip->hardware = WSS_HW_AD1847;
} else {
- chip->hardware = AD1848_HW_AD1848;
+ chip->hardware = WSS_HW_AD1848;
rev = snd_ad1848_in(chip, AD1848_MISC_INFO);
if (rev & 0x80) {
- chip->hardware = AD1848_HW_CS4248;
+ chip->hardware = WSS_HW_CS4248;
} else if ((rev & 0x0f) == 0x0a) {
snd_ad1848_out(chip, AD1848_MISC_INFO, 0x40);
for (i = 0; i < 16; ++i) {
if (snd_ad1848_in(chip, i) != snd_ad1848_in(chip, i + 16)) {
- chip->hardware = AD1848_HW_CMI8330;
+ chip->hardware = WSS_HW_CMI8330;
break;
}
}
struct snd_pcm_runtime *runtime = substream->runtime;
int err;
- if ((err = snd_ad1848_open(chip, AD1848_MODE_PLAY)) < 0)
+ err = snd_ad1848_open(chip, WSS_MODE_PLAY);
+ if (err < 0)
return err;
chip->playback_substream = substream;
runtime->hw = snd_ad1848_playback;
struct snd_pcm_runtime *runtime = substream->runtime;
int err;
- if ((err = snd_ad1848_open(chip, AD1848_MODE_CAPTURE)) < 0)
+ err = snd_ad1848_open(chip, WSS_MODE_RECORD);
+ if (err < 0)
return err;
chip->capture_substream = substream;
runtime->hw = snd_ad1848_capture;
{
struct snd_wss *chip = snd_pcm_substream_chip(substream);
- chip->mode &= ~AD1848_MODE_PLAY;
+ chip->mode &= ~WSS_MODE_PLAY;
chip->playback_substream = NULL;
snd_ad1848_close(chip);
return 0;
{
struct snd_wss *chip = snd_pcm_substream_chip(substream);
- chip->mode &= ~AD1848_MODE_CAPTURE;
+ chip->mode &= ~WSS_MODE_RECORD;
chip->capture_substream = NULL;
snd_ad1848_close(chip);
return 0;
chip->dma1 = dma;
chip->dma2 = dma;
- if (hardware == AD1848_HW_THINKPAD) {
+ if (hardware == WSS_HW_THINKPAD) {
chip->thinkpad_flag = 1;
- chip->hardware = AD1848_HW_DETECT; /* reset */
+ chip->hardware = WSS_HW_DETECT; /* reset */
snd_ad1848_thinkpad_twiddle(chip, 1);
}
static const DECLARE_TLV_DB_SCALE(db_scale_5bit_12db_max, -3450, 150, 0);
static const DECLARE_TLV_DB_SCALE(db_scale_rec_gain, 0, 150, 0);
+#define AD1848_SINGLE_TLV(xname, xindex, reg, shift, mask, invert, xtlv) \
+{ .name = xname, \
+ .index = xindex, \
+ .type = AD1848_MIX_SINGLE, \
+ .private_value = AD1848_MIXVAL_SINGLE(reg, shift, mask, invert), \
+ .tlv = xtlv }
+
+#define AD1848_DOUBLE_TLV(xname, xindex, left_reg, right_reg, shift_left, shift_right, mask, invert, xtlv) \
+{ .name = xname, \
+ .index = xindex, \
+ .type = AD1848_MIX_DOUBLE, \
+ .private_value = AD1848_MIXVAL_DOUBLE(left_reg, right_reg, shift_left, shift_right, mask, invert), \
+ .tlv = xtlv }
+
static struct ad1848_mix_elem snd_ad1848_controls[] = {
AD1848_DOUBLE("PCM Playback Switch", 0, AD1848_LEFT_OUTPUT, AD1848_RIGHT_OUTPUT, 7, 7, 1, 1),
AD1848_DOUBLE_TLV("PCM Playback Volume", 0, AD1848_LEFT_OUTPUT, AD1848_RIGHT_OUTPUT, 0, 0, 63, 1,