Skip to content

Commit

Permalink
Merge branch 'topic/cs423x-merge' into for-linus
Browse files Browse the repository at this point in the history
  • Loading branch information
tiwai committed Mar 23, 2009
2 parents 87cd9d7 + cda9043 commit a3c6048
Show file tree
Hide file tree
Showing 24 changed files with 351 additions and 282 deletions.
34 changes: 9 additions & 25 deletions Documentation/sound/alsa/ALSA-Configuration.txt
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,9 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
sbirq - IRQ # for CMI8330 chip (SB16)
sbdma8 - 8bit DMA # for CMI8330 chip (SB16)
sbdma16 - 16bit DMA # for CMI8330 chip (SB16)
fmport - (optional) OPL3 I/O port
mpuport - (optional) MPU401 I/O port
mpuirq - (optional) MPU401 irq #

This module supports multiple cards and autoprobe.

Expand Down Expand Up @@ -388,34 +391,11 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.

The power-management is supported.

Module snd-cs4232
-----------------

Module for sound cards based on CS4232/CS4232A ISA chips.

isapnp - ISA PnP detection - 0 = disable, 1 = enable (default)

with isapnp=0, the following options are available:

port - port # for CS4232 chip (PnP setup - 0x534)
cport - control port # for CS4232 chip (PnP setup - 0x120,0x210,0xf00)
mpu_port - port # for MPU-401 UART (PnP setup - 0x300), -1 = disable
fm_port - FM port # for CS4232 chip (PnP setup - 0x388), -1 = disable
irq - IRQ # for CS4232 chip (5,7,9,11,12,15)
mpu_irq - IRQ # for MPU-401 UART (9,11,12,15)
dma1 - first DMA # for CS4232 chip (0,1,3)
dma2 - second DMA # for Yamaha CS4232 chip (0,1,3), -1 = disable

This module supports multiple cards. This module does not support autoprobe
(if ISA PnP is not used) thus main port must be specified!!! Other ports are
optional.

The power-management is supported.

Module snd-cs4236
-----------------

Module for sound cards based on CS4235/CS4236/CS4236B/CS4237B/
Module for sound cards based on CS4232/CS4232A,
CS4235/CS4236/CS4236B/CS4237B/
CS4238B/CS4239 ISA chips.

isapnp - ISA PnP detection - 0 = disable, 1 = enable (default)
Expand All @@ -437,6 +417,9 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.

The power-management is supported.

This module is aliased as snd-cs4232 since it provides the old
snd-cs4232 functionality, too.

Module snd-cs4281
-----------------

Expand Down Expand Up @@ -606,6 +589,7 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
Module for ESS AudioDrive ES-1688 and ES-688 sound cards.

port - port # for ES-1688 chip (0x220,0x240,0x260)
fm_port - port # for OPL3 (option; share the same port as default)
mpu_port - port # for MPU-401 port (0x300,0x310,0x320,0x330), -1 = disable (default)
irq - IRQ # for ES-1688 chip (5,7,9,10)
mpu_irq - IRQ # for MPU-401 port (5,7,9,10)
Expand Down
2 changes: 2 additions & 0 deletions include/sound/ad1816a.h
Original file line number Diff line number Diff line change
Expand Up @@ -169,5 +169,7 @@ extern int snd_ad1816a_create(struct snd_card *card, unsigned long port,

extern int snd_ad1816a_pcm(struct snd_ad1816a *chip, int device, struct snd_pcm **rpcm);
extern int snd_ad1816a_mixer(struct snd_ad1816a *chip);
extern int snd_ad1816a_timer(struct snd_ad1816a *chip, int device,
struct snd_timer **rtimer);

#endif /* __SOUND_AD1816A_H */
1 change: 1 addition & 0 deletions include/sound/wss.h
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ int snd_wss_create(struct snd_card *card,
unsigned short hardware,
unsigned short hwshare,
struct snd_wss **rchip);
int snd_wss_free(struct snd_wss *chip);
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);
Expand Down
25 changes: 8 additions & 17 deletions sound/isa/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ config SND_AD1848
Say Y here to include support for AD1848 (Analog Devices) or
CS4248 (Cirrus Logic - Crystal Semiconductors) chips.

For newer chips from Cirrus Logic, use the CS4231, CS4232 or
CS4236+ drivers.
For newer chips from Cirrus Logic, use the CS4231 or CS4232+
drivers.

To compile this driver as a module, choose M here: the module
will be called snd-ad1848.
Expand Down Expand Up @@ -94,6 +94,8 @@ config SND_CMI8330
tristate "C-Media CMI8330"
select SND_WSS_LIB
select SND_SB16_DSP
select SND_OPL3_LIB
select SND_MPU401_UART
help
Say Y here to include support for soundcards based on the
C-Media CMI8330 chip.
Expand All @@ -112,26 +114,15 @@ config SND_CS4231
To compile this driver as a module, choose M here: the module
will be called snd-cs4231.

