ALSA: wss_lib: rename cs4321_foo to wss_foo
Rename functions and structures from the former cs4321_lib to names more corresponding with the new name: wss_lib. 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>
This commit is contained in:
parent
61ef19d7e7
commit
7779f75f07
13 changed files with 1205 additions and 936 deletions
|
@ -1,5 +1,5 @@
|
|||
#ifndef __SOUND_CS4231_H
|
||||
#define __SOUND_CS4231_H
|
||||
#ifndef __SOUND_WSS_H
|
||||
#define __SOUND_WSS_H
|
||||
|
||||
/*
|
||||
* Copyright (c) by Jaroslav Kysela <perex@perex.cz>
|
||||
|
@ -30,42 +30,42 @@
|
|||
|
||||
/* defines for codec.mode */
|
||||
|
||||
#define CS4231_MODE_NONE 0x0000
|
||||
#define CS4231_MODE_PLAY 0x0001
|
||||
#define CS4231_MODE_RECORD 0x0002
|
||||
#define CS4231_MODE_TIMER 0x0004
|
||||
#define CS4231_MODE_OPEN (CS4231_MODE_PLAY|CS4231_MODE_RECORD|CS4231_MODE_TIMER)
|
||||
#define WSS_MODE_NONE 0x0000
|
||||
#define WSS_MODE_PLAY 0x0001
|
||||
#define WSS_MODE_RECORD 0x0002
|
||||
#define WSS_MODE_TIMER 0x0004
|
||||
#define WSS_MODE_OPEN (WSS_MODE_PLAY|WSS_MODE_RECORD|WSS_MODE_TIMER)
|
||||
|
||||
/* defines for codec.hardware */
|
||||
|
||||
#define CS4231_HW_DETECT 0x0000 /* let CS4231 driver detect chip */
|
||||
#define CS4231_HW_DETECT3 0x0001 /* allow mode 3 */
|
||||
#define CS4231_HW_TYPE_MASK 0xff00 /* type mask */
|
||||
#define CS4231_HW_CS4231_MASK 0x0100 /* CS4231 serie */
|
||||
#define CS4231_HW_CS4231 0x0100 /* CS4231 chip */
|
||||
#define CS4231_HW_CS4231A 0x0101 /* CS4231A chip */
|
||||
#define CS4231_HW_AD1845 0x0102 /* AD1845 chip */
|
||||
#define CS4231_HW_CS4232_MASK 0x0200 /* CS4232 serie (has control ports) */
|
||||
#define CS4231_HW_CS4232 0x0200 /* CS4232 */
|
||||
#define CS4231_HW_CS4232A 0x0201 /* CS4232A */
|
||||
#define CS4231_HW_CS4236 0x0202 /* CS4236 */
|
||||
#define CS4231_HW_CS4236B_MASK 0x0400 /* CS4236B serie (has extended control regs) */
|
||||
#define CS4231_HW_CS4235 0x0400 /* CS4235 - Crystal Clear (tm) stereo enhancement */
|
||||
#define CS4231_HW_CS4236B 0x0401 /* CS4236B */
|
||||
#define CS4231_HW_CS4237B 0x0402 /* CS4237B - SRS 3D */
|
||||
#define CS4231_HW_CS4238B 0x0403 /* CS4238B - QSOUND 3D */
|
||||
#define CS4231_HW_CS4239 0x0404 /* CS4239 - Crystal Clear (tm) stereo enhancement */
|
||||
#define WSS_HW_DETECT 0x0000 /* let CS4231 driver detect chip */
|
||||
#define WSS_HW_DETECT3 0x0001 /* allow mode 3 */
|
||||
#define WSS_HW_TYPE_MASK 0xff00 /* type mask */
|
||||
#define WSS_HW_CS4231_MASK 0x0100 /* CS4231 serie */
|
||||
#define WSS_HW_CS4231 0x0100 /* CS4231 chip */
|
||||
#define WSS_HW_CS4231A 0x0101 /* CS4231A chip */
|
||||
#define WSS_HW_AD1845 0x0102 /* AD1845 chip */
|
||||
#define WSS_HW_CS4232_MASK 0x0200 /* CS4232 serie (has control ports) */
|
||||
#define WSS_HW_CS4232 0x0200 /* CS4232 */
|
||||
#define WSS_HW_CS4232A 0x0201 /* CS4232A */
|
||||
#define WSS_HW_CS4236 0x0202 /* CS4236 */
|
||||
#define WSS_HW_CS4236B_MASK 0x0400 /* CS4236B serie (has extended control regs) */
|
||||
#define WSS_HW_CS4235 0x0400 /* CS4235 - Crystal Clear (tm) stereo enhancement */
|
||||
#define WSS_HW_CS4236B 0x0401 /* CS4236B */
|
||||
#define WSS_HW_CS4237B 0x0402 /* CS4237B - SRS 3D */
|
||||
#define WSS_HW_CS4238B 0x0403 /* CS4238B - QSOUND 3D */
|
||||
#define WSS_HW_CS4239 0x0404 /* CS4239 - Crystal Clear (tm) stereo enhancement */
|
||||
/* compatible, but clones */
|
||||
#define CS4231_HW_INTERWAVE 0x1000 /* InterWave chip */
|
||||
#define CS4231_HW_OPL3SA2 0x1101 /* OPL3-SA2 chip, similar to cs4231 */
|
||||
#define CS4231_HW_OPTI93X 0x1102 /* Opti 930/931/933 */
|
||||
#define WSS_HW_INTERWAVE 0x1000 /* InterWave chip */
|
||||
#define WSS_HW_OPL3SA2 0x1101 /* OPL3-SA2 chip, similar to cs4231 */
|
||||
#define WSS_HW_OPTI93X 0x1102 /* Opti 930/931/933 */
|
||||
|
||||
/* defines for codec.hwshare */
|
||||
#define CS4231_HWSHARE_IRQ (1<<0)
|
||||
#define CS4231_HWSHARE_DMA1 (1<<1)
|
||||
#define CS4231_HWSHARE_DMA2 (1<<2)
|
||||
#define WSS_HWSHARE_IRQ (1<<0)
|
||||
#define WSS_HWSHARE_DMA1 (1<<1)
|
||||
#define WSS_HWSHARE_DMA2 (1<<2)
|
||||
|
||||
struct snd_cs4231 {
|
||||
struct snd_wss {
|
||||
unsigned long port; /* base i/o port */
|
||||
struct resource *res_port;
|
||||
unsigned long cport; /* control base i/o port (CS4236) */
|
||||
|
@ -74,8 +74,8 @@ struct snd_cs4231 {
|
|||
int dma1; /* playback DMA */
|
||||
int dma2; /* record DMA */
|
||||
unsigned short version; /* version of CODEC chip */
|
||||
unsigned short mode; /* see to CS4231_MODE_XXXX */
|
||||
unsigned short hardware; /* see to CS4231_HW_XXXX */
|
||||
unsigned short mode; /* see to WSS_MODE_XXXX */
|
||||
unsigned short hardware; /* see to WSS_HW_XXXX */
|
||||
unsigned short hwshare; /* shared resources */
|
||||
unsigned short single_dma:1, /* forced single DMA mode (GUS 16-bit daughter board) or dma1 == dma2 */
|
||||
ebus_flag:1; /* SPARC: EBUS present */
|
||||
|
@ -100,43 +100,50 @@ struct snd_cs4231 {
|
|||
struct mutex open_mutex;
|
||||
|
||||
int (*rate_constraint) (struct snd_pcm_runtime *runtime);
|
||||
void (*set_playback_format) (struct snd_cs4231 *chip, struct snd_pcm_hw_params *hw_params, unsigned char pdfr);
|
||||
void (*set_capture_format) (struct snd_cs4231 *chip, struct snd_pcm_hw_params *hw_params, unsigned char cdfr);
|
||||
void (*trigger) (struct snd_cs4231 *chip, unsigned int what, int start);
|
||||
void (*set_playback_format) (struct snd_wss *chip,
|
||||
struct snd_pcm_hw_params *hw_params,
|
||||
unsigned char pdfr);
|
||||
void (*set_capture_format) (struct snd_wss *chip,
|
||||
struct snd_pcm_hw_params *hw_params,
|
||||
unsigned char cdfr);
|
||||
void (*trigger) (struct snd_wss *chip, unsigned int what, int start);
|
||||
#ifdef CONFIG_PM
|
||||
void (*suspend) (struct snd_cs4231 *chip);
|
||||
void (*resume) (struct snd_cs4231 *chip);
|
||||
void (*suspend) (struct snd_wss *chip);
|
||||
void (*resume) (struct snd_wss *chip);
|
||||
#endif
|
||||
void *dma_private_data;
|
||||
int (*claim_dma) (struct snd_cs4231 *chip, void *dma_private_data, int dma);
|
||||
int (*release_dma) (struct snd_cs4231 *chip, void *dma_private_data, int dma);
|
||||
int (*claim_dma) (struct snd_wss *chip,
|
||||
void *dma_private_data, int dma);
|
||||
int (*release_dma) (struct snd_wss *chip,
|
||||
void *dma_private_data, int dma);
|
||||
};
|
||||
|
||||
/* exported functions */
|
||||
|
||||
void snd_cs4231_out(struct snd_cs4231 *chip, unsigned char reg, unsigned char val);
|
||||
unsigned char snd_cs4231_in(struct snd_cs4231 *chip, unsigned char reg);
|
||||
void snd_cs4236_ext_out(struct snd_cs4231 *chip, unsigned char reg, unsigned char val);
|
||||
unsigned char snd_cs4236_ext_in(struct snd_cs4231 *chip, unsigned char reg);
|
||||
void snd_cs4231_mce_up(struct snd_cs4231 *chip);
|
||||
void snd_cs4231_mce_down(struct snd_cs4231 *chip);
|
||||
void snd_wss_out(struct snd_wss *chip, unsigned char reg, unsigned char val);
|
||||
unsigned char snd_wss_in(struct snd_wss *chip, unsigned char reg);
|
||||
void snd_cs4236_ext_out(struct snd_wss *chip,
|
||||
unsigned char reg, unsigned char val);
|
||||
unsigned char snd_cs4236_ext_in(struct snd_wss *chip, unsigned char reg);
|
||||
void snd_wss_mce_up(struct snd_wss *chip);
|
||||
void snd_wss_mce_down(struct snd_wss *chip);
|
||||
|
||||
void snd_cs4231_overrange(struct snd_cs4231 *chip);
|
||||
void snd_wss_overrange(struct snd_wss *chip);
|
||||
|
||||
irqreturn_t snd_cs4231_interrupt(int irq, void *dev_id);
|
||||
irqreturn_t snd_wss_interrupt(int irq, void *dev_id);
|
||||
|
||||
const char *snd_cs4231_chip_id(struct snd_cs4231 *chip);
|
||||
const char *snd_wss_chip_id(struct snd_wss *chip);
|
||||
|
||||
int snd_cs4231_create(struct snd_card *card,
|
||||
int snd_wss_create(struct snd_card *card,
|
||||
unsigned long port,
|
||||
unsigned long cport,
|
||||
int irq, int dma1, int dma2,
|
||||
unsigned short hardware,
|
||||
unsigned short hwshare,
|
||||
struct snd_cs4231 ** rchip);
|
||||
int snd_cs4231_pcm(struct snd_cs4231 * chip, int device, struct snd_pcm **rpcm);
|
||||
int snd_cs4231_timer(struct snd_cs4231 * chip, int device, struct snd_timer **rtimer);
|
||||
int snd_cs4231_mixer(struct snd_cs4231 * chip);
|
||||
struct snd_wss **rchip);
|
||||
int snd_wss_pcm(struct snd_wss *chip, int device, struct snd_pcm **rpcm);
|
||||
int snd_wss_timer(struct snd_wss *chip, int device, struct snd_timer **rtimer);
|
||||
int snd_wss_mixer(struct snd_wss *chip);
|
||||
|
||||
int snd_cs4236_create(struct snd_card *card,
|
||||
unsigned long port,
|
||||
|
@ -144,32 +151,45 @@ int snd_cs4236_create(struct snd_card *card,
|
|||
int irq, int dma1, int dma2,
|
||||
unsigned short hardware,
|
||||
unsigned short hwshare,
|
||||
struct snd_cs4231 ** rchip);
|
||||
int snd_cs4236_pcm(struct snd_cs4231 * chip, int device, struct snd_pcm **rpcm);
|
||||
int snd_cs4236_mixer(struct snd_cs4231 * chip);
|
||||
struct snd_wss **rchip);
|
||||
int snd_cs4236_pcm(struct snd_wss *chip, int device, struct snd_pcm **rpcm);
|
||||
int snd_cs4236_mixer(struct snd_wss *chip);
|
||||
|
||||
/*
|
||||
* mixer library
|
||||
*/
|
||||
|
||||
#define CS4231_SINGLE(xname, xindex, reg, shift, mask, invert) \
|
||||
{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = xindex, \
|
||||
.info = snd_cs4231_info_single, \
|
||||
.get = snd_cs4231_get_single, .put = snd_cs4231_put_single, \
|
||||
#define WSS_SINGLE(xname, xindex, reg, shift, mask, invert) \
|
||||
{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
|
||||
.name = xname, \
|
||||
.index = xindex, \
|
||||
.info = snd_wss_info_single, \
|
||||
.get = snd_wss_get_single, \
|
||||
.put = snd_wss_put_single, \
|
||||
.private_value = reg | (shift << 8) | (mask << 16) | (invert << 24) }
|
||||
|
||||
int snd_cs4231_info_single(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo);
|
||||
int snd_cs4231_get_single(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol);
|
||||
int snd_cs4231_put_single(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol);
|
||||
int snd_wss_info_single(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_info *uinfo);
|
||||
int snd_wss_get_single(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol);
|
||||
int snd_wss_put_single(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol);
|
||||
|
||||
#define CS4231_DOUBLE(xname, xindex, left_reg, right_reg, shift_left, shift_right, mask, invert) \
|
||||
{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = xindex, \
|
||||
.info = snd_cs4231_info_double, \
|
||||
.get = snd_cs4231_get_double, .put = snd_cs4231_put_double, \
|
||||
.private_value = left_reg | (right_reg << 8) | (shift_left << 16) | (shift_right << 19) | (mask << 24) | (invert << 22) }
|
||||
#define WSS_DOUBLE(xname, xindex, left_reg, right_reg, shift_left, shift_right, mask, invert) \
|
||||
{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
|
||||
.name = xname, \
|
||||
.index = xindex, \
|
||||
.info = snd_wss_info_double, \
|
||||
.get = snd_wss_get_double, \
|
||||
.put = snd_wss_put_double, \
|
||||
.private_value = left_reg | (right_reg << 8) | (shift_left << 16) | \
|
||||
(shift_right << 19) | (mask << 24) | (invert << 22) }
|
||||
|
||||
int snd_cs4231_info_double(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo);
|
||||
int snd_cs4231_get_double(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol);
|
||||
int snd_cs4231_put_double(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol);
|
||||
int snd_wss_info_double(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_info *uinfo);
|
||||
int snd_wss_get_double(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol);
|
||||
int snd_wss_put_double(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol);
|
||||
|
||||
#endif /* __SOUND_CS4231_H */
|
||||
#endif /* __SOUND_WSS_H */
|
||||
|
|
|
@ -76,7 +76,7 @@ struct snd_card_azt2320 {
|
|||
int dev_no;
|
||||
struct pnp_dev *dev;
|
||||
struct pnp_dev *devmpu;
|
||||
struct snd_cs4231 *chip;
|
||||
struct snd_wss *chip;
|
||||
};
|
||||
|
||||
static struct pnp_card_device_id snd_azt2320_pnpids[] = {
|
||||
|
@ -181,7 +181,7 @@ static int __devinit snd_card_azt2320_probe(int dev,
|
|||
int error;
|
||||
struct snd_card *card;
|
||||
struct snd_card_azt2320 *acard;
|
||||
struct snd_cs4231 *chip;
|
||||
struct snd_wss *chip;
|
||||
struct snd_opl3 *opl3;
|
||||
|
||||
if ((card = snd_card_new(index[dev], id[dev], THIS_MODULE,
|
||||
|
@ -200,11 +200,11 @@ static int __devinit snd_card_azt2320_probe(int dev,
|
|||
return error;
|
||||
}
|
||||
|
||||
if ((error = snd_cs4231_create(card, wss_port[dev], -1,
|
||||
irq[dev],
|
||||
dma1[dev],
|
||||
dma2[dev],
|
||||
CS4231_HW_DETECT, 0, &chip)) < 0) {
|
||||
error = snd_wss_create(card, wss_port[dev], -1,
|
||||
irq[dev],
|
||||
dma1[dev], dma2[dev],
|
||||
WSS_HW_DETECT, 0, &chip);
|
||||
if (error < 0) {
|
||||
snd_card_free(card);
|
||||
return error;
|
||||
}
|
||||
|
@ -214,15 +214,18 @@ static int __devinit snd_card_azt2320_probe(int dev,
|
|||
sprintf(card->longname, "%s, WSS at 0x%lx, irq %i, dma %i&%i",
|
||||
card->shortname, chip->port, irq[dev], dma1[dev], dma2[dev]);
|
||||
|
||||
if ((error = snd_cs4231_pcm(chip, 0, NULL)) < 0) {
|
||||
error = snd_wss_pcm(chip, 0, NULL);
|
||||
if (error < 0) {
|
||||
snd_card_free(card);
|
||||
return error;
|
||||
}
|
||||
if ((error = snd_cs4231_mixer(chip)) < 0) {
|
||||
error = snd_wss_mixer(chip);
|
||||
if (error < 0) {
|
||||
snd_card_free(card);
|
||||
return error;
|
||||
}
|
||||
if ((error = snd_cs4231_timer(chip, 0, NULL)) < 0) {
|
||||
error = snd_wss_timer(chip, 0, NULL);
|
||||
if (error < 0) {
|
||||
snd_card_free(card);
|
||||
return error;
|
||||
}
|
||||
|
@ -293,7 +296,7 @@ static int snd_azt2320_pnp_suspend(struct pnp_card_link *pcard, pm_message_t sta
|
|||
{
|
||||
struct snd_card *card = pnp_get_card_drvdata(pcard);
|
||||
struct snd_card_azt2320 *acard = card->private_data;
|
||||
struct snd_cs4231 *chip = acard->chip;
|
||||
struct snd_wss *chip = acard->chip;
|
||||
|
||||
snd_power_change_state(card, SNDRV_CTL_POWER_D3hot);
|
||||
chip->suspend(chip);
|
||||
|
@ -304,7 +307,7 @@ static int snd_azt2320_pnp_resume(struct pnp_card_link *pcard)
|
|||
{
|
||||
struct snd_card *card = pnp_get_card_drvdata(pcard);
|
||||
struct snd_card_azt2320 *acard = card->private_data;
|
||||
struct snd_cs4231 *chip = acard->chip;
|
||||
struct snd_wss *chip = acard->chip;
|
||||
|
||||
chip->resume(chip);
|
||||
snd_power_change_state(card, SNDRV_CTL_POWER_D0);
|
||||
|
|
|
@ -91,7 +91,7 @@ static int __devinit snd_cs4231_match(struct device *dev, unsigned int n)
|
|||
static int __devinit snd_cs4231_probe(struct device *dev, unsigned int n)
|
||||
{
|
||||
struct snd_card *card;
|
||||
struct snd_cs4231 *chip;
|
||||
struct snd_wss *chip;
|
||||
struct snd_pcm *pcm;
|
||||
int error;
|
||||
|
||||
|
@ -99,14 +99,14 @@ static int __devinit snd_cs4231_probe(struct device *dev, unsigned int n)
|
|||
if (!card)
|
||||
return -EINVAL;
|
||||
|
||||
error = snd_cs4231_create(card, port[n], -1, irq[n], dma1[n], dma2[n],
|
||||
CS4231_HW_DETECT, 0, &chip);
|
||||
error = snd_wss_create(card, port[n], -1, irq[n], dma1[n], dma2[n],
|
||||
WSS_HW_DETECT, 0, &chip);
|
||||
if (error < 0)
|
||||
goto out;
|
||||
|
||||
card->private_data = chip;
|
||||
|
||||
error = snd_cs4231_pcm(chip, 0, &pcm);
|
||||
error = snd_wss_pcm(chip, 0, &pcm);
|
||||
if (error < 0)
|
||||
goto out;
|
||||
|
||||
|
@ -118,11 +118,11 @@ static int __devinit snd_cs4231_probe(struct device *dev, unsigned int n)
|
|||
if (dma2[n] >= 0)
|
||||
sprintf(card->longname + strlen(card->longname), "&%d", dma2[n]);
|
||||
|
||||
error = snd_cs4231_mixer(chip);
|
||||
error = snd_wss_mixer(chip);
|
||||
if (error < 0)
|
||||
goto out;
|
||||
|
||||
error = snd_cs4231_timer(chip, 0, NULL);
|
||||
error = snd_wss_timer(chip, 0, NULL);
|
||||
if (error < 0)
|
||||
goto out;
|
||||
|
||||
|
@ -160,7 +160,7 @@ static int __devexit snd_cs4231_remove(struct device *dev, unsigned int n)
|
|||
static int snd_cs4231_suspend(struct device *dev, unsigned int n, pm_message_t state)
|
||||
{
|
||||
struct snd_card *card = dev_get_drvdata(dev);
|
||||
struct snd_cs4231 *chip = card->private_data;
|
||||
struct snd_wss *chip = card->private_data;
|
||||
|
||||
snd_power_change_state(card, SNDRV_CTL_POWER_D3hot);
|
||||
chip->suspend(chip);
|
||||
|
@ -170,7 +170,7 @@ static int snd_cs4231_suspend(struct device *dev, unsigned int n, pm_message_t s
|
|||
static int snd_cs4231_resume(struct device *dev, unsigned int n)
|
||||
{
|
||||
struct snd_card *card = dev_get_drvdata(dev);
|
||||
struct snd_cs4231 *chip = card->private_data;
|
||||
struct snd_wss *chip = card->private_data;
|
||||
|
||||
chip->resume(chip);
|
||||
snd_power_change_state(card, SNDRV_CTL_POWER_D0);
|
||||
|
|
|
@ -134,7 +134,7 @@ static int pnp_registered;
|
|||
#endif /* CONFIG_PNP */
|
||||
|
||||
struct snd_card_cs4236 {
|
||||
struct snd_cs4231 *chip;
|
||||
struct snd_wss *chip;
|
||||
struct resource *res_sb_port;
|
||||
#ifdef CONFIG_PNP
|
||||
struct pnp_dev *wss;
|
||||
|
@ -396,7 +396,7 @@ static int __devinit snd_cs423x_probe(struct snd_card *card, int dev)
|
|||
{
|
||||
struct snd_card_cs4236 *acard;
|
||||
struct snd_pcm *pcm;
|
||||
struct snd_cs4231 *chip;
|
||||
struct snd_wss *chip;
|
||||
struct snd_opl3 *opl3;
|
||||
int err;
|
||||
|
||||
|
@ -408,41 +408,37 @@ static int __devinit snd_cs423x_probe(struct snd_card *card, int dev)
|
|||
}
|
||||
|
||||
#ifdef CS4232
|
||||
if ((err = snd_cs4231_create(card,
|
||||
port[dev],
|
||||
cport[dev],
|
||||
irq[dev],
|
||||
dma1[dev],
|
||||
dma2[dev],
|
||||
CS4231_HW_DETECT,
|
||||
0,
|
||||
&chip)) < 0)
|
||||
err = snd_wss_create(card, port[dev], cport[dev],
|
||||
irq[dev],
|
||||
dma1[dev], dma2[dev],
|
||||
WSS_HW_DETECT, 0, &chip);
|
||||
if (err < 0)
|
||||
return err;
|
||||
acard->chip = chip;
|
||||
|
||||
if ((err = snd_cs4231_pcm(chip, 0, &pcm)) < 0)
|
||||
err = snd_wss_pcm(chip, 0, &pcm);
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
if ((err = snd_cs4231_mixer(chip)) < 0)
|
||||
err = snd_wss_mixer(chip);
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
#else /* CS4236 */
|
||||
if ((err = snd_cs4236_create(card,
|
||||
port[dev],
|
||||
cport[dev],
|
||||
irq[dev],
|
||||
dma1[dev],
|
||||
dma2[dev],
|
||||
CS4231_HW_DETECT,
|
||||
0,
|
||||
&chip)) < 0)
|
||||
err = snd_cs4236_create(card,
|
||||
port[dev], cport[dev],
|
||||
irq[dev], dma1[dev], dma2[dev],
|
||||
WSS_HW_DETECT, 0, &chip);
|
||||
if (err < 0)
|
||||
return err;
|
||||
acard->chip = chip;
|
||||
|
||||
if ((err = snd_cs4236_pcm(chip, 0, &pcm)) < 0)
|
||||
err = snd_cs4236_pcm(chip, 0, &pcm);
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
if ((err = snd_cs4236_mixer(chip)) < 0)
|
||||
err = snd_cs4236_mixer(chip);
|
||||
if (err < 0)
|
||||
return err;
|
||||
#endif
|
||||
strcpy(card->driver, pcm->name);
|
||||
|
@ -455,7 +451,8 @@ static int __devinit snd_cs423x_probe(struct snd_card *card, int dev)
|
|||
if (dma2[dev] >= 0)
|
||||
sprintf(card->longname + strlen(card->longname), "&%d", dma2[dev]);
|
||||
|
||||
if ((err = snd_cs4231_timer(chip, 0, NULL)) < 0)
|
||||
err = snd_wss_timer(chip, 0, NULL);
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
if (fm_port[dev] > 0 && fm_port[dev] != SNDRV_AUTO_PORT) {
|
||||
|
|
|
@ -121,13 +121,14 @@ static unsigned char snd_cs4236_ext_map[18] = {
|
|||
*
|
||||
*/
|
||||
|
||||
static void snd_cs4236_ctrl_out(struct snd_cs4231 *chip, unsigned char reg, unsigned char val)
|
||||
static void snd_cs4236_ctrl_out(struct snd_wss *chip,
|
||||
unsigned char reg, unsigned char val)
|
||||
{
|
||||
outb(reg, chip->cport + 3);
|
||||
outb(chip->cimage[reg] = val, chip->cport + 4);
|
||||
}
|
||||
|
||||
static unsigned char snd_cs4236_ctrl_in(struct snd_cs4231 *chip, unsigned char reg)
|
||||
static unsigned char snd_cs4236_ctrl_in(struct snd_wss *chip, unsigned char reg)
|
||||
{
|
||||
outb(reg, chip->cport + 3);
|
||||
return inb(chip->cport + 4);
|
||||
|
@ -180,44 +181,52 @@ static unsigned char divisor_to_rate_register(unsigned int divisor)
|
|||
}
|
||||
}
|
||||
|
||||
static void snd_cs4236_playback_format(struct snd_cs4231 *chip, struct snd_pcm_hw_params *params, unsigned char pdfr)
|
||||
static void snd_cs4236_playback_format(struct snd_wss *chip,
|
||||
struct snd_pcm_hw_params *params,
|
||||
unsigned char pdfr)
|
||||
{
|
||||
unsigned long flags;
|
||||
unsigned char rate = divisor_to_rate_register(params->rate_den);
|
||||
|
||||
spin_lock_irqsave(&chip->reg_lock, flags);
|
||||
/* set fast playback format change and clean playback FIFO */
|
||||
snd_cs4231_out(chip, CS4231_ALT_FEATURE_1, chip->image[CS4231_ALT_FEATURE_1] | 0x10);
|
||||
snd_cs4231_out(chip, CS4231_PLAYBK_FORMAT, pdfr & 0xf0);
|
||||
snd_cs4231_out(chip, CS4231_ALT_FEATURE_1, chip->image[CS4231_ALT_FEATURE_1] & ~0x10);
|
||||
snd_wss_out(chip, CS4231_ALT_FEATURE_1,
|
||||
chip->image[CS4231_ALT_FEATURE_1] | 0x10);
|
||||
snd_wss_out(chip, CS4231_PLAYBK_FORMAT, pdfr & 0xf0);
|
||||
snd_wss_out(chip, CS4231_ALT_FEATURE_1,
|
||||
chip->image[CS4231_ALT_FEATURE_1] & ~0x10);
|
||||
snd_cs4236_ext_out(chip, CS4236_DAC_RATE, rate);
|
||||
spin_unlock_irqrestore(&chip->reg_lock, flags);
|
||||
}
|
||||
|
||||
static void snd_cs4236_capture_format(struct snd_cs4231 *chip, struct snd_pcm_hw_params *params, unsigned char cdfr)
|
||||
static void snd_cs4236_capture_format(struct snd_wss *chip,
|
||||
struct snd_pcm_hw_params *params,
|
||||
unsigned char cdfr)
|
||||
{
|
||||
unsigned long flags;
|
||||
unsigned char rate = divisor_to_rate_register(params->rate_den);
|
||||
|
||||
spin_lock_irqsave(&chip->reg_lock, flags);
|
||||
/* set fast capture format change and clean capture FIFO */
|
||||
snd_cs4231_out(chip, CS4231_ALT_FEATURE_1, chip->image[CS4231_ALT_FEATURE_1] | 0x20);
|
||||
snd_cs4231_out(chip, CS4231_REC_FORMAT, cdfr & 0xf0);
|
||||
snd_cs4231_out(chip, CS4231_ALT_FEATURE_1, chip->image[CS4231_ALT_FEATURE_1] & ~0x20);
|
||||
snd_wss_out(chip, CS4231_ALT_FEATURE_1,
|
||||
chip->image[CS4231_ALT_FEATURE_1] | 0x20);
|
||||
snd_wss_out(chip, CS4231_REC_FORMAT, cdfr & 0xf0);
|
||||
snd_wss_out(chip, CS4231_ALT_FEATURE_1,
|
||||
chip->image[CS4231_ALT_FEATURE_1] & ~0x20);
|
||||
snd_cs4236_ext_out(chip, CS4236_ADC_RATE, rate);
|
||||
spin_unlock_irqrestore(&chip->reg_lock, flags);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_PM
|
||||
|
||||
static void snd_cs4236_suspend(struct snd_cs4231 *chip)
|
||||
static void snd_cs4236_suspend(struct snd_wss *chip)
|
||||
{
|
||||
int reg;
|
||||
unsigned long flags;
|
||||
|
||||
spin_lock_irqsave(&chip->reg_lock, flags);
|
||||
for (reg = 0; reg < 32; reg++)
|
||||
chip->image[reg] = snd_cs4231_in(chip, reg);
|
||||
chip->image[reg] = snd_wss_in(chip, reg);
|
||||
for (reg = 0; reg < 18; reg++)
|
||||
chip->eimage[reg] = snd_cs4236_ext_in(chip, CS4236_I23VAL(reg));
|
||||
for (reg = 2; reg < 9; reg++)
|
||||
|
@ -225,12 +234,12 @@ static void snd_cs4236_suspend(struct snd_cs4231 *chip)
|
|||
spin_unlock_irqrestore(&chip->reg_lock, flags);
|
||||
}
|
||||
|
||||
static void snd_cs4236_resume(struct snd_cs4231 *chip)
|
||||
static void snd_cs4236_resume(struct snd_wss *chip)
|
||||
{
|
||||
int reg;
|
||||
unsigned long flags;
|
||||
|
||||
snd_cs4231_mce_up(chip);
|
||||
snd_wss_mce_up(chip);
|
||||
spin_lock_irqsave(&chip->reg_lock, flags);
|
||||
for (reg = 0; reg < 32; reg++) {
|
||||
switch (reg) {
|
||||
|
@ -240,7 +249,7 @@ static void snd_cs4236_resume(struct snd_cs4231 *chip)
|
|||
case 29: /* why? CS4235 - master right */
|
||||
break;
|
||||
default:
|
||||
snd_cs4231_out(chip, reg, chip->image[reg]);
|
||||
snd_wss_out(chip, reg, chip->image[reg]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -255,7 +264,7 @@ static void snd_cs4236_resume(struct snd_cs4231 *chip)
|
|||
}
|
||||
}
|
||||
spin_unlock_irqrestore(&chip->reg_lock, flags);
|
||||
snd_cs4231_mce_down(chip);
|
||||
snd_wss_mce_down(chip);
|
||||
}
|
||||
|
||||
#endif /* CONFIG_PM */
|
||||
|
@ -266,24 +275,26 @@ int snd_cs4236_create(struct snd_card *card,
|
|||
int irq, int dma1, int dma2,
|
||||
unsigned short hardware,
|
||||
unsigned short hwshare,
|
||||
struct snd_cs4231 ** rchip)
|
||||
struct snd_wss **rchip)
|
||||
{
|
||||
struct snd_cs4231 *chip;
|
||||
struct snd_wss *chip;
|
||||
unsigned char ver1, ver2;
|
||||
unsigned int reg;
|
||||
int err;
|
||||
|
||||
*rchip = NULL;
|
||||
if (hardware == CS4231_HW_DETECT)
|
||||
hardware = CS4231_HW_DETECT3;
|
||||
if (hardware == WSS_HW_DETECT)
|
||||
hardware = WSS_HW_DETECT3;
|
||||
if (cport < 0x100) {
|
||||
snd_printk("please, specify control port for CS4236+ chips\n");
|
||||
return -ENODEV;
|
||||
}
|
||||
if ((err = snd_cs4231_create(card, port, cport, irq, dma1, dma2, hardware, hwshare, &chip)) < 0)
|
||||
err = snd_wss_create(card, port, cport,
|
||||
irq, dma1, dma2, hardware, hwshare, &chip);
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
if (!(chip->hardware & CS4231_HW_CS4236B_MASK)) {
|
||||
if (!(chip->hardware & WSS_HW_CS4236B_MASK)) {
|
||||
snd_printk("CS4236+: MODE3 and extended registers not available, hardware=0x%x\n",chip->hardware);
|
||||
snd_device_free(card, chip);
|
||||
return -ENODEV;
|
||||
|
@ -330,20 +341,20 @@ int snd_cs4236_create(struct snd_card *card,
|
|||
snd_cs4236_ext_out(chip, CS4236_I23VAL(reg), snd_cs4236_ext_map[reg]);
|
||||
|
||||
/* initialize compatible but more featured registers */
|
||||
snd_cs4231_out(chip, CS4231_LEFT_INPUT, 0x40);
|
||||
snd_cs4231_out(chip, CS4231_RIGHT_INPUT, 0x40);
|
||||
snd_cs4231_out(chip, CS4231_AUX1_LEFT_INPUT, 0xff);
|
||||
snd_cs4231_out(chip, CS4231_AUX1_RIGHT_INPUT, 0xff);
|
||||
snd_cs4231_out(chip, CS4231_AUX2_LEFT_INPUT, 0xdf);
|
||||
snd_cs4231_out(chip, CS4231_AUX2_RIGHT_INPUT, 0xdf);
|
||||
snd_cs4231_out(chip, CS4231_RIGHT_LINE_IN, 0xff);
|
||||
snd_cs4231_out(chip, CS4231_LEFT_LINE_IN, 0xff);
|
||||
snd_cs4231_out(chip, CS4231_RIGHT_LINE_IN, 0xff);
|
||||
snd_wss_out(chip, CS4231_LEFT_INPUT, 0x40);
|
||||
snd_wss_out(chip, CS4231_RIGHT_INPUT, 0x40);
|
||||
snd_wss_out(chip, CS4231_AUX1_LEFT_INPUT, 0xff);
|
||||
snd_wss_out(chip, CS4231_AUX1_RIGHT_INPUT, 0xff);
|
||||
snd_wss_out(chip, CS4231_AUX2_LEFT_INPUT, 0xdf);
|
||||
snd_wss_out(chip, CS4231_AUX2_RIGHT_INPUT, 0xdf);
|
||||
snd_wss_out(chip, CS4231_RIGHT_LINE_IN, 0xff);
|
||||
snd_wss_out(chip, CS4231_LEFT_LINE_IN, 0xff);
|
||||
snd_wss_out(chip, CS4231_RIGHT_LINE_IN, 0xff);
|
||||
switch (chip->hardware) {
|
||||
case CS4231_HW_CS4235:
|
||||
case CS4231_HW_CS4239:
|
||||
snd_cs4231_out(chip, CS4235_LEFT_MASTER, 0xff);
|
||||
snd_cs4231_out(chip, CS4235_RIGHT_MASTER, 0xff);
|
||||
case WSS_HW_CS4235:
|
||||
case WSS_HW_CS4239:
|
||||
snd_wss_out(chip, CS4235_LEFT_MASTER, 0xff);
|
||||
snd_wss_out(chip, CS4235_RIGHT_MASTER, 0xff);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -351,12 +362,13 @@ int snd_cs4236_create(struct snd_card *card,
|
|||
return 0;
|
||||
}
|
||||
|
||||
int snd_cs4236_pcm(struct snd_cs4231 *chip, int device, struct snd_pcm **rpcm)
|
||||
int snd_cs4236_pcm(struct snd_wss *chip, int device, struct snd_pcm **rpcm)
|
||||
{
|
||||
struct snd_pcm *pcm;
|
||||
int err;
|
||||
|
||||
if ((err = snd_cs4231_pcm(chip, device, &pcm)) < 0)
|
||||
err = snd_wss_pcm(chip, device, &pcm);
|
||||
if (err < 0)
|
||||
return err;
|
||||
pcm->info_flags &= ~SNDRV_PCM_INFO_JOINT_DUPLEX;
|
||||
if (rpcm)
|
||||
|
@ -387,7 +399,7 @@ static int snd_cs4236_info_single(struct snd_kcontrol *kcontrol, struct snd_ctl_
|
|||
|
||||
static int snd_cs4236_get_single(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_cs4231 *chip = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_wss *chip = snd_kcontrol_chip(kcontrol);
|
||||
unsigned long flags;
|
||||
int reg = kcontrol->private_value & 0xff;
|
||||
int shift = (kcontrol->private_value >> 8) & 0xff;
|
||||
|
@ -404,7 +416,7 @@ static int snd_cs4236_get_single(struct snd_kcontrol *kcontrol, struct snd_ctl_e
|
|||
|
||||
static int snd_cs4236_put_single(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_cs4231 *chip = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_wss *chip = snd_kcontrol_chip(kcontrol);
|
||||
unsigned long flags;
|
||||
int reg = kcontrol->private_value & 0xff;
|
||||
int shift = (kcontrol->private_value >> 8) & 0xff;
|
||||
|
@ -433,7 +445,7 @@ static int snd_cs4236_put_single(struct snd_kcontrol *kcontrol, struct snd_ctl_e
|
|||
|
||||
static int snd_cs4236_get_singlec(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_cs4231 *chip = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_wss *chip = snd_kcontrol_chip(kcontrol);
|
||||
unsigned long flags;
|
||||
int reg = kcontrol->private_value & 0xff;
|
||||
int shift = (kcontrol->private_value >> 8) & 0xff;
|
||||
|
@ -450,7 +462,7 @@ static int snd_cs4236_get_singlec(struct snd_kcontrol *kcontrol, struct snd_ctl_
|
|||
|
||||
static int snd_cs4236_put_singlec(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_cs4231 *chip = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_wss *chip = snd_kcontrol_chip(kcontrol);
|
||||
unsigned long flags;
|
||||
int reg = kcontrol->private_value & 0xff;
|
||||
int shift = (kcontrol->private_value >> 8) & 0xff;
|
||||
|
@ -490,7 +502,7 @@ static int snd_cs4236_info_double(struct snd_kcontrol *kcontrol, struct snd_ctl_
|
|||
|
||||
static int snd_cs4236_get_double(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_cs4231 *chip = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_wss *chip = snd_kcontrol_chip(kcontrol);
|
||||
unsigned long flags;
|
||||
int left_reg = kcontrol->private_value & 0xff;
|
||||
int right_reg = (kcontrol->private_value >> 8) & 0xff;
|
||||
|
@ -512,7 +524,7 @@ static int snd_cs4236_get_double(struct snd_kcontrol *kcontrol, struct snd_ctl_e
|
|||
|
||||
static int snd_cs4236_put_double(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_cs4231 *chip = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_wss *chip = snd_kcontrol_chip(kcontrol);
|
||||
unsigned long flags;
|
||||
int left_reg = kcontrol->private_value & 0xff;
|
||||
int right_reg = (kcontrol->private_value >> 8) & 0xff;
|
||||
|
@ -555,7 +567,7 @@ static int snd_cs4236_put_double(struct snd_kcontrol *kcontrol, struct snd_ctl_e
|
|||
|
||||
static int snd_cs4236_get_double1(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_cs4231 *chip = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_wss *chip = snd_kcontrol_chip(kcontrol);
|
||||
unsigned long flags;
|
||||
int left_reg = kcontrol->private_value & 0xff;
|
||||
int right_reg = (kcontrol->private_value >> 8) & 0xff;
|
||||
|
@ -577,7 +589,7 @@ static int snd_cs4236_get_double1(struct snd_kcontrol *kcontrol, struct snd_ctl_
|
|||
|
||||
static int snd_cs4236_put_double1(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_cs4231 *chip = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_wss *chip = snd_kcontrol_chip(kcontrol);
|
||||
unsigned long flags;
|
||||
int left_reg = kcontrol->private_value & 0xff;
|
||||
int right_reg = (kcontrol->private_value >> 8) & 0xff;
|
||||
|
@ -600,7 +612,7 @@ static int snd_cs4236_put_double1(struct snd_kcontrol *kcontrol, struct snd_ctl_
|
|||
val1 = (chip->image[left_reg] & ~(mask << shift_left)) | val1;
|
||||
val2 = (chip->eimage[CS4236_REG(right_reg)] & ~(mask << shift_right)) | val2;
|
||||
change = val1 != chip->image[left_reg] || val2 != chip->eimage[CS4236_REG(right_reg)];
|
||||
snd_cs4231_out(chip, left_reg, val1);
|
||||
snd_wss_out(chip, left_reg, val1);
|
||||
snd_cs4236_ext_out(chip, right_reg, val2);
|
||||
spin_unlock_irqrestore(&chip->reg_lock, flags);
|
||||
return change;
|
||||
|
@ -619,7 +631,7 @@ static inline int snd_cs4236_mixer_master_digital_invert_volume(int vol)
|
|||
|
||||
static int snd_cs4236_get_master_digital(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_cs4231 *chip = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_wss *chip = snd_kcontrol_chip(kcontrol);
|
||||
unsigned long flags;
|
||||
|
||||
spin_lock_irqsave(&chip->reg_lock, flags);
|
||||
|
@ -631,7 +643,7 @@ static int snd_cs4236_get_master_digital(struct snd_kcontrol *kcontrol, struct s
|
|||
|
||||
static int snd_cs4236_put_master_digital(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_cs4231 *chip = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_wss *chip = snd_kcontrol_chip(kcontrol);
|
||||
unsigned long flags;
|
||||
int change;
|
||||
unsigned short val1, val2;
|
||||
|
@ -678,7 +690,7 @@ static inline int snd_cs4235_mixer_output_accu_set_volume(int vol)
|
|||
|
||||
static int snd_cs4235_get_output_accu(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_cs4231 *chip = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_wss *chip = snd_kcontrol_chip(kcontrol);
|
||||
unsigned long flags;
|
||||
|
||||
spin_lock_irqsave(&chip->reg_lock, flags);
|
||||
|
@ -690,7 +702,7 @@ static int snd_cs4235_get_output_accu(struct snd_kcontrol *kcontrol, struct snd_
|
|||
|
||||
static int snd_cs4235_put_output_accu(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_cs4231 *chip = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_wss *chip = snd_kcontrol_chip(kcontrol);
|
||||
unsigned long flags;
|
||||
int change;
|
||||
unsigned short val1, val2;
|
||||
|
@ -701,108 +713,160 @@ static int snd_cs4235_put_output_accu(struct snd_kcontrol *kcontrol, struct snd_
|
|||
val1 = (chip->image[CS4235_LEFT_MASTER] & ~(3 << 5)) | val1;
|
||||
val2 = (chip->image[CS4235_RIGHT_MASTER] & ~(3 << 5)) | val2;
|
||||
change = val1 != chip->image[CS4235_LEFT_MASTER] || val2 != chip->image[CS4235_RIGHT_MASTER];
|
||||
snd_cs4231_out(chip, CS4235_LEFT_MASTER, val1);
|
||||
snd_cs4231_out(chip, CS4235_RIGHT_MASTER, val2);
|
||||
snd_wss_out(chip, CS4235_LEFT_MASTER, val1);
|
||||
snd_wss_out(chip, CS4235_RIGHT_MASTER, val2);
|
||||
spin_unlock_irqrestore(&chip->reg_lock, flags);
|
||||
return change;
|
||||
}
|
||||
|
||||
static struct snd_kcontrol_new snd_cs4236_controls[] = {
|
||||
|
||||
CS4236_DOUBLE("Master Digital Playback Switch", 0, CS4236_LEFT_MASTER, CS4236_RIGHT_MASTER, 7, 7, 1, 1),
|
||||
CS4236_DOUBLE("Master Digital Capture Switch", 0, CS4236_DAC_MUTE, CS4236_DAC_MUTE, 7, 6, 1, 1),
|
||||
CS4236_DOUBLE("Master Digital Playback Switch", 0,
|
||||
CS4236_LEFT_MASTER, CS4236_RIGHT_MASTER, 7, 7, 1, 1),
|
||||
CS4236_DOUBLE("Master Digital Capture Switch", 0,
|
||||
CS4236_DAC_MUTE, CS4236_DAC_MUTE, 7, 6, 1, 1),
|
||||
CS4236_MASTER_DIGITAL("Master Digital Volume", 0),
|
||||
|
||||
CS4236_DOUBLE("Capture Boost Volume", 0, CS4236_LEFT_MIX_CTRL, CS4236_RIGHT_MIX_CTRL, 5, 5, 3, 1),
|
||||
CS4236_DOUBLE("Capture Boost Volume", 0,
|
||||
CS4236_LEFT_MIX_CTRL, CS4236_RIGHT_MIX_CTRL, 5, 5, 3, 1),
|
||||
|
||||
CS4231_DOUBLE("PCM Playback Switch", 0, CS4231_LEFT_OUTPUT, CS4231_RIGHT_OUTPUT, 7, 7, 1, 1),
|
||||
CS4231_DOUBLE("PCM Playback Volume", 0, CS4231_LEFT_OUTPUT, CS4231_RIGHT_OUTPUT, 0, 0, 63, 1),
|
||||
WSS_DOUBLE("PCM Playback Switch", 0,
|
||||
CS4231_LEFT_OUTPUT, CS4231_RIGHT_OUTPUT, 7, 7, 1, 1),
|
||||
WSS_DOUBLE("PCM Playback Volume", 0,
|
||||
CS4231_LEFT_OUTPUT, CS4231_RIGHT_OUTPUT, 0, 0, 63, 1),
|
||||
|
||||
CS4236_DOUBLE("DSP Playback Switch", 0, CS4236_LEFT_DSP, CS4236_RIGHT_DSP, 7, 7, 1, 1),
|
||||
CS4236_DOUBLE("DSP Playback Volume", 0, CS4236_LEFT_DSP, CS4236_RIGHT_DSP, 0, 0, 63, 1),
|
||||
CS4236_DOUBLE("DSP Playback Switch", 0,
|
||||
CS4236_LEFT_DSP, CS4236_RIGHT_DSP, 7, 7, 1, 1),
|
||||
CS4236_DOUBLE("DSP Playback Volume", 0,
|
||||
CS4236_LEFT_DSP, CS4236_RIGHT_DSP, 0, 0, 63, 1),
|
||||
|
||||
CS4236_DOUBLE("FM Playback Switch", 0, CS4236_LEFT_FM, CS4236_RIGHT_FM, 7, 7, 1, 1),
|
||||
CS4236_DOUBLE("FM Playback Volume", 0, CS4236_LEFT_FM, CS4236_RIGHT_FM, 0, 0, 63, 1),
|
||||
CS4236_DOUBLE("FM Playback Switch", 0,
|
||||
CS4236_LEFT_FM, CS4236_RIGHT_FM, 7, 7, 1, 1),
|
||||
CS4236_DOUBLE("FM Playback Volume", 0,
|
||||
CS4236_LEFT_FM, CS4236_RIGHT_FM, 0, 0, 63, 1),
|
||||
|
||||
CS4236_DOUBLE("Wavetable Playback Switch", 0, CS4236_LEFT_WAVE, CS4236_RIGHT_WAVE, 7, 7, 1, 1),
|
||||
CS4236_DOUBLE("Wavetable Playback Volume", 0, CS4236_LEFT_WAVE, CS4236_RIGHT_WAVE, 0, 0, 63, 1),
|
||||
CS4236_DOUBLE("Wavetable Playback Switch", 0,
|
||||
CS4236_LEFT_WAVE, CS4236_RIGHT_WAVE, 7, 7, 1, 1),
|
||||
CS4236_DOUBLE("Wavetable Playback Volume", 0,
|
||||
CS4236_LEFT_WAVE, CS4236_RIGHT_WAVE, 0, 0, 63, 1),
|
||||
|
||||
CS4231_DOUBLE("Synth Playback Switch", 0, CS4231_LEFT_LINE_IN, CS4231_RIGHT_LINE_IN, 7, 7, 1, 1),
|
||||
CS4231_DOUBLE("Synth Volume", 0, CS4231_LEFT_LINE_IN, CS4231_RIGHT_LINE_IN, 0, 0, 31, 1),
|
||||
CS4231_DOUBLE("Synth Capture Switch", 0, CS4231_LEFT_LINE_IN, CS4231_RIGHT_LINE_IN, 6, 6, 1, 1),
|
||||
CS4231_DOUBLE("Synth Capture Bypass", 0, CS4231_LEFT_LINE_IN, CS4231_RIGHT_LINE_IN, 5, 5, 1, 1),
|
||||
WSS_DOUBLE("Synth Playback Switch", 0,
|
||||
CS4231_LEFT_LINE_IN, CS4231_RIGHT_LINE_IN, 7, 7, 1, 1),
|
||||
WSS_DOUBLE("Synth Volume", 0,
|
||||
CS4231_LEFT_LINE_IN, CS4231_RIGHT_LINE_IN, 0, 0, 31, 1),
|
||||
WSS_DOUBLE("Synth Capture Switch", 0,
|
||||
CS4231_LEFT_LINE_IN, CS4231_RIGHT_LINE_IN, 6, 6, 1, 1),
|
||||
WSS_DOUBLE("Synth Capture Bypass", 0,
|
||||
CS4231_LEFT_LINE_IN, CS4231_RIGHT_LINE_IN, 5, 5, 1, 1),
|
||||
|
||||
CS4236_DOUBLE("Mic Playback Switch", 0, CS4236_LEFT_MIC, CS4236_RIGHT_MIC, 6, 6, 1, 1),
|
||||
CS4236_DOUBLE("Mic Capture Switch", 0, CS4236_LEFT_MIC, CS4236_RIGHT_MIC, 7, 7, 1, 1),
|
||||
CS4236_DOUBLE("Mic Playback Switch", 0,
|
||||
CS4236_LEFT_MIC, CS4236_RIGHT_MIC, 6, 6, 1, 1),
|
||||
CS4236_DOUBLE("Mic Capture Switch", 0,
|
||||
CS4236_LEFT_MIC, CS4236_RIGHT_MIC, 7, 7, 1, 1),
|
||||
CS4236_DOUBLE("Mic Volume", 0, CS4236_LEFT_MIC, CS4236_RIGHT_MIC, 0, 0, 31, 1),
|
||||
CS4236_DOUBLE("Mic Playback Boost", 0, CS4236_LEFT_MIC, CS4236_RIGHT_MIC, 5, 5, 1, 0),
|
||||
CS4236_DOUBLE("Mic Playback Boost", 0,
|
||||
CS4236_LEFT_MIC, CS4236_RIGHT_MIC, 5, 5, 1, 0),
|
||||
|
||||
CS4231_DOUBLE("Line Playback Switch", 0, CS4231_AUX1_LEFT_INPUT, CS4231_AUX1_RIGHT_INPUT, 7, 7, 1, 1),
|
||||
CS4231_DOUBLE("Line Volume", 0, CS4231_AUX1_LEFT_INPUT, CS4231_AUX1_RIGHT_INPUT, 0, 0, 31, 1),
|
||||
CS4231_DOUBLE("Line Capture Switch", 0, CS4231_AUX1_LEFT_INPUT, CS4231_AUX1_RIGHT_INPUT, 6, 6, 1, 1),
|
||||
CS4231_DOUBLE("Line Capture Bypass", 0, CS4231_AUX1_LEFT_INPUT, CS4231_AUX1_RIGHT_INPUT, 5, 5, 1, 1),
|
||||
WSS_DOUBLE("Line Playback Switch", 0,
|
||||
CS4231_AUX1_LEFT_INPUT, CS4231_AUX1_RIGHT_INPUT, 7, 7, 1, 1),
|
||||
WSS_DOUBLE("Line Volume", 0,
|
||||
CS4231_AUX1_LEFT_INPUT, CS4231_AUX1_RIGHT_INPUT, 0, 0, 31, 1),
|
||||
WSS_DOUBLE("Line Capture Switch", 0,
|
||||
CS4231_AUX1_LEFT_INPUT, CS4231_AUX1_RIGHT_INPUT, 6, 6, 1, 1),
|
||||
WSS_DOUBLE("Line Capture Bypass", 0,
|
||||
CS4231_AUX1_LEFT_INPUT, CS4231_AUX1_RIGHT_INPUT, 5, 5, 1, 1),
|
||||
|
||||
CS4231_DOUBLE("CD Playback Switch", 0, CS4231_AUX2_LEFT_INPUT, CS4231_AUX2_RIGHT_INPUT, 7, 7, 1, 1),
|
||||
CS4231_DOUBLE("CD Volume", 0, CS4231_AUX2_LEFT_INPUT, CS4231_AUX2_RIGHT_INPUT, 0, 0, 31, 1),
|
||||
CS4231_DOUBLE("CD Capture Switch", 0, CS4231_AUX2_LEFT_INPUT, CS4231_AUX2_RIGHT_INPUT, 6, 6, 1, 1),
|
||||
WSS_DOUBLE("CD Playback Switch", 0,
|
||||
CS4231_AUX2_LEFT_INPUT, CS4231_AUX2_RIGHT_INPUT, 7, 7, 1, 1),
|
||||
WSS_DOUBLE("CD Volume", 0,
|
||||
CS4231_AUX2_LEFT_INPUT, CS4231_AUX2_RIGHT_INPUT, 0, 0, 31, 1),
|
||||
WSS_DOUBLE("CD Capture Switch", 0,
|
||||
CS4231_AUX2_LEFT_INPUT, CS4231_AUX2_RIGHT_INPUT, 6, 6, 1, 1),
|
||||
|
||||
CS4236_DOUBLE1("Mono Output Playback Switch", 0, CS4231_MONO_CTRL, CS4236_RIGHT_MIX_CTRL, 6, 7, 1, 1),
|
||||
CS4236_DOUBLE1("Mono Playback Switch", 0, CS4231_MONO_CTRL, CS4236_LEFT_MIX_CTRL, 7, 7, 1, 1),
|
||||
CS4231_SINGLE("Mono Playback Volume", 0, CS4231_MONO_CTRL, 0, 15, 1),
|
||||
CS4231_SINGLE("Mono Playback Bypass", 0, CS4231_MONO_CTRL, 5, 1, 0),
|
||||
CS4236_DOUBLE1("Mono Output Playback Switch", 0,
|
||||
CS4231_MONO_CTRL, CS4236_RIGHT_MIX_CTRL, 6, 7, 1, 1),
|
||||
CS4236_DOUBLE1("Mono Playback Switch", 0,
|
||||
CS4231_MONO_CTRL, CS4236_LEFT_MIX_CTRL, 7, 7, 1, 1),
|
||||
WSS_SINGLE("Mono Playback Volume", 0, CS4231_MONO_CTRL, 0, 15, 1),
|
||||
WSS_SINGLE("Mono Playback Bypass", 0, CS4231_MONO_CTRL, 5, 1, 0),
|
||||
|
||||
CS4231_DOUBLE("Capture Volume", 0, CS4231_LEFT_INPUT, CS4231_RIGHT_INPUT, 0, 0, 15, 0),
|
||||
CS4231_DOUBLE("Analog Loopback Capture Switch", 0, CS4231_LEFT_INPUT, CS4231_RIGHT_INPUT, 7, 7, 1, 0),
|
||||
WSS_DOUBLE("Capture Volume", 0,
|
||||
CS4231_LEFT_INPUT, CS4231_RIGHT_INPUT, 0, 0, 15, 0),
|
||||
WSS_DOUBLE("Analog Loopback Capture Switch", 0,
|
||||
CS4231_LEFT_INPUT, CS4231_RIGHT_INPUT, 7, 7, 1, 0),
|
||||
|
||||
CS4231_SINGLE("Digital Loopback Playback Switch", 0, CS4231_LOOPBACK, 0, 1, 0),
|
||||
CS4236_DOUBLE1("Digital Loopback Playback Volume", 0, CS4231_LOOPBACK, CS4236_RIGHT_LOOPBACK, 2, 0, 63, 1)
|
||||
WSS_SINGLE("Digital Loopback Playback Switch", 0, CS4231_LOOPBACK, 0, 1, 0),
|
||||
CS4236_DOUBLE1("Digital Loopback Playback Volume", 0,
|
||||
CS4231_LOOPBACK, CS4236_RIGHT_LOOPBACK, 2, 0, 63, 1)
|
||||
};
|
||||
|
||||
static struct snd_kcontrol_new snd_cs4235_controls[] = {
|
||||
|
||||
CS4231_DOUBLE("Master Switch", 0, CS4235_LEFT_MASTER, CS4235_RIGHT_MASTER, 7, 7, 1, 1),
|
||||
CS4231_DOUBLE("Master Volume", 0, CS4235_LEFT_MASTER, CS4235_RIGHT_MASTER, 0, 0, 31, 1),
|
||||
WSS_DOUBLE("Master Switch", 0,
|
||||
CS4235_LEFT_MASTER, CS4235_RIGHT_MASTER, 7, 7, 1, 1),
|
||||
WSS_DOUBLE("Master Volume", 0,
|
||||
CS4235_LEFT_MASTER, CS4235_RIGHT_MASTER, 0, 0, 31, 1),
|
||||
|
||||
CS4235_OUTPUT_ACCU("Playback Volume", 0),
|
||||
|
||||
CS4236_DOUBLE("Master Digital Playback Switch", 0, CS4236_LEFT_MASTER, CS4236_RIGHT_MASTER, 7, 7, 1, 1),
|
||||
CS4236_DOUBLE("Master Digital Capture Switch", 0, CS4236_DAC_MUTE, CS4236_DAC_MUTE, 7, 6, 1, 1),
|
||||
CS4236_DOUBLE("Master Digital Playback Switch", 0,
|
||||
CS4236_LEFT_MASTER, CS4236_RIGHT_MASTER, 7, 7, 1, 1),
|
||||
CS4236_DOUBLE("Master Digital Capture Switch", 0,
|
||||
CS4236_DAC_MUTE, CS4236_DAC_MUTE, 7, 6, 1, 1),
|
||||
CS4236_MASTER_DIGITAL("Master Digital Volume", 0),
|
||||
|
||||
CS4231_DOUBLE("Master Digital Playback Switch", 1, CS4231_LEFT_LINE_IN, CS4231_RIGHT_LINE_IN, 7, 7, 1, 1),
|
||||
CS4231_DOUBLE("Master Digital Capture Switch", 1, CS4231_LEFT_LINE_IN, CS4231_RIGHT_LINE_IN, 6, 6, 1, 1),
|
||||
CS4231_DOUBLE("Master Digital Volume", 1, CS4231_LEFT_LINE_IN, CS4231_RIGHT_LINE_IN, 0, 0, 31, 1),
|
||||
WSS_DOUBLE("Master Digital Playback Switch", 1,
|
||||
CS4231_LEFT_LINE_IN, CS4231_RIGHT_LINE_IN, 7, 7, 1, 1),
|
||||
WSS_DOUBLE("Master Digital Capture Switch", 1,
|
||||
CS4231_LEFT_LINE_IN, CS4231_RIGHT_LINE_IN, 6, 6, 1, 1),
|
||||
WSS_DOUBLE("Master Digital Volume", 1,
|
||||
CS4231_LEFT_LINE_IN, CS4231_RIGHT_LINE_IN, 0, 0, 31, 1),
|
||||
|
||||
CS4236_DOUBLE("Capture Volume", 0, CS4236_LEFT_MIX_CTRL, CS4236_RIGHT_MIX_CTRL, 5, 5, 3, 1),
|
||||
CS4236_DOUBLE("Capture Volume", 0,
|
||||
CS4236_LEFT_MIX_CTRL, CS4236_RIGHT_MIX_CTRL, 5, 5, 3, 1),
|
||||
|
||||
CS4231_DOUBLE("PCM Switch", 0, CS4231_LEFT_OUTPUT, CS4231_RIGHT_OUTPUT, 7, 7, 1, 1),
|
||||
CS4231_DOUBLE("PCM Volume", 0, CS4231_LEFT_OUTPUT, CS4231_RIGHT_OUTPUT, 0, 0, 63, 1),
|
||||
WSS_DOUBLE("PCM Switch", 0,
|
||||
CS4231_LEFT_OUTPUT, CS4231_RIGHT_OUTPUT, 7, 7, 1, 1),
|
||||
WSS_DOUBLE("PCM Volume", 0,
|
||||
CS4231_LEFT_OUTPUT, CS4231_RIGHT_OUTPUT, 0, 0, 63, 1),
|
||||
|
||||
CS4236_DOUBLE("DSP Switch", 0, CS4236_LEFT_DSP, CS4236_RIGHT_DSP, 7, 7, 1, 1),
|
||||
|
||||
CS4236_DOUBLE("FM Switch", 0, CS4236_LEFT_FM, CS4236_RIGHT_FM, 7, 7, 1, 1),
|
||||
|
||||
CS4236_DOUBLE("Wavetable Switch", 0, CS4236_LEFT_WAVE, CS4236_RIGHT_WAVE, 7, 7, 1, 1),
|
||||
CS4236_DOUBLE("Wavetable Switch", 0,
|
||||
CS4236_LEFT_WAVE, CS4236_RIGHT_WAVE, 7, 7, 1, 1),
|
||||
|
||||
CS4236_DOUBLE("Mic Capture Switch", 0, CS4236_LEFT_MIC, CS4236_RIGHT_MIC, 7, 7, 1, 1),
|
||||
CS4236_DOUBLE("Mic Playback Switch", 0, CS4236_LEFT_MIC, CS4236_RIGHT_MIC, 6, 6, 1, 1),
|
||||
CS4236_DOUBLE("Mic Capture Switch", 0,
|
||||
CS4236_LEFT_MIC, CS4236_RIGHT_MIC, 7, 7, 1, 1),
|
||||
CS4236_DOUBLE("Mic Playback Switch", 0,
|
||||
CS4236_LEFT_MIC, CS4236_RIGHT_MIC, 6, 6, 1, 1),
|
||||
CS4236_SINGLE("Mic Volume", 0, CS4236_LEFT_MIC, 0, 31, 1),
|
||||
CS4236_SINGLE("Mic Playback Boost", 0, CS4236_LEFT_MIC, 5, 1, 0),
|
||||
|
||||
CS4231_DOUBLE("Aux Playback Switch", 0, CS4231_AUX1_LEFT_INPUT, CS4231_AUX1_RIGHT_INPUT, 7, 7, 1, 1),
|
||||
CS4231_DOUBLE("Aux Capture Switch", 0, CS4231_AUX1_LEFT_INPUT, CS4231_AUX1_RIGHT_INPUT, 6, 6, 1, 1),
|
||||
CS4231_DOUBLE("Aux Volume", 0, CS4231_AUX1_LEFT_INPUT, CS4231_AUX1_RIGHT_INPUT, 0, 0, 31, 1),
|
||||
WSS_DOUBLE("Aux Playback Switch", 0,
|
||||
CS4231_AUX1_LEFT_INPUT, CS4231_AUX1_RIGHT_INPUT, 7, 7, 1, 1),
|
||||
WSS_DOUBLE("Aux Capture Switch", 0,
|
||||
CS4231_AUX1_LEFT_INPUT, CS4231_AUX1_RIGHT_INPUT, 6, 6, 1, 1),
|
||||
WSS_DOUBLE("Aux Volume", 0,
|
||||
CS4231_AUX1_LEFT_INPUT, CS4231_AUX1_RIGHT_INPUT, 0, 0, 31, 1),
|
||||
|
||||
CS4231_DOUBLE("Aux Playback Switch", 1, CS4231_AUX2_LEFT_INPUT, CS4231_AUX2_RIGHT_INPUT, 7, 7, 1, 1),
|
||||
CS4231_DOUBLE("Aux Capture Switch", 1, CS4231_AUX2_LEFT_INPUT, CS4231_AUX2_RIGHT_INPUT, 6, 6, 1, 1),
|
||||
CS4231_DOUBLE("Aux Volume", 1, CS4231_AUX2_LEFT_INPUT, CS4231_AUX2_RIGHT_INPUT, 0, 0, 31, 1),
|
||||
WSS_DOUBLE("Aux Playback Switch", 1,
|
||||
CS4231_AUX2_LEFT_INPUT, CS4231_AUX2_RIGHT_INPUT, 7, 7, 1, 1),
|
||||
WSS_DOUBLE("Aux Capture Switch", 1,
|
||||
CS4231_AUX2_LEFT_INPUT, CS4231_AUX2_RIGHT_INPUT, 6, 6, 1, 1),
|
||||
WSS_DOUBLE("Aux Volume", 1,
|
||||
CS4231_AUX2_LEFT_INPUT, CS4231_AUX2_RIGHT_INPUT, 0, 0, 31, 1),
|
||||
|
||||
CS4236_DOUBLE1("Master Mono Switch", 0, CS4231_MONO_CTRL, CS4236_RIGHT_MIX_CTRL, 6, 7, 1, 1),
|
||||
CS4236_DOUBLE1("Master Mono Switch", 0,
|
||||
CS4231_MONO_CTRL, CS4236_RIGHT_MIX_CTRL, 6, 7, 1, 1),
|
||||
|
||||
CS4236_DOUBLE1("Mono Switch", 0, CS4231_MONO_CTRL, CS4236_LEFT_MIX_CTRL, 7, 7, 1, 1),
|
||||
CS4231_SINGLE("Mono Volume", 0, CS4231_MONO_CTRL, 0, 15, 1),
|
||||
CS4236_DOUBLE1("Mono Switch", 0,
|
||||
CS4231_MONO_CTRL, CS4236_LEFT_MIX_CTRL, 7, 7, 1, 1),
|
||||
WSS_SINGLE("Mono Volume", 0, CS4231_MONO_CTRL, 0, 15, 1),
|
||||
|
||||
CS4231_DOUBLE("Analog Loopback Switch", 0, CS4231_LEFT_INPUT, CS4231_RIGHT_INPUT, 7, 7, 1, 0),
|
||||
WSS_DOUBLE("Analog Loopback Switch", 0,
|
||||
CS4231_LEFT_INPUT, CS4231_RIGHT_INPUT, 7, 7, 1, 0),
|
||||
};
|
||||
|
||||
#define CS4236_IEC958_ENABLE(xname, xindex) \
|
||||
|
@ -813,14 +877,14 @@ CS4231_DOUBLE("Analog Loopback Switch", 0, CS4231_LEFT_INPUT, CS4231_RIGHT_INPUT
|
|||
|
||||
static int snd_cs4236_get_iec958_switch(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_cs4231 *chip = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_wss *chip = snd_kcontrol_chip(kcontrol);
|
||||
unsigned long flags;
|
||||
|
||||
spin_lock_irqsave(&chip->reg_lock, flags);
|
||||
ucontrol->value.integer.value[0] = chip->image[CS4231_ALT_FEATURE_1] & 0x02 ? 1 : 0;
|
||||
#if 0
|
||||
printk("get valid: ALT = 0x%x, C3 = 0x%x, C4 = 0x%x, C5 = 0x%x, C6 = 0x%x, C8 = 0x%x\n",
|
||||
snd_cs4231_in(chip, CS4231_ALT_FEATURE_1),
|
||||
snd_wss_in(chip, CS4231_ALT_FEATURE_1),
|
||||
snd_cs4236_ctrl_in(chip, 3),
|
||||
snd_cs4236_ctrl_in(chip, 4),
|
||||
snd_cs4236_ctrl_in(chip, 5),
|
||||
|
@ -833,7 +897,7 @@ static int snd_cs4236_get_iec958_switch(struct snd_kcontrol *kcontrol, struct sn
|
|||
|
||||
static int snd_cs4236_put_iec958_switch(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_cs4231 *chip = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_wss *chip = snd_kcontrol_chip(kcontrol);
|
||||
unsigned long flags;
|
||||
int change;
|
||||
unsigned short enable, val;
|
||||
|
@ -841,23 +905,23 @@ static int snd_cs4236_put_iec958_switch(struct snd_kcontrol *kcontrol, struct sn
|
|||
enable = ucontrol->value.integer.value[0] & 1;
|
||||
|
||||
mutex_lock(&chip->mce_mutex);
|
||||
snd_cs4231_mce_up(chip);
|
||||
snd_wss_mce_up(chip);
|
||||
spin_lock_irqsave(&chip->reg_lock, flags);
|
||||
val = (chip->image[CS4231_ALT_FEATURE_1] & ~0x0e) | (0<<2) | (enable << 1);
|
||||
change = val != chip->image[CS4231_ALT_FEATURE_1];
|
||||
snd_cs4231_out(chip, CS4231_ALT_FEATURE_1, val);
|
||||
snd_wss_out(chip, CS4231_ALT_FEATURE_1, val);
|
||||
val = snd_cs4236_ctrl_in(chip, 4) | 0xc0;
|
||||
snd_cs4236_ctrl_out(chip, 4, val);
|
||||
udelay(100);
|
||||
val &= ~0x40;
|
||||
snd_cs4236_ctrl_out(chip, 4, val);
|
||||
spin_unlock_irqrestore(&chip->reg_lock, flags);
|
||||
snd_cs4231_mce_down(chip);
|
||||
snd_wss_mce_down(chip);
|
||||
mutex_unlock(&chip->mce_mutex);
|
||||
|
||||
#if 0
|
||||
printk("set valid: ALT = 0x%x, C3 = 0x%x, C4 = 0x%x, C5 = 0x%x, C6 = 0x%x, C8 = 0x%x\n",
|
||||
snd_cs4231_in(chip, CS4231_ALT_FEATURE_1),
|
||||
snd_wss_in(chip, CS4231_ALT_FEATURE_1),
|
||||
snd_cs4236_ctrl_in(chip, 3),
|
||||
snd_cs4236_ctrl_in(chip, 4),
|
||||
snd_cs4236_ctrl_in(chip, 5),
|
||||
|
@ -896,7 +960,7 @@ CS4236_SINGLEC("3D Control - Volume", 0, 2, 0, 15, 1),
|
|||
CS4236_SINGLEC("3D Control - IEC958", 0, 3, 5, 1, 0)
|
||||
};
|
||||
|
||||
int snd_cs4236_mixer(struct snd_cs4231 *chip)
|
||||
int snd_cs4236_mixer(struct snd_wss *chip)
|
||||
{
|
||||
struct snd_card *card;
|
||||
unsigned int idx, count;
|
||||
|
@ -905,10 +969,10 @@ int snd_cs4236_mixer(struct snd_cs4231 *chip)
|
|||
|
||||
snd_assert(chip != NULL && chip->card != NULL, return -EINVAL);
|
||||
card = chip->card;
|
||||
strcpy(card->mixername, snd_cs4231_chip_id(chip));
|
||||
strcpy(card->mixername, snd_wss_chip_id(chip));
|
||||
|
||||
if (chip->hardware == CS4231_HW_CS4235 ||
|
||||
chip->hardware == CS4231_HW_CS4239) {
|
||||
if (chip->hardware == WSS_HW_CS4235 ||
|
||||
chip->hardware == WSS_HW_CS4239) {
|
||||
for (idx = 0; idx < ARRAY_SIZE(snd_cs4235_controls); idx++) {
|
||||
if ((err = snd_ctl_add(card, snd_ctl_new1(&snd_cs4235_controls[idx], chip))) < 0)
|
||||
return err;
|
||||
|
@ -920,16 +984,16 @@ int snd_cs4236_mixer(struct snd_cs4231 *chip)
|
|||
}
|
||||
}
|
||||
switch (chip->hardware) {
|
||||
case CS4231_HW_CS4235:
|
||||
case CS4231_HW_CS4239:
|
||||
case WSS_HW_CS4235:
|
||||
case WSS_HW_CS4239:
|
||||
count = ARRAY_SIZE(snd_cs4236_3d_controls_cs4235);
|
||||
kcontrol = snd_cs4236_3d_controls_cs4235;
|
||||
break;
|
||||
case CS4231_HW_CS4237B:
|
||||
case WSS_HW_CS4237B:
|
||||
count = ARRAY_SIZE(snd_cs4236_3d_controls_cs4237);
|
||||
kcontrol = snd_cs4236_3d_controls_cs4237;
|
||||
break;
|
||||
case CS4231_HW_CS4238B:
|
||||
case WSS_HW_CS4238B:
|
||||
count = ARRAY_SIZE(snd_cs4236_3d_controls_cs4238);
|
||||
kcontrol = snd_cs4236_3d_controls_cs4238;
|
||||
break;
|
||||
|
@ -941,8 +1005,8 @@ int snd_cs4236_mixer(struct snd_cs4231 *chip)
|
|||
if ((err = snd_ctl_add(card, snd_ctl_new1(kcontrol, chip))) < 0)
|
||||
return err;
|
||||
}
|
||||
if (chip->hardware == CS4231_HW_CS4237B ||
|
||||
chip->hardware == CS4231_HW_CS4238B) {
|
||||
if (chip->hardware == WSS_HW_CS4237B ||
|
||||
chip->hardware == WSS_HW_CS4238B) {
|
||||
for (idx = 0; idx < ARRAY_SIZE(snd_cs4236_iec958_controls); idx++) {
|
||||
if ((err = snd_ctl_add(card, snd_ctl_new1(&snd_cs4236_iec958_controls[idx], chip))) < 0)
|
||||
return err;
|
||||
|
|
|
@ -75,7 +75,7 @@ struct snd_gusmax {
|
|||
int irq;
|
||||
struct snd_card *card;
|
||||
struct snd_gus_card *gus;
|
||||
struct snd_cs4231 *cs4231;
|
||||
struct snd_wss *wss;
|
||||
unsigned short gus_status_reg;
|
||||
unsigned short pcm_status_reg;
|
||||
};
|
||||
|
@ -117,7 +117,7 @@ static irqreturn_t snd_gusmax_interrupt(int irq, void *dev_id)
|
|||
}
|
||||
if (inb(maxcard->pcm_status_reg) & 0x01) { /* IRQ bit is set? */
|
||||
handled = 1;
|
||||
snd_cs4231_interrupt(irq, maxcard->cs4231);
|
||||
snd_wss_interrupt(irq, maxcard->wss);
|
||||
loop++;
|
||||
}
|
||||
} while (loop && --max > 0);
|
||||
|
@ -140,10 +140,7 @@ static void __devinit snd_gusmax_init(int dev, struct snd_card *card,
|
|||
outb(gus->max_cntrl_val, GUSP(gus, MAXCNTRLPORT));
|
||||
}
|
||||
|
||||
#define CS4231_PRIVATE( left, right, shift, mute ) \
|
||||
((left << 24)|(right << 16)|(shift<<8)|mute)
|
||||
|
||||
static int __devinit snd_gusmax_mixer(struct snd_cs4231 *chip)
|
||||
static int __devinit snd_gusmax_mixer(struct snd_wss *chip)
|
||||
{
|
||||
struct snd_card *card = chip->card;
|
||||
struct snd_ctl_elem_id id1, id2;
|
||||
|
@ -214,7 +211,7 @@ static int __devinit snd_gusmax_probe(struct device *pdev, unsigned int dev)
|
|||
int xirq, xdma1, xdma2, err;
|
||||
struct snd_card *card;
|
||||
struct snd_gus_card *gus = NULL;
|
||||
struct snd_cs4231 *cs4231;
|
||||
struct snd_wss *wss;
|
||||
struct snd_gusmax *maxcard;
|
||||
|
||||
card = snd_card_new(index[dev], id[dev], THIS_MODULE,
|
||||
|
@ -301,33 +298,39 @@ static int __devinit snd_gusmax_probe(struct device *pdev, unsigned int dev)
|
|||
}
|
||||
maxcard->irq = xirq;
|
||||
|
||||
if ((err = snd_cs4231_create(card,
|
||||
gus->gf1.port + 0x10c, -1, xirq,
|
||||
xdma2 < 0 ? xdma1 : xdma2, xdma1,
|
||||
CS4231_HW_DETECT,
|
||||
CS4231_HWSHARE_IRQ |
|
||||
CS4231_HWSHARE_DMA1 |
|
||||
CS4231_HWSHARE_DMA2,
|
||||
&cs4231)) < 0)
|
||||
err = snd_wss_create(card,
|
||||
gus->gf1.port + 0x10c, -1, xirq,
|
||||
xdma2 < 0 ? xdma1 : xdma2, xdma1,
|
||||
WSS_HW_DETECT,
|
||||
WSS_HWSHARE_IRQ |
|
||||
WSS_HWSHARE_DMA1 |
|
||||
WSS_HWSHARE_DMA2,
|
||||
&wss);
|
||||
if (err < 0)
|
||||
goto _err;
|
||||
|
||||
if ((err = snd_cs4231_pcm(cs4231, 0, NULL)) < 0)
|
||||
err = snd_wss_pcm(wss, 0, NULL);
|
||||
if (err < 0)
|
||||
goto _err;
|
||||
|
||||
if ((err = snd_cs4231_mixer(cs4231)) < 0)
|
||||
err = snd_wss_mixer(wss);
|
||||
if (err < 0)
|
||||
goto _err;
|
||||
|
||||
if ((err = snd_cs4231_timer(cs4231, 2, NULL)) < 0)
|
||||
err = snd_wss_timer(wss, 2, NULL);
|
||||
if (err < 0)
|
||||
goto _err;
|
||||
|
||||
if (pcm_channels[dev] > 0) {
|
||||
if ((err = snd_gf1_pcm_new(gus, 1, 1, NULL)) < 0)
|
||||
goto _err;
|
||||
}
|
||||
if ((err = snd_gusmax_mixer(cs4231)) < 0)
|
||||
err = snd_gusmax_mixer(wss);
|
||||
if (err < 0)
|
||||
goto _err;
|
||||
|
||||
if ((err = snd_gf1_rawmidi_new(gus, 0, NULL)) < 0)
|
||||
err = snd_gf1_rawmidi_new(gus, 0, NULL);
|
||||
if (err < 0)
|
||||
goto _err;
|
||||
|
||||
sprintf(card->longname + strlen(card->longname), " at 0x%lx, irq %i, dma %i", gus->gf1.port, xirq, xdma1);
|
||||
|
@ -336,11 +339,12 @@ static int __devinit snd_gusmax_probe(struct device *pdev, unsigned int dev)
|
|||
|
||||
snd_card_set_dev(card, pdev);
|
||||
|
||||
if ((err = snd_card_register(card)) < 0)
|
||||
err = snd_card_register(card);
|
||||
if (err < 0)
|
||||
goto _err;
|
||||
|
||||
maxcard->gus = gus;
|
||||
maxcard->cs4231 = cs4231;
|
||||
maxcard->wss = wss;
|
||||
|
||||
dev_set_drvdata(pdev, card);
|
||||
return 0;
|
||||
|
|
|
@ -118,7 +118,7 @@ struct snd_interwave {
|
|||
int irq;
|
||||
struct snd_card *card;
|
||||
struct snd_gus_card *gus;
|
||||
struct snd_cs4231 *cs4231;
|
||||
struct snd_wss *wss;
|
||||
#ifdef SNDRV_STB
|
||||
struct resource *i2c_res;
|
||||
#endif
|
||||
|
@ -312,7 +312,7 @@ static irqreturn_t snd_interwave_interrupt(int irq, void *dev_id)
|
|||
}
|
||||
if (inb(iwcard->pcm_status_reg) & 0x01) { /* IRQ bit is set? */
|
||||
handled = 1;
|
||||
snd_cs4231_interrupt(irq, iwcard->cs4231);
|
||||
snd_wss_interrupt(irq, iwcard->wss);
|
||||
loop++;
|
||||
}
|
||||
} while (loop && --max > 0);
|
||||
|
@ -498,13 +498,17 @@ static void __devinit snd_interwave_init(int dev, struct snd_gus_card * gus)
|
|||
}
|
||||
|
||||
static struct snd_kcontrol_new snd_interwave_controls[] = {
|
||||
CS4231_DOUBLE("Master Playback Switch", 0, CS4231_LINE_LEFT_OUTPUT, CS4231_LINE_RIGHT_OUTPUT, 7, 7, 1, 1),
|
||||
CS4231_DOUBLE("Master Playback Volume", 0, CS4231_LINE_LEFT_OUTPUT, CS4231_LINE_RIGHT_OUTPUT, 0, 0, 31, 1),
|
||||
CS4231_DOUBLE("Mic Playback Switch", 0, CS4231_LEFT_MIC_INPUT, CS4231_RIGHT_MIC_INPUT, 7, 7, 1, 1),
|
||||
CS4231_DOUBLE("Mic Playback Volume", 0, CS4231_LEFT_MIC_INPUT, CS4231_RIGHT_MIC_INPUT, 0, 0, 31, 1)
|
||||
WSS_DOUBLE("Master Playback Switch", 0,
|
||||
CS4231_LINE_LEFT_OUTPUT, CS4231_LINE_RIGHT_OUTPUT, 7, 7, 1, 1),
|
||||
WSS_DOUBLE("Master Playback Volume", 0,
|
||||
CS4231_LINE_LEFT_OUTPUT, CS4231_LINE_RIGHT_OUTPUT, 0, 0, 31, 1),
|
||||
WSS_DOUBLE("Mic Playback Switch", 0,
|
||||
CS4231_LEFT_MIC_INPUT, CS4231_RIGHT_MIC_INPUT, 7, 7, 1, 1),
|
||||
WSS_DOUBLE("Mic Playback Volume", 0,
|
||||
CS4231_LEFT_MIC_INPUT, CS4231_RIGHT_MIC_INPUT, 0, 0, 31, 1)
|
||||
};
|
||||
|
||||
static int __devinit snd_interwave_mixer(struct snd_cs4231 *chip)
|
||||
static int __devinit snd_interwave_mixer(struct snd_wss *chip)
|
||||
{
|
||||
struct snd_card *card = chip->card;
|
||||
struct snd_ctl_elem_id id1, id2;
|
||||
|
@ -527,10 +531,10 @@ static int __devinit snd_interwave_mixer(struct snd_cs4231 *chip)
|
|||
for (idx = 0; idx < ARRAY_SIZE(snd_interwave_controls); idx++)
|
||||
if ((err = snd_ctl_add(card, snd_ctl_new1(&snd_interwave_controls[idx], chip))) < 0)
|
||||
return err;
|
||||
snd_cs4231_out(chip, CS4231_LINE_LEFT_OUTPUT, 0x9f);
|
||||
snd_cs4231_out(chip, CS4231_LINE_RIGHT_OUTPUT, 0x9f);
|
||||
snd_cs4231_out(chip, CS4231_LEFT_MIC_INPUT, 0x9f);
|
||||
snd_cs4231_out(chip, CS4231_RIGHT_MIC_INPUT, 0x9f);
|
||||
snd_wss_out(chip, CS4231_LINE_LEFT_OUTPUT, 0x9f);
|
||||
snd_wss_out(chip, CS4231_LINE_RIGHT_OUTPUT, 0x9f);
|
||||
snd_wss_out(chip, CS4231_LEFT_MIC_INPUT, 0x9f);
|
||||
snd_wss_out(chip, CS4231_RIGHT_MIC_INPUT, 0x9f);
|
||||
/* reassign AUXA to SYNTHESIZER */
|
||||
strcpy(id1.name, "Aux Playback Switch");
|
||||
strcpy(id2.name, "Synth Playback Switch");
|
||||
|
@ -642,7 +646,7 @@ static int __devinit snd_interwave_probe(struct snd_card *card, int dev)
|
|||
{
|
||||
int xirq, xdma1, xdma2;
|
||||
struct snd_interwave *iwcard = card->private_data;
|
||||
struct snd_cs4231 *cs4231;
|
||||
struct snd_wss *wss;
|
||||
struct snd_gus_card *gus;
|
||||
#ifdef SNDRV_STB
|
||||
struct snd_i2c_bus *i2c_bus;
|
||||
|
@ -684,33 +688,39 @@ static int __devinit snd_interwave_probe(struct snd_card *card, int dev)
|
|||
}
|
||||
iwcard->irq = xirq;
|
||||
|
||||
if ((err = snd_cs4231_create(card,
|
||||
gus->gf1.port + 0x10c, -1, xirq,
|
||||
xdma2 < 0 ? xdma1 : xdma2, xdma1,
|
||||
CS4231_HW_INTERWAVE,
|
||||
CS4231_HWSHARE_IRQ |
|
||||
CS4231_HWSHARE_DMA1 |
|
||||
CS4231_HWSHARE_DMA2,
|
||||
&cs4231)) < 0)
|
||||
err = snd_wss_create(card,
|
||||
gus->gf1.port + 0x10c, -1, xirq,
|
||||
xdma2 < 0 ? xdma1 : xdma2, xdma1,
|
||||
WSS_HW_INTERWAVE,
|
||||
WSS_HWSHARE_IRQ |
|
||||
WSS_HWSHARE_DMA1 |
|
||||
WSS_HWSHARE_DMA2,
|
||||
&wss);
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
if ((err = snd_cs4231_pcm(cs4231, 0, &pcm)) < 0)
|
||||
err = snd_wss_pcm(wss, 0, &pcm);
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
sprintf(pcm->name + strlen(pcm->name), " rev %c", gus->revision + 'A');
|
||||
strcat(pcm->name, " (codec)");
|
||||
|
||||
if ((err = snd_cs4231_timer(cs4231, 2, NULL)) < 0)
|
||||
err = snd_wss_timer(wss, 2, NULL);
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
if ((err = snd_cs4231_mixer(cs4231)) < 0)
|
||||
err = snd_wss_mixer(wss);
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
if (pcm_channels[dev] > 0) {
|
||||
if ((err = snd_gf1_pcm_new(gus, 1, 1, NULL)) < 0)
|
||||
err = snd_gf1_pcm_new(gus, 1, 1, NULL);
|
||||
if (err < 0)
|
||||
return err;
|
||||
}
|
||||
if ((err = snd_interwave_mixer(cs4231)) < 0)
|
||||
err = snd_interwave_mixer(wss);
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
#ifdef SNDRV_STB
|
||||
|
@ -754,10 +764,11 @@ static int __devinit snd_interwave_probe(struct snd_card *card, int dev)
|
|||
if (xdma2 >= 0)
|
||||
sprintf(card->longname + strlen(card->longname), "&%d", xdma2);
|
||||
|
||||
if ((err = snd_card_register(card)) < 0)
|
||||
err = snd_card_register(card);
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
iwcard->cs4231 = cs4231;
|
||||
iwcard->wss = wss;
|
||||
iwcard->gus = gus;
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -133,7 +133,7 @@ struct snd_opl3sa2 {
|
|||
spinlock_t reg_lock;
|
||||
struct snd_hwdep *synth;
|
||||
struct snd_rawmidi *rmidi;
|
||||
struct snd_cs4231 *cs4231;
|
||||
struct snd_wss *wss;
|
||||
unsigned char ctlregs[0x20];
|
||||
int ymode; /* SL added */
|
||||
struct snd_kcontrol *master_switch;
|
||||
|
@ -318,7 +318,7 @@ static irqreturn_t snd_opl3sa2_interrupt(int irq, void *dev_id)
|
|||
|
||||
if (status & 0x07) { /* TI,CI,PI */
|
||||
handled = 1;
|
||||
snd_cs4231_interrupt(irq, chip->cs4231);
|
||||
snd_wss_interrupt(irq, chip->wss);
|
||||
}
|
||||
|
||||
if (status & 0x40) { /* hardware volume change */
|
||||
|
@ -573,7 +573,7 @@ static int snd_opl3sa2_suspend(struct snd_card *card, pm_message_t state)
|
|||
struct snd_opl3sa2 *chip = card->private_data;
|
||||
|
||||
snd_power_change_state(card, SNDRV_CTL_POWER_D3hot);
|
||||
chip->cs4231->suspend(chip->cs4231);
|
||||
chip->wss->suspend(chip->wss);
|
||||
/* power down */
|
||||
snd_opl3sa2_write(chip, OPL3SA2_PM_CTRL, OPL3SA2_PM_D3);
|
||||
|
||||
|
@ -597,8 +597,8 @@ static int snd_opl3sa2_resume(struct snd_card *card)
|
|||
for (i = 0x12; i <= 0x16; i++)
|
||||
snd_opl3sa2_write(chip, i, chip->ctlregs[i]);
|
||||
}
|
||||
/* restore cs4231 */
|
||||
chip->cs4231->resume(chip->cs4231);
|
||||
/* restore wss */
|
||||
chip->wss->resume(chip->wss);
|
||||
|
||||
snd_power_change_state(card, SNDRV_CTL_POWER_D0);
|
||||
return 0;
|
||||
|
@ -659,7 +659,7 @@ static int __devinit snd_opl3sa2_probe(struct snd_card *card, int dev)
|
|||
{
|
||||
int xirq, xdma1, xdma2;
|
||||
struct snd_opl3sa2 *chip;
|
||||
struct snd_cs4231 *cs4231;
|
||||
struct snd_wss *wss;
|
||||
struct snd_opl3 *opl3;
|
||||
int err;
|
||||
|
||||
|
@ -679,23 +679,25 @@ static int __devinit snd_opl3sa2_probe(struct snd_card *card, int dev)
|
|||
return -ENODEV;
|
||||
}
|
||||
chip->irq = xirq;
|
||||
if ((err = snd_cs4231_create(card,
|
||||
wss_port[dev] + 4, -1,
|
||||
xirq, xdma1, xdma2,
|
||||
CS4231_HW_OPL3SA2,
|
||||
CS4231_HWSHARE_IRQ,
|
||||
&cs4231)) < 0) {
|
||||
err = snd_wss_create(card,
|
||||
wss_port[dev] + 4, -1,
|
||||
xirq, xdma1, xdma2,
|
||||
WSS_HW_OPL3SA2, WSS_HWSHARE_IRQ, &wss);
|
||||
if (err < 0) {
|
||||
snd_printd("Oops, WSS not detected at 0x%lx\n", wss_port[dev] + 4);
|
||||
return err;
|
||||
}
|
||||
chip->cs4231 = cs4231;
|
||||
if ((err = snd_cs4231_pcm(cs4231, 0, NULL)) < 0)
|
||||
chip->wss = wss;
|
||||
err = snd_wss_pcm(wss, 0, NULL);
|
||||
if (err < 0)
|
||||
return err;
|
||||
if ((err = snd_cs4231_mixer(cs4231)) < 0)
|
||||
err = snd_wss_mixer(wss);
|
||||
if (err < 0)
|
||||
return err;
|
||||
if ((err = snd_opl3sa2_mixer(chip)) < 0)
|
||||
return err;
|
||||
if ((err = snd_cs4231_timer(cs4231, 0, NULL)) < 0)
|
||||
err = snd_wss_timer(wss, 0, NULL);
|
||||
if (err < 0)
|
||||
return err;
|
||||
if (fm_port[dev] >= 0x340 && fm_port[dev] < 0x400) {
|
||||
if ((err = snd_opl3_create(card, fm_port[dev],
|
||||
|
|
|
@ -1221,7 +1221,7 @@ static int __devinit snd_miro_probe(struct device *devptr, unsigned int n)
|
|||
|
||||
int error;
|
||||
struct snd_miro *miro;
|
||||
struct snd_cs4231 *codec;
|
||||
struct snd_wss *codec;
|
||||
struct snd_timer *timer;
|
||||
struct snd_card *card;
|
||||
struct snd_pcm *pcm;
|
||||
|
@ -1310,29 +1310,32 @@ static int __devinit snd_miro_probe(struct device *devptr, unsigned int n)
|
|||
}
|
||||
}
|
||||
|
||||
if ((error = snd_miro_configure(miro))) {
|
||||
error = snd_miro_configure(miro);
|
||||
if (error) {
|
||||
snd_card_free(card);
|
||||
return error;
|
||||
}
|
||||
|
||||
if ((error = snd_cs4231_create(card, miro->wss_base + 4, -1,
|
||||
miro->irq, miro->dma1, miro->dma2,
|
||||
CS4231_HW_AD1845,
|
||||
0,
|
||||
&codec)) < 0) {
|
||||
error = snd_wss_create(card, miro->wss_base + 4, -1,
|
||||
miro->irq, miro->dma1, miro->dma2,
|
||||
WSS_HW_AD1845, 0, &codec);
|
||||
if (error < 0) {
|
||||
snd_card_free(card);
|
||||
return error;
|
||||
}
|
||||
|
||||
if ((error = snd_cs4231_pcm(codec, 0, &pcm)) < 0) {
|
||||
error = snd_wss_pcm(codec, 0, &pcm);
|
||||
if (error < 0) {
|
||||
snd_card_free(card);
|
||||
return error;
|
||||
}
|
||||
if ((error = snd_cs4231_mixer(codec)) < 0) {
|
||||
error = snd_wss_mixer(codec);
|
||||
if (error < 0) {
|
||||
snd_card_free(card);
|
||||
return error;
|
||||
}
|
||||
if ((error = snd_cs4231_timer(codec, 0, &timer)) < 0) {
|
||||
error = snd_wss_timer(codec, 0, &timer);
|
||||
if (error < 0) {
|
||||
snd_card_free(card);
|
||||
return error;
|
||||
}
|
||||
|
|
|
@ -139,7 +139,7 @@ struct snd_opti9xx {
|
|||
unsigned long mc_base_size;
|
||||
#ifdef OPTi93X
|
||||
unsigned long mc_indir_index;
|
||||
struct snd_cs4231 *codec;
|
||||
struct snd_wss *codec;
|
||||
#endif /* OPTi93X */
|
||||
unsigned long pwd_reg;
|
||||
|
||||
|
@ -562,7 +562,7 @@ static int __devinit snd_opti9xx_configure(struct snd_opti9xx *chip)
|
|||
|
||||
static irqreturn_t snd_opti93x_interrupt(int irq, void *dev_id)
|
||||
{
|
||||
struct snd_cs4231 *codec = dev_id;
|
||||
struct snd_wss *codec = dev_id;
|
||||
struct snd_opti9xx *chip = codec->card->private_data;
|
||||
unsigned char status;
|
||||
|
||||
|
@ -570,7 +570,7 @@ static irqreturn_t snd_opti93x_interrupt(int irq, void *dev_id)
|
|||
if ((status & OPTi93X_IRQ_PLAYBACK) && codec->playback_substream)
|
||||
snd_pcm_period_elapsed(codec->playback_substream);
|
||||
if ((status & OPTi93X_IRQ_CAPTURE) && codec->capture_substream) {
|
||||
snd_cs4231_overrange(codec);
|
||||
snd_wss_overrange(codec);
|
||||
snd_pcm_period_elapsed(codec->capture_substream);
|
||||
}
|
||||
outb(0x00, OPTi93X_PORT(codec, STATUS));
|
||||
|
@ -691,7 +691,7 @@ static void snd_card_opti9xx_free(struct snd_card *card)
|
|||
|
||||
if (chip) {
|
||||
#ifdef OPTi93X
|
||||
struct snd_cs4231 *codec = chip->codec;
|
||||
struct snd_wss *codec = chip->codec;
|
||||
if (codec && codec->irq > 0) {
|
||||
disable_irq(codec->irq);
|
||||
free_irq(codec->irq, codec);
|
||||
|
@ -707,7 +707,7 @@ static int __devinit snd_opti9xx_probe(struct snd_card *card)
|
|||
int error;
|
||||
struct snd_opti9xx *chip = card->private_data;
|
||||
#if defined(CS4231) || defined(OPTi93X)
|
||||
struct snd_cs4231 *codec;
|
||||
struct snd_wss *codec;
|
||||
#ifdef CS4231
|
||||
struct snd_timer *timer;
|
||||
#endif
|
||||
|
@ -734,33 +734,39 @@ static int __devinit snd_opti9xx_probe(struct snd_card *card)
|
|||
#endif
|
||||
|
||||
if (chip->wss_base == SNDRV_AUTO_PORT) {
|
||||
if ((chip->wss_base = snd_legacy_find_free_ioport(possible_ports, 4)) < 0) {
|
||||
chip->wss_base = snd_legacy_find_free_ioport(possible_ports, 4);
|
||||
if (chip->wss_base < 0) {
|
||||
snd_printk("unable to find a free WSS port\n");
|
||||
return -EBUSY;
|
||||
}
|
||||
}
|
||||
if ((error = snd_opti9xx_configure(chip)))
|
||||
error = snd_opti9xx_configure(chip);
|
||||
if (error)
|
||||
return error;
|
||||
|
||||
#if defined(CS4231) || defined(OPTi93X)
|
||||
if ((error = snd_cs4231_create(card, chip->wss_base + 4, -1,
|
||||
chip->irq, chip->dma1, chip->dma2,
|
||||
error = snd_wss_create(card, chip->wss_base + 4, -1,
|
||||
chip->irq, chip->dma1, chip->dma2,
|
||||
#ifdef CS4231
|
||||
CS4231_HW_DETECT, 0,
|
||||
WSS_HW_DETECT, 0,
|
||||
#else /* OPTi93x */
|
||||
CS4231_HW_OPTI93X, CS4231_HWSHARE_IRQ,
|
||||
WSS_HW_OPTI93X, WSS_HWSHARE_IRQ,
|
||||
#endif
|
||||
&codec)) < 0)
|
||||
&codec);
|
||||
if (error < 0)
|
||||
return error;
|
||||
#ifdef OPTi93X
|
||||
chip->codec = codec;
|
||||
#endif
|
||||
if ((error = snd_cs4231_pcm(codec, 0, &pcm)) < 0)
|
||||
error = snd_wss_pcm(codec, 0, &pcm);
|
||||
if (error < 0)
|
||||
return error;
|
||||
if ((error = snd_cs4231_mixer(codec)) < 0)
|
||||
error = snd_wss_mixer(codec);
|
||||
if (error < 0)
|
||||
return error;
|
||||
#ifdef CS4231
|
||||
if ((error = snd_cs4231_timer(codec, 0, &timer)) < 0)
|
||||
error = snd_wss_timer(codec, 0, &timer);
|
||||
if (error < 0)
|
||||
return error;
|
||||
#else /* OPTI93X */
|
||||
error = request_irq(chip->irq, snd_opti93x_interrupt,
|
||||
|
|
|
@ -147,7 +147,7 @@ struct soundscape {
|
|||
enum card_type type;
|
||||
struct resource *io_res;
|
||||
struct resource *wss_res;
|
||||
struct snd_cs4231 *chip;
|
||||
struct snd_wss *chip;
|
||||
struct snd_mpu401 *mpu;
|
||||
struct snd_hwdep *hw;
|
||||
|
||||
|
@ -726,7 +726,7 @@ static int sscape_midi_info(struct snd_kcontrol *ctl,
|
|||
static int sscape_midi_get(struct snd_kcontrol *kctl,
|
||||
struct snd_ctl_elem_value *uctl)
|
||||
{
|
||||
struct snd_cs4231 *chip = snd_kcontrol_chip(kctl);
|
||||
struct snd_wss *chip = snd_kcontrol_chip(kctl);
|
||||
struct snd_card *card = chip->card;
|
||||
register struct soundscape *s = get_card_soundscape(card);
|
||||
unsigned long flags;
|
||||
|
@ -746,7 +746,7 @@ static int sscape_midi_get(struct snd_kcontrol *kctl,
|
|||
static int sscape_midi_put(struct snd_kcontrol *kctl,
|
||||
struct snd_ctl_elem_value *uctl)
|
||||
{
|
||||
struct snd_cs4231 *chip = snd_kcontrol_chip(kctl);
|
||||
struct snd_wss *chip = snd_kcontrol_chip(kctl);
|
||||
struct snd_card *card = chip->card;
|
||||
register struct soundscape *s = get_card_soundscape(card);
|
||||
unsigned long flags;
|
||||
|
@ -958,7 +958,9 @@ static int __devinit create_mpu401(struct snd_card *card, int devnum, unsigned l
|
|||
* Override for the CS4231 playback format function.
|
||||
* The AD1845 has much simpler format and rate selection.
|
||||
*/
|
||||
static void ad1845_playback_format(struct snd_cs4231 * chip, struct snd_pcm_hw_params *params, unsigned char format)
|
||||
static void ad1845_playback_format(struct snd_wss *chip,
|
||||
struct snd_pcm_hw_params *params,
|
||||
unsigned char format)
|
||||
{
|
||||
unsigned long flags;
|
||||
unsigned rate = params_rate(params);
|
||||
|
@ -983,9 +985,9 @@ static void ad1845_playback_format(struct snd_cs4231 * chip, struct snd_pcm_hw_p
|
|||
* NOTE: We seem to need to write to the MSB before the LSB
|
||||
* to get the correct sample frequency.
|
||||
*/
|
||||
snd_cs4231_out(chip, CS4231_PLAYBK_FORMAT, (format & 0xf0));
|
||||
snd_cs4231_out(chip, AD1845_FREQ_SEL_MSB, (unsigned char) (rate >> 8));
|
||||
snd_cs4231_out(chip, AD1845_FREQ_SEL_LSB, (unsigned char) rate);
|
||||
snd_wss_out(chip, CS4231_PLAYBK_FORMAT, (format & 0xf0));
|
||||
snd_wss_out(chip, AD1845_FREQ_SEL_MSB, (unsigned char) (rate >> 8));
|
||||
snd_wss_out(chip, AD1845_FREQ_SEL_LSB, (unsigned char) rate);
|
||||
|
||||
spin_unlock_irqrestore(&chip->reg_lock, flags);
|
||||
}
|
||||
|
@ -994,7 +996,9 @@ static void ad1845_playback_format(struct snd_cs4231 * chip, struct snd_pcm_hw_p
|
|||
* Override for the CS4231 capture format function.
|
||||
* The AD1845 has much simpler format and rate selection.
|
||||
*/
|
||||
static void ad1845_capture_format(struct snd_cs4231 * chip, struct snd_pcm_hw_params *params, unsigned char format)
|
||||
static void ad1845_capture_format(struct snd_wss *chip,
|
||||
struct snd_pcm_hw_params *params,
|
||||
unsigned char format)
|
||||
{
|
||||
unsigned long flags;
|
||||
unsigned rate = params_rate(params);
|
||||
|
@ -1019,9 +1023,9 @@ static void ad1845_capture_format(struct snd_cs4231 * chip, struct snd_pcm_hw_pa
|
|||
* NOTE: We seem to need to write to the MSB before the LSB
|
||||
* to get the correct sample frequency.
|
||||
*/
|
||||
snd_cs4231_out(chip, CS4231_REC_FORMAT, (format & 0xf0));
|
||||
snd_cs4231_out(chip, AD1845_FREQ_SEL_MSB, (unsigned char) (rate >> 8));
|
||||
snd_cs4231_out(chip, AD1845_FREQ_SEL_LSB, (unsigned char) rate);
|
||||
snd_wss_out(chip, CS4231_REC_FORMAT, (format & 0xf0));
|
||||
snd_wss_out(chip, AD1845_FREQ_SEL_MSB, (unsigned char) (rate >> 8));
|
||||
snd_wss_out(chip, AD1845_FREQ_SEL_LSB, (unsigned char) rate);
|
||||
|
||||
spin_unlock_irqrestore(&chip->reg_lock, flags);
|
||||
}
|
||||
|
@ -1036,7 +1040,7 @@ static int __devinit create_ad1845(struct snd_card *card, unsigned port,
|
|||
int irq, int dma1, int dma2)
|
||||
{
|
||||
register struct soundscape *sscape = get_card_soundscape(card);
|
||||
struct snd_cs4231 *chip;
|
||||
struct snd_wss *chip;
|
||||
int err;
|
||||
|
||||
if (sscape->type == SSCAPE_VIVO)
|
||||
|
@ -1045,9 +1049,8 @@ static int __devinit create_ad1845(struct snd_card *card, unsigned port,
|
|||
if (dma1 == dma2)
|
||||
dma2 = -1;
|
||||
|
||||
err = snd_cs4231_create(card,
|
||||
port, -1, irq, dma1, dma2,
|
||||
CS4231_HW_DETECT, CS4231_HWSHARE_DMA1, &chip);
|
||||
err = snd_wss_create(card, port, -1, irq, dma1, dma2,
|
||||
WSS_HW_DETECT, WSS_HWSHARE_DMA1, &chip);
|
||||
if (!err) {
|
||||
unsigned long flags;
|
||||
struct snd_pcm *pcm;
|
||||
|
@ -1063,11 +1066,11 @@ static int __devinit create_ad1845(struct snd_card *card, unsigned port,
|
|||
*
|
||||
#define AD1845_IFACE_CONFIG \
|
||||
(CS4231_AUTOCALIB | CS4231_RECORD_ENABLE | CS4231_PLAYBACK_ENABLE)
|
||||
snd_cs4231_mce_up(chip);
|
||||
snd_wss_mce_up(chip);
|
||||
spin_lock_irqsave(&chip->reg_lock, flags);
|
||||
snd_cs4231_out(chip, CS4231_IFACE_CTRL, AD1845_IFACE_CONFIG);
|
||||
snd_wss_out(chip, CS4231_IFACE_CTRL, AD1845_IFACE_CONFIG);
|
||||
spin_unlock_irqrestore(&chip->reg_lock, flags);
|
||||
snd_cs4231_mce_down(chip);
|
||||
snd_wss_mce_down(chip);
|
||||
*/
|
||||
|
||||
if (sscape->type != SSCAPE_VIVO) {
|
||||
|
@ -1077,11 +1080,11 @@ static int __devinit create_ad1845(struct snd_card *card, unsigned port,
|
|||
* be 14.31818 MHz, because we must set this register
|
||||
* to get the playback to sound correct ...
|
||||
*/
|
||||
snd_cs4231_mce_up(chip);
|
||||
snd_wss_mce_up(chip);
|
||||
spin_lock_irqsave(&chip->reg_lock, flags);
|
||||
snd_cs4231_out(chip, AD1845_CRYS_CLOCK_SEL, 0x20);
|
||||
snd_wss_out(chip, AD1845_CRYS_CLOCK_SEL, 0x20);
|
||||
spin_unlock_irqrestore(&chip->reg_lock, flags);
|
||||
snd_cs4231_mce_down(chip);
|
||||
snd_wss_mce_down(chip);
|
||||
|
||||
/*
|
||||
* More custom configuration:
|
||||
|
@ -1089,28 +1092,28 @@ static int __devinit create_ad1845(struct snd_card *card, unsigned port,
|
|||
* b) enable frequency selection (for capture/playback)
|
||||
*/
|
||||
spin_lock_irqsave(&chip->reg_lock, flags);
|
||||
snd_cs4231_out(chip, CS4231_MISC_INFO,
|
||||
CS4231_MODE2 | 0x10);
|
||||
val = snd_cs4231_in(chip, AD1845_PWR_DOWN_CTRL);
|
||||
snd_cs4231_out(chip, AD1845_PWR_DOWN_CTRL,
|
||||
val | AD1845_FREQ_SEL_ENABLE);
|
||||
snd_wss_out(chip, CS4231_MISC_INFO,
|
||||
CS4231_MODE2 | 0x10);
|
||||
val = snd_wss_in(chip, AD1845_PWR_DOWN_CTRL);
|
||||
snd_wss_out(chip, AD1845_PWR_DOWN_CTRL,
|
||||
val | AD1845_FREQ_SEL_ENABLE);
|
||||
spin_unlock_irqrestore(&chip->reg_lock, flags);
|
||||
}
|
||||
|
||||
err = snd_cs4231_pcm(chip, 0, &pcm);
|
||||
err = snd_wss_pcm(chip, 0, &pcm);
|
||||
if (err < 0) {
|
||||
snd_printk(KERN_ERR "sscape: No PCM device "
|
||||
"for AD1845 chip\n");
|
||||
goto _error;
|
||||
}
|
||||
|
||||
err = snd_cs4231_mixer(chip);
|
||||
err = snd_wss_mixer(chip);
|
||||
if (err < 0) {
|
||||
snd_printk(KERN_ERR "sscape: No mixer device "
|
||||
"for AD1845 chip\n");
|
||||
goto _error;
|
||||
}
|
||||
err = snd_cs4231_timer(chip, 0, NULL);
|
||||
err = snd_wss_timer(chip, 0, NULL);
|
||||
if (err < 0) {
|
||||
snd_printk(KERN_ERR "sscape: No timer device "
|
||||
"for AD1845 chip\n");
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* ALSA card-level driver for Turtle Beach Wavefront cards
|
||||
* (Maui,Tropez,Tropez+)
|
||||
* (Maui,Tropez,Tropez+)
|
||||
*
|
||||
* Copyright (c) 1997-1999 by Paul Barton-Davis <pbd@op.net>
|
||||
*
|
||||
|
@ -320,8 +320,8 @@ snd_wavefront_new_midi (struct snd_card *card,
|
|||
snd_rawmidi_set_ops(rmidi, SNDRV_RAWMIDI_STREAM_INPUT, &snd_wavefront_midi_input);
|
||||
|
||||
rmidi->info_flags |= SNDRV_RAWMIDI_INFO_OUTPUT |
|
||||
SNDRV_RAWMIDI_INFO_INPUT |
|
||||
SNDRV_RAWMIDI_INFO_DUPLEX;
|
||||
SNDRV_RAWMIDI_INFO_INPUT |
|
||||
SNDRV_RAWMIDI_INFO_DUPLEX;
|
||||
|
||||
return rmidi;
|
||||
}
|
||||
|
@ -364,7 +364,7 @@ static int __devinit
|
|||
snd_wavefront_probe (struct snd_card *card, int dev)
|
||||
{
|
||||
snd_wavefront_card_t *acard = card->private_data;
|
||||
struct snd_cs4231 *chip;
|
||||
struct snd_wss *chip;
|
||||
struct snd_hwdep *wavefront_synth;
|
||||
struct snd_rawmidi *ics2115_internal_rmidi = NULL;
|
||||
struct snd_rawmidi *ics2115_external_rmidi = NULL;
|
||||
|
@ -373,21 +373,20 @@ snd_wavefront_probe (struct snd_card *card, int dev)
|
|||
|
||||
/* --------- PCM --------------- */
|
||||
|
||||
if ((err = snd_cs4231_create (card,
|
||||
cs4232_pcm_port[dev],
|
||||
-1,
|
||||
cs4232_pcm_irq[dev],
|
||||
dma1[dev],
|
||||
dma2[dev],
|
||||
CS4231_HW_DETECT, 0, &chip)) < 0) {
|
||||
snd_printk (KERN_ERR "can't allocate CS4231 device\n");
|
||||
err = snd_wss_create(card, cs4232_pcm_port[dev], -1,
|
||||
cs4232_pcm_irq[dev], dma1[dev], dma2[dev],
|
||||
WSS_HW_DETECT, 0, &chip);
|
||||
if (err < 0) {
|
||||
snd_printk(KERN_ERR "can't allocate WSS device\n");
|
||||
return err;
|
||||
}
|
||||
|
||||
if ((err = snd_cs4231_pcm (chip, 0, NULL)) < 0)
|
||||
err = snd_wss_pcm(chip, 0, NULL);
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
if ((err = snd_cs4231_timer (chip, 0, NULL)) < 0)
|
||||
err = snd_wss_timer(chip, 0, NULL);
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
/* ---------- OPL3 synth --------- */
|
||||
|
@ -395,24 +394,24 @@ snd_wavefront_probe (struct snd_card *card, int dev)
|
|||
if (fm_port[dev] > 0 && fm_port[dev] != SNDRV_AUTO_PORT) {
|
||||
struct snd_opl3 *opl3;
|
||||
|
||||
if ((err = snd_opl3_create(card,
|
||||
fm_port[dev],
|
||||
fm_port[dev] + 2,
|
||||
OPL3_HW_OPL3_CS,
|
||||
0, &opl3)) < 0) {
|
||||
err = snd_opl3_create(card, fm_port[dev], fm_port[dev] + 2,
|
||||
OPL3_HW_OPL3_CS, 0, &opl3);
|
||||
if (err < 0) {
|
||||
snd_printk (KERN_ERR "can't allocate or detect OPL3 synth\n");
|
||||
return err;
|
||||
}
|
||||
|
||||
if ((err = snd_opl3_hwdep_new(opl3, hw_dev, 1, NULL)) < 0)
|
||||
err = snd_opl3_hwdep_new(opl3, hw_dev, 1, NULL);
|
||||
if (err < 0)
|
||||
return err;
|
||||
hw_dev++;
|
||||
}
|
||||
|
||||
/* ------- ICS2115 Wavetable synth ------- */
|
||||
|
||||
if ((acard->wavefront.res_base = request_region(ics2115_port[dev], 16,
|
||||
"ICS2115")) == NULL) {
|
||||
acard->wavefront.res_base = request_region(ics2115_port[dev], 16,
|
||||
"ICS2115");
|
||||
if (acard->wavefront.res_base == NULL) {
|
||||
snd_printk(KERN_ERR "unable to grab ICS2115 i/o region 0x%lx-0x%lx\n",
|
||||
ics2115_port[dev], ics2115_port[dev] + 16 - 1);
|
||||
return -EBUSY;
|
||||
|
@ -426,7 +425,8 @@ snd_wavefront_probe (struct snd_card *card, int dev)
|
|||
acard->wavefront.irq = ics2115_irq[dev];
|
||||
acard->wavefront.base = ics2115_port[dev];
|
||||
|
||||
if ((wavefront_synth = snd_wavefront_new_synth (card, hw_dev, acard)) == NULL) {
|
||||
wavefront_synth = snd_wavefront_new_synth(card, hw_dev, acard);
|
||||
if (wavefront_synth == NULL) {
|
||||
snd_printk (KERN_ERR "can't create WaveFront synth device\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
@ -437,7 +437,8 @@ snd_wavefront_probe (struct snd_card *card, int dev)
|
|||
|
||||
/* --------- Mixer ------------ */
|
||||
|
||||
if ((err = snd_cs4231_mixer(chip)) < 0) {
|
||||
err = snd_wss_mixer(chip);
|
||||
if (err < 0) {
|
||||
snd_printk (KERN_ERR "can't allocate mixer device\n");
|
||||
return err;
|
||||
}
|
||||
|
@ -445,11 +446,11 @@ snd_wavefront_probe (struct snd_card *card, int dev)
|
|||
/* -------- CS4232 MPU-401 interface -------- */
|
||||
|
||||
if (cs4232_mpu_port[dev] > 0 && cs4232_mpu_port[dev] != SNDRV_AUTO_PORT) {
|
||||
if ((err = snd_mpu401_uart_new(card, midi_dev, MPU401_HW_CS4232,
|
||||
cs4232_mpu_port[dev], 0,
|
||||
cs4232_mpu_irq[dev],
|
||||
IRQF_DISABLED,
|
||||
NULL)) < 0) {
|
||||
err = snd_mpu401_uart_new(card, midi_dev, MPU401_HW_CS4232,
|
||||
cs4232_mpu_port[dev], 0,
|
||||
cs4232_mpu_irq[dev], IRQF_DISABLED,
|
||||
NULL);
|
||||
if (err < 0) {
|
||||
snd_printk (KERN_ERR "can't allocate CS4232 MPU-401 device\n");
|
||||
return err;
|
||||
}
|
||||
|
@ -602,7 +603,7 @@ static struct isa_driver snd_wavefront_driver = {
|
|||
|
||||
#ifdef CONFIG_PNP
|
||||
static int __devinit snd_wavefront_pnp_detect(struct pnp_card_link *pcard,
|
||||
const struct pnp_card_device_id *pid)
|
||||
const struct pnp_card_device_id *pid)
|
||||
{
|
||||
static int dev;
|
||||
struct snd_card *card;
|
||||
|
|
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue