Commit 241b3ee7 authored by Krzysztof Helt's avatar Krzysztof Helt Committed by Jaroslav Kysela

ALSA: wss_lib: use struct snd_wss instead of snd_ad1848

The snd_wss is superset of the snd_ad1848 so kill
the latter and replace it with the snd_wss.
Signed-off-by: default avatarKrzysztof Helt <krzysztof.h1@wp.pl>
Reviewed-by: default avatarRene Herman <rene.herman@gmail.com>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
Signed-off-by: default avatarJaroslav Kysela <perex@perex.cz>
parent 7779f75f
...@@ -25,6 +25,8 @@ ...@@ -25,6 +25,8 @@
#include "pcm.h" #include "pcm.h"
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include "wss.h" /* temporary till the driver is removed */
/* IO ports */ /* IO ports */
#define AD1848P( chip, x ) ( (chip) -> port + c_d_c_AD1848##x ) #define AD1848P( chip, x ) ( (chip) -> port + c_d_c_AD1848##x )
...@@ -127,48 +129,20 @@ ...@@ -127,48 +129,20 @@
#define AD1848_THINKPAD_CTL_PORT2 0x15e9 #define AD1848_THINKPAD_CTL_PORT2 0x15e9
#define AD1848_THINKPAD_CS4248_ENABLE_BIT 0x02 #define AD1848_THINKPAD_CS4248_ENABLE_BIT 0x02
struct snd_ad1848 {
unsigned long port; /* i/o port */
struct resource *res_port;
int irq; /* IRQ line */
int dma; /* data DMA */
unsigned short version; /* version of CODEC chip */
unsigned short mode; /* see to AD1848_MODE_XXXX */
unsigned short hardware; /* see to AD1848_HW_XXXX */
unsigned short single_dma:1; /* forced single DMA mode (GUS 16-bit daughter board) or dma1 == dma2 */
struct snd_pcm *pcm;
struct snd_pcm_substream *playback_substream;
struct snd_pcm_substream *capture_substream;
struct snd_card *card;
unsigned char image[32]; /* SGalaxy needs an access to extended registers */
int mce_bit;
int calibrate_mute;
int dma_size;
int thinkpad_flag; /* Thinkpad CS4248 needs some extra help */
#ifdef CONFIG_PM
void (*suspend)(struct snd_ad1848 *chip);
void (*resume)(struct snd_ad1848 *chip);
#endif
spinlock_t reg_lock;
};
/* exported functions */ /* exported functions */
void snd_ad1848_out(struct snd_ad1848 *chip, unsigned char reg, unsigned char value); void snd_ad1848_out(struct snd_wss *chip, unsigned char reg,
unsigned char value);
int snd_ad1848_create(struct snd_card *card, int snd_ad1848_create(struct snd_card *card,
unsigned long port, unsigned long port,
int irq, int dma, int irq, int dma,
unsigned short hardware, unsigned short hardware,
struct snd_ad1848 ** chip); struct snd_wss **chip);
int snd_ad1848_pcm(struct snd_ad1848 * chip, int device, struct snd_pcm **rpcm); int snd_ad1848_pcm(struct snd_wss *chip, int device, struct snd_pcm **rpcm);
const struct snd_pcm_ops *snd_ad1848_get_pcm_ops(int direction); const struct snd_pcm_ops *snd_ad1848_get_pcm_ops(int direction);
int snd_ad1848_mixer(struct snd_ad1848 * chip); int snd_ad1848_mixer(struct snd_wss *chip);
/* exported mixer stuffs */ /* exported mixer stuffs */
enum { AD1848_MIX_SINGLE, AD1848_MIX_DOUBLE, AD1848_MIX_CAPTURE }; enum { AD1848_MIX_SINGLE, AD1848_MIX_DOUBLE, AD1848_MIX_CAPTURE };
...@@ -213,6 +187,7 @@ struct ad1848_mix_elem { ...@@ -213,6 +187,7 @@ struct ad1848_mix_elem {
.private_value = AD1848_MIXVAL_DOUBLE(left_reg, right_reg, shift_left, shift_right, mask, invert), \ .private_value = AD1848_MIXVAL_DOUBLE(left_reg, right_reg, shift_left, shift_right, mask, invert), \
.tlv = xtlv } .tlv = xtlv }
int snd_ad1848_add_ctl_elem(struct snd_ad1848 *chip, const struct ad1848_mix_elem *c); int snd_ad1848_add_ctl_elem(struct snd_wss *chip,
const struct ad1848_mix_elem *c);
#endif /* __SOUND_AD1848_H */ #endif /* __SOUND_AD1848_H */
...@@ -77,8 +77,10 @@ struct snd_wss { ...@@ -77,8 +77,10 @@ struct snd_wss {
unsigned short mode; /* see to WSS_MODE_XXXX */ unsigned short mode; /* see to WSS_MODE_XXXX */
unsigned short hardware; /* see to WSS_HW_XXXX */ unsigned short hardware; /* see to WSS_HW_XXXX */
unsigned short hwshare; /* shared resources */ unsigned short hwshare; /* shared resources */
unsigned short single_dma:1, /* forced single DMA mode (GUS 16-bit daughter board) or dma1 == dma2 */ unsigned short single_dma:1, /* forced single DMA mode (GUS 16-bit */
ebus_flag:1; /* SPARC: EBUS present */ /* daughter board) or dma1 == dma2 */
ebus_flag:1, /* SPARC: EBUS present */
thinkpad_flag:1; /* Thinkpad CS4248 needs extra help */
struct snd_card *card; struct snd_card *card;
struct snd_pcm *pcm; struct snd_pcm *pcm;
......
...@@ -87,7 +87,7 @@ static int __devinit snd_ad1848_match(struct device *dev, unsigned int n) ...@@ -87,7 +87,7 @@ static int __devinit snd_ad1848_match(struct device *dev, unsigned int n)
static int __devinit snd_ad1848_probe(struct device *dev, unsigned int n) static int __devinit snd_ad1848_probe(struct device *dev, unsigned int n)
{ {
struct snd_card *card; struct snd_card *card;
struct snd_ad1848 *chip; struct snd_wss *chip;
struct snd_pcm *pcm; struct snd_pcm *pcm;
int error; int error;
...@@ -142,7 +142,7 @@ static int __devexit snd_ad1848_remove(struct device *dev, unsigned int n) ...@@ -142,7 +142,7 @@ static int __devexit snd_ad1848_remove(struct device *dev, unsigned int n)
static int snd_ad1848_suspend(struct device *dev, unsigned int n, pm_message_t state) static int snd_ad1848_suspend(struct device *dev, unsigned int n, pm_message_t state)
{ {
struct snd_card *card = dev_get_drvdata(dev); struct snd_card *card = dev_get_drvdata(dev);
struct snd_ad1848 *chip = card->private_data; struct snd_wss *chip = card->private_data;
snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); snd_power_change_state(card, SNDRV_CTL_POWER_D3hot);
chip->suspend(chip); chip->suspend(chip);
...@@ -152,7 +152,7 @@ static int snd_ad1848_suspend(struct device *dev, unsigned int n, pm_message_t s ...@@ -152,7 +152,7 @@ static int snd_ad1848_suspend(struct device *dev, unsigned int n, pm_message_t s
static int snd_ad1848_resume(struct device *dev, unsigned int n) static int snd_ad1848_resume(struct device *dev, unsigned int n)
{ {
struct snd_card *card = dev_get_drvdata(dev); struct snd_card *card = dev_get_drvdata(dev);
struct snd_ad1848 *chip = card->private_data; struct snd_wss *chip = card->private_data;
chip->resume(chip); chip->resume(chip);
snd_power_change_state(card, SNDRV_CTL_POWER_D0); snd_power_change_state(card, SNDRV_CTL_POWER_D0);
......
...@@ -98,7 +98,7 @@ static unsigned char snd_ad1848_original_image[16] = ...@@ -98,7 +98,7 @@ static unsigned char snd_ad1848_original_image[16] =
* Basic I/O functions * Basic I/O functions
*/ */
static void snd_ad1848_wait(struct snd_ad1848 *chip) static void snd_ad1848_wait(struct snd_wss *chip)
{ {
int timeout; int timeout;
...@@ -109,7 +109,7 @@ static void snd_ad1848_wait(struct snd_ad1848 *chip) ...@@ -109,7 +109,7 @@ static void snd_ad1848_wait(struct snd_ad1848 *chip)
} }
} }
void snd_ad1848_out(struct snd_ad1848 *chip, void snd_ad1848_out(struct snd_wss *chip,
unsigned char reg, unsigned char reg,
unsigned char value) unsigned char value)
{ {
...@@ -128,7 +128,7 @@ void snd_ad1848_out(struct snd_ad1848 *chip, ...@@ -128,7 +128,7 @@ void snd_ad1848_out(struct snd_ad1848 *chip,
EXPORT_SYMBOL(snd_ad1848_out); EXPORT_SYMBOL(snd_ad1848_out);
static void snd_ad1848_dout(struct snd_ad1848 *chip, static void snd_ad1848_dout(struct snd_wss *chip,
unsigned char reg, unsigned char value) unsigned char reg, unsigned char value)
{ {
snd_ad1848_wait(chip); snd_ad1848_wait(chip);
...@@ -137,7 +137,7 @@ static void snd_ad1848_dout(struct snd_ad1848 *chip, ...@@ -137,7 +137,7 @@ static void snd_ad1848_dout(struct snd_ad1848 *chip,
mb(); mb();
} }
static unsigned char snd_ad1848_in(struct snd_ad1848 *chip, unsigned char reg) static unsigned char snd_ad1848_in(struct snd_wss *chip, unsigned char reg)
{ {
snd_ad1848_wait(chip); snd_ad1848_wait(chip);
#ifdef CONFIG_SND_DEBUG #ifdef CONFIG_SND_DEBUG
...@@ -152,7 +152,7 @@ static unsigned char snd_ad1848_in(struct snd_ad1848 *chip, unsigned char reg) ...@@ -152,7 +152,7 @@ static unsigned char snd_ad1848_in(struct snd_ad1848 *chip, unsigned char reg)
#if 0 #if 0
static void snd_ad1848_debug(struct snd_ad1848 *chip) static void snd_ad1848_debug(struct snd_wss *chip)
{ {
printk("AD1848 REGS: INDEX = 0x%02x ", inb(AD1848P(chip, REGSEL))); printk("AD1848 REGS: INDEX = 0x%02x ", inb(AD1848P(chip, REGSEL)));
printk(" STATUS = 0x%02x\n", inb(AD1848P(chip, STATUS))); printk(" STATUS = 0x%02x\n", inb(AD1848P(chip, STATUS)));
...@@ -180,7 +180,7 @@ static void snd_ad1848_debug(struct snd_ad1848 *chip) ...@@ -180,7 +180,7 @@ static void snd_ad1848_debug(struct snd_ad1848 *chip)
* AD1848 detection / MCE routines * AD1848 detection / MCE routines
*/ */
static void snd_ad1848_mce_up(struct snd_ad1848 *chip) static void snd_ad1848_mce_up(struct snd_wss *chip)
{ {
unsigned long flags; unsigned long flags;
int timeout; int timeout;
...@@ -200,7 +200,7 @@ static void snd_ad1848_mce_up(struct snd_ad1848 *chip) ...@@ -200,7 +200,7 @@ static void snd_ad1848_mce_up(struct snd_ad1848 *chip)
spin_unlock_irqrestore(&chip->reg_lock, flags); spin_unlock_irqrestore(&chip->reg_lock, flags);
} }
static void snd_ad1848_mce_down(struct snd_ad1848 *chip) static void snd_ad1848_mce_down(struct snd_wss *chip)
{ {
unsigned long flags, timeout; unsigned long flags, timeout;
int reg; int reg;
...@@ -268,7 +268,7 @@ static unsigned int snd_ad1848_get_count(unsigned char format, ...@@ -268,7 +268,7 @@ static unsigned int snd_ad1848_get_count(unsigned char format,
return size; return size;
} }
static int snd_ad1848_trigger(struct snd_ad1848 *chip, unsigned char what, static int snd_ad1848_trigger(struct snd_wss *chip, unsigned char what,
int channel, int cmd) int channel, int cmd)
{ {
int result = 0; int result = 0;
...@@ -337,7 +337,7 @@ static unsigned char snd_ad1848_get_format(int format, int channels) ...@@ -337,7 +337,7 @@ static unsigned char snd_ad1848_get_format(int format, int channels)
return rformat; return rformat;
} }
static void snd_ad1848_calibrate_mute(struct snd_ad1848 *chip, int mute) static void snd_ad1848_calibrate_mute(struct snd_wss *chip, int mute)
{ {
unsigned long flags; unsigned long flags;
...@@ -361,7 +361,8 @@ static void snd_ad1848_calibrate_mute(struct snd_ad1848 *chip, int mute) ...@@ -361,7 +361,8 @@ static void snd_ad1848_calibrate_mute(struct snd_ad1848 *chip, int mute)
spin_unlock_irqrestore(&chip->reg_lock, flags); spin_unlock_irqrestore(&chip->reg_lock, flags);
} }
static void snd_ad1848_set_data_format(struct snd_ad1848 *chip, struct snd_pcm_hw_params *hw_params) static void snd_ad1848_set_data_format(struct snd_wss *chip,
struct snd_pcm_hw_params *hw_params)
{ {
if (hw_params == NULL) { if (hw_params == NULL) {
chip->image[AD1848_DATA_FORMAT] = 0x20; chip->image[AD1848_DATA_FORMAT] = 0x20;
...@@ -373,7 +374,7 @@ static void snd_ad1848_set_data_format(struct snd_ad1848 *chip, struct snd_pcm_h ...@@ -373,7 +374,7 @@ static void snd_ad1848_set_data_format(struct snd_ad1848 *chip, struct snd_pcm_h
// snd_printk(">>> pmode = 0x%x, dfr = 0x%x\n", pstr->mode, chip->image[AD1848_DATA_FORMAT]); // snd_printk(">>> pmode = 0x%x, dfr = 0x%x\n", pstr->mode, chip->image[AD1848_DATA_FORMAT]);
} }
static int snd_ad1848_open(struct snd_ad1848 *chip, unsigned int mode) static int snd_ad1848_open(struct snd_wss *chip, unsigned int mode)
{ {
unsigned long flags; unsigned long flags;
...@@ -424,7 +425,7 @@ static int snd_ad1848_open(struct snd_ad1848 *chip, unsigned int mode) ...@@ -424,7 +425,7 @@ static int snd_ad1848_open(struct snd_ad1848 *chip, unsigned int mode)
return 0; return 0;
} }
static void snd_ad1848_close(struct snd_ad1848 *chip) static void snd_ad1848_close(struct snd_wss *chip)
{ {
unsigned long flags; unsigned long flags;
...@@ -464,21 +465,21 @@ static void snd_ad1848_close(struct snd_ad1848 *chip) ...@@ -464,21 +465,21 @@ static void snd_ad1848_close(struct snd_ad1848 *chip)
static int snd_ad1848_playback_trigger(struct snd_pcm_substream *substream, static int snd_ad1848_playback_trigger(struct snd_pcm_substream *substream,
int cmd) int cmd)
{ {
struct snd_ad1848 *chip = snd_pcm_substream_chip(substream); struct snd_wss *chip = snd_pcm_substream_chip(substream);
return snd_ad1848_trigger(chip, AD1848_PLAYBACK_ENABLE, SNDRV_PCM_STREAM_PLAYBACK, cmd); return snd_ad1848_trigger(chip, AD1848_PLAYBACK_ENABLE, SNDRV_PCM_STREAM_PLAYBACK, cmd);
} }
static int snd_ad1848_capture_trigger(struct snd_pcm_substream *substream, static int snd_ad1848_capture_trigger(struct snd_pcm_substream *substream,
int cmd) int cmd)
{ {
struct snd_ad1848 *chip = snd_pcm_substream_chip(substream); struct snd_wss *chip = snd_pcm_substream_chip(substream);
return snd_ad1848_trigger(chip, AD1848_CAPTURE_ENABLE, SNDRV_PCM_STREAM_CAPTURE, cmd); return snd_ad1848_trigger(chip, AD1848_CAPTURE_ENABLE, SNDRV_PCM_STREAM_CAPTURE, cmd);
} }
static int snd_ad1848_playback_hw_params(struct snd_pcm_substream *substream, static int snd_ad1848_playback_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *hw_params) struct snd_pcm_hw_params *hw_params)
{ {
struct snd_ad1848 *chip = snd_pcm_substream_chip(substream); struct snd_wss *chip = snd_pcm_substream_chip(substream);
unsigned long flags; unsigned long flags;
int err; int err;
...@@ -502,15 +503,16 @@ static int snd_ad1848_playback_hw_free(struct snd_pcm_substream *substream) ...@@ -502,15 +503,16 @@ static int snd_ad1848_playback_hw_free(struct snd_pcm_substream *substream)
static int snd_ad1848_playback_prepare(struct snd_pcm_substream *substream) static int snd_ad1848_playback_prepare(struct snd_pcm_substream *substream)
{ {
struct snd_ad1848 *chip = snd_pcm_substream_chip(substream); struct snd_wss *chip = snd_pcm_substream_chip(substream);
struct snd_pcm_runtime *runtime = substream->runtime; struct snd_pcm_runtime *runtime = substream->runtime;
unsigned long flags; unsigned long flags;
unsigned int size = snd_pcm_lib_buffer_bytes(substream); unsigned int size = snd_pcm_lib_buffer_bytes(substream);
unsigned int count = snd_pcm_lib_period_bytes(substream); unsigned int count = snd_pcm_lib_period_bytes(substream);
chip->dma_size = size; chip->p_dma_size = size;
chip->image[AD1848_IFACE_CTRL] &= ~(AD1848_PLAYBACK_ENABLE | AD1848_PLAYBACK_PIO); chip->image[AD1848_IFACE_CTRL] &= ~(AD1848_PLAYBACK_ENABLE | AD1848_PLAYBACK_PIO);
snd_dma_program(chip->dma, runtime->dma_addr, size, DMA_MODE_WRITE | DMA_AUTOINIT); snd_dma_program(chip->dma1, runtime->dma_addr, size,
DMA_MODE_WRITE | DMA_AUTOINIT);
count = snd_ad1848_get_count(chip->image[AD1848_DATA_FORMAT], count) - 1; count = snd_ad1848_get_count(chip->image[AD1848_DATA_FORMAT], count) - 1;
spin_lock_irqsave(&chip->reg_lock, flags); spin_lock_irqsave(&chip->reg_lock, flags);
snd_ad1848_out(chip, AD1848_DATA_LWR_CNT, (unsigned char) count); snd_ad1848_out(chip, AD1848_DATA_LWR_CNT, (unsigned char) count);
...@@ -522,7 +524,7 @@ static int snd_ad1848_playback_prepare(struct snd_pcm_substream *substream) ...@@ -522,7 +524,7 @@ static int snd_ad1848_playback_prepare(struct snd_pcm_substream *substream)
static int snd_ad1848_capture_hw_params(struct snd_pcm_substream *substream, static int snd_ad1848_capture_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *hw_params) struct snd_pcm_hw_params *hw_params)
{ {
struct snd_ad1848 *chip = snd_pcm_substream_chip(substream); struct snd_wss *chip = snd_pcm_substream_chip(substream);
unsigned long flags; unsigned long flags;
int err; int err;
...@@ -546,15 +548,16 @@ static int snd_ad1848_capture_hw_free(struct snd_pcm_substream *substream) ...@@ -546,15 +548,16 @@ static int snd_ad1848_capture_hw_free(struct snd_pcm_substream *substream)
static int snd_ad1848_capture_prepare(struct snd_pcm_substream *substream) static int snd_ad1848_capture_prepare(struct snd_pcm_substream *substream)
{ {
struct snd_ad1848 *chip = snd_pcm_substream_chip(substream); struct snd_wss *chip = snd_pcm_substream_chip(substream);
struct snd_pcm_runtime *runtime = substream->runtime; struct snd_pcm_runtime *runtime = substream->runtime;
unsigned long flags; unsigned long flags;
unsigned int size = snd_pcm_lib_buffer_bytes(substream); unsigned int size = snd_pcm_lib_buffer_bytes(substream);
unsigned int count = snd_pcm_lib_period_bytes(substream); unsigned int count = snd_pcm_lib_period_bytes(substream);
chip->dma_size = size; chip->c_dma_size = size;
chip->image[AD1848_IFACE_CTRL] &= ~(AD1848_CAPTURE_ENABLE | AD1848_CAPTURE_PIO); chip->image[AD1848_IFACE_CTRL] &= ~(AD1848_CAPTURE_ENABLE | AD1848_CAPTURE_PIO);
snd_dma_program(chip->dma, runtime->dma_addr, size, DMA_MODE_READ | DMA_AUTOINIT); snd_dma_program(chip->dma2, runtime->dma_addr, size,
DMA_MODE_READ | DMA_AUTOINIT);
count = snd_ad1848_get_count(chip->image[AD1848_DATA_FORMAT], count) - 1; count = snd_ad1848_get_count(chip->image[AD1848_DATA_FORMAT], count) - 1;
spin_lock_irqsave(&chip->reg_lock, flags); spin_lock_irqsave(&chip->reg_lock, flags);
snd_ad1848_out(chip, AD1848_DATA_LWR_CNT, (unsigned char) count); snd_ad1848_out(chip, AD1848_DATA_LWR_CNT, (unsigned char) count);
...@@ -565,7 +568,7 @@ static int snd_ad1848_capture_prepare(struct snd_pcm_substream *substream) ...@@ -565,7 +568,7 @@ static int snd_ad1848_capture_prepare(struct snd_pcm_substream *substream)
static irqreturn_t snd_ad1848_interrupt(int irq, void *dev_id) static irqreturn_t snd_ad1848_interrupt(int irq, void *dev_id)
{ {
struct snd_ad1848 *chip = dev_id; struct snd_wss *chip = dev_id;
if ((chip->mode & AD1848_MODE_PLAY) && chip->playback_substream && if ((chip->mode & AD1848_MODE_PLAY) && chip->playback_substream &&
(chip->mode & AD1848_MODE_RUNNING)) (chip->mode & AD1848_MODE_RUNNING))
...@@ -579,23 +582,23 @@ static irqreturn_t snd_ad1848_interrupt(int irq, void *dev_id) ...@@ -579,23 +582,23 @@ static irqreturn_t snd_ad1848_interrupt(int irq, void *dev_id)
static snd_pcm_uframes_t snd_ad1848_playback_pointer(struct snd_pcm_substream *substream) static snd_pcm_uframes_t snd_ad1848_playback_pointer(struct snd_pcm_substream *substream)
{ {
struct snd_ad1848 *chip = snd_pcm_substream_chip(substream); struct snd_wss *chip = snd_pcm_substream_chip(substream);
size_t ptr; size_t ptr;
if (!(chip->image[AD1848_IFACE_CTRL] & AD1848_PLAYBACK_ENABLE)) if (!(chip->image[AD1848_IFACE_CTRL] & AD1848_PLAYBACK_ENABLE))
return 0; return 0;
ptr = snd_dma_pointer(chip->dma, chip->dma_size); ptr = snd_dma_pointer(chip->dma1, chip->p_dma_size);
return bytes_to_frames(substream->runtime, ptr); return bytes_to_frames(substream->runtime, ptr);
} }
static snd_pcm_uframes_t snd_ad1848_capture_pointer(struct snd_pcm_substream *substream) static snd_pcm_uframes_t snd_ad1848_capture_pointer(struct snd_pcm_substream *substream)
{ {
struct snd_ad1848 *chip = snd_pcm_substream_chip(substream); struct snd_wss *chip = snd_pcm_substream_chip(substream);
size_t ptr; size_t ptr;
if (!(chip->image[AD1848_IFACE_CTRL] & AD1848_CAPTURE_ENABLE)) if (!(chip->image[AD1848_IFACE_CTRL] & AD1848_CAPTURE_ENABLE))
return 0; return 0;
ptr = snd_dma_pointer(chip->dma, chip->dma_size); ptr = snd_dma_pointer(chip->dma2, chip->c_dma_size);
return bytes_to_frames(substream->runtime, ptr); return bytes_to_frames(substream->runtime, ptr);
} }
...@@ -603,8 +606,8 @@ static snd_pcm_uframes_t snd_ad1848_capture_pointer(struct snd_pcm_substream *su ...@@ -603,8 +606,8 @@ static snd_pcm_uframes_t snd_ad1848_capture_pointer(struct snd_pcm_substream *su
*/ */
static void snd_ad1848_thinkpad_twiddle(struct snd_ad1848 *chip, int on) { static void snd_ad1848_thinkpad_twiddle(struct snd_wss *chip, int on)
{
int tmp; int tmp;
if (!chip->thinkpad_flag) return; if (!chip->thinkpad_flag) return;
...@@ -624,14 +627,14 @@ static void snd_ad1848_thinkpad_twiddle(struct snd_ad1848 *chip, int on) { ...@@ -624,14 +627,14 @@ static void snd_ad1848_thinkpad_twiddle(struct snd_ad1848 *chip, int on) {
} }
#ifdef CONFIG_PM #ifdef CONFIG_PM
static void snd_ad1848_suspend(struct snd_ad1848 *chip) static void snd_ad1848_suspend(struct snd_wss *chip)
{ {
snd_pcm_suspend_all(chip->pcm); snd_pcm_suspend_all(chip->pcm);
if (chip->thinkpad_flag) if (chip->thinkpad_flag)
snd_ad1848_thinkpad_twiddle(chip, 0); snd_ad1848_thinkpad_twiddle(chip, 0);
} }
static void snd_ad1848_resume(struct snd_ad1848 *chip) static void snd_ad1848_resume(struct snd_wss *chip)
{ {
int i; int i;
...@@ -651,7 +654,7 @@ static void snd_ad1848_resume(struct snd_ad1848 *chip) ...@@ -651,7 +654,7 @@ static void snd_ad1848_resume(struct snd_ad1848 *chip)
} }
#endif /* CONFIG_PM */ #endif /* CONFIG_PM */
static int snd_ad1848_probe(struct snd_ad1848 * chip) static int snd_ad1848_probe(struct snd_wss *chip)
{ {
unsigned long flags; unsigned long flags;
int i, id, rev, ad1847; int i, id, rev, ad1847;
...@@ -775,7 +778,7 @@ static struct snd_pcm_hardware snd_ad1848_capture = ...@@ -775,7 +778,7 @@ static struct snd_pcm_hardware snd_ad1848_capture =
static int snd_ad1848_playback_open(struct snd_pcm_substream *substream) static int snd_ad1848_playback_open(struct snd_pcm_substream *substream)
{ {
struct snd_ad1848 *chip = snd_pcm_substream_chip(substream); struct snd_wss *chip = snd_pcm_substream_chip(substream);
struct snd_pcm_runtime *runtime = substream->runtime; struct snd_pcm_runtime *runtime = substream->runtime;
int err; int err;
...@@ -783,15 +786,15 @@ static int snd_ad1848_playback_open(struct snd_pcm_substream *substream) ...@@ -783,15 +786,15 @@ static int snd_ad1848_playback_open(struct snd_pcm_substream *substream)
return err; return err;
chip->playback_substream = substream; chip->playback_substream = substream;
runtime->hw = snd_ad1848_playback; runtime->hw = snd_ad1848_playback;
snd_pcm_limit_isa_dma_size(chip->dma, &runtime->hw.buffer_bytes_max); snd_pcm_limit_isa_dma_size(chip->dma1, &runtime->hw.buffer_bytes_max);
snd_pcm_limit_isa_dma_size(chip->dma, &runtime->hw.period_bytes_max); snd_pcm_limit_isa_dma_size(chip->dma1, &runtime->hw.period_bytes_max);
snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_RATE, &hw_constraints_rates); snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_RATE, &hw_constraints_rates);
return 0; return 0;
} }
static int snd_ad1848_capture_open(struct snd_pcm_substream *substream) static int snd_ad1848_capture_open(struct snd_pcm_substream *substream)
{ {
struct snd_ad1848 *chip = snd_pcm_substream_chip(substream); struct snd_wss *chip = snd_pcm_substream_chip(substream);
struct snd_pcm_runtime *runtime = substream->runtime; struct snd_pcm_runtime *runtime = substream->runtime;
int err; int err;
...@@ -799,15 +802,15 @@ static int snd_ad1848_capture_open(struct snd_pcm_substream *substream) ...@@ -799,15 +802,15 @@ static int snd_ad1848_capture_open(struct snd_pcm_substream *substream)
return err; return err;
chip->capture_substream = substream; chip->capture_substream = substream;
runtime->hw = snd_ad1848_capture; runtime->hw = snd_ad1848_capture;
snd_pcm_limit_isa_dma_size(chip->dma, &runtime->hw.buffer_bytes_max); snd_pcm_limit_isa_dma_size(chip->dma2, &runtime->hw.buffer_bytes_max);
snd_pcm_limit_isa_dma_size(chip->dma, &runtime->hw.period_bytes_max); snd_pcm_limit_isa_dma_size(chip->dma2, &runtime->hw.period_bytes_max);
snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_RATE, &hw_constraints_rates); snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_RATE, &hw_constraints_rates);
return 0; return 0;
} }
static int snd_ad1848_playback_close(struct snd_pcm_substream *substream) static int snd_ad1848_playback_close(struct snd_pcm_substream *substream)
{ {
struct snd_ad1848 *chip = snd_pcm_substream_chip(substream); struct snd_wss *chip = snd_pcm_substream_chip(substream);
chip->mode &= ~AD1848_MODE_PLAY; chip->mode &= ~AD1848_MODE_PLAY;
chip->playback_substream = NULL; chip->playback_substream = NULL;
...@@ -817,7 +820,7 @@ static int snd_ad1848_playback_close(struct snd_pcm_substream *substream) ...@@ -817,7 +820,7 @@ static int snd_ad1848_playback_close(struct snd_pcm_substream *substream)
static int snd_ad1848_capture_close(struct snd_pcm_substream *substream) static int snd_ad1848_capture_close(struct snd_pcm_substream *substream)
{ {
struct snd_ad1848 *chip = snd_pcm_substream_chip(substream); struct snd_wss *chip = snd_pcm_substream_chip(substream);
chip->mode &= ~AD1848_MODE_CAPTURE; chip->mode &= ~AD1848_MODE_CAPTURE;
chip->capture_substream = NULL; chip->capture_substream = NULL;
...@@ -825,14 +828,14 @@ static int snd_ad1848_capture_close(struct snd_pcm_substream *substream) ...@@ -825,14 +828,14 @@ static int snd_ad1848_capture_close(struct snd_pcm_substream *substream)
return 0; return 0;
} }
static int snd_ad1848_free(struct snd_ad1848 *chip) static int snd_ad1848_free(struct snd_wss *chip)
{ {
release_and_free_resource(chip->res_port); release_and_free_resource(chip->res_port);
if (chip->irq >= 0) if (chip->irq >= 0)
free_irq(chip->irq, (void *) chip); free_irq(chip->irq, (void *) chip);
if (chip->dma >= 0) { if (chip->dma1 >= 0) {
snd_dma_disable(chip->dma); snd_dma_disable(chip->dma1);
free_dma(chip->dma); free_dma(chip->dma1);
} }
kfree(chip); kfree(chip);
return 0; return 0;
...@@ -840,11 +843,11 @@ static int snd_ad1848_free(struct snd_ad1848 *chip) ...@@ -840,11 +843,11 @@ static int snd_ad1848_free(struct snd_ad1848 *chip)
static int snd_ad1848_dev_free(struct snd_device *device) static int snd_ad1848_dev_free(struct snd_device *device)
{ {
struct snd_ad1848 *chip = device->device_data; struct snd_wss *chip = device->device_data;
return snd_ad1848_free(chip); return snd_ad1848_free(chip);
} }
static const char *snd_ad1848_chip_id(struct snd_ad1848 *chip) static const char *snd_ad1848_chip_id(struct snd_wss *chip)
{ {
switch (chip->hardware) { switch (chip->hardware) {
case AD1848_HW_AD1847: return "AD1847"; case AD1848_HW_AD1847: return "AD1847";
...@@ -859,12 +862,12 @@ int snd_ad1848_create(struct snd_card *card, ...@@ -859,12 +862,12 @@ int snd_ad1848_create(struct snd_card *card,
unsigned long port, unsigned long port,
int irq, int dma, int irq, int dma,
unsigned short hardware, unsigned short hardware,
struct snd_ad1848 ** rchip) struct snd_wss **rchip)
{ {
static struct snd_device_ops ops = { static struct snd_device_ops ops = {
.dev_free = snd_ad1848_dev_free, .dev_free = snd_ad1848_dev_free,
}; };
struct snd_ad1848 *chip; struct snd_wss *chip;
int err; int err;
*rchip = NULL; *rchip = NULL;
...@@ -875,7 +878,9 @@ int snd_ad1848_create(struct snd_card *card, ...@@ -875,7 +878,9 @@ int snd_ad1848_create(struct snd_card *card,
chip->card = card; chip->card = card;
chip->port = port; chip->port = port;
chip->irq = -1; chip->irq = -1;
chip->dma = -1; chip->dma1 = -1;
chip->dma2 = -1;
chip->single_dma = 1;
chip->hardware = hardware; chip->hardware = hardware;
memcpy(&chip->image, &snd_ad1848_original_image, sizeof(snd_ad1848_original_image)); memcpy(&chip->image, &snd_ad1848_original_image, sizeof(snd_ad1848_original_image));
...@@ -895,7 +900,8 @@ int snd_ad1848_create(struct snd_card *card, ...@@ -895,7 +900,8 @@ int snd_ad1848_create(struct snd_card *card,
snd_ad1848_free(chip); snd_ad1848_free(chip);
return -EBUSY; return -EBUSY;
} }
chip->dma = dma; chip->dma1 = dma;
chip->dma2 = dma;
if (hardware == AD1848_HW_THINKPAD) { if (hardware == AD1848_HW_THINKPAD) {
chip->thinkpad_flag = 1; chip->thinkpad_flag = 1;
...@@ -947,7 +953,7 @@ static struct snd_pcm_ops snd_ad1848_capture_ops = { ...@@ -947,7 +953,7 @@ static struct snd_pcm_ops snd_ad1848_capture_ops = {
.pointer = snd_ad1848_capture_pointer, .pointer = snd_ad1848_capture_pointer,
}; };
int snd_ad1848_pcm(struct snd_ad1848 *chip, int device, struct snd_pcm **rpcm) int snd_ad1848_pcm(struct snd_wss *chip, int device, struct snd_pcm **rpcm)
{ {
struct snd_pcm *pcm; struct snd_pcm *pcm;
int err; int err;
...@@ -964,7 +970,9 @@ int snd_ad1848_pcm(struct snd_ad1848 *chip, int device, struct snd_pcm **rpcm) ...@@ -964,7 +970,9 @@ int snd_ad1848_pcm(struct snd_ad1848 *chip, int device, struct snd_pcm **rpcm)
snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV,
snd_dma_isa_data(), snd_dma_isa_data(),
64*1024, chip->dma > 3 ? 128*1024 : 64*1024); 64 * 1024,
chip->dma1 > 3 ?
128 * 1024 : 64 * 1024);
chip->pcm = pcm; chip->pcm = pcm;
if (rpcm) if (rpcm)
...@@ -1003,7 +1011,7 @@ static int snd_ad1848_info_mux(struct snd_kcontrol *kcontrol, struct snd_ctl_ele ...@@ -1003,7 +1011,7 @@ static int snd_ad1848_info_mux(struct snd_kcontrol *kcontrol, struct snd_ctl_ele
static int snd_ad1848_get_mux(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) static int snd_ad1848_get_mux(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
{ {
struct snd_ad1848 *chip = snd_kcontrol_chip(kcontrol); struct snd_wss *chip = snd_kcontrol_chip(kcontrol);
unsigned long flags; unsigned long flags;
spin_lock_irqsave(&chip->reg_lock, flags); spin_lock_irqsave(&chip->reg_lock, flags);
...@@ -1015,7 +1023,7 @@ static int snd_ad1848_get_mux(struct snd_kcontrol *kcontrol, struct snd_ctl_elem ...@@ -1015,7 +1023,7 @@ static int snd_ad1848_get_mux(struct snd_kcontrol *kcontrol, struct snd_ctl_elem
static int snd_ad1848_put_mux(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) static int snd_ad1848_put_mux(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
{ {
struct snd_ad1848 *chip = snd_kcontrol_chip(kcontrol); struct snd_wss *chip = snd_kcontrol_chip(kcontrol);
unsigned long flags; unsigned long flags;
unsigned short left, right; unsigned short left, right;
int change; int change;
...@@ -1049,7 +1057,7 @@ static int snd_ad1848_info_single(struct snd_kcontrol *kcontrol, struct snd_ctl_ ...@@ -1049,7 +1057,7 @@ static int snd_ad1848_info_single(struct snd_kcontrol *kcontrol, struct snd_ctl_
static int snd_ad1848_get_single(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) static int snd_ad1848_get_single(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
{ {
struct snd_ad1848 *chip = snd_kcontrol_chip(kcontrol); struct snd_wss *chip = snd_kcontrol_chip(kcontrol);
unsigned long flags; unsigned long flags;
int reg = kcontrol->private_value & 0xff; int reg = kcontrol->private_value & 0xff;
int shift = (kcontrol->private_value >> 8) & 0xff; int shift = (kcontrol->private_value >> 8) & 0xff;
...@@ -1066,7 +1074,7 @@ static int snd_ad1848_get_single(struct snd_kcontrol *kcontrol, struct snd_ctl_e ...@@ -1066,7 +1074,7 @@ static int snd_ad1848_get_single(struct snd_kcontrol *kcontrol, struct snd_ctl_e
static int snd_ad1848_put_single(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) static int snd_ad1848_put_single(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
{ {
struct snd_ad1848 *chip = snd_kcontrol_chip(kcontrol); struct snd_wss *chip = snd_kcontrol_chip(kcontrol);
unsigned long flags; unsigned long flags;
int reg = kcontrol->private_value & 0xff; int reg = kcontrol->private_value & 0xff;
int shift = (kcontrol->private_value >> 8) & 0xff; int shift = (kcontrol->private_value >> 8) & 0xff;
...@@ -1100,7 +1108,7 @@ static int snd_ad1848_info_double(struct snd_kcontrol *kcontrol, struct snd_ctl_ ...@@ -1100,7 +1108,7 @@ static int snd_ad1848_info_double(struct snd_kcontrol *kcontrol, struct snd_ctl_
static int snd_ad1848_get_double(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) static int snd_ad1848_get_double(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
{ {
struct snd_ad1848 *chip = snd_kcontrol_chip(kcontrol); struct snd_wss *chip = snd_kcontrol_chip(kcontrol);
unsigned long flags; unsigned long flags;
int left_reg = kcontrol->private_value & 0xff; int left_reg = kcontrol->private_value & 0xff;
int right_reg = (kcontrol->private_value >> 8) & 0xff; int right_reg = (kcontrol->private_value >> 8) & 0xff;
...@@ -1122,7 +1130,7 @@ static int snd_ad1848_get_double(struct snd_kcontrol *kcontrol, struct snd_ctl_e ...@@ -1122,7 +1130,7 @@ static int snd_ad1848_get_double(struct snd_kcontrol *kcontrol, struct snd_ctl_e
static int snd_ad1848_put_double(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) static int snd_ad1848_put_double(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
{ {
struct snd_ad1848 *chip = snd_kcontrol_chip(kcontrol); struct snd_wss *chip = snd_kcontrol_chip(kcontrol);
unsigned long flags; unsigned long flags;
int left_reg = kcontrol->private_value & 0xff; int left_reg = kcontrol->private_value & 0xff;
int right_reg = (kcontrol->private_value >> 8) & 0xff; int right_reg = (kcontrol->private_value >> 8) & 0xff;
...@@ -1159,7 +1167,7 @@ static int snd_ad1848_put_double(struct snd_kcontrol *kcontrol, struct snd_ctl_e ...@@ -1159,7 +1167,7 @@ static int snd_ad1848_put_double(struct snd_kcontrol *kcontrol, struct snd_ctl_e
/* /*
*/ */
int snd_ad1848_add_ctl_elem(struct snd_ad1848 *chip, int snd_ad1848_add_ctl_elem(struct snd_wss *chip,
const struct ad1848_mix_elem *c) const struct ad1848_mix_elem *c)
{ {
static struct snd_kcontrol_new newctls[] = { static struct snd_kcontrol_new newctls[] = {
...@@ -1227,7 +1235,7 @@ AD1848_SINGLE_TLV("Loopback Capture Volume", 0, AD1848_LOOPBACK, 1, 63, 0, ...@@ -1227,7 +1235,7 @@ AD1848_SINGLE_TLV("Loopback Capture Volume", 0, AD1848_LOOPBACK, 1, 63, 0,
db_scale_6bit), db_scale_6bit),
}; };
int snd_ad1848_mixer(struct snd_ad1848 *chip) int snd_ad1848_mixer(struct snd_wss *chip)
{ {
struct snd_card *card; struct snd_card *card;
struct snd_pcm *pcm; struct snd_pcm *pcm;
......
...@@ -151,7 +151,7 @@ struct snd_cmi8330 { ...@@ -151,7 +151,7 @@ struct snd_cmi8330 {
struct pnp_dev *play; struct pnp_dev *play;
#endif #endif
struct snd_card *card; struct snd_card *card;
struct snd_ad1848 *wss; struct snd_wss *wss;
struct snd_sb *sb; struct snd_sb *sb;
struct snd_pcm *pcm; struct snd_pcm *pcm;
......
...@@ -706,13 +706,9 @@ static int __devinit snd_opti9xx_probe(struct snd_card *card) ...@@ -706,13 +706,9 @@ static int __devinit snd_opti9xx_probe(struct snd_card *card)
static long possible_ports[] = {0x530, 0xe80, 0xf40, 0x604, -1}; static long possible_ports[] = {0x530, 0xe80, 0xf40, 0x604, -1};
int error; int error;
struct snd_opti9xx *chip = card->private_data; struct snd_opti9xx *chip = card->private_data;
#if defined(CS4231) || defined(OPTi93X)
struct snd_wss *codec; struct snd_wss *codec;
#ifdef CS4231 #ifdef CS4231
struct snd_timer *timer; struct snd_timer *timer;
#endif
#else
struct snd_ad1848 *codec;
#endif #endif
struct snd_pcm *pcm; struct snd_pcm *pcm;
struct snd_rawmidi *rmidi; struct snd_rawmidi *rmidi;
......
...@@ -397,7 +397,7 @@ static int __devinit sc6000_init_board(char __iomem *vport, int irq, int dma, ...@@ -397,7 +397,7 @@ static int __devinit sc6000_init_board(char __iomem *vport, int irq, int dma,
return 0; return 0;
} }
static int __devinit snd_sc6000_mixer(struct snd_ad1848 *chip) static int __devinit snd_sc6000_mixer(struct snd_wss *chip)
{ {
struct snd_card *card = chip->card; struct snd_card *card = chip->card;
struct snd_ctl_elem_id id1, id2; struct snd_ctl_elem_id id1, id2;
...@@ -483,7 +483,7 @@ static int __devinit snd_sc6000_probe(struct device *devptr, unsigned int dev) ...@@ -483,7 +483,7 @@ static int __devinit snd_sc6000_probe(struct device *devptr, unsigned int dev)
int xirq = irq[dev]; int xirq = irq[dev];
int xdma = dma[dev]; int xdma = dma[dev];
struct snd_card *card; struct snd_card *card;
struct snd_ad1848 *chip; struct snd_wss *chip;
struct snd_opl3 *opl3; struct snd_opl3 *opl3;
char __iomem *vport; char __iomem *vport;
char __iomem *vmss_port; char __iomem *vmss_port;
......
...@@ -180,7 +180,7 @@ AD1848_DOUBLE("Aux Playback Switch", 0, SGALAXY_AUXC_LEFT, SGALAXY_AUXC_RIGHT, 7 ...@@ -180,7 +180,7 @@ AD1848_DOUBLE("Aux Playback Switch", 0, SGALAXY_AUXC_LEFT, SGALAXY_AUXC_RIGHT, 7
AD1848_DOUBLE("Aux Playback Volume", 0, SGALAXY_AUXC_LEFT, SGALAXY_AUXC_RIGHT, 0, 0, 31, 0) AD1848_DOUBLE("Aux Playback Volume", 0, SGALAXY_AUXC_LEFT, SGALAXY_AUXC_RIGHT, 0, 0, 31, 0)
}; };
static int __devinit snd_sgalaxy_mixer(struct snd_ad1848 *chip) static int __devinit snd_sgalaxy_mixer(struct snd_wss *chip)
{ {
struct snd_card *card = chip->card; struct snd_card *card = chip->card;
struct snd_ctl_elem_id id1, id2; struct snd_ctl_elem_id id1, id2;
...@@ -237,7 +237,7 @@ static int __devinit snd_sgalaxy_probe(struct device *devptr, unsigned int dev) ...@@ -237,7 +237,7 @@ static int __devinit snd_sgalaxy_probe(struct device *devptr, unsigned int dev)
static int possible_dmas[] = {1, 3, 0, -1}; static int possible_dmas[] = {1, 3, 0, -1};
int err, xirq, xdma1; int err, xirq, xdma1;
struct snd_card *card; struct snd_card *card;
struct snd_ad1848 *chip; struct snd_wss *chip;
card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0);
if (card == NULL) if (card == NULL)
...@@ -312,7 +312,7 @@ static int snd_sgalaxy_suspend(struct device *pdev, unsigned int n, ...@@ -312,7 +312,7 @@ static int snd_sgalaxy_suspend(struct device *pdev, unsigned int n,
pm_message_t state) pm_message_t state)
{ {
struct snd_card *card = dev_get_drvdata(pdev); struct snd_card *card = dev_get_drvdata(pdev);
struct snd_ad1848 *chip = card->private_data; struct snd_wss *chip = card->private_data;
snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); snd_power_change_state(card, SNDRV_CTL_POWER_D3hot);
chip->suspend(chip); chip->suspend(chip);
...@@ -322,7 +322,7 @@ static int snd_sgalaxy_suspend(struct device *pdev, unsigned int n, ...@@ -322,7 +322,7 @@ static int snd_sgalaxy_suspend(struct device *pdev, unsigned int n,
static int snd_sgalaxy_resume(struct device *pdev, unsigned int n) static int snd_sgalaxy_resume(struct device *pdev, unsigned int n)
{ {
struct snd_card *card = dev_get_drvdata(pdev); struct snd_card *card = dev_get_drvdata(pdev);
struct snd_ad1848 *chip = card->private_data; struct snd_wss *chip = card->private_data;
chip->resume(chip); chip->resume(chip);
snd_ad1848_out(chip, SGALAXY_AUXC_LEFT, chip->image[SGALAXY_AUXC_LEFT]); snd_ad1848_out(chip, SGALAXY_AUXC_LEFT, chip->image[SGALAXY_AUXC_LEFT]);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment