module_param_array(index, int, boot_devs, 0444);
MODULE_PARM_DESC(index, "Index value for Sun CS4231 soundcard.");
-MODULE_PARM_SYNTAX(index, SNDRV_INDEX_DESC);
module_param_array(id, charp, boot_devs, 0444);
MODULE_PARM_DESC(id, "ID string for Sun CS4231 soundcard.");
-MODULE_PARM_SYNTAX(id, SNDRV_ID_DESC);
module_param_array(enable, bool, boot_devs, 0444);
MODULE_PARM_DESC(enable, "Enable Sun CS4231 soundcard.");
-MODULE_PARM_SYNTAX(enable, SNDRV_ENABLE_DESC);
MODULE_AUTHOR("Jaroslav Kysela, Derrick J. Brashear and David S. Miller");
MODULE_DESCRIPTION("Sun CS4231");
MODULE_LICENSE("GPL");
-MODULE_CLASSES("{sound}");
-MODULE_DEVICES("{{Sun,CS4231}}");
+MODULE_SUPPORTED_DEVICE("{{Sun,CS4231}}");
typedef struct snd_cs4231 {
spinlock_t lock;
- unsigned long port;
+ void __iomem *port;
#ifdef EBUS_SUPPORT
struct ebus_dma_info eb2c;
struct ebus_dma_info eb2p;
unsigned int regs_size;
struct snd_cs4231 *next;
} cs4231_t;
-#define chip_t cs4231_t
static cs4231_t *cs4231_list;
0x00, /* 1f/31 - cbrl */
};
-static u8 __cs4231_readb(cs4231_t *cp, unsigned long reg_addr)
+static u8 __cs4231_readb(cs4231_t *cp, void __iomem *reg_addr)
{
#ifdef EBUS_SUPPORT
if (cp->flags & CS4231_FLAG_EBUS) {
#endif
}
-static void __cs4231_writeb(cs4231_t *cp, u8 val, unsigned long reg_addr)
+static void __cs4231_writeb(cs4231_t *cp, u8 val, void __iomem *reg_addr)
{
#ifdef EBUS_SUPPORT
if (cp->flags & CS4231_FLAG_EBUS) {
chip->mce_bit |= CS4231_MCE;
timeout = __cs4231_readb(chip, CS4231P(chip, REGSEL));
if (timeout == 0x80)
- snd_printk("mce_up [0x%lx]: serious init problem - codec still busy\n", chip->port);
+ snd_printk("mce_up [%p]: serious init problem - codec still busy\n", chip->port);
if (!(timeout & CS4231_MCE))
__cs4231_writeb(chip, chip->mce_bit | (timeout & 0x1f), CS4231P(chip, REGSEL));
spin_unlock_irqrestore(&chip->lock, flags);
timeout = __cs4231_readb(chip, CS4231P(chip, REGSEL));
__cs4231_writeb(chip, chip->mce_bit | (timeout & 0x1f), CS4231P(chip, REGSEL));
if (timeout == 0x80)
- snd_printk("mce_down [0x%lx]: serious init problem - codec still busy\n", chip->port);
+ snd_printk("mce_down [%p]: serious init problem - codec still busy\n", chip->port);
if ((timeout & CS4231_MCE) == 0) {
spin_unlock_irqrestore(&chip->lock, flags);
return;
#ifdef SBUS_SUPPORT
static irqreturn_t snd_cs4231_sbus_interrupt(int irq, void *dev_id, struct pt_regs *regs)
{
- cs4231_t *chip = snd_magic_cast(cs4231_t, dev_id, return);
+ cs4231_t *chip = dev_id;
u32 csr;
csr = sbus_readl(chip->port + APCCSR);
#ifdef EBUS_SUPPORT
static void snd_cs4231_ebus_play_callback(struct ebus_dma_info *p, int event, void *cookie)
{
- cs4231_t *chip = snd_magic_cast(cs4231_t, cookie, return);
+ cs4231_t *chip = cookie;
if (chip->image[CS4231_IFACE_CTRL] & CS4231_PLAYBACK_ENABLE) {
snd_pcm_period_elapsed(chip->playback_substream);
static void snd_cs4231_ebus_capture_callback(struct ebus_dma_info *p, int event, void *cookie)
{
- cs4231_t *chip = snd_magic_cast(cs4231_t, cookie, return);
+ cs4231_t *chip = cookie;
if (chip->image[CS4231_IFACE_CTRL] & CS4231_RECORD_ENABLE) {
snd_pcm_period_elapsed(chip->capture_substream);
static void snd_cs4231_pcm_free(snd_pcm_t *pcm)
{
- cs4231_t *chip = snd_magic_cast(cs4231_t, pcm->private_data, return);
+ cs4231_t *chip = pcm->private_data;
chip->pcm = NULL;
snd_pcm_lib_preallocate_free_for_all(pcm);
}
static void snd_cs4231_timer_free(snd_timer_t *timer)
{
- cs4231_t *chip = snd_magic_cast(cs4231_t, timer->private_data, return);
+ cs4231_t *chip = timer->private_data;
chip->timer = NULL;
}
return change;
}
-#define CS4231_CONTROLS (sizeof(snd_cs4231_controls)/sizeof(snd_kcontrol_new_t))
-
#define CS4231_SINGLE(xname, xindex, reg, shift, mask, invert) \
{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = xindex, \
.info = snd_cs4231_info_single, \
strcpy(card->mixername, chip->pcm->name);
- for (idx = 0; idx < CS4231_CONTROLS; idx++) {
+ for (idx = 0; idx < ARRAY_SIZE(snd_cs4231_controls); idx++) {
if ((err = snd_ctl_add(card,
snd_ctl_new1(&snd_cs4231_controls[idx],
chip))) < 0)
if (chip->timer)
snd_device_free(chip->card, chip->timer);
- snd_magic_kfree(chip);
+ kfree(chip);
return 0;
}
static int snd_cs4231_sbus_dev_free(snd_device_t *device)
{
- cs4231_t *cp = snd_magic_cast(cs4231_t, device->device_data, return -ENXIO);
+ cs4231_t *cp = device->device_data;
return snd_cs4231_sbus_free(cp);
}
int err;
*rchip = NULL;
- chip = snd_magic_kcalloc(cs4231_t, 0, GFP_KERNEL);
+ chip = kcalloc(1, sizeof(*chip), GFP_KERNEL);
if (chip == NULL)
return -ENOMEM;
if (chip->timer)
snd_device_free(chip->card, chip->timer);
- snd_magic_kfree(chip);
+ kfree(chip);
return 0;
}
static int snd_cs4231_ebus_dev_free(snd_device_t *device)
{
- cs4231_t *cp = snd_magic_cast(cs4231_t, device->device_data, return -ENXIO);
+ cs4231_t *cp = device->device_data;
return snd_cs4231_ebus_free(cp);
}
int err;
*rchip = NULL;
- chip = snd_magic_kcalloc(cs4231_t, 0, GFP_KERNEL);
+ chip = kcalloc(1, sizeof(*chip), GFP_KERNEL);
if (chip == NULL)
return -ENOMEM;
chip->eb2p.client_cookie = chip;
chip->eb2p.irq = edev->irqs[1];
- chip->port = (unsigned long) ioremap(edev->resource[0].start, 0x10);
- chip->eb2p.regs = (unsigned long) ioremap(edev->resource[1].start, 0x10);
- chip->eb2c.regs = (unsigned long) ioremap(edev->resource[2].start, 0x10);
+ chip->port = ioremap(edev->resource[0].start, 0x10);
+ chip->eb2p.regs = ioremap(edev->resource[1].start, 0x10);
+ chip->eb2c.regs = ioremap(edev->resource[2].start, 0x10);
if (!chip->port || !chip->eb2p.regs || !chip->eb2c.regs) {
snd_cs4231_ebus_free(chip);
snd_printk("cs4231-%d: Unable to map chip registers.\n", dev);