diff options
author | Takashi Iwai <tiwai@suse.de> | 2005-11-17 09:27:08 (GMT) |
---|---|---|
committer | Jaroslav Kysela <perex@suse.cz> | 2006-01-03 11:16:44 (GMT) |
commit | f739aeccedc7681a249bdae435e9af3e5476ad1d (patch) | |
tree | f0a2e33a755039a6cb3286895d8c43187c1de613 | |
parent | 0948e3c8bb187b3dea38be1e1ffd1797866014f1 (diff) | |
download | linux-f739aeccedc7681a249bdae435e9af3e5476ad1d.tar.xz |
[ALSA] Clean up ISA cs4231 code
Modules: CS4231 driver
Clean up ISA cs4231 code, removing experimental EBUS/SBUS merge,
to improve readability.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r-- | include/sound/cs4231.h | 39 | ||||
-rw-r--r-- | sound/isa/cs423x/cs4231_lib.c | 82 |
2 files changed, 2 insertions, 119 deletions
diff --git a/include/sound/cs4231.h b/include/sound/cs4231.h index d7f9082..d956de9 100644 --- a/include/sound/cs4231.h +++ b/include/sound/cs4231.h @@ -26,21 +26,6 @@ #include "pcm.h" #include "timer.h" -#ifdef CONFIG_SBUS -#define SBUS_SUPPORT -#include <asm/sbus.h> -#endif - -#if defined(CONFIG_PCI) && defined(CONFIG_SPARC64) -#define EBUS_SUPPORT -#include <linux/pci.h> -#include <asm/ebus.h> -#endif - -#if !defined(SBUS_SUPPORT) && !defined(EBUS_SUPPORT) -#define LEGACY_SUPPORT -#endif - /* IO ports */ #define CS4231P(x) (c_d_c_CS4231##x) @@ -236,14 +221,12 @@ typedef struct _snd_cs4231 cs4231_t; struct _snd_cs4231 { unsigned long port; /* base i/o port */ -#ifdef LEGACY_SUPPORT struct resource *res_port; unsigned long cport; /* control base i/o port (CS4236) */ struct resource *res_cport; int irq; /* IRQ line */ int dma1; /* playback DMA */ int dma2; /* record DMA */ -#endif unsigned short version; /* version of CODEC chip */ unsigned short mode; /* see to CS4231_MODE_XXXX */ unsigned short hardware; /* see to CS4231_HW_XXXX */ @@ -251,24 +234,6 @@ struct _snd_cs4231 { unsigned short single_dma:1, /* forced single DMA mode (GUS 16-bit daughter board) or dma1 == dma2 */ ebus_flag:1; /* SPARC: EBUS present */ -#ifdef EBUS_SUPPORT - struct ebus_dma_info eb2c; - struct ebus_dma_info eb2p; -#endif - -#if defined(SBUS_SUPPORT) || defined(EBUS_SUPPORT) - union { -#ifdef SBUS_SUPPORT - struct sbus_dev *sdev; -#endif -#ifdef EBUS_SUPPORT - struct pci_dev *pdev; -#endif - } dev_u; - unsigned int p_periods_sent; - unsigned int c_periods_sent; -#endif - snd_card_t *card; snd_pcm_t *pcm; snd_pcm_substream_t *playback_substream; @@ -281,10 +246,8 @@ struct _snd_cs4231 { int mce_bit; int calibrate_mute; int sw_3d_bit; -#ifdef LEGACY_SUPPORT unsigned int p_dma_size; unsigned int c_dma_size; -#endif spinlock_t reg_lock; struct semaphore mce_mutex; @@ -299,10 +262,8 @@ struct _snd_cs4231 { void (*resume) (cs4231_t *chip); #endif void *dma_private_data; -#ifdef LEGACY_SUPPORT int (*claim_dma) (cs4231_t *chip, void *dma_private_data, int dma); int (*release_dma) (cs4231_t *chip, void *dma_private_data, int dma); -#endif }; /* exported functions */ diff --git a/sound/isa/cs423x/cs4231_lib.c b/sound/isa/cs423x/cs4231_lib.c index 4c9fb16..94e07a7c 100644 --- a/sound/isa/cs423x/cs4231_lib.c +++ b/sound/isa/cs423x/cs4231_lib.c @@ -124,46 +124,14 @@ static unsigned char snd_cs4231_original_image[32] = * Basic I/O functions */ -#if !defined(EBUS_SUPPORT) && !defined(SBUS_SUPPORT) -#define __CS4231_INLINE__ inline -#else -#define __CS4231_INLINE__ /* nothing */ -#endif - -static __CS4231_INLINE__ void cs4231_outb(cs4231_t *chip, u8 offset, u8 val) +static inline void cs4231_outb(cs4231_t *chip, u8 offset, u8 val) { -#ifdef EBUS_SUPPORT - if (chip->ebus->flag) { - writeb(val, chip->port + (offset << 2)); - } else { -#endif -#ifdef SBUS_SUPPORT - sbus_writeb(val, chip->port + (offset << 2)); -#endif -#ifdef EBUS_SUPPORT - } -#endif -#ifdef LEGACY_SUPPORT outb(val, chip->port + offset); -#endif } -static __CS4231_INLINE__ u8 cs4231_inb(cs4231_t *chip, u8 offset) +static inline u8 cs4231_inb(cs4231_t *chip, u8 offset) { -#ifdef EBUS_SUPPORT - if (chip->ebus_flag) { - return readb(chip->port + (offset << 2)); - } else { -#endif -#ifdef SBUS_SUPPORT - return sbus_readb(chip->port + (offset << 2)); -#endif -#ifdef EBUS_SUPPORT - } -#endif -#ifdef LEGACY_SUPPORT return inb(chip->port + offset); -#endif } static void snd_cs4231_outm(cs4231_t *chip, unsigned char reg, @@ -874,7 +842,6 @@ static int snd_cs4231_playback_hw_free(snd_pcm_substream_t * substream) return snd_pcm_lib_free_pages(substream); } -#ifdef LEGACY_SUPPORT static int snd_cs4231_playback_prepare(snd_pcm_substream_t * substream) { cs4231_t *chip = snd_pcm_substream_chip(substream); @@ -896,7 +863,6 @@ static int snd_cs4231_playback_prepare(snd_pcm_substream_t * substream) #endif return 0; } -#endif /* LEGACY_SUPPORT */ static int snd_cs4231_capture_hw_params(snd_pcm_substream_t * substream, snd_pcm_hw_params_t * hw_params) @@ -918,7 +884,6 @@ static int snd_cs4231_capture_hw_free(snd_pcm_substream_t * substream) return snd_pcm_lib_free_pages(substream); } -#ifdef LEGACY_SUPPORT static int snd_cs4231_capture_prepare(snd_pcm_substream_t * substream) { cs4231_t *chip = snd_pcm_substream_chip(substream); @@ -942,7 +907,6 @@ static int snd_cs4231_capture_prepare(snd_pcm_substream_t * substream) spin_unlock_irqrestore(&chip->reg_lock, flags); return 0; } -#endif static void snd_cs4231_overrange(cs4231_t *chip) { @@ -998,7 +962,6 @@ irqreturn_t snd_cs4231_interrupt(int irq, void *dev_id, struct pt_regs *regs) return IRQ_HANDLED; } -#ifdef LEGACY_SUPPORT static snd_pcm_uframes_t snd_cs4231_playback_pointer(snd_pcm_substream_t * substream) { cs4231_t *chip = snd_pcm_substream_chip(substream); @@ -1020,7 +983,6 @@ static snd_pcm_uframes_t snd_cs4231_capture_pointer(snd_pcm_substream_t * substr ptr = snd_dma_pointer(chip->dma2, chip->c_dma_size); return bytes_to_frames(substream->runtime, ptr); } -#endif /* LEGACY_SUPPORT */ /* @@ -1253,7 +1215,6 @@ static int snd_cs4231_playback_open(snd_pcm_substream_t * substream) chip->hardware == CS4231_HW_CS4239) runtime->hw.formats = SNDRV_PCM_FMTBIT_U8 | SNDRV_PCM_FMTBIT_S16_LE; -#ifdef LEGACY_SUPPORT snd_pcm_limit_isa_dma_size(chip->dma1, &runtime->hw.buffer_bytes_max); snd_pcm_limit_isa_dma_size(chip->dma1, &runtime->hw.period_bytes_max); @@ -1261,20 +1222,14 @@ static int snd_cs4231_playback_open(snd_pcm_substream_t * substream) if ((err = chip->claim_dma(chip, chip->dma_private_data, chip->dma1)) < 0) return err; } -#endif if ((err = snd_cs4231_open(chip, CS4231_MODE_PLAY)) < 0) { -#ifdef LEGACY_SUPPORT if (chip->release_dma) chip->release_dma(chip, chip->dma_private_data, chip->dma1); -#endif snd_free_pages(runtime->dma_area, runtime->dma_bytes); return err; } chip->playback_substream = substream; -#if defined(SBUS_SUPPORT) || defined(EBUS_SUPPORT) - chip->p_periods_sent = 0; -#endif snd_pcm_set_sync(substream); chip->rate_constraint(runtime); return 0; @@ -1293,7 +1248,6 @@ static int snd_cs4231_capture_open(snd_pcm_substream_t * substream) chip->hardware == CS4231_HW_CS4239) runtime->hw.formats = SNDRV_PCM_FMTBIT_U8 | SNDRV_PCM_FMTBIT_S16_LE; -#ifdef LEGACY_SUPPORT snd_pcm_limit_isa_dma_size(chip->dma2, &runtime->hw.buffer_bytes_max); snd_pcm_limit_isa_dma_size(chip->dma2, &runtime->hw.period_bytes_max); @@ -1301,20 +1255,14 @@ static int snd_cs4231_capture_open(snd_pcm_substream_t * substream) if ((err = chip->claim_dma(chip, chip->dma_private_data, chip->dma2)) < 0) return err; } -#endif if ((err = snd_cs4231_open(chip, CS4231_MODE_RECORD)) < 0) { -#ifdef LEGACY_SUPPORT if (chip->release_dma) chip->release_dma(chip, chip->dma_private_data, chip->dma2); -#endif snd_free_pages(runtime->dma_area, runtime->dma_bytes); return err; } chip->capture_substream = substream; -#if defined(SBUS_SUPPORT) || defined(EBUS_SUPPORT) - chip->c_periods_sent = 0; -#endif snd_pcm_set_sync(substream); chip->rate_constraint(runtime); return 0; @@ -1413,8 +1361,6 @@ static int snd_cs4231_pm_resume(snd_card_t *card) } #endif /* CONFIG_PM */ -#ifdef LEGACY_SUPPORT - static int snd_cs4231_free(cs4231_t *chip) { release_and_free_resource(chip->res_port); @@ -1444,8 +1390,6 @@ static int snd_cs4231_dev_free(snd_device_t *device) return snd_cs4231_free(chip); } -#endif /* LEGACY_SUPPORT */ - const char *snd_cs4231_chip_id(cs4231_t *chip) { switch (chip->hardware) { @@ -1493,8 +1437,6 @@ static int snd_cs4231_new(snd_card_t * card, return 0; } -#ifdef LEGACY_SUPPORT - int snd_cs4231_create(snd_card_t * card, unsigned long port, unsigned long cport, @@ -1581,8 +1523,6 @@ int snd_cs4231_create(snd_card_t * card, return 0; } -#endif /* LEGACY_SUPPORT */ - static snd_pcm_ops_t snd_cs4231_playback_ops = { .open = snd_cs4231_playback_open, .close = snd_cs4231_playback_close, @@ -1629,27 +1569,9 @@ int snd_cs4231_pcm(cs4231_t *chip, int device, snd_pcm_t **rpcm) pcm->info_flags |= SNDRV_PCM_INFO_JOINT_DUPLEX; strcpy(pcm->name, snd_cs4231_chip_id(chip)); -#ifdef LEGACY_SUPPORT snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, snd_dma_isa_data(), 64*1024, chip->dma1 > 3 || chip->dma2 > 3 ? 128*1024 : 64*1024); -#else -# ifdef EBUS_SUPPORT - if (chip->ebus_flag) { - snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, - chip->dev_u.pdev, - 64*1024, 128*1024); - } else { -# endif -# ifdef SBUS_SUPPORT - snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_SBUS, - chip->dev_u.sdev, - 64*1024, 128*1024); -# endif -# ifdef EBUS_SUPPORT - } -# endif -#endif chip->pcm = pcm; if (rpcm) |