From 4f272341c7a42a71586523f196b242bccde3be8c Mon Sep 17 00:00:00 2001 From: Tobias Hansen Date: Tue, 22 Sep 2009 16:52:08 +0200 Subject: ALSA: snd-usb-us122l: add support for US-144 Adds support for US-144 when attached on USB1.1. Unlike the US-122L it uses both USB interfaces 0 and 1. Signed-off-by: Tobias Hansen Signed-off-by: Takashi Iwai --- sound/usb/usx2y/us122l.c | 75 ++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 67 insertions(+), 8 deletions(-) (limited to 'sound') diff --git a/sound/usb/usx2y/us122l.c b/sound/usb/usx2y/us122l.c index fd44946ce4b..6c7b64a23c1 100644 --- a/sound/usb/usx2y/us122l.c +++ b/sound/usb/usx2y/us122l.c @@ -66,6 +66,28 @@ static int us122l_create_usbmidi(struct snd_card *card) iface, &quirk); } +static int us144_create_usbmidi(struct snd_card *card) +{ + static struct snd_usb_midi_endpoint_info quirk_data = { + .out_ep = 4, + .in_ep = 3, + .out_cables = 0x001, + .in_cables = 0x001 + }; + static struct snd_usb_audio_quirk quirk = { + .vendor_name = "US144", + .product_name = NAME_ALLCAPS, + .ifnum = 0, + .type = QUIRK_MIDI_US122L, + .data = &quirk_data + }; + struct usb_device *dev = US122L(card)->chip.dev; + struct usb_interface *iface = usb_ifnum_to_if(dev, 0); + + return snd_usb_create_midi_interface(&US122L(card)->chip, + iface, &quirk); +} + /* * Wrapper for usb_control_msg(). * Allocates a temp buffer to prevent dmaing from/to the stack. @@ -171,6 +193,11 @@ static int usb_stream_hwdep_open(struct snd_hwdep *hw, struct file *file) if (!us122l->first) us122l->first = file; + + if (us122l->chip.dev->descriptor.idProduct == USB_ID_US144) { + iface = usb_ifnum_to_if(us122l->chip.dev, 0); + usb_autopm_get_interface(iface); + } iface = usb_ifnum_to_if(us122l->chip.dev, 1); usb_autopm_get_interface(iface); return 0; @@ -179,8 +206,14 @@ static int usb_stream_hwdep_open(struct snd_hwdep *hw, struct file *file) static int usb_stream_hwdep_release(struct snd_hwdep *hw, struct file *file) { struct us122l *us122l = hw->private_data; - struct usb_interface *iface = usb_ifnum_to_if(us122l->chip.dev, 1); + struct usb_interface *iface; snd_printdd(KERN_DEBUG "%p %p\n", hw, file); + + if (us122l->chip.dev->descriptor.idProduct == USB_ID_US144) { + iface = usb_ifnum_to_if(us122l->chip.dev, 0); + usb_autopm_put_interface(iface); + } + iface = usb_ifnum_to_if(us122l->chip.dev, 1); usb_autopm_put_interface(iface); if (us122l->first == file) us122l->first = NULL; @@ -443,6 +476,13 @@ static bool us122l_create_card(struct snd_card *card) int err; struct us122l *us122l = US122L(card); + if (us122l->chip.dev->descriptor.idProduct == USB_ID_US144) { + err = usb_set_interface(us122l->chip.dev, 0, 1); + if (err) { + snd_printk(KERN_ERR "usb_set_interface error \n"); + return false; + } + } err = usb_set_interface(us122l->chip.dev, 1, 1); if (err) { snd_printk(KERN_ERR "usb_set_interface error \n"); @@ -455,7 +495,10 @@ static bool us122l_create_card(struct snd_card *card) if (!us122l_start(us122l, 44100, 256)) return false; - err = us122l_create_usbmidi(card); + if (us122l->chip.dev->descriptor.idProduct == USB_ID_US144) + err = us144_create_usbmidi(card); + else + err = us122l_create_usbmidi(card); if (err < 0) { snd_printk(KERN_ERR "us122l_create_usbmidi error %i \n", err); us122l_stop(us122l); @@ -542,6 +585,7 @@ static int us122l_usb_probe(struct usb_interface *intf, return err; } + usb_get_intf(usb_ifnum_to_if(device, 0)); usb_get_dev(device); *cardp = card; return 0; @@ -550,9 +594,16 @@ static int us122l_usb_probe(struct usb_interface *intf, static int snd_us122l_probe(struct usb_interface *intf, const struct usb_device_id *id) { + struct usb_device *device = interface_to_usbdev(intf); struct snd_card *card; int err; + if (device->descriptor.idProduct == USB_ID_US144 + && device->speed == USB_SPEED_HIGH) { + snd_printk(KERN_ERR "disable ehci-hcd to run US-144 \n"); + return -ENOENT; + } + snd_printdd(KERN_DEBUG"%p:%i\n", intf, intf->cur_altsetting->desc.bInterfaceNumber); if (intf->cur_altsetting->desc.bInterfaceNumber != 1) @@ -591,7 +642,8 @@ static void snd_us122l_disconnect(struct usb_interface *intf) snd_usbmidi_disconnect(p); } - usb_put_intf(intf); + usb_put_intf(usb_ifnum_to_if(us122l->chip.dev, 0)); + usb_put_intf(usb_ifnum_to_if(us122l->chip.dev, 1)); usb_put_dev(us122l->chip.dev); while (atomic_read(&us122l->mmap_count)) @@ -642,6 +694,13 @@ static int snd_us122l_resume(struct usb_interface *intf) mutex_lock(&us122l->mutex); /* needed, doesn't restart without: */ + if (us122l->chip.dev->descriptor.idProduct == USB_ID_US144) { + err = usb_set_interface(us122l->chip.dev, 0, 1); + if (err) { + snd_printk(KERN_ERR "usb_set_interface error \n"); + goto unlock; + } + } err = usb_set_interface(us122l->chip.dev, 1, 1); if (err) { snd_printk(KERN_ERR "usb_set_interface error \n"); @@ -675,11 +734,11 @@ static struct usb_device_id snd_us122l_usb_id_table[] = { .idVendor = 0x0644, .idProduct = USB_ID_US122L }, -/* { */ /* US-144 maybe works when @USB1.1. Untested. */ -/* .match_flags = USB_DEVICE_ID_MATCH_DEVICE, */ -/* .idVendor = 0x0644, */ -/* .idProduct = USB_ID_US144 */ -/* }, */ + { /* US-144 only works at USB1.1! Disable module ehci-hcd. */ + .match_flags = USB_DEVICE_ID_MATCH_DEVICE, + .idVendor = 0x0644, + .idProduct = USB_ID_US144 + }, { /* terminator */ } }; -- cgit v1.2.3 From df0fd5e5e117329436fdea568455545ca18a71f0 Mon Sep 17 00:00:00 2001 From: Cliff Cai Date: Wed, 23 Sep 2009 11:51:05 -0400 Subject: ASoC: Blackfin: fix inverted handling of SPORT0 on PORT F/G Signed-off-by: Cliff Cai Signed-off-by: Barry Song Signed-off-by: Mike Frysinger Signed-off-by: Mark Brown --- sound/soc/blackfin/bf5xx-i2s.c | 8 ++++---- sound/soc/blackfin/bf5xx-tdm.c | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) (limited to 'sound') diff --git a/sound/soc/blackfin/bf5xx-i2s.c b/sound/soc/blackfin/bf5xx-i2s.c index 1e9d161c76c..084b68884ad 100644 --- a/sound/soc/blackfin/bf5xx-i2s.c +++ b/sound/soc/blackfin/bf5xx-i2s.c @@ -77,12 +77,12 @@ static struct sport_param sport_params[2] = { * TFS. When Port G is selected and EMAC then there is a conflict between * the PHY interrupt line and TFS. Current settings prevent the conflict * by ignoring the TFS pin when Port G is selected. This allows both - * ssm2602 using Port G and EMAC concurrently. + * codecs and EMAC using Port G concurrently. */ -#ifdef CONFIG_BF527_SPORT0_PORTF -#define LOCAL_SPORT0_TFS (P_SPORT0_TFS) -#else +#ifdef CONFIG_BF527_SPORT0_PORTG #define LOCAL_SPORT0_TFS (0) +#else +#define LOCAL_SPORT0_TFS (P_SPORT0_TFS) #endif static u16 sport_req[][7] = { {P_SPORT0_DTPRI, P_SPORT0_TSCLK, P_SPORT0_RFS, diff --git a/sound/soc/blackfin/bf5xx-tdm.c b/sound/soc/blackfin/bf5xx-tdm.c index 3096badf09a..ff546e91a22 100644 --- a/sound/soc/blackfin/bf5xx-tdm.c +++ b/sound/soc/blackfin/bf5xx-tdm.c @@ -78,12 +78,12 @@ static struct sport_param sport_params[2] = { * TFS. When Port G is selected and EMAC then there is a conflict between * the PHY interrupt line and TFS. Current settings prevent the conflict * by ignoring the TFS pin when Port G is selected. This allows both - * ssm2602 using Port G and EMAC concurrently. + * codecs and EMAC using Port G concurrently. */ -#ifdef CONFIG_BF527_SPORT0_PORTF -#define LOCAL_SPORT0_TFS (P_SPORT0_TFS) -#else +#ifdef CONFIG_BF527_SPORT0_PORTG #define LOCAL_SPORT0_TFS (0) +#else +#define LOCAL_SPORT0_TFS (P_SPORT0_TFS) #endif static u16 sport_req[][7] = { {P_SPORT0_DTPRI, P_SPORT0_TSCLK, P_SPORT0_RFS, -- cgit v1.2.3 From 81ac55aa14c863821248d9e82694c79bb556694d Mon Sep 17 00:00:00 2001 From: Troy Kisky Date: Fri, 11 Sep 2009 14:29:02 -0700 Subject: ASoC: DaVinci: Fix divide by zero error during 1st execution When both playback and capture stream were open davinci_i2s_hw_params was setting parameters for the wrong stream. The fix for davinci_i2s_hw_params is sufficient, but it looks like a race still happens in davici_pcm_open. This patch also makes the race smaller but the next patch provides a better fix. Signed-off-by: Troy Kisky Signed-off-by: Mark Brown --- sound/soc/davinci/davinci-i2s.c | 3 ++- sound/soc/davinci/davinci-pcm.c | 12 +++++------- 2 files changed, 7 insertions(+), 8 deletions(-) (limited to 'sound') diff --git a/sound/soc/davinci/davinci-i2s.c b/sound/soc/davinci/davinci-i2s.c index 12a6c549ee6..d32e1974fdf 100644 --- a/sound/soc/davinci/davinci-i2s.c +++ b/sound/soc/davinci/davinci-i2s.c @@ -353,8 +353,9 @@ static int davinci_i2s_hw_params(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params, struct snd_soc_dai *dai) { - struct davinci_pcm_dma_params *dma_params = dai->dma_data; struct davinci_mcbsp_dev *dev = dai->private_data; + struct davinci_pcm_dma_params *dma_params = + dev->dma_params[substream->stream]; struct snd_interval *i = NULL; int mcbsp_word_length; unsigned int rcr, xcr, srgr; diff --git a/sound/soc/davinci/davinci-pcm.c b/sound/soc/davinci/davinci-pcm.c index 091dacb78b4..002808b27f4 100644 --- a/sound/soc/davinci/davinci-pcm.c +++ b/sound/soc/davinci/davinci-pcm.c @@ -126,16 +126,9 @@ static void davinci_pcm_dma_irq(unsigned lch, u16 ch_status, void *data) static int davinci_pcm_dma_request(struct snd_pcm_substream *substream) { struct davinci_runtime_data *prtd = substream->runtime->private_data; - struct snd_soc_pcm_runtime *rtd = substream->private_data; - struct davinci_pcm_dma_params *dma_data = rtd->dai->cpu_dai->dma_data; struct edmacc_param p_ram; int ret; - if (!dma_data) - return -ENODEV; - - prtd->params = dma_data; - /* Request master DMA channel */ ret = edma_alloc_channel(prtd->params->channel, davinci_pcm_dma_irq, substream, @@ -244,6 +237,10 @@ static int davinci_pcm_open(struct snd_pcm_substream *substream) struct snd_pcm_runtime *runtime = substream->runtime; struct davinci_runtime_data *prtd; int ret = 0; + struct snd_soc_pcm_runtime *rtd = substream->private_data; + struct davinci_pcm_dma_params *params = rtd->dai->cpu_dai->dma_data; + if (!params) + return -ENODEV; snd_soc_set_runtime_hwparams(substream, &davinci_pcm_hardware); /* ensure that buffer size is a multiple of period size */ @@ -257,6 +254,7 @@ static int davinci_pcm_open(struct snd_pcm_substream *substream) return -ENOMEM; spin_lock_init(&prtd->lock); + prtd->params = params; runtime->private_data = prtd; -- cgit v1.2.3 From 92e2a6f68219f8d4c862b1f29c653b05639e4c06 Mon Sep 17 00:00:00 2001 From: Troy Kisky Date: Fri, 11 Sep 2009 14:29:03 -0700 Subject: ASoC: Davinci: Fix race with cpu_dai->dma_data This patch removes references to cpu_dai->dma_data. It makes struct davinci_pcm_dma_params part of struct davinci_mcbsp_dev or struct davinci_audio_dev. It removes the unused name variable from davinci_pcm_dma_params. Signed-off-by: Troy Kisky Signed-off-by: Mark Brown --- sound/soc/davinci/davinci-i2s.c | 36 ++++++++++---------------------- sound/soc/davinci/davinci-mcasp.c | 44 +++++++++------------------------------ sound/soc/davinci/davinci-mcasp.h | 7 ++++++- sound/soc/davinci/davinci-pcm.c | 3 ++- sound/soc/davinci/davinci-pcm.h | 1 - 5 files changed, 29 insertions(+), 62 deletions(-) (limited to 'sound') diff --git a/sound/soc/davinci/davinci-i2s.c b/sound/soc/davinci/davinci-i2s.c index d32e1974fdf..4ae70704802 100644 --- a/sound/soc/davinci/davinci-i2s.c +++ b/sound/soc/davinci/davinci-i2s.c @@ -97,22 +97,19 @@ enum { DAVINCI_MCBSP_WORD_32, }; -static struct davinci_pcm_dma_params davinci_i2s_pcm_out = { - .name = "I2S PCM Stereo out", -}; - -static struct davinci_pcm_dma_params davinci_i2s_pcm_in = { - .name = "I2S PCM Stereo in", -}; - struct davinci_mcbsp_dev { + /* + * dma_params must be first because rtd->dai->cpu_dai->private_data + * is cast to a pointer of an array of struct davinci_pcm_dma_params in + * davinci_pcm_open. + */ + struct davinci_pcm_dma_params dma_params[2]; void __iomem *base; #define MOD_DSP_A 0 #define MOD_DSP_B 1 int mode; u32 pcr; struct clk *clk; - struct davinci_pcm_dma_params *dma_params[2]; }; static inline void davinci_mcbsp_write_reg(struct davinci_mcbsp_dev *dev, @@ -215,14 +212,6 @@ static void davinci_mcbsp_stop(struct davinci_mcbsp_dev *dev, int playback) toggle_clock(dev, playback); } -static int davinci_i2s_startup(struct snd_pcm_substream *substream, - struct snd_soc_dai *cpu_dai) -{ - struct davinci_mcbsp_dev *dev = cpu_dai->private_data; - cpu_dai->dma_data = dev->dma_params[substream->stream]; - return 0; -} - #define DEFAULT_BITPERSAMPLE 16 static int davinci_i2s_set_dai_fmt(struct snd_soc_dai *cpu_dai, @@ -355,7 +344,7 @@ static int davinci_i2s_hw_params(struct snd_pcm_substream *substream, { struct davinci_mcbsp_dev *dev = dai->private_data; struct davinci_pcm_dma_params *dma_params = - dev->dma_params[substream->stream]; + &dev->dma_params[substream->stream]; struct snd_interval *i = NULL; int mcbsp_word_length; unsigned int rcr, xcr, srgr; @@ -473,7 +462,6 @@ static void davinci_i2s_shutdown(struct snd_pcm_substream *substream, #define DAVINCI_I2S_RATES SNDRV_PCM_RATE_8000_96000 static struct snd_soc_dai_ops davinci_i2s_dai_ops = { - .startup = davinci_i2s_startup, .shutdown = davinci_i2s_shutdown, .prepare = davinci_i2s_prepare, .trigger = davinci_i2s_trigger, @@ -535,12 +523,10 @@ static int davinci_i2s_probe(struct platform_device *pdev) dev->base = (void __iomem *)IO_ADDRESS(mem->start); - dev->dma_params[SNDRV_PCM_STREAM_PLAYBACK] = &davinci_i2s_pcm_out; - dev->dma_params[SNDRV_PCM_STREAM_PLAYBACK]->dma_addr = + dev->dma_params[SNDRV_PCM_STREAM_PLAYBACK].dma_addr = (dma_addr_t)(io_v2p(dev->base) + DAVINCI_MCBSP_DXR_REG); - dev->dma_params[SNDRV_PCM_STREAM_CAPTURE] = &davinci_i2s_pcm_in; - dev->dma_params[SNDRV_PCM_STREAM_CAPTURE]->dma_addr = + dev->dma_params[SNDRV_PCM_STREAM_CAPTURE].dma_addr = (dma_addr_t)(io_v2p(dev->base) + DAVINCI_MCBSP_DRR_REG); /* first TX, then RX */ @@ -550,7 +536,7 @@ static int davinci_i2s_probe(struct platform_device *pdev) ret = -ENXIO; goto err_free_mem; } - dev->dma_params[SNDRV_PCM_STREAM_PLAYBACK]->channel = res->start; + dev->dma_params[SNDRV_PCM_STREAM_PLAYBACK].channel = res->start; res = platform_get_resource(pdev, IORESOURCE_DMA, 1); if (!res) { @@ -558,7 +544,7 @@ static int davinci_i2s_probe(struct platform_device *pdev) ret = -ENXIO; goto err_free_mem; } - dev->dma_params[SNDRV_PCM_STREAM_CAPTURE]->channel = res->start; + dev->dma_params[SNDRV_PCM_STREAM_CAPTURE].channel = res->start; davinci_i2s_dai.private_data = dev; ret = snd_soc_register_dai(&davinci_i2s_dai); diff --git a/sound/soc/davinci/davinci-mcasp.c b/sound/soc/davinci/davinci-mcasp.c index 7a06c0a8666..3174d96d929 100644 --- a/sound/soc/davinci/davinci-mcasp.c +++ b/sound/soc/davinci/davinci-mcasp.c @@ -332,14 +332,6 @@ static inline void mcasp_set_ctl_reg(void __iomem *regs, u32 val) printk(KERN_ERR "GBLCTL write error\n"); } -static int davinci_mcasp_startup(struct snd_pcm_substream *substream, - struct snd_soc_dai *cpu_dai) -{ - struct davinci_audio_dev *dev = cpu_dai->private_data; - cpu_dai->dma_data = dev->dma_params[substream->stream]; - return 0; -} - static void mcasp_start_rx(struct davinci_audio_dev *dev) { mcasp_set_ctl_reg(dev->base + DAVINCI_MCASP_GBLCTLR_REG, RXHCLKRST); @@ -720,7 +712,7 @@ static int davinci_mcasp_hw_params(struct snd_pcm_substream *substream, { struct davinci_audio_dev *dev = cpu_dai->private_data; struct davinci_pcm_dma_params *dma_params = - dev->dma_params[substream->stream]; + &dev->dma_params[substream->stream]; int word_length; u8 numevt; @@ -798,7 +790,6 @@ static int davinci_mcasp_trigger(struct snd_pcm_substream *substream, } static struct snd_soc_dai_ops davinci_mcasp_dai_ops = { - .startup = davinci_mcasp_startup, .trigger = davinci_mcasp_trigger, .hw_params = davinci_mcasp_hw_params, .set_fmt = davinci_mcasp_set_dai_fmt, @@ -849,20 +840,12 @@ static int davinci_mcasp_probe(struct platform_device *pdev) struct resource *mem, *ioarea, *res; struct snd_platform_data *pdata; struct davinci_audio_dev *dev; - int count = 0; int ret = 0; dev = kzalloc(sizeof(struct davinci_audio_dev), GFP_KERNEL); if (!dev) return -ENOMEM; - dma_data = kzalloc(sizeof(struct davinci_pcm_dma_params) * 2, - GFP_KERNEL); - if (!dma_data) { - ret = -ENOMEM; - goto err_release_dev; - } - mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); if (!mem) { dev_err(&pdev->dev, "no mem resource?\n"); @@ -897,11 +880,10 @@ static int davinci_mcasp_probe(struct platform_device *pdev) dev->txnumevt = pdata->txnumevt; dev->rxnumevt = pdata->rxnumevt; - dma_data[count].name = "I2S PCM Stereo out"; - dma_data[count].eventq_no = pdata->eventq_no; - dma_data[count].dma_addr = (dma_addr_t) (pdata->tx_dma_offset + + dma_data = &dev->dma_params[SNDRV_PCM_STREAM_PLAYBACK]; + dma_data->eventq_no = pdata->eventq_no; + dma_data->dma_addr = (dma_addr_t) (pdata->tx_dma_offset + io_v2p(dev->base)); - dev->dma_params[SNDRV_PCM_STREAM_PLAYBACK] = &dma_data[count]; /* first TX, then RX */ res = platform_get_resource(pdev, IORESOURCE_DMA, 0); @@ -910,13 +892,12 @@ static int davinci_mcasp_probe(struct platform_device *pdev) goto err_release_region; } - dma_data[count].channel = res->start; - count++; - dma_data[count].name = "I2S PCM Stereo in"; - dma_data[count].eventq_no = pdata->eventq_no; - dma_data[count].dma_addr = (dma_addr_t)(pdata->rx_dma_offset + + dma_data->channel = res->start; + + dma_data = &dev->dma_params[SNDRV_PCM_STREAM_CAPTURE]; + dma_data->eventq_no = pdata->eventq_no; + dma_data->dma_addr = (dma_addr_t)(pdata->rx_dma_offset + io_v2p(dev->base)); - dev->dma_params[SNDRV_PCM_STREAM_CAPTURE] = &dma_data[count]; res = platform_get_resource(pdev, IORESOURCE_DMA, 1); if (!res) { @@ -924,7 +905,7 @@ static int davinci_mcasp_probe(struct platform_device *pdev) goto err_release_region; } - dma_data[count].channel = res->start; + dma_data->channel = res->start; davinci_mcasp_dai[pdata->op_mode].private_data = dev; davinci_mcasp_dai[pdata->op_mode].dev = &pdev->dev; ret = snd_soc_register_dai(&davinci_mcasp_dai[pdata->op_mode]); @@ -936,8 +917,6 @@ static int davinci_mcasp_probe(struct platform_device *pdev) err_release_region: release_mem_region(mem->start, (mem->end - mem->start) + 1); err_release_data: - kfree(dma_data); -err_release_dev: kfree(dev); return ret; @@ -946,7 +925,6 @@ err_release_dev: static int davinci_mcasp_remove(struct platform_device *pdev) { struct snd_platform_data *pdata = pdev->dev.platform_data; - struct davinci_pcm_dma_params *dma_data; struct davinci_audio_dev *dev; struct resource *mem; @@ -959,8 +937,6 @@ static int davinci_mcasp_remove(struct platform_device *pdev) mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); release_mem_region(mem->start, (mem->end - mem->start) + 1); - dma_data = dev->dma_params[SNDRV_PCM_STREAM_PLAYBACK]; - kfree(dma_data); kfree(dev); return 0; diff --git a/sound/soc/davinci/davinci-mcasp.h b/sound/soc/davinci/davinci-mcasp.h index 554354c1cc2..9d179cc88f7 100644 --- a/sound/soc/davinci/davinci-mcasp.h +++ b/sound/soc/davinci/davinci-mcasp.h @@ -39,10 +39,15 @@ enum { }; struct davinci_audio_dev { + /* + * dma_params must be first because rtd->dai->cpu_dai->private_data + * is cast to a pointer of an array of struct davinci_pcm_dma_params in + * davinci_pcm_open. + */ + struct davinci_pcm_dma_params dma_params[2]; void __iomem *base; int sample_rate; struct clk *clk; - struct davinci_pcm_dma_params *dma_params[2]; unsigned int codec_fmt; /* McASP specific data */ diff --git a/sound/soc/davinci/davinci-pcm.c b/sound/soc/davinci/davinci-pcm.c index 002808b27f4..359e99ec724 100644 --- a/sound/soc/davinci/davinci-pcm.c +++ b/sound/soc/davinci/davinci-pcm.c @@ -238,7 +238,8 @@ static int davinci_pcm_open(struct snd_pcm_substream *substream) struct davinci_runtime_data *prtd; int ret = 0; struct snd_soc_pcm_runtime *rtd = substream->private_data; - struct davinci_pcm_dma_params *params = rtd->dai->cpu_dai->dma_data; + struct davinci_pcm_dma_params *pa = rtd->dai->cpu_dai->private_data; + struct davinci_pcm_dma_params *params = &pa[substream->stream]; if (!params) return -ENODEV; diff --git a/sound/soc/davinci/davinci-pcm.h b/sound/soc/davinci/davinci-pcm.h index 63d96253c73..8746606efc8 100644 --- a/sound/soc/davinci/davinci-pcm.h +++ b/sound/soc/davinci/davinci-pcm.h @@ -17,7 +17,6 @@ struct davinci_pcm_dma_params { - char *name; /* stream identifier */ int channel; /* sync dma channel ID */ unsigned short acnt; dma_addr_t dma_addr; /* device physical address for DMA */ -- cgit v1.2.3 From 539d3d8cbe5cf7597d4c4c4428aec242f9ea5185 Mon Sep 17 00:00:00 2001 From: Chaithrika U S Date: Wed, 23 Sep 2009 10:12:08 -0400 Subject: ASoC: DaVinci: Correct McASP FIFO initialization McASP write FIFO registers should be modified for playback and read FIFO registers for capture. Check the PCM mode before manipulating the FIFO registers. Currently, irrespective of playback/capture both the FIFOs are enabled or disbaled. This resulted in errors in audio loopback mode. Signed-off-by: Chaithrika U S Signed-off-by: Mark Brown --- sound/soc/davinci/davinci-mcasp.c | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) (limited to 'sound') diff --git a/sound/soc/davinci/davinci-mcasp.c b/sound/soc/davinci/davinci-mcasp.c index 3174d96d929..5d1f98a4c97 100644 --- a/sound/soc/davinci/davinci-mcasp.c +++ b/sound/soc/davinci/davinci-mcasp.c @@ -378,17 +378,17 @@ static void mcasp_start_tx(struct davinci_audio_dev *dev) static void davinci_mcasp_start(struct davinci_audio_dev *dev, int stream) { - if (stream == SNDRV_PCM_STREAM_PLAYBACK) + if (stream == SNDRV_PCM_STREAM_PLAYBACK) { + if (dev->txnumevt) /* enable FIFO */ + mcasp_set_bits(dev->base + DAVINCI_MCASP_WFIFOCTL, + FIFO_ENABLE); mcasp_start_tx(dev); - else + } else { + if (dev->rxnumevt) /* enable FIFO */ + mcasp_set_bits(dev->base + DAVINCI_MCASP_RFIFOCTL, + FIFO_ENABLE); mcasp_start_rx(dev); - - /* enable FIFO */ - if (dev->txnumevt) - mcasp_set_bits(dev->base + DAVINCI_MCASP_WFIFOCTL, FIFO_ENABLE); - - if (dev->rxnumevt) - mcasp_set_bits(dev->base + DAVINCI_MCASP_RFIFOCTL, FIFO_ENABLE); + } } static void mcasp_stop_rx(struct davinci_audio_dev *dev) @@ -405,17 +405,17 @@ static void mcasp_stop_tx(struct davinci_audio_dev *dev) static void davinci_mcasp_stop(struct davinci_audio_dev *dev, int stream) { - if (stream == SNDRV_PCM_STREAM_PLAYBACK) + if (stream == SNDRV_PCM_STREAM_PLAYBACK) { + if (dev->txnumevt) /* disable FIFO */ + mcasp_clr_bits(dev->base + DAVINCI_MCASP_WFIFOCTL, + FIFO_ENABLE); mcasp_stop_tx(dev); - else + } else { + if (dev->rxnumevt) /* disable FIFO */ + mcasp_clr_bits(dev->base + DAVINCI_MCASP_RFIFOCTL, + FIFO_ENABLE); mcasp_stop_rx(dev); - - /* disable FIFO */ - if (dev->txnumevt) - mcasp_clr_bits(dev->base + DAVINCI_MCASP_WFIFOCTL, FIFO_ENABLE); - - if (dev->rxnumevt) - mcasp_clr_bits(dev->base + DAVINCI_MCASP_RFIFOCTL, FIFO_ENABLE); + } } static int davinci_mcasp_set_dai_fmt(struct snd_soc_dai *cpu_dai, -- cgit v1.2.3 From f0968e3f7a8ea30728d2580d3043a30ea9994ec6 Mon Sep 17 00:00:00 2001 From: Krzysztof Helt Date: Sun, 27 Sep 2009 23:08:40 +0200 Subject: ALSA: sscape: add supoort for SPEA Media FX/Reveal SC-600 Move code from the OSS sscape driver in order to support old Soundscape OEM models. Signed-off-by: Krzysztof Helt Signed-off-by: Takashi Iwai --- sound/isa/Kconfig | 6 ++- sound/isa/sscape.c | 116 +++++++++++++++++++++++++++++++++++++---------------- 2 files changed, 86 insertions(+), 36 deletions(-) (limited to 'sound') diff --git a/sound/isa/Kconfig b/sound/isa/Kconfig index 51a7e3777e1..b90fc164a79 100644 --- a/sound/isa/Kconfig +++ b/sound/isa/Kconfig @@ -377,10 +377,12 @@ config SND_SSCAPE select SND_WSS_LIB help Say Y here to include support for Ensoniq SoundScape - soundcards. + and Ensoniq OEM soundcards. The PCM audio is supported on SoundScape Classic, Elite, PnP - and VIVO cards. The MIDI support is very experimental. + and VIVO cards. The supported OEM cards are SPEA Media FX and + Reveal SC-600. + The MIDI support is very experimental. To compile this driver as a module, choose M here: the module will be called snd-sscape. diff --git a/sound/isa/sscape.c b/sound/isa/sscape.c index 66187122377..b11c35f6aef 100644 --- a/sound/isa/sscape.c +++ b/sound/isa/sscape.c @@ -127,7 +127,8 @@ enum GA_REG { enum card_type { - SSCAPE, + MEDIA_FX, /* Sequoia S-1000 */ + SSCAPE, /* Sequoia S-2000 */ SSCAPE_PNP, SSCAPE_VIVO, }; @@ -784,20 +785,25 @@ static struct snd_kcontrol_new midi_mixer_ctl = { * These IRQs are encoded as bit patterns so that they can be * written to the control registers. */ -static unsigned __devinit get_irq_config(int irq) +static unsigned __devinit get_irq_config(int sscape_type, int irq) { static const int valid_irq[] = { 9, 5, 7, 10 }; + static const int old_irq[] = { 9, 7, 5, 15 }; unsigned cfg; - for (cfg = 0; cfg < ARRAY_SIZE(valid_irq); ++cfg) { - if (irq == valid_irq[cfg]) - return cfg; - } /* for */ + if (sscape_type == MEDIA_FX) { + for (cfg = 0; cfg < ARRAY_SIZE(old_irq); ++cfg) + if (irq == old_irq[cfg]) + return cfg; + } else { + for (cfg = 0; cfg < ARRAY_SIZE(valid_irq); ++cfg) + if (irq == valid_irq[cfg]) + return cfg; + } return INVALID_IRQ; } - /* * Perform certain arcane port-checks to see whether there * is a SoundScape board lurking behind the given ports. @@ -842,11 +848,39 @@ static int __devinit detect_sscape(struct soundscape *s, long wss_io) if (s->type != SSCAPE_VIVO && (d & 0x9f) != 0x0e) goto _done; - d = sscape_read_unsafe(s->io_base, GA_HMCTL_REG) & 0x3f; - sscape_write_unsafe(s->io_base, GA_HMCTL_REG, d | 0xc0); + if (s->ic_type == IC_OPUS) + activate_ad1845_unsafe(s->io_base); if (s->type == SSCAPE_VIVO) wss_io += 4; + + d = sscape_read_unsafe(s->io_base, GA_HMCTL_REG) & 0x3f; + sscape_write_unsafe(s->io_base, GA_HMCTL_REG, d | 0xc0); + + /* wait for WSS codec */ + for (d = 0; d < 500; d++) { + if ((inb(wss_io) & 0x80) == 0) + break; + spin_unlock_irqrestore(&s->lock, flags); + msleep(1); + spin_lock_irqsave(&s->lock, flags); + } + snd_printd(KERN_INFO "init delay = %d ms\n", d); + + if ((inb(wss_io) & 0x80) != 0) + goto _done; + + if (inb(wss_io + 2) == 0xff) + goto _done; + + d = sscape_read_unsafe(s->io_base, GA_HMCTL_REG) & 0x3f; + sscape_write_unsafe(s->io_base, GA_HMCTL_REG, d); + + if ((inb(wss_io) & 0x80) != 0) + s->type = MEDIA_FX; + + d = sscape_read_unsafe(s->io_base, GA_HMCTL_REG) & 0x3f; + sscape_write_unsafe(s->io_base, GA_HMCTL_REG, d | 0xc0); /* wait for WSS codec */ for (d = 0; d < 500; d++) { if ((inb(wss_io) & 0x80) == 0) @@ -954,9 +988,6 @@ static int __devinit create_ad1845(struct snd_card *card, unsigned port, if (sscape->type == SSCAPE_VIVO) port += 4; - if (dma1 == dma2) - dma2 = -1; - err = snd_wss_create(card, port, -1, irq, dma1, dma2, WSS_HW_DETECT, WSS_HWSHARE_DMA1, &chip); if (!err) { @@ -1051,21 +1082,7 @@ static int __devinit create_sscape(int dev, struct snd_card *card) struct resource *wss_res; unsigned long flags; int err; - - /* - * Check that the user didn't pass us garbage data ... - */ - irq_cfg = get_irq_config(irq[dev]); - if (irq_cfg == INVALID_IRQ) { - snd_printk(KERN_ERR "sscape: Invalid IRQ %d\n", irq[dev]); - return -ENXIO; - } - - mpu_irq_cfg = get_irq_config(mpu_irq[dev]); - if (mpu_irq_cfg == INVALID_IRQ) { - printk(KERN_ERR "sscape: Invalid IRQ %d\n", mpu_irq[dev]); - return -ENXIO; - } + const char *name; /* * Grab IO ports that we will need to probe so that we @@ -1109,8 +1126,41 @@ static int __devinit create_sscape(int dev, struct snd_card *card) goto _release_dma; } - printk(KERN_INFO "sscape: hardware detected at 0x%x, using IRQ %d, DMA %d\n", - sscape->io_base, irq[dev], dma[dev]); + switch (sscape->type) { + case MEDIA_FX: + name = "MediaFX/SoundFX"; + break; + case SSCAPE: + name = "Soundscape"; + break; + case SSCAPE_PNP: + name = "Soundscape PnP"; + break; + case SSCAPE_VIVO: + name = "Soundscape VIVO"; + break; + default: + name = "unknown Soundscape"; + break; + } + + printk(KERN_INFO "sscape: %s card detected at 0x%x, using IRQ %d, DMA %d\n", + name, sscape->io_base, irq[dev], dma[dev]); + + /* + * Check that the user didn't pass us garbage data ... + */ + irq_cfg = get_irq_config(sscape->type, irq[dev]); + if (irq_cfg == INVALID_IRQ) { + snd_printk(KERN_ERR "sscape: Invalid IRQ %d\n", irq[dev]); + return -ENXIO; + } + + mpu_irq_cfg = get_irq_config(sscape->type, mpu_irq[dev]); + if (mpu_irq_cfg == INVALID_IRQ) { + printk(KERN_ERR "sscape: Invalid IRQ %d\n", mpu_irq[dev]); + return -ENXIO; + } if (sscape->type != SSCAPE_VIVO) { /* @@ -1141,8 +1191,6 @@ static int __devinit create_sscape(int dev, struct snd_card *card) */ spin_lock_irqsave(&sscape->lock, flags); - activate_ad1845_unsafe(sscape->io_base); - sscape_write_unsafe(sscape->io_base, GA_INTENA_REG, 0x00); /* disable */ sscape_write_unsafe(sscape->io_base, GA_SMCFGA_REG, 0x2e); sscape_write_unsafe(sscape->io_base, GA_SMCFGB_REG, 0x00); @@ -1151,12 +1199,12 @@ static int __devinit create_sscape(int dev, struct snd_card *card) * Enable and configure the DMA channels ... */ sscape_write_unsafe(sscape->io_base, GA_DMACFG_REG, 0x50); - dma_cfg = (sscape->ic_type == IC_ODIE ? 0x70 : 0x40); + dma_cfg = (sscape->ic_type == IC_OPUS ? 0x40 : 0x70); sscape_write_unsafe(sscape->io_base, GA_DMAA_REG, dma_cfg); sscape_write_unsafe(sscape->io_base, GA_DMAB_REG, 0x20); - sscape_write_unsafe(sscape->io_base, - GA_INTCFG_REG, 0xf0 | (mpu_irq_cfg << 2) | mpu_irq_cfg); + mpu_irq_cfg |= mpu_irq_cfg << 2; + sscape_write_unsafe(sscape->io_base, GA_INTCFG_REG, 0xf0 | mpu_irq_cfg); sscape_write_unsafe(sscape->io_base, GA_CDCFG_REG, 0x09 | DMA_8BIT | (dma[dev] << 4) | (irq_cfg << 1)); -- cgit v1.2.3 From 392bf2f1ba03b690f0ee71a185d4a5720a82bb25 Mon Sep 17 00:00:00 2001 From: Giuliano Pochini Date: Wed, 30 Sep 2009 08:26:45 +0200 Subject: ALSA: echoaudio - Re-enable the line-out control for the Mia card Mia has an undocumented line-out control, and it has to be exposed. Signed-off-by: Giuliano Pochini Signed-off-by: Takashi Iwai --- sound/pci/echoaudio/echoaudio.c | 30 ++++++++++++++++++++++++++---- sound/pci/echoaudio/mia.c | 1 + 2 files changed, 27 insertions(+), 4 deletions(-) (limited to 'sound') diff --git a/sound/pci/echoaudio/echoaudio.c b/sound/pci/echoaudio/echoaudio.c index da2065cd2c0..1305f7ca02c 100644 --- a/sound/pci/echoaudio/echoaudio.c +++ b/sound/pci/echoaudio/echoaudio.c @@ -950,7 +950,7 @@ static int __devinit snd_echo_new_pcm(struct echoaudio *chip) Control interface ******************************************************************************/ -#ifndef ECHOCARD_HAS_VMIXER +#if !defined(ECHOCARD_HAS_VMIXER) || defined(ECHOCARD_HAS_LINE_OUT_GAIN) /******************* PCM output volume *******************/ static int snd_echo_output_gain_info(struct snd_kcontrol *kcontrol, @@ -1003,6 +1003,19 @@ static int snd_echo_output_gain_put(struct snd_kcontrol *kcontrol, return changed; } +#ifdef ECHOCARD_HAS_LINE_OUT_GAIN +/* On the Mia this one controls the line-out volume */ +static struct snd_kcontrol_new snd_echo_line_output_gain __devinitdata = { + .name = "Line Playback Volume", + .iface = SNDRV_CTL_ELEM_IFACE_MIXER, + .access = SNDRV_CTL_ELEM_ACCESS_READWRITE | + SNDRV_CTL_ELEM_ACCESS_TLV_READ, + .info = snd_echo_output_gain_info, + .get = snd_echo_output_gain_get, + .put = snd_echo_output_gain_put, + .tlv = {.p = db_scale_output_gain}, +}; +#else static struct snd_kcontrol_new snd_echo_pcm_output_gain __devinitdata = { .name = "PCM Playback Volume", .iface = SNDRV_CTL_ELEM_IFACE_MIXER, @@ -1012,9 +1025,10 @@ static struct snd_kcontrol_new snd_echo_pcm_output_gain __devinitdata = { .put = snd_echo_output_gain_put, .tlv = {.p = db_scale_output_gain}, }; - #endif +#endif /* !ECHOCARD_HAS_VMIXER || ECHOCARD_HAS_LINE_OUT_GAIN */ + #ifdef ECHOCARD_HAS_INPUT_GAIN @@ -2030,10 +2044,18 @@ static int __devinit snd_echo_probe(struct pci_dev *pci, snd_echo_vmixer.count = num_pipes_out(chip) * num_busses_out(chip); if ((err = snd_ctl_add(chip->card, snd_ctl_new1(&snd_echo_vmixer, chip))) < 0) goto ctl_error; -#else - if ((err = snd_ctl_add(chip->card, snd_ctl_new1(&snd_echo_pcm_output_gain, chip))) < 0) +#ifdef ECHOCARD_HAS_LINE_OUT_GAIN + err = snd_ctl_add(chip->card, + snd_ctl_new1(&snd_echo_line_output_gain, chip)); + if (err < 0) goto ctl_error; #endif +#else /* ECHOCARD_HAS_VMIXER */ + err = snd_ctl_add(chip->card, + snd_ctl_new1(&snd_echo_pcm_output_gain, chip)); + if (err < 0) + goto ctl_error; +#endif /* ECHOCARD_HAS_VMIXER */ #ifdef ECHOCARD_HAS_INPUT_GAIN if ((err = snd_ctl_add(chip->card, snd_ctl_new1(&snd_echo_line_input_gain, chip))) < 0) diff --git a/sound/pci/echoaudio/mia.c b/sound/pci/echoaudio/mia.c index f3b9b45c9c1..f05c8c097aa 100644 --- a/sound/pci/echoaudio/mia.c +++ b/sound/pci/echoaudio/mia.c @@ -29,6 +29,7 @@ #define ECHOCARD_HAS_ADAT FALSE #define ECHOCARD_HAS_STEREO_BIG_ENDIAN32 #define ECHOCARD_HAS_MIDI +#define ECHOCARD_HAS_LINE_OUT_GAIN /* Pipe indexes */ #define PX_ANALOG_OUT 0 /* 8 */ -- cgit v1.2.3 From 5da5b6f9e967e8c62486444f97e66252c3768d7d Mon Sep 17 00:00:00 2001 From: Daniel T Chen Date: Thu, 1 Oct 2009 00:28:16 -0400 Subject: ALSA: intel8x0 - Mute External Amplifier by default for Sony VAIO VGN-T350P BugLink: https://bugs.launchpad.net/bugs/410933 This Sony VAIO model needs External Amplifier unmuted for audible playback, so make sure we set the inv_eapd quirk. Signed-off-by: Daniel T Chen Signed-off-by: Takashi Iwai --- sound/pci/intel8x0.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'sound') diff --git a/sound/pci/intel8x0.c b/sound/pci/intel8x0.c index 171ada53520..86e9a2d6e03 100644 --- a/sound/pci/intel8x0.c +++ b/sound/pci/intel8x0.c @@ -1954,6 +1954,12 @@ static struct ac97_quirk ac97_quirks[] __devinitdata = { .name = "Sony S1XP", .type = AC97_TUNE_INV_EAPD }, + { + .subvendor = 0x104d, + .subdevice = 0x81c0, + .name = "Sony VAIO VGN-T350P", /*AD1981B*/ + .type = AC97_TUNE_INV_EAPD + }, { .subvendor = 0x1043, .subdevice = 0x80f3, -- cgit v1.2.3 From 18c4078489fe064cc0ed08be3381cf2f26657f5f Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Thu, 1 Oct 2009 07:46:33 +0200 Subject: ALSA: Don't assume i2c device probing always succeeds The client->driver pointer can be NULL when i2c-device probing fails in i2c_new_device(). This patch adds the NULL checks for client->driver and return the error instead of blind assumption of driver availability. Reported-by: Tim Shepard Cc: Jean Delvare Cc: Johannes Berg Signed-off-by: Takashi Iwai --- sound/aoa/codecs/tas.c | 9 +++++++++ sound/ppc/keywest.c | 12 ++++++++++++ 2 files changed, 21 insertions(+) (limited to 'sound') diff --git a/sound/aoa/codecs/tas.c b/sound/aoa/codecs/tas.c index f0ebc971c68..1dd66ddffca 100644 --- a/sound/aoa/codecs/tas.c +++ b/sound/aoa/codecs/tas.c @@ -897,6 +897,15 @@ static int tas_create(struct i2c_adapter *adapter, client = i2c_new_device(adapter, &info); if (!client) return -ENODEV; + /* + * We know the driver is already loaded, so the device should be + * already bound. If not it means binding failed, and then there + * is no point in keeping the device instantiated. + */ + if (!client->driver) { + i2c_unregister_device(client); + return -ENODEV; + } /* * Let i2c-core delete that device on driver removal. diff --git a/sound/ppc/keywest.c b/sound/ppc/keywest.c index 835fa19ed46..bb6819aab13 100644 --- a/sound/ppc/keywest.c +++ b/sound/ppc/keywest.c @@ -59,6 +59,18 @@ static int keywest_attach_adapter(struct i2c_adapter *adapter) strlcpy(info.type, "keywest", I2C_NAME_SIZE); info.addr = keywest_ctx->addr; keywest_ctx->client = i2c_new_device(adapter, &info); + if (!keywest_ctx->client) + return -ENODEV; + /* + * We know the driver is already loaded, so the device should be + * already bound. If not it means binding failed, and then there + * is no point in keeping the device instantiated. + */ + if (!keywest_ctx->client->driver) { + i2c_unregister_device(keywest_ctx->client); + keywest_ctx->client = NULL; + return -ENODEV; + } /* * Let i2c-core delete that device on driver removal. -- cgit v1.2.3 From acd47100914b2896d0699febefd077f85c4dd272 Mon Sep 17 00:00:00 2001 From: Krzysztof Helt Date: Thu, 1 Oct 2009 00:10:34 +0200 Subject: ALSA: sscape: convert to firmware loader framework The conversion solves the problem that firmware size was set to 64KB while non PnP cards have 128KB firmware files. An additional firmware initialization code has been moved from the OSS driver. Signed-off-by: Krzysztof Helt Signed-off-by: Takashi Iwai --- sound/isa/Kconfig | 8 +- sound/isa/sscape.c | 328 +++++++++++++++++------------------------------------ 2 files changed, 112 insertions(+), 224 deletions(-) (limited to 'sound') diff --git a/sound/isa/Kconfig b/sound/isa/Kconfig index b90fc164a79..02fe81ca88f 100644 --- a/sound/isa/Kconfig +++ b/sound/isa/Kconfig @@ -372,9 +372,9 @@ config SND_SGALAXY config SND_SSCAPE tristate "Ensoniq SoundScape driver" - select SND_HWDEP select SND_MPU401_UART select SND_WSS_LIB + select FW_LOADER help Say Y here to include support for Ensoniq SoundScape and Ensoniq OEM soundcards. @@ -382,7 +382,11 @@ config SND_SSCAPE The PCM audio is supported on SoundScape Classic, Elite, PnP and VIVO cards. The supported OEM cards are SPEA Media FX and Reveal SC-600. - The MIDI support is very experimental. + The MIDI support is very experimental and requires binary + firmware files called "scope.cod" and "sndscape.co?" where the + ? is digit 0, 1, 2, 3 or 4. The firmware files can be found + in DOS or Windows driver packages. One has to put the firmware + files into the /lib/firmware directory. To compile this driver as a module, choose M here: the module will be called snd-sscape. diff --git a/sound/isa/sscape.c b/sound/isa/sscape.c index b11c35f6aef..1ce465cc66a 100644 --- a/sound/isa/sscape.c +++ b/sound/isa/sscape.c @@ -1,5 +1,5 @@ /* - * Low-level ALSA driver for the ENSONIQ SoundScape PnP + * Low-level ALSA driver for the ENSONIQ SoundScape * Copyright (c) by Chris Rankin * * This driver was written in part using information obtained from @@ -25,22 +25,26 @@ #include #include #include +#include #include #include #include #include #include -#include #include #include #include -#include - MODULE_AUTHOR("Chris Rankin"); -MODULE_DESCRIPTION("ENSONIQ SoundScape PnP driver"); +MODULE_DESCRIPTION("ENSONIQ SoundScape driver"); MODULE_LICENSE("GPL"); +MODULE_FIRMWARE("sndscape.co0"); +MODULE_FIRMWARE("sndscape.co1"); +MODULE_FIRMWARE("sndscape.co2"); +MODULE_FIRMWARE("sndscape.co3"); +MODULE_FIRMWARE("sndscape.co4"); +MODULE_FIRMWARE("scope.cod"); static int index[SNDRV_CARDS] __devinitdata = SNDRV_DEFAULT_IDX; static char* id[SNDRV_CARDS] __devinitdata = SNDRV_DEFAULT_STR; @@ -142,14 +146,12 @@ struct soundscape { struct resource *wss_res; struct snd_wss *chip; struct snd_mpu401 *mpu; - struct snd_hwdep *hw; /* * The MIDI device won't work until we've loaded * its firmware via a hardware-dependent device IOCTL */ spinlock_t fwlock; - int hw_in_use; unsigned long midi_usage; unsigned char midi_vol; }; @@ -167,12 +169,6 @@ static inline struct soundscape *get_mpu401_soundscape(struct snd_mpu401 * mpu) return (struct soundscape *) (mpu->private_data); } -static inline struct soundscape *get_hwdep_soundscape(struct snd_hwdep * hw) -{ - return (struct soundscape *) (hw->private_data); -} - - /* * Allocates some kernel memory that we can use for DMA. * I think this means that the memory has to map to @@ -393,12 +389,12 @@ static int obp_startup_ack(struct soundscape *s, unsigned timeout) do { unsigned long flags; - unsigned char x; + int x; spin_lock_irqsave(&s->lock, flags); - x = inb(HOST_DATA_IO(s->io_base)); + x = host_read_unsafe(s->io_base); spin_unlock_irqrestore(&s->lock, flags); - if ((x & 0xfe) == 0xfe) + if (x == 0xfe || x == 0xff) return 1; msleep(10); @@ -420,10 +416,10 @@ static int host_startup_ack(struct soundscape *s, unsigned timeout) do { unsigned long flags; - unsigned char x; + int x; spin_lock_irqsave(&s->lock, flags); - x = inb(HOST_DATA_IO(s->io_base)); + x = host_read_unsafe(s->io_base); spin_unlock_irqrestore(&s->lock, flags); if (x == 0xfe) return 1; @@ -438,14 +434,14 @@ static int host_startup_ack(struct soundscape *s, unsigned timeout) * Upload a byte-stream into the SoundScape using DMA channel A. */ static int upload_dma_data(struct soundscape *s, - const unsigned char __user *data, + const unsigned char *data, size_t size) { unsigned long flags; struct snd_dma_buffer dma; int ret; - if (!get_dmabuf(&dma, PAGE_ALIGN(size))) + if (!get_dmabuf(&dma, PAGE_ALIGN(32 * 1024))) return -ENOMEM; spin_lock_irqsave(&s->lock, flags); @@ -458,7 +454,6 @@ static int upload_dma_data(struct soundscape *s, /* * Enable the DMA channels and configure them ... */ - sscape_write_unsafe(s->io_base, GA_DMACFG_REG, 0x50); sscape_write_unsafe(s->io_base, GA_DMAA_REG, (s->chip->dma1 << 4) | DMA_8BIT); sscape_write_unsafe(s->io_base, GA_DMAB_REG, 0x20); @@ -468,35 +463,17 @@ static int upload_dma_data(struct soundscape *s, sscape_write_unsafe(s->io_base, GA_HMCTL_REG, sscape_read_unsafe(s->io_base, GA_HMCTL_REG) | 0x80); /* - * Upload the user's data (firmware?) to the SoundScape + * Upload the firmware to the SoundScape * board through the DMA channel ... */ while (size != 0) { unsigned long len; - /* - * Apparently, copying to/from userspace can sleep. - * We are therefore forbidden from holding any - * spinlocks while we copy ... - */ - spin_unlock_irqrestore(&s->lock, flags); - - /* - * Remember that the data that we want to DMA - * comes from USERSPACE. We have already verified - * the userspace pointer ... - */ len = min(size, dma.bytes); - len -= __copy_from_user(dma.area, data, len); + memcpy(dma.area, data, len); data += len; size -= len; - /* - * Grab that spinlock again, now that we've - * finished copying! - */ - spin_lock_irqsave(&s->lock, flags); - snd_dma_program(s->chip->dma1, dma.addr, len, DMA_MODE_WRITE); sscape_start_dma_unsafe(s->io_base, GA_DMAA_REG); if (!sscape_wait_dma_unsafe(s->io_base, GA_DMAA_REG, 5000)) { @@ -512,6 +489,7 @@ static int upload_dma_data(struct soundscape *s, } /* while */ set_host_mode_unsafe(s->io_base); + outb(0x0, s->io_base); /* * Boot the board ... (I think) @@ -537,7 +515,7 @@ _release_dma: /* * NOTE!!! We are NOT holding any spinlocks at this point !!! */ - sscape_write(s, GA_DMAA_REG, (s->ic_type == IC_ODIE ? 0x70 : 0x40)); + sscape_write(s, GA_DMAA_REG, (s->ic_type == IC_OPUS ? 0x40 : 0x70)); free_dmabuf(&dma); return ret; @@ -547,162 +525,69 @@ _release_dma: * Upload the bootblock(?) into the SoundScape. The only * purpose of this block of code seems to be to tell * us which version of the microcode we should be using. - * - * NOTE: The boot-block data resides in USER-SPACE!!! - * However, we have already verified its memory - * addresses by the time we get here. */ -static int sscape_upload_bootblock(struct soundscape *sscape, struct sscape_bootblock __user *bb) +static int sscape_upload_bootblock(struct snd_card *card) { + struct soundscape *sscape = get_card_soundscape(card); unsigned long flags; + const struct firmware *init_fw = NULL; int data = 0; int ret; - ret = upload_dma_data(sscape, bb->code, sizeof(bb->code)); - - spin_lock_irqsave(&sscape->lock, flags); - if (ret == 0) { - data = host_read_ctrl_unsafe(sscape->io_base, 100); - } - set_midi_mode_unsafe(sscape->io_base); - spin_unlock_irqrestore(&sscape->lock, flags); - - if (ret == 0) { - if (data < 0) { - snd_printk(KERN_ERR "sscape: timeout reading firmware version\n"); - ret = -EAGAIN; - } - else if (__copy_to_user(&bb->version, &data, sizeof(bb->version))) { - ret = -EFAULT; - } + ret = request_firmware(&init_fw, "scope.cod", card->dev); + if (ret < 0) { + snd_printk(KERN_ERR "Error loading scope.cod"); + return ret; } + ret = upload_dma_data(sscape, init_fw->data, init_fw->size); - return ret; -} + release_firmware(init_fw); -/* - * Upload the microcode into the SoundScape. The - * microcode is 64K of data, and if we try to copy - * it into a local variable then we will SMASH THE - * KERNEL'S STACK! We therefore leave it in USER - * SPACE, and save ourselves from copying it at all. - */ -static int sscape_upload_microcode(struct soundscape *sscape, - const struct sscape_microcode __user *mc) -{ - unsigned long flags; - char __user *code; - int err; - - /* - * We are going to have to copy this data into a special - * DMA-able buffer before we can upload it. We shall therefore - * just check that the data pointer is valid for now. - * - * NOTE: This buffer is 64K long! That's WAY too big to - * copy into a stack-temporary anyway. - */ - if ( get_user(code, &mc->code) || - !access_ok(VERIFY_READ, code, SSCAPE_MICROCODE_SIZE) ) - return -EFAULT; + spin_lock_irqsave(&sscape->lock, flags); + if (ret == 0) + data = host_read_ctrl_unsafe(sscape->io_base, 100); - if ((err = upload_dma_data(sscape, code, SSCAPE_MICROCODE_SIZE)) == 0) { - snd_printk(KERN_INFO "sscape: MIDI firmware loaded\n"); - } + if (data & 0x10) + sscape_write_unsafe(sscape->io_base, GA_SMCFGA_REG, 0x2f); - spin_lock_irqsave(&sscape->lock, flags); - set_midi_mode_unsafe(sscape->io_base); spin_unlock_irqrestore(&sscape->lock, flags); - initialise_mpu401(sscape->mpu); + data &= 0xf; + if (ret == 0 && data > 7) { + snd_printk(KERN_ERR "timeout reading firmware version\n"); + ret = -EAGAIN; + } - return err; + return (ret == 0) ? data : ret; } /* - * Hardware-specific device functions, to implement special - * IOCTLs for the SoundScape card. This is how we upload - * the microcode into the card, for example, and so we - * must ensure that no two processes can open this device - * simultaneously, and that we can't open it at all if - * someone is using the MIDI device. + * Upload the microcode into the SoundScape. */ -static int sscape_hw_open(struct snd_hwdep * hw, struct file *file) +static int sscape_upload_microcode(struct snd_card *card, int version) { - register struct soundscape *sscape = get_hwdep_soundscape(hw); - unsigned long flags; + struct soundscape *sscape = get_card_soundscape(card); + const struct firmware *init_fw = NULL; + char name[14]; int err; - spin_lock_irqsave(&sscape->fwlock, flags); + snprintf(name, sizeof(name), "sndscape.co%d", version); - if ((sscape->midi_usage != 0) || sscape->hw_in_use) { - err = -EBUSY; - } else { - sscape->hw_in_use = 1; - err = 0; + err = request_firmware(&init_fw, name, card->dev); + if (err < 0) { + snd_printk(KERN_ERR "Error loading sndscape.co%d", version); + return err; } + err = upload_dma_data(sscape, init_fw->data, init_fw->size); + if (err == 0) + snd_printk(KERN_INFO "MIDI firmware loaded %d KBs\n", + init_fw->size >> 10); - spin_unlock_irqrestore(&sscape->fwlock, flags); - return err; -} - -static int sscape_hw_release(struct snd_hwdep * hw, struct file *file) -{ - register struct soundscape *sscape = get_hwdep_soundscape(hw); - unsigned long flags; - - spin_lock_irqsave(&sscape->fwlock, flags); - sscape->hw_in_use = 0; - spin_unlock_irqrestore(&sscape->fwlock, flags); - return 0; -} - -static int sscape_hw_ioctl(struct snd_hwdep * hw, struct file *file, - unsigned int cmd, unsigned long arg) -{ - struct soundscape *sscape = get_hwdep_soundscape(hw); - int err = -EBUSY; - - switch (cmd) { - case SND_SSCAPE_LOAD_BOOTB: - { - register struct sscape_bootblock __user *bb = (struct sscape_bootblock __user *) arg; - - /* - * We are going to have to copy this data into a special - * DMA-able buffer before we can upload it. We shall therefore - * just check that the data pointer is valid for now ... - */ - if ( !access_ok(VERIFY_READ, bb->code, sizeof(bb->code)) ) - return -EFAULT; - - /* - * Now check that we can write the firmware version number too... - */ - if ( !access_ok(VERIFY_WRITE, &bb->version, sizeof(bb->version)) ) - return -EFAULT; - - err = sscape_upload_bootblock(sscape, bb); - } - break; - - case SND_SSCAPE_LOAD_MCODE: - { - register const struct sscape_microcode __user *mc = (const struct sscape_microcode __user *) arg; - - err = sscape_upload_microcode(sscape, mc); - } - break; - - default: - err = -EINVAL; - break; - } /* switch */ + release_firmware(init_fw); return err; } - /* * Mixer control for the SoundScape's MIDI device. */ @@ -920,7 +805,7 @@ static int mpu401_open(struct snd_mpu401 * mpu) spin_lock_irqsave(&sscape->fwlock, flags); - if (sscape->hw_in_use || (sscape->midi_usage == ULONG_MAX)) { + if (sscape->midi_usage == ULONG_MAX) { err = -EBUSY; } else { ++(sscape->midi_usage); @@ -1053,13 +938,6 @@ static int __devinit create_ad1845(struct snd_card *card, unsigned port, } } - strcpy(card->driver, "SoundScape"); - strcpy(card->shortname, pcm->name); - snprintf(card->longname, sizeof(card->longname), - "%s at 0x%lx, IRQ %d, DMA1 %d, DMA2 %d\n", - pcm->name, chip->port, chip->irq, - chip->dma1, chip->dma2); - sscape->chip = chip; } @@ -1162,29 +1040,6 @@ static int __devinit create_sscape(int dev, struct snd_card *card) return -ENXIO; } - if (sscape->type != SSCAPE_VIVO) { - /* - * Now create the hardware-specific device so that we can - * load the microcode into the on-board processor. - * We cannot use the MPU-401 MIDI system until this firmware - * has been loaded into the card. - */ - err = snd_hwdep_new(card, "MC68EC000", 0, &(sscape->hw)); - if (err < 0) { - printk(KERN_ERR "sscape: Failed to create " - "firmware device\n"); - goto _release_dma; - } - strlcpy(sscape->hw->name, "SoundScape M68K", - sizeof(sscape->hw->name)); - sscape->hw->name[sizeof(sscape->hw->name) - 1] = '\0'; - sscape->hw->iface = SNDRV_HWDEP_IFACE_SSCAPE; - sscape->hw->ops.open = sscape_hw_open; - sscape->hw->ops.release = sscape_hw_release; - sscape->hw->ops.ioctl = sscape_hw_ioctl; - sscape->hw->private_data = sscape; - } - /* * Tell the on-board devices where their resources are (I think - * I can't be sure without a datasheet ... So many magic values!) @@ -1222,28 +1077,56 @@ static int __devinit create_sscape(int dev, struct snd_card *card) wss_port[dev], irq[dev]); goto _release_dma; } + strcpy(card->driver, "SoundScape"); + strcpy(card->shortname, name); + snprintf(card->longname, sizeof(card->longname), + "%s at 0x%lx, IRQ %d, DMA1 %d, DMA2 %d\n", + name, sscape->chip->port, sscape->chip->irq, + sscape->chip->dma1, sscape->chip->dma2); + #define MIDI_DEVNUM 0 if (sscape->type != SSCAPE_VIVO) { - err = create_mpu401(card, MIDI_DEVNUM, port[dev], mpu_irq[dev]); - if (err < 0) { - printk(KERN_ERR "sscape: Failed to create " - "MPU-401 device at 0x%lx\n", - port[dev]); - goto _release_dma; - } + err = sscape_upload_bootblock(card); + if (err >= 0) + err = sscape_upload_microcode(card, err); - /* - * Enable the master IRQ ... - */ - sscape_write(sscape, GA_INTENA_REG, 0x80); - - /* - * Initialize mixer - */ - sscape->midi_vol = 0; - host_write_ctrl_unsafe(sscape->io_base, CMD_SET_MIDI_VOL, 100); - host_write_ctrl_unsafe(sscape->io_base, 0, 100); - host_write_ctrl_unsafe(sscape->io_base, CMD_XXX_MIDI_VOL, 100); + if (err == 0) { + err = create_mpu401(card, MIDI_DEVNUM, port[dev], + mpu_irq[dev]); + if (err < 0) { + printk(KERN_ERR "sscape: Failed to create " + "MPU-401 device at 0x%lx\n", + port[dev]); + goto _release_dma; + } + + /* + * Enable the master IRQ ... + */ + sscape_write(sscape, GA_INTENA_REG, 0x80); + + /* + * Initialize mixer + */ + spin_lock_irqsave(&sscape->lock, flags); + sscape->midi_vol = 0; + host_write_ctrl_unsafe(sscape->io_base, + CMD_SET_MIDI_VOL, 100); + host_write_ctrl_unsafe(sscape->io_base, + sscape->midi_vol, 100); + host_write_ctrl_unsafe(sscape->io_base, + CMD_XXX_MIDI_VOL, 100); + host_write_ctrl_unsafe(sscape->io_base, + sscape->midi_vol, 100); + host_write_ctrl_unsafe(sscape->io_base, + CMD_SET_EXTMIDI, 100); + host_write_ctrl_unsafe(sscape->io_base, + 0, 100); + host_write_ctrl_unsafe(sscape->io_base, CMD_ACK, 100); + + set_midi_mode_unsafe(sscape->io_base); + spin_unlock_irqrestore(&sscape->lock, flags); + } } /* @@ -1301,11 +1184,12 @@ static int __devinit snd_sscape_probe(struct device *pdev, unsigned int dev) sscape->type = SSCAPE; dma[dev] &= 0x03; + snd_card_set_dev(card, pdev); + ret = create_sscape(dev, card); if (ret < 0) goto _release_card; - snd_card_set_dev(card, pdev); if ((ret = snd_card_register(card)) < 0) { printk(KERN_ERR "sscape: Failed to register sound card\n"); goto _release_card; @@ -1426,12 +1310,12 @@ static int __devinit sscape_pnp_detect(struct pnp_card_link *pcard, wss_port[idx] = pnp_port_start(dev, 1); dma2[idx] = pnp_dma(dev, 1); } + snd_card_set_dev(card, &pcard->card->dev); ret = create_sscape(idx, card); if (ret < 0) goto _release_card; - snd_card_set_dev(card, &pcard->card->dev); if ((ret = snd_card_register(card)) < 0) { printk(KERN_ERR "sscape: Failed to register sound card\n"); goto _release_card; -- cgit v1.2.3 From c877c25170e2655d519b29e91d6c91d5d1a72a6f Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Thu, 1 Oct 2009 08:33:47 +0200 Subject: ASoC: Fix dependency of CONFIG_SND_PXA2XX_SOC_IMOTE2 wm8940 requires I2C. Signed-off-by: Takashi Iwai --- sound/soc/pxa/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sound') diff --git a/sound/soc/pxa/Kconfig b/sound/soc/pxa/Kconfig index 6375b4ea525..dcb3181bb34 100644 --- a/sound/soc/pxa/Kconfig +++ b/sound/soc/pxa/Kconfig @@ -138,7 +138,7 @@ config SND_PXA2XX_SOC_MIOA701 config SND_PXA2XX_SOC_IMOTE2 tristate "SoC Audio support for IMote 2" - depends on SND_PXA2XX_SOC && MACH_INTELMOTE2 + depends on SND_PXA2XX_SOC && MACH_INTELMOTE2 && I2C select SND_PXA2XX_SOC_I2S select SND_SOC_WM8940 help -- cgit v1.2.3 From df1246d84ab7edc375e6b6d236654ac0866229c5 Mon Sep 17 00:00:00 2001 From: Barry Song Date: Thu, 1 Oct 2009 01:33:30 -0400 Subject: ASoC: fix kconfig order of Blackfin drivers Some of the Blackfin options don't directly follow the kconfig options they depend on, so kconfig is unable to display the proper tree. So sort the options such they expand/collapse properly. Signed-off-by: Barry Song Signed-off-by: Mike Frysinger Signed-off-by: Mark Brown --- sound/soc/blackfin/Kconfig | 98 +++++++++++++++++++++++----------------------- 1 file changed, 49 insertions(+), 49 deletions(-) (limited to 'sound') diff --git a/sound/soc/blackfin/Kconfig b/sound/soc/blackfin/Kconfig index ac927ffdc96..97f1a251e44 100644 --- a/sound/soc/blackfin/Kconfig +++ b/sound/soc/blackfin/Kconfig @@ -7,15 +7,6 @@ config SND_BF5XX_I2S mode (supports single stereo In/Out). You will also need to select the audio interfaces to support below. -config SND_BF5XX_TDM - tristate "SoC I2S(TDM mode) Audio for the ADI BF5xx chip" - depends on (BLACKFIN && SND_SOC) - help - Say Y or M if you want to add support for codecs attached to - the Blackfin SPORT (synchronous serial ports) interface in TDM - mode. - You will also need to select the audio interfaces to support below. - config SND_BF5XX_SOC_SSM2602 tristate "SoC SSM2602 Audio support for BF52x ezkit" depends on SND_BF5XX_I2S @@ -41,6 +32,31 @@ config SND_BFIN_AD73311_SE Enter the GPIO used to control AD73311's SE pin. Acceptable values are 0 to 7 +config SND_BF5XX_TDM + tristate "SoC I2S(TDM mode) Audio for the ADI BF5xx chip" + depends on (BLACKFIN && SND_SOC) + help + Say Y or M if you want to add support for codecs attached to + the Blackfin SPORT (synchronous serial ports) interface in TDM + mode. + You will also need to select the audio interfaces to support below. + +config SND_BF5XX_SOC_AD1836 + tristate "SoC AD1836 Audio support for BF5xx" + depends on SND_BF5XX_TDM + select SND_BF5XX_SOC_TDM + select SND_SOC_AD1836 + help + Say Y if you want to add support for SoC audio on BF5xx STAMP/EZKIT. + +config SND_BF5XX_SOC_AD1938 + tristate "SoC AD1938 Audio support for Blackfin" + depends on SND_BF5XX_TDM + select SND_BF5XX_SOC_TDM + select SND_SOC_AD1938 + help + Say Y if you want to add support for AD1938 codec on Blackfin. + config SND_BF5XX_AC97 tristate "SoC AC97 Audio for the ADI BF5xx chip" depends on BLACKFIN @@ -71,6 +87,30 @@ config SND_BF5XX_MULTICHAN_SUPPORT Say y if you want AC97 driver to support up to 5.1 channel audio. this mode will consume much more memory for DMA. +config SND_BF5XX_HAVE_COLD_RESET + bool "BOARD has COLD Reset GPIO" + depends on SND_BF5XX_AC97 + default y if BFIN548_EZKIT + default n if !BFIN548_EZKIT + +config SND_BF5XX_RESET_GPIO_NUM + int "Set a GPIO for cold reset" + depends on SND_BF5XX_HAVE_COLD_RESET + range 0 159 + default 19 if BFIN548_EZKIT + default 5 if BFIN537_STAMP + default 0 + help + Set the correct GPIO for RESET the sound chip. + +config SND_BF5XX_SOC_AD1980 + tristate "SoC AD1980/1 Audio support for BF5xx" + depends on SND_BF5XX_AC97 + select SND_BF5XX_SOC_AC97 + select SND_SOC_AD1980 + help + Say Y if you want to add support for SoC audio on BF5xx STAMP/EZKIT. + config SND_BF5XX_SOC_SPORT tristate @@ -88,30 +128,6 @@ config SND_BF5XX_SOC_AC97 select SND_SOC_AC97_BUS select SND_BF5XX_SOC_SPORT -config SND_BF5XX_SOC_AD1836 - tristate "SoC AD1836 Audio support for BF5xx" - depends on SND_BF5XX_TDM - select SND_BF5XX_SOC_TDM - select SND_SOC_AD1836 - help - Say Y if you want to add support for SoC audio on BF5xx STAMP/EZKIT. - -config SND_BF5XX_SOC_AD1980 - tristate "SoC AD1980/1 Audio support for BF5xx" - depends on SND_BF5XX_AC97 - select SND_BF5XX_SOC_AC97 - select SND_SOC_AD1980 - help - Say Y if you want to add support for SoC audio on BF5xx STAMP/EZKIT. - -config SND_BF5XX_SOC_AD1938 - tristate "SoC AD1938 Audio support for Blackfin" - depends on SND_BF5XX_TDM - select SND_BF5XX_SOC_TDM - select SND_SOC_AD1938 - help - Say Y if you want to add support for AD1938 codec on Blackfin. - config SND_BF5XX_SPORT_NUM int "Set a SPORT for Sound chip" depends on (SND_BF5XX_I2S || SND_BF5XX_AC97 || SND_BF5XX_TDM) @@ -120,19 +136,3 @@ config SND_BF5XX_SPORT_NUM default 0 help Set the correct SPORT for sound chip. - -config SND_BF5XX_HAVE_COLD_RESET - bool "BOARD has COLD Reset GPIO" - depends on SND_BF5XX_AC97 - default y if BFIN548_EZKIT - default n if !BFIN548_EZKIT - -config SND_BF5XX_RESET_GPIO_NUM - int "Set a GPIO for cold reset" - depends on SND_BF5XX_HAVE_COLD_RESET - range 0 159 - default 19 if BFIN548_EZKIT - default 5 if BFIN537_STAMP - default 0 - help - Set the correct GPIO for RESET the sound chip. -- cgit v1.2.3 From ebb6f6acbc7c23dfb23739bf02dd987500949bd0 Mon Sep 17 00:00:00 2001 From: Daniel T Chen Date: Thu, 1 Oct 2009 18:56:30 -0400 Subject: ALSA: intel8x0 - Mute External Amplifier by default for Sony VAIO VGN-B1VP BugLink: https://bugs.launchpad.net/bugs/410933 This Sony VAIO model also needs External Amplifier unmuted for audible playback, so make sure we set the inv_eapd quirk. Signed-off-by: Daniel T Chen Signed-off-by: Takashi Iwai --- sound/pci/intel8x0.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'sound') diff --git a/sound/pci/intel8x0.c b/sound/pci/intel8x0.c index 86e9a2d6e03..754867ed478 100644 --- a/sound/pci/intel8x0.c +++ b/sound/pci/intel8x0.c @@ -1960,6 +1960,12 @@ static struct ac97_quirk ac97_quirks[] __devinitdata = { .name = "Sony VAIO VGN-T350P", /*AD1981B*/ .type = AC97_TUNE_INV_EAPD }, + { + .subvendor = 0x104d, + .subdevice = 0x81c5, + .name = "Sony VAIO VGN-B1VP", /*AD1981B*/ + .type = AC97_TUNE_INV_EAPD + }, { .subvendor = 0x1043, .subdevice = 0x80f3, -- cgit v1.2.3 From a656cbf07f1106db941af337ac0051347fb778a5 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Thu, 1 Oct 2009 18:08:18 +0200 Subject: sound: Make keywest_driver static I can't see any reason for struct i2c_driver keywest_driver to not be static. Signed-off-by: Jean Delvare Signed-off-by: Takashi Iwai --- sound/ppc/keywest.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sound') diff --git a/sound/ppc/keywest.c b/sound/ppc/keywest.c index bb6819aab13..d06f780bd7e 100644 --- a/sound/ppc/keywest.c +++ b/sound/ppc/keywest.c @@ -98,7 +98,7 @@ static const struct i2c_device_id keywest_i2c_id[] = { { } }; -struct i2c_driver keywest_driver = { +static struct i2c_driver keywest_driver = { .driver = { .name = "PMac Keywest Audio", }, -- cgit v1.2.3 From 3b04691c2b1661c7e64cd4222d7175b5bf87163f Mon Sep 17 00:00:00 2001 From: Sven Eckelmann Date: Thu, 1 Oct 2009 20:06:39 +0200 Subject: ALSA: ctxfi: Swapped SURROUND-SIDE mute On Soundblaster X-FI Titenium with emu20k2 the SIDE and SURROUND mute functions are swapped. It was checked with 'speaker-test -c 8 -s 3' and (un)mute surround or 'speaker-test -c 8 -s 7' and (un)mute side. The volume seems not to be affected and works as expected. Signed-off-by: Sven Eckelmann Signed-off-by: Takashi Iwai --- sound/pci/ctxfi/ctatc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'sound') diff --git a/sound/pci/ctxfi/ctatc.c b/sound/pci/ctxfi/ctatc.c index b1b3a644f73..75454648d50 100644 --- a/sound/pci/ctxfi/ctatc.c +++ b/sound/pci/ctxfi/ctatc.c @@ -1037,7 +1037,7 @@ static int atc_line_front_unmute(struct ct_atc *atc, unsigned char state) static int atc_line_surround_unmute(struct ct_atc *atc, unsigned char state) { - return atc_daio_unmute(atc, state, LINEO4); + return atc_daio_unmute(atc, state, LINEO2); } static int atc_line_clfe_unmute(struct ct_atc *atc, unsigned char state) @@ -1047,7 +1047,7 @@ static int atc_line_clfe_unmute(struct ct_atc *atc, unsigned char state) static int atc_line_rear_unmute(struct ct_atc *atc, unsigned char state) { - return atc_daio_unmute(atc, state, LINEO2); + return atc_daio_unmute(atc, state, LINEO4); } static int atc_line_in_unmute(struct ct_atc *atc, unsigned char state) -- cgit v1.2.3 From 2f229a31aac86ea6911d70ec4c79196ca711d625 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Fri, 2 Oct 2009 11:04:54 +0200 Subject: ALSA: Fix invalid __exit in sound/mips/*.c MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The remove callback has to be marked as __devexit, as the dynamic unbind is possible. Reported-by: Uwe Kleine-König Signed-off-by: Takashi Iwai --- sound/mips/hal2.c | 2 +- sound/mips/sgio2audio.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'sound') diff --git a/sound/mips/hal2.c b/sound/mips/hal2.c index c52691c2fc4..9a88cdfd952 100644 --- a/sound/mips/hal2.c +++ b/sound/mips/hal2.c @@ -915,7 +915,7 @@ static int __devinit hal2_probe(struct platform_device *pdev) return 0; } -static int __exit hal2_remove(struct platform_device *pdev) +static int __devexit hal2_remove(struct platform_device *pdev) { struct snd_card *card = platform_get_drvdata(pdev); diff --git a/sound/mips/sgio2audio.c b/sound/mips/sgio2audio.c index e497525bc11..8691f4cf619 100644 --- a/sound/mips/sgio2audio.c +++ b/sound/mips/sgio2audio.c @@ -973,7 +973,7 @@ static int __devinit snd_sgio2audio_probe(struct platform_device *pdev) return 0; } -static int __exit snd_sgio2audio_remove(struct platform_device *pdev) +static int __devexit snd_sgio2audio_remove(struct platform_device *pdev) { struct snd_card *card = platform_get_drvdata(pdev); -- cgit v1.2.3 From eaeae5d9b783a62e435645122bed90561924a2d6 Mon Sep 17 00:00:00 2001 From: Peter Ujfalusi Date: Wed, 30 Sep 2009 09:27:24 +0300 Subject: ASoC: Fix SND_SOC_DAPM_LINE handling Since the SND_SOC_DAPM_LINE can be input or output, additional check is needed in order to determine if the widget is connected as input or output. When checking for connected outputs, if the widget is line, than check if the sources list is not empty (line is connected as output) For input endpoint check, when the widget is line, also check if the sinks list is not empty (line is connected as input). Signed-off-by: Peter Ujfalusi Signed-off-by: Mark Brown --- sound/soc/soc-dapm.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'sound') diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c index f79711b9fa5..8de6f9dec4a 100644 --- a/sound/soc/soc-dapm.c +++ b/sound/soc/soc-dapm.c @@ -524,7 +524,7 @@ static int is_connected_output_ep(struct snd_soc_dapm_widget *widget) /* connected jack or spk ? */ if (widget->id == snd_soc_dapm_hp || widget->id == snd_soc_dapm_spk || - widget->id == snd_soc_dapm_line) + (widget->id == snd_soc_dapm_line && !list_empty(&widget->sources))) return 1; } @@ -573,7 +573,8 @@ static int is_connected_input_ep(struct snd_soc_dapm_widget *widget) return 1; /* connected jack ? */ - if (widget->id == snd_soc_dapm_mic || widget->id == snd_soc_dapm_line) + if (widget->id == snd_soc_dapm_mic || + (widget->id == snd_soc_dapm_line && !list_empty(&widget->sinks))) return 1; } -- cgit v1.2.3 From 08d1e635089f41e28fec644a8620a0e8d66b1235 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Fri, 2 Oct 2009 14:06:08 +0200 Subject: ALSA: usb - Use strlcat() correctly Don't pass the advanced position to strlcat() but just gives the buffer head position so that the max size limit can be checked correctly. Introduced a new helper function to standaralize strlcat() calls. Signed-off-by: Takashi Iwai --- sound/usb/usbmixer.c | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) (limited to 'sound') diff --git a/sound/usb/usbmixer.c b/sound/usb/usbmixer.c index ab5a3ac2ac4..9efcfd08d74 100644 --- a/sound/usb/usbmixer.c +++ b/sound/usb/usbmixer.c @@ -898,6 +898,11 @@ static struct snd_kcontrol_new usb_feature_unit_ctl = { * build a feature control */ +static size_t append_ctl_name(struct snd_kcontrol *kctl, const char *str) +{ + return strlcat(kctl->id.name, str, sizeof(kctl->id.name)); +} + static void build_feature_ctl(struct mixer_build *state, unsigned char *desc, unsigned int ctl_mask, int control, struct usb_audio_term *iterm, int unitid) @@ -978,13 +983,13 @@ static void build_feature_ctl(struct mixer_build *state, unsigned char *desc, */ if (! mapped_name && ! (state->oterm.type >> 16)) { if ((state->oterm.type & 0xff00) == 0x0100) { - len = strlcat(kctl->id.name, " Capture", sizeof(kctl->id.name)); + len = append_ctl_name(kctl, " Capture"); } else { - len = strlcat(kctl->id.name + len, " Playback", sizeof(kctl->id.name)); + len = append_ctl_name(kctl, " Playback"); } } - strlcat(kctl->id.name + len, control == USB_FEATURE_MUTE ? " Switch" : " Volume", - sizeof(kctl->id.name)); + append_ctl_name(kctl, control == USB_FEATURE_MUTE ? + " Switch" : " Volume"); if (control == USB_FEATURE_VOLUME) { kctl->tlv.c = mixer_vol_tlv; kctl->vd[0].access |= @@ -1143,7 +1148,7 @@ static void build_mixer_unit_ctl(struct mixer_build *state, unsigned char *desc, len = get_term_name(state, iterm, kctl->id.name, sizeof(kctl->id.name), 0); if (! len) len = sprintf(kctl->id.name, "Mixer Source %d", in_ch + 1); - strlcat(kctl->id.name + len, " Volume", sizeof(kctl->id.name)); + append_ctl_name(kctl, " Volume"); snd_printdd(KERN_INFO "[%d] MU [%s] ch = %d, val = %d/%d\n", cval->id, kctl->id.name, cval->channels, cval->min, cval->max); @@ -1400,8 +1405,8 @@ static int build_audio_procunit(struct mixer_build *state, int unitid, unsigned if (! len) strlcpy(kctl->id.name, name, sizeof(kctl->id.name)); } - strlcat(kctl->id.name, " ", sizeof(kctl->id.name)); - strlcat(kctl->id.name, valinfo->suffix, sizeof(kctl->id.name)); + append_ctl_name(kctl, " "); + append_ctl_name(kctl, valinfo->suffix); snd_printdd(KERN_INFO "[%d] PU [%s] ch = %d, val = %d/%d\n", cval->id, kctl->id.name, cval->channels, cval->min, cval->max); @@ -1610,9 +1615,9 @@ static int parse_audio_selector_unit(struct mixer_build *state, int unitid, unsi strlcpy(kctl->id.name, "USB", sizeof(kctl->id.name)); if ((state->oterm.type & 0xff00) == 0x0100) - strlcat(kctl->id.name, " Capture Source", sizeof(kctl->id.name)); + append_ctl_name(kctl, " Capture Source"); else - strlcat(kctl->id.name, " Playback Source", sizeof(kctl->id.name)); + append_ctl_name(kctl, " Playback Source"); } snd_printdd(KERN_INFO "[%d] SU [%s] items = %d\n", -- cgit v1.2.3 From e655a43544bd3c45a83da93b00a4b115b4fa758e Mon Sep 17 00:00:00 2001 From: Jonathan Cameron Date: Fri, 2 Oct 2009 16:09:49 +0100 Subject: ASoC: wm8940: Fix check on error code form snd_soc_codec_set_cache_io Fix for typo in commit 8d50e447d19fec64adebeef55f2b60d695435412 ASoC: Factor out I/O for Wolfson 8 bit data 16 bit register CODECs Signed-off-by: Jonathan Cameron Signed-off-by: Mark Brown --- sound/soc/codecs/wm8940.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sound') diff --git a/sound/soc/codecs/wm8940.c b/sound/soc/codecs/wm8940.c index da97aae475a..1ef2454c520 100644 --- a/sound/soc/codecs/wm8940.c +++ b/sound/soc/codecs/wm8940.c @@ -790,7 +790,7 @@ static int wm8940_register(struct wm8940_priv *wm8940, codec->reg_cache = &wm8940->reg_cache; ret = snd_soc_codec_set_cache_io(codec, 8, 16, control); - if (ret == 0) { + if (ret < 0) { dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret); return ret; } -- cgit v1.2.3 From bcde1f8a80d1bdfd43fb498996dfa89666fd7fe3 Mon Sep 17 00:00:00 2001 From: Krzysztof Helt Date: Fri, 2 Oct 2009 18:41:29 +0200 Subject: ALSA: sscape: remove MIDI instances counting with limit ULONG_MAX There is no sense to limit open MIDI connections with limit as high as ULONG_MAX. Also, convert more messages to use the snd_printk. Correct few old and misleading comments as well. Signed-off-by: Krzysztof Helt Signed-off-by: Takashi Iwai --- sound/isa/sscape.c | 101 +++++++++++++++-------------------------------------- 1 file changed, 29 insertions(+), 72 deletions(-) (limited to 'sound') diff --git a/sound/isa/sscape.c b/sound/isa/sscape.c index 1ce465cc66a..c739374af20 100644 --- a/sound/isa/sscape.c +++ b/sound/isa/sscape.c @@ -147,12 +147,6 @@ struct soundscape { struct snd_wss *chip; struct snd_mpu401 *mpu; - /* - * The MIDI device won't work until we've loaded - * its firmware via a hardware-dependent device IOCTL - */ - spinlock_t fwlock; - unsigned long midi_usage; unsigned char midi_vol; }; @@ -164,11 +158,6 @@ static inline struct soundscape *get_card_soundscape(struct snd_card *c) return (struct soundscape *) (c->private_data); } -static inline struct soundscape *get_mpu401_soundscape(struct snd_mpu401 * mpu) -{ - return (struct soundscape *) (mpu->private_data); -} - /* * Allocates some kernel memory that we can use for DMA. * I think this means that the memory has to map to @@ -179,7 +168,9 @@ static struct snd_dma_buffer *get_dmabuf(struct snd_dma_buffer *buf, unsigned lo if (buf) { if (snd_dma_alloc_pages_fallback(SNDRV_DMA_TYPE_DEV, snd_dma_isa_data(), size, buf) < 0) { - snd_printk(KERN_ERR "sscape: Failed to allocate %lu bytes for DMA\n", size); + snd_printk(KERN_ERR "sscape: Failed to allocate " + "%lu bytes for DMA\n", + size); return NULL; } } @@ -482,7 +473,8 @@ static int upload_dma_data(struct soundscape *s, */ spin_unlock_irqrestore(&s->lock, flags); - snd_printk(KERN_ERR "sscape: DMA upload has timed out\n"); + snd_printk(KERN_ERR + "sscape: DMA upload has timed out\n"); ret = -EAGAIN; goto _release_dma; } @@ -504,10 +496,12 @@ static int upload_dma_data(struct soundscape *s, */ ret = 0; if (!obp_startup_ack(s, 5000)) { - snd_printk(KERN_ERR "sscape: No response from on-board processor after upload\n"); + snd_printk(KERN_ERR "sscape: No response " + "from on-board processor after upload\n"); ret = -EAGAIN; } else if (!host_startup_ack(s, 5000)) { - snd_printk(KERN_ERR "sscape: SoundScape failed to initialise\n"); + snd_printk(KERN_ERR + "sscape: SoundScape failed to initialise\n"); ret = -EAGAIN; } @@ -536,7 +530,7 @@ static int sscape_upload_bootblock(struct snd_card *card) ret = request_firmware(&init_fw, "scope.cod", card->dev); if (ret < 0) { - snd_printk(KERN_ERR "Error loading scope.cod"); + snd_printk(KERN_ERR "sscape: Error loading scope.cod"); return ret; } ret = upload_dma_data(sscape, init_fw->data, init_fw->size); @@ -554,7 +548,8 @@ static int sscape_upload_bootblock(struct snd_card *card) data &= 0xf; if (ret == 0 && data > 7) { - snd_printk(KERN_ERR "timeout reading firmware version\n"); + snd_printk(KERN_ERR + "sscape: timeout reading firmware version\n"); ret = -EAGAIN; } @@ -575,12 +570,13 @@ static int sscape_upload_microcode(struct snd_card *card, int version) err = request_firmware(&init_fw, name, card->dev); if (err < 0) { - snd_printk(KERN_ERR "Error loading sndscape.co%d", version); + snd_printk(KERN_ERR "sscape: Error loading sndscape.co%d", + version); return err; } err = upload_dma_data(sscape, init_fw->data, init_fw->size); if (err == 0) - snd_printk(KERN_INFO "MIDI firmware loaded %d KBs\n", + snd_printk(KERN_INFO "sscape: MIDI firmware loaded %d KBs\n", init_fw->size >> 10); release_firmware(init_fw); @@ -750,7 +746,6 @@ static int __devinit detect_sscape(struct soundscape *s, long wss_io) msleep(1); spin_lock_irqsave(&s->lock, flags); } - snd_printd(KERN_INFO "init delay = %d ms\n", d); if ((inb(wss_io) & 0x80) != 0) goto _done; @@ -774,7 +769,6 @@ static int __devinit detect_sscape(struct soundscape *s, long wss_io) msleep(1); spin_lock_irqsave(&s->lock, flags); } - snd_printd(KERN_INFO "init delay = %d ms\n", d); /* * SoundScape successfully detected! @@ -794,38 +788,13 @@ static int __devinit detect_sscape(struct soundscape *s, long wss_io) */ static int mpu401_open(struct snd_mpu401 * mpu) { - int err; - if (!verify_mpu401(mpu)) { - snd_printk(KERN_ERR "sscape: MIDI disabled, please load firmware\n"); - err = -ENODEV; - } else { - register struct soundscape *sscape = get_mpu401_soundscape(mpu); - unsigned long flags; - - spin_lock_irqsave(&sscape->fwlock, flags); - - if (sscape->midi_usage == ULONG_MAX) { - err = -EBUSY; - } else { - ++(sscape->midi_usage); - err = 0; - } - - spin_unlock_irqrestore(&sscape->fwlock, flags); + snd_printk(KERN_ERR "sscape: MIDI disabled, " + "please load firmware\n"); + return -ENODEV; } - return err; -} - -static void mpu401_close(struct snd_mpu401 * mpu) -{ - register struct soundscape *sscape = get_mpu401_soundscape(mpu); - unsigned long flags; - - spin_lock_irqsave(&sscape->fwlock, flags); - --(sscape->midi_usage); - spin_unlock_irqrestore(&sscape->fwlock, flags); + return 0; } /* @@ -845,8 +814,6 @@ static int __devinit create_mpu401(struct snd_card *card, int devnum, unsigned l struct snd_mpu401 *mpu = (struct snd_mpu401 *) rawmidi->private_data; mpu->open_input = mpu401_open; mpu->open_output = mpu401_open; - mpu->close_input = mpu401_close; - mpu->close_output = mpu401_close; mpu->private_data = sscape; sscape->mpu = mpu; @@ -993,13 +960,13 @@ static int __devinit create_sscape(int dev, struct snd_card *card) } spin_lock_init(&sscape->lock); - spin_lock_init(&sscape->fwlock); sscape->io_res = io_res; sscape->wss_res = wss_res; sscape->io_base = port[dev]; if (!detect_sscape(sscape, wss_port[dev])) { - printk(KERN_ERR "sscape: hardware not detected at 0x%x\n", sscape->io_base); + printk(KERN_ERR "sscape: hardware not detected at 0x%x\n", + sscape->io_base); err = -ENODEV; goto _release_dma; } @@ -1036,7 +1003,7 @@ static int __devinit create_sscape(int dev, struct snd_card *card) mpu_irq_cfg = get_irq_config(sscape->type, mpu_irq[dev]); if (mpu_irq_cfg == INVALID_IRQ) { - printk(KERN_ERR "sscape: Invalid IRQ %d\n", mpu_irq[dev]); + snd_printk(KERN_ERR "sscape: Invalid IRQ %d\n", mpu_irq[dev]); return -ENXIO; } @@ -1073,8 +1040,9 @@ static int __devinit create_sscape(int dev, struct snd_card *card) err = create_ad1845(card, wss_port[dev], irq[dev], dma[dev], dma2[dev]); if (err < 0) { - printk(KERN_ERR "sscape: No AD1845 device at 0x%lx, IRQ %d\n", - wss_port[dev], irq[dev]); + snd_printk(KERN_ERR + "sscape: No AD1845 device at 0x%lx, IRQ %d\n", + wss_port[dev], irq[dev]); goto _release_dma; } strcpy(card->driver, "SoundScape"); @@ -1094,7 +1062,7 @@ static int __devinit create_sscape(int dev, struct snd_card *card) err = create_mpu401(card, MIDI_DEVNUM, port[dev], mpu_irq[dev]); if (err < 0) { - printk(KERN_ERR "sscape: Failed to create " + snd_printk(KERN_ERR "sscape: Failed to create " "MPU-401 device at 0x%lx\n", port[dev]); goto _release_dma; @@ -1191,7 +1159,7 @@ static int __devinit snd_sscape_probe(struct device *pdev, unsigned int dev) goto _release_card; if ((ret = snd_card_register(card)) < 0) { - printk(KERN_ERR "sscape: Failed to register sound card\n"); + snd_printk(KERN_ERR "sscape: Failed to register sound card\n"); goto _release_card; } dev_set_drvdata(pdev, card); @@ -1250,18 +1218,7 @@ static int __devinit sscape_pnp_detect(struct pnp_card_link *pcard, * We have found a candidate ISA PnP card. Now we * have to check that it has the devices that we * expect it to have. - * - * We will NOT try and autoconfigure all of the resources - * needed and then activate the card as we are assuming that - * has already been done at boot-time using /proc/isapnp. - * We shall simply try to give each active card the resources - * that it wants. This is a sensible strategy for a modular - * system where unused modules are unloaded regularly. - * - * This strategy is utterly useless if we compile the driver - * into the kernel, of course. */ - // printk(KERN_INFO "sscape: %s\n", card->name); /* * Check that we still have room for another sound card ... @@ -1272,7 +1229,7 @@ static int __devinit sscape_pnp_detect(struct pnp_card_link *pcard, if (!pnp_is_active(dev)) { if (pnp_activate_dev(dev) < 0) { - printk(KERN_INFO "sscape: device is inactive\n"); + snd_printk(KERN_INFO "sscape: device is inactive\n"); return -EBUSY; } } @@ -1317,7 +1274,7 @@ static int __devinit sscape_pnp_detect(struct pnp_card_link *pcard, goto _release_card; if ((ret = snd_card_register(card)) < 0) { - printk(KERN_ERR "sscape: Failed to register sound card\n"); + snd_printk(KERN_ERR "sscape: Failed to register sound card\n"); goto _release_card; } -- cgit v1.2.3 From 1cb0fdebae08f6daaac81197d8dde1746e0a1d96 Mon Sep 17 00:00:00 2001 From: Krzysztof Helt Date: Mon, 5 Oct 2009 18:18:57 +0200 Subject: ALSA: sscape: force AD1848 codec mode on old Soundscape Old Soundscape cards (pre PnP) work only with AD1848 codecs. If the CS4231 codec is installed it must be used in AD1848 compatible mode. Also, add gameport support and remove an unused mpu field. Signed-off-by: Krzysztof Helt Signed-off-by: Takashi Iwai --- sound/isa/sscape.c | 33 +++++++++++++++++++++++++++++---- 1 file changed, 29 insertions(+), 4 deletions(-) (limited to 'sound') diff --git a/sound/isa/sscape.c b/sound/isa/sscape.c index c739374af20..279be505b72 100644 --- a/sound/isa/sscape.c +++ b/sound/isa/sscape.c @@ -54,6 +54,7 @@ static int irq[SNDRV_CARDS] __devinitdata = SNDRV_DEFAULT_IRQ; static int mpu_irq[SNDRV_CARDS] __devinitdata = SNDRV_DEFAULT_IRQ; static int dma[SNDRV_CARDS] __devinitdata = SNDRV_DEFAULT_DMA; static int dma2[SNDRV_CARDS] __devinitdata = SNDRV_DEFAULT_DMA; +static bool joystick[SNDRV_CARDS] __devinitdata; module_param_array(index, int, NULL, 0444); MODULE_PARM_DESC(index, "Index number for SoundScape soundcard"); @@ -79,6 +80,9 @@ MODULE_PARM_DESC(dma, "DMA # for SoundScape driver."); module_param_array(dma2, int, NULL, 0444); MODULE_PARM_DESC(dma2, "DMA2 # for SoundScape driver."); +module_param_array(joystick, bool, NULL, 0444); +MODULE_PARM_DESC(joystick, "Enable gameport."); + #ifdef CONFIG_PNP static int isa_registered; static int pnp_registered; @@ -145,7 +149,6 @@ struct soundscape { struct resource *io_res; struct resource *wss_res; struct snd_wss *chip; - struct snd_mpu401 *mpu; unsigned char midi_vol; }; @@ -815,7 +818,6 @@ static int __devinit create_mpu401(struct snd_card *card, int devnum, unsigned l mpu->open_input = mpu401_open; mpu->open_output = mpu401_open; mpu->private_data = sscape; - sscape->mpu = mpu; initialise_mpu401(mpu); } @@ -836,12 +838,30 @@ static int __devinit create_ad1845(struct snd_card *card, unsigned port, register struct soundscape *sscape = get_card_soundscape(card); struct snd_wss *chip; int err; + int codec_type = WSS_HW_DETECT; + + switch (sscape->type) { + case MEDIA_FX: + case SSCAPE: + /* + * There are some freak examples of early Soundscape cards + * with CS4231 instead of AD1848/CS4248. Unfortunately, the + * CS4231 works only in CS4248 compatibility mode on + * these cards so force it. + */ + if (sscape->ic_type != IC_OPUS) + codec_type = WSS_HW_AD1848; + break; - if (sscape->type == SSCAPE_VIVO) + case SSCAPE_VIVO: port += 4; + break; + default: + break; + } err = snd_wss_create(card, port, -1, irq, dma1, dma2, - WSS_HW_DETECT, WSS_HWSHARE_DMA1, &chip); + codec_type, WSS_HWSHARE_DMA1, &chip); if (!err) { unsigned long flags; struct snd_pcm *pcm; @@ -927,6 +947,7 @@ static int __devinit create_sscape(int dev, struct snd_card *card) struct resource *wss_res; unsigned long flags; int err; + int val; const char *name; /* @@ -1026,6 +1047,10 @@ static int __devinit create_sscape(int dev, struct snd_card *card) sscape_write_unsafe(sscape->io_base, GA_DMAB_REG, 0x20); mpu_irq_cfg |= mpu_irq_cfg << 2; + val = sscape_read_unsafe(sscape->io_base, GA_HMCTL_REG) & 0xF7; + if (joystick[dev]) + val |= 8; + sscape_write_unsafe(sscape->io_base, GA_HMCTL_REG, val | 0x10); sscape_write_unsafe(sscape->io_base, GA_INTCFG_REG, 0xf0 | mpu_irq_cfg); sscape_write_unsafe(sscape->io_base, GA_CDCFG_REG, 0x09 | DMA_8BIT -- cgit v1.2.3 From ed76f652d5329d9dff0ea7f3953b1357ed7f8e6e Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Mon, 5 Oct 2009 18:27:28 +0200 Subject: ALSA: sscape - Remove invalid __devinitdata to module parameters Module parameters shouldn't be marked as __devinitdata since they can be referred via sysfs even after probing. Signed-off-by: Takashi Iwai --- sound/isa/sscape.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'sound') diff --git a/sound/isa/sscape.c b/sound/isa/sscape.c index 279be505b72..579a59b9e47 100644 --- a/sound/isa/sscape.c +++ b/sound/isa/sscape.c @@ -46,15 +46,15 @@ MODULE_FIRMWARE("sndscape.co3"); MODULE_FIRMWARE("sndscape.co4"); MODULE_FIRMWARE("scope.cod"); -static int index[SNDRV_CARDS] __devinitdata = SNDRV_DEFAULT_IDX; -static char* id[SNDRV_CARDS] __devinitdata = SNDRV_DEFAULT_STR; -static long port[SNDRV_CARDS] __devinitdata = SNDRV_DEFAULT_PORT; -static long wss_port[SNDRV_CARDS] __devinitdata = SNDRV_DEFAULT_PORT; -static int irq[SNDRV_CARDS] __devinitdata = SNDRV_DEFAULT_IRQ; -static int mpu_irq[SNDRV_CARDS] __devinitdata = SNDRV_DEFAULT_IRQ; -static int dma[SNDRV_CARDS] __devinitdata = SNDRV_DEFAULT_DMA; -static int dma2[SNDRV_CARDS] __devinitdata = SNDRV_DEFAULT_DMA; -static bool joystick[SNDRV_CARDS] __devinitdata; +static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; +static char* id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; +static long port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; +static long wss_port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; +static int irq[SNDRV_CARDS] = SNDRV_DEFAULT_IRQ; +static int mpu_irq[SNDRV_CARDS] = SNDRV_DEFAULT_IRQ; +static int dma[SNDRV_CARDS] = SNDRV_DEFAULT_DMA; +static int dma2[SNDRV_CARDS] = SNDRV_DEFAULT_DMA; +static bool joystick[SNDRV_CARDS]; module_param_array(index, int, NULL, 0444); MODULE_PARM_DESC(index, "Index number for SoundScape soundcard"); -- cgit v1.2.3 From 2fb930b53f513cbc4c102d415d2923a8a7091337 Mon Sep 17 00:00:00 2001 From: Clemens Ladisch Date: Tue, 6 Oct 2009 08:21:04 +0200 Subject: sound: via82xx: move DXS volume controls to PCM interface The "VIA DXS" controls are actually volume controls that apply to the four PCM substreams, so we better indicate this connection by moving the controls to the PCM interface. Commit b452e08e73c0e3dbb0be82130217be4b7084299e in 2.6.30 broke the restoring of these volumes by "alsactl restore" that most distributions use; the renaming in this patch cures that regression by preventing alsactl from applying the old, wrong volume levels to the new controls. http://bugzilla.kernel.org/show_bug.cgi?id=14151 http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=532613 Signed-off-by: Clemens Ladisch Cc: Signed-off-by: Takashi Iwai --- sound/pci/via82xx.c | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) (limited to 'sound') diff --git a/sound/pci/via82xx.c b/sound/pci/via82xx.c index acfa4760da4..91683a34903 100644 --- a/sound/pci/via82xx.c +++ b/sound/pci/via82xx.c @@ -1626,7 +1626,7 @@ static int snd_via8233_dxs_volume_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { struct via82xx *chip = snd_kcontrol_chip(kcontrol); - unsigned int idx = snd_ctl_get_ioff(kcontrol, &ucontrol->id); + unsigned int idx = kcontrol->id.subdevice; ucontrol->value.integer.value[0] = VIA_DXS_MAX_VOLUME - chip->playback_volume[idx][0]; ucontrol->value.integer.value[1] = VIA_DXS_MAX_VOLUME - chip->playback_volume[idx][1]; @@ -1646,7 +1646,7 @@ static int snd_via8233_dxs_volume_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { struct via82xx *chip = snd_kcontrol_chip(kcontrol); - unsigned int idx = snd_ctl_get_ioff(kcontrol, &ucontrol->id); + unsigned int idx = kcontrol->id.subdevice; unsigned long port = chip->port + 0x10 * idx; unsigned char val; int i, change = 0; @@ -1705,11 +1705,12 @@ static struct snd_kcontrol_new snd_via8233_pcmdxs_volume_control __devinitdata = }; static struct snd_kcontrol_new snd_via8233_dxs_volume_control __devinitdata = { - .name = "VIA DXS Playback Volume", - .iface = SNDRV_CTL_ELEM_IFACE_MIXER, + .iface = SNDRV_CTL_ELEM_IFACE_PCM, + .device = 0, + /* .subdevice set later */ + .name = "PCM Playback Volume", .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | SNDRV_CTL_ELEM_ACCESS_TLV_READ), - .count = 4, .info = snd_via8233_dxs_volume_info, .get = snd_via8233_dxs_volume_get, .put = snd_via8233_dxs_volume_put, @@ -1936,10 +1937,18 @@ static int __devinit snd_via8233_init_misc(struct via82xx *chip) } else /* Using DXS when PCM emulation is enabled is really weird */ { - /* Standalone DXS controls */ - err = snd_ctl_add(chip->card, snd_ctl_new1(&snd_via8233_dxs_volume_control, chip)); - if (err < 0) - return err; + for (i = 0; i < 4; ++i) { + struct snd_kcontrol *kctl; + + kctl = snd_ctl_new1( + &snd_via8233_dxs_volume_control, chip); + if (!kctl) + return -ENOMEM; + kctl->id.subdevice = i; + err = snd_ctl_add(chip->card, kctl); + if (err < 0) + return err; + } } } /* select spdif data slot 10/11 */ -- cgit v1.2.3 From b266002abf6dfa4b358fdb5495f09e350b296552 Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Tue, 6 Oct 2009 19:25:02 +0100 Subject: ASoC: Remove absent SYNC and TDM DAI format options from i.MX SSI These should be handled via set_tdm_slot() now and cause build failures as-is. Signed-off-by: Mark Brown --- sound/soc/imx/mxc-ssi.c | 8 -------- 1 file changed, 8 deletions(-) (limited to 'sound') diff --git a/sound/soc/imx/mxc-ssi.c b/sound/soc/imx/mxc-ssi.c index 3806ff2c0cd..ccdefe60e75 100644 --- a/sound/soc/imx/mxc-ssi.c +++ b/sound/soc/imx/mxc-ssi.c @@ -397,14 +397,6 @@ static int imx_ssi_set_dai_fmt(struct snd_soc_dai *cpu_dai, break; } - /* sync */ - if (!(fmt & SND_SOC_DAIFMT_ASYNC)) - scr |= SSI_SCR_SYN; - - /* tdm - only for stereo atm */ - if (fmt & SND_SOC_DAIFMT_TDM) - scr |= SSI_SCR_NET; - if (cpu_dai->id == IMX_DAI_SSI0 || cpu_dai->id == IMX_DAI_SSI2) { SSI1_STCR = stcr; SSI1_SRCR = srcr; -- cgit v1.2.3 From 5b7dde346881b12246669ae97b3a2793c27b32b6 Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Mon, 29 Jun 2009 11:17:10 +0100 Subject: ASoC: WM8350 capture PGA mutes are inverted Signed-off-by: Mark Brown Cc: stable@kernel.org --- sound/soc/codecs/wm8350.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/wm8350.c b/sound/soc/codecs/wm8350.c index e7348d341b7..26f826c6e74 100644 --- a/sound/soc/codecs/wm8350.c +++ b/sound/soc/codecs/wm8350.c @@ -580,7 +580,7 @@ static const struct snd_kcontrol_new wm8350_left_capt_mixer_controls[] = { SOC_DAPM_SINGLE_TLV("L3 Capture Volume", WM8350_INPUT_MIXER_VOLUME_L, 9, 7, 0, out_mix_tlv), SOC_DAPM_SINGLE("PGA Capture Switch", - WM8350_LEFT_INPUT_VOLUME, 14, 1, 0), + WM8350_LEFT_INPUT_VOLUME, 14, 1, 1), }; /* Right Input Mixer */ @@ -590,7 +590,7 @@ static const struct snd_kcontrol_new wm8350_right_capt_mixer_controls[] = { SOC_DAPM_SINGLE_TLV("L3 Capture Volume", WM8350_INPUT_MIXER_VOLUME_R, 13, 7, 0, out_mix_tlv), SOC_DAPM_SINGLE("PGA Capture Switch", - WM8350_RIGHT_INPUT_VOLUME, 14, 1, 0), + WM8350_RIGHT_INPUT_VOLUME, 14, 1, 1), }; /* Left Mic Mixer */ -- cgit v1.2.3 From 2bdf66331c3ff8d564efe7a054f1099133d520cd Mon Sep 17 00:00:00 2001 From: Pavel Hofman Date: Tue, 6 Oct 2009 16:04:11 +0200 Subject: ALSA: ICE1712/24 - Change the Multi Track Peak control (level meters) from MIXER to PCM type * PLEASE NOTE - this change requires the corresponding update of envy24control for ice1712 - kind of an ABI change. * The "Multi Track Peak" control is read-only level meters indicator. * The control is VERY confusing to most users since it is currently displayed in regular mixers. E.g. alsamixer ignores its read-only status and allows changing the levels with keys which makes no sense. Signed-off-by: Pavel Hofman Acked-by: Jaroslav Kysela Signed-off-by: Takashi Iwai --- sound/pci/ice1712/ice1712.c | 2 +- sound/pci/ice1712/ice1724.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'sound') diff --git a/sound/pci/ice1712/ice1712.c b/sound/pci/ice1712/ice1712.c index cecf1ffeeaa..d74033a2cfb 100644 --- a/sound/pci/ice1712/ice1712.c +++ b/sound/pci/ice1712/ice1712.c @@ -2259,7 +2259,7 @@ static int snd_ice1712_pro_peak_get(struct snd_kcontrol *kcontrol, } static struct snd_kcontrol_new snd_ice1712_mixer_pro_peak __devinitdata = { - .iface = SNDRV_CTL_ELEM_IFACE_MIXER, + .iface = SNDRV_CTL_ELEM_IFACE_PCM, .name = "Multi Track Peak", .access = SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE, .info = snd_ice1712_pro_peak_info, diff --git a/sound/pci/ice1712/ice1724.c b/sound/pci/ice1712/ice1724.c index af6e0014862..c24f268f63a 100644 --- a/sound/pci/ice1712/ice1724.c +++ b/sound/pci/ice1712/ice1724.c @@ -2110,7 +2110,7 @@ static int snd_vt1724_pro_peak_get(struct snd_kcontrol *kcontrol, } static struct snd_kcontrol_new snd_vt1724_mixer_pro_peak __devinitdata = { - .iface = SNDRV_CTL_ELEM_IFACE_MIXER, + .iface = SNDRV_CTL_ELEM_IFACE_PCM, .name = "Multi Track Peak", .access = SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE, .info = snd_vt1724_pro_peak_info, -- cgit v1.2.3 From 8dce39b8955be6164172cb6204ef8fc21de27431 Mon Sep 17 00:00:00 2001 From: Krzysztof Helt Date: Wed, 7 Oct 2009 22:51:34 +0200 Subject: ALSA: opl3: circular locking in the snd_opl3_note_on() and snd_opl3_note_off() Fix following circular locking in the opl3 driver. ======================================================= [ INFO: possible circular locking dependency detected ] 2.6.32-rc3 #87 ------------------------------------------------------- swapper/0 is trying to acquire lock: (&opl3->voice_lock){..-...}, at: [] snd_opl3_note_off+0x1e/0xe0 [snd_opl3_synth] but task is already holding lock: (&opl3->sys_timer_lock){..-...}, at: [] snd_opl3_timer_func+0x19/0xc0 [snd_opl3_synth] which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #1 (&opl3->sys_timer_lock){..-...}: [] validate_chain+0xa25/0x1040 [] __lock_acquire+0x2da/0xab0 [] lock_acquire+0x7a/0xa0 [] _spin_lock_irqsave+0x40/0x60 [] snd_opl3_note_on+0x686/0x790 [snd_opl3_synth] [] snd_midi_process_event+0x322/0x590 [snd_seq_midi_emul] [] snd_opl3_synth_event_input+0x15/0x20 [snd_opl3_synth] [] snd_seq_deliver_single_event+0x100/0x200 [snd_seq] [] snd_seq_deliver_event+0x47/0x1f0 [snd_seq] [] snd_seq_dispatch_event+0x3b/0x140 [snd_seq] [] snd_seq_check_queue+0x10c/0x120 [snd_seq] [] snd_seq_enqueue_event+0x6b/0xe0 [snd_seq] [] snd_seq_client_enqueue_event+0xdd/0x100 [snd_seq] [] snd_seq_write+0xea/0x190 [snd_seq] [] vfs_write+0x96/0x160 [] sys_write+0x3d/0x70 [] syscall_call+0x7/0xb -> #0 (&opl3->voice_lock){..-...}: [] validate_chain+0x1036/0x1040 [] __lock_acquire+0x2da/0xab0 [] lock_acquire+0x7a/0xa0 [] _spin_lock_irqsave+0x40/0x60 [] snd_opl3_note_off+0x1e/0xe0 [snd_opl3_synth] [] snd_opl3_timer_func+0xa0/0xc0 [snd_opl3_synth] [] run_timer_softirq+0x166/0x1e0 [] __do_softirq+0x78/0x110 [] do_softirq+0x46/0x50 [] irq_exit+0x36/0x40 [] do_IRQ+0x42/0xb0 [] common_interrupt+0x2e/0x40 [] apm_cpu_idle+0x10f/0x290 [] cpu_idle+0x21/0x40 [] rest_init+0x4d/0x60 [] start_kernel+0x235/0x280 [] i386_start_kernel+0x66/0x70 other info that might help us debug this: 2 locks held by swapper/0: #0: (&opl3->tlist){+.-...}, at: [] run_timer_softirq+0xf0/0x1e0 #1: (&opl3->sys_timer_lock){..-...}, at: [] snd_opl3_timer_func+0x19/0xc0 [snd_opl3_synth] stack backtrace: Pid: 0, comm: swapper Not tainted 2.6.32-rc3 #87 Call Trace: [] print_circular_bug+0xc8/0xd0 [] validate_chain+0x1036/0x1040 [] ? check_usage_forwards+0x54/0xd0 [] __lock_acquire+0x2da/0xab0 [] lock_acquire+0x7a/0xa0 [] ? snd_opl3_note_off+0x1e/0xe0 [snd_opl3_synth] [] _spin_lock_irqsave+0x40/0x60 [] ? snd_opl3_note_off+0x1e/0xe0 [snd_opl3_synth] [] snd_opl3_note_off+0x1e/0xe0 [snd_opl3_synth] [] ? _spin_lock_irqsave+0x47/0x60 [] snd_opl3_timer_func+0xa0/0xc0 [snd_opl3_synth] [] run_timer_softirq+0x166/0x1e0 [] ? run_timer_softirq+0xf0/0x1e0 [] ? snd_opl3_timer_func+0x0/0xc0 [snd_opl3_synth] [] __do_softirq+0x78/0x110 [] ? _spin_unlock+0x1d/0x20 [] ? handle_level_irq+0xaf/0xe0 [] do_softirq+0x46/0x50 [] irq_exit+0x36/0x40 [] do_IRQ+0x42/0xb0 [] ? trace_hardirqs_on_caller+0x12c/0x180 [] common_interrupt+0x2e/0x40 [] ? default_idle+0x38/0x50 [] apm_cpu_idle+0x10f/0x290 [] cpu_idle+0x21/0x40 [] rest_init+0x4d/0x60 [] start_kernel+0x235/0x280 [] ? unknown_bootoption+0x0/0x210 [] i386_start_kernel+0x66/0x70 Signed-off-by: Krzysztof Helt Signed-off-by: Takashi Iwai --- sound/drivers/opl3/opl3_midi.c | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) (limited to 'sound') diff --git a/sound/drivers/opl3/opl3_midi.c b/sound/drivers/opl3/opl3_midi.c index 6e7d09ae0e8..7d722a025d0 100644 --- a/sound/drivers/opl3/opl3_midi.c +++ b/sound/drivers/opl3/opl3_midi.c @@ -29,6 +29,8 @@ extern char snd_opl3_regmap[MAX_OPL2_VOICES][4]; extern int use_internal_drums; +static void snd_opl3_note_off_unsafe(void *p, int note, int vel, + struct snd_midi_channel *chan); /* * The next table looks magical, but it certainly is not. Its values have * been calculated as table[i]=8*log(i/64)/log(2) with an obvious exception @@ -242,16 +244,20 @@ void snd_opl3_timer_func(unsigned long data) int again = 0; int i; - spin_lock_irqsave(&opl3->sys_timer_lock, flags); + spin_lock_irqsave(&opl3->voice_lock, flags); for (i = 0; i < opl3->max_voices; i++) { struct snd_opl3_voice *vp = &opl3->voices[i]; if (vp->state > 0 && vp->note_off_check) { if (vp->note_off == jiffies) - snd_opl3_note_off(opl3, vp->note, 0, vp->chan); + snd_opl3_note_off_unsafe(opl3, vp->note, 0, + vp->chan); else again++; } } + spin_unlock_irqrestore(&opl3->voice_lock, flags); + + spin_lock_irqsave(&opl3->sys_timer_lock, flags); if (again) { opl3->tlist.expires = jiffies + 1; /* invoke again */ add_timer(&opl3->tlist); @@ -658,15 +664,14 @@ static void snd_opl3_kill_voice(struct snd_opl3 *opl3, int voice) /* * Release a note in response to a midi note off. */ -void snd_opl3_note_off(void *p, int note, int vel, struct snd_midi_channel *chan) +static void snd_opl3_note_off_unsafe(void *p, int note, int vel, + struct snd_midi_channel *chan) { struct snd_opl3 *opl3; int voice; struct snd_opl3_voice *vp; - unsigned long flags; - opl3 = p; #ifdef DEBUG_MIDI @@ -674,12 +679,9 @@ void snd_opl3_note_off(void *p, int note, int vel, struct snd_midi_channel *chan chan->number, chan->midi_program, note); #endif - spin_lock_irqsave(&opl3->voice_lock, flags); - if (opl3->synth_mode == SNDRV_OPL3_MODE_SEQ) { if (chan->drum_channel && use_internal_drums) { snd_opl3_drum_switch(opl3, note, vel, 0, chan); - spin_unlock_irqrestore(&opl3->voice_lock, flags); return; } /* this loop will hopefully kill all extra voices, because @@ -697,6 +699,16 @@ void snd_opl3_note_off(void *p, int note, int vel, struct snd_midi_channel *chan snd_opl3_kill_voice(opl3, voice); } } +} + +void snd_opl3_note_off(void *p, int note, int vel, + struct snd_midi_channel *chan) +{ + struct snd_opl3 *opl3 = p; + unsigned long flags; + + spin_lock_irqsave(&opl3->voice_lock, flags); + snd_opl3_note_off_unsafe(p, note, vel, chan); spin_unlock_irqrestore(&opl3->voice_lock, flags); } -- cgit v1.2.3 From 1d4efa6650454177afe30ad97283ff78572d0442 Mon Sep 17 00:00:00 2001 From: Robert Hancock Date: Wed, 7 Oct 2009 20:19:21 -0600 Subject: ALSA: ice1724: increase SPDIF and independent stereo buffer sizes Increase the default and maximum PCM buffer prellocation size for ice1724's SPDIF and independent stereo pair outputs to 256K, which is the hardware's maximum supported size. This allows a reduction in interrupt rate and potentially power usage when an application is not latency-critical. Signed-off-by: Robert Hancock Signed-off-by: Takashi Iwai --- sound/pci/ice1712/ice1724.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'sound') diff --git a/sound/pci/ice1712/ice1724.c b/sound/pci/ice1712/ice1724.c index c24f268f63a..76b717dae4b 100644 --- a/sound/pci/ice1712/ice1724.c +++ b/sound/pci/ice1712/ice1724.c @@ -1294,7 +1294,7 @@ static int __devinit snd_vt1724_pcm_spdif(struct snd_ice1712 *ice, int device) snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(ice->pci), - 64*1024, 64*1024); + 256*1024, 256*1024); ice->pcm = pcm; @@ -1408,7 +1408,7 @@ static int __devinit snd_vt1724_pcm_indep(struct snd_ice1712 *ice, int device) snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(ice->pci), - 64*1024, 64*1024); + 256*1024, 256*1024); ice->pcm_ds = pcm; -- cgit v1.2.3 From 43189a38dada053b820fafc47de8ba665dd3a618 Mon Sep 17 00:00:00 2001 From: Robert Hancock Date: Fri, 9 Oct 2009 22:08:58 -0600 Subject: ALSA: ice1724: Fix surround on Chaintech AV-710 Fix the num_total_dacs setting for Chaintech AV710. The existing comment that only PSDOUT0 is connected is correct, but since the card is using packed AC97 mode to send 6 channels to the codec, num_total_dacs should be set to 6 and not 2. This allows 6-channel surround to work. Also clarify a comment regarding the additional WM8728 codec on this card (it's connected to the SPDIF output and always receives the same data). Signed-off-by: Robert Hancock Signed-off-by: Takashi Iwai --- sound/pci/ice1712/amp.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'sound') diff --git a/sound/pci/ice1712/amp.c b/sound/pci/ice1712/amp.c index 37564300b50..6da21a2bcad 100644 --- a/sound/pci/ice1712/amp.c +++ b/sound/pci/ice1712/amp.c @@ -52,11 +52,13 @@ static int __devinit snd_vt1724_amp_init(struct snd_ice1712 *ice) /* only use basic functionality for now */ - ice->num_total_dacs = 2; /* only PSDOUT0 is connected */ + /* VT1616 6ch codec connected to PSDOUT0 using packed mode */ + ice->num_total_dacs = 6; ice->num_total_adcs = 2; - /* Chaintech AV-710 has another codecs, which need initialization */ - /* initialize WM8728 codec */ + /* Chaintech AV-710 has another WM8728 codec connected to PSDOUT4 + (shared with the SPDIF output). Mixer control for this codec + is not yet supported. */ if (ice->eeprom.subvendor == VT1724_SUBDEVICE_AV710) { for (i = 0; i < ARRAY_SIZE(wm_inits); i += 2) wm_put(ice, wm_inits[i], wm_inits[i+1]); -- cgit v1.2.3 From 6fcfa3959a5f5ecb7c333f54f401575d94eb8172 Mon Sep 17 00:00:00 2001 From: Krzysztof Helt Date: Sat, 10 Oct 2009 10:27:58 +0200 Subject: ALSA: sscape: coding style fixes Fix coding style errors in the driver. Also, add missing argument for CMD_XXX_MIDI_VOL command. Signed-off-by: Krzysztof Helt Signed-off-by: Takashi Iwai --- sound/isa/sscape.c | 169 ++++++++++++++++++++++++++--------------------------- 1 file changed, 83 insertions(+), 86 deletions(-) (limited to 'sound') diff --git a/sound/isa/sscape.c b/sound/isa/sscape.c index 579a59b9e47..e2d5d2d3ed9 100644 --- a/sound/isa/sscape.c +++ b/sound/isa/sscape.c @@ -109,14 +109,14 @@ MODULE_DEVICE_TABLE(pnp_card, sscape_pnpids); #define RX_READY 0x01 #define TX_READY 0x02 -#define CMD_ACK 0x80 -#define CMD_SET_MIDI_VOL 0x84 -#define CMD_GET_MIDI_VOL 0x85 -#define CMD_XXX_MIDI_VOL 0x86 -#define CMD_SET_EXTMIDI 0x8a -#define CMD_GET_EXTMIDI 0x8b -#define CMD_SET_MT32 0x8c -#define CMD_GET_MT32 0x8d +#define CMD_ACK 0x80 +#define CMD_SET_MIDI_VOL 0x84 +#define CMD_GET_MIDI_VOL 0x85 +#define CMD_XXX_MIDI_VOL 0x86 +#define CMD_SET_EXTMIDI 0x8a +#define CMD_GET_EXTMIDI 0x8b +#define CMD_SET_MT32 0x8c +#define CMD_GET_MT32 0x8d enum GA_REG { GA_INTSTAT_REG = 0, @@ -166,10 +166,12 @@ static inline struct soundscape *get_card_soundscape(struct snd_card *c) * I think this means that the memory has to map to * contiguous pages of physical memory. */ -static struct snd_dma_buffer *get_dmabuf(struct snd_dma_buffer *buf, unsigned long size) +static struct snd_dma_buffer *get_dmabuf(struct snd_dma_buffer *buf, + unsigned long size) { if (buf) { - if (snd_dma_alloc_pages_fallback(SNDRV_DMA_TYPE_DEV, snd_dma_isa_data(), + if (snd_dma_alloc_pages_fallback(SNDRV_DMA_TYPE_DEV, + snd_dma_isa_data(), size, buf) < 0) { snd_printk(KERN_ERR "sscape: Failed to allocate " "%lu bytes for DMA\n", @@ -190,13 +192,13 @@ static void free_dmabuf(struct snd_dma_buffer *buf) snd_dma_free_pages(buf); } - /* * This function writes to the SoundScape's control registers, * but doesn't do any locking. It's up to the caller to do that. * This is why this function is "unsafe" ... */ -static inline void sscape_write_unsafe(unsigned io_base, enum GA_REG reg, unsigned char val) +static inline void sscape_write_unsafe(unsigned io_base, enum GA_REG reg, + unsigned char val) { outb(reg, ODIE_ADDR_IO(io_base)); outb(val, ODIE_DATA_IO(io_base)); @@ -206,7 +208,8 @@ static inline void sscape_write_unsafe(unsigned io_base, enum GA_REG reg, unsign * Write to the SoundScape's control registers, and do the * necessary locking ... */ -static void sscape_write(struct soundscape *s, enum GA_REG reg, unsigned char val) +static void sscape_write(struct soundscape *s, enum GA_REG reg, + unsigned char val) { unsigned long flags; @@ -219,7 +222,8 @@ static void sscape_write(struct soundscape *s, enum GA_REG reg, unsigned char va * Read from the SoundScape's control registers, but leave any * locking to the caller. This is why the function is "unsafe" ... */ -static inline unsigned char sscape_read_unsafe(unsigned io_base, enum GA_REG reg) +static inline unsigned char sscape_read_unsafe(unsigned io_base, + enum GA_REG reg) { outb(reg, ODIE_ADDR_IO(io_base)); return inb(ODIE_DATA_IO(io_base)); @@ -248,9 +252,8 @@ static inline void set_midi_mode_unsafe(unsigned io_base) static inline int host_read_unsafe(unsigned io_base) { int data = -1; - if ((inb(HOST_CTRL_IO(io_base)) & RX_READY) != 0) { + if ((inb(HOST_CTRL_IO(io_base)) & RX_READY) != 0) data = inb(HOST_DATA_IO(io_base)); - } return data; } @@ -292,7 +295,7 @@ static inline int host_write_unsafe(unsigned io_base, unsigned char data) * Also leaves all locking-issues to the caller ... */ static int host_write_ctrl_unsafe(unsigned io_base, unsigned char data, - unsigned timeout) + unsigned timeout) { int err; @@ -311,7 +314,7 @@ static int host_write_ctrl_unsafe(unsigned io_base, unsigned char data, * * NOTE: This check is based upon observation, not documentation. */ -static inline int verify_mpu401(const struct snd_mpu401 * mpu) +static inline int verify_mpu401(const struct snd_mpu401 *mpu) { return ((inb(MPU401C(mpu)) & 0xc0) == 0x80); } @@ -319,7 +322,7 @@ static inline int verify_mpu401(const struct snd_mpu401 * mpu) /* * This is apparently the standard way to initailise an MPU-401 */ -static inline void initialise_mpu401(const struct snd_mpu401 * mpu) +static inline void initialise_mpu401(const struct snd_mpu401 *mpu) { outb(0, MPU401D(mpu)); } @@ -329,9 +332,10 @@ static inline void initialise_mpu401(const struct snd_mpu401 * mpu) * The AD1845 detection fails if we *don't* do this, so I * think that this is a good idea ... */ -static inline void activate_ad1845_unsafe(unsigned io_base) +static void activate_ad1845_unsafe(unsigned io_base) { - sscape_write_unsafe(io_base, GA_HMCTL_REG, (sscape_read_unsafe(io_base, GA_HMCTL_REG) & 0xcf) | 0x10); + unsigned char val = sscape_read_unsafe(io_base, GA_HMCTL_REG); + sscape_write_unsafe(io_base, GA_HMCTL_REG, (val & 0xcf) | 0x10); sscape_write_unsafe(io_base, GA_CDCFG_REG, 0x80); } @@ -350,24 +354,27 @@ static void soundscape_free(struct snd_card *c) * Tell the SoundScape to begin a DMA tranfer using the given channel. * All locking issues are left to the caller. */ -static inline void sscape_start_dma_unsafe(unsigned io_base, enum GA_REG reg) +static void sscape_start_dma_unsafe(unsigned io_base, enum GA_REG reg) { - sscape_write_unsafe(io_base, reg, sscape_read_unsafe(io_base, reg) | 0x01); - sscape_write_unsafe(io_base, reg, sscape_read_unsafe(io_base, reg) & 0xfe); + sscape_write_unsafe(io_base, reg, + sscape_read_unsafe(io_base, reg) | 0x01); + sscape_write_unsafe(io_base, reg, + sscape_read_unsafe(io_base, reg) & 0xfe); } /* * Wait for a DMA transfer to complete. This is a "limited busy-wait", * and all locking issues are left to the caller. */ -static int sscape_wait_dma_unsafe(unsigned io_base, enum GA_REG reg, unsigned timeout) +static int sscape_wait_dma_unsafe(unsigned io_base, enum GA_REG reg, + unsigned timeout) { while (!(sscape_read_unsafe(io_base, reg) & 0x01) && (timeout != 0)) { udelay(100); --timeout; } /* while */ - return (sscape_read_unsafe(io_base, reg) & 0x01); + return sscape_read_unsafe(io_base, reg) & 0x01; } /* @@ -427,13 +434,13 @@ static int host_startup_ack(struct soundscape *s, unsigned timeout) /* * Upload a byte-stream into the SoundScape using DMA channel A. */ -static int upload_dma_data(struct soundscape *s, - const unsigned char *data, - size_t size) +static int upload_dma_data(struct soundscape *s, const unsigned char *data, + size_t size) { unsigned long flags; struct snd_dma_buffer dma; int ret; + unsigned char val; if (!get_dmabuf(&dma, PAGE_ALIGN(32 * 1024))) return -ENOMEM; @@ -443,18 +450,21 @@ static int upload_dma_data(struct soundscape *s, /* * Reset the board ... */ - sscape_write_unsafe(s->io_base, GA_HMCTL_REG, sscape_read_unsafe(s->io_base, GA_HMCTL_REG) & 0x3f); + val = sscape_read_unsafe(s->io_base, GA_HMCTL_REG); + sscape_write_unsafe(s->io_base, GA_HMCTL_REG, val & 0x3f); /* * Enable the DMA channels and configure them ... */ - sscape_write_unsafe(s->io_base, GA_DMAA_REG, (s->chip->dma1 << 4) | DMA_8BIT); + val = (s->chip->dma1 << 4) | DMA_8BIT; + sscape_write_unsafe(s->io_base, GA_DMAA_REG, val); sscape_write_unsafe(s->io_base, GA_DMAB_REG, 0x20); /* * Take the board out of reset ... */ - sscape_write_unsafe(s->io_base, GA_HMCTL_REG, sscape_read_unsafe(s->io_base, GA_HMCTL_REG) | 0x80); + val = sscape_read_unsafe(s->io_base, GA_HMCTL_REG); + sscape_write_unsafe(s->io_base, GA_HMCTL_REG, val | 0x80); /* * Upload the firmware to the SoundScape @@ -472,7 +482,7 @@ static int upload_dma_data(struct soundscape *s, sscape_start_dma_unsafe(s->io_base, GA_DMAA_REG); if (!sscape_wait_dma_unsafe(s->io_base, GA_DMAA_REG, 5000)) { /* - * Don't forget to release this spinlock we're holding ... + * Don't forget to release this spinlock we're holding */ spin_unlock_irqrestore(&s->lock, flags); @@ -489,7 +499,8 @@ static int upload_dma_data(struct soundscape *s, /* * Boot the board ... (I think) */ - sscape_write_unsafe(s->io_base, GA_HMCTL_REG, sscape_read_unsafe(s->io_base, GA_HMCTL_REG) | 0x40); + val = sscape_read_unsafe(s->io_base, GA_HMCTL_REG); + sscape_write_unsafe(s->io_base, GA_HMCTL_REG, val | 0x40); spin_unlock_irqrestore(&s->lock, flags); /* @@ -591,7 +602,7 @@ static int sscape_upload_microcode(struct snd_card *card, int version) * Mixer control for the SoundScape's MIDI device. */ static int sscape_midi_info(struct snd_kcontrol *ctl, - struct snd_ctl_elem_info *uinfo) + struct snd_ctl_elem_info *uinfo) { uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; uinfo->count = 1; @@ -601,7 +612,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_ctl_elem_value *uctl) { struct snd_wss *chip = snd_kcontrol_chip(kctl); struct snd_card *card = chip->card; @@ -615,16 +626,18 @@ 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_ctl_elem_value *uctl) { struct snd_wss *chip = snd_kcontrol_chip(kctl); struct snd_card *card = chip->card; - register struct soundscape *s = get_card_soundscape(card); + struct soundscape *s = get_card_soundscape(card); unsigned long flags; int change; + unsigned char new_val; spin_lock_irqsave(&s->lock, flags); + new_val = uctl->value.integer.value[0] & 127; /* * We need to put the board into HOST mode before we * can send any volume-changing HOST commands ... @@ -637,15 +650,16 @@ static int sscape_midi_put(struct snd_kcontrol *kctl, * and then perform another volume-related command. Perhaps the * first command is an "open" and the second command is a "close"? */ - if (s->midi_vol == ((unsigned char) uctl->value.integer. value[0] & 127)) { + if (s->midi_vol == new_val) { change = 0; goto __skip_change; } - change = (host_write_ctrl_unsafe(s->io_base, CMD_SET_MIDI_VOL, 100) - && host_write_ctrl_unsafe(s->io_base, ((unsigned char) uctl->value.integer. value[0]) & 127, 100) - && host_write_ctrl_unsafe(s->io_base, CMD_XXX_MIDI_VOL, 100)); - s->midi_vol = (unsigned char) uctl->value.integer.value[0] & 127; - __skip_change: + change = host_write_ctrl_unsafe(s->io_base, CMD_SET_MIDI_VOL, 100) + && host_write_ctrl_unsafe(s->io_base, new_val, 100) + && host_write_ctrl_unsafe(s->io_base, CMD_XXX_MIDI_VOL, 100) + && host_write_ctrl_unsafe(s->io_base, new_val, 100); + s->midi_vol = new_val; +__skip_change: /* * Take the board out of HOST mode and back into MIDI mode ... @@ -738,7 +752,7 @@ static int __devinit detect_sscape(struct soundscape *s, long wss_io) if (s->type == SSCAPE_VIVO) wss_io += 4; - d = sscape_read_unsafe(s->io_base, GA_HMCTL_REG) & 0x3f; + d = sscape_read_unsafe(s->io_base, GA_HMCTL_REG); sscape_write_unsafe(s->io_base, GA_HMCTL_REG, d | 0xc0); /* wait for WSS codec */ @@ -762,7 +776,7 @@ static int __devinit detect_sscape(struct soundscape *s, long wss_io) if ((inb(wss_io) & 0x80) != 0) s->type = MEDIA_FX; - d = sscape_read_unsafe(s->io_base, GA_HMCTL_REG) & 0x3f; + d = sscape_read_unsafe(s->io_base, GA_HMCTL_REG); sscape_write_unsafe(s->io_base, GA_HMCTL_REG, d | 0xc0); /* wait for WSS codec */ for (d = 0; d < 500; d++) { @@ -778,7 +792,7 @@ static int __devinit detect_sscape(struct soundscape *s, long wss_io) */ retval = 1; - _done: +_done: spin_unlock_irqrestore(&s->lock, flags); return retval; } @@ -789,7 +803,7 @@ static int __devinit detect_sscape(struct soundscape *s, long wss_io) * to crash the machine. Also check that someone isn't using the hardware * IOCTL device. */ -static int mpu401_open(struct snd_mpu401 * mpu) +static int mpu401_open(struct snd_mpu401 *mpu) { if (!verify_mpu401(mpu)) { snd_printk(KERN_ERR "sscape: MIDI disabled, " @@ -803,18 +817,18 @@ static int mpu401_open(struct snd_mpu401 * mpu) /* * Initialse an MPU-401 subdevice for MIDI support on the SoundScape. */ -static int __devinit create_mpu401(struct snd_card *card, int devnum, unsigned long port, int irq) +static int __devinit create_mpu401(struct snd_card *card, int devnum, + unsigned long port, int irq) { struct soundscape *sscape = get_card_soundscape(card); struct snd_rawmidi *rawmidi; int err; - if ((err = snd_mpu401_uart_new(card, devnum, - MPU401_HW_MPU401, - port, MPU401_INFO_INTEGRATED, - irq, IRQF_DISABLED, - &rawmidi)) == 0) { - struct snd_mpu401 *mpu = (struct snd_mpu401 *) rawmidi->private_data; + err = snd_mpu401_uart_new(card, devnum, MPU401_HW_MPU401, port, + MPU401_INFO_INTEGRATED, irq, IRQF_DISABLED, + &rawmidi); + if (err == 0) { + struct snd_mpu401 *mpu = rawmidi->private_data; mpu->open_input = mpu401_open; mpu->open_output = mpu401_open; mpu->private_data = sscape; @@ -866,19 +880,6 @@ static int __devinit create_ad1845(struct snd_card *card, unsigned port, unsigned long flags; struct snd_pcm *pcm; -/* - * It turns out that the PLAYBACK_ENABLE bit is set - * by the lowlevel driver ... - * -#define AD1845_IFACE_CONFIG \ - (CS4231_AUTOCALIB | CS4231_RECORD_ENABLE | CS4231_PLAYBACK_ENABLE) - snd_wss_mce_up(chip); - spin_lock_irqsave(&chip->reg_lock, flags); - snd_wss_out(chip, CS4231_IFACE_CTRL, AD1845_IFACE_CONFIG); - spin_unlock_irqrestore(&chip->reg_lock, flags); - snd_wss_mce_down(chip); - */ - if (sscape->type != SSCAPE_VIVO) { /* * The input clock frequency on the SoundScape must @@ -928,7 +929,7 @@ static int __devinit create_ad1845(struct snd_card *card, unsigned port, sscape->chip = chip; } - _error: +_error: return err; } @@ -1034,7 +1035,6 @@ static int __devinit create_sscape(int dev, struct snd_card *card) */ spin_lock_irqsave(&sscape->lock, flags); - sscape_write_unsafe(sscape->io_base, GA_INTENA_REG, 0x00); /* disable */ sscape_write_unsafe(sscape->io_base, GA_SMCFGA_REG, 0x2e); sscape_write_unsafe(sscape->io_base, GA_SMCFGB_REG, 0x00); @@ -1055,6 +1055,10 @@ static int __devinit create_sscape(int dev, struct snd_card *card) sscape_write_unsafe(sscape->io_base, GA_CDCFG_REG, 0x09 | DMA_8BIT | (dma[dev] << 4) | (irq_cfg << 1)); + /* + * Enable the master IRQ ... + */ + sscape_write_unsafe(sscape->io_base, GA_INTENA_REG, 0x80); spin_unlock_irqrestore(&sscape->lock, flags); @@ -1093,11 +1097,6 @@ static int __devinit create_sscape(int dev, struct snd_card *card) goto _release_dma; } - /* - * Enable the master IRQ ... - */ - sscape_write(sscape, GA_INTENA_REG, 0x80); - /* * Initialize mixer */ @@ -1155,7 +1154,8 @@ static int __devinit snd_sscape_match(struct device *pdev, unsigned int i) mpu_irq[i] == SNDRV_AUTO_IRQ || dma[i] == SNDRV_AUTO_DMA) { printk(KERN_INFO - "sscape: insufficient parameters, need IO, IRQ, MPU-IRQ and DMA\n"); + "sscape: insufficient parameters, " + "need IO, IRQ, MPU-IRQ and DMA\n"); return 0; } @@ -1183,7 +1183,8 @@ static int __devinit snd_sscape_probe(struct device *pdev, unsigned int dev) if (ret < 0) goto _release_card; - if ((ret = snd_card_register(card)) < 0) { + ret = snd_card_register(card); + if (ret < 0) { snd_printk(KERN_ERR "sscape: Failed to register sound card\n"); goto _release_card; } @@ -1236,20 +1237,15 @@ static int __devinit sscape_pnp_detect(struct pnp_card_link *pcard, * Allow this function to fail *quietly* if all the ISA PnP * devices were configured using module parameters instead. */ - if ((idx = get_next_autoindex(idx)) >= SNDRV_CARDS) + idx = get_next_autoindex(idx); + if (idx >= SNDRV_CARDS) return -ENOSPC; - /* - * We have found a candidate ISA PnP card. Now we - * have to check that it has the devices that we - * expect it to have. - */ - /* * Check that we still have room for another sound card ... */ dev = pnp_request_card_device(pcard, pid->devs[0].id, NULL); - if (! dev) + if (!dev) return -ENODEV; if (!pnp_is_active(dev)) { @@ -1298,7 +1294,8 @@ static int __devinit sscape_pnp_detect(struct pnp_card_link *pcard, if (ret < 0) goto _release_card; - if ((ret = snd_card_register(card)) < 0) { + ret = snd_card_register(card); + if (ret < 0) { snd_printk(KERN_ERR "sscape: Failed to register sound card\n"); goto _release_card; } -- cgit v1.2.3 From abd134db940ddccaf6a61d88cf0841a62b917ab3 Mon Sep 17 00:00:00 2001 From: Krzysztof Helt Date: Sat, 10 Oct 2009 10:25:39 +0200 Subject: ALSA: wss: convert CS4231 mixer to dB scale Convert CS4231 mixer to dB scale after AD1848 mixer. Also, add missing microphone boost control for the AD1848 and correct wrong bits for loopback volume on the AD1848. Signed-off-by: Krzysztof Helt Signed-off-by: Takashi Iwai --- sound/isa/wss/wss_lib.c | 43 ++++++++++++++++++++++++++----------------- 1 file changed, 26 insertions(+), 17 deletions(-) (limited to 'sound') diff --git a/sound/isa/wss/wss_lib.c b/sound/isa/wss/wss_lib.c index 5d2ba1b749a..754a2089c65 100644 --- a/sound/isa/wss/wss_lib.c +++ b/sound/isa/wss/wss_lib.c @@ -2198,6 +2198,7 @@ EXPORT_SYMBOL(snd_wss_put_double); static const DECLARE_TLV_DB_SCALE(db_scale_6bit, -9450, 150, 0); static const DECLARE_TLV_DB_SCALE(db_scale_5bit_12db_max, -3450, 150, 0); static const DECLARE_TLV_DB_SCALE(db_scale_rec_gain, 0, 150, 0); +static const DECLARE_TLV_DB_SCALE(db_scale_4bit, -4500, 300, 0); static struct snd_kcontrol_new snd_ad1848_controls[] = { WSS_DOUBLE("PCM Playback Switch", 0, CS4231_LEFT_OUTPUT, CS4231_RIGHT_OUTPUT, @@ -2224,38 +2225,45 @@ WSS_DOUBLE_TLV("Capture Volume", 0, CS4231_LEFT_INPUT, CS4231_RIGHT_INPUT, .get = snd_wss_get_mux, .put = snd_wss_put_mux, }, +WSS_DOUBLE("Mic Boost", 0, + CS4231_LEFT_INPUT, CS4231_RIGHT_INPUT, 5, 5, 1, 0), WSS_SINGLE("Loopback Capture Switch", 0, CS4231_LOOPBACK, 0, 1, 0), -WSS_SINGLE_TLV("Loopback Capture Volume", 0, CS4231_LOOPBACK, 1, 63, 0, +WSS_SINGLE_TLV("Loopback Capture Volume", 0, CS4231_LOOPBACK, 2, 63, 1, db_scale_6bit), }; static struct snd_kcontrol_new snd_wss_controls[] = { 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), +WSS_DOUBLE_TLV("PCM Playback Volume", 0, + CS4231_LEFT_OUTPUT, CS4231_RIGHT_OUTPUT, 0, 0, 63, 1, + db_scale_6bit), WSS_DOUBLE("Line Playback Switch", 0, CS4231_LEFT_LINE_IN, CS4231_RIGHT_LINE_IN, 7, 7, 1, 1), -WSS_DOUBLE("Line Playback Volume", 0, - CS4231_LEFT_LINE_IN, CS4231_RIGHT_LINE_IN, 0, 0, 31, 1), +WSS_DOUBLE_TLV("Line Playback Volume", 0, + CS4231_LEFT_LINE_IN, CS4231_RIGHT_LINE_IN, 0, 0, 31, 1, + db_scale_5bit_12db_max), WSS_DOUBLE("Aux Playback Switch", 0, CS4231_AUX1_LEFT_INPUT, CS4231_AUX1_RIGHT_INPUT, 7, 7, 1, 1), -WSS_DOUBLE("Aux Playback Volume", 0, - CS4231_AUX1_LEFT_INPUT, CS4231_AUX1_RIGHT_INPUT, 0, 0, 31, 1), +WSS_DOUBLE_TLV("Aux Playback Volume", 0, + CS4231_AUX1_LEFT_INPUT, CS4231_AUX1_RIGHT_INPUT, 0, 0, 31, 1, + db_scale_5bit_12db_max), WSS_DOUBLE("Aux Playback Switch", 1, CS4231_AUX2_LEFT_INPUT, CS4231_AUX2_RIGHT_INPUT, 7, 7, 1, 1), -WSS_DOUBLE("Aux Playback Volume", 1, - CS4231_AUX2_LEFT_INPUT, CS4231_AUX2_RIGHT_INPUT, 0, 0, 31, 1), +WSS_DOUBLE_TLV("Aux Playback Volume", 1, + CS4231_AUX2_LEFT_INPUT, CS4231_AUX2_RIGHT_INPUT, 0, 0, 31, 1, + db_scale_5bit_12db_max), WSS_SINGLE("Mono Playback Switch", 0, CS4231_MONO_CTRL, 7, 1, 1), -WSS_SINGLE("Mono Playback Volume", 0, - CS4231_MONO_CTRL, 0, 15, 1), +WSS_SINGLE_TLV("Mono Playback Volume", 0, + CS4231_MONO_CTRL, 0, 15, 1, + db_scale_4bit), WSS_SINGLE("Mono Output Playback Switch", 0, CS4231_MONO_CTRL, 6, 1, 1), WSS_SINGLE("Mono Output Playback Bypass", 0, CS4231_MONO_CTRL, 5, 1, 0), -WSS_DOUBLE("Capture Volume", 0, - CS4231_LEFT_INPUT, CS4231_RIGHT_INPUT, 0, 0, 15, 0), +WSS_DOUBLE_TLV("Capture Volume", 0, CS4231_LEFT_INPUT, CS4231_RIGHT_INPUT, + 0, 0, 15, 0, db_scale_rec_gain), { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = "Capture Source", @@ -2267,15 +2275,16 @@ WSS_DOUBLE("Mic Boost", 0, CS4231_LEFT_INPUT, CS4231_RIGHT_INPUT, 5, 5, 1, 0), WSS_SINGLE("Loopback Capture Switch", 0, CS4231_LOOPBACK, 0, 1, 0), -WSS_SINGLE("Loopback Capture Volume", 0, - CS4231_LOOPBACK, 2, 63, 1) +WSS_SINGLE_TLV("Loopback Capture Volume", 0, CS4231_LOOPBACK, 2, 63, 1, + db_scale_6bit), }; static struct snd_kcontrol_new snd_opti93x_controls[] = { WSS_DOUBLE("Master Playback Switch", 0, OPTi93X_OUT_LEFT, OPTi93X_OUT_RIGHT, 7, 7, 1, 1), -WSS_DOUBLE("Master Playback Volume", 0, - OPTi93X_OUT_LEFT, OPTi93X_OUT_RIGHT, 1, 1, 31, 1), +WSS_DOUBLE_TLV("Master Playback Volume", 0, + OPTi93X_OUT_LEFT, OPTi93X_OUT_RIGHT, 1, 1, 31, 1, + db_scale_6bit), WSS_DOUBLE("PCM Playback Switch", 0, CS4231_LEFT_OUTPUT, CS4231_RIGHT_OUTPUT, 7, 7, 1, 1), WSS_DOUBLE("PCM Playback Volume", 0, -- cgit v1.2.3 From 633c7e92bdd54ba939f2bd3b78c72e1e1a1dd077 Mon Sep 17 00:00:00 2001 From: Krzysztof Helt Date: Sun, 11 Oct 2009 12:38:49 +0200 Subject: ALSA: wss: reuse CS4231 controls for AD1848 The C4231 control set is a superset of the AD1848 control set so reuse the CS4231 controls definitions for the AD1848. Signed-off-by: Krzysztof Helt Signed-off-by: Takashi Iwai --- sound/isa/wss/wss_lib.c | 79 ++++++++++++++----------------------------------- 1 file changed, 23 insertions(+), 56 deletions(-) (limited to 'sound') diff --git a/sound/isa/wss/wss_lib.c b/sound/isa/wss/wss_lib.c index 754a2089c65..2ba18978b41 100644 --- a/sound/isa/wss/wss_lib.c +++ b/sound/isa/wss/wss_lib.c @@ -2200,49 +2200,12 @@ static const DECLARE_TLV_DB_SCALE(db_scale_5bit_12db_max, -3450, 150, 0); static const DECLARE_TLV_DB_SCALE(db_scale_rec_gain, 0, 150, 0); static const DECLARE_TLV_DB_SCALE(db_scale_4bit, -4500, 300, 0); -static struct snd_kcontrol_new snd_ad1848_controls[] = { -WSS_DOUBLE("PCM Playback Switch", 0, CS4231_LEFT_OUTPUT, CS4231_RIGHT_OUTPUT, - 7, 7, 1, 1), -WSS_DOUBLE_TLV("PCM Playback Volume", 0, - CS4231_LEFT_OUTPUT, CS4231_RIGHT_OUTPUT, 0, 0, 63, 1, - db_scale_6bit), -WSS_DOUBLE("Aux Playback Switch", 0, - CS4231_AUX1_LEFT_INPUT, CS4231_AUX1_RIGHT_INPUT, 7, 7, 1, 1), -WSS_DOUBLE_TLV("Aux Playback Volume", 0, - CS4231_AUX1_LEFT_INPUT, CS4231_AUX1_RIGHT_INPUT, 0, 0, 31, 1, - db_scale_5bit_12db_max), -WSS_DOUBLE("Aux Playback Switch", 1, - CS4231_AUX2_LEFT_INPUT, CS4231_AUX2_RIGHT_INPUT, 7, 7, 1, 1), -WSS_DOUBLE_TLV("Aux Playback Volume", 1, - CS4231_AUX2_LEFT_INPUT, CS4231_AUX2_RIGHT_INPUT, 0, 0, 31, 1, - db_scale_5bit_12db_max), -WSS_DOUBLE_TLV("Capture Volume", 0, CS4231_LEFT_INPUT, CS4231_RIGHT_INPUT, - 0, 0, 15, 0, db_scale_rec_gain), -{ - .name = "Capture Source", - .iface = SNDRV_CTL_ELEM_IFACE_MIXER, - .info = snd_wss_info_mux, - .get = snd_wss_get_mux, - .put = snd_wss_put_mux, -}, -WSS_DOUBLE("Mic Boost", 0, - CS4231_LEFT_INPUT, CS4231_RIGHT_INPUT, 5, 5, 1, 0), -WSS_SINGLE("Loopback Capture Switch", 0, CS4231_LOOPBACK, 0, 1, 0), -WSS_SINGLE_TLV("Loopback Capture Volume", 0, CS4231_LOOPBACK, 2, 63, 1, - db_scale_6bit), -}; - static struct snd_kcontrol_new snd_wss_controls[] = { WSS_DOUBLE("PCM Playback Switch", 0, CS4231_LEFT_OUTPUT, CS4231_RIGHT_OUTPUT, 7, 7, 1, 1), WSS_DOUBLE_TLV("PCM Playback Volume", 0, CS4231_LEFT_OUTPUT, CS4231_RIGHT_OUTPUT, 0, 0, 63, 1, db_scale_6bit), -WSS_DOUBLE("Line Playback Switch", 0, - CS4231_LEFT_LINE_IN, CS4231_RIGHT_LINE_IN, 7, 7, 1, 1), -WSS_DOUBLE_TLV("Line Playback Volume", 0, - CS4231_LEFT_LINE_IN, CS4231_RIGHT_LINE_IN, 0, 0, 31, 1, - db_scale_5bit_12db_max), WSS_DOUBLE("Aux Playback Switch", 0, CS4231_AUX1_LEFT_INPUT, CS4231_AUX1_RIGHT_INPUT, 7, 7, 1, 1), WSS_DOUBLE_TLV("Aux Playback Volume", 0, @@ -2253,15 +2216,6 @@ WSS_DOUBLE("Aux Playback Switch", 1, WSS_DOUBLE_TLV("Aux Playback Volume", 1, CS4231_AUX2_LEFT_INPUT, CS4231_AUX2_RIGHT_INPUT, 0, 0, 31, 1, db_scale_5bit_12db_max), -WSS_SINGLE("Mono Playback Switch", 0, - CS4231_MONO_CTRL, 7, 1, 1), -WSS_SINGLE_TLV("Mono Playback Volume", 0, - CS4231_MONO_CTRL, 0, 15, 1, - db_scale_4bit), -WSS_SINGLE("Mono Output Playback Switch", 0, - CS4231_MONO_CTRL, 6, 1, 1), -WSS_SINGLE("Mono Output Playback Bypass", 0, - CS4231_MONO_CTRL, 5, 1, 0), WSS_DOUBLE_TLV("Capture Volume", 0, CS4231_LEFT_INPUT, CS4231_RIGHT_INPUT, 0, 0, 15, 0, db_scale_rec_gain), { @@ -2277,6 +2231,20 @@ WSS_SINGLE("Loopback Capture Switch", 0, CS4231_LOOPBACK, 0, 1, 0), WSS_SINGLE_TLV("Loopback Capture Volume", 0, CS4231_LOOPBACK, 2, 63, 1, db_scale_6bit), +WSS_DOUBLE("Line Playback Switch", 0, + CS4231_LEFT_LINE_IN, CS4231_RIGHT_LINE_IN, 7, 7, 1, 1), +WSS_DOUBLE_TLV("Line Playback Volume", 0, + CS4231_LEFT_LINE_IN, CS4231_RIGHT_LINE_IN, 0, 0, 31, 1, + db_scale_5bit_12db_max), +WSS_SINGLE("Mono Playback Switch", 0, + CS4231_MONO_CTRL, 7, 1, 1), +WSS_SINGLE_TLV("Mono Playback Volume", 0, + CS4231_MONO_CTRL, 0, 15, 1, + db_scale_4bit), +WSS_SINGLE("Mono Output Playback Switch", 0, + CS4231_MONO_CTRL, 6, 1, 1), +WSS_SINGLE("Mono Output Playback Bypass", 0, + CS4231_MONO_CTRL, 5, 1, 0), }; static struct snd_kcontrol_new snd_opti93x_controls[] = { @@ -2343,22 +2311,21 @@ int snd_wss_mixer(struct snd_wss *chip) if (err < 0) return err; } - else if (chip->hardware & WSS_HW_AD1848_MASK) - for (idx = 0; idx < ARRAY_SIZE(snd_ad1848_controls); idx++) { - err = snd_ctl_add(card, - snd_ctl_new1(&snd_ad1848_controls[idx], - chip)); - if (err < 0) - return err; - } - else - for (idx = 0; idx < ARRAY_SIZE(snd_wss_controls); idx++) { + else { + int count = ARRAY_SIZE(snd_wss_controls); + + /* Use only the first 11 entries on AD1848 */ + if (chip->hardware & WSS_HW_AD1848_MASK) + count = 11; + + for (idx = 0; idx < count; idx++) { err = snd_ctl_add(card, snd_ctl_new1(&snd_wss_controls[idx], chip)); if (err < 0) return err; } + } return 0; } EXPORT_SYMBOL(snd_wss_mixer); -- cgit v1.2.3 From 8066e51ae7329220f459470a38387f8533e99141 Mon Sep 17 00:00:00 2001 From: Krzysztof Helt Date: Sun, 11 Oct 2009 12:48:00 +0200 Subject: ALSA: snd_dma_pointer workaround for chipsets with buggy DMA The chipsets with the isa_dma_bridge_buggy set do not stop DMA during DMA counter reads. The DMA counter is read in two 8-bit read steps on x86 platform. Sometimes, such reads happen during higher byte change so the lower byte is already decremented (rolled over) but the higher byte is not. It introduces an error that position is moved 256 bytes ahead of the true position. Thus, the next DMA position read can return a lower value then the previous read. If the DMA position is decreased (reversed) the ALSA subsystem is tricked into the playback underrun error and resets the playback. It results in a "pop" during a playback. Work around the issue by reading the counter twice and choosing a higher value. Signed-off-by: Krzysztof Helt Signed-off-by: Takashi Iwai --- sound/core/isadma.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'sound') diff --git a/sound/core/isadma.c b/sound/core/isadma.c index 79f0f16af33..950e19ba91f 100644 --- a/sound/core/isadma.c +++ b/sound/core/isadma.c @@ -85,16 +85,24 @@ EXPORT_SYMBOL(snd_dma_disable); unsigned int snd_dma_pointer(unsigned long dma, unsigned int size) { unsigned long flags; - unsigned int result; + unsigned int result, result1; flags = claim_dma_lock(); clear_dma_ff(dma); if (!isa_dma_bridge_buggy) disable_dma(dma); result = get_dma_residue(dma); + /* + * HACK - read the counter again and choose higher value in order to + * avoid reading during counter lower byte roll over if the + * isa_dma_bridge_buggy is set. + */ + result1 = get_dma_residue(dma); if (!isa_dma_bridge_buggy) enable_dma(dma); release_dma_lock(flags); + if (unlikely(result < result1)) + result = result1; #ifdef CONFIG_SND_DEBUG if (result > size) snd_printk(KERN_ERR "pointer (0x%x) for DMA #%ld is greater than transfer size (0x%x)\n", result, dma, size); -- cgit v1.2.3 From bd3c200e6d5495343c91db66d2acf1853b57a141 Mon Sep 17 00:00:00 2001 From: David Henningsson Date: Sun, 11 Oct 2009 11:37:22 +0200 Subject: ALSA: ice1724 - Make call to set hw params succeed on ESI Juli@ If two streams are started immediately after one another (such as a playback and a recording stream), the call to set hw params fails with EBUSY. This patch makes the call succeed, so playback and recording will work properly. Signed-off-by: David Henningsson Signed-off-by: Takashi Iwai --- sound/pci/ice1712/ice1724.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sound') diff --git a/sound/pci/ice1712/ice1724.c b/sound/pci/ice1712/ice1724.c index 76b717dae4b..10fc92c0557 100644 --- a/sound/pci/ice1712/ice1724.c +++ b/sound/pci/ice1712/ice1724.c @@ -648,7 +648,7 @@ static int snd_vt1724_set_pro_rate(struct snd_ice1712 *ice, unsigned int rate, (inb(ICEMT1724(ice, DMA_PAUSE)) & DMA_PAUSES)) { /* running? we cannot change the rate now... */ spin_unlock_irqrestore(&ice->reg_lock, flags); - return -EBUSY; + return ((rate == ice->cur_rate) && !force) ? 0 : -EBUSY; } if (!force && is_pro_rate_locked(ice)) { spin_unlock_irqrestore(&ice->reg_lock, flags); -- cgit v1.2.3 From 68f139204c1a2b10cc292d9cca036ebdbb6730a8 Mon Sep 17 00:00:00 2001 From: Wu Zhangjin Date: Sat, 10 Oct 2009 23:53:49 +0800 Subject: ALSA: SND_CS5535AUDIO: Remove the X86 platform dependency SND_CS5535AUDIO is available on Loongson(MIPS compatible) family machines, and checked it with ARCH=x86_64, no relative compiling warnings & errors, so, remove the platform dependency directly. Reported-by: rixed@happyleptic.org Acked-by: Andres Salomon Signed-off-by: Wu Zhangjin Signed-off-by: Takashi Iwai --- sound/pci/Kconfig | 1 - 1 file changed, 1 deletion(-) (limited to 'sound') diff --git a/sound/pci/Kconfig b/sound/pci/Kconfig index fb5ee3cc396..75c602b5b13 100644 --- a/sound/pci/Kconfig +++ b/sound/pci/Kconfig @@ -259,7 +259,6 @@ config SND_CS5530 config SND_CS5535AUDIO tristate "CS5535/CS5536 Audio" - depends on X86 && !X86_64 select SND_PCM select SND_AC97_CODEC help -- cgit v1.2.3 From a688e4885c1aa6b88ab5ffa64655bacc01749c9e Mon Sep 17 00:00:00 2001 From: Tobias Hansen Date: Mon, 12 Oct 2009 16:24:15 +0200 Subject: ALSA: snd-usb-us122l: corrent error number for not probing US-144 on ehci-hcd snd-usb-us122l: corrent error number for not probing US-144 on ehci-hcd This is the correct error number for telling the USB system that this driver is not for the device. Signed-off-by: Tobias Hansen Signed-off-by: Takashi Iwai --- sound/usb/usx2y/us122l.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sound') diff --git a/sound/usb/usx2y/us122l.c b/sound/usb/usx2y/us122l.c index 6c7b64a23c1..b54e8ca360d 100644 --- a/sound/usb/usx2y/us122l.c +++ b/sound/usb/usx2y/us122l.c @@ -601,7 +601,7 @@ static int snd_us122l_probe(struct usb_interface *intf, if (device->descriptor.idProduct == USB_ID_US144 && device->speed == USB_SPEED_HIGH) { snd_printk(KERN_ERR "disable ehci-hcd to run US-144 \n"); - return -ENOENT; + return -ENODEV; } snd_printdd(KERN_DEBUG"%p:%i\n", -- cgit v1.2.3 From 9c6b8dcefe9a39f36ba11bdd523c0ac5246514c9 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Tue, 13 Oct 2009 09:34:28 +0200 Subject: ALSA: bt87x - Add a whitelist for Pinnacle PCTV (11bd:0012) Signed-off-by: Takashi Iwai --- sound/pci/bt87x.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'sound') diff --git a/sound/pci/bt87x.c b/sound/pci/bt87x.c index 24585c6c6d0..4e2b925a94c 100644 --- a/sound/pci/bt87x.c +++ b/sound/pci/bt87x.c @@ -808,6 +808,8 @@ static struct pci_device_id snd_bt87x_ids[] = { BT_DEVICE(PCI_DEVICE_ID_BROOKTREE_878, 0x1002, 0x0001, GENERIC), /* Leadtek Winfast tv 2000xp delux */ BT_DEVICE(PCI_DEVICE_ID_BROOKTREE_878, 0x107d, 0x6606, GENERIC), + /* Pinnacle PCTV */ + BT_DEVICE(PCI_DEVICE_ID_BROOKTREE_878, 0x11bd, 0x0012, GENERIC), /* Voodoo TV 200 */ BT_DEVICE(PCI_DEVICE_ID_BROOKTREE_878, 0x121a, 0x3000, GENERIC), /* Askey Computer Corp. MagicTView'99 */ -- cgit v1.2.3 From 29a4f2d31c03756bf24883e567a8c3b4ee5df1f4 Mon Sep 17 00:00:00 2001 From: Philby John Date: Tue, 13 Oct 2009 16:30:22 +0530 Subject: ALSA: aaci: ARM1176 aaci-pl041 AC97 register read timeout After a reboot on an ARM1176 which amounts to a softreset, it has been noted that the ALSA driver does not get registered and the probe fails with the error "aaci-pl041 fpga:04: ac97 read back fail". In the process of reading from a register the SL1TxBusy bit is set indicating that the transceiver is busy and remains so until the default timeout occurs. Set the Power down register 0x26 to an arbitrary value as specified in the PL041 manual (page: 3-18) so that AACISL1TX/AACISL2TX registers take their default state. Signed-off-by: Philby John Signed-off-by: Takashi Iwai --- sound/arm/aaci.c | 1 + 1 file changed, 1 insertion(+) (limited to 'sound') diff --git a/sound/arm/aaci.c b/sound/arm/aaci.c index dc78272fc39..1f0f8213e2d 100644 --- a/sound/arm/aaci.c +++ b/sound/arm/aaci.c @@ -937,6 +937,7 @@ static int __devinit aaci_probe_ac97(struct aaci *aaci) struct snd_ac97 *ac97; int ret; + writel(0, aaci->base + AC97_POWERDOWN); /* * Assert AACIRESET for 2us */ -- cgit v1.2.3 From 97609458ce972180172ae2cec0483451820e6a41 Mon Sep 17 00:00:00 2001 From: Wu Zhangjin Date: Thu, 15 Oct 2009 10:22:54 +0800 Subject: ALSA: SND_CS5535AUDIO: Remove the X86 platform dependency SND_CS5535AUDIO is available on Loongson(MIPS compatible) family machines, and checked it with ARCH=x86_64, no relative compiling warnings & errors, so, remove the platform dependency directly. Reported-by: rixed@happyleptic.org Acked-by: Andres Salomon Signed-off-by: Wu Zhangjin Signed-off-by: Takashi Iwai --- sound/pci/Kconfig | 1 - 1 file changed, 1 deletion(-) (limited to 'sound') diff --git a/sound/pci/Kconfig b/sound/pci/Kconfig index fb5ee3cc396..75c602b5b13 100644 --- a/sound/pci/Kconfig +++ b/sound/pci/Kconfig @@ -259,7 +259,6 @@ config SND_CS5530 config SND_CS5535AUDIO tristate "CS5535/CS5536 Audio" - depends on X86 && !X86_64 select SND_PCM select SND_AC97_CODEC help -- cgit v1.2.3 From b71207e9dc044b30d8b5d7f1c2290ba14563f05c Mon Sep 17 00:00:00 2001 From: Stas Sergeev Date: Fri, 30 Oct 2009 11:51:24 +0100 Subject: ALSA: pcsp - Fix nforce workaround The attached patch fixes the problems introduced in this commit: http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=eea0579fc85e64e9f05361d5aacf496fe7a151aa - Fix nForce workaround by honouring the pointer_update var - Revert "ns" to u64, as per the hrtimer API - Revert to the zero-delay timer startup, since I can't reproduce any problem with it (please, give me the hint!) Signed-off-by: Stas Sergeev Signed-off-by: Takashi Iwai --- sound/drivers/pcsp/pcsp_lib.c | 65 +++++++++++++++++++++-------------------- sound/drivers/pcsp/pcsp_mixer.c | 2 +- 2 files changed, 35 insertions(+), 32 deletions(-) (limited to 'sound') diff --git a/sound/drivers/pcsp/pcsp_lib.c b/sound/drivers/pcsp/pcsp_lib.c index 84cc2658c05..e1145ac6e90 100644 --- a/sound/drivers/pcsp/pcsp_lib.c +++ b/sound/drivers/pcsp/pcsp_lib.c @@ -39,25 +39,20 @@ static DECLARE_TASKLET(pcsp_pcm_tasklet, pcsp_call_pcm_elapsed, 0); /* write the port and returns the next expire time in ns; * called at the trigger-start and in hrtimer callback */ -static unsigned long pcsp_timer_update(struct hrtimer *handle) +static u64 pcsp_timer_update(struct snd_pcsp *chip) { unsigned char timer_cnt, val; u64 ns; struct snd_pcm_substream *substream; struct snd_pcm_runtime *runtime; - struct snd_pcsp *chip = container_of(handle, struct snd_pcsp, timer); unsigned long flags; if (chip->thalf) { outb(chip->val61, 0x61); chip->thalf = 0; - if (!atomic_read(&chip->timer_active)) - return 0; return chip->ns_rem; } - if (!atomic_read(&chip->timer_active)) - return 0; substream = chip->playback_substream; if (!substream) return 0; @@ -88,24 +83,17 @@ static unsigned long pcsp_timer_update(struct hrtimer *handle) return ns; } -enum hrtimer_restart pcsp_do_timer(struct hrtimer *handle) +static void pcsp_pointer_update(struct snd_pcsp *chip) { - struct snd_pcsp *chip = container_of(handle, struct snd_pcsp, timer); struct snd_pcm_substream *substream; - int periods_elapsed, pointer_update; size_t period_bytes, buffer_bytes; - unsigned long ns; + int periods_elapsed; unsigned long flags; - pointer_update = !chip->thalf; - ns = pcsp_timer_update(handle); - if (!ns) - return HRTIMER_NORESTART; - /* update the playback position */ substream = chip->playback_substream; if (!substream) - return HRTIMER_NORESTART; + return; period_bytes = snd_pcm_lib_period_bytes(substream); buffer_bytes = snd_pcm_lib_buffer_bytes(substream); @@ -134,6 +122,26 @@ enum hrtimer_restart pcsp_do_timer(struct hrtimer *handle) if (periods_elapsed) tasklet_schedule(&pcsp_pcm_tasklet); +} + +enum hrtimer_restart pcsp_do_timer(struct hrtimer *handle) +{ + struct snd_pcsp *chip = container_of(handle, struct snd_pcsp, timer); + int pointer_update; + u64 ns; + + if (!atomic_read(&chip->timer_active) || !chip->playback_substream) + return HRTIMER_NORESTART; + + pointer_update = !chip->thalf; + ns = pcsp_timer_update(chip); + if (!ns) { + printk(KERN_WARNING "PCSP: unexpected stop\n"); + return HRTIMER_NORESTART; + } + + if (pointer_update) + pcsp_pointer_update(chip); hrtimer_forward(handle, hrtimer_get_expires(handle), ns_to_ktime(ns)); @@ -142,8 +150,6 @@ enum hrtimer_restart pcsp_do_timer(struct hrtimer *handle) static int pcsp_start_playing(struct snd_pcsp *chip) { - unsigned long ns; - #if PCSP_DEBUG printk(KERN_INFO "PCSP: start_playing called\n"); #endif @@ -159,11 +165,7 @@ static int pcsp_start_playing(struct snd_pcsp *chip) atomic_set(&chip->timer_active, 1); chip->thalf = 0; - ns = pcsp_timer_update(&pcsp_chip.timer); - if (!ns) - return -EIO; - - hrtimer_start(&pcsp_chip.timer, ktime_set(0, ns), HRTIMER_MODE_REL); + hrtimer_start(&pcsp_chip.timer, ktime_set(0, 0), HRTIMER_MODE_REL); return 0; } @@ -232,21 +234,22 @@ static int snd_pcsp_playback_hw_free(struct snd_pcm_substream *substream) static int snd_pcsp_playback_prepare(struct snd_pcm_substream *substream) { struct snd_pcsp *chip = snd_pcm_substream_chip(substream); + pcsp_sync_stop(chip); + chip->playback_ptr = 0; + chip->period_ptr = 0; + chip->fmt_size = + snd_pcm_format_physical_width(substream->runtime->format) >> 3; + chip->is_signed = snd_pcm_format_signed(substream->runtime->format); #if PCSP_DEBUG printk(KERN_INFO "PCSP: prepare called, " - "size=%zi psize=%zi f=%zi f1=%i\n", + "size=%zi psize=%zi f=%zi f1=%i fsize=%i\n", snd_pcm_lib_buffer_bytes(substream), snd_pcm_lib_period_bytes(substream), snd_pcm_lib_buffer_bytes(substream) / snd_pcm_lib_period_bytes(substream), - substream->runtime->periods); + substream->runtime->periods, + chip->fmt_size); #endif - pcsp_sync_stop(chip); - chip->playback_ptr = 0; - chip->period_ptr = 0; - chip->fmt_size = - snd_pcm_format_physical_width(substream->runtime->format) >> 3; - chip->is_signed = snd_pcm_format_signed(substream->runtime->format); return 0; } diff --git a/sound/drivers/pcsp/pcsp_mixer.c b/sound/drivers/pcsp/pcsp_mixer.c index 199b0337714..903bc846763 100644 --- a/sound/drivers/pcsp/pcsp_mixer.c +++ b/sound/drivers/pcsp/pcsp_mixer.c @@ -72,7 +72,7 @@ static int pcsp_treble_put(struct snd_kcontrol *kcontrol, if (treble != chip->treble) { chip->treble = treble; #if PCSP_DEBUG - printk(KERN_INFO "PCSP: rate set to %i\n", PCSP_RATE()); + printk(KERN_INFO "PCSP: rate set to %li\n", PCSP_RATE()); #endif changed = 1; } -- cgit v1.2.3 From 4b3be6afa4ab8b3fdce39df68bad71f8b85164de Mon Sep 17 00:00:00 2001 From: Julia Lawall Date: Sat, 17 Oct 2009 08:33:22 +0200 Subject: ALSA: sound: Move dereference after NULL test and drop unnecessary NULL tests In pcm.c, if the NULL test on pcm is needed, then the dereference should be after the NULL test. In dummy.c and ali5451.c, the context of the calls to snd_card_dummy_new_mixer and snd_ali_free_voice show that dummy and pvoice, respectively cannot be NULL. A simplified version of the semantic match that detects this problem is as follows (http://coccinelle.lip6.fr/): // @match exists@ expression x, E; identifier fld; @@ * x->fld ... when != \(x = E\|&x\) * x == NULL // Signed-off-by: Julia Lawall Signed-off-by: Takashi Iwai --- sound/core/pcm.c | 5 +++-- sound/drivers/dummy.c | 2 -- sound/pci/ali5451/ali5451.c | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) (limited to 'sound') diff --git a/sound/core/pcm.c b/sound/core/pcm.c index 0c1440121c2..c69c60b2a48 100644 --- a/sound/core/pcm.c +++ b/sound/core/pcm.c @@ -953,11 +953,12 @@ static int snd_pcm_dev_register(struct snd_device *device) struct snd_pcm_substream *substream; struct snd_pcm_notify *notify; char str[16]; - struct snd_pcm *pcm = device->device_data; + struct snd_pcm *pcm; struct device *dev; - if (snd_BUG_ON(!pcm || !device)) + if (snd_BUG_ON(!device || !device->device_data)) return -ENXIO; + pcm = device->device_data; mutex_lock(®ister_mutex); err = snd_pcm_add(pcm); if (err) { diff --git a/sound/drivers/dummy.c b/sound/drivers/dummy.c index 6ba066c41d2..146ef00f94a 100644 --- a/sound/drivers/dummy.c +++ b/sound/drivers/dummy.c @@ -808,8 +808,6 @@ static int __devinit snd_card_dummy_new_mixer(struct snd_dummy *dummy) unsigned int idx; int err; - if (snd_BUG_ON(!dummy)) - return -EINVAL; spin_lock_init(&dummy->mixer_lock); strcpy(card->mixername, "Dummy Mixer"); diff --git a/sound/pci/ali5451/ali5451.c b/sound/pci/ali5451/ali5451.c index b458d208720..aaf4da68969 100644 --- a/sound/pci/ali5451/ali5451.c +++ b/sound/pci/ali5451/ali5451.c @@ -973,7 +973,7 @@ static void snd_ali_free_voice(struct snd_ali * codec, void *private_data; snd_ali_printk("free_voice: channel=%d\n",pvoice->number); - if (pvoice == NULL || !pvoice->use) + if (!pvoice->use) return; snd_ali_clear_voices(codec, pvoice->number, pvoice->number); spin_lock_irq(&codec->voice_alloc); -- cgit v1.2.3 From e8e0929d7290cab7c5b1a3e5f5f54f73daf38038 Mon Sep 17 00:00:00 2001 From: Julia Lawall Date: Sat, 17 Oct 2009 08:33:47 +0200 Subject: ALSA: sound/parisc: Move dereference after NULL test If the NULL test on h is needed in snd_harmony_mixer_init, then the dereference should be after the NULL test. Actually, there is a sequence of calls: snd_harmony_create, then snd_harmony_pcm_init, and then snd_harmony_mixer_init. snd_harmony_create initializes h, but may indeed leave it as NULL. There was no NULL test at the beginning of snd_harmony_pcm_init, so I have added one. The NULL test in snd_harmony_mixer_init is then not necessary, but in case the ordering of the calls changes, I have left it, and moved the dereference after it. A simplified version of the semantic match that detects this problem is as follows (http://coccinelle.lip6.fr/): // @match exists@ expression x, E; identifier fld; @@ * x->fld ... when != \(x = E\|&x\) * x == NULL // Signed-off-by: Julia Lawall Signed-off-by: Takashi Iwai --- sound/parisc/harmony.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'sound') diff --git a/sound/parisc/harmony.c b/sound/parisc/harmony.c index e924492df21..f47f9e226b0 100644 --- a/sound/parisc/harmony.c +++ b/sound/parisc/harmony.c @@ -624,6 +624,9 @@ snd_harmony_pcm_init(struct snd_harmony *h) struct snd_pcm *pcm; int err; + if (snd_BUG_ON(!h)) + return -EINVAL; + harmony_disable_interrupts(h); err = snd_pcm_new(h->card, "harmony", 0, 1, 1, &pcm); @@ -865,11 +868,12 @@ snd_harmony_mixer_reset(struct snd_harmony *h) static int __devinit snd_harmony_mixer_init(struct snd_harmony *h) { - struct snd_card *card = h->card; + struct snd_card *card; int idx, err; if (snd_BUG_ON(!h)) return -EINVAL; + card = h->card; strcpy(card->mixername, "Harmony Gain control interface"); for (idx = 0; idx < HARMONY_CONTROLS; idx++) { -- cgit v1.2.3 From 84ed1a1942e8c28fb4c23a6235ec48672fc43e49 Mon Sep 17 00:00:00 2001 From: Roel Kluin Date: Fri, 23 Oct 2009 16:03:08 +0200 Subject: ALSA: Cleanup redundant tests on unsigned The variables are unsigned so the test `>= 0' is always true, the `< 0' test always fails. In these cases the other part of the test catches wrapped values. In dac_audio_write() there does not occur a test for wrapped values, but the test appears redundant. Signed-off-by: Roel Kluin Signed-off-by: Takashi Iwai --- sound/oss/sh_dac_audio.c | 3 --- sound/pci/ca0106/ca0106_proc.c | 4 ++-- sound/pci/ctxfi/ctatc.c | 2 +- sound/pci/emu10k1/emu10k1x.c | 3 +-- sound/pci/emu10k1/emuproc.c | 4 ++-- sound/pci/emu10k1/io.c | 2 +- sound/soc/codecs/tlv320aic23.c | 2 +- 7 files changed, 8 insertions(+), 12 deletions(-) (limited to 'sound') diff --git a/sound/oss/sh_dac_audio.c b/sound/oss/sh_dac_audio.c index b2ed8757542..4153752507e 100644 --- a/sound/oss/sh_dac_audio.c +++ b/sound/oss/sh_dac_audio.c @@ -164,9 +164,6 @@ static ssize_t dac_audio_write(struct file *file, const char *buf, size_t count, int free; int nbytes; - if (count < 0) - return -EINVAL; - if (!count) { dac_audio_sync(); return 0; diff --git a/sound/pci/ca0106/ca0106_proc.c b/sound/pci/ca0106/ca0106_proc.c index c62b7d10ec6..15523e60351 100644 --- a/sound/pci/ca0106/ca0106_proc.c +++ b/sound/pci/ca0106/ca0106_proc.c @@ -304,7 +304,7 @@ static void snd_ca0106_proc_reg_write32(struct snd_info_entry *entry, while (!snd_info_get_line(buffer, line, sizeof(line))) { if (sscanf(line, "%x %x", ®, &val) != 2) continue; - if ((reg < 0x40) && (reg >=0) && (val <= 0xffffffff) ) { + if (reg < 0x40 && val <= 0xffffffff) { spin_lock_irqsave(&emu->emu_lock, flags); outl(val, emu->port + (reg & 0xfffffffc)); spin_unlock_irqrestore(&emu->emu_lock, flags); @@ -405,7 +405,7 @@ static void snd_ca0106_proc_reg_write(struct snd_info_entry *entry, while (!snd_info_get_line(buffer, line, sizeof(line))) { if (sscanf(line, "%x %x %x", ®, &channel_id, &val) != 3) continue; - if ((reg < 0x80) && (reg >=0) && (val <= 0xffffffff) && (channel_id >=0) && (channel_id <= 3) ) + if (reg < 0x80 && val <= 0xffffffff && channel_id <= 3) snd_ca0106_ptr_write(emu, reg, channel_id, val); } } diff --git a/sound/pci/ctxfi/ctatc.c b/sound/pci/ctxfi/ctatc.c index b1b3a644f73..6bfce99b42a 100644 --- a/sound/pci/ctxfi/ctatc.c +++ b/sound/pci/ctxfi/ctatc.c @@ -240,7 +240,7 @@ static int select_rom(unsigned int pitch) } else if (pitch == 0x02000000) { /* pitch == 2 */ return 3; - } else if (pitch >= 0x0 && pitch <= 0x08000000) { + } else if (pitch <= 0x08000000) { /* 0 <= pitch <= 8 */ return 0; } else { diff --git a/sound/pci/emu10k1/emu10k1x.c b/sound/pci/emu10k1/emu10k1x.c index 36e08bd2b3c..6b8ae7b5cd5 100644 --- a/sound/pci/emu10k1/emu10k1x.c +++ b/sound/pci/emu10k1/emu10k1x.c @@ -1040,8 +1040,7 @@ static void snd_emu10k1x_proc_reg_write(struct snd_info_entry *entry, if (sscanf(line, "%x %x %x", ®, &channel_id, &val) != 3) continue; - if ((reg < 0x49) && (reg >= 0) && (val <= 0xffffffff) - && (channel_id >= 0) && (channel_id <= 2) ) + if (reg < 0x49 && val <= 0xffffffff && channel_id <= 2) snd_emu10k1x_ptr_write(emu, reg, channel_id, val); } } diff --git a/sound/pci/emu10k1/emuproc.c b/sound/pci/emu10k1/emuproc.c index 216f9748aff..baa7cd508cd 100644 --- a/sound/pci/emu10k1/emuproc.c +++ b/sound/pci/emu10k1/emuproc.c @@ -451,7 +451,7 @@ static void snd_emu_proc_io_reg_write(struct snd_info_entry *entry, while (!snd_info_get_line(buffer, line, sizeof(line))) { if (sscanf(line, "%x %x", ®, &val) != 2) continue; - if ((reg < 0x40) && (reg >= 0) && (val <= 0xffffffff) ) { + if (reg < 0x40 && val <= 0xffffffff) { spin_lock_irqsave(&emu->emu_lock, flags); outl(val, emu->port + (reg & 0xfffffffc)); spin_unlock_irqrestore(&emu->emu_lock, flags); @@ -527,7 +527,7 @@ static void snd_emu_proc_ptr_reg_write(struct snd_info_entry *entry, while (!snd_info_get_line(buffer, line, sizeof(line))) { if (sscanf(line, "%x %x %x", ®, &channel_id, &val) != 3) continue; - if ((reg < 0xa0) && (reg >= 0) && (val <= 0xffffffff) && (channel_id >= 0) && (channel_id <= 3) ) + if (reg < 0xa0 && val <= 0xffffffff && channel_id <= 3) snd_ptr_write(emu, iobase, reg, channel_id, val); } } diff --git a/sound/pci/emu10k1/io.c b/sound/pci/emu10k1/io.c index c1a5aa15af8..5ef7080e14d 100644 --- a/sound/pci/emu10k1/io.c +++ b/sound/pci/emu10k1/io.c @@ -256,7 +256,7 @@ int snd_emu1010_fpga_write(struct snd_emu10k1 * emu, u32 reg, u32 value) if (reg > 0x3f) return 1; reg += 0x40; /* 0x40 upwards are registers. */ - if (value < 0 || value > 0x3f) /* 0 to 0x3f are values */ + if (value > 0x3f) /* 0 to 0x3f are values */ return 1; spin_lock_irqsave(&emu->emu_lock, flags); outl(reg, emu->port + A_IOCFG); diff --git a/sound/soc/codecs/tlv320aic23.c b/sound/soc/codecs/tlv320aic23.c index 0b8dcb5cd72..35606ae6086 100644 --- a/sound/soc/codecs/tlv320aic23.c +++ b/sound/soc/codecs/tlv320aic23.c @@ -85,7 +85,7 @@ static int tlv320aic23_write(struct snd_soc_codec *codec, unsigned int reg, * of data into val */ - if ((reg < 0 || reg > 9) && (reg != 15)) { + if (reg > 9 && reg != 15) { printk(KERN_WARNING "%s Invalid register R%u\n", __func__, reg); return -1; } -- cgit v1.2.3 From 3702b082281929cf1bdf14f67eb0619aab58b496 Mon Sep 17 00:00:00 2001 From: Mark Hills Date: Sat, 24 Oct 2009 12:59:35 +0100 Subject: ALSA: snd-usb-caiaq: Missing lock around use of buffer positions Fix a race which causes snd_pcm_update_hw_ptr_pos() to report a bug. Signed-off-by: Mark Hills Acked-by: Daniel Mack Signed-off-by: Takashi Iwai --- sound/usb/caiaq/audio.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'sound') diff --git a/sound/usb/caiaq/audio.c b/sound/usb/caiaq/audio.c index 121af0644fd..e76017cd5ac 100644 --- a/sound/usb/caiaq/audio.c +++ b/sound/usb/caiaq/audio.c @@ -269,16 +269,22 @@ snd_usb_caiaq_pcm_pointer(struct snd_pcm_substream *sub) { int index = sub->number; struct snd_usb_caiaqdev *dev = snd_pcm_substream_chip(sub); + snd_pcm_uframes_t ptr; + + spin_lock(&dev->spinlock); if (dev->input_panic || dev->output_panic) - return SNDRV_PCM_POS_XRUN; + ptr = SNDRV_PCM_POS_XRUN; if (sub->stream == SNDRV_PCM_STREAM_PLAYBACK) - return bytes_to_frames(sub->runtime, + ptr = bytes_to_frames(sub->runtime, dev->audio_out_buf_pos[index]); else - return bytes_to_frames(sub->runtime, + ptr = bytes_to_frames(sub->runtime, dev->audio_in_buf_pos[index]); + + spin_unlock(&dev->spinlock); + return ptr; } /* operators for both playback and capture */ -- cgit v1.2.3 From ac9dd9d384b018f1e1c5a9a2686ab5605ce55818 Mon Sep 17 00:00:00 2001 From: Mark Hills Date: Sat, 24 Oct 2009 12:59:36 +0100 Subject: ALSA: snd-usb-caiaq: Lock on stream start/unpause Fix a bug which can result in white noise from the driver after stream start or unpause. Signed-off-by: Mark Hills Acked-by: Daniel Mack Signed-off-by: Takashi Iwai --- sound/usb/caiaq/audio.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'sound') diff --git a/sound/usb/caiaq/audio.c b/sound/usb/caiaq/audio.c index e76017cd5ac..86b2c3b92df 100644 --- a/sound/usb/caiaq/audio.c +++ b/sound/usb/caiaq/audio.c @@ -62,10 +62,14 @@ static void activate_substream(struct snd_usb_caiaqdev *dev, struct snd_pcm_substream *sub) { + spin_lock(&dev->spinlock); + if (sub->stream == SNDRV_PCM_STREAM_PLAYBACK) dev->sub_playback[sub->number] = sub; else dev->sub_capture[sub->number] = sub; + + spin_unlock(&dev->spinlock); } static void -- cgit v1.2.3 From 467cc1692036909ee0a723ce633fc4a53d72fd9a Mon Sep 17 00:00:00 2001 From: Mark Hills Date: Sat, 24 Oct 2009 12:59:37 +0100 Subject: ALSA: snd-usb-caiaq: Bump version number to 1.3.20 Signed-off-by: Mark Hills Acked-by: Daniel Mack Signed-off-by: Takashi Iwai --- sound/usb/caiaq/device.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sound') diff --git a/sound/usb/caiaq/device.c b/sound/usb/caiaq/device.c index 83e6c1312d4..a3f02dd9744 100644 --- a/sound/usb/caiaq/device.c +++ b/sound/usb/caiaq/device.c @@ -35,7 +35,7 @@ #include "input.h" MODULE_AUTHOR("Daniel Mack "); -MODULE_DESCRIPTION("caiaq USB audio, version 1.3.19"); +MODULE_DESCRIPTION("caiaq USB audio, version 1.3.20"); MODULE_LICENSE("GPL"); MODULE_SUPPORTED_DEVICE("{{Native Instruments, RigKontrol2}," "{Native Instruments, RigKontrol3}," -- cgit v1.2.3 From 3d00941371a765779c4e3509214c7e5793cce1fe Mon Sep 17 00:00:00 2001 From: Clemens Ladisch Date: Thu, 22 Oct 2009 09:04:09 +0200 Subject: sound: via82xx: deactivate DXS controls of inactive streams Activate the DXS volume controls only when the corresponding stream is being used. This makes the behaviour consistent with the other drivers that have per-stream volume controls. Signed-off-by: Clemens Ladisch Signed-off-by: Takashi Iwai --- sound/pci/via82xx.c | 59 ++++++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 52 insertions(+), 7 deletions(-) (limited to 'sound') diff --git a/sound/pci/via82xx.c b/sound/pci/via82xx.c index 91683a34903..8a332d2f615 100644 --- a/sound/pci/via82xx.c +++ b/sound/pci/via82xx.c @@ -386,6 +386,7 @@ struct via82xx { struct snd_pcm *pcms[2]; struct snd_rawmidi *rmidi; + struct snd_kcontrol *dxs_controls[4]; struct snd_ac97_bus *ac97_bus; struct snd_ac97 *ac97; @@ -1216,9 +1217,9 @@ static int snd_via82xx_pcm_open(struct via82xx *chip, struct viadev *viadev, /* - * open callback for playback on via686 and via823x DSX + * open callback for playback on via686 */ -static int snd_via82xx_playback_open(struct snd_pcm_substream *substream) +static int snd_via686_playback_open(struct snd_pcm_substream *substream) { struct via82xx *chip = snd_pcm_substream_chip(substream); struct viadev *viadev = &chip->devs[chip->playback_devno + substream->number]; @@ -1229,6 +1230,32 @@ static int snd_via82xx_playback_open(struct snd_pcm_substream *substream) return 0; } +/* + * open callback for playback on via823x DXS + */ +static int snd_via8233_playback_open(struct snd_pcm_substream *substream) +{ + struct via82xx *chip = snd_pcm_substream_chip(substream); + struct viadev *viadev; + unsigned int stream; + int err; + + viadev = &chip->devs[chip->playback_devno + substream->number]; + if ((err = snd_via82xx_pcm_open(chip, viadev, substream)) < 0) + return err; + stream = viadev->reg_offset / 0x10; + if (chip->dxs_controls[stream]) { + chip->playback_volume[stream][0] = 0; + chip->playback_volume[stream][1] = 0; + chip->dxs_controls[stream]->vd[0].access &= + ~SNDRV_CTL_ELEM_ACCESS_INACTIVE; + snd_ctl_notify(chip->card, SNDRV_CTL_EVENT_MASK_VALUE | + SNDRV_CTL_EVENT_MASK_INFO, + &chip->dxs_controls[stream]->id); + } + return 0; +} + /* * open callback for playback on via823x multi-channel */ @@ -1302,10 +1329,26 @@ static int snd_via82xx_pcm_close(struct snd_pcm_substream *substream) return 0; } +static int snd_via8233_playback_close(struct snd_pcm_substream *substream) +{ + struct via82xx *chip = snd_pcm_substream_chip(substream); + struct viadev *viadev = substream->runtime->private_data; + unsigned int stream; + + stream = viadev->reg_offset / 0x10; + if (chip->dxs_controls[stream]) { + chip->dxs_controls[stream]->vd[0].access |= + SNDRV_CTL_ELEM_ACCESS_INACTIVE; + snd_ctl_notify(chip->card, SNDRV_CTL_EVENT_MASK_INFO, + &chip->dxs_controls[stream]->id); + } + return snd_via82xx_pcm_close(substream); +} + /* via686 playback callbacks */ static struct snd_pcm_ops snd_via686_playback_ops = { - .open = snd_via82xx_playback_open, + .open = snd_via686_playback_open, .close = snd_via82xx_pcm_close, .ioctl = snd_pcm_lib_ioctl, .hw_params = snd_via82xx_hw_params, @@ -1331,8 +1374,8 @@ static struct snd_pcm_ops snd_via686_capture_ops = { /* via823x DSX playback callbacks */ static struct snd_pcm_ops snd_via8233_playback_ops = { - .open = snd_via82xx_playback_open, - .close = snd_via82xx_pcm_close, + .open = snd_via8233_playback_open, + .close = snd_via8233_playback_close, .ioctl = snd_pcm_lib_ioctl, .hw_params = snd_via82xx_hw_params, .hw_free = snd_via82xx_hw_free, @@ -1709,8 +1752,9 @@ static struct snd_kcontrol_new snd_via8233_dxs_volume_control __devinitdata = { .device = 0, /* .subdevice set later */ .name = "PCM Playback Volume", - .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | - SNDRV_CTL_ELEM_ACCESS_TLV_READ), + .access = SNDRV_CTL_ELEM_ACCESS_READWRITE | + SNDRV_CTL_ELEM_ACCESS_TLV_READ | + SNDRV_CTL_ELEM_ACCESS_INACTIVE, .info = snd_via8233_dxs_volume_info, .get = snd_via8233_dxs_volume_get, .put = snd_via8233_dxs_volume_put, @@ -1948,6 +1992,7 @@ static int __devinit snd_via8233_init_misc(struct via82xx *chip) err = snd_ctl_add(chip->card, kctl); if (err < 0) return err; + chip->dxs_controls[i] = kctl; } } } -- cgit v1.2.3 From b7d5d946e50116f4150542f881ac90ac74c28165 Mon Sep 17 00:00:00 2001 From: Krzysztof Helt Date: Sat, 24 Oct 2009 17:47:33 +0200 Subject: sound: remove OSS Ensoniq SoundScape driver The OSS driver for Ensoniq SoundScape cards is broken after conversion to mutexes and a new ALSA snd-sscape driver handles all devices handled by the OSS one. The ALSA driver was tested with these cards: Spea V7 MediaFX Ensoniq Soundscape Elite Ensoniq Soundscape VIVO (this card is not handled by the OSS driver) Signed-off-by: Krzysztof Helt Signed-off-by: Takashi Iwai --- sound/oss/Kconfig | 12 - sound/oss/Makefile | 1 - sound/oss/sscape.c | 1480 ---------------------------------------------------- 3 files changed, 1493 deletions(-) delete mode 100644 sound/oss/sscape.c (limited to 'sound') diff --git a/sound/oss/Kconfig b/sound/oss/Kconfig index bcf2a0698d5..135a2b77cc4 100644 --- a/sound/oss/Kconfig +++ b/sound/oss/Kconfig @@ -287,18 +287,6 @@ config SOUND_DMAP Say Y unless you have 16MB or more RAM or a PCI sound card. -config SOUND_SSCAPE - tristate "Ensoniq SoundScape support" - help - Answer Y if you have a sound card based on the Ensoniq SoundScape - chipset. Such cards are being manufactured at least by Ensoniq, Spea - and Reveal (Reveal makes also other cards). - - If you compile the driver into the kernel, you have to add - "sscape=,,,," to the kernel command - line. - - config SOUND_VMIDI tristate "Loopback MIDI device support" help diff --git a/sound/oss/Makefile b/sound/oss/Makefile index e0ae4d4d6a5..567b8a74178 100644 --- a/sound/oss/Makefile +++ b/sound/oss/Makefile @@ -13,7 +13,6 @@ obj-$(CONFIG_SOUND_SH_DAC_AUDIO) += sh_dac_audio.o obj-$(CONFIG_SOUND_AEDSP16) += aedsp16.o obj-$(CONFIG_SOUND_PSS) += pss.o ad1848.o mpu401.o obj-$(CONFIG_SOUND_TRIX) += trix.o ad1848.o sb_lib.o uart401.o -obj-$(CONFIG_SOUND_SSCAPE) += sscape.o ad1848.o mpu401.o obj-$(CONFIG_SOUND_MSS) += ad1848.o obj-$(CONFIG_SOUND_PAS) += pas2.o sb.o sb_lib.o uart401.o obj-$(CONFIG_SOUND_SB) += sb.o sb_lib.o uart401.o diff --git a/sound/oss/sscape.c b/sound/oss/sscape.c deleted file mode 100644 index 30c36d1f35d..00000000000 --- a/sound/oss/sscape.c +++ /dev/null @@ -1,1480 +0,0 @@ -/* - * sound/oss/sscape.c - * - * Low level driver for Ensoniq SoundScape - * - * - * Copyright (C) by Hannu Savolainen 1993-1997 - * - * OSS/Free for Linux is distributed under the GNU GENERAL PUBLIC LICENSE (GPL) - * Version 2 (June 1991). See the "COPYING" file distributed with this software - * for more info. - * - * - * Thomas Sailer : ioctl code reworked (vmalloc/vfree removed) - * Sergey Smitienko : ensoniq p'n'p support - * Christoph Hellwig : adapted to module_init/module_exit - * Bartlomiej Zolnierkiewicz : added __init to attach_sscape() - * Chris Rankin : Specify that this module owns the coprocessor - * Arnaldo C. de Melo : added missing restore_flags in sscape_pnp_upload_file - */ - -#include -#include - -#include "sound_config.h" -#include "sound_firmware.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "coproc.h" - -#include "ad1848.h" -#include "mpu401.h" - -/* - * I/O ports - */ -#define MIDI_DATA 0 -#define MIDI_CTRL 1 -#define HOST_CTRL 2 -#define TX_READY 0x02 -#define RX_READY 0x01 -#define HOST_DATA 3 -#define ODIE_ADDR 4 -#define ODIE_DATA 5 - -/* - * Indirect registers - */ - -#define GA_INTSTAT_REG 0 -#define GA_INTENA_REG 1 -#define GA_DMAA_REG 2 -#define GA_DMAB_REG 3 -#define GA_INTCFG_REG 4 -#define GA_DMACFG_REG 5 -#define GA_CDCFG_REG 6 -#define GA_SMCFGA_REG 7 -#define GA_SMCFGB_REG 8 -#define GA_HMCTL_REG 9 - -/* - * DMA channel identifiers (A and B) - */ - -#define SSCAPE_DMA_A 0 -#define SSCAPE_DMA_B 1 - -#define PORT(name) (devc->base+name) - -/* - * Host commands recognized by the OBP microcode - */ - -#define CMD_GEN_HOST_ACK 0x80 -#define CMD_GEN_MPU_ACK 0x81 -#define CMD_GET_BOARD_TYPE 0x82 -#define CMD_SET_CONTROL 0x88 /* Old firmware only */ -#define CMD_GET_CONTROL 0x89 /* Old firmware only */ -#define CTL_MASTER_VOL 0 -#define CTL_MIC_MODE 2 -#define CTL_SYNTH_VOL 4 -#define CTL_WAVE_VOL 7 -#define CMD_SET_EXTMIDI 0x8a -#define CMD_GET_EXTMIDI 0x8b -#define CMD_SET_MT32 0x8c -#define CMD_GET_MT32 0x8d - -#define CMD_ACK 0x80 - -#define IC_ODIE 1 -#define IC_OPUS 2 - -typedef struct sscape_info -{ - int base, irq, dma; - - int codec, codec_irq; /* required to setup pnp cards*/ - int codec_type; - int ic_type; - char* raw_buf; - unsigned long raw_buf_phys; - int buffsize; /* -------------------------- */ - spinlock_t lock; - int ok; /* Properly detected */ - int failed; - int dma_allocated; - int codec_audiodev; - int opened; - int *osp; - int my_audiodev; -} sscape_info; - -static struct sscape_info adev_info = { - 0 -}; - -static struct sscape_info *devc = &adev_info; -static int sscape_mididev = -1; - -/* Some older cards have assigned interrupt bits differently than new ones */ -static char valid_interrupts_old[] = { - 9, 7, 5, 15 -}; - -static char valid_interrupts_new[] = { - 9, 5, 7, 10 -}; - -static char *valid_interrupts = valid_interrupts_new; - -/* - * See the bottom of the driver. This can be set by spea =0/1. - */ - -#ifdef REVEAL_SPEA -static char old_hardware = 1; -#else -static char old_hardware; -#endif - -static void sleep(unsigned howlong) -{ - current->state = TASK_INTERRUPTIBLE; - schedule_timeout(howlong); -} - -static unsigned char sscape_read(struct sscape_info *devc, int reg) -{ - unsigned long flags; - unsigned char val; - - spin_lock_irqsave(&devc->lock,flags); - outb(reg, PORT(ODIE_ADDR)); - val = inb(PORT(ODIE_DATA)); - spin_unlock_irqrestore(&devc->lock,flags); - return val; -} - -static void __sscape_write(int reg, int data) -{ - outb(reg, PORT(ODIE_ADDR)); - outb(data, PORT(ODIE_DATA)); -} - -static void sscape_write(struct sscape_info *devc, int reg, int data) -{ - unsigned long flags; - - spin_lock_irqsave(&devc->lock,flags); - __sscape_write(reg, data); - spin_unlock_irqrestore(&devc->lock,flags); -} - -static unsigned char sscape_pnp_read_codec(sscape_info* devc, unsigned char reg) -{ - unsigned char res; - unsigned long flags; - - spin_lock_irqsave(&devc->lock,flags); - outb( reg, devc -> codec); - res = inb (devc -> codec + 1); - spin_unlock_irqrestore(&devc->lock,flags); - return res; - -} - -static void sscape_pnp_write_codec(sscape_info* devc, unsigned char reg, unsigned char data) -{ - unsigned long flags; - - spin_lock_irqsave(&devc->lock,flags); - outb( reg, devc -> codec); - outb( data, devc -> codec + 1); - spin_unlock_irqrestore(&devc->lock,flags); -} - -static void host_open(struct sscape_info *devc) -{ - outb((0x00), PORT(HOST_CTRL)); /* Put the board to the host mode */ -} - -static void host_close(struct sscape_info *devc) -{ - outb((0x03), PORT(HOST_CTRL)); /* Put the board to the MIDI mode */ -} - -static int host_write(struct sscape_info *devc, unsigned char *data, int count) -{ - unsigned long flags; - int i, timeout_val; - - spin_lock_irqsave(&devc->lock,flags); - /* - * Send the command and data bytes - */ - - for (i = 0; i < count; i++) - { - for (timeout_val = 10000; timeout_val > 0; timeout_val--) - if (inb(PORT(HOST_CTRL)) & TX_READY) - break; - - if (timeout_val <= 0) - { - spin_unlock_irqrestore(&devc->lock,flags); - return 0; - } - outb(data[i], PORT(HOST_DATA)); - } - spin_unlock_irqrestore(&devc->lock,flags); - return 1; -} - -static int host_read(struct sscape_info *devc) -{ - unsigned long flags; - int timeout_val; - unsigned char data; - - spin_lock_irqsave(&devc->lock,flags); - /* - * Read a byte - */ - - for (timeout_val = 10000; timeout_val > 0; timeout_val--) - if (inb(PORT(HOST_CTRL)) & RX_READY) - break; - - if (timeout_val <= 0) - { - spin_unlock_irqrestore(&devc->lock,flags); - return -1; - } - data = inb(PORT(HOST_DATA)); - spin_unlock_irqrestore(&devc->lock,flags); - return data; -} - -#if 0 /* unused */ -static int host_command1(struct sscape_info *devc, int cmd) -{ - unsigned char buf[10]; - buf[0] = (unsigned char) (cmd & 0xff); - return host_write(devc, buf, 1); -} -#endif /* unused */ - - -static int host_command2(struct sscape_info *devc, int cmd, int parm1) -{ - unsigned char buf[10]; - - buf[0] = (unsigned char) (cmd & 0xff); - buf[1] = (unsigned char) (parm1 & 0xff); - - return host_write(devc, buf, 2); -} - -static int host_command3(struct sscape_info *devc, int cmd, int parm1, int parm2) -{ - unsigned char buf[10]; - - buf[0] = (unsigned char) (cmd & 0xff); - buf[1] = (unsigned char) (parm1 & 0xff); - buf[2] = (unsigned char) (parm2 & 0xff); - return host_write(devc, buf, 3); -} - -static void set_mt32(struct sscape_info *devc, int value) -{ - host_open(devc); - host_command2(devc, CMD_SET_MT32, value ? 1 : 0); - if (host_read(devc) != CMD_ACK) - { - /* printk( "SNDSCAPE: Setting MT32 mode failed\n"); */ - } - host_close(devc); -} - -static void set_control(struct sscape_info *devc, int ctrl, int value) -{ - host_open(devc); - host_command3(devc, CMD_SET_CONTROL, ctrl, value); - if (host_read(devc) != CMD_ACK) - { - /* printk( "SNDSCAPE: Setting control (%d) failed\n", ctrl); */ - } - host_close(devc); -} - -static void do_dma(struct sscape_info *devc, int dma_chan, unsigned long buf, int blk_size, int mode) -{ - unsigned char temp; - - if (dma_chan != SSCAPE_DMA_A) - { - printk(KERN_WARNING "soundscape: Tried to use DMA channel != A. Why?\n"); - return; - } - audio_devs[devc->codec_audiodev]->flags &= ~DMA_AUTOMODE; - DMAbuf_start_dma(devc->codec_audiodev, buf, blk_size, mode); - audio_devs[devc->codec_audiodev]->flags |= DMA_AUTOMODE; - - temp = devc->dma << 4; /* Setup DMA channel select bits */ - if (devc->dma <= 3) - temp |= 0x80; /* 8 bit DMA channel */ - - temp |= 1; /* Trigger DMA */ - sscape_write(devc, GA_DMAA_REG, temp); - temp &= 0xfe; /* Clear DMA trigger */ - sscape_write(devc, GA_DMAA_REG, temp); -} - -static int verify_mpu(struct sscape_info *devc) -{ - /* - * The SoundScape board could be in three modes (MPU, 8250 and host). - * If the card is not in the MPU mode, enabling the MPU driver will - * cause infinite loop (the driver believes that there is always some - * received data in the buffer. - * - * Detect this by looking if there are more than 10 received MIDI bytes - * (0x00) in the buffer. - */ - - int i; - - for (i = 0; i < 10; i++) - { - if (inb(devc->base + HOST_CTRL) & 0x80) - return 1; - - if (inb(devc->base) != 0x00) - return 1; - } - printk(KERN_WARNING "SoundScape: The device is not in the MPU-401 mode\n"); - return 0; -} - -static int sscape_coproc_open(void *dev_info, int sub_device) -{ - if (sub_device == COPR_MIDI) - { - set_mt32(devc, 0); - if (!verify_mpu(devc)) - return -EIO; - } - return 0; -} - -static void sscape_coproc_close(void *dev_info, int sub_device) -{ - struct sscape_info *devc = dev_info; - unsigned long flags; - - spin_lock_irqsave(&devc->lock,flags); - if (devc->dma_allocated) - { - __sscape_write(GA_DMAA_REG, 0x20); /* DMA channel disabled */ - devc->dma_allocated = 0; - } - spin_unlock_irqrestore(&devc->lock,flags); - return; -} - -static void sscape_coproc_reset(void *dev_info) -{ -} - -static int sscape_download_boot(struct sscape_info *devc, unsigned char *block, int size, int flag) -{ - unsigned long flags; - unsigned char temp; - volatile int done, timeout_val; - static unsigned char codec_dma_bits; - - if (flag & CPF_FIRST) - { - /* - * First block. Have to allocate DMA and to reset the board - * before continuing. - */ - - spin_lock_irqsave(&devc->lock,flags); - codec_dma_bits = sscape_read(devc, GA_CDCFG_REG); - - if (devc->dma_allocated == 0) - devc->dma_allocated = 1; - - spin_unlock_irqrestore(&devc->lock,flags); - - sscape_write(devc, GA_HMCTL_REG, - (temp = sscape_read(devc, GA_HMCTL_REG)) & 0x3f); /*Reset */ - - for (timeout_val = 10000; timeout_val > 0; timeout_val--) - sscape_read(devc, GA_HMCTL_REG); /* Delay */ - - /* Take board out of reset */ - sscape_write(devc, GA_HMCTL_REG, - (temp = sscape_read(devc, GA_HMCTL_REG)) | 0x80); - } - /* - * Transfer one code block using DMA - */ - if (audio_devs[devc->codec_audiodev]->dmap_out->raw_buf == NULL) - { - printk(KERN_WARNING "soundscape: DMA buffer not available\n"); - return 0; - } - memcpy(audio_devs[devc->codec_audiodev]->dmap_out->raw_buf, block, size); - - spin_lock_irqsave(&devc->lock,flags); - - /******** INTERRUPTS DISABLED NOW ********/ - - do_dma(devc, SSCAPE_DMA_A, - audio_devs[devc->codec_audiodev]->dmap_out->raw_buf_phys, - size, DMA_MODE_WRITE); - - /* - * Wait until transfer completes. - */ - - done = 0; - timeout_val = 30; - while (!done && timeout_val-- > 0) - { - int resid; - - if (HZ / 50) - sleep(HZ / 50); - clear_dma_ff(devc->dma); - if ((resid = get_dma_residue(devc->dma)) == 0) - done = 1; - } - - spin_unlock_irqrestore(&devc->lock,flags); - if (!done) - return 0; - - if (flag & CPF_LAST) - { - /* - * Take the board out of reset - */ - outb((0x00), PORT(HOST_CTRL)); - outb((0x00), PORT(MIDI_CTRL)); - - temp = sscape_read(devc, GA_HMCTL_REG); - temp |= 0x40; - sscape_write(devc, GA_HMCTL_REG, temp); /* Kickstart the board */ - - /* - * Wait until the ODB wakes up - */ - spin_lock_irqsave(&devc->lock,flags); - done = 0; - timeout_val = 5 * HZ; - while (!done && timeout_val-- > 0) - { - unsigned char x; - - sleep(1); - x = inb(PORT(HOST_DATA)); - if (x == 0xff || x == 0xfe) /* OBP startup acknowledge */ - { - DDB(printk("Soundscape: Acknowledge = %x\n", x)); - done = 1; - } - } - sscape_write(devc, GA_CDCFG_REG, codec_dma_bits); - - spin_unlock_irqrestore(&devc->lock,flags); - if (!done) - { - printk(KERN_ERR "soundscape: The OBP didn't respond after code download\n"); - return 0; - } - spin_lock_irqsave(&devc->lock,flags); - done = 0; - timeout_val = 5 * HZ; - while (!done && timeout_val-- > 0) - { - sleep(1); - if (inb(PORT(HOST_DATA)) == 0xfe) /* Host startup acknowledge */ - done = 1; - } - spin_unlock_irqrestore(&devc->lock,flags); - if (!done) - { - printk(KERN_ERR "soundscape: OBP Initialization failed.\n"); - return 0; - } - printk(KERN_INFO "SoundScape board initialized OK\n"); - set_control(devc, CTL_MASTER_VOL, 100); - set_control(devc, CTL_SYNTH_VOL, 100); - -#ifdef SSCAPE_DEBUG3 - /* - * Temporary debugging aid. Print contents of the registers after - * downloading the code. - */ - { - int i; - - for (i = 0; i < 13; i++) - printk("I%d = %02x (new value)\n", i, sscape_read(devc, i)); - } -#endif - - } - return 1; -} - -static int download_boot_block(void *dev_info, copr_buffer * buf) -{ - if (buf->len <= 0 || buf->len > sizeof(buf->data)) - return -EINVAL; - - if (!sscape_download_boot(devc, buf->data, buf->len, buf->flags)) - { - printk(KERN_ERR "soundscape: Unable to load microcode block to the OBP.\n"); - return -EIO; - } - return 0; -} - -static int sscape_coproc_ioctl(void *dev_info, unsigned int cmd, void __user *arg, int local) -{ - copr_buffer *buf; - int err; - - switch (cmd) - { - case SNDCTL_COPR_RESET: - sscape_coproc_reset(dev_info); - return 0; - - case SNDCTL_COPR_LOAD: - buf = (copr_buffer *) vmalloc(sizeof(copr_buffer)); - if (buf == NULL) - return -ENOSPC; - if (copy_from_user(buf, arg, sizeof(copr_buffer))) - { - vfree(buf); - return -EFAULT; - } - err = download_boot_block(dev_info, buf); - vfree(buf); - return err; - - default: - return -EINVAL; - } -} - -static coproc_operations sscape_coproc_operations = -{ - "SoundScape M68K", - THIS_MODULE, - sscape_coproc_open, - sscape_coproc_close, - sscape_coproc_ioctl, - sscape_coproc_reset, - &adev_info -}; - -static struct resource *sscape_ports; -static int sscape_is_pnp; - -static void __init attach_sscape(struct address_info *hw_config) -{ -#ifndef SSCAPE_REGS - /* - * Config register values for Spea/V7 Media FX and Ensoniq S-2000. - * These values are card - * dependent. If you have another SoundScape based card, you have to - * find the correct values. Do the following: - * - Compile this driver with SSCAPE_DEBUG1 defined. - * - Shut down and power off your machine. - * - Boot with DOS so that the SSINIT.EXE program is run. - * - Warm boot to {Linux|SYSV|BSD} and write down the lines displayed - * when detecting the SoundScape. - * - Modify the following list to use the values printed during boot. - * Undefine the SSCAPE_DEBUG1 - */ -#define SSCAPE_REGS { \ -/* I0 */ 0x00, \ -/* I1 */ 0xf0, /* Note! Ignored. Set always to 0xf0 */ \ -/* I2 */ 0x20, /* Note! Ignored. Set always to 0x20 */ \ -/* I3 */ 0x20, /* Note! Ignored. Set always to 0x20 */ \ -/* I4 */ 0xf5, /* Ignored */ \ -/* I5 */ 0x10, \ -/* I6 */ 0x00, \ -/* I7 */ 0x2e, /* I7 MEM config A. Likely to vary between models */ \ -/* I8 */ 0x00, /* I8 MEM config B. Likely to vary between models */ \ -/* I9 */ 0x40 /* Ignored */ \ - } -#endif - - unsigned long flags; - static unsigned char regs[10] = SSCAPE_REGS; - - int i, irq_bits = 0xff; - - if (old_hardware) - { - valid_interrupts = valid_interrupts_old; - conf_printf("Ensoniq SoundScape (old)", hw_config); - } - else - conf_printf("Ensoniq SoundScape", hw_config); - - for (i = 0; i < 4; i++) - { - if (hw_config->irq == valid_interrupts[i]) - { - irq_bits = i; - break; - } - } - if (hw_config->irq > 15 || (regs[4] = irq_bits == 0xff)) - { - printk(KERN_ERR "Invalid IRQ%d\n", hw_config->irq); - release_region(devc->base, 2); - release_region(devc->base + 2, 6); - if (sscape_is_pnp) - release_region(devc->codec, 2); - return; - } - - if (!sscape_is_pnp) { - - spin_lock_irqsave(&devc->lock,flags); - /* Host interrupt enable */ - sscape_write(devc, 1, 0xf0); /* All interrupts enabled */ - /* DMA A status/trigger register */ - sscape_write(devc, 2, 0x20); /* DMA channel disabled */ - /* DMA B status/trigger register */ - sscape_write(devc, 3, 0x20); /* DMA channel disabled */ - /* Host interrupt config reg */ - sscape_write(devc, 4, 0xf0 | (irq_bits << 2) | irq_bits); - /* Don't destroy CD-ROM DMA config bits (0xc0) */ - sscape_write(devc, 5, (regs[5] & 0x3f) | (sscape_read(devc, 5) & 0xc0)); - /* CD-ROM config (WSS codec actually) */ - sscape_write(devc, 6, regs[6]); - sscape_write(devc, 7, regs[7]); - sscape_write(devc, 8, regs[8]); - /* Master control reg. Don't modify CR-ROM bits. Disable SB emul */ - sscape_write(devc, 9, (sscape_read(devc, 9) & 0xf0) | 0x08); - spin_unlock_irqrestore(&devc->lock,flags); - } -#ifdef SSCAPE_DEBUG2 - /* - * Temporary debugging aid. Print contents of the registers after - * changing them. - */ - { - int i; - - for (i = 0; i < 13; i++) - printk("I%d = %02x (new value)\n", i, sscape_read(devc, i)); - } -#endif - - if (probe_mpu401(hw_config, sscape_ports)) - hw_config->always_detect = 1; - hw_config->name = "SoundScape"; - - hw_config->irq *= -1; /* Negative value signals IRQ sharing */ - attach_mpu401(hw_config, THIS_MODULE); - hw_config->irq *= -1; /* Restore it */ - - if (hw_config->slots[1] != -1) /* The MPU driver installed itself */ - { - sscape_mididev = hw_config->slots[1]; - midi_devs[hw_config->slots[1]]->coproc = &sscape_coproc_operations; - } - sscape_write(devc, GA_INTENA_REG, 0x80); /* Master IRQ enable */ - devc->ok = 1; - devc->failed = 0; -} - -static int detect_ga(sscape_info * devc) -{ - unsigned char save; - - DDB(printk("Entered Soundscape detect_ga(%x)\n", devc->base)); - - /* - * First check that the address register of "ODIE" is - * there and that it has exactly 4 writable bits. - * First 4 bits - */ - - if ((save = inb(PORT(ODIE_ADDR))) & 0xf0) - { - DDB(printk("soundscape: Detect error A\n")); - return 0; - } - outb((0x00), PORT(ODIE_ADDR)); - if (inb(PORT(ODIE_ADDR)) != 0x00) - { - DDB(printk("soundscape: Detect error B\n")); - return 0; - } - outb((0xff), PORT(ODIE_ADDR)); - if (inb(PORT(ODIE_ADDR)) != 0x0f) - { - DDB(printk("soundscape: Detect error C\n")); - return 0; - } - outb((save), PORT(ODIE_ADDR)); - - /* - * Now verify that some indirect registers return zero on some bits. - * This may break the driver with some future revisions of "ODIE" but... - */ - - if (sscape_read(devc, 0) & 0x0c) - { - DDB(printk("soundscape: Detect error D (%x)\n", sscape_read(devc, 0))); - return 0; - } - if (sscape_read(devc, 1) & 0x0f) - { - DDB(printk("soundscape: Detect error E\n")); - return 0; - } - if (sscape_read(devc, 5) & 0x0f) - { - DDB(printk("soundscape: Detect error F\n")); - return 0; - } - return 1; -} - -static int sscape_read_host_ctrl(sscape_info* devc) -{ - return host_read(devc); -} - -static void sscape_write_host_ctrl2(sscape_info *devc, int a, int b) -{ - host_command2(devc, a, b); -} - -static int sscape_alloc_dma(sscape_info *devc) -{ - char *start_addr, *end_addr; - int dma_pagesize; - int sz, size; - struct page *page; - - if (devc->raw_buf != NULL) return 0; /* Already done */ - dma_pagesize = (devc->dma < 4) ? (64 * 1024) : (128 * 1024); - devc->raw_buf = NULL; - devc->buffsize = 8192*4; - if (devc->buffsize > dma_pagesize) devc->buffsize = dma_pagesize; - start_addr = NULL; - /* - * Now loop until we get a free buffer. Try to get smaller buffer if - * it fails. Don't accept smaller than 8k buffer for performance - * reasons. - */ - while (start_addr == NULL && devc->buffsize > PAGE_SIZE) { - for (sz = 0, size = PAGE_SIZE; size < devc->buffsize; sz++, size <<= 1); - devc->buffsize = PAGE_SIZE * (1 << sz); - start_addr = (char *) __get_free_pages(GFP_ATOMIC|GFP_DMA, sz); - if (start_addr == NULL) devc->buffsize /= 2; - } - - if (start_addr == NULL) { - printk(KERN_ERR "sscape pnp init error: Couldn't allocate DMA buffer\n"); - return 0; - } else { - /* make some checks */ - end_addr = start_addr + devc->buffsize - 1; - /* now check if it fits into the same dma-pagesize */ - - if (((long) start_addr & ~(dma_pagesize - 1)) != ((long) end_addr & ~(dma_pagesize - 1)) - || end_addr >= (char *) (MAX_DMA_ADDRESS)) { - printk(KERN_ERR "sscape pnp: Got invalid address 0x%lx for %db DMA-buffer\n", (long) start_addr, devc->buffsize); - return 0; - } - } - devc->raw_buf = start_addr; - devc->raw_buf_phys = virt_to_bus(start_addr); - - for (page = virt_to_page(start_addr); page <= virt_to_page(end_addr); page++) - SetPageReserved(page); - return 1; -} - -static void sscape_free_dma(sscape_info *devc) -{ - int sz, size; - unsigned long start_addr, end_addr; - struct page *page; - - if (devc->raw_buf == NULL) return; - for (sz = 0, size = PAGE_SIZE; size < devc->buffsize; sz++, size <<= 1); - start_addr = (unsigned long) devc->raw_buf; - end_addr = start_addr + devc->buffsize; - - for (page = virt_to_page(start_addr); page <= virt_to_page(end_addr); page++) - ClearPageReserved(page); - - free_pages((unsigned long) devc->raw_buf, sz); - devc->raw_buf = NULL; -} - -/* Intel version !!!!!!!!! */ - -static int sscape_start_dma(int chan, unsigned long physaddr, int count, int dma_mode) -{ - unsigned long flags; - - flags = claim_dma_lock(); - disable_dma(chan); - clear_dma_ff(chan); - set_dma_mode(chan, dma_mode); - set_dma_addr(chan, physaddr); - set_dma_count(chan, count); - enable_dma(chan); - release_dma_lock(flags); - return 0; -} - -static void sscape_pnp_start_dma(sscape_info* devc, int arg ) -{ - int reg; - if (arg == 0) reg = 2; - else reg = 3; - - sscape_write(devc, reg, sscape_read( devc, reg) | 0x01); - sscape_write(devc, reg, sscape_read( devc, reg) & 0xFE); -} - -static int sscape_pnp_wait_dma (sscape_info* devc, int arg ) -{ - int reg; - unsigned long i; - unsigned char d; - - if (arg == 0) reg = 2; - else reg = 3; - - sleep ( 1 ); - i = 0; - do { - d = sscape_read(devc, reg) & 1; - if ( d == 1) break; - i++; - } while (i < 500000); - d = sscape_read(devc, reg) & 1; - return d; -} - -static int sscape_pnp_alloc_dma(sscape_info* devc) -{ - /* printk(KERN_INFO "sscape: requesting dma\n"); */ - if (request_dma(devc -> dma, "sscape")) return 0; - /* printk(KERN_INFO "sscape: dma channel allocated\n"); */ - if (!sscape_alloc_dma(devc)) { - free_dma(devc -> dma); - return 0; - }; - return 1; -} - -static void sscape_pnp_free_dma(sscape_info* devc) -{ - sscape_free_dma( devc); - free_dma(devc -> dma ); - /* printk(KERN_INFO "sscape: dma released\n"); */ -} - -static int sscape_pnp_upload_file(sscape_info* devc, char* fn) -{ - int done = 0; - int timeout_val; - char* data,*dt; - int len,l; - unsigned long flags; - - sscape_write( devc, 9, sscape_read(devc, 9 ) & 0x3F ); - sscape_write( devc, 2, (devc -> dma << 4) | 0x80 ); - sscape_write( devc, 3, 0x20 ); - sscape_write( devc, 9, sscape_read( devc, 9 ) | 0x80 ); - - len = mod_firmware_load(fn, &data); - if (len == 0) { - printk(KERN_ERR "sscape: file not found: %s\n", fn); - return 0; - } - dt = data; - spin_lock_irqsave(&devc->lock,flags); - while ( len > 0 ) { - if (len > devc -> buffsize) l = devc->buffsize; - else l = len; - len -= l; - memcpy(devc->raw_buf, dt, l); dt += l; - sscape_start_dma(devc->dma, devc->raw_buf_phys, l, 0x48); - sscape_pnp_start_dma ( devc, 0 ); - if (sscape_pnp_wait_dma ( devc, 0 ) == 0) { - spin_unlock_irqrestore(&devc->lock,flags); - return 0; - } - } - - spin_unlock_irqrestore(&devc->lock,flags); - vfree(data); - - outb(0, devc -> base + 2); - outb(0, devc -> base); - - sscape_write ( devc, 9, sscape_read( devc, 9 ) | 0x40); - - timeout_val = 5 * HZ; - while (!done && timeout_val-- > 0) - { - unsigned char x; - sleep(1); - x = inb( devc -> base + 3); - if (x == 0xff || x == 0xfe) /* OBP startup acknowledge */ - { - //printk(KERN_ERR "Soundscape: Acknowledge = %x\n", x); - done = 1; - } - } - timeout_val = 5 * HZ; - done = 0; - while (!done && timeout_val-- > 0) - { - unsigned char x; - sleep(1); - x = inb( devc -> base + 3); - if (x == 0xfe) /* OBP startup acknowledge */ - { - //printk(KERN_ERR "Soundscape: Acknowledge = %x\n", x); - done = 1; - } - } - - if ( !done ) printk(KERN_ERR "soundscape: OBP Initialization failed.\n"); - - sscape_write( devc, 2, devc->ic_type == IC_ODIE ? 0x70 : 0x40); - sscape_write( devc, 3, (devc -> dma << 4) + 0x80); - return 1; -} - -static void __init sscape_pnp_init_hw(sscape_info* devc) -{ - unsigned char midi_irq = 0, sb_irq = 0; - unsigned i; - static char code_file_name[23] = "/sndscape/sndscape.cox"; - - int sscape_joystic_enable = 0x7f; - int sscape_mic_enable = 0; - int sscape_ext_midi = 0; - - if ( !sscape_pnp_alloc_dma(devc) ) { - printk(KERN_ERR "sscape: faild to allocate dma\n"); - return; - } - - for (i = 0; i < 4; i++) { - if ( devc -> irq == valid_interrupts[i] ) - midi_irq = i; - if ( devc -> codec_irq == valid_interrupts[i] ) - sb_irq = i; - } - - sscape_write( devc, 5, 0x50); - sscape_write( devc, 7, 0x2e); - sscape_write( devc, 8, 0x00); - - sscape_write( devc, 2, devc->ic_type == IC_ODIE ? 0x70 : 0x40); - sscape_write( devc, 3, ( devc -> dma << 4) | 0x80); - - sscape_write (devc, 4, 0xF0 | (midi_irq<<2) | midi_irq); - - i = 0x10; //sscape_read(devc, 9) & (devc->ic_type == IC_ODIE ? 0xf0 : 0xc0); - if (sscape_joystic_enable) i |= 8; - - sscape_write (devc, 9, i); - sscape_write (devc, 6, 0x80); - sscape_write (devc, 1, 0x80); - - if (devc -> codec_type == 2) { - sscape_pnp_write_codec( devc, 0x0C, 0x50); - sscape_pnp_write_codec( devc, 0x10, sscape_pnp_read_codec( devc, 0x10) & 0x3F); - sscape_pnp_write_codec( devc, 0x11, sscape_pnp_read_codec( devc, 0x11) | 0xC0); - sscape_pnp_write_codec( devc, 29, 0x20); - } - - if (sscape_pnp_upload_file(devc, "/sndscape/scope.cod") == 0 ) { - printk(KERN_ERR "sscape: faild to upload file /sndscape/scope.cod\n"); - sscape_pnp_free_dma(devc); - return; - } - - i = sscape_read_host_ctrl( devc ); - - if ( (i & 0x0F) > 7 ) { - printk(KERN_ERR "sscape: scope.cod faild\n"); - sscape_pnp_free_dma(devc); - return; - } - if ( i & 0x10 ) sscape_write( devc, 7, 0x2F); - code_file_name[21] = (char) ( i & 0x0F) + 0x30; - if (sscape_pnp_upload_file( devc, code_file_name) == 0) { - printk(KERN_ERR "sscape: faild to upload file %s\n", code_file_name); - sscape_pnp_free_dma(devc); - return; - } - - if (devc->ic_type != IC_ODIE) { - sscape_pnp_write_codec( devc, 10, (sscape_pnp_read_codec(devc, 10) & 0x7f) | - ( sscape_mic_enable == 0 ? 0x00 : 0x80) ); - } - sscape_write_host_ctrl2( devc, 0x84, 0x64 ); /* MIDI volume */ - sscape_write_host_ctrl2( devc, 0x86, 0x64 ); /* MIDI volume?? */ - sscape_write_host_ctrl2( devc, 0x8A, sscape_ext_midi); - - sscape_pnp_write_codec ( devc, 6, 0x3f ); //WAV_VOL - sscape_pnp_write_codec ( devc, 7, 0x3f ); //WAV_VOL - sscape_pnp_write_codec ( devc, 2, 0x1F ); //WD_CDXVOLL - sscape_pnp_write_codec ( devc, 3, 0x1F ); //WD_CDXVOLR - - if (devc -> codec_type == 1) { - sscape_pnp_write_codec ( devc, 4, 0x1F ); - sscape_pnp_write_codec ( devc, 5, 0x1F ); - sscape_write_host_ctrl2( devc, 0x88, sscape_mic_enable); - } else { - int t; - sscape_pnp_write_codec ( devc, 0x10, 0x1F << 1); - sscape_pnp_write_codec ( devc, 0x11, 0xC0 | (0x1F << 1)); - - t = sscape_pnp_read_codec( devc, 0x00) & 0xDF; - if ( (sscape_mic_enable == 0)) t |= 0; - else t |= 0x20; - sscape_pnp_write_codec ( devc, 0x00, t); - t = sscape_pnp_read_codec( devc, 0x01) & 0xDF; - if ( (sscape_mic_enable == 0) ) t |= 0; - else t |= 0x20; - sscape_pnp_write_codec ( devc, 0x01, t); - sscape_pnp_write_codec ( devc, 0x40 | 29 , 0x20); - outb(0, devc -> codec); - } - if (devc -> ic_type == IC_OPUS ) { - int i = sscape_read( devc, 9 ); - sscape_write( devc, 9, i | 3 ); - sscape_write( devc, 3, 0x40); - - if (request_region(0x228, 1, "sscape setup junk")) { - outb(0, 0x228); - release_region(0x228,1); - } - sscape_write( devc, 3, (devc -> dma << 4) | 0x80); - sscape_write( devc, 9, i ); - } - - host_close ( devc ); - sscape_pnp_free_dma(devc); -} - -static int __init detect_sscape_pnp(sscape_info* devc) -{ - long i, irq_bits = 0xff; - unsigned int d; - - DDB(printk("Entered detect_sscape_pnp(%x)\n", devc->base)); - - if (!request_region(devc->codec, 2, "sscape codec")) { - printk(KERN_ERR "detect_sscape_pnp: port %x is not free\n", devc->codec); - return 0; - } - - if ((inb(devc->base + 2) & 0x78) != 0) - goto fail; - - d = inb ( devc -> base + 4) & 0xF0; - if (d & 0x80) - goto fail; - - if (d == 0) { - devc->codec_type = 1; - devc->ic_type = IC_ODIE; - } else if ( (d & 0x60) != 0) { - devc->codec_type = 2; - devc->ic_type = IC_OPUS; - } else if ( (d & 0x40) != 0) { /* WTF? */ - devc->codec_type = 2; - devc->ic_type = IC_ODIE; - } else - goto fail; - - sscape_is_pnp = 1; - - outb(0xFA, devc -> base+4); - if ((inb( devc -> base+4) & 0x9F) != 0x0A) - goto fail; - outb(0xFE, devc -> base+4); - if ( (inb(devc -> base+4) & 0x9F) != 0x0E) - goto fail; - if ( (inb(devc -> base+5) & 0x9F) != 0x0E) - goto fail; - - if (devc->codec_type == 2) { - if (devc->codec != devc->base + 8) { - printk("soundscape warning: incorrect codec port specified\n"); - goto fail; - } - d = 0x10 | (sscape_read(devc, 9) & 0xCF); - sscape_write(devc, 9, d); - sscape_write(devc, 6, 0x80); - } else { - //todo: check codec is not base + 8 - } - - d = (sscape_read(devc, 9) & 0x3F) | 0xC0; - sscape_write(devc, 9, d); - - for (i = 0; i < 550000; i++) - if ( !(inb(devc -> codec) & 0x80) ) break; - - d = inb(devc -> codec); - if (d & 0x80) - goto fail; - if ( inb(devc -> codec + 2) == 0xFF) - goto fail; - - sscape_write(devc, 9, sscape_read(devc, 9) & 0x3F ); - - d = inb(devc -> codec) & 0x80; - if ( d == 0) { - printk(KERN_INFO "soundscape: hardware detected\n"); - valid_interrupts = valid_interrupts_new; - } else { - printk(KERN_INFO "soundscape: board looks like media fx\n"); - valid_interrupts = valid_interrupts_old; - old_hardware = 1; - } - - sscape_write( devc, 9, 0xC0 | (sscape_read(devc, 9) & 0x3F) ); - - for (i = 0; i < 550000; i++) - if ( !(inb(devc -> codec) & 0x80)) - break; - - sscape_pnp_init_hw(devc); - - for (i = 0; i < 4; i++) - { - if (devc->codec_irq == valid_interrupts[i]) { - irq_bits = i; - break; - } - } - sscape_write(devc, GA_INTENA_REG, 0x00); - sscape_write(devc, GA_DMACFG_REG, 0x50); - sscape_write(devc, GA_DMAA_REG, 0x70); - sscape_write(devc, GA_DMAB_REG, 0x20); - sscape_write(devc, GA_INTCFG_REG, 0xf0); - sscape_write(devc, GA_CDCFG_REG, 0x89 | (devc->dma << 4) | (irq_bits << 1)); - - sscape_pnp_write_codec( devc, 0, sscape_pnp_read_codec( devc, 0) | 0x20); - sscape_pnp_write_codec( devc, 0, sscape_pnp_read_codec( devc, 1) | 0x20); - - return 1; -fail: - release_region(devc->codec, 2); - return 0; -} - -static int __init probe_sscape(struct address_info *hw_config) -{ - devc->base = hw_config->io_base; - devc->irq = hw_config->irq; - devc->dma = hw_config->dma; - devc->osp = hw_config->osp; - -#ifdef SSCAPE_DEBUG1 - /* - * Temporary debugging aid. Print contents of the registers before - * changing them. - */ - { - int i; - - for (i = 0; i < 13; i++) - printk("I%d = %02x (old value)\n", i, sscape_read(devc, i)); - } -#endif - devc->failed = 1; - - sscape_ports = request_region(devc->base, 2, "mpu401"); - if (!sscape_ports) - return 0; - - if (!request_region(devc->base + 2, 6, "SoundScape")) { - release_region(devc->base, 2); - return 0; - } - - if (!detect_ga(devc)) { - if (detect_sscape_pnp(devc)) - return 1; - release_region(devc->base, 2); - release_region(devc->base + 2, 6); - return 0; - } - - if (old_hardware) /* Check that it's really an old Spea/Reveal card. */ - { - unsigned char tmp; - int cc; - - if (!((tmp = sscape_read(devc, GA_HMCTL_REG)) & 0xc0)) - { - sscape_write(devc, GA_HMCTL_REG, tmp | 0x80); - for (cc = 0; cc < 200000; ++cc) - inb(devc->base + ODIE_ADDR); - } - } - return 1; -} - -static int __init init_ss_ms_sound(struct address_info *hw_config) -{ - int i, irq_bits = 0xff; - int ad_flags = 0; - struct resource *ports; - - if (devc->failed) - { - printk(KERN_ERR "soundscape: Card not detected\n"); - return 0; - } - if (devc->ok == 0) - { - printk(KERN_ERR "soundscape: Invalid initialization order.\n"); - return 0; - } - for (i = 0; i < 4; i++) - { - if (hw_config->irq == valid_interrupts[i]) - { - irq_bits = i; - break; - } - } - if (irq_bits == 0xff) { - printk(KERN_ERR "soundscape: Invalid MSS IRQ%d\n", hw_config->irq); - return 0; - } - - if (old_hardware) - ad_flags = 0x12345677; /* Tell that we may have a CS4248 chip (Spea-V7 Media FX) */ - else if (sscape_is_pnp) - ad_flags = 0x87654321; /* Tell that we have a soundscape pnp with 1845 chip */ - - ports = request_region(hw_config->io_base, 4, "ad1848"); - if (!ports) { - printk(KERN_ERR "soundscape: ports busy\n"); - return 0; - } - - if (!ad1848_detect(ports, &ad_flags, hw_config->osp)) { - release_region(hw_config->io_base, 4); - return 0; - } - - if (!sscape_is_pnp) /*pnp is already setup*/ - { - /* - * Setup the DMA polarity. - */ - sscape_write(devc, GA_DMACFG_REG, 0x50); - - /* - * Take the gate-array off of the DMA channel. - */ - sscape_write(devc, GA_DMAB_REG, 0x20); - - /* - * Init the AD1848 (CD-ROM) config reg. - */ - sscape_write(devc, GA_CDCFG_REG, 0x89 | (hw_config->dma << 4) | (irq_bits << 1)); - } - - if (hw_config->irq == devc->irq) - printk(KERN_WARNING "soundscape: Warning! The WSS mode can't share IRQ with MIDI\n"); - - hw_config->slots[0] = ad1848_init( - sscape_is_pnp ? "SoundScape" : "SoundScape PNP", - ports, - hw_config->irq, - hw_config->dma, - hw_config->dma, - 0, - devc->osp, - THIS_MODULE); - - - if (hw_config->slots[0] != -1) /* The AD1848 driver installed itself */ - { - audio_devs[hw_config->slots[0]]->coproc = &sscape_coproc_operations; - devc->codec_audiodev = hw_config->slots[0]; - devc->my_audiodev = hw_config->slots[0]; - - /* Set proper routings here (what are they) */ - AD1848_REROUTE(SOUND_MIXER_LINE1, SOUND_MIXER_LINE); - } - -#ifdef SSCAPE_DEBUG5 - /* - * Temporary debugging aid. Print contents of the registers - * after the AD1848 device has been initialized. - */ - { - int i; - - for (i = 0; i < 13; i++) - printk("I%d = %02x\n", i, sscape_read(devc, i)); - } -#endif - return 1; -} - -static void __exit unload_sscape(struct address_info *hw_config) -{ - release_region(devc->base + 2, 6); - unload_mpu401(hw_config); - if (sscape_is_pnp) - release_region(devc->codec, 2); -} - -static void __exit unload_ss_ms_sound(struct address_info *hw_config) -{ - ad1848_unload(hw_config->io_base, - hw_config->irq, - devc->dma, - devc->dma, - 0); - sound_unload_audiodev(hw_config->slots[0]); -} - -static struct address_info cfg; -static struct address_info cfg_mpu; - -static int __initdata spea = -1; -static int mss = 0; -static int __initdata dma = -1; -static int __initdata irq = -1; -static int __initdata io = -1; -static int __initdata mpu_irq = -1; -static int __initdata mpu_io = -1; - -module_param(dma, int, 0); -module_param(irq, int, 0); -module_param(io, int, 0); -module_param(spea, int, 0); /* spea=0/1 set the old_hardware */ -module_param(mpu_irq, int, 0); -module_param(mpu_io, int, 0); -module_param(mss, int, 0); - -static int __init init_sscape(void) -{ - printk(KERN_INFO "Soundscape driver Copyright (C) by Hannu Savolainen 1993-1996\n"); - - cfg.irq = irq; - cfg.dma = dma; - cfg.io_base = io; - - cfg_mpu.irq = mpu_irq; - cfg_mpu.io_base = mpu_io; - /* WEH - Try to get right dma channel */ - cfg_mpu.dma = dma; - - devc->codec = cfg.io_base; - devc->codec_irq = cfg.irq; - devc->codec_type = 0; - devc->ic_type = 0; - devc->raw_buf = NULL; - spin_lock_init(&devc->lock); - - if (cfg.dma == -1 || cfg.irq == -1 || cfg.io_base == -1) { - printk(KERN_ERR "DMA, IRQ, and IO port must be specified.\n"); - return -EINVAL; - } - - if (cfg_mpu.irq == -1 && cfg_mpu.io_base != -1) { - printk(KERN_ERR "MPU_IRQ must be specified if MPU_IO is set.\n"); - return -EINVAL; - } - - if(spea != -1) { - old_hardware = spea; - printk(KERN_INFO "Forcing %s hardware support.\n", - spea?"new":"old"); - } - if (probe_sscape(&cfg_mpu) == 0) - return -ENODEV; - - attach_sscape(&cfg_mpu); - - mss = init_ss_ms_sound(&cfg); - - return 0; -} - -static void __exit cleanup_sscape(void) -{ - if (mss) - unload_ss_ms_sound(&cfg); - unload_sscape(&cfg_mpu); -} - -module_init(init_sscape); -module_exit(cleanup_sscape); - -#ifndef MODULE -static int __init setup_sscape(char *str) -{ - /* io, irq, dma, mpu_io, mpu_irq */ - int ints[6]; - - str = get_options(str, ARRAY_SIZE(ints), ints); - - io = ints[1]; - irq = ints[2]; - dma = ints[3]; - mpu_io = ints[4]; - mpu_irq = ints[5]; - - return 1; -} - -__setup("sscape=", setup_sscape); -#endif -MODULE_LICENSE("GPL"); -- cgit v1.2.3 From 3c76b4d69bedde5b9e7e42612a7d2ede4ab7fd8d Mon Sep 17 00:00:00 2001 From: Krzysztof Helt Date: Sun, 25 Oct 2009 11:05:19 +0100 Subject: ALSA: es18xx: remove snd_card pointer from snd_es18xx structure The snd_card pointer is redundant and code can be easily changed to work without it. Signed-off-by: Krzysztof Helt Signed-off-by: Takashi Iwai --- sound/isa/es18xx.c | 75 ++++++++++++++++++++++++++++++++---------------------- 1 file changed, 44 insertions(+), 31 deletions(-) (limited to 'sound') diff --git a/sound/isa/es18xx.c b/sound/isa/es18xx.c index 8cfbff73a83..160752bc2e8 100644 --- a/sound/isa/es18xx.c +++ b/sound/isa/es18xx.c @@ -121,7 +121,6 @@ struct snd_es18xx { unsigned int dma1_shift; unsigned int dma2_shift; - struct snd_card *card; struct snd_pcm *pcm; struct snd_pcm_substream *playback_a_substream; struct snd_pcm_substream *capture_a_substream; @@ -755,7 +754,9 @@ static int snd_es18xx_playback_trigger(struct snd_pcm_substream *substream, static irqreturn_t snd_es18xx_interrupt(int irq, void *dev_id) { - struct snd_es18xx *chip = dev_id; + struct snd_card *card = dev_id; + struct snd_audiodrive *acard = card->private_data; + struct snd_es18xx *chip = acard->chip; unsigned char status; if (chip->caps & ES18XX_CONTROL) { @@ -805,12 +806,16 @@ static irqreturn_t snd_es18xx_interrupt(int irq, void *dev_id) int split = 0; if (chip->caps & ES18XX_HWV) { split = snd_es18xx_mixer_read(chip, 0x64) & 0x80; - snd_ctl_notify(chip->card, SNDRV_CTL_EVENT_MASK_VALUE, &chip->hw_switch->id); - snd_ctl_notify(chip->card, SNDRV_CTL_EVENT_MASK_VALUE, &chip->hw_volume->id); + snd_ctl_notify(card, SNDRV_CTL_EVENT_MASK_VALUE, + &chip->hw_switch->id); + snd_ctl_notify(card, SNDRV_CTL_EVENT_MASK_VALUE, + &chip->hw_volume->id); } if (!split) { - snd_ctl_notify(chip->card, SNDRV_CTL_EVENT_MASK_VALUE, &chip->master_switch->id); - snd_ctl_notify(chip->card, SNDRV_CTL_EVENT_MASK_VALUE, &chip->master_volume->id); + snd_ctl_notify(card, SNDRV_CTL_EVENT_MASK_VALUE, + &chip->master_switch->id); + snd_ctl_notify(card, SNDRV_CTL_EVENT_MASK_VALUE, + &chip->master_volume->id); } /* ack interrupt */ snd_es18xx_mixer_write(chip, 0x66, 0x00); @@ -1691,8 +1696,11 @@ static struct snd_pcm_ops snd_es18xx_capture_ops = { .pointer = snd_es18xx_capture_pointer, }; -static int __devinit snd_es18xx_pcm(struct snd_es18xx *chip, int device, struct snd_pcm ** rpcm) +static int __devinit snd_es18xx_pcm(struct snd_card *card, int device, + struct snd_pcm **rpcm) { + struct snd_audiodrive *acard = card->private_data; + struct snd_es18xx *chip = acard->chip; struct snd_pcm *pcm; char str[16]; int err; @@ -1701,9 +1709,9 @@ static int __devinit snd_es18xx_pcm(struct snd_es18xx *chip, int device, struct *rpcm = NULL; sprintf(str, "ES%x", chip->version); if (chip->caps & ES18XX_PCM2) - err = snd_pcm_new(chip->card, str, device, 2, 1, &pcm); + err = snd_pcm_new(card, str, device, 2, 1, &pcm); else - err = snd_pcm_new(chip->card, str, device, 1, 1, &pcm); + err = snd_pcm_new(card, str, device, 1, 1, &pcm); if (err < 0) return err; @@ -1737,7 +1745,7 @@ static int snd_es18xx_suspend(struct snd_card *card, pm_message_t state) struct snd_audiodrive *acard = card->private_data; struct snd_es18xx *chip = acard->chip; - snd_power_change_state(chip->card, SNDRV_CTL_POWER_D3hot); + snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); snd_pcm_suspend_all(chip->pcm); @@ -1758,18 +1766,21 @@ static int snd_es18xx_resume(struct snd_card *card) /* restore PM register, we won't wake till (not 0x07) i/o activity though */ snd_es18xx_write(chip, ES18XX_PM, chip->pm_reg ^= ES18XX_PM_FM); - snd_power_change_state(chip->card, SNDRV_CTL_POWER_D0); + snd_power_change_state(card, SNDRV_CTL_POWER_D0); return 0; } #endif /* CONFIG_PM */ -static int snd_es18xx_free(struct snd_es18xx *chip) +static int snd_es18xx_free(struct snd_card *card) { + struct snd_audiodrive *acard = card->private_data; + struct snd_es18xx *chip = acard->chip; + release_and_free_resource(chip->res_port); release_and_free_resource(chip->res_ctrl_port); release_and_free_resource(chip->res_mpu_port); if (chip->irq >= 0) - free_irq(chip->irq, (void *) chip); + free_irq(chip->irq, (void *) card); if (chip->dma1 >= 0) { disable_dma(chip->dma1); free_dma(chip->dma1); @@ -1784,8 +1795,7 @@ static int snd_es18xx_free(struct snd_es18xx *chip) static int snd_es18xx_dev_free(struct snd_device *device) { - struct snd_es18xx *chip = device->device_data; - return snd_es18xx_free(chip); + return snd_es18xx_free(device->card); } static int __devinit snd_es18xx_new_device(struct snd_card *card, @@ -1808,7 +1818,6 @@ static int __devinit snd_es18xx_new_device(struct snd_card *card, spin_lock_init(&chip->reg_lock); spin_lock_init(&chip->mixer_lock); spin_lock_init(&chip->ctrl_lock); - chip->card = card; chip->port = port; chip->mpu_port = mpu_port; chip->fm_port = fm_port; @@ -1818,53 +1827,55 @@ static int __devinit snd_es18xx_new_device(struct snd_card *card, chip->audio2_vol = 0x00; chip->active = 0; - if ((chip->res_port = request_region(port, 16, "ES18xx")) == NULL) { - snd_es18xx_free(chip); + chip->res_port = request_region(port, 16, "ES18xx"); + if (chip->res_port == NULL) { + snd_es18xx_free(card); snd_printk(KERN_ERR PFX "unable to grap ports 0x%lx-0x%lx\n", port, port + 16 - 1); return -EBUSY; } - if (request_irq(irq, snd_es18xx_interrupt, IRQF_DISABLED, "ES18xx", (void *) chip)) { - snd_es18xx_free(chip); + if (request_irq(irq, snd_es18xx_interrupt, IRQF_DISABLED, "ES18xx", + (void *) card)) { + snd_es18xx_free(card); snd_printk(KERN_ERR PFX "unable to grap IRQ %d\n", irq); return -EBUSY; } chip->irq = irq; if (request_dma(dma1, "ES18xx DMA 1")) { - snd_es18xx_free(chip); + snd_es18xx_free(card); snd_printk(KERN_ERR PFX "unable to grap DMA1 %d\n", dma1); return -EBUSY; } chip->dma1 = dma1; if (dma2 != dma1 && request_dma(dma2, "ES18xx DMA 2")) { - snd_es18xx_free(chip); + snd_es18xx_free(card); snd_printk(KERN_ERR PFX "unable to grap DMA2 %d\n", dma2); return -EBUSY; } chip->dma2 = dma2; if (snd_es18xx_probe(chip) < 0) { - snd_es18xx_free(chip); + snd_es18xx_free(card); return -ENODEV; } - if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops)) < 0) { - snd_es18xx_free(chip); + err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, NULL, &ops); + if (err < 0) { + snd_es18xx_free(card); return err; } *rchip = chip; return 0; } -static int __devinit snd_es18xx_mixer(struct snd_es18xx *chip) +static int __devinit snd_es18xx_mixer(struct snd_card *card) { - struct snd_card *card; + struct snd_audiodrive *acard = card->private_data; + struct snd_es18xx *chip = acard->chip; int err; unsigned int idx; - card = chip->card; - strcpy(card->mixername, chip->pcm->name); for (idx = 0; idx < ARRAY_SIZE(snd_es18xx_base_controls); idx++) { @@ -2161,10 +2172,12 @@ static int __devinit snd_audiodrive_probe(struct snd_card *card, int dev) chip->port, irq[dev], dma1[dev]); - if ((err = snd_es18xx_pcm(chip, 0, NULL)) < 0) + err = snd_es18xx_pcm(card, 0, NULL); + if (err < 0) return err; - if ((err = snd_es18xx_mixer(chip)) < 0) + err = snd_es18xx_mixer(card); + if (err < 0) return err; if (fm_port[dev] > 0 && fm_port[dev] != SNDRV_AUTO_PORT) { -- cgit v1.2.3 From b14f5de731ae657d498d18d713c6431bfbeefb4b Mon Sep 17 00:00:00 2001 From: Krzysztof Helt Date: Sun, 25 Oct 2009 11:10:01 +0100 Subject: ALSA: es18xx: remove snd_audiodrive structure Remove intermediate snd_audiodrive structure between snd_card structure and snd_es18xx. This reduces size of source code and binary driver. Signed-off-by: Krzysztof Helt Signed-off-by: Takashi Iwai --- sound/isa/es18xx.c | 71 +++++++++++++++++++----------------------------------- 1 file changed, 25 insertions(+), 46 deletions(-) (limited to 'sound') diff --git a/sound/isa/es18xx.c b/sound/isa/es18xx.c index 160752bc2e8..5cf42b4d65f 100644 --- a/sound/isa/es18xx.c +++ b/sound/isa/es18xx.c @@ -139,10 +139,6 @@ struct snd_es18xx { #ifdef CONFIG_PM unsigned char pm_reg; #endif -}; - -struct snd_audiodrive { - struct snd_es18xx *chip; #ifdef CONFIG_PNP struct pnp_dev *dev; struct pnp_dev *devc; @@ -755,8 +751,7 @@ static int snd_es18xx_playback_trigger(struct snd_pcm_substream *substream, static irqreturn_t snd_es18xx_interrupt(int irq, void *dev_id) { struct snd_card *card = dev_id; - struct snd_audiodrive *acard = card->private_data; - struct snd_es18xx *chip = acard->chip; + struct snd_es18xx *chip = card->private_data; unsigned char status; if (chip->caps & ES18XX_CONTROL) { @@ -1699,8 +1694,7 @@ static struct snd_pcm_ops snd_es18xx_capture_ops = { static int __devinit snd_es18xx_pcm(struct snd_card *card, int device, struct snd_pcm **rpcm) { - struct snd_audiodrive *acard = card->private_data; - struct snd_es18xx *chip = acard->chip; + struct snd_es18xx *chip = card->private_data; struct snd_pcm *pcm; char str[16]; int err; @@ -1742,8 +1736,7 @@ static int __devinit snd_es18xx_pcm(struct snd_card *card, int device, #ifdef CONFIG_PM static int snd_es18xx_suspend(struct snd_card *card, pm_message_t state) { - struct snd_audiodrive *acard = card->private_data; - struct snd_es18xx *chip = acard->chip; + struct snd_es18xx *chip = card->private_data; snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); @@ -1760,8 +1753,7 @@ static int snd_es18xx_suspend(struct snd_card *card, pm_message_t state) static int snd_es18xx_resume(struct snd_card *card) { - struct snd_audiodrive *acard = card->private_data; - struct snd_es18xx *chip = acard->chip; + struct snd_es18xx *chip = card->private_data; /* restore PM register, we won't wake till (not 0x07) i/o activity though */ snd_es18xx_write(chip, ES18XX_PM, chip->pm_reg ^= ES18XX_PM_FM); @@ -1773,8 +1765,7 @@ static int snd_es18xx_resume(struct snd_card *card) static int snd_es18xx_free(struct snd_card *card) { - struct snd_audiodrive *acard = card->private_data; - struct snd_es18xx *chip = acard->chip; + struct snd_es18xx *chip = card->private_data; release_and_free_resource(chip->res_port); release_and_free_resource(chip->res_ctrl_port); @@ -1789,7 +1780,6 @@ static int snd_es18xx_free(struct snd_card *card) disable_dma(chip->dma2); free_dma(chip->dma2); } - kfree(chip); return 0; } @@ -1802,19 +1792,14 @@ static int __devinit snd_es18xx_new_device(struct snd_card *card, unsigned long port, unsigned long mpu_port, unsigned long fm_port, - int irq, int dma1, int dma2, - struct snd_es18xx ** rchip) + int irq, int dma1, int dma2) { - struct snd_es18xx *chip; + struct snd_es18xx *chip = card->private_data; static struct snd_device_ops ops = { .dev_free = snd_es18xx_dev_free, }; int err; - *rchip = NULL; - chip = kzalloc(sizeof(*chip), GFP_KERNEL); - if (chip == NULL) - return -ENOMEM; spin_lock_init(&chip->reg_lock); spin_lock_init(&chip->mixer_lock); spin_lock_init(&chip->ctrl_lock); @@ -1865,14 +1850,12 @@ static int __devinit snd_es18xx_new_device(struct snd_card *card, snd_es18xx_free(card); return err; } - *rchip = chip; return 0; } static int __devinit snd_es18xx_mixer(struct snd_card *card) { - struct snd_audiodrive *acard = card->private_data; - struct snd_es18xx *chip = acard->chip; + struct snd_es18xx *chip = card->private_data; int err; unsigned int idx; @@ -2074,11 +2057,11 @@ static int __devinit snd_audiodrive_pnp_init_main(int dev, struct pnp_dev *pdev) return 0; } -static int __devinit snd_audiodrive_pnp(int dev, struct snd_audiodrive *acard, +static int __devinit snd_audiodrive_pnp(int dev, struct snd_es18xx *chip, struct pnp_dev *pdev) { - acard->dev = pdev; - if (snd_audiodrive_pnp_init_main(dev, acard->dev) < 0) + chip->dev = pdev; + if (snd_audiodrive_pnp_init_main(dev, chip->dev) < 0) return -EBUSY; return 0; } @@ -2104,26 +2087,26 @@ static struct pnp_card_device_id snd_audiodrive_pnpids[] = { MODULE_DEVICE_TABLE(pnp_card, snd_audiodrive_pnpids); -static int __devinit snd_audiodrive_pnpc(int dev, struct snd_audiodrive *acard, +static int __devinit snd_audiodrive_pnpc(int dev, struct snd_es18xx *chip, struct pnp_card_link *card, const struct pnp_card_device_id *id) { - acard->dev = pnp_request_card_device(card, id->devs[0].id, NULL); - if (acard->dev == NULL) + chip->dev = pnp_request_card_device(card, id->devs[0].id, NULL); + if (chip->dev == NULL) return -EBUSY; - acard->devc = pnp_request_card_device(card, id->devs[1].id, NULL); - if (acard->devc == NULL) + chip->devc = pnp_request_card_device(card, id->devs[1].id, NULL); + if (chip->devc == NULL) return -EBUSY; /* Control port initialization */ - if (pnp_activate_dev(acard->devc) < 0) { + if (pnp_activate_dev(chip->devc) < 0) { snd_printk(KERN_ERR PFX "PnP control configure failure (out of resources?)\n"); return -EAGAIN; } snd_printdd("pnp: port=0x%llx\n", - (unsigned long long)pnp_port_start(acard->devc, 0)); - if (snd_audiodrive_pnp_init_main(dev, acard->dev) < 0) + (unsigned long long)pnp_port_start(chip->devc, 0)); + if (snd_audiodrive_pnp_init_main(dev, chip->dev) < 0) return -EBUSY; return 0; @@ -2139,24 +2122,20 @@ static int __devinit snd_audiodrive_pnpc(int dev, struct snd_audiodrive *acard, static int snd_es18xx_card_new(int dev, struct snd_card **cardp) { return snd_card_create(index[dev], id[dev], THIS_MODULE, - sizeof(struct snd_audiodrive), cardp); + sizeof(struct snd_es18xx), cardp); } static int __devinit snd_audiodrive_probe(struct snd_card *card, int dev) { - struct snd_audiodrive *acard = card->private_data; - struct snd_es18xx *chip; + struct snd_es18xx *chip = card->private_data; struct snd_opl3 *opl3; int err; - if ((err = snd_es18xx_new_device(card, - port[dev], - mpu_port[dev], - fm_port[dev], - irq[dev], dma1[dev], dma2[dev], - &chip)) < 0) + err = snd_es18xx_new_device(card, + port[dev], mpu_port[dev], fm_port[dev], + irq[dev], dma1[dev], dma2[dev]); + if (err < 0) return err; - acard->chip = chip; sprintf(card->driver, "ES%x", chip->version); -- cgit v1.2.3 From bcc2c6b7cb320d10c7fcccd87dce87f4384b4332 Mon Sep 17 00:00:00 2001 From: Stas Sergeev Date: Sun, 1 Nov 2009 11:13:19 +0100 Subject: ALSA: snd-pcsp: add nopcm mode Currently, if the high-res timers are unavailable, snd-pcsp does not initialize. People who choose it over pcspkr, loose their console beeps in that case and get annoyed. With this patch, the console beeps remain regardless of the high-res timers. Additionally, the "nopcm" modparam is added to forcibly disable the PCM capabilities of the driver. Signed-off-by: Stas Sergeev Signed-off-by: Takashi Iwai --- sound/drivers/pcsp/pcsp.c | 32 ++++++++++++++++++++------------ sound/drivers/pcsp/pcsp.h | 2 +- sound/drivers/pcsp/pcsp_mixer.c | 33 ++++++++++++++++++++++++++------- 3 files changed, 47 insertions(+), 20 deletions(-) (limited to 'sound') diff --git a/sound/drivers/pcsp/pcsp.c b/sound/drivers/pcsp/pcsp.c index b60cef257b5..f165c77d627 100644 --- a/sound/drivers/pcsp/pcsp.c +++ b/sound/drivers/pcsp/pcsp.c @@ -26,6 +26,7 @@ MODULE_ALIAS("platform:pcspkr"); static int index = SNDRV_DEFAULT_IDX1; /* Index 0-MAX */ static char *id = SNDRV_DEFAULT_STR1; /* ID for this card */ static int enable = SNDRV_DEFAULT_ENABLE1; /* Enable this card */ +static int nopcm; /* Disable PCM capability of the driver */ module_param(index, int, 0444); MODULE_PARM_DESC(index, "Index value for pcsp soundcard."); @@ -33,6 +34,8 @@ module_param(id, charp, 0444); MODULE_PARM_DESC(id, "ID string for pcsp soundcard."); module_param(enable, bool, 0444); MODULE_PARM_DESC(enable, "Enable PC-Speaker sound."); +module_param(nopcm, bool, 0444); +MODULE_PARM_DESC(nopcm, "Disable PC-Speaker PCM sound. Only beeps remain."); struct snd_pcsp pcsp_chip; @@ -43,13 +46,16 @@ static int __devinit snd_pcsp_create(struct snd_card *card) int err; int div, min_div, order; - hrtimer_get_res(CLOCK_MONOTONIC, &tp); - if (tp.tv_sec || tp.tv_nsec > PCSP_MAX_PERIOD_NS) { - printk(KERN_ERR "PCSP: Timer resolution is not sufficient " - "(%linS)\n", tp.tv_nsec); - printk(KERN_ERR "PCSP: Make sure you have HPET and ACPI " - "enabled.\n"); - return -EIO; + if (!nopcm) { + hrtimer_get_res(CLOCK_MONOTONIC, &tp); + if (tp.tv_sec || tp.tv_nsec > PCSP_MAX_PERIOD_NS) { + printk(KERN_ERR "PCSP: Timer resolution is not sufficient " + "(%linS)\n", tp.tv_nsec); + printk(KERN_ERR "PCSP: Make sure you have HPET and ACPI " + "enabled.\n"); + printk(KERN_ERR "PCSP: Turned into nopcm mode.\n"); + nopcm = 1; + } } if (loops_per_jiffy >= PCSP_MIN_LPJ && tp.tv_nsec <= PCSP_MIN_PERIOD_NS) @@ -107,12 +113,14 @@ static int __devinit snd_card_pcsp_probe(int devnum, struct device *dev) snd_card_free(card); return err; } - err = snd_pcsp_new_pcm(&pcsp_chip); - if (err < 0) { - snd_card_free(card); - return err; + if (!nopcm) { + err = snd_pcsp_new_pcm(&pcsp_chip); + if (err < 0) { + snd_card_free(card); + return err; + } } - err = snd_pcsp_new_mixer(&pcsp_chip); + err = snd_pcsp_new_mixer(&pcsp_chip, nopcm); if (err < 0) { snd_card_free(card); return err; diff --git a/sound/drivers/pcsp/pcsp.h b/sound/drivers/pcsp/pcsp.h index 174dd2ff0f2..1e123077923 100644 --- a/sound/drivers/pcsp/pcsp.h +++ b/sound/drivers/pcsp/pcsp.h @@ -83,6 +83,6 @@ extern enum hrtimer_restart pcsp_do_timer(struct hrtimer *handle); extern void pcsp_sync_stop(struct snd_pcsp *chip); extern int snd_pcsp_new_pcm(struct snd_pcsp *chip); -extern int snd_pcsp_new_mixer(struct snd_pcsp *chip); +extern int snd_pcsp_new_mixer(struct snd_pcsp *chip, int nopcm); #endif diff --git a/sound/drivers/pcsp/pcsp_mixer.c b/sound/drivers/pcsp/pcsp_mixer.c index 903bc846763..02e05552632 100644 --- a/sound/drivers/pcsp/pcsp_mixer.c +++ b/sound/drivers/pcsp/pcsp_mixer.c @@ -119,24 +119,43 @@ static int pcsp_pcspkr_put(struct snd_kcontrol *kcontrol, .put = pcsp_##ctl_type##_put, \ } -static struct snd_kcontrol_new __devinitdata snd_pcsp_controls[] = { +static struct snd_kcontrol_new __devinitdata snd_pcsp_controls_pcm[] = { PCSP_MIXER_CONTROL(enable, "Master Playback Switch"), PCSP_MIXER_CONTROL(treble, "BaseFRQ Playback Volume"), +}; + +static struct snd_kcontrol_new __devinitdata snd_pcsp_controls_spkr[] = { PCSP_MIXER_CONTROL(pcspkr, "PC Speaker Playback Switch"), }; -int __devinit snd_pcsp_new_mixer(struct snd_pcsp *chip) +static int __devinit snd_pcsp_ctls_add(struct snd_pcsp *chip, + struct snd_kcontrol_new *ctls, int num) { - struct snd_card *card = chip->card; int i, err; + struct snd_card *card = chip->card; + for (i = 0; i < num; i++) { + err = snd_ctl_add(card, snd_ctl_new1(ctls + i, chip)); + if (err < 0) + return err; + } + return 0; +} + +int __devinit snd_pcsp_new_mixer(struct snd_pcsp *chip, int nopcm) +{ + int err; + struct snd_card *card = chip->card; - for (i = 0; i < ARRAY_SIZE(snd_pcsp_controls); i++) { - err = snd_ctl_add(card, - snd_ctl_new1(snd_pcsp_controls + i, - chip)); + if (!nopcm) { + err = snd_pcsp_ctls_add(chip, snd_pcsp_controls_pcm, + ARRAY_SIZE(snd_pcsp_controls_pcm)); if (err < 0) return err; } + err = snd_pcsp_ctls_add(chip, snd_pcsp_controls_spkr, + ARRAY_SIZE(snd_pcsp_controls_spkr)); + if (err < 0) + return err; strcpy(card->mixername, "PC-Speaker"); -- cgit v1.2.3 From 9dcaa7b25f2c8f6a0485854cd3641f585a154072 Mon Sep 17 00:00:00 2001 From: Rafael Ignacio Zurita Date: Tue, 3 Nov 2009 17:16:27 -0300 Subject: ALSA: sh: add SuperH DAC audio driver for ALSA V4 This is a port of the sound/oss/sh_dac_audio.c driver. The driver uses an on-chip 8-bit D/A converter, which has a speaker connected to one of its channels, found in several ancient HP machines. For interrupts it uses a high-resolution timer (hrtimer). Tested on SH7709 based hp6xx (HP Jornada 680/690 and HP Palmtop 620lx/660lx). Also, since OSS Emulation works, the old OSS sound/oss/sh_dac_audio.c driver would be obsolete soon, and it could be removed. Signed-off-by: Rafael Ignacio Zurita Acked-by: Paul Mundt Signed-off-by: Takashi Iwai --- sound/sh/Kconfig | 8 + sound/sh/Makefile | 2 + sound/sh/sh_dac_audio.c | 453 ++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 463 insertions(+) create mode 100644 sound/sh/sh_dac_audio.c (limited to 'sound') diff --git a/sound/sh/Kconfig b/sound/sh/Kconfig index aed0f90c391..61139f3c161 100644 --- a/sound/sh/Kconfig +++ b/sound/sh/Kconfig @@ -19,5 +19,13 @@ config SND_AICA help ALSA Sound driver for the SEGA Dreamcast console. +config SND_SH_DAC_AUDIO + tristate "SuperH DAC audio support" + depends on SND + depends on CPU_SH3 && HIGH_RES_TIMERS + select SND_PCM + help + Say Y here to include support for the on-chip DAC. + endif # SND_SUPERH diff --git a/sound/sh/Makefile b/sound/sh/Makefile index 8fdcb6e26f0..7d09b5188cf 100644 --- a/sound/sh/Makefile +++ b/sound/sh/Makefile @@ -3,6 +3,8 @@ # snd-aica-objs := aica.o +snd-sh_dac_audio-objs := sh_dac_audio.o # Toplevel Module Dependency obj-$(CONFIG_SND_AICA) += snd-aica.o +obj-$(CONFIG_SND_SH_DAC_AUDIO) += snd-sh_dac_audio.o diff --git a/sound/sh/sh_dac_audio.c b/sound/sh/sh_dac_audio.c new file mode 100644 index 00000000000..76d9ad27d91 --- /dev/null +++ b/sound/sh/sh_dac_audio.c @@ -0,0 +1,453 @@ +/* + * sh_dac_audio.c - SuperH DAC audio driver for ALSA + * + * Copyright (c) 2009 by Rafael Ignacio Zurita + * + * + * Based on sh_dac_audio.c (Copyright (C) 2004, 2005 by Andriy Skulysh) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +MODULE_AUTHOR("Rafael Ignacio Zurita "); +MODULE_DESCRIPTION("SuperH DAC audio driver"); +MODULE_LICENSE("GPL"); +MODULE_SUPPORTED_DEVICE("{{SuperH DAC audio support}}"); + +/* Module Parameters */ +static int index = SNDRV_DEFAULT_IDX1; +static char *id = SNDRV_DEFAULT_STR1; +module_param(index, int, 0444); +MODULE_PARM_DESC(index, "Index value for SuperH DAC audio."); +module_param(id, charp, 0444); +MODULE_PARM_DESC(id, "ID string for SuperH DAC audio."); + +/* main struct */ +struct snd_sh_dac { + struct snd_card *card; + struct snd_pcm_substream *substream; + struct hrtimer hrtimer; + ktime_t wakeups_per_second; + + int rate; + int empty; + char *data_buffer, *buffer_begin, *buffer_end; + int processed; /* bytes proccesed, to compare with period_size */ + int buffer_size; + struct dac_audio_pdata *pdata; +}; + + +static void dac_audio_start_timer(struct snd_sh_dac *chip) +{ + hrtimer_start(&chip->hrtimer, chip->wakeups_per_second, + HRTIMER_MODE_REL); +} + +static void dac_audio_stop_timer(struct snd_sh_dac *chip) +{ + hrtimer_cancel(&chip->hrtimer); +} + +static void dac_audio_reset(struct snd_sh_dac *chip) +{ + dac_audio_stop_timer(chip); + chip->buffer_begin = chip->buffer_end = chip->data_buffer; + chip->processed = 0; + chip->empty = 1; +} + +static void dac_audio_set_rate(struct snd_sh_dac *chip) +{ + chip->wakeups_per_second = ktime_set(0, 1000000000 / chip->rate); +} + + +/* PCM INTERFACE */ + +static struct snd_pcm_hardware snd_sh_dac_pcm_hw = { + .info = (SNDRV_PCM_INFO_MMAP | + SNDRV_PCM_INFO_MMAP_VALID | + SNDRV_PCM_INFO_INTERLEAVED | + SNDRV_PCM_INFO_HALF_DUPLEX), + .formats = SNDRV_PCM_FMTBIT_U8, + .rates = SNDRV_PCM_RATE_8000, + .rate_min = 8000, + .rate_max = 8000, + .channels_min = 1, + .channels_max = 1, + .buffer_bytes_max = (48*1024), + .period_bytes_min = 1, + .period_bytes_max = (48*1024), + .periods_min = 1, + .periods_max = 1024, +}; + +static int snd_sh_dac_pcm_open(struct snd_pcm_substream *substream) +{ + struct snd_sh_dac *chip = snd_pcm_substream_chip(substream); + struct snd_pcm_runtime *runtime = substream->runtime; + + runtime->hw = snd_sh_dac_pcm_hw; + + chip->substream = substream; + chip->buffer_begin = chip->buffer_end = chip->data_buffer; + chip->processed = 0; + chip->empty = 1; + + chip->pdata->start(chip->pdata); + + return 0; +} + +static int snd_sh_dac_pcm_close(struct snd_pcm_substream *substream) +{ + struct snd_sh_dac *chip = snd_pcm_substream_chip(substream); + + chip->substream = NULL; + + dac_audio_stop_timer(chip); + chip->pdata->stop(chip->pdata); + + return 0; +} + +static int snd_sh_dac_pcm_hw_params(struct snd_pcm_substream *substream, + struct snd_pcm_hw_params *hw_params) +{ + return snd_pcm_lib_malloc_pages(substream, + params_buffer_bytes(hw_params)); +} + +static int snd_sh_dac_pcm_hw_free(struct snd_pcm_substream *substream) +{ + return snd_pcm_lib_free_pages(substream); +} + +static int snd_sh_dac_pcm_prepare(struct snd_pcm_substream *substream) +{ + struct snd_sh_dac *chip = snd_pcm_substream_chip(substream); + struct snd_pcm_runtime *runtime = chip->substream->runtime; + + chip->buffer_size = runtime->buffer_size; + memset(chip->data_buffer, 0, chip->pdata->buffer_size); + + return 0; +} + +static int snd_sh_dac_pcm_trigger(struct snd_pcm_substream *substream, int cmd) +{ + struct snd_sh_dac *chip = snd_pcm_substream_chip(substream); + + switch (cmd) { + case SNDRV_PCM_TRIGGER_START: + dac_audio_start_timer(chip); + break; + case SNDRV_PCM_TRIGGER_STOP: + chip->buffer_begin = chip->buffer_end = chip->data_buffer; + chip->processed = 0; + chip->empty = 1; + dac_audio_stop_timer(chip); + break; + default: + return -EINVAL; + } + + return 0; +} + +static int snd_sh_dac_pcm_copy(struct snd_pcm_substream *substream, int channel, + snd_pcm_uframes_t pos, void __user *src, snd_pcm_uframes_t count) +{ + /* channel is not used (interleaved data) */ + struct snd_sh_dac *chip = snd_pcm_substream_chip(substream); + struct snd_pcm_runtime *runtime = substream->runtime; + ssize_t b_count = frames_to_bytes(runtime , count); + ssize_t b_pos = frames_to_bytes(runtime , pos); + + if (count < 0) + return -EINVAL; + + if (!count) + return 0; + + memcpy_toio(chip->data_buffer + b_pos, src, b_count); + chip->buffer_end = chip->data_buffer + b_pos + b_count; + + if (chip->empty) { + chip->empty = 0; + dac_audio_start_timer(chip); + } + + return 0; +} + +static int snd_sh_dac_pcm_silence(struct snd_pcm_substream *substream, + int channel, snd_pcm_uframes_t pos, + snd_pcm_uframes_t count) +{ + /* channel is not used (interleaved data) */ + struct snd_sh_dac *chip = snd_pcm_substream_chip(substream); + struct snd_pcm_runtime *runtime = substream->runtime; + ssize_t b_count = frames_to_bytes(runtime , count); + ssize_t b_pos = frames_to_bytes(runtime , pos); + + if (count < 0) + return -EINVAL; + + if (!count) + return 0; + + memset_io(chip->data_buffer + b_pos, 0, b_count); + chip->buffer_end = chip->data_buffer + b_pos + b_count; + + if (chip->empty) { + chip->empty = 0; + dac_audio_start_timer(chip); + } + + return 0; +} + +static +snd_pcm_uframes_t snd_sh_dac_pcm_pointer(struct snd_pcm_substream *substream) +{ + struct snd_sh_dac *chip = snd_pcm_substream_chip(substream); + int pointer = chip->buffer_begin - chip->data_buffer; + + return pointer; +} + +/* pcm ops */ +static struct snd_pcm_ops snd_sh_dac_pcm_ops = { + .open = snd_sh_dac_pcm_open, + .close = snd_sh_dac_pcm_close, + .ioctl = snd_pcm_lib_ioctl, + .hw_params = snd_sh_dac_pcm_hw_params, + .hw_free = snd_sh_dac_pcm_hw_free, + .prepare = snd_sh_dac_pcm_prepare, + .trigger = snd_sh_dac_pcm_trigger, + .pointer = snd_sh_dac_pcm_pointer, + .copy = snd_sh_dac_pcm_copy, + .silence = snd_sh_dac_pcm_silence, + .mmap = snd_pcm_lib_mmap_iomem, +}; + +static int __devinit snd_sh_dac_pcm(struct snd_sh_dac *chip, int device) +{ + int err; + struct snd_pcm *pcm; + + /* device should be always 0 for us */ + err = snd_pcm_new(chip->card, "SH_DAC PCM", device, 1, 0, &pcm); + if (err < 0) + return err; + + pcm->private_data = chip; + strcpy(pcm->name, "SH_DAC PCM"); + snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_sh_dac_pcm_ops); + + /* buffer size=48K */ + snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_CONTINUOUS, + snd_dma_continuous_data(GFP_KERNEL), + 48 * 1024, + 48 * 1024); + + return 0; +} +/* END OF PCM INTERFACE */ + + +/* driver .remove -- destructor */ +static int snd_sh_dac_remove(struct platform_device *devptr) +{ + snd_card_free(platform_get_drvdata(devptr)); + platform_set_drvdata(devptr, NULL); + + return 0; +} + +/* free -- it has been defined by create */ +static int snd_sh_dac_free(struct snd_sh_dac *chip) +{ + /* release the data */ + kfree(chip->data_buffer); + kfree(chip); + + return 0; +} + +static int snd_sh_dac_dev_free(struct snd_device *device) +{ + struct snd_sh_dac *chip = device->device_data; + + return snd_sh_dac_free(chip); +} + +static enum hrtimer_restart sh_dac_audio_timer(struct hrtimer *handle) +{ + struct snd_sh_dac *chip = container_of(handle, struct snd_sh_dac, + hrtimer); + struct snd_pcm_runtime *runtime = chip->substream->runtime; + ssize_t b_ps = frames_to_bytes(runtime, runtime->period_size); + + if (!chip->empty) { + sh_dac_output(*chip->buffer_begin, chip->pdata->channel); + chip->buffer_begin++; + + chip->processed++; + if (chip->processed >= b_ps) { + chip->processed -= b_ps; + snd_pcm_period_elapsed(chip->substream); + } + + if (chip->buffer_begin == (chip->data_buffer + + chip->buffer_size - 1)) + chip->buffer_begin = chip->data_buffer; + + if (chip->buffer_begin == chip->buffer_end) + chip->empty = 1; + + } + + if (!chip->empty) + hrtimer_start(&chip->hrtimer, chip->wakeups_per_second, + HRTIMER_MODE_REL); + + return HRTIMER_NORESTART; +} + +/* create -- chip-specific constructor for the cards components */ +static int __devinit snd_sh_dac_create(struct snd_card *card, + struct platform_device *devptr, + struct snd_sh_dac **rchip) +{ + struct snd_sh_dac *chip; + int err; + + static struct snd_device_ops ops = { + .dev_free = snd_sh_dac_dev_free, + }; + + *rchip = NULL; + + chip = kzalloc(sizeof(*chip), GFP_KERNEL); + if (chip == NULL) + return -ENOMEM; + + chip->card = card; + + hrtimer_init(&chip->hrtimer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); + chip->hrtimer.function = sh_dac_audio_timer; + + dac_audio_reset(chip); + chip->rate = 8000; + dac_audio_set_rate(chip); + + chip->pdata = devptr->dev.platform_data; + + chip->data_buffer = kmalloc(chip->pdata->buffer_size, GFP_KERNEL); + if (chip->data_buffer == NULL) { + kfree(chip); + return -ENOMEM; + } + + err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops); + if (err < 0) { + snd_sh_dac_free(chip); + return err; + } + + *rchip = chip; + + return 0; +} + +/* driver .probe -- constructor */ +static int __devinit snd_sh_dac_probe(struct platform_device *devptr) +{ + struct snd_sh_dac *chip; + struct snd_card *card; + int err; + + err = snd_card_create(index, id, THIS_MODULE, 0, &card); + if (err < 0) { + snd_printk(KERN_ERR "cannot allocate the card\n"); + return err; + } + + err = snd_sh_dac_create(card, devptr, &chip); + if (err < 0) + goto probe_error; + + err = snd_sh_dac_pcm(chip, 0); + if (err < 0) + goto probe_error; + + strcpy(card->driver, "snd_sh_dac"); + strcpy(card->shortname, "SuperH DAC audio driver"); + printk(KERN_INFO "%s %s", card->longname, card->shortname); + + err = snd_card_register(card); + if (err < 0) + goto probe_error; + + snd_printk("ALSA driver for SuperH DAC audio"); + + platform_set_drvdata(devptr, card); + return 0; + +probe_error: + snd_card_free(card); + return err; +} + +/* + * "driver" definition + */ +static struct platform_driver driver = { + .probe = snd_sh_dac_probe, + .remove = snd_sh_dac_remove, + .driver = { + .name = "dac_audio", + }, +}; + +static int __init sh_dac_init(void) +{ + return platform_driver_register(&driver); +} + +static void __exit sh_dac_exit(void) +{ + platform_driver_unregister(&driver); +} + +module_init(sh_dac_init); +module_exit(sh_dac_exit); -- cgit v1.2.3 From d355c82a0191d5a3e971bd5af96cc81fe3ed25b9 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Tue, 3 Nov 2009 15:47:25 +0100 Subject: ALSA: rename "PC Speaker" and "PC Beep" controls to "Beep" To avoid confusion in control names for the standard analog PC Beep generator using a small Internal PC Speaker, rename all related "PC Speaker" and "PC Beep" controls to "Beep" only. This name is more universal and can be also used on more platforms without confusion. Introduce also "Internal Speaker" in ControlNames.txt for systems with full-featured build-in internal speaker. Signed-off-by: Jaroslav Kysela Signed-off-by: Takashi Iwai --- sound/core/oss/mixer_oss.c | 3 ++- sound/drivers/pcsp/pcsp_mixer.c | 2 +- sound/isa/cmi8330.c | 4 ++-- sound/isa/es1688/es1688_lib.c | 2 +- sound/isa/es18xx.c | 2 +- sound/isa/sb/sb_mixer.c | 4 ++-- sound/pci/ac97/ac97_codec.c | 6 +++--- sound/pci/ac97/ac97_patch.c | 12 ++++++------ sound/pci/azt3328.c | 4 ++-- sound/pci/ca0106/ca0106_mixer.c | 4 ++-- sound/pci/cmipci.c | 4 ++-- sound/pci/emu10k1/emumixer.c | 4 ++-- sound/pci/es1938.c | 2 +- sound/pci/hda/patch_cmedia.c | 4 ++-- sound/pci/hda/patch_realtek.c | 4 ++-- sound/pci/hda/patch_sigmatel.c | 6 +++--- sound/soc/codecs/wm9713.c | 22 +++++++++++----------- 17 files changed, 45 insertions(+), 44 deletions(-) (limited to 'sound') diff --git a/sound/core/oss/mixer_oss.c b/sound/core/oss/mixer_oss.c index 772423889eb..b935ac9dce8 100644 --- a/sound/core/oss/mixer_oss.c +++ b/sound/core/oss/mixer_oss.c @@ -1251,7 +1251,8 @@ static void snd_mixer_oss_build(struct snd_mixer_oss *mixer) { SOUND_MIXER_SYNTH, "FM", 0 }, /* fallback */ { SOUND_MIXER_SYNTH, "Music", 0 }, /* fallback */ { SOUND_MIXER_PCM, "PCM", 0 }, - { SOUND_MIXER_SPEAKER, "PC Speaker", 0 }, + { SOUND_MIXER_SPEAKER, "Beep", 0 }, + { SOUND_MIXER_SPEAKER, "PC Speaker", 0 }, /* fallback */ { SOUND_MIXER_LINE, "Line", 0 }, { SOUND_MIXER_MIC, "Mic", 0 }, { SOUND_MIXER_CD, "CD", 0 }, diff --git a/sound/drivers/pcsp/pcsp_mixer.c b/sound/drivers/pcsp/pcsp_mixer.c index 02e05552632..6f633f4f3b9 100644 --- a/sound/drivers/pcsp/pcsp_mixer.c +++ b/sound/drivers/pcsp/pcsp_mixer.c @@ -125,7 +125,7 @@ static struct snd_kcontrol_new __devinitdata snd_pcsp_controls_pcm[] = { }; static struct snd_kcontrol_new __devinitdata snd_pcsp_controls_spkr[] = { - PCSP_MIXER_CONTROL(pcspkr, "PC Speaker Playback Switch"), + PCSP_MIXER_CONTROL(pcspkr, "Beep Playback Switch"), }; static int __devinit snd_pcsp_ctls_add(struct snd_pcsp *chip, diff --git a/sound/isa/cmi8330.c b/sound/isa/cmi8330.c index 02f79d25271..8246aae32ab 100644 --- a/sound/isa/cmi8330.c +++ b/sound/isa/cmi8330.c @@ -237,7 +237,7 @@ WSS_DOUBLE("Wavetable Capture Volume", 0, CMI8330_WAVGAIN, CMI8330_WAVGAIN, 4, 0, 15, 0), WSS_SINGLE("3D Control - Switch", 0, CMI8330_RMUX3D, 5, 1, 1), -WSS_SINGLE("PC Speaker Playback Volume", 0, +WSS_SINGLE("Beep Playback Volume", 0, CMI8330_OUTPUTVOL, 3, 3, 0), WSS_DOUBLE("FM Playback Switch", 0, CS4231_AUX2_LEFT_INPUT, CS4231_AUX2_RIGHT_INPUT, 7, 7, 1, 1), @@ -262,7 +262,7 @@ SB_DOUBLE("SB Line Playback Switch", SB_DSP4_OUTPUT_SW, SB_DSP4_OUTPUT_SW, 4, 3, SB_DOUBLE("SB Line Playback Volume", SB_DSP4_LINE_DEV, (SB_DSP4_LINE_DEV + 1), 3, 3, 31), SB_SINGLE("SB Mic Playback Switch", SB_DSP4_OUTPUT_SW, 0, 1), SB_SINGLE("SB Mic Playback Volume", SB_DSP4_MIC_DEV, 3, 31), -SB_SINGLE("SB PC Speaker Volume", SB_DSP4_SPEAKER_DEV, 6, 3), +SB_SINGLE("SB Beep Volume", SB_DSP4_SPEAKER_DEV, 6, 3), SB_DOUBLE("SB Capture Volume", SB_DSP4_IGAIN_DEV, (SB_DSP4_IGAIN_DEV + 1), 6, 6, 3), SB_DOUBLE("SB Playback Volume", SB_DSP4_OGAIN_DEV, (SB_DSP4_OGAIN_DEV + 1), 6, 6, 3), SB_SINGLE("SB Mic Auto Gain", SB_DSP4_MIC_AGC, 0, 1), diff --git a/sound/isa/es1688/es1688_lib.c b/sound/isa/es1688/es1688_lib.c index 4c6e14f87f2..c76bb00c9d1 100644 --- a/sound/isa/es1688/es1688_lib.c +++ b/sound/isa/es1688/es1688_lib.c @@ -982,7 +982,7 @@ ES1688_DOUBLE("CD Playback Volume", 0, ES1688_CD_DEV, ES1688_CD_DEV, 4, 0, 15, 0 ES1688_DOUBLE("FM Playback Volume", 0, ES1688_FM_DEV, ES1688_FM_DEV, 4, 0, 15, 0), ES1688_DOUBLE("Mic Playback Volume", 0, ES1688_MIC_DEV, ES1688_MIC_DEV, 4, 0, 15, 0), ES1688_DOUBLE("Aux Playback Volume", 0, ES1688_AUX_DEV, ES1688_AUX_DEV, 4, 0, 15, 0), -ES1688_SINGLE("PC Speaker Playback Volume", 0, ES1688_SPEAKER_DEV, 0, 7, 0), +ES1688_SINGLE("Beep Playback Volume", 0, ES1688_SPEAKER_DEV, 0, 7, 0), ES1688_DOUBLE("Capture Volume", 0, ES1688_RECLEV_DEV, ES1688_RECLEV_DEV, 4, 0, 15, 0), ES1688_SINGLE("Capture Switch", 0, ES1688_REC_DEV, 4, 1, 1), { diff --git a/sound/isa/es18xx.c b/sound/isa/es18xx.c index 5cf42b4d65f..e5bf3355d2c 100644 --- a/sound/isa/es18xx.c +++ b/sound/isa/es18xx.c @@ -1313,7 +1313,7 @@ ES18XX_DOUBLE("Aux Capture Volume", 0, 0x6c, 0x6c, 4, 0, 15, 0) * The chipset specific mixer controls */ static struct snd_kcontrol_new snd_es18xx_opt_speaker = - ES18XX_SINGLE("PC Speaker Playback Volume", 0, 0x3c, 0, 7, 0); + ES18XX_SINGLE("Beep Playback Volume", 0, 0x3c, 0, 7, 0); static struct snd_kcontrol_new snd_es18xx_opt_1869[] = { ES18XX_SINGLE("Capture Switch", 0, 0x1c, 4, 1, 1), diff --git a/sound/isa/sb/sb_mixer.c b/sound/isa/sb/sb_mixer.c index 475220bbcc9..318ff0c823e 100644 --- a/sound/isa/sb/sb_mixer.c +++ b/sound/isa/sb/sb_mixer.c @@ -631,7 +631,7 @@ static struct sbmix_elem snd_sb16_ctl_mic_play_switch = static struct sbmix_elem snd_sb16_ctl_mic_play_vol = SB_SINGLE("Mic Playback Volume", SB_DSP4_MIC_DEV, 3, 31); static struct sbmix_elem snd_sb16_ctl_pc_speaker_vol = - SB_SINGLE("PC Speaker Volume", SB_DSP4_SPEAKER_DEV, 6, 3); + SB_SINGLE("Beep Volume", SB_DSP4_SPEAKER_DEV, 6, 3); static struct sbmix_elem snd_sb16_ctl_capture_vol = SB_DOUBLE("Capture Volume", SB_DSP4_IGAIN_DEV, (SB_DSP4_IGAIN_DEV + 1), 6, 6, 3); static struct sbmix_elem snd_sb16_ctl_play_vol = @@ -689,7 +689,7 @@ static struct sbmix_elem snd_dt019x_ctl_cd_play_vol = static struct sbmix_elem snd_dt019x_ctl_mic_play_vol = SB_SINGLE("Mic Playback Volume", SB_DT019X_MIC_DEV, 4, 7); static struct sbmix_elem snd_dt019x_ctl_pc_speaker_vol = - SB_SINGLE("PC Speaker Volume", SB_DT019X_SPKR_DEV, 0, 7); + SB_SINGLE("Beep Volume", SB_DT019X_SPKR_DEV, 0, 7); static struct sbmix_elem snd_dt019x_ctl_line_play_vol = SB_DOUBLE("Line Playback Volume", SB_DT019X_LINE_DEV, SB_DT019X_LINE_DEV, 4,0, 15); static struct sbmix_elem snd_dt019x_ctl_pcm_play_switch = diff --git a/sound/pci/ac97/ac97_codec.c b/sound/pci/ac97/ac97_codec.c index 78288dbfc17..20cb60afb20 100644 --- a/sound/pci/ac97/ac97_codec.c +++ b/sound/pci/ac97/ac97_codec.c @@ -603,8 +603,8 @@ AC97_SINGLE("Tone Control - Treble", AC97_MASTER_TONE, 0, 15, 1) }; static const struct snd_kcontrol_new snd_ac97_controls_pc_beep[2] = { -AC97_SINGLE("PC Speaker Playback Switch", AC97_PC_BEEP, 15, 1, 1), -AC97_SINGLE("PC Speaker Playback Volume", AC97_PC_BEEP, 1, 15, 1) +AC97_SINGLE("Beep Playback Switch", AC97_PC_BEEP, 15, 1, 1), +AC97_SINGLE("Beep Playback Volume", AC97_PC_BEEP, 1, 15, 1) }; static const struct snd_kcontrol_new snd_ac97_controls_mic_boost = @@ -1393,7 +1393,7 @@ static int snd_ac97_mixer_build(struct snd_ac97 * ac97) } } - /* build PC Speaker controls */ + /* build Beep controls */ if (!(ac97->flags & AC97_HAS_NO_PC_BEEP) && ((ac97->flags & AC97_HAS_PC_BEEP) || snd_ac97_try_volume_mix(ac97, AC97_PC_BEEP))) { diff --git a/sound/pci/ac97/ac97_patch.c b/sound/pci/ac97/ac97_patch.c index 7337abdbe4e..139cf3b2b9d 100644 --- a/sound/pci/ac97/ac97_patch.c +++ b/sound/pci/ac97/ac97_patch.c @@ -800,12 +800,12 @@ AC97_SINGLE("Mono Switch", AC97_MASTER_TONE, 7, 1, 1), AC97_SINGLE("Mono ZC Switch", AC97_MASTER_TONE, 6, 1, 0), AC97_SINGLE("Mono Volume", AC97_MASTER_TONE, 0, 31, 1), -AC97_SINGLE("PC Beep to Headphone Switch", AC97_AUX, 15, 1, 1), -AC97_SINGLE("PC Beep to Headphone Volume", AC97_AUX, 12, 7, 1), -AC97_SINGLE("PC Beep to Master Switch", AC97_AUX, 11, 1, 1), -AC97_SINGLE("PC Beep to Master Volume", AC97_AUX, 8, 7, 1), -AC97_SINGLE("PC Beep to Mono Switch", AC97_AUX, 7, 1, 1), -AC97_SINGLE("PC Beep to Mono Volume", AC97_AUX, 4, 7, 1), +AC97_SINGLE("Beep to Headphone Switch", AC97_AUX, 15, 1, 1), +AC97_SINGLE("Beep to Headphone Volume", AC97_AUX, 12, 7, 1), +AC97_SINGLE("Beep to Master Switch", AC97_AUX, 11, 1, 1), +AC97_SINGLE("Beep to Master Volume", AC97_AUX, 8, 7, 1), +AC97_SINGLE("Beep to Mono Switch", AC97_AUX, 7, 1, 1), +AC97_SINGLE("Beep to Mono Volume", AC97_AUX, 4, 7, 1), AC97_SINGLE("Voice to Headphone Switch", AC97_PCM, 15, 1, 1), AC97_SINGLE("Voice to Headphone Volume", AC97_PCM, 12, 7, 1), diff --git a/sound/pci/azt3328.c b/sound/pci/azt3328.c index 8451a0169f3..69867ace786 100644 --- a/sound/pci/azt3328.c +++ b/sound/pci/azt3328.c @@ -830,8 +830,8 @@ static struct snd_kcontrol_new snd_azf3328_mixer_controls[] __devinitdata = { AZF3328_MIXER_SWITCH("Mic Boost (+20dB)", IDX_MIXER_MIC, 6, 0), AZF3328_MIXER_SWITCH("Line Playback Switch", IDX_MIXER_LINEIN, 15, 1), AZF3328_MIXER_VOL_STEREO("Line Playback Volume", IDX_MIXER_LINEIN, 0x1f, 1), - AZF3328_MIXER_SWITCH("PC Speaker Playback Switch", IDX_MIXER_PCBEEP, 15, 1), - AZF3328_MIXER_VOL_SPECIAL("PC Speaker Playback Volume", IDX_MIXER_PCBEEP, 0x0f, 1, 1), + AZF3328_MIXER_SWITCH("Beep Playback Switch", IDX_MIXER_PCBEEP, 15, 1), + AZF3328_MIXER_VOL_SPECIAL("Beep Playback Volume", IDX_MIXER_PCBEEP, 0x0f, 1, 1), AZF3328_MIXER_SWITCH("Video Playback Switch", IDX_MIXER_VIDEO, 15, 1), AZF3328_MIXER_VOL_STEREO("Video Playback Volume", IDX_MIXER_VIDEO, 0x1f, 1), AZF3328_MIXER_SWITCH("Aux Playback Switch", IDX_MIXER_AUX, 15, 1), diff --git a/sound/pci/ca0106/ca0106_mixer.c b/sound/pci/ca0106/ca0106_mixer.c index c8c6f437f5b..8f443a9d61e 100644 --- a/sound/pci/ca0106/ca0106_mixer.c +++ b/sound/pci/ca0106/ca0106_mixer.c @@ -792,8 +792,8 @@ int __devinit snd_ca0106_mixer(struct snd_ca0106 *emu) "Phone Playback Volume", "Video Playback Switch", "Video Playback Volume", - "PC Speaker Playback Switch", - "PC Speaker Playback Volume", + "Beep Playback Switch", + "Beep Playback Volume", "Mono Output Select", "Capture Source", "Capture Switch", diff --git a/sound/pci/cmipci.c b/sound/pci/cmipci.c index ddcd4a9fd7e..a312bae08f5 100644 --- a/sound/pci/cmipci.c +++ b/sound/pci/cmipci.c @@ -2302,7 +2302,7 @@ static struct snd_kcontrol_new snd_cmipci_mixers[] __devinitdata = { CMIPCI_SB_VOL_MONO("Mic Playback Volume", SB_DSP4_MIC_DEV, 3, 31), CMIPCI_SB_SW_MONO("Mic Playback Switch", 0), CMIPCI_DOUBLE("Mic Capture Switch", SB_DSP4_INPUT_LEFT, SB_DSP4_INPUT_RIGHT, 0, 0, 1, 0, 0), - CMIPCI_SB_VOL_MONO("PC Speaker Playback Volume", SB_DSP4_SPEAKER_DEV, 6, 3), + CMIPCI_SB_VOL_MONO("Beep Playback Volume", SB_DSP4_SPEAKER_DEV, 6, 3), CMIPCI_MIXER_VOL_STEREO("Aux Playback Volume", CM_REG_AUX_VOL, 4, 0, 15), CMIPCI_MIXER_SW_STEREO("Aux Playback Switch", CM_REG_MIXER2, CM_VAUXLM_SHIFT, CM_VAUXRM_SHIFT, 0), CMIPCI_MIXER_SW_STEREO("Aux Capture Switch", CM_REG_MIXER2, CM_RAUXLEN_SHIFT, CM_RAUXREN_SHIFT, 0), @@ -2310,7 +2310,7 @@ static struct snd_kcontrol_new snd_cmipci_mixers[] __devinitdata = { CMIPCI_MIXER_VOL_MONO("Mic Capture Volume", CM_REG_MIXER2, CM_VADMIC_SHIFT, 7), CMIPCI_SB_VOL_MONO("Phone Playback Volume", CM_REG_EXTENT_IND, 5, 7), CMIPCI_DOUBLE("Phone Playback Switch", CM_REG_EXTENT_IND, CM_REG_EXTENT_IND, 4, 4, 1, 0, 0), - CMIPCI_DOUBLE("PC Speaker Playback Switch", CM_REG_EXTENT_IND, CM_REG_EXTENT_IND, 3, 3, 1, 0, 0), + CMIPCI_DOUBLE("Beep Playback Switch", CM_REG_EXTENT_IND, CM_REG_EXTENT_IND, 3, 3, 1, 0, 0), CMIPCI_DOUBLE("Mic Boost Capture Switch", CM_REG_EXTENT_IND, CM_REG_EXTENT_IND, 0, 0, 1, 0, 0), }; diff --git a/sound/pci/emu10k1/emumixer.c b/sound/pci/emu10k1/emumixer.c index b0fb6c917c3..05afe06e353 100644 --- a/sound/pci/emu10k1/emumixer.c +++ b/sound/pci/emu10k1/emumixer.c @@ -1818,8 +1818,8 @@ int __devinit snd_emu10k1_mixer(struct snd_emu10k1 *emu, "Master Playback Switch", "Master Capture Switch", "Master Playback Volume", "Master Capture Volume", "Wave Master Playback Volume", "Master Playback Volume", - "PC Speaker Playback Switch", "PC Speaker Capture Switch", - "PC Speaker Playback Volume", "PC Speaker Capture Volume", + "Beep Playback Switch", "Beep Capture Switch", + "Beep Playback Volume", "Beep Capture Volume", "Phone Playback Switch", "Phone Capture Switch", "Phone Playback Volume", "Phone Capture Volume", "Mic Playback Switch", "Mic Capture Switch", diff --git a/sound/pci/es1938.c b/sound/pci/es1938.c index 820318ee62c..fb83e1ffa5c 100644 --- a/sound/pci/es1938.c +++ b/sound/pci/es1938.c @@ -1387,7 +1387,7 @@ ES1938_DOUBLE_TLV("Aux Playback Volume", 0, 0x3a, 0x3a, 4, 0, 15, 0, db_scale_line), ES1938_DOUBLE_TLV("Capture Volume", 0, 0xb4, 0xb4, 4, 0, 15, 0, db_scale_capture), -ES1938_SINGLE("PC Speaker Volume", 0, 0x3c, 0, 7, 0), +ES1938_SINGLE("Beep Volume", 0, 0x3c, 0, 7, 0), ES1938_SINGLE("Record Monitor", 0, 0xa8, 3, 1, 0), ES1938_SINGLE("Capture Switch", 0, 0x1c, 4, 1, 1), { diff --git a/sound/pci/hda/patch_cmedia.c b/sound/pci/hda/patch_cmedia.c index 780e1a72114..85c81feb10c 100644 --- a/sound/pci/hda/patch_cmedia.c +++ b/sound/pci/hda/patch_cmedia.c @@ -197,8 +197,8 @@ static struct snd_kcontrol_new cmi9880_basic_mixer[] = { HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0, HDA_INPUT), HDA_CODEC_MUTE("Capture Switch", 0x08, 0, HDA_INPUT), HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0, HDA_INPUT), - HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x23, 0, HDA_OUTPUT), - HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x23, 0, HDA_OUTPUT), + HDA_CODEC_VOLUME("Beep Playback Volume", 0x23, 0, HDA_OUTPUT), + HDA_CODEC_MUTE("Beep Playback Switch", 0x23, 0, HDA_OUTPUT), { } /* end */ }; diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index c08ca660dab..08a5b8a5540 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -7334,8 +7334,8 @@ static struct snd_kcontrol_new alc882_macpro_mixer[] = { HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), /* FIXME: this looks suspicious... - HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x02, HDA_INPUT), - HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x02, HDA_INPUT), + HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x02, HDA_INPUT), + HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x02, HDA_INPUT), */ { } /* end */ }; diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index 66c0876bf73..426edfa476a 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c @@ -3221,7 +3221,7 @@ static int stac92xx_auto_create_beep_ctls(struct hda_codec *codec, /* check for mute support for the the amp */ if ((caps & AC_AMPCAP_MUTE) >> AC_AMPCAP_MUTE_SHIFT) { err = stac92xx_add_control(spec, STAC_CTL_WIDGET_MUTE, - "PC Beep Playback Switch", + "Beep Playback Switch", HDA_COMPOSE_AMP_VAL(nid, 1, 0, HDA_OUTPUT)); if (err < 0) return err; @@ -3230,7 +3230,7 @@ static int stac92xx_auto_create_beep_ctls(struct hda_codec *codec, /* check to see if there is volume support for the amp */ if ((caps & AC_AMPCAP_NUM_STEPS) >> AC_AMPCAP_NUM_STEPS_SHIFT) { err = stac92xx_add_control(spec, STAC_CTL_WIDGET_VOL, - "PC Beep Playback Volume", + "Beep Playback Volume", HDA_COMPOSE_AMP_VAL(nid, 1, 0, HDA_OUTPUT)); if (err < 0) return err; @@ -3271,7 +3271,7 @@ static struct snd_kcontrol_new stac92xx_dig_beep_ctrl = { static int stac92xx_beep_switch_ctl(struct hda_codec *codec) { return stac92xx_add_control_temp(codec->spec, &stac92xx_dig_beep_ctrl, - 0, "PC Beep Playback Switch", 0); + 0, "Beep Playback Switch", 0); } #endif diff --git a/sound/soc/codecs/wm9713.c b/sound/soc/codecs/wm9713.c index abed37acf78..60e360b1046 100644 --- a/sound/soc/codecs/wm9713.c +++ b/sound/soc/codecs/wm9713.c @@ -165,9 +165,9 @@ SOC_SINGLE("Mono Playback Switch", AC97_MASTER_TONE, 7, 1, 1), SOC_SINGLE("Mono Playback ZC Switch", AC97_MASTER_TONE, 6, 1, 0), SOC_SINGLE("Mono Playback Volume", AC97_MASTER_TONE, 0, 31, 1), -SOC_SINGLE("PC Beep Playback Headphone Volume", AC97_AUX, 12, 7, 1), -SOC_SINGLE("PC Beep Playback Speaker Volume", AC97_AUX, 8, 7, 1), -SOC_SINGLE("PC Beep Playback Mono Volume", AC97_AUX, 4, 7, 1), +SOC_SINGLE("Beep Playback Headphone Volume", AC97_AUX, 12, 7, 1), +SOC_SINGLE("Beep Playback Speaker Volume", AC97_AUX, 8, 7, 1), +SOC_SINGLE("Beep Playback Mono Volume", AC97_AUX, 4, 7, 1), SOC_SINGLE("Voice Playback Headphone Volume", AC97_PCM, 12, 7, 1), SOC_SINGLE("Voice Playback Master Volume", AC97_PCM, 8, 7, 1), @@ -266,7 +266,7 @@ static int mixer_event(struct snd_soc_dapm_widget *w, /* Left Headphone Mixers */ static const struct snd_kcontrol_new wm9713_hpl_mixer_controls[] = { -SOC_DAPM_SINGLE("PC Beep Playback Switch", HPL_MIXER, 5, 1, 0), +SOC_DAPM_SINGLE("Beep Playback Switch", HPL_MIXER, 5, 1, 0), SOC_DAPM_SINGLE("Voice Playback Switch", HPL_MIXER, 4, 1, 0), SOC_DAPM_SINGLE("Aux Playback Switch", HPL_MIXER, 3, 1, 0), SOC_DAPM_SINGLE("PCM Playback Switch", HPL_MIXER, 2, 1, 0), @@ -276,7 +276,7 @@ SOC_DAPM_SINGLE("Bypass Playback Switch", HPL_MIXER, 0, 1, 0), /* Right Headphone Mixers */ static const struct snd_kcontrol_new wm9713_hpr_mixer_controls[] = { -SOC_DAPM_SINGLE("PC Beep Playback Switch", HPR_MIXER, 5, 1, 0), +SOC_DAPM_SINGLE("Beep Playback Switch", HPR_MIXER, 5, 1, 0), SOC_DAPM_SINGLE("Voice Playback Switch", HPR_MIXER, 4, 1, 0), SOC_DAPM_SINGLE("Aux Playback Switch", HPR_MIXER, 3, 1, 0), SOC_DAPM_SINGLE("PCM Playback Switch", HPR_MIXER, 2, 1, 0), @@ -294,7 +294,7 @@ SOC_DAPM_ENUM("Route", wm9713_enum[0]); /* Speaker Mixer */ static const struct snd_kcontrol_new wm9713_speaker_mixer_controls[] = { -SOC_DAPM_SINGLE("PC Beep Playback Switch", AC97_AUX, 11, 1, 1), +SOC_DAPM_SINGLE("Beep Playback Switch", AC97_AUX, 11, 1, 1), SOC_DAPM_SINGLE("Voice Playback Switch", AC97_PCM, 11, 1, 1), SOC_DAPM_SINGLE("Aux Playback Switch", AC97_REC_SEL, 11, 1, 1), SOC_DAPM_SINGLE("PCM Playback Switch", AC97_PHONE, 14, 1, 1), @@ -304,7 +304,7 @@ SOC_DAPM_SINGLE("Bypass Playback Switch", AC97_PC_BEEP, 14, 1, 1), /* Mono Mixer */ static const struct snd_kcontrol_new wm9713_mono_mixer_controls[] = { -SOC_DAPM_SINGLE("PC Beep Playback Switch", AC97_AUX, 7, 1, 1), +SOC_DAPM_SINGLE("Beep Playback Switch", AC97_AUX, 7, 1, 1), SOC_DAPM_SINGLE("Voice Playback Switch", AC97_PCM, 7, 1, 1), SOC_DAPM_SINGLE("Aux Playback Switch", AC97_REC_SEL, 7, 1, 1), SOC_DAPM_SINGLE("PCM Playback Switch", AC97_PHONE, 13, 1, 1), @@ -463,7 +463,7 @@ SND_SOC_DAPM_VMID("VMID"), static const struct snd_soc_dapm_route audio_map[] = { /* left HP mixer */ - {"Left HP Mixer", "PC Beep Playback Switch", "PCBEEP"}, + {"Left HP Mixer", "Beep Playback Switch", "PCBEEP"}, {"Left HP Mixer", "Voice Playback Switch", "Voice DAC"}, {"Left HP Mixer", "Aux Playback Switch", "Aux DAC"}, {"Left HP Mixer", "Bypass Playback Switch", "Left Line In"}, @@ -472,7 +472,7 @@ static const struct snd_soc_dapm_route audio_map[] = { {"Left HP Mixer", NULL, "Capture Headphone Mux"}, /* right HP mixer */ - {"Right HP Mixer", "PC Beep Playback Switch", "PCBEEP"}, + {"Right HP Mixer", "Beep Playback Switch", "PCBEEP"}, {"Right HP Mixer", "Voice Playback Switch", "Voice DAC"}, {"Right HP Mixer", "Aux Playback Switch", "Aux DAC"}, {"Right HP Mixer", "Bypass Playback Switch", "Right Line In"}, @@ -491,7 +491,7 @@ static const struct snd_soc_dapm_route audio_map[] = { {"Capture Mixer", NULL, "Right Capture Source"}, /* speaker mixer */ - {"Speaker Mixer", "PC Beep Playback Switch", "PCBEEP"}, + {"Speaker Mixer", "Beep Playback Switch", "PCBEEP"}, {"Speaker Mixer", "Voice Playback Switch", "Voice DAC"}, {"Speaker Mixer", "Aux Playback Switch", "Aux DAC"}, {"Speaker Mixer", "Bypass Playback Switch", "Line Mixer"}, @@ -499,7 +499,7 @@ static const struct snd_soc_dapm_route audio_map[] = { {"Speaker Mixer", "MonoIn Playback Switch", "Mono In"}, /* mono mixer */ - {"Mono Mixer", "PC Beep Playback Switch", "PCBEEP"}, + {"Mono Mixer", "Beep Playback Switch", "PCBEEP"}, {"Mono Mixer", "Voice Playback Switch", "Voice DAC"}, {"Mono Mixer", "Aux Playback Switch", "Aux DAC"}, {"Mono Mixer", "Bypass Playback Switch", "Line Mixer"}, -- cgit v1.2.3 From ad1cd745060ae2f24026b3b3d09da3426df6ab36 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Wed, 4 Nov 2009 14:30:36 +0100 Subject: ALSA: rename "PC Speaker" controls to "Speaker" To unify control names, rename "PC Speaker" to "Speaker" for PPC ALSA drivers. Signed-off-by: Jaroslav Kysela Signed-off-by: Takashi Iwai --- sound/core/oss/mixer_oss.c | 1 + sound/ppc/awacs.c | 12 ++++++------ sound/ppc/burgundy.c | 8 ++++---- sound/ppc/tumbler.c | 2 +- 4 files changed, 12 insertions(+), 11 deletions(-) (limited to 'sound') diff --git a/sound/core/oss/mixer_oss.c b/sound/core/oss/mixer_oss.c index b935ac9dce8..54e2eb56e4c 100644 --- a/sound/core/oss/mixer_oss.c +++ b/sound/core/oss/mixer_oss.c @@ -1253,6 +1253,7 @@ static void snd_mixer_oss_build(struct snd_mixer_oss *mixer) { SOUND_MIXER_PCM, "PCM", 0 }, { SOUND_MIXER_SPEAKER, "Beep", 0 }, { SOUND_MIXER_SPEAKER, "PC Speaker", 0 }, /* fallback */ + { SOUND_MIXER_SPEAKER, "Speaker", 0 }, /* fallback */ { SOUND_MIXER_LINE, "Line", 0 }, { SOUND_MIXER_MIC, "Mic", 0 }, { SOUND_MIXER_CD, "CD", 0 }, diff --git a/sound/ppc/awacs.c b/sound/ppc/awacs.c index 2cc0eda4f20..2e156467b81 100644 --- a/sound/ppc/awacs.c +++ b/sound/ppc/awacs.c @@ -479,7 +479,7 @@ static int snd_pmac_awacs_put_master_amp(struct snd_kcontrol *kcontrol, static struct snd_kcontrol_new snd_pmac_awacs_amp_vol[] __devinitdata = { { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, - .name = "PC Speaker Playback Volume", + .name = "Speaker Playback Volume", .info = snd_pmac_awacs_info_volume_amp, .get = snd_pmac_awacs_get_volume_amp, .put = snd_pmac_awacs_put_volume_amp, @@ -525,7 +525,7 @@ static struct snd_kcontrol_new snd_pmac_awacs_amp_hp_sw __devinitdata = { static struct snd_kcontrol_new snd_pmac_awacs_amp_spk_sw __devinitdata = { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, - .name = "PC Speaker Playback Switch", + .name = "Speaker Playback Switch", .info = snd_pmac_boolean_stereo_info, .get = snd_pmac_awacs_get_switch_amp, .put = snd_pmac_awacs_put_switch_amp, @@ -696,17 +696,17 @@ static struct snd_kcontrol_new snd_pmac_screamer_mic_boost_imac[] __devinitdata }; static struct snd_kcontrol_new snd_pmac_awacs_speaker_vol[] __devinitdata = { - AWACS_VOLUME("PC Speaker Playback Volume", 4, 6, 1), + AWACS_VOLUME("Speaker Playback Volume", 4, 6, 1), }; static struct snd_kcontrol_new snd_pmac_awacs_speaker_sw __devinitdata = -AWACS_SWITCH("PC Speaker Playback Switch", 1, SHIFT_SPKMUTE, 1); +AWACS_SWITCH("Speaker Playback Switch", 1, SHIFT_SPKMUTE, 1); static struct snd_kcontrol_new snd_pmac_awacs_speaker_sw_imac1 __devinitdata = -AWACS_SWITCH("PC Speaker Playback Switch", 1, SHIFT_PAROUT1, 1); +AWACS_SWITCH("Speaker Playback Switch", 1, SHIFT_PAROUT1, 1); static struct snd_kcontrol_new snd_pmac_awacs_speaker_sw_imac2 __devinitdata = -AWACS_SWITCH("PC Speaker Playback Switch", 1, SHIFT_PAROUT1, 0); +AWACS_SWITCH("Speaker Playback Switch", 1, SHIFT_PAROUT1, 0); /* diff --git a/sound/ppc/burgundy.c b/sound/ppc/burgundy.c index 16ed240e423..0accfe49735 100644 --- a/sound/ppc/burgundy.c +++ b/sound/ppc/burgundy.c @@ -505,7 +505,7 @@ static struct snd_kcontrol_new snd_pmac_burgundy_mixers_imac[] __devinitdata = { MASK_ADDR_BURGUNDY_GAINLINE, 1, 0), BURGUNDY_VOLUME_B("Mic Gain Capture Volume", 0, MASK_ADDR_BURGUNDY_GAINMIC, 1, 0), - BURGUNDY_VOLUME_B("PC Speaker Playback Volume", 0, + BURGUNDY_VOLUME_B("Speaker Playback Volume", 0, MASK_ADDR_BURGUNDY_ATTENSPEAKER, 1, 1), BURGUNDY_VOLUME_B("Line out Playback Volume", 0, MASK_ADDR_BURGUNDY_ATTENLINEOUT, 1, 1), @@ -527,7 +527,7 @@ static struct snd_kcontrol_new snd_pmac_burgundy_mixers_pmac[] __devinitdata = { MASK_ADDR_BURGUNDY_VOLMIC, 16), BURGUNDY_VOLUME_B("Line in Gain Capture Volume", 0, MASK_ADDR_BURGUNDY_GAINMIC, 1, 0), - BURGUNDY_VOLUME_B("PC Speaker Playback Volume", 0, + BURGUNDY_VOLUME_B("Speaker Playback Volume", 0, MASK_ADDR_BURGUNDY_ATTENMONO, 0, 1), BURGUNDY_VOLUME_B("Line out Playback Volume", 0, MASK_ADDR_BURGUNDY_ATTENSPEAKER, 1, 1), @@ -549,11 +549,11 @@ BURGUNDY_SWITCH_B("Master Playback Switch", 0, BURGUNDY_OUTPUT_INTERN | BURGUNDY_OUTPUT_LEFT, BURGUNDY_OUTPUT_RIGHT, 1); static struct snd_kcontrol_new snd_pmac_burgundy_speaker_sw_imac __devinitdata = -BURGUNDY_SWITCH_B("PC Speaker Playback Switch", 0, +BURGUNDY_SWITCH_B("Speaker Playback Switch", 0, MASK_ADDR_BURGUNDY_MORE_OUTPUTENABLES, BURGUNDY_OUTPUT_LEFT, BURGUNDY_OUTPUT_RIGHT, 1); static struct snd_kcontrol_new snd_pmac_burgundy_speaker_sw_pmac __devinitdata = -BURGUNDY_SWITCH_B("PC Speaker Playback Switch", 0, +BURGUNDY_SWITCH_B("Speaker Playback Switch", 0, MASK_ADDR_BURGUNDY_MORE_OUTPUTENABLES, BURGUNDY_OUTPUT_INTERN, 0, 0); static struct snd_kcontrol_new snd_pmac_burgundy_line_sw_imac __devinitdata = diff --git a/sound/ppc/tumbler.c b/sound/ppc/tumbler.c index 08e584d1453..789f44f4ac7 100644 --- a/sound/ppc/tumbler.c +++ b/sound/ppc/tumbler.c @@ -905,7 +905,7 @@ static struct snd_kcontrol_new tumbler_hp_sw __devinitdata = { }; static struct snd_kcontrol_new tumbler_speaker_sw __devinitdata = { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, - .name = "PC Speaker Playback Switch", + .name = "Speaker Playback Switch", .info = snd_pmac_boolean_mono_info, .get = tumbler_get_mute_switch, .put = tumbler_put_mute_switch, -- cgit v1.2.3