config SND_CS4232
tristate "Generic Cirrus Logic CS4232 driver"
select SND_OPL3_LIB
select SND_MPU401_UART
select SND_WSS_LIB
help
Say Y here to include support for CS4232 chips from Cirrus
Logic - Crystal Semiconductors.

To compile this driver as a module, choose M here: the module
will be called snd-cs4232.

config SND_CS4236
tristate "Generic Cirrus Logic CS4236+ driver"
tristate "Generic Cirrus Logic CS4232/CS4236+ driver"
select SND_OPL3_LIB
select SND_MPU401_UART
select SND_WSS_LIB
help
Say Y to include support for CS4235,CS4236,CS4237B,CS4238B,
CS4239 chips from Cirrus Logic - Crystal Semiconductors.
Say Y to include support for CS4232,CS4235,CS4236,CS4237B,
CS4238B,CS4239 chips from Cirrus Logic - Crystal
Semiconductors.

To compile this driver as a module, choose M here: the module
will be called snd-cs4236.
Expand Down
14 changes: 9 additions & 5 deletions sound/isa/ad1816a/ad1816a.c
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ static int __devinit snd_card_ad1816a_probe(int dev, struct pnp_card_link *pcard
struct snd_card_ad1816a *acard;
struct snd_ad1816a *chip;
struct snd_opl3 *opl3;
struct snd_timer *timer;

error = snd_card_create(index[dev], id[dev], THIS_MODULE,
sizeof(struct snd_card_ad1816a), &card);
Expand Down Expand Up @@ -195,6 +196,12 @@ static int __devinit snd_card_ad1816a_probe(int dev, struct pnp_card_link *pcard
return error;
}

error = snd_ad1816a_timer(chip, 0, &timer);
if (error < 0) {
snd_card_free(card);
return error;
}

if (mpu_port[dev] > 0) {
if (snd_mpu401_uart_new(card, 0, MPU401_HW_MPU401,
mpu_port[dev], 0, mpu_irq[dev], IRQF_DISABLED,
Expand All @@ -208,11 +215,8 @@ static int __devinit snd_card_ad1816a_probe(int dev, struct pnp_card_link *pcard
OPL3_HW_AUTO, 0, &opl3) < 0) {
printk(KERN_ERR PFX "no OPL device at 0x%lx-0x%lx.\n", fm_port[dev], fm_port[dev] + 2);
} else {
if ((error = snd_opl3_timer_new(opl3, 1, 2)) < 0) {
snd_card_free(card);
return error;
}
if ((error = snd_opl3_hwdep_new(opl3, 0, 1, NULL)) < 0) {
error = snd_opl3_hwdep_new(opl3, 0, 1, NULL);
if (error < 0) {
snd_card_free(card);
return error;
}
Expand Down
11 changes: 3 additions & 8 deletions sound/isa/ad1816a/ad1816a_lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ static inline int snd_ad1816a_busy_wait(struct snd_ad1816a *chip)
if (inb(AD1816A_REG(AD1816A_CHIP_STATUS)) & AD1816A_READY)
return 0;

snd_printk("chip busy.\n");
snd_printk(KERN_WARNING "chip busy.\n");
return -EBUSY;
}

Expand Down Expand Up @@ -196,7 +196,7 @@ static int snd_ad1816a_trigger(struct snd_ad1816a *chip, unsigned char what,
spin_unlock(&chip->lock);
break;
default:
snd_printk("invalid trigger mode 0x%x.\n", what);
snd_printk(KERN_WARNING "invalid trigger mode 0x%x.\n", what);
error = -EINVAL;
}

Expand Down Expand Up @@ -377,7 +377,6 @@ static struct snd_pcm_hardware snd_ad1816a_capture = {
.fifo_size = 0,
};

#if 0 /* not used now */
static int snd_ad1816a_timer_close(struct snd_timer *timer)
{
struct snd_ad1816a *chip = snd_timer_chip(timer);
Expand Down Expand Up @@ -442,8 +441,6 @@ static struct snd_timer_hardware snd_ad1816a_timer_table = {
.start = snd_ad1816a_timer_start,
.stop = snd_ad1816a_timer_stop,
};
#endif /* not used now */


static int snd_ad1816a_playback_open(struct snd_pcm_substream *substream)
{
Expand Down Expand Up @@ -568,7 +565,7 @@ static const char __devinit *snd_ad1816a_chip_id(struct snd_ad1816a *chip)
case AD1816A_HW_AD1815: return "AD1815";
case AD1816A_HW_AD18MAX10: return "AD18max10";
default:
snd_printk("Unknown chip version %d:%d.\n",
snd_printk(KERN_WARNING "Unknown chip version %d:%d.\n",
chip->version, chip->hardware);
return "AD1816A - unknown";
}
Expand Down Expand Up @@ -687,7 +684,6 @@ int __devinit snd_ad1816a_pcm(struct snd_ad1816a *chip, int device, struct snd_p
return 0;
}

#if 0 /* not used now */
int __devinit snd_ad1816a_timer(struct snd_ad1816a *chip, int device, struct snd_timer **rtimer)
{
struct snd_timer *timer;
Expand All @@ -709,7 +705,6 @@ int __devinit snd_ad1816a_timer(struct snd_ad1816a *chip, int device, struct snd
*rtimer = timer;
return 0;
}
#endif /* not used now */

/*
*
Expand Down
68 changes: 60 additions & 8 deletions sound/isa/cmi8330.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@
* To quickly load the module,
*
* modprobe -a snd-cmi8330 sbport=0x220 sbirq=5 sbdma8=1
* sbdma16=5 wssport=0x530 wssirq=11 wssdma=0
* sbdma16=5 wssport=0x530 wssirq=11 wssdma=0 fmport=0x388
*
* This card has two mixers and two PCM devices. I've cheesed it such
* that recording and playback can be done through the same device.
* The driver "magically" routes the capturing to the AD1848 codec,
* The driver "magically" routes the capturing to the CMI8330 codec,
* and playback to the SB16 codec. This allows for full-duplex mode
* to some extent.
* The utilities in alsa-utils are aware of both devices, so passing
Expand All @@ -51,6 +51,8 @@
#include <linux/moduleparam.h>
#include <sound/core.h>
#include <sound/wss.h>
#include <sound/opl3.h>
#include <sound/mpu401.h>
#include <sound/sb.h>
#include <sound/initval.h>

Expand Down Expand Up @@ -79,6 +81,9 @@ static int sbdma16[SNDRV_CARDS] = SNDRV_DEFAULT_DMA;
static long wssport[SNDRV_CARDS] = SNDRV_DEFAULT_PORT;
static int wssirq[SNDRV_CARDS] = SNDRV_DEFAULT_IRQ;
static int wssdma[SNDRV_CARDS] = SNDRV_DEFAULT_DMA;
static long fmport[SNDRV_CARDS] = SNDRV_DEFAULT_PORT;
static long mpuport[SNDRV_CARDS] = SNDRV_DEFAULT_PORT;
static int mpuirq[SNDRV_CARDS] = SNDRV_DEFAULT_IRQ;

module_param_array(index, int, NULL, 0444);
MODULE_PARM_DESC(index, "Index value for CMI8330 soundcard.");
Expand Down Expand Up @@ -107,6 +112,12 @@ MODULE_PARM_DESC(wssirq, "IRQ # for CMI8330 WSS driver.");
module_param_array(wssdma, int, NULL, 0444);
MODULE_PARM_DESC(wssdma, "DMA for CMI8330 WSS driver.");

module_param_array(fmport, long, NULL, 0444);
MODULE_PARM_DESC(fmport, "FM port # for CMI8330 driver.");
module_param_array(mpuport, long, NULL, 0444);
MODULE_PARM_DESC(mpuport, "MPU-401 port # for CMI8330 driver.");
module_param_array(mpuirq, int, NULL, 0444);
MODULE_PARM_DESC(mpuirq, "IRQ # for CMI8330 MPU-401 port.");
#ifdef CONFIG_PNP
static int isa_registered;
static int pnp_registered;
Expand Down Expand Up @@ -149,6 +160,7 @@ struct snd_cmi8330 {
#ifdef CONFIG_PNP
struct pnp_dev *cap;
struct pnp_dev *play;
struct pnp_dev *mpu;
#endif
struct snd_card *card;
struct snd_wss *wss;
Expand All @@ -165,7 +177,7 @@ struct snd_cmi8330 {
#ifdef CONFIG_PNP

static struct pnp_card_device_id snd_cmi8330_pnpids[] = {
{ .id = "CMI0001", .devs = { { "@@@0001" }, { "@X@0001" } } },
{ .id = "CMI0001", .devs = { { "@@@0001" }, { "@X@0001" }, { "@H@0001" } } },
{ .id = "" }
};

Expand Down Expand Up @@ -219,8 +231,10 @@ WSS_SINGLE("3D Control - Switch", 0,
CMI8330_RMUX3D, 5, 1, 1),
WSS_SINGLE("PC Speaker Playback Volume", 0,
CMI8330_OUTPUTVOL, 3, 3, 0),
WSS_SINGLE("FM Playback Switch", 0,
CMI8330_RECMUX, 3, 1, 1),
WSS_DOUBLE("FM Playback Switch", 0,
CS4231_AUX2_LEFT_INPUT, CS4231_AUX2_RIGHT_INPUT, 7, 7, 1, 1),
WSS_DOUBLE("FM Playback Volume", 0,
CS4231_AUX2_LEFT_INPUT, CS4231_AUX2_RIGHT_INPUT, 0, 0, 31, 1),
WSS_SINGLE(SNDRV_CTL_NAME_IEC958("Input ", CAPTURE, SWITCH), 0,
CMI8330_RMUX3D, 7, 1, 1),
WSS_SINGLE(SNDRV_CTL_NAME_IEC958("Input ", PLAYBACK, SWITCH), 0,
Expand Down Expand Up @@ -323,16 +337,21 @@ static int __devinit snd_cmi8330_pnp(int dev, struct snd_cmi8330 *acard,
if (acard->play == NULL)
return -EBUSY;

acard->mpu = pnp_request_card_device(card, id->devs[2].id, NULL);
if (acard->play == NULL)
return -EBUSY;

pdev = acard->cap;

err = pnp_activate_dev(pdev);
if (err < 0) {
snd_printk(KERN_ERR "CMI8330/C3D (AD1848) PnP configure failure\n");
snd_printk(KERN_ERR "CMI8330/C3D PnP configure failure\n");
return -EBUSY;
}
wssport[dev] = pnp_port_start(pdev, 0);
wssdma[dev] = pnp_dma(pdev, 0);
wssirq[dev] = pnp_irq(pdev, 0);
fmport[dev] = pnp_port_start(pdev, 1);

/* allocate SB16 resources */
pdev = acard->play;
Expand All @@ -347,6 +366,17 @@ static int __devinit snd_cmi8330_pnp(int dev, struct snd_cmi8330 *acard,
sbdma16[dev] = pnp_dma(pdev, 1);
sbirq[dev] = pnp_irq(pdev, 0);

/* allocate MPU-401 resources */
pdev = acard->mpu;

err = pnp_activate_dev(pdev);
if (err < 0) {
snd_printk(KERN_ERR
"CMI8330/C3D (MPU-401) PnP configure failure\n");
return -EBUSY;
}
mpuport[dev] = pnp_port_start(pdev, 0);
mpuirq[dev] = pnp_irq(pdev, 0);
return 0;
}
#endif
Expand Down Expand Up @@ -489,18 +519,19 @@ static int __devinit snd_cmi8330_probe(struct snd_card *card, int dev)
{
struct snd_cmi8330 *acard;
int i, err;
struct snd_opl3 *opl3;

acard = card->private_data;
err = snd_wss_create(card, wssport[dev] + 4, -1,
wssirq[dev],
wssdma[dev], -1,
WSS_HW_DETECT, 0, &acard->wss);
if (err < 0) {
snd_printk(KERN_ERR PFX "(AD1848) device busy??\n");
snd_printk(KERN_ERR PFX "(CMI8330) device busy??\n");
return err;
}
if (acard->wss->hardware != WSS_HW_CMI8330) {
snd_printk(KERN_ERR PFX "(AD1848) not found during probe\n");
snd_printk(KERN_ERR PFX "(CMI8330) not found during probe\n");
return -ENODEV;
}

Expand Down Expand Up @@ -532,6 +563,27 @@ static int __devinit snd_cmi8330_probe(struct snd_card *card, int dev)
snd_printk(KERN_ERR PFX "failed to create pcms\n");
return err;
}
if (fmport[dev] != SNDRV_AUTO_PORT) {
if (snd_opl3_create(card,
fmport[dev], fmport[dev] + 2,
OPL3_HW_AUTO, 0, &opl3) < 0) {
snd_printk(KERN_ERR PFX
"no OPL device at 0x%lx-0x%lx ?\n",
fmport[dev], fmport[dev] + 2);
} else {
err = snd_opl3_hwdep_new(opl3, 0, 1, NULL);
if (err < 0)
return err;
}
}

if (mpuport[dev] != SNDRV_AUTO_PORT) {
if (snd_mpu401_uart_new(card, 0, MPU401_HW_MPU401,
mpuport[dev], 0, mpuirq[dev],
IRQF_DISABLED, NULL) < 0)
printk(KERN_ERR PFX "no MPU-401 device at 0x%lx.\n",
mpuport[dev]);
}

strcpy(card->driver, "CMI8330/C3D");
strcpy(card->shortname, "C-Media CMI8330/C3D");
Expand Down
Loading

0 comments on commit a3c6048

Please sign in to comment.