summaryrefslogtreecommitdiff
path: root/sound/isa
diff options
context:
space:
mode:
authorKrzysztof Helt <krzysztof.h1@wp.pl>2008-07-31 23:05:44 +0400
committerJaroslav Kysela <perex@perex.cz>2008-08-06 17:39:51 +0400
commitece11c9b6db5b96179df8eb9cdc54c78953a4c0f (patch)
tree21c5ebf03d9750fc1c4a4551f84031e969e422b8 /sound/isa
parent241b3ee70d2d69e88d5c144ce938b1887cd6d3fc (diff)
downloadlinux-ece11c9b6db5b96179df8eb9cdc54c78953a4c0f.tar.xz
ALSA: wss_lib: use wss constants instead of ad1848 ones
Use wss constants for mode. Move ad1848 hardware constants to the wss.h. Move mixer tlv macros into the ad1848_lib.c from the ad1848.h. Drop the MODE_RUNNING spurious IRQ guard on AD1848 as it doesn not seem to be needed. Signed-off-by: Krzysztof Helt <krzysztof.h1@wp.pl> Reviewed-by: Rene Herman <rene.herman@gmail.com> Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Diffstat (limited to 'sound/isa')
-rw-r--r--sound/isa/ad1848/ad1848.c2
-rw-r--r--sound/isa/ad1848/ad1848_lib.c48
-rw-r--r--sound/isa/cmi8330.c4
-rw-r--r--sound/isa/opti9xx/opti92x-ad1848.c2
-rw-r--r--sound/isa/sc6000.c2
-rw-r--r--sound/isa/sgalaxy.c2
6 files changed, 36 insertions, 24 deletions
diff --git a/sound/isa/ad1848/ad1848.c b/sound/isa/ad1848/ad1848.c
index 74db24ae6509..40de24b280d3 100644
--- a/sound/isa/ad1848/ad1848.c
+++ b/sound/isa/ad1848/ad1848.c
@@ -96,7 +96,7 @@ static int __devinit snd_ad1848_probe(struct device *dev, unsigned int n)
return -EINVAL;
error = snd_ad1848_create(card, port[n], irq[n], dma1[n],
- thinkpad[n] ? AD1848_HW_THINKPAD : AD1848_HW_DETECT, &chip);
+ thinkpad[n] ? WSS_HW_THINKPAD : WSS_HW_DETECT, &chip);
if (error < 0)
goto out;
diff --git a/sound/isa/ad1848/ad1848_lib.c b/sound/isa/ad1848/ad1848_lib.c
index e25fadffdb55..5aa8f6dae75b 100644
--- a/sound/isa/ad1848/ad1848_lib.c
+++ b/sound/isa/ad1848/ad1848_lib.c
@@ -283,14 +283,12 @@ static int snd_ad1848_trigger(struct snd_wss *chip, unsigned char what,
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;
}
@@ -378,7 +376,7 @@ static int snd_ad1848_open(struct snd_wss *chip, unsigned int mode)
{
unsigned long flags;
- if (chip->mode & AD1848_MODE_OPEN)
+ if (chip->mode & WSS_MODE_OPEN)
return -EAGAIN;
snd_ad1848_mce_down(chip);
@@ -570,11 +568,9 @@ static irqreturn_t snd_ad1848_interrupt(int irq, void *dev_id)
{
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;
@@ -690,19 +686,19 @@ static int snd_ad1848_probe(struct snd_wss *chip)
}
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;
}
}
@@ -782,7 +778,8 @@ static int snd_ad1848_playback_open(struct snd_pcm_substream *substream)
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;
@@ -798,7 +795,8 @@ static int snd_ad1848_capture_open(struct snd_pcm_substream *substream)
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;
@@ -812,7 +810,7 @@ static int snd_ad1848_playback_close(struct snd_pcm_substream *substream)
{
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;
@@ -822,7 +820,7 @@ static int snd_ad1848_capture_close(struct snd_pcm_substream *substream)
{
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;
@@ -903,9 +901,9 @@ int snd_ad1848_create(struct snd_card *card,
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);
}
@@ -1214,6 +1212,20 @@ static const DECLARE_TLV_DB_SCALE(db_scale_6bit, -9450, 150, 0);
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,
diff --git a/sound/isa/cmi8330.c b/sound/isa/cmi8330.c
index aefd2f4a0572..af6ba129910e 100644
--- a/sound/isa/cmi8330.c
+++ b/sound/isa/cmi8330.c
@@ -465,12 +465,12 @@ static int __devinit snd_cmi8330_probe(struct snd_card *card, int dev)
wssport[dev] + 4,
wssirq[dev],
wssdma[dev],
- AD1848_HW_DETECT,
+ WSS_HW_DETECT,
&acard->wss)) < 0) {
snd_printk(KERN_ERR PFX "(AD1848) device busy??\n");
return err;
}
- if (acard->wss->hardware != AD1848_HW_CMI8330) {
+ if (acard->wss->hardware != WSS_HW_CMI8330) {
snd_printk(KERN_ERR PFX "(AD1848) not found during probe\n");
return -ENODEV;
}
diff --git a/sound/isa/opti9xx/opti92x-ad1848.c b/sound/isa/opti9xx/opti92x-ad1848.c
index ff9baf751b22..1f6d6fcd6e57 100644
--- a/sound/isa/opti9xx/opti92x-ad1848.c
+++ b/sound/isa/opti9xx/opti92x-ad1848.c
@@ -775,7 +775,7 @@ static int __devinit snd_opti9xx_probe(struct snd_card *card)
#else
if ((error = snd_ad1848_create(card, chip->wss_base + 4,
chip->irq, chip->dma1,
- AD1848_HW_DETECT, &codec)) < 0)
+ WSS_HW_DETECT, &codec)) < 0)
return error;
if ((error = snd_ad1848_pcm(codec, 0, &pcm)) < 0)
return error;
diff --git a/sound/isa/sc6000.c b/sound/isa/sc6000.c
index 1771f15d6d3c..0b6cf472ddcb 100644
--- a/sound/isa/sc6000.c
+++ b/sound/isa/sc6000.c
@@ -549,7 +549,7 @@ static int __devinit snd_sc6000_probe(struct device *devptr, unsigned int dev)
goto err_unmap2;
err = snd_ad1848_create(card, mss_port[dev] + 4, xirq, xdma,
- AD1848_HW_DETECT, &chip);
+ WSS_HW_DETECT, &chip);
if (err < 0)
goto err_unmap2;
card->private_data = chip;
diff --git a/sound/isa/sgalaxy.c b/sound/isa/sgalaxy.c
index 879c00c566ba..9a5a7cc0e607 100644
--- a/sound/isa/sgalaxy.c
+++ b/sound/isa/sgalaxy.c
@@ -265,7 +265,7 @@ static int __devinit snd_sgalaxy_probe(struct device *devptr, unsigned int dev)
if ((err = snd_ad1848_create(card, wssport[dev] + 4,
xirq, xdma1,
- AD1848_HW_DETECT, &chip)) < 0)
+ WSS_HW_DETECT, &chip)) < 0)
goto _err;
card->private_data = chip;