Alsa-devel
Threads by month
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
September 2008
- 101 participants
- 247 discussions
ASoC and non-ASoC drivers for ACLINK on PXA share lot's of common code.
Move all common code into separate module snd-pxa2xx-lib.
Signed-off-by: Dmitry Baryshkov <dbaryshkov(a)gmail.com>
---
include/sound/pxa2xx-lib.h | 20 +++
sound/arm/Kconfig | 6 +-
sound/arm/Makefile | 3 +
sound/arm/pxa2xx-ac97-lib.c | 323 +++++++++++++++++++++++++++++++++++++++++++
sound/arm/pxa2xx-ac97.c | 247 +++------------------------------
sound/soc/pxa/Kconfig | 2 +
sound/soc/pxa/pxa2xx-ac97.c | 272 ++-----------------------------------
7 files changed, 380 insertions(+), 493 deletions(-)
create mode 100644 include/sound/pxa2xx-lib.h
create mode 100644 sound/arm/pxa2xx-ac97-lib.c
diff --git a/include/sound/pxa2xx-lib.h b/include/sound/pxa2xx-lib.h
new file mode 100644
index 0000000..d18dd2d
--- /dev/null
+++ b/include/sound/pxa2xx-lib.h
@@ -0,0 +1,20 @@
+#ifndef PXA2XX_LIB_H
+#define PXA2XX_LIB_H
+
+#include <linux/platform_device.h>
+#include <sound/ac97_codec.h>
+
+extern unsigned short pxa2xx_ac97_read(struct snd_ac97 *ac97, unsigned short reg);
+extern void pxa2xx_ac97_write(struct snd_ac97 *ac97, unsigned short reg, unsigned short val);
+
+extern bool pxa2xx_ac97_try_warm_reset(struct snd_ac97 *ac97);
+extern bool pxa2xx_ac97_try_cold_reset(struct snd_ac97 *ac97);
+extern void pxa2xx_ac97_finish_reset(struct snd_ac97 *ac97);
+
+extern int pxa2xx_ac97_hw_suspend(void);
+extern int pxa2xx_ac97_hw_resume(void);
+
+extern int pxa2xx_ac97_hw_probe(struct platform_device *dev);
+extern void pxa2xx_ac97_hw_remove(struct platform_device *dev);
+
+#endif
diff --git a/sound/arm/Kconfig b/sound/arm/Kconfig
index 351e19e..3fd2642 100644
--- a/sound/arm/Kconfig
+++ b/sound/arm/Kconfig
@@ -32,11 +32,15 @@ config SND_PXA2XX_PCM
tristate
select SND_PCM
+config SND_PXA2XX_LIB
+ tristate
+ select SND_AC97_CODEC
+
config SND_PXA2XX_AC97
tristate "AC97 driver for the Intel PXA2xx chip"
depends on ARCH_PXA
select SND_PXA2XX_PCM
- select SND_AC97_CODEC
+ select SND_PXA2XX_LIB
help
Say Y or M if you want to support any AC97 codec attached to
the PXA2xx AC97 interface.
diff --git a/sound/arm/Makefile b/sound/arm/Makefile
index 4ef6dd0..bb2ed88 100644
--- a/sound/arm/Makefile
+++ b/sound/arm/Makefile
@@ -11,5 +11,8 @@ snd-aaci-objs := aaci.o devdma.o
obj-$(CONFIG_SND_PXA2XX_PCM) += snd-pxa2xx-pcm.o
snd-pxa2xx-pcm-objs := pxa2xx-pcm.o
+obj-$(CONFIG_SND_PXA2XX_LIB) += snd-pxa2xx-lib.o
+snd-pxa2xx-lib-objs := pxa2xx-ac97-lib.o
+
obj-$(CONFIG_SND_PXA2XX_AC97) += snd-pxa2xx-ac97.o
snd-pxa2xx-ac97-objs := pxa2xx-ac97.o
diff --git a/sound/arm/pxa2xx-ac97-lib.c b/sound/arm/pxa2xx-ac97-lib.c
new file mode 100644
index 0000000..61cf41f
--- /dev/null
+++ b/sound/arm/pxa2xx-ac97-lib.c
@@ -0,0 +1,323 @@
+/*
+ * Based on sound/arm/pxa2xx-ac97.c and sound/soc/pxa/pxa2xx-ac97.c which contain:
+ *
+ * Author: Nicolas Pitre
+ * Created: Dec 02, 2004
+ * Copyright: MontaVista Software Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include <linux/kernel.h>
+#include <linux/platform_device.h>
+#include <linux/interrupt.h>
+#include <linux/clk.h>
+#include <linux/delay.h>
+
+#include <sound/ac97_codec.h>
+#include <sound/pxa2xx-lib.h>
+
+#include <asm/irq.h>
+#include <mach/hardware.h>
+#include <mach/pxa-regs.h>
+#include <mach/pxa2xx-gpio.h>
+#include <mach/audio.h>
+
+static DEFINE_MUTEX(car_mutex);
+static DECLARE_WAIT_QUEUE_HEAD(gsr_wq);
+static volatile long gsr_bits;
+static struct clk *ac97_clk;
+#ifdef CONFIG_PXA27x
+static struct clk *ac97conf_clk;
+#endif
+
+/*
+ * Beware PXA27x bugs:
+ *
+ * o Slot 12 read from modem space will hang controller.
+ * o CDONE, SDONE interrupt fails after any slot 12 IO.
+ *
+ * We therefore have an hybrid approach for waiting on SDONE (interrupt or
+ * 1 jiffy timeout if interrupt never comes).
+ */
+
+unsigned short pxa2xx_ac97_read(struct snd_ac97 *ac97, unsigned short reg)
+{
+ unsigned short val = -1;
+ volatile u32 *reg_addr;
+
+ mutex_lock(&car_mutex);
+
+ /* set up primary or secondary codec space */
+#if defined(CONFIG_PXA27x) || defined(CONFIG_PXA3xx)
+ reg_addr = (ac97->num & 1) ? &SAC_REG_BASE : &PAC_REG_BASE;
+#else
+ if (reg == AC97_GPIO_STATUS)
+ reg_addr = ac97->num ? &SMC_REG_BASE : &PMC_REG_BASE;
+ else
+ reg_addr = ac97->num ? &SAC_REG_BASE : &PAC_REG_BASE;
+#endif
+ reg_addr += (reg >> 1);
+
+ /* start read access across the ac97 link */
+ GSR = GSR_CDONE | GSR_SDONE;
+ gsr_bits = 0;
+ val = *reg_addr;
+ if (reg == AC97_GPIO_STATUS)
+ goto out;
+ if (wait_event_timeout(gsr_wq, (GSR | gsr_bits) & GSR_SDONE, 1) <= 0 &&
+ !((GSR | gsr_bits) & GSR_SDONE)) {
+ printk(KERN_ERR "%s: read error (ac97_reg=%d GSR=%#lx)\n",
+ __func__, reg, GSR | gsr_bits);
+ val = -1;
+ goto out;
+ }
+
+ /* valid data now */
+ GSR = GSR_CDONE | GSR_SDONE;
+ gsr_bits = 0;
+ val = *reg_addr;
+ /* but we've just started another cycle... */
+ wait_event_timeout(gsr_wq, (GSR | gsr_bits) & GSR_SDONE, 1);
+
+out: mutex_unlock(&car_mutex);
+ return val;
+}
+EXPORT_SYMBOL_GPL(pxa2xx_ac97_read);
+
+void pxa2xx_ac97_write(struct snd_ac97 *ac97, unsigned short reg, unsigned short val)
+{
+ volatile u32 *reg_addr;
+
+ mutex_lock(&car_mutex);
+
+ /* set up primary or secondary codec space */
+#if defined(CONFIG_PXA27x) || defined(CONFIG_PXA3xx)
+ reg_addr = (ac97->num & 1) ? &SAC_REG_BASE : &PAC_REG_BASE;
+#else
+ if (reg == AC97_GPIO_STATUS)
+ reg_addr = ac97->num ? &SMC_REG_BASE : &PMC_REG_BASE;
+ else
+ reg_addr = ac97->num ? &SAC_REG_BASE : &PAC_REG_BASE;
+#endif
+ reg_addr += (reg >> 1);
+
+ GSR = GSR_CDONE | GSR_SDONE;
+ gsr_bits = 0;
+ *reg_addr = val;
+ if (wait_event_timeout(gsr_wq, (GSR | gsr_bits) & GSR_CDONE, 1) <= 0 &&
+ !((GSR | gsr_bits) & GSR_CDONE))
+ printk(KERN_ERR "%s: write error (ac97_reg=%d GSR=%#lx)\n",
+ __func__, reg, GSR | gsr_bits);
+
+ mutex_unlock(&car_mutex);
+}
+EXPORT_SYMBOL_GPL(pxa2xx_ac97_write);
+
+bool pxa2xx_ac97_try_warm_reset(struct snd_ac97 *ac97)
+{
+#ifdef CONFIG_PXA3xx
+ int timeout = 100;
+#endif
+ gsr_bits = 0;
+
+#ifdef CONFIG_PXA27x
+ /* warm reset broken on Bulverde,
+ so manually keep AC97 reset high */
+ pxa_gpio_mode(113 | GPIO_OUT | GPIO_DFLT_HIGH);
+ udelay(10);
+ GCR |= GCR_WARM_RST;
+ pxa_gpio_mode(113 | GPIO_ALT_FN_2_OUT);
+ udelay(500);
+#elif defined(CONFIG_PXA3xx)
+ /* Can't use interrupts */
+ GCR |= GCR_WARM_RST;
+ while (!((GSR | gsr_bits) & (GSR_PCR | GSR_SCR)) && timeout--)
+ mdelay(1);
+#else
+ GCR |= GCR_WARM_RST | GCR_PRIRDY_IEN | GCR_SECRDY_IEN;
+ wait_event_timeout(gsr_wq, gsr_bits & (GSR_PCR | GSR_SCR), 1);
+#endif
+
+ if (!((GSR | gsr_bits) & (GSR_PCR | GSR_SCR))) {
+ printk(KERN_INFO "%s: warm reset timeout (GSR=%#lx)\n",
+ __func__, gsr_bits);
+
+ return false;
+ }
+
+ return true;
+}
+EXPORT_SYMBOL_GPL(pxa2xx_ac97_try_warm_reset);
+
+bool pxa2xx_ac97_try_cold_reset(struct snd_ac97 *ac97)
+{
+#ifdef CONFIG_PXA3xx
+ int timeout = 1000;
+
+ /* Hold CLKBPB for 100us */
+ GCR = 0;
+ GCR = GCR_CLKBPB;
+ udelay(100);
+ GCR = 0;
+#endif
+
+ GCR &= GCR_COLD_RST; /* clear everything but nCRST */
+ GCR &= ~GCR_COLD_RST; /* then assert nCRST */
+
+ gsr_bits = 0;
+#ifdef CONFIG_PXA27x
+ /* PXA27x Developers Manual section 13.5.2.2.1 */
+ clk_enable(ac97conf_clk);
+ udelay(5);
+ clk_disable(ac97conf_clk);
+ GCR = GCR_COLD_RST;
+ udelay(50);
+#elif defined(CONFIG_PXA3xx)
+ /* Can't use interrupts on PXA3xx */
+ GCR &= ~(GCR_PRIRDY_IEN|GCR_SECRDY_IEN);
+
+ GCR = GCR_WARM_RST | GCR_COLD_RST;
+ while (!(GSR & (GSR_PCR | GSR_SCR)) && timeout--)
+ mdelay(10);
+#else
+ GCR = GCR_COLD_RST;
+ GCR |= GCR_CDONE_IE|GCR_SDONE_IE;
+ wait_event_timeout(gsr_wq, gsr_bits & (GSR_PCR | GSR_SCR), 1);
+#endif
+
+ if (!((GSR | gsr_bits) & (GSR_PCR | GSR_SCR))) {
+ printk(KERN_INFO "%s: cold reset timeout (GSR=%#lx)\n",
+ __func__, gsr_bits);
+
+ return false;
+ }
+
+ return true;
+}
+EXPORT_SYMBOL_GPL(pxa2xx_ac97_try_cold_reset);
+
+
+void pxa2xx_ac97_finish_reset(struct snd_ac97 *ac97)
+{
+ GCR &= ~(GCR_PRIRDY_IEN|GCR_SECRDY_IEN);
+ GCR |= GCR_SDONE_IE|GCR_CDONE_IE;
+}
+EXPORT_SYMBOL_GPL(pxa2xx_ac97_finish_reset);
+
+static irqreturn_t pxa2xx_ac97_irq(int irq, void *dev_id)
+{
+ long status;
+
+ status = GSR;
+ if (status) {
+ GSR = status;
+ gsr_bits |= status;
+ wake_up(&gsr_wq);
+
+#ifdef CONFIG_PXA27x
+ /* Although we don't use those we still need to clear them
+ since they tend to spuriously trigger when MMC is used
+ (hardware bug? go figure)... */
+ MISR = MISR_EOC;
+ PISR = PISR_EOC;
+ MCSR = MCSR_EOC;
+#endif
+
+ return IRQ_HANDLED;
+ }
+
+ return IRQ_NONE;
+}
+
+#ifdef CONFIG_PM
+int pxa2xx_ac97_hw_suspend(void)
+{
+ GCR |= GCR_ACLINK_OFF;
+ clk_disable(ac97_clk);
+ return 0;
+}
+EXPORT_SYMBOL_GPL(pxa2xx_ac97_hw_suspend);
+
+int pxa2xx_ac97_hw_resume(void)
+{
+ pxa_gpio_mode(GPIO31_SYNC_AC97_MD);
+ pxa_gpio_mode(GPIO30_SDATA_OUT_AC97_MD);
+ pxa_gpio_mode(GPIO28_BITCLK_AC97_MD);
+ pxa_gpio_mode(GPIO29_SDATA_IN_AC97_MD);
+#ifdef CONFIG_PXA27x
+ /* Use GPIO 113 as AC97 Reset on Bulverde */
+ pxa_gpio_mode(113 | GPIO_ALT_FN_2_OUT);
+#endif
+ clk_enable(ac97_clk);
+ return 0;
+}
+EXPORT_SYMBOL_GPL(pxa2xx_ac97_hw_resume);
+#endif
+
+int __devinit pxa2xx_ac97_hw_probe(struct platform_device *dev)
+{
+ int ret;
+
+ ret = request_irq(IRQ_AC97, pxa2xx_ac97_irq, 0, "AC97", NULL);
+ if (ret < 0)
+ goto err;
+
+ pxa_gpio_mode(GPIO31_SYNC_AC97_MD);
+ pxa_gpio_mode(GPIO30_SDATA_OUT_AC97_MD);
+ pxa_gpio_mode(GPIO28_BITCLK_AC97_MD);
+ pxa_gpio_mode(GPIO29_SDATA_IN_AC97_MD);
+#ifdef CONFIG_PXA27x
+ /* Use GPIO 113 as AC97 Reset on Bulverde */
+ pxa_gpio_mode(113 | GPIO_ALT_FN_2_OUT);
+ ac97conf_clk = clk_get(&dev->dev, "AC97CONFCLK");
+ if (IS_ERR(ac97conf_clk)) {
+ ret = PTR_ERR(ac97conf_clk);
+ ac97conf_clk = NULL;
+ goto err_irq;
+ }
+#endif
+
+ ac97_clk = clk_get(&dev->dev, "AC97CLK");
+ if (IS_ERR(ac97_clk)) {
+ ret = PTR_ERR(ac97_clk);
+ ac97_clk = NULL;
+ goto err_irq;
+ }
+
+ return clk_enable(ac97_clk);
+
+err_irq:
+ GCR |= GCR_ACLINK_OFF;
+#ifdef CONFIG_PXA27x
+ if (ac97conf_clk) {
+ clk_put(ac97conf_clk);
+ ac97conf_clk = NULL;
+ }
+#endif
+ free_irq(IRQ_AC97, NULL);
+err:
+ return ret;
+}
+EXPORT_SYMBOL_GPL(pxa2xx_ac97_hw_probe);
+
+void pxa2xx_ac97_hw_remove(struct platform_device *dev)
+{
+ GCR |= GCR_ACLINK_OFF;
+ free_irq(IRQ_AC97, NULL);
+#ifdef CONFIG_PXA27x
+ clk_put(ac97conf_clk);
+ ac97conf_clk = NULL;
+#endif
+ clk_disable(ac97_clk);
+ clk_put(ac97_clk);
+ ac97_clk = NULL;
+}
+EXPORT_SYMBOL_GPL(pxa2xx_ac97_hw_remove);
+
+MODULE_AUTHOR("Nicolas Pitre");
+MODULE_DESCRIPTION("Intel/Marvell PXA sound library");
+MODULE_LICENSE("GPL");
+
diff --git a/sound/arm/pxa2xx-ac97.c b/sound/arm/pxa2xx-ac97.c
index 199cca3..cba71d8 100644
--- a/sound/arm/pxa2xx-ac97.c
+++ b/sound/arm/pxa2xx-ac97.c
@@ -12,198 +12,27 @@
#include <linux/init.h>
#include <linux/module.h>
-#include <linux/kernel.h>
#include <linux/platform_device.h>
-#include <linux/interrupt.h>
-#include <linux/wait.h>
-#include <linux/clk.h>
-#include <linux/delay.h>
#include <sound/core.h>
#include <sound/pcm.h>
#include <sound/ac97_codec.h>
#include <sound/initval.h>
+#include <sound/pxa2xx-lib.h>
-#include <asm/irq.h>
-#include <linux/mutex.h>
#include <mach/hardware.h>
#include <mach/pxa-regs.h>
-#include <mach/pxa2xx-gpio.h>
#include <mach/audio.h>
#include "pxa2xx-pcm.h"
-
-static DEFINE_MUTEX(car_mutex);
-static DECLARE_WAIT_QUEUE_HEAD(gsr_wq);
-static volatile long gsr_bits;
-static struct clk *ac97_clk;
-#ifdef CONFIG_PXA27x
-static struct clk *ac97conf_clk;
-#endif
-
-/*
- * Beware PXA27x bugs:
- *
- * o Slot 12 read from modem space will hang controller.
- * o CDONE, SDONE interrupt fails after any slot 12 IO.
- *
- * We therefore have an hybrid approach for waiting on SDONE (interrupt or
- * 1 jiffy timeout if interrupt never comes).
- */
-
-static unsigned short pxa2xx_ac97_read(struct snd_ac97 *ac97, unsigned short reg)
-{
- unsigned short val = -1;
- volatile u32 *reg_addr;
-
- mutex_lock(&car_mutex);
-
- /* set up primary or secondary codec space */
- reg_addr = (ac97->num & 1) ? &SAC_REG_BASE : &PAC_REG_BASE;
- reg_addr += (reg >> 1);
-
- /* start read access across the ac97 link */
- GSR = GSR_CDONE | GSR_SDONE;
- gsr_bits = 0;
- val = *reg_addr;
- if (reg == AC97_GPIO_STATUS)
- goto out;
- if (wait_event_timeout(gsr_wq, (GSR | gsr_bits) & GSR_SDONE, 1) <= 0 &&
- !((GSR | gsr_bits) & GSR_SDONE)) {
- printk(KERN_ERR "%s: read error (ac97_reg=%d GSR=%#lx)\n",
- __func__, reg, GSR | gsr_bits);
- val = -1;
- goto out;
- }
-
- /* valid data now */
- GSR = GSR_CDONE | GSR_SDONE;
- gsr_bits = 0;
- val = *reg_addr;
- /* but we've just started another cycle... */
- wait_event_timeout(gsr_wq, (GSR | gsr_bits) & GSR_SDONE, 1);
-
-out: mutex_unlock(&car_mutex);
- return val;
-}
-
-static void pxa2xx_ac97_write(struct snd_ac97 *ac97, unsigned short reg, unsigned short val)
-{
- volatile u32 *reg_addr;
-
- mutex_lock(&car_mutex);
-
- /* set up primary or secondary codec space */
- reg_addr = (ac97->num & 1) ? &SAC_REG_BASE : &PAC_REG_BASE;
- reg_addr += (reg >> 1);
-
- GSR = GSR_CDONE | GSR_SDONE;
- gsr_bits = 0;
- *reg_addr = val;
- if (wait_event_timeout(gsr_wq, (GSR | gsr_bits) & GSR_CDONE, 1) <= 0 &&
- !((GSR | gsr_bits) & GSR_CDONE))
- printk(KERN_ERR "%s: write error (ac97_reg=%d GSR=%#lx)\n",
- __func__, reg, GSR | gsr_bits);
-
- mutex_unlock(&car_mutex);
-}
-
static void pxa2xx_ac97_reset(struct snd_ac97 *ac97)
{
- /* First, try cold reset */
-#ifdef CONFIG_PXA3xx
- int timeout;
-
- /* Hold CLKBPB for 100us */
- GCR = 0;
- GCR = GCR_CLKBPB;
- udelay(100);
- GCR = 0;
-#endif
-
- GCR &= GCR_COLD_RST; /* clear everything but nCRST */
- GCR &= ~GCR_COLD_RST; /* then assert nCRST */
-
- gsr_bits = 0;
-#ifdef CONFIG_PXA27x
- /* PXA27x Developers Manual section 13.5.2.2.1 */
- clk_enable(ac97conf_clk);
- udelay(5);
- clk_disable(ac97conf_clk);
- GCR = GCR_COLD_RST;
- udelay(50);
-#elif defined(CONFIG_PXA3xx)
- timeout = 1000;
- /* Can't use interrupts on PXA3xx */
- GCR &= ~(GCR_PRIRDY_IEN|GCR_SECRDY_IEN);
-
- GCR = GCR_WARM_RST | GCR_COLD_RST;
- while (!(GSR & (GSR_PCR | GSR_SCR)) && timeout--)
- mdelay(10);
-#else
- GCR = GCR_COLD_RST;
- GCR |= GCR_CDONE_IE|GCR_SDONE_IE;
- wait_event_timeout(gsr_wq, gsr_bits & (GSR_PCR | GSR_SCR), 1);
-#endif
-
- if (!((GSR | gsr_bits) & (GSR_PCR | GSR_SCR))) {
- printk(KERN_INFO "%s: cold reset timeout (GSR=%#lx)\n",
- __func__, gsr_bits);
-
- /* let's try warm reset */
- gsr_bits = 0;
-#ifdef CONFIG_PXA27x
- /* warm reset broken on Bulverde,
- so manually keep AC97 reset high */
- pxa_gpio_mode(113 | GPIO_OUT | GPIO_DFLT_HIGH);
- udelay(10);
- GCR |= GCR_WARM_RST;
- pxa_gpio_mode(113 | GPIO_ALT_FN_2_OUT);
- udelay(500);
-#elif defined(CONFIG_PXA3xx)
- timeout = 100;
- /* Can't use interrupts */
- GCR |= GCR_WARM_RST;
- while (!((GSR | gsr_bits) & (GSR_PCR | GSR_SCR)) && timeout--)
- mdelay(1);
-#else
- GCR |= GCR_WARM_RST|GCR_PRIRDY_IEN|GCR_SECRDY_IEN;
- wait_event_timeout(gsr_wq, gsr_bits & (GSR_PCR | GSR_SCR), 1);
-#endif
-
- if (!((GSR | gsr_bits) & (GSR_PCR | GSR_SCR)))
- printk(KERN_INFO "%s: warm reset timeout (GSR=%#lx)\n",
- __func__, gsr_bits);
- }
-
- GCR &= ~(GCR_PRIRDY_IEN|GCR_SECRDY_IEN);
- GCR |= GCR_SDONE_IE|GCR_CDONE_IE;
-}
-
-static irqreturn_t pxa2xx_ac97_irq(int irq, void *dev_id)
-{
- long status;
-
- status = GSR;
- if (status) {
- GSR = status;
- gsr_bits |= status;
- wake_up(&gsr_wq);
-
-#ifdef CONFIG_PXA27x
- /* Although we don't use those we still need to clear them
- since they tend to spuriously trigger when MMC is used
- (hardware bug? go figure)... */
- MISR = MISR_EOC;
- PISR = PISR_EOC;
- MCSR = MCSR_EOC;
-#endif
-
- return IRQ_HANDLED;
+ if (!pxa2xx_ac97_try_cold_reset(ac97)) {
+ pxa2xx_ac97_try_warm_reset(ac97);
}
- return IRQ_NONE;
+ pxa2xx_ac97_finish_reset(ac97);
}
static struct snd_ac97_bus_ops pxa2xx_ac97_ops = {
@@ -288,17 +117,19 @@ static int pxa2xx_ac97_do_suspend(struct snd_card *card, pm_message_t state)
snd_ac97_suspend(pxa2xx_ac97_ac97);
if (platform_ops && platform_ops->suspend)
platform_ops->suspend(platform_ops->priv);
- GCR |= GCR_ACLINK_OFF;
- clk_disable(ac97_clk);
- return 0;
+ return pxa2xx_ac97_hw_suspend();
}
static int pxa2xx_ac97_do_resume(struct snd_card *card)
{
pxa2xx_audio_ops_t *platform_ops = card->dev->platform_data;
+ int rc;
+
+ rc = pxa2xx_ac97_hw_resume();
+ if (rc)
+ return rc;
- clk_enable(ac97_clk);
if (platform_ops && platform_ops->resume)
platform_ops->resume(platform_ops->priv);
snd_ac97_resume(pxa2xx_ac97_ac97);
@@ -354,40 +185,17 @@ static int __devinit pxa2xx_ac97_probe(struct platform_device *dev)
if (ret)
goto err;
- ret = request_irq(IRQ_AC97, pxa2xx_ac97_irq, 0, "AC97", NULL);
- if (ret < 0)
- goto err;
-
- pxa_gpio_mode(GPIO31_SYNC_AC97_MD);
- pxa_gpio_mode(GPIO30_SDATA_OUT_AC97_MD);
- pxa_gpio_mode(GPIO28_BITCLK_AC97_MD);
- pxa_gpio_mode(GPIO29_SDATA_IN_AC97_MD);
-#ifdef CONFIG_PXA27x
- /* Use GPIO 113 as AC97 Reset on Bulverde */
- pxa_gpio_mode(113 | GPIO_ALT_FN_2_OUT);
- ac97conf_clk = clk_get(&dev->dev, "AC97CONFCLK");
- if (IS_ERR(ac97conf_clk)) {
- ret = PTR_ERR(ac97conf_clk);
- ac97conf_clk = NULL;
- goto err;
- }
-#endif
-
- ac97_clk = clk_get(&dev->dev, "AC97CLK");
- if (IS_ERR(ac97_clk)) {
- ret = PTR_ERR(ac97_clk);
- ac97_clk = NULL;
+ ret = pxa2xx_ac97_hw_probe(dev);
+ if (ret)
goto err;
- }
- clk_enable(ac97_clk);
ret = snd_ac97_bus(card, 0, &pxa2xx_ac97_ops, NULL, &ac97_bus);
if (ret)
- goto err;
+ goto err_remove;
memset(&ac97_template, 0, sizeof(ac97_template));
ret = snd_ac97_mixer(ac97_bus, &ac97_template, &pxa2xx_ac97_ac97);
if (ret)
- goto err;
+ goto err_remove;
snprintf(card->shortname, sizeof(card->shortname),
"%s", snd_ac97_get_short_name(pxa2xx_ac97_ac97));
@@ -401,22 +209,11 @@ static int __devinit pxa2xx_ac97_probe(struct platform_device *dev)
return 0;
}
- err:
+err_remove:
+ pxa2xx_ac97_hw_remove(dev);
+err:
if (card)
snd_card_free(card);
- if (ac97_clk) {
- GCR |= GCR_ACLINK_OFF;
- free_irq(IRQ_AC97, NULL);
- clk_disable(ac97_clk);
- clk_put(ac97_clk);
- ac97_clk = NULL;
- }
-#ifdef CONFIG_PXA27x
- if (ac97conf_clk) {
- clk_put(ac97conf_clk);
- ac97conf_clk = NULL;
- }
-#endif
return ret;
}
@@ -427,15 +224,7 @@ static int __devexit pxa2xx_ac97_remove(struct platform_device *dev)
if (card) {
snd_card_free(card);
platform_set_drvdata(dev, NULL);
- GCR |= GCR_ACLINK_OFF;
- free_irq(IRQ_AC97, NULL);
- clk_disable(ac97_clk);
- clk_put(ac97_clk);
- ac97_clk = NULL;
-#ifdef CONFIG_PXA27x
- clk_put(ac97conf_clk);
- ac97conf_clk = NULL;
-#endif
+ pxa2xx_ac97_hw_remove(dev);
}
return 0;
diff --git a/sound/soc/pxa/Kconfig b/sound/soc/pxa/Kconfig
index 9212c37..d1ccbdc 100644
--- a/sound/soc/pxa/Kconfig
+++ b/sound/soc/pxa/Kconfig
@@ -13,6 +13,8 @@ config SND_PXA2XX_AC97
config SND_PXA2XX_SOC_AC97
tristate
select AC97_BUS
+ select SND_ARM
+ select SND_PXA2XX_LIB
select SND_SOC_AC97_BUS
config SND_PXA2XX_SOC_I2S
diff --git a/sound/soc/pxa/pxa2xx-ac97.c b/sound/soc/pxa/pxa2xx-ac97.c
index d94a495..a80ae07 100644
--- a/sound/soc/pxa/pxa2xx-ac97.c
+++ b/sound/soc/pxa/pxa2xx-ac97.c
@@ -13,225 +13,30 @@
#include <linux/init.h>
#include <linux/module.h>
#include <linux/platform_device.h>
-#include <linux/interrupt.h>
-#include <linux/wait.h>
-#include <linux/clk.h>
-#include <linux/delay.h>
#include <sound/core.h>
-#include <sound/pcm.h>
#include <sound/ac97_codec.h>
-#include <sound/initval.h>
#include <sound/soc.h>
+#include <sound/pxa2xx-lib.h>
-#include <asm/irq.h>
-#include <linux/mutex.h>
#include <mach/hardware.h>
#include <mach/pxa-regs.h>
-#include <mach/pxa2xx-gpio.h>
-#include <mach/audio.h>
#include "pxa2xx-pcm.h"
#include "pxa2xx-ac97.h"
-static DEFINE_MUTEX(car_mutex);
-static DECLARE_WAIT_QUEUE_HEAD(gsr_wq);
-static volatile long gsr_bits;
-static struct clk *ac97_clk;
-#ifdef CONFIG_PXA27x
-static struct clk *ac97conf_clk;
-#endif
-
-/*
- * Beware PXA27x bugs:
- *
- * o Slot 12 read from modem space will hang controller.
- * o CDONE, SDONE interrupt fails after any slot 12 IO.
- *
- * We therefore have an hybrid approach for waiting on SDONE (interrupt or
- * 1 jiffy timeout if interrupt never comes).
- */
-
-static unsigned short pxa2xx_ac97_read(struct snd_ac97 *ac97,
- unsigned short reg)
-{
- unsigned short val = -1;
- volatile u32 *reg_addr;
-
- mutex_lock(&car_mutex);
-
- /* set up primary or secondary codec/modem space */
-#if defined(CONFIG_PXA27x) || defined(CONFIG_PXA3xx)
- reg_addr = ac97->num ? &SAC_REG_BASE : &PAC_REG_BASE;
-#else
- if (reg == AC97_GPIO_STATUS)
- reg_addr = ac97->num ? &SMC_REG_BASE : &PMC_REG_BASE;
- else
- reg_addr = ac97->num ? &SAC_REG_BASE : &PAC_REG_BASE;
-#endif
- reg_addr += (reg >> 1);
-
-#ifndef CONFIG_PXA27x
- if (reg == AC97_GPIO_STATUS) {
- /* read from controller cache */
- val = *reg_addr;
- goto out;
- }
-#endif
-
- /* start read access across the ac97 link */
- GSR = GSR_CDONE | GSR_SDONE;
- gsr_bits = 0;
- val = *reg_addr;
-
- wait_event_timeout(gsr_wq, (GSR | gsr_bits) & GSR_SDONE, 1);
- if (!((GSR | gsr_bits) & GSR_SDONE)) {
- printk(KERN_ERR "%s: read error (ac97_reg=%x GSR=%#lx)\n",
- __func__, reg, GSR | gsr_bits);
- val = -1;
- goto out;
- }
-
- /* valid data now */
- GSR = GSR_CDONE | GSR_SDONE;
- gsr_bits = 0;
- val = *reg_addr;
- /* but we've just started another cycle... */
- wait_event_timeout(gsr_wq, (GSR | gsr_bits) & GSR_SDONE, 1);
-
-out: mutex_unlock(&car_mutex);
- return val;
-}
-
-static void pxa2xx_ac97_write(struct snd_ac97 *ac97, unsigned short reg,
- unsigned short val)
-{
- volatile u32 *reg_addr;
-
- mutex_lock(&car_mutex);
-
- /* set up primary or secondary codec/modem space */
-#if defined(CONFIG_PXA27x) || defined(CONFIG_PXA3xx)
- reg_addr = ac97->num ? &SAC_REG_BASE : &PAC_REG_BASE;
-#else
- if (reg == AC97_GPIO_STATUS)
- reg_addr = ac97->num ? &SMC_REG_BASE : &PMC_REG_BASE;
- else
- reg_addr = ac97->num ? &SAC_REG_BASE : &PAC_REG_BASE;
-#endif
- reg_addr += (reg >> 1);
-
- GSR = GSR_CDONE | GSR_SDONE;
- gsr_bits = 0;
- *reg_addr = val;
- wait_event_timeout(gsr_wq, (GSR | gsr_bits) & GSR_CDONE, 1);
- if (!((GSR | gsr_bits) & GSR_CDONE))
- printk(KERN_ERR "%s: write error (ac97_reg=%x GSR=%#lx)\n",
- __func__, reg, GSR | gsr_bits);
-
- mutex_unlock(&car_mutex);
-}
-
static void pxa2xx_ac97_warm_reset(struct snd_ac97 *ac97)
{
-#ifdef CONFIG_PXA3xx
- int timeout = 100;
-#endif
- gsr_bits = 0;
-
-#ifdef CONFIG_PXA27x
- /* warm reset broken on Bulverde,
- so manually keep AC97 reset high */
- pxa_gpio_mode(113 | GPIO_OUT | GPIO_DFLT_HIGH);
- udelay(10);
- GCR |= GCR_WARM_RST;
- pxa_gpio_mode(113 | GPIO_ALT_FN_2_OUT);
- udelay(500);
-#elif defined(CONFIG_PXA3xx)
- /* Can't use interrupts */
- GCR |= GCR_WARM_RST;
- while (!((GSR | gsr_bits) & (GSR_PCR | GSR_SCR)) && timeout--)
- mdelay(1);
-#else
- GCR |= GCR_WARM_RST | GCR_PRIRDY_IEN | GCR_SECRDY_IEN;
- wait_event_timeout(gsr_wq, gsr_bits & (GSR_PCR | GSR_SCR), 1);
-#endif
-
- if (!((GSR | gsr_bits) & (GSR_PCR | GSR_SCR)))
- printk(KERN_INFO "%s: warm reset timeout (GSR=%#lx)\n",
- __func__, gsr_bits);
+ pxa2xx_ac97_try_warm_reset(ac97);
- GCR &= ~(GCR_PRIRDY_IEN|GCR_SECRDY_IEN);
- GCR |= GCR_SDONE_IE|GCR_CDONE_IE;
+ pxa2xx_ac97_finish_reset(ac97);
}
static void pxa2xx_ac97_cold_reset(struct snd_ac97 *ac97)
{
-#ifdef CONFIG_PXA3xx
- int timeout = 1000;
-
- /* Hold CLKBPB for 100us */
- GCR = 0;
- GCR = GCR_CLKBPB;
- udelay(100);
- GCR = 0;
-#endif
+ pxa2xx_ac97_try_cold_reset(ac97);
- GCR &= GCR_COLD_RST; /* clear everything but nCRST */
- GCR &= ~GCR_COLD_RST; /* then assert nCRST */
-
- gsr_bits = 0;
-#ifdef CONFIG_PXA27x
- /* PXA27x Developers Manual section 13.5.2.2.1 */
- clk_enable(ac97conf_clk);
- udelay(5);
- clk_disable(ac97conf_clk);
- GCR = GCR_COLD_RST;
- udelay(50);
-#elif defined(CONFIG_PXA3xx)
- /* Can't use interrupts on PXA3xx */
- GCR &= ~(GCR_PRIRDY_IEN|GCR_SECRDY_IEN);
-
- GCR = GCR_WARM_RST | GCR_COLD_RST;
- while (!(GSR & (GSR_PCR | GSR_SCR)) && timeout--)
- mdelay(10);
-#else
- GCR = GCR_COLD_RST;
- GCR |= GCR_CDONE_IE|GCR_SDONE_IE;
- wait_event_timeout(gsr_wq, gsr_bits & (GSR_PCR | GSR_SCR), 1);
-#endif
-
- if (!((GSR | gsr_bits) & (GSR_PCR | GSR_SCR)))
- printk(KERN_INFO "%s: cold reset timeout (GSR=%#lx)\n",
- __func__, gsr_bits);
-
- GCR &= ~(GCR_PRIRDY_IEN|GCR_SECRDY_IEN);
- GCR |= GCR_SDONE_IE|GCR_CDONE_IE;
-}
-
-static irqreturn_t pxa2xx_ac97_irq(int irq, void *dev_id)
-{
- long status;
-
- status = GSR;
- if (status) {
- GSR = status;
- gsr_bits |= status;
- wake_up(&gsr_wq);
-
-#ifdef CONFIG_PXA27x
- /* Although we don't use those we still need to clear them
- since they tend to spuriously trigger when MMC is used
- (hardware bug? go figure)... */
- MISR = MISR_EOC;
- PISR = PISR_EOC;
- MCSR = MCSR_EOC;
-#endif
-
- return IRQ_HANDLED;
- }
-
- return IRQ_NONE;
+ pxa2xx_ac97_finish_reset(ac97);
}
struct snd_ac97_bus_ops soc_ac97_ops = {
@@ -285,24 +90,13 @@ static struct pxa2xx_pcm_dma_params pxa2xx_ac97_pcm_mic_mono_in = {
static int pxa2xx_ac97_suspend(struct platform_device *pdev,
struct snd_soc_dai *dai)
{
- GCR |= GCR_ACLINK_OFF;
- clk_disable(ac97_clk);
- return 0;
+ return pxa2xx_ac97_hw_suspend();
}
static int pxa2xx_ac97_resume(struct platform_device *pdev,
struct snd_soc_dai *dai)
{
- pxa_gpio_mode(GPIO31_SYNC_AC97_MD);
- pxa_gpio_mode(GPIO30_SDATA_OUT_AC97_MD);
- pxa_gpio_mode(GPIO28_BITCLK_AC97_MD);
- pxa_gpio_mode(GPIO29_SDATA_IN_AC97_MD);
-#ifdef CONFIG_PXA27x
- /* Use GPIO 113 as AC97 Reset on Bulverde */
- pxa_gpio_mode(113 | GPIO_ALT_FN_2_OUT);
-#endif
- clk_enable(ac97_clk);
- return 0;
+ return pxa2xx_ac97_hw_resume();
}
#else
@@ -313,61 +107,13 @@ static int pxa2xx_ac97_resume(struct platform_device *pdev,
static int pxa2xx_ac97_probe(struct platform_device *pdev,
struct snd_soc_dai *dai)
{
- int ret;
-
- ret = request_irq(IRQ_AC97, pxa2xx_ac97_irq, IRQF_DISABLED, "AC97", NULL);
- if (ret < 0)
- goto err;
-
- pxa_gpio_mode(GPIO31_SYNC_AC97_MD);
- pxa_gpio_mode(GPIO30_SDATA_OUT_AC97_MD);
- pxa_gpio_mode(GPIO28_BITCLK_AC97_MD);
- pxa_gpio_mode(GPIO29_SDATA_IN_AC97_MD);
-#ifdef CONFIG_PXA27x
- /* Use GPIO 113 as AC97 Reset on Bulverde */
- pxa_gpio_mode(113 | GPIO_ALT_FN_2_OUT);
-
- ac97conf_clk = clk_get(&pdev->dev, "AC97CONFCLK");
- if (IS_ERR(ac97conf_clk)) {
- ret = PTR_ERR(ac97conf_clk);
- ac97conf_clk = NULL;
- goto err_irq;
- }
-#endif
- ac97_clk = clk_get(&pdev->dev, "AC97CLK");
- if (IS_ERR(ac97_clk)) {
- ret = PTR_ERR(ac97_clk);
- ac97_clk = NULL;
- goto err_irq;
- }
- clk_enable(ac97_clk);
- return 0;
-
- err_irq:
- GCR |= GCR_ACLINK_OFF;
-#ifdef CONFIG_PXA27x
- if (ac97conf_clk) {
- clk_put(ac97conf_clk);
- ac97conf_clk = NULL;
- }
-#endif
- free_irq(IRQ_AC97, NULL);
- err:
- return ret;
+ return pxa2xx_ac97_hw_probe(pdev);
}
static void pxa2xx_ac97_remove(struct platform_device *pdev,
struct snd_soc_dai *dai)
{
- GCR |= GCR_ACLINK_OFF;
- free_irq(IRQ_AC97, NULL);
-#ifdef CONFIG_PXA27x
- clk_put(ac97conf_clk);
- ac97conf_clk = NULL;
-#endif
- clk_disable(ac97_clk);
- clk_put(ac97_clk);
- ac97_clk = NULL;
+ pxa2xx_ac97_hw_remove(pdev);
}
static int pxa2xx_ac97_hw_params(struct snd_pcm_substream *substream,
--
1.5.6.5
4
12
Hi,
I'm observing an issue with my audio driver in omap platform. When playing back audio files several 'buffer underrun' messages appear, but using -M option of 'aplay', audio is played fine.
Since the driver is for omap, I'm using the alsa driver for that platform with minor changes (sound/arm/omap/omap-alsa.c from omap-kernel)? Any idea what could be wrong?
Regards,
Misael
1
0
Since I got like,
$cat /proc/asound/devices
2: : timer
3: : sequencer
4: [ 0- 0]: digital audio playback
5: [ 0] : control
I created nodes according to this like,
$ls -l /dev/snd/
total 0
crw-r--r-- 1 root root 116, 5 Jun 14 18:58 controlC0
crw-r--r-- 1 root root 116, 24 Jun 14 18:55 pcmC0D0c
crw-r--r-- 1 root root 116, 4 Jun 14 18:59 pcmC0D0p
crw-r--r-- 1 root root 116, 2 Jun 14 18:59 timer
Now when I played aplay,
$aplay alarm.wav
Playing WAVE '/home/alarm.wav' : Unsigned 8 bit, Rate 22050 Hz, Mono
<3>Bad pte = 5fc2d05f, process = aplay, vm_flags = 800fb, vaddr = 4001c000
Unable to handle kernel NULL pointer dereference at virtual address 00000003
pgd = c2a70000
[00000003] *pgd=22a30031, *pte=00000000, *ppte=00000000
Internal error: Oops: 1 [#2]
Modules linked in:
CPU: 0
PC is at snd_pcm_mmap_data_nopage+0xc4/0xe8
LR is at 0x4001d000
pc : [<c01bf854>] lr : [<4001d000>] Not tainted
sp : c2a4fe6c ip : ffffffff fp : c2a4fe80
r10: 4001d000 r9 : c002bba0 r8 : c2a4e000
r7 : c2e364c4 r6 : 00000000 r5 : c2a4fea0 r4 : c2a7ac00
r3 : 00000093 r2 : 00000013 r1 : 00002000 r0 : c0afa5c0
Flags: nzcv IRQs off FIQs on Mode SVC_32 Segment user
Control: 5317F
Table: 22A70000 DAC: 00000015
Process aplay (pid: 912, stack limit = 0xc2a4e250)
Stack: (0xc2a4fe6c to 0xc2a50000)
fe60: 00000000 c29b3544 c2a4fecc c2a4fe84
c0079c58
fe80: c01bf7a0 c2a71000 c002bbe0 5fc2d05f 00000000 00000000 c2a71000
00000000
fea0: 00000002 ffffffeb c03d0040 c2e364c4 c002bba0 c002bbd4 c2a4ffb0
4001d000
fec0: c2a4ff04 c2a4fed0 c003b3a4 c0079b2c 000227d0 00000000 00000017
ffffffff
fee0: c02cd04c 00000017 c2a4ffb0 4001d000 4032e000 400cb5fc c2a4ffac
c2a4ff08
ff00: c003b5c0 c003b2dc c2a4ff14 c2faddc0 ffffffe7 c0844123 00000000
c0035ec4
ff20: 400cb5fc c2a4ff40 c2a4ff34 c01c15b8 c01c10e4 c2a4ff5c c2a4ff44
c00943d0
ff40: c01c1594 c2faddc0 000227d0 00000004 c2a4ff84 c2a4ff60 c00946ac
c00943a4
ff60: 000003d8 00000000 c2faddc0 fffffff7 c0844123 00000036 c2a4ffa4
c2a4ff88
ff80: c009470c c0094428 00000000 ffffffff 4032e320 00000008 00000004
00000004
ffa0: 00000000 c2a4ffb0 c0035cc8 c003b594 00000000 4001d000 4032c000
ffffff00
ffc0: 00000400 4032e320 00000008 00000004 00000004 4032e000 400cb5fc
000004c8
ffe0: ffffff00 bebb29e0 ffffff00 4008ce20 20000010 ffffffff 4009e42c
4009e464
Backtrace:
[<c01bf790>] (snd_pcm_mmap_data_nopage+0x0/0xe8) from [<c0079c58>]
(__handle_mm_fault+0x13c/0x760)
r5 = C29B3544 r4 = 00000000
[<c0079b1c>] (__handle_mm_fault+0x0/0x760) from [<c003b3a4>]
(do_page_fault+0xd8/0x20c)
[<c003b2cc>] (do_page_fault+0x0/0x20c) from [<c003b5c0>]
(do_DataAbort+0x3c/0xa0)
[<c003b584>] (do_DataAbort+0x0/0xa0) from [<c0035cc8>]
(ret_from_exception+0x0/0x10)
r8 = 00000004 r7 = 00000004 r6 = 00000008 r5 = 4032E320
r4 = FFFFFFFF
Code: 1590c00c e10f2000 e3823080 e121f003 (e59c3004)
Segmentation fault
No sound ...:-((
Where I am doing wrong..??
On Thu, Sep 11, 2008 at 6:12 PM, Prithwee Narayan N S <
prithweens(a)sanyo.co.in> wrote:
> Hi,
>
>
>
> Try the following nodes.
>
>
>
> # cat /proc/asound/devices
>
> 0: [ 0] : control
>
> 16: [ 0- 0]: digital audio playback
>
> 24: [ 0- 0]: digital audio capture
>
> 33: : timer
>
>
>
> / # ls -l /dev/snd/
>
> crw-rw---- 1 0 101 116, 0 Jan 1 00:00 controlC0
>
> crw-rw---- 1 0 101 116, 24 Jan 1 00:00 pcmC0D0c
>
> crw-rw---- 1 0 101 116, 16 Jan 1 00:00 pcmC0D0p
>
> crw-rw---- 1 0 101 116, 33 Jan 1 00:00 timer
>
>
>
> *aplay** -D hw:**0**,0 file.wav* or *aplay** -D plughw:0,0 file.wav*should play your WAV file provided you have the correct alsa.conf file.
>
>
>
> Regards,
>
> Prithwee Narayan.
>
>
>
> On Wed, Sep 10, 2008 at 6:16 PM, vasudha rao <vasudha.jrao(a)gmail.com>
> wrote:
>
> >
>
> > Hi ,
>
> >
>
> > I want to play and record audio file in my custom atmel 9263 board
>
> > running with linux(2.6.20).
>
> > when I tried to play aplay for a wave file, I got
>
> >
>
> > $aplay /home/alarm.wav
>
> > ALSA lib pcm.c:1707:(snd_pcm_open_noupdate) Unknown PCM default
>
> > aplay: main:446: audio open error: No such file or directory
>
> >
>
> > $aplay -l
>
> > aplay: device_list:187: no soundcards found...
>
> >
>
> > $cat /proc/asound/devices
>
> > 2: : timer
>
> > 3: : sequencer
>
> > 4: [ 0- 0]: digital audio playback
>
> > 5: [ 0] : control
>
> >
>
> > Can you tel me where I am doing wrong..??
>
> >
>
> > Thanks in advance..
>
1
0
Sir,
If you have, can you please send me the o/p of this comand,
$ls -lh /dev/snd/
Thank you..
On Thu, Sep 11, 2008 at 2:00 PM, dinesh <dinesh.dua(a)coraltele.com> wrote:
> Hi,
> As per ur proc enteries you havn't registered any capture device so u can
> not do recording with ur device.
>
>
>
> -----Original Message-----
> *From*: vasudha rao <vasudha.jrao(a)gmail.com<vasudha%20rao%20%3cvasudha.jrao(a)gmail.com%3e>
> >
> *To*: aggarwal <anuj.aggarwal(a)gmail.com<aggarwal%20%3canuj.aggarwal(a)gmail.com%3e>
> >
> *Cc*: alsa-devel(a)alsa-project.org
> *Subject*: [alsa-devel] aplay not working
> *Date*: Thu, 11 Sep 2008 13:33:10 +0530
>
> Hi ,
>
> I am not able to do audio record also..
>
> I tried following commands..
>
> $arecord
> RIFF$��.WAVEfmt ...@.@.data��.Recording WAVE 'stdout' : Unsigned 8 bit, Rate
> 8000 Hz, Mono
> arecord: xrun:1037: read/write error, state = PREPARED
>
> $aplay -l
> **** List of PLAYBACK Hardware Devices ****
> card 0: AC97 [Atmel AC97], device 0: Atmel AC97 [Atmel AC97]
> Subdevices: 1/1
> Subdevice #0: subdevice #0
>
> $aplay
> aplay: main:508: audio open error: Inappropriate ioctl for device
>
> $cat /proc/asound/cards
> 0 [AC97 ]: ac97c - Atmel AC97
> Atmel AC97 Controller at 0xfffa0000, irq 18
>
>
> $cat /proc/asound/version
> Advanced Linux Sound Architecture Driver Version 1.0.14rc1 (Tue Jan 09
> 09:56:17 2007 UTC).
>
> $cat /proc/asound/devices
> 2: : timer
> 3: : sequencer
> 4: [ 0- 0]: digital audio playback
> 5: [ 0] : control
>
>
> Where I am doing wrong..
>
>
>
> Thank you..
> _______________________________________________
> Alsa-devel mailing listAlsa-devel@alsa-project.orghttp://mailman.alsa-project.org/mailman/listinfo/alsa-devel
>
>
1
0
Hi ,
I am not able to do audio record also..
I tried following commands..
$arecord
RIFF$��.WAVEfmt ...@.@.data��.Recording WAVE 'stdout' : Unsigned 8 bit, Rate
8000 Hz, Mono
arecord: xrun:1037: read/write error, state = PREPARED
$aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: AC97 [Atmel AC97], device 0: Atmel AC97 [Atmel AC97]
Subdevices: 1/1
Subdevice #0: subdevice #0
$aplay
aplay: main:508: audio open error: Inappropriate ioctl for device
$cat /proc/asound/cards
0 [AC97 ]: ac97c - Atmel AC97
Atmel AC97 Controller at 0xfffa0000, irq 18
$cat /proc/asound/version
Advanced Linux Sound Architecture Driver Version 1.0.14rc1 (Tue Jan 09
09:56:17 2007 UTC).
$cat /proc/asound/devices
2: : timer
3: : sequencer
4: [ 0- 0]: digital audio playback
5: [ 0] : control
Where I am doing wrong..
Thank you..
1
0
Hello,
at first I'm sorry for not using the bug-tracking system to report this
bug. But I'm not going to create one account for each os-project only to
submit a bug report.
While playing arround with mumble, I discovered a bug in the alsa
library (1.0.17a) function 'snd_device_name_hint': Calling this function
leads to a partial destroyed snd_config for my configuration. In my
case, after calling this function, an open request for certain pcm
devices fails. If you need detailed information, feel free to contact me
using my email adress. (I'm not subscribing the mailing list!)
I omitted my config here, to keep this mail short...
greetings
Andreas
1
0
10 Sep '08
- <asm/io.h> -> <linux/io.h>
- remove trailing whitespaces
- convert comments
Only compile tested.
Signed-off-by: Alexander Beregalov <a.beregalov(a)gmail.com>
---
sound/pci/ac97/ac97_codec.c | 192 ++++++++++++++++----------------
sound/pci/ac97/ac97_patch.c | 252 +++++++++++++++++++++---------------------
sound/pci/ac97/ac97_pcm.c | 10 +-
sound/pci/ac97/ac97_proc.c | 24 ++--
4 files changed, 239 insertions(+), 239 deletions(-)
diff --git a/sound/pci/ac97/ac97_codec.c b/sound/pci/ac97/ac97_codec.c
index 6704acb..0cf819a 100644
--- a/sound/pci/ac97/ac97_codec.c
+++ b/sound/pci/ac97/ac97_codec.c
@@ -141,33 +141,33 @@ static const struct ac97_codec_id snd_ac97_codec_ids[] = {
{ 0x43525958, 0xfffffff8, "CS4205", patch_cirrus_spdif, NULL },
{ 0x43525960, 0xfffffff8, "CS4291", NULL, NULL },
{ 0x43525970, 0xfffffff8, "CS4202", NULL, NULL },
-{ 0x43585421, 0xffffffff, "HSD11246", NULL, NULL }, // SmartMC II
-{ 0x43585428, 0xfffffff8, "Cx20468", patch_conexant, NULL }, // SmartAMC fixme: the mask might be different
+{ 0x43585421, 0xffffffff, "HSD11246", NULL, NULL }, /* SmartMC II */
+{ 0x43585428, 0xfffffff8, "Cx20468", patch_conexant, NULL }, /* SmartAMC fixme: the mask might be different */
{ 0x43585431, 0xffffffff, "Cx20551", patch_cx20551, NULL },
{ 0x44543031, 0xfffffff0, "DT0398", NULL, NULL },
-{ 0x454d4328, 0xffffffff, "EM28028", NULL, NULL }, // same as TR28028?
+{ 0x454d4328, 0xffffffff, "EM28028", NULL, NULL }, /* same as TR28028? */
{ 0x45838308, 0xffffffff, "ESS1988", NULL, NULL },
{ 0x48525300, 0xffffff00, "HMP9701", NULL, NULL },
{ 0x49434501, 0xffffffff, "ICE1230", NULL, NULL },
-{ 0x49434511, 0xffffffff, "ICE1232", NULL, NULL }, // alias VIA VT1611A?
+{ 0x49434511, 0xffffffff, "ICE1232", NULL, NULL }, /* alias VIA VT1611A? */
{ 0x49434514, 0xffffffff, "ICE1232A", NULL, NULL },
-{ 0x49434551, 0xffffffff, "VT1616", patch_vt1616, NULL },
-{ 0x49434552, 0xffffffff, "VT1616i", patch_vt1616, NULL }, // VT1616 compatible (chipset integrated)
+{ 0x49434551, 0xffffffff, "VT1616", patch_vt1616, NULL },
+{ 0x49434552, 0xffffffff, "VT1616i", patch_vt1616, NULL }, /* VT1616 compatible (chipset integrated) */
{ 0x49544520, 0xffffffff, "IT2226E", NULL, NULL },
{ 0x49544561, 0xffffffff, "IT2646E", patch_it2646, NULL },
-{ 0x4e534300, 0xffffffff, "LM4540,43,45,46,48", NULL, NULL }, // only guess --jk
+{ 0x4e534300, 0xffffffff, "LM4540,43,45,46,48", NULL, NULL }, /* only guess --jk */
{ 0x4e534331, 0xffffffff, "LM4549", NULL, NULL },
-{ 0x4e534350, 0xffffffff, "LM4550", patch_lm4550, NULL }, // volume wrap fix
+{ 0x4e534350, 0xffffffff, "LM4550", patch_lm4550, NULL }, /* volume wrap fix */
{ 0x50534304, 0xffffffff, "UCB1400", patch_ucb1400, NULL },
{ 0x53494c20, 0xffffffe0, "Si3036,8", mpatch_si3036, mpatch_si3036, AC97_MODEM_PATCH },
{ 0x54524102, 0xffffffff, "TR28022", NULL, NULL },
{ 0x54524103, 0xffffffff, "TR28023", NULL, NULL },
{ 0x54524106, 0xffffffff, "TR28026", NULL, NULL },
-{ 0x54524108, 0xffffffff, "TR28028", patch_tritech_tr28028, NULL }, // added by xin jin [07/09/99]
-{ 0x54524123, 0xffffffff, "TR28602", NULL, NULL }, // only guess --jk [TR28023 = eMicro EM28023 (new CT1297)]
+{ 0x54524108, 0xffffffff, "TR28028", patch_tritech_tr28028, NULL }, /* added by xin jin [07/09/99] */
+{ 0x54524123, 0xffffffff, "TR28602", NULL, NULL }, /* only guess --jk [TR28023 = eMicro EM28023 (new CT1297)] */
{ 0x54584e20, 0xffffffff, "TLC320AD9xC", NULL, NULL },
-{ 0x56494161, 0xffffffff, "VIA1612A", NULL, NULL }, // modified ICE1232 with S/PDIF
-{ 0x56494170, 0xffffffff, "VIA1617A", patch_vt1617a, NULL }, // modified VT1616 with S/PDIF
+{ 0x56494161, 0xffffffff, "VIA1612A", NULL, NULL }, /* modified ICE1232 with S/PDIF */
+{ 0x56494170, 0xffffffff, "VIA1617A", patch_vt1617a, NULL }, /* modified VT1616 with S/PDIF */
{ 0x56494182, 0xffffffff, "VIA1618", patch_vt1618, NULL },
{ 0x57454301, 0xffffffff, "W83971D", NULL, NULL },
{ 0x574d4c00, 0xffffffff, "WM9701,WM9701A", NULL, NULL },
@@ -186,11 +186,11 @@ static const struct ac97_codec_id snd_ac97_codec_ids[] = {
{ 0x83847608, 0xffffffff, "STAC9708,11", patch_sigmatel_stac9708, NULL },
{ 0x83847609, 0xffffffff, "STAC9721,23", patch_sigmatel_stac9721, NULL },
{ 0x83847644, 0xffffffff, "STAC9744", patch_sigmatel_stac9744, NULL },
-{ 0x83847650, 0xffffffff, "STAC9750,51", NULL, NULL }, // patch?
-{ 0x83847652, 0xffffffff, "STAC9752,53", NULL, NULL }, // patch?
+{ 0x83847650, 0xffffffff, "STAC9750,51", NULL, NULL }, /* patch? */
+{ 0x83847652, 0xffffffff, "STAC9752,53", NULL, NULL }, /* patch? */
{ 0x83847656, 0xffffffff, "STAC9756,57", patch_sigmatel_stac9756, NULL },
{ 0x83847658, 0xffffffff, "STAC9758,59", patch_sigmatel_stac9758, NULL },
-{ 0x83847666, 0xffffffff, "STAC9766,67", NULL, NULL }, // patch?
+{ 0x83847666, 0xffffffff, "STAC9766,67", NULL, NULL }, /* patch? */
{ 0, 0, NULL, NULL, NULL }
};
@@ -274,7 +274,7 @@ EXPORT_SYMBOL(snd_ac97_write);
/**
* snd_ac97_read - read a value from the given register
- *
+ *
* @ac97: the ac97 instance
* @reg: the register to read
*
@@ -293,9 +293,9 @@ unsigned short snd_ac97_read(struct snd_ac97 *ac97, unsigned short reg)
/* read a register - return the cached value if already read */
static inline unsigned short snd_ac97_read_cache(struct snd_ac97 *ac97, unsigned short reg)
{
- if (! test_bit(reg, ac97->reg_accessed)) {
+ if (!test_bit(reg, ac97->reg_accessed)) {
ac97->regs[reg] = ac97->bus->ops->read(ac97, reg);
- // set_bit(reg, ac97->reg_accessed);
+ /* set_bit(reg, ac97->reg_accessed); */
}
return ac97->regs[reg];
}
@@ -437,11 +437,11 @@ static int snd_ac97_info_enum_double(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_info *uinfo)
{
struct ac97_enum *e = (struct ac97_enum *)kcontrol->private_value;
-
+
uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
uinfo->count = e->shift_l == e->shift_r ? 1 : 2;
uinfo->value.enumerated.items = e->mask;
-
+
if (uinfo->value.enumerated.item > e->mask - 1)
uinfo->value.enumerated.item = e->mask - 1;
strcpy(uinfo->value.enumerated.name, e->texts[uinfo->value.enumerated.item]);
@@ -454,7 +454,7 @@ static int snd_ac97_get_enum_double(struct snd_kcontrol *kcontrol,
struct snd_ac97 *ac97 = snd_kcontrol_chip(kcontrol);
struct ac97_enum *e = (struct ac97_enum *)kcontrol->private_value;
unsigned short val, bitmask;
-
+
for (bitmask = 1; bitmask < e->mask; bitmask <<= 1)
;
val = snd_ac97_read_cache(ac97, e->reg);
@@ -472,7 +472,7 @@ static int snd_ac97_put_enum_double(struct snd_kcontrol *kcontrol,
struct ac97_enum *e = (struct ac97_enum *)kcontrol->private_value;
unsigned short val;
unsigned short mask, bitmask;
-
+
for (bitmask = 1; bitmask < e->mask; bitmask <<= 1)
;
if (ucontrol->value.enumerated.item[0] > e->mask - 1)
@@ -561,7 +561,7 @@ static int snd_ac97_put_volsw(struct snd_kcontrol *kcontrol,
int invert = (kcontrol->private_value >> 24) & 0x01;
int err, page_save;
unsigned short val, val2, val_mask;
-
+
page_save = snd_ac97_page_save(ac97, reg, kcontrol);
val = (ucontrol->value.integer.value[0] & mask);
if (invert)
@@ -622,8 +622,8 @@ AC97_ENUM_SINGLE(AC97_GENERAL_PURPOSE, 9, 2, std_mix),
AC97_ENUM_SINGLE(AC97_GENERAL_PURPOSE, 8, 2, std_mic),
};
-static const struct snd_kcontrol_new snd_ac97_control_capture_src =
-AC97_ENUM("Capture Source", std_enum[0]);
+static const struct snd_kcontrol_new snd_ac97_control_capture_src =
+AC97_ENUM("Capture Source", std_enum[0]);
static const struct snd_kcontrol_new snd_ac97_control_capture_vol =
AC97_DOUBLE("Capture Volume", AC97_REC_GAIN, 8, 0, 15, 0);
@@ -690,7 +690,7 @@ static int snd_ac97_spdif_mask_info(struct snd_kcontrol *kcontrol, struct snd_ct
uinfo->count = 1;
return 0;
}
-
+
static int snd_ac97_spdif_cmask_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
{
ucontrol->value.iec958.status[0] = IEC958_AES0_PROFESSIONAL |
@@ -702,7 +702,7 @@ static int snd_ac97_spdif_cmask_get(struct snd_kcontrol *kcontrol, struct snd_ct
ucontrol->value.iec958.status[3] = IEC958_AES3_CON_FS;
return 0;
}
-
+
static int snd_ac97_spdif_pmask_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
{
/* FIXME: AC'97 spec doesn't say which bits are used for what */
@@ -725,7 +725,7 @@ static int snd_ac97_spdif_default_get(struct snd_kcontrol *kcontrol, struct snd_
mutex_unlock(&ac97->reg_mutex);
return 0;
}
-
+
static int snd_ac97_spdif_default_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
{
struct snd_ac97 *ac97 = snd_kcontrol_chip(kcontrol);
@@ -752,7 +752,7 @@ static int snd_ac97_spdif_default_put(struct snd_kcontrol *kcontrol, struct snd_
val |= 1<<3;
if (!(new & IEC958_AES0_CON_NOT_COPYRIGHT))
val |= 1<<2;
- val |= ((new >> 8) & 0xff) << 4; // category + original
+ val |= ((new >> 8) & 0xff) << 4; /* category + original */
switch ((new >> 24) & 0xff) {
case IEC958_AES3_CON_FS_44100: val |= 0<<12; break;
case IEC958_AES3_CON_FS_48000: val |= 2<<12; break;
@@ -768,16 +768,16 @@ static int snd_ac97_spdif_default_put(struct snd_kcontrol *kcontrol, struct snd_
if (ac97->flags & AC97_CS_SPDIF) {
int x = (val >> 12) & 0x03;
switch (x) {
- case 0: x = 1; break; // 44.1
- case 2: x = 0; break; // 48.0
- default: x = 0; break; // illegal.
+ case 0: x = 1; break; /* 44.1 */
+ case 2: x = 0; break; /* 48.0 */
+ default: x = 0; break; /* illegal. */
}
change |= snd_ac97_update_bits_nolock(ac97, AC97_CSR_SPDIF, 0x3fff, ((val & 0xcfff) | (x << 12)));
} else if (ac97->flags & AC97_CX_SPDIF) {
int v;
v = new & (IEC958_AES0_CON_EMPHASIS_5015|IEC958_AES0_CON_NOT_COPYRIGHT) ? 0 : AC97_CXR_COPYRGT;
v |= new & IEC958_AES0_NONAUDIO ? AC97_CXR_SPDIF_AC3 : AC97_CXR_SPDIF_PCM;
- change |= snd_ac97_update_bits_nolock(ac97, AC97_CXR_AUDIO_MISC,
+ change |= snd_ac97_update_bits_nolock(ac97, AC97_CXR_AUDIO_MISC,
AC97_CXR_SPDIF_MASK | AC97_CXR_COPYRGT,
v);
} else if (ac97->id == AC97_ID_YMF743) {
@@ -806,7 +806,7 @@ static int snd_ac97_put_spsa(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_
int reg = kcontrol->private_value & 0xff;
int shift = (kcontrol->private_value >> 8) & 0xff;
int mask = (kcontrol->private_value >> 16) & 0xff;
- // int invert = (kcontrol->private_value >> 24) & 0xff;
+ /* int invert = (kcontrol->private_value >> 24) & 0xff; */
unsigned short value, old, new;
int change;
@@ -893,7 +893,7 @@ static int snd_ac97_ad18xx_pcm_get_bits(struct snd_kcontrol *kcontrol, struct sn
int lshift = (kcontrol->private_value >> 8) & 0x0f;
int rshift = (kcontrol->private_value >> 12) & 0x0f;
int mask = (kcontrol->private_value >> 16) & 0xff;
-
+
ucontrol->value.integer.value[0] = mask - ((ac97->spec.ad18xx.pcmreg[codec] >> lshift) & mask);
if (lshift != rshift && (ac97->flags & AC97_STEREO_MUTES))
ucontrol->value.integer.value[1] = mask - ((ac97->spec.ad18xx.pcmreg[codec] >> rshift) & mask);
@@ -908,7 +908,7 @@ static int snd_ac97_ad18xx_pcm_put_bits(struct snd_kcontrol *kcontrol, struct sn
int rshift = (kcontrol->private_value >> 12) & 0x0f;
int mask = (kcontrol->private_value >> 16) & 0xff;
unsigned short val, valmask;
-
+
val = (mask - (ucontrol->value.integer.value[0] & mask)) << lshift;
valmask = mask << lshift;
if (lshift != rshift && (ac97->flags & AC97_STEREO_MUTES)) {
@@ -936,7 +936,7 @@ static int snd_ac97_ad18xx_pcm_get_volume(struct snd_kcontrol *kcontrol, struct
{
struct snd_ac97 *ac97 = snd_kcontrol_chip(kcontrol);
int codec = kcontrol->private_value & 3;
-
+
mutex_lock(&ac97->page_mutex);
ucontrol->value.integer.value[0] = 31 - ((ac97->spec.ad18xx.pcmreg[codec] >> 0) & 31);
ucontrol->value.integer.value[1] = 31 - ((ac97->spec.ad18xx.pcmreg[codec] >> 8) & 31);
@@ -949,7 +949,7 @@ static int snd_ac97_ad18xx_pcm_put_volume(struct snd_kcontrol *kcontrol, struct
struct snd_ac97 *ac97 = snd_kcontrol_chip(kcontrol);
int codec = kcontrol->private_value & 3;
unsigned short val1, val2;
-
+
val1 = 31 - (ucontrol->value.integer.value[0] & 31);
val2 = 31 - (ucontrol->value.integer.value[1] & 31);
return snd_ac97_ad18xx_update_pcm_bits(ac97, codec, 0x1f1f, (val1 << 8) | val2);
@@ -1023,11 +1023,11 @@ static int snd_ac97_dev_free(struct snd_device *device)
return snd_ac97_free(ac97);
}
-static int snd_ac97_try_volume_mix(struct snd_ac97 * ac97, int reg)
+static int snd_ac97_try_volume_mix(struct snd_ac97 *ac97, int reg)
{
unsigned short val, mask = 0x8000;
- if (! snd_ac97_valid_reg(ac97, reg))
+ if (!snd_ac97_valid_reg(ac97, reg))
return 0;
switch (reg) {
@@ -1092,7 +1092,7 @@ static void check_volume_resolution(struct snd_ac97 *ac97, int reg, unsigned cha
}
*lo_max = *hi_max = 0;
- for (i = 0 ; i < ARRAY_SIZE(cbit); i++) {
+ for (i = 0; i < ARRAY_SIZE(cbit); i++) {
unsigned short val;
snd_ac97_write(ac97, reg, 0x8080 | cbit[i] | (cbit[i] << 8));
/* Do the read twice due to buffers on some ac97 codecs.
@@ -1110,7 +1110,7 @@ static void check_volume_resolution(struct snd_ac97 *ac97, int reg, unsigned cha
}
}
-static int snd_ac97_try_bit(struct snd_ac97 * ac97, int reg, int bit)
+static int snd_ac97_try_bit(struct snd_ac97 *ac97, int reg, int bit)
{
unsigned short mask, val, orig, res;
@@ -1124,7 +1124,7 @@ static int snd_ac97_try_bit(struct snd_ac97 * ac97, int reg, int bit)
}
/* check the volume resolution of center/lfe */
-static void snd_ac97_change_volume_params2(struct snd_ac97 * ac97, int reg, int shift, unsigned char *max)
+static void snd_ac97_change_volume_params2(struct snd_ac97 *ac97, int reg, int shift, unsigned char *max)
{
unsigned short val, val1;
@@ -1151,7 +1151,7 @@ static inline int printable(unsigned int x)
}
static struct snd_kcontrol *snd_ac97_cnew(const struct snd_kcontrol_new *_template,
- struct snd_ac97 * ac97)
+ struct snd_ac97 *ac97)
{
struct snd_kcontrol_new template;
memcpy(&template, _template, sizeof(template));
@@ -1170,7 +1170,7 @@ static int snd_ac97_cmute_new_stereo(struct snd_card *card, char *name, int reg,
int err;
unsigned short val, val1, mute_mask;
- if (! snd_ac97_valid_reg(ac97, reg))
+ if (!snd_ac97_valid_reg(ac97, reg))
return 0;
mute_mask = 0x8000;
@@ -1238,7 +1238,7 @@ static int snd_ac97_cvol_new(struct snd_card *card, char *name, int reg, unsigne
int err;
struct snd_kcontrol *kctl;
- if (! snd_ac97_valid_reg(ac97, reg))
+ if (!snd_ac97_valid_reg(ac97, reg))
return 0;
if (hi_max) {
/* invert */
@@ -1275,7 +1275,7 @@ static int snd_ac97_cmix_new_stereo(struct snd_card *card, const char *pfx,
char name[44];
unsigned char lo_max, hi_max;
- if (! snd_ac97_valid_reg(ac97, reg))
+ if (!snd_ac97_valid_reg(ac97, reg))
return 0;
if (snd_ac97_try_bit(ac97, reg, 15)) {
@@ -1301,7 +1301,7 @@ static int snd_ac97_cmix_new_stereo(struct snd_card *card, const char *pfx,
static unsigned int snd_ac97_determine_spdif_rates(struct snd_ac97 *ac97);
-static int snd_ac97_mixer_build(struct snd_ac97 * ac97)
+static int snd_ac97_mixer_build(struct snd_ac97 *ac97)
{
struct snd_card *card = ac97->bus->card;
struct snd_kcontrol *kctl;
@@ -1325,7 +1325,7 @@ static int snd_ac97_mixer_build(struct snd_ac97 * ac97)
ac97->regs[AC97_CENTER_LFE_MASTER] = 0x8080;
/* build center controls */
- if ((snd_ac97_try_volume_mix(ac97, AC97_CENTER_LFE_MASTER))
+ if ((snd_ac97_try_volume_mix(ac97, AC97_CENTER_LFE_MASTER))
&& !(ac97->flags & AC97_AD_MULTI)) {
if ((err = snd_ctl_add(card, snd_ac97_cnew(&snd_ac97_controls_center[0], ac97))) < 0)
return err;
@@ -1353,7 +1353,7 @@ static int snd_ac97_mixer_build(struct snd_ac97 * ac97)
}
/* build surround controls */
- if ((snd_ac97_try_volume_mix(ac97, AC97_SURROUND_MASTER))
+ if ((snd_ac97_try_volume_mix(ac97, AC97_SURROUND_MASTER))
&& !(ac97->flags & AC97_AD_MULTI)) {
/* Surround Master (0x38) is with stereo mutes */
if ((err = snd_ac97_cmix_new_stereo(card, "Surround Playback",
@@ -1368,14 +1368,14 @@ static int snd_ac97_mixer_build(struct snd_ac97 * ac97)
AC97_HEADPHONE, 0, ac97)) < 0)
return err;
}
-
+
/* build master mono controls */
if (snd_ac97_try_volume_mix(ac97, AC97_MASTER_MONO)) {
if ((err = snd_ac97_cmix_new(card, "Master Mono Playback",
AC97_MASTER_MONO, 0, ac97)) < 0)
return err;
}
-
+
/* build master tone controls */
if (!(ac97->flags & AC97_HAS_NO_TONE)) {
if (snd_ac97_try_volume_mix(ac97, AC97_MASTER_TONE)) {
@@ -1391,9 +1391,9 @@ static int snd_ac97_mixer_build(struct snd_ac97 * ac97)
snd_ac97_write_cache(ac97, AC97_MASTER_TONE, 0x0f0f);
}
}
-
+
/* build PC Speaker controls */
- if (!(ac97->flags & AC97_HAS_NO_PC_BEEP) &&
+ if (!(ac97->flags & AC97_HAS_NO_PC_BEEP) &&
((ac97->flags & AC97_HAS_PC_BEEP) ||
snd_ac97_try_volume_mix(ac97, AC97_PC_BEEP))) {
for (idx = 0; idx < 2; idx++)
@@ -1403,7 +1403,7 @@ static int snd_ac97_mixer_build(struct snd_ac97 * ac97)
snd_ac97_write_cache(ac97, AC97_PC_BEEP,
snd_ac97_read(ac97, AC97_PC_BEEP) | 0x801e);
}
-
+
/* build Phone controls */
if (!(ac97->flags & AC97_HAS_NO_PHONE)) {
if (snd_ac97_try_volume_mix(ac97, AC97_PHONE)) {
@@ -1412,7 +1412,7 @@ static int snd_ac97_mixer_build(struct snd_ac97 * ac97)
return err;
}
}
-
+
/* build MIC controls */
if (!(ac97->flags & AC97_HAS_NO_MIC)) {
if (snd_ac97_try_volume_mix(ac97, AC97_MIC)) {
@@ -1430,7 +1430,7 @@ static int snd_ac97_mixer_build(struct snd_ac97 * ac97)
AC97_LINE, 1, ac97)) < 0)
return err;
}
-
+
/* build CD controls */
if (!(ac97->flags & AC97_HAS_NO_CD)) {
if (snd_ac97_try_volume_mix(ac97, AC97_CD)) {
@@ -1439,7 +1439,7 @@ static int snd_ac97_mixer_build(struct snd_ac97 * ac97)
return err;
}
}
-
+
/* build Video controls */
if (!(ac97->flags & AC97_HAS_NO_VIDEO)) {
if (snd_ac97_try_volume_mix(ac97, AC97_VIDEO)) {
@@ -1620,7 +1620,7 @@ static int snd_ac97_mixer_build(struct snd_ac97 * ac97)
}
ac97->spdif_status = SNDRV_PCM_DEFAULT_CON_SPDIF;
}
-
+
/* build chip specific controls */
if (ac97->build_ops->build_specific)
if ((err = ac97->build_ops->build_specific(ac97)) < 0)
@@ -1628,7 +1628,7 @@ static int snd_ac97_mixer_build(struct snd_ac97 * ac97)
if (snd_ac97_try_bit(ac97, AC97_POWERDOWN, 15)) {
kctl = snd_ac97_cnew(&snd_ac97_control_eapd, ac97);
- if (! kctl)
+ if (!kctl)
return -ENOMEM;
if (ac97->scaps & AC97_SCAP_INV_EAPD)
set_inv_eapd(ac97, kctl);
@@ -1639,11 +1639,11 @@ static int snd_ac97_mixer_build(struct snd_ac97 * ac97)
return 0;
}
-static int snd_ac97_modem_build(struct snd_card *card, struct snd_ac97 * ac97)
+static int snd_ac97_modem_build(struct snd_card *card, struct snd_ac97 *ac97)
{
int err, idx;
- //printk("AC97_GPIO_CFG = %x\n",snd_ac97_read(ac97,AC97_GPIO_CFG));
+ /* printk("AC97_GPIO_CFG = %x\n",snd_ac97_read(ac97,AC97_GPIO_CFG)); */
snd_ac97_write(ac97, AC97_GPIO_CFG, 0xffff & ~(AC97_GPIO_LINE1_OH));
snd_ac97_write(ac97, AC97_GPIO_POLARITY, 0xffff & ~(AC97_GPIO_LINE1_OH));
snd_ac97_write(ac97, AC97_GPIO_STICKY, 0xffff);
@@ -1776,15 +1776,15 @@ void snd_ac97_get_name(struct snd_ac97 *ac97, unsigned int id, char *name, int m
printable(id >> 16),
printable(id >> 8));
pid = look_for_codec_id(snd_ac97_codec_id_vendors, id);
- if (! pid)
+ if (!pid)
return;
strcpy(name, pid->name);
if (ac97 && pid->patch) {
if ((modem && (pid->flags & AC97_MODEM_PATCH)) ||
- (! modem && ! (pid->flags & AC97_MODEM_PATCH)))
+ (!modem && !(pid->flags & AC97_MODEM_PATCH)))
pid->patch(ac97);
- }
+ }
pid = look_for_codec_id(snd_ac97_codec_ids, id);
if (pid) {
@@ -1794,7 +1794,7 @@ void snd_ac97_get_name(struct snd_ac97 *ac97, unsigned int id, char *name, int m
sprintf(name + strlen(name), " rev %d", id & ~pid->mask);
if (ac97 && pid->patch) {
if ((modem && (pid->flags & AC97_MODEM_PATCH)) ||
- (! modem && ! (pid->flags & AC97_MODEM_PATCH)))
+ (!modem && !(pid->flags & AC97_MODEM_PATCH)))
pid->patch(ac97);
}
} else
@@ -1829,7 +1829,7 @@ static int ac97_reset_wait(struct snd_ac97 *ac97, int timeout, int with_modem)
end_time = jiffies + timeout;
do {
-
+
/* use preliminary reads to settle the communication */
snd_ac97_read(ac97, AC97_RESET);
snd_ac97_read(ac97, AC97_VENDOR_ID1);
@@ -1872,7 +1872,7 @@ static int ac97_reset_wait(struct snd_ac97 *ac97, int timeout, int with_modem)
*
* The ops table must include valid callbacks (at least read and
* write). The other callbacks, wait and reset, are not mandatory.
- *
+ *
* The clock is set to 48000. If another clock is needed, set
* (*rbus)->clock manually.
*
@@ -1971,7 +1971,7 @@ static void do_update_power(struct work_struct *work)
*
* The template must include the codec number (num) and address (addr),
* and the private data (private_data).
- *
+ *
* The ac97 instance is registered as a low-level device, so you don't
* have to release it manually.
*
@@ -2061,10 +2061,10 @@ int snd_ac97_mixer(struct snd_ac97_bus *bus, struct snd_ac97_template *template,
/* proceed anyway - it's often non-critical */
}
}
- __access_ok:
+__access_ok:
ac97->id = snd_ac97_read(ac97, AC97_VENDOR_ID1) << 16;
ac97->id |= snd_ac97_read(ac97, AC97_VENDOR_ID2);
- if (! (ac97->scaps & AC97_SCAP_DETECT_BY_VENDOR) &&
+ if (!(ac97->scaps & AC97_SCAP_DETECT_BY_VENDOR) &&
(ac97->id == 0x00000000 || ac97->id == 0xffffffff)) {
snd_printk(KERN_ERR "AC'97 %d access is not valid [0x%x], removing mixer.\n", ac97->num, ac97->id);
snd_ac97_free(ac97);
@@ -2073,7 +2073,7 @@ int snd_ac97_mixer(struct snd_ac97_bus *bus, struct snd_ac97_template *template,
pid = look_for_codec_id(snd_ac97_codec_ids, ac97->id);
if (pid)
ac97->flags |= pid->flags;
-
+
/* test for AC'97 */
if (!(ac97->scaps & AC97_SCAP_SKIP_AUDIO) && !(ac97->scaps & AC97_SCAP_AUDIO)) {
/* test if we can write to the record gain volume register */
@@ -2104,14 +2104,14 @@ int snd_ac97_mixer(struct snd_ac97_bus *bus, struct snd_ac97_template *template,
return -EACCES;
}
- if (bus->ops->reset) // FIXME: always skipping?
+ if (bus->ops->reset) /* FIXME: always skipping? */
goto __ready_ok;
/* FIXME: add powerdown control */
if (ac97_is_audio(ac97)) {
/* nothing should be in powerdown mode */
snd_ac97_write_cache(ac97, AC97_POWERDOWN, 0);
- if (! (ac97->flags & AC97_DEFAULT_POWER_OFF)) {
+ if (!(ac97->flags & AC97_DEFAULT_POWER_OFF)) {
snd_ac97_write_cache(ac97, AC97_RESET, 0); /* reset to defaults */
udelay(100);
snd_ac97_write_cache(ac97, AC97_POWERDOWN, 0);
@@ -2158,8 +2158,8 @@ int snd_ac97_mixer(struct snd_ac97_bus *bus, struct snd_ac97_template *template,
} while (time_after_eq(end_time, jiffies));
snd_printk(KERN_WARNING "MC'97 %d converters and GPIO not ready (0x%x)\n", ac97->num, snd_ac97_read(ac97, AC97_EXTENDED_MSTATUS));
}
-
- __ready_ok:
+
+__ready_ok:
if (ac97_is_audio(ac97))
ac97->addr = (ac97->ext_id & AC97_EI_ADDR_MASK) >> AC97_EI_ADDR_SHIFT;
else
@@ -2167,7 +2167,7 @@ int snd_ac97_mixer(struct snd_ac97_bus *bus, struct snd_ac97_template *template,
if (ac97->ext_id & 0x01c9) { /* L/R, MIC, SDAC, LDAC VRA support */
reg = snd_ac97_read(ac97, AC97_EXTENDED_STATUS);
reg |= ac97->ext_id & 0x01c0; /* LDAC/SDAC/CDAC */
- if (! bus->no_vra)
+ if (!bus->no_vra)
reg |= ac97->ext_id & 0x0009; /* VRA/VRM */
snd_ac97_write_cache(ac97, AC97_EXTENDED_STATUS, reg);
}
@@ -2210,8 +2210,8 @@ int snd_ac97_mixer(struct snd_ac97_bus *bus, struct snd_ac97_template *template,
if (bus->ops->init)
bus->ops->init(ac97);
snd_ac97_get_name(ac97, ac97->id, name, !ac97_is_audio(ac97));
- snd_ac97_get_name(NULL, ac97->id, name, !ac97_is_audio(ac97)); // ac97->id might be changed in the special setup code
- if (! ac97->build_ops)
+ snd_ac97_get_name(NULL, ac97->id, name, !ac97_is_audio(ac97)); /* ac97->id might be changed in the special setup code */
+ if (!ac97->build_ops)
ac97->build_ops = &null_build_ops;
if (ac97_is_audio(ac97)) {
@@ -2295,7 +2295,7 @@ static void snd_ac97_powerdown(struct snd_ac97 *ac97)
/* powerdown external amplifier */
if (ac97->scaps & AC97_SCAP_INV_EAPD)
power = ac97->regs[AC97_POWERDOWN] & ~AC97_PD_EAPD;
- else if (! (ac97->scaps & AC97_SCAP_EAPD_LED))
+ else if (!(ac97->scaps & AC97_SCAP_EAPD_LED))
power = ac97->regs[AC97_POWERDOWN] | AC97_PD_EAPD;
power |= AC97_PD_PR6; /* Headphone amplifier powerdown */
power |= AC97_PD_PR0 | AC97_PD_PR1; /* ADC & DAC powerdown */
@@ -2347,7 +2347,7 @@ int snd_ac97_update_power(struct snd_ac97 *ac97, int reg, int powerup)
{
int i;
- if (! ac97)
+ if (!ac97)
return 0;
if (reg) {
@@ -2416,8 +2416,8 @@ static void update_power_regs(struct snd_ac97 *ac97)
snd_ac97_update_bits(ac97, power_regs[i].power_reg,
power_regs[i].mask, bits);
}
- if (! power_up) {
- if (! (ac97->regs[AC97_POWERDOWN] & AC97_PD_PR2)) {
+ if (!power_up) {
+ if (!(ac97->regs[AC97_POWERDOWN] & AC97_PD_PR2)) {
/* power down analog mix and vref */
snd_ac97_update_bits(ac97, AC97_POWERDOWN,
AC97_PD_PR2, AC97_PD_PR2);
@@ -2437,7 +2437,7 @@ static void update_power_regs(struct snd_ac97 *ac97)
*/
void snd_ac97_suspend(struct snd_ac97 *ac97)
{
- if (! ac97)
+ if (!ac97)
return;
if (ac97->build_ops->suspend)
ac97->build_ops->suspend(ac97);
@@ -2457,7 +2457,7 @@ static void snd_ac97_restore_status(struct snd_ac97 *ac97)
{
int i;
- for (i = 2; i < 0x7c ; i += 2) {
+ for (i = 2; i < 0x7c; i += 2) {
if (i == AC97_POWERDOWN || i == AC97_EXTENDED_ID)
continue;
/* restore only accessible registers
@@ -2501,7 +2501,7 @@ void snd_ac97_resume(struct snd_ac97 *ac97)
{
unsigned long end_time;
- if (! ac97)
+ if (!ac97)
return;
if (ac97->bus->ops->reset) {
@@ -2510,7 +2510,7 @@ void snd_ac97_resume(struct snd_ac97 *ac97)
}
snd_ac97_write(ac97, AC97_POWERDOWN, 0);
- if (! (ac97->flags & AC97_DEFAULT_POWER_OFF)) {
+ if (!(ac97->flags & AC97_DEFAULT_POWER_OFF)) {
if (!(ac97->scaps & AC97_SCAP_SKIP_AUDIO))
snd_ac97_write(ac97, AC97_RESET, 0);
else if (!(ac97->scaps & AC97_SCAP_SKIP_MODEM))
@@ -2568,7 +2568,7 @@ static void set_ctl_name(char *dst, const char *src, const char *suffix)
sprintf(dst, "%s %s", src, suffix);
else
strcpy(dst, src);
-}
+}
/* remove the control with the given name and optional suffix */
static int snd_ac97_remove_ctl(struct snd_ac97 *ac97, const char *name,
@@ -2644,7 +2644,7 @@ static int tune_hp_only(struct snd_ac97 *ac97)
{
struct snd_kcontrol *msw = ctl_find(ac97, "Master Playback Switch", NULL);
struct snd_kcontrol *mvol = ctl_find(ac97, "Master Playback Volume", NULL);
- if (! msw || ! mvol)
+ if (!msw || !mvol)
return -ENOENT;
msw->put = bind_hp_volsw_put;
mvol->put = bind_hp_volsw_put;
@@ -2699,7 +2699,7 @@ static int tune_ad_sharing(struct snd_ac97 *ac97)
return 0;
}
-static const struct snd_kcontrol_new snd_ac97_alc_jack_detect =
+static const struct snd_kcontrol_new snd_ac97_alc_jack_detect =
AC97_SINGLE("Jack Detect", AC97_ALC650_CLOCK, 5, 1, 0);
/* ac97 tune: set up ALC jack-select */
@@ -2720,7 +2720,7 @@ static int tune_alc_jack(struct snd_ac97 *ac97)
static int tune_inv_eapd(struct snd_ac97 *ac97)
{
struct snd_kcontrol *kctl = ctl_find(ac97, "External Amplifier", NULL);
- if (! kctl)
+ if (!kctl)
return -ENOENT;
set_inv_eapd(ac97, kctl);
return 0;
@@ -2749,7 +2749,7 @@ static int master_mute_sw_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem
static int tune_mute_led(struct snd_ac97 *ac97)
{
struct snd_kcontrol *msw = ctl_find(ac97, "Master Playback Switch", NULL);
- if (! msw)
+ if (!msw)
return -ENOENT;
msw->put = master_mute_sw_put;
snd_ac97_remove_ctl(ac97, "External Amplifier", NULL);
@@ -2782,7 +2782,7 @@ static int tune_hp_mute_led(struct snd_ac97 *ac97)
{
struct snd_kcontrol *msw = ctl_find(ac97, "Master Playback Switch", NULL);
struct snd_kcontrol *mvol = ctl_find(ac97, "Master Playback Volume", NULL);
- if (! msw || ! mvol)
+ if (!msw || !mvol)
return -ENOENT;
msw->put = hp_master_mute_sw_put;
mvol->put = bind_hp_volsw_put;
@@ -2830,7 +2830,7 @@ static int apply_quirk_str(struct snd_ac97 *ac97, const char *typestr)
for (i = 0; i < ARRAY_SIZE(applicable_quirks); i++) {
q = &applicable_quirks[i];
- if (q->name && ! strcmp(typestr, q->name))
+ if (q->name && !strcmp(typestr, q->name))
return apply_quirk(ac97, i);
}
/* for compatibility, accept the numbers, too */
@@ -2864,13 +2864,13 @@ int snd_ac97_tune_hardware(struct snd_ac97 *ac97, struct ac97_quirk *quirk, cons
return result;
}
- if (! quirk)
+ if (!quirk)
return -EINVAL;
for (; quirk->subvendor; quirk++) {
if (quirk->subvendor != ac97->subsystem_vendor)
continue;
- if ((! quirk->mask && quirk->subdevice == ac97->subsystem_device) ||
+ if ((!quirk->mask && quirk->subdevice == ac97->subsystem_device) ||
quirk->subdevice == (quirk->mask & ac97->subsystem_device)) {
if (quirk->codec_id && quirk->codec_id != ac97->id)
continue;
diff --git a/sound/pci/ac97/ac97_patch.c b/sound/pci/ac97/ac97_patch.c
index 6ce3cbe..19e8572 100644
--- a/sound/pci/ac97/ac97_patch.c
+++ b/sound/pci/ac97/ac97_patch.c
@@ -30,7 +30,7 @@
* Chip specific initialization
*/
-static int patch_build_controls(struct snd_ac97 * ac97, const struct snd_kcontrol_new *controls, int count)
+static int patch_build_controls(struct snd_ac97 *ac97, const struct snd_kcontrol_new *controls, int count)
{
int idx, err;
@@ -446,7 +446,7 @@ static const struct snd_kcontrol_new snd_ac97_ymf753_controls_spdif[3] = {
AC97_YMF7X3_DIT_CTRL, 2, 1, 1)
};
-static int patch_yamaha_ymf753_post_spdif(struct snd_ac97 * ac97)
+static int patch_yamaha_ymf753_post_spdif(struct snd_ac97 *ac97)
{
int err;
@@ -460,7 +460,7 @@ static struct snd_ac97_build_ops patch_yamaha_ymf753_ops = {
.build_post_spdif = patch_yamaha_ymf753_post_spdif
};
-static int patch_yamaha_ymf753(struct snd_ac97 * ac97)
+static int patch_yamaha_ymf753(struct snd_ac97 *ac97)
{
/* Patch for Yamaha YMF753, Copyright (c) by David Shust, dshust(a)shustring.com.
This chip has nonstandard and extended behaviour with regard to its S/PDIF output.
@@ -486,14 +486,14 @@ AC97_DOUBLE("Front Playback Volume", AC97_WM97XX_FMIXER_VOL, 8, 0, 31, 1),
AC97_SINGLE("Front Playback Switch", AC97_WM97XX_FMIXER_VOL, 15, 1, 1),
};
-static int patch_wolfson_wm9703_specific(struct snd_ac97 * ac97)
+static int patch_wolfson_wm9703_specific(struct snd_ac97 *ac97)
{
/* This is known to work for the ViewSonic ViewPad 1000
* Randolph Bentson <bentson(a)holmsjoen.com>
- * WM9703/9707/9708/9717
+ * WM9703/9707/9708/9717
*/
int err, i;
-
+
for (i = 0; i < ARRAY_SIZE(wm97xx_snd_ac97_controls); i++) {
if ((err = snd_ctl_add(ac97->bus->card, snd_ac97_cnew(&wm97xx_snd_ac97_controls[i], ac97))) < 0)
return err;
@@ -506,7 +506,7 @@ static struct snd_ac97_build_ops patch_wolfson_wm9703_ops = {
.build_specific = patch_wolfson_wm9703_specific,
};
-static int patch_wolfson03(struct snd_ac97 * ac97)
+static int patch_wolfson03(struct snd_ac97 *ac97)
{
ac97->build_ops = &patch_wolfson_wm9703_ops;
return 0;
@@ -521,7 +521,7 @@ AC97_DOUBLE("Rear DAC Volume", AC97_WM9704_RPCM_VOL, 8, 0, 31, 1),
AC97_DOUBLE("Surround Volume", AC97_SURROUND_MASTER, 8, 0, 31, 1),
};
-static int patch_wolfson_wm9704_specific(struct snd_ac97 * ac97)
+static int patch_wolfson_wm9704_specific(struct snd_ac97 *ac97)
{
int err, i;
for (i = 0; i < ARRAY_SIZE(wm9704_snd_ac97_controls); i++) {
@@ -537,14 +537,14 @@ static struct snd_ac97_build_ops patch_wolfson_wm9704_ops = {
.build_specific = patch_wolfson_wm9704_specific,
};
-static int patch_wolfson04(struct snd_ac97 * ac97)
+static int patch_wolfson04(struct snd_ac97 *ac97)
{
/* WM9704M/9704Q */
ac97->build_ops = &patch_wolfson_wm9704_ops;
return 0;
}
-static int patch_wolfson_wm9705_specific(struct snd_ac97 * ac97)
+static int patch_wolfson_wm9705_specific(struct snd_ac97 *ac97)
{
int err, i;
for (i = 0; i < ARRAY_SIZE(wm97xx_snd_ac97_controls); i++) {
@@ -559,7 +559,7 @@ static struct snd_ac97_build_ops patch_wolfson_wm9705_ops = {
.build_specific = patch_wolfson_wm9705_specific,
};
-static int patch_wolfson05(struct snd_ac97 * ac97)
+static int patch_wolfson05(struct snd_ac97 *ac97)
{
/* WM9705, WM9710 */
ac97->build_ops = &patch_wolfson_wm9705_ops;
@@ -578,7 +578,7 @@ static const char* wm9711_rec_adc[] = {"Stereo", "Left", "Right", "Mute"};
static const char* wm9711_base[] = {"Linear Control", "Adaptive Boost"};
static const char* wm9711_rec_gain[] = {"+1.5dB Steps", "+0.75dB Steps"};
static const char* wm9711_mic[] = {"Mic 1", "Differential", "Mic 2", "Stereo"};
-static const char* wm9711_rec_sel[] =
+static const char* wm9711_rec_sel[] =
{"Mic 1", "NC", "NC", "Master Mix", "Line", "Headphone Mix", "Phone Mix", "Phone"};
static const char* wm9711_ng_type[] = {"Constant Gain", "Mute"};
@@ -675,10 +675,10 @@ AC97_SINGLE("Headphone ZC Switch", AC97_HEADPHONE, 7, 1, 0),
AC97_SINGLE("Mono ZC Switch", AC97_MASTER_MONO, 7, 1, 0),
};
-static int patch_wolfson_wm9711_specific(struct snd_ac97 * ac97)
+static int patch_wolfson_wm9711_specific(struct snd_ac97 *ac97)
{
int err, i;
-
+
for (i = 0; i < ARRAY_SIZE(wm9711_snd_ac97_controls); i++) {
if ((err = snd_ctl_add(ac97->bus->card, snd_ac97_cnew(&wm9711_snd_ac97_controls[i], ac97))) < 0)
return err;
@@ -696,32 +696,32 @@ static struct snd_ac97_build_ops patch_wolfson_wm9711_ops = {
.build_specific = patch_wolfson_wm9711_specific,
};
-static int patch_wolfson11(struct snd_ac97 * ac97)
+static int patch_wolfson11(struct snd_ac97 *ac97)
{
/* WM9711, WM9712 */
ac97->build_ops = &patch_wolfson_wm9711_ops;
ac97->flags |= AC97_HAS_NO_REC_GAIN | AC97_STEREO_MUTES | AC97_HAS_NO_MIC |
AC97_HAS_NO_PC_BEEP | AC97_HAS_NO_VIDEO | AC97_HAS_NO_CD;
-
+
return 0;
}
static const char* wm9713_mic_mixer[] = {"Stereo", "Mic 1", "Mic 2", "Mute"};
static const char* wm9713_rec_mux[] = {"Stereo", "Left", "Right", "Mute"};
-static const char* wm9713_rec_src[] =
- {"Mic 1", "Mic 2", "Line", "Mono In", "Headphone Mix", "Master Mix",
+static const char* wm9713_rec_src[] =
+ {"Mic 1", "Mic 2", "Line", "Mono In", "Headphone Mix", "Master Mix",
"Mono Mix", "Zh"};
static const char* wm9713_rec_gain[] = {"+1.5dB Steps", "+0.75dB Steps"};
static const char* wm9713_alc_select[] = {"None", "Left", "Right", "Stereo"};
static const char* wm9713_mono_pga[] = {"Vmid", "Zh", "Mono Mix", "Inv 1"};
-static const char* wm9713_spk_pga[] =
+static const char* wm9713_spk_pga[] =
{"Vmid", "Zh", "Headphone Mix", "Master Mix", "Inv", "NC", "NC", "NC"};
static const char* wm9713_hp_pga[] = {"Vmid", "Zh", "Headphone Mix", "NC"};
static const char* wm9713_out3_pga[] = {"Vmid", "Zh", "Inv 1", "NC"};
static const char* wm9713_out4_pga[] = {"Vmid", "Zh", "Inv 2", "NC"};
-static const char* wm9713_dac_inv[] =
- {"Off", "Mono Mix", "Master Mix", "Headphone Mix L", "Headphone Mix R",
+static const char* wm9713_dac_inv[] =
+ {"Off", "Mono Mix", "Master Mix", "Headphone Mix L", "Headphone Mix R",
"Headphone Mix Mono", "NC", "Vmid"};
static const char* wm9713_base[] = {"Linear Control", "Adaptive Boost"};
static const char* wm9713_ng_type[] = {"Constant Gain", "Mute"};
@@ -842,10 +842,10 @@ AC97_SINGLE("3D Lower Cut-off Switch", AC97_REC_GAIN_MIC, 4, 1, 0),
AC97_SINGLE("3D Depth", AC97_REC_GAIN_MIC, 0, 15, 1),
};
-static int patch_wolfson_wm9713_3d (struct snd_ac97 * ac97)
+static int patch_wolfson_wm9713_3d(struct snd_ac97 *ac97)
{
int err, i;
-
+
for (i = 0; i < ARRAY_SIZE(wm13_snd_ac97_controls_3d); i++) {
if ((err = snd_ctl_add(ac97->bus->card, snd_ac97_cnew(&wm13_snd_ac97_controls_3d[i], ac97))) < 0)
return err;
@@ -853,10 +853,10 @@ static int patch_wolfson_wm9713_3d (struct snd_ac97 * ac97)
return 0;
}
-static int patch_wolfson_wm9713_specific(struct snd_ac97 * ac97)
+static int patch_wolfson_wm9713_specific(struct snd_ac97 *ac97)
{
int err, i;
-
+
for (i = 0; i < ARRAY_SIZE(wm13_snd_ac97_controls); i++) {
if ((err = snd_ctl_add(ac97->bus->card, snd_ac97_cnew(&wm13_snd_ac97_controls[i], ac97))) < 0)
return err;
@@ -872,13 +872,13 @@ static int patch_wolfson_wm9713_specific(struct snd_ac97 * ac97)
}
#ifdef CONFIG_PM
-static void patch_wolfson_wm9713_suspend (struct snd_ac97 * ac97)
+static void patch_wolfson_wm9713_suspend(struct snd_ac97 *ac97)
{
snd_ac97_write_cache(ac97, AC97_EXTENDED_MID, 0xfeff);
snd_ac97_write_cache(ac97, AC97_EXTENDED_MSTATUS, 0xffff);
}
-static void patch_wolfson_wm9713_resume (struct snd_ac97 * ac97)
+static void patch_wolfson_wm9713_resume(struct snd_ac97 *ac97)
{
snd_ac97_write_cache(ac97, AC97_EXTENDED_MID, 0xda00);
snd_ac97_write_cache(ac97, AC97_EXTENDED_MSTATUS, 0x3810);
@@ -889,13 +889,13 @@ static void patch_wolfson_wm9713_resume (struct snd_ac97 * ac97)
static struct snd_ac97_build_ops patch_wolfson_wm9713_ops = {
.build_specific = patch_wolfson_wm9713_specific,
.build_3d = patch_wolfson_wm9713_3d,
-#ifdef CONFIG_PM
+#ifdef CONFIG_PM
.suspend = patch_wolfson_wm9713_suspend,
.resume = patch_wolfson_wm9713_resume
#endif
};
-static int patch_wolfson13(struct snd_ac97 * ac97)
+static int patch_wolfson13(struct snd_ac97 *ac97)
{
/* WM9713, WM9714 */
ac97->build_ops = &patch_wolfson_wm9713_ops;
@@ -915,7 +915,7 @@ static int patch_wolfson13(struct snd_ac97 * ac97)
/*
* Tritech codec
*/
-static int patch_tritech_tr28028(struct snd_ac97 * ac97)
+static int patch_tritech_tr28028(struct snd_ac97 *ac97)
{
snd_ac97_write_cache(ac97, 0x26, 0x0300);
snd_ac97_write_cache(ac97, 0x26, 0x0000);
@@ -927,7 +927,7 @@ static int patch_tritech_tr28028(struct snd_ac97 * ac97)
/*
* Sigmatel STAC97xx codecs
*/
-static int patch_sigmatel_stac9700_3d(struct snd_ac97 * ac97)
+static int patch_sigmatel_stac9700_3d(struct snd_ac97 *ac97)
{
struct snd_kcontrol *kctl;
int err;
@@ -940,7 +940,7 @@ static int patch_sigmatel_stac9700_3d(struct snd_ac97 * ac97)
return 0;
}
-static int patch_sigmatel_stac9708_3d(struct snd_ac97 * ac97)
+static int patch_sigmatel_stac9708_3d(struct snd_ac97 *ac97)
{
struct snd_kcontrol *kctl;
int err;
@@ -968,7 +968,7 @@ AC97_SINGLE("Sigmatel DAC 6dB Attenuate", AC97_SIGMATEL_ANALOG, 1, 1, 0),
AC97_SINGLE("Sigmatel ADC 6dB Attenuate", AC97_SIGMATEL_ANALOG, 0, 1, 0)
};
-static int patch_sigmatel_stac97xx_specific(struct snd_ac97 * ac97)
+static int patch_sigmatel_stac97xx_specific(struct snd_ac97 *ac97)
{
int err;
@@ -993,7 +993,7 @@ static struct snd_ac97_build_ops patch_sigmatel_stac9700_ops = {
.build_specific = patch_sigmatel_stac97xx_specific
};
-static int patch_sigmatel_stac9700(struct snd_ac97 * ac97)
+static int patch_sigmatel_stac9700(struct snd_ac97 *ac97)
{
ac97->build_ops = &patch_sigmatel_stac9700_ops;
return 0;
@@ -1040,7 +1040,7 @@ static struct snd_ac97_build_ops patch_sigmatel_stac9708_ops = {
.build_specific = patch_sigmatel_stac9708_specific
};
-static int patch_sigmatel_stac9708(struct snd_ac97 * ac97)
+static int patch_sigmatel_stac9708(struct snd_ac97 *ac97)
{
unsigned int codec72, codec6c;
@@ -1066,11 +1066,11 @@ static int patch_sigmatel_stac9708(struct snd_ac97 * ac97)
return 0;
}
-static int patch_sigmatel_stac9721(struct snd_ac97 * ac97)
+static int patch_sigmatel_stac9721(struct snd_ac97 *ac97)
{
ac97->build_ops = &patch_sigmatel_stac9700_ops;
if (snd_ac97_read(ac97, AC97_SIGMATEL_ANALOG) == 0) {
- // patch for SigmaTel
+ /* patch for SigmaTel */
snd_ac97_write_cache(ac97, AC97_SIGMATEL_CIC1, 0xabba);
snd_ac97_write_cache(ac97, AC97_SIGMATEL_CIC2, 0x4000);
snd_ac97_write_cache(ac97, AC97_SIGMATEL_BIAS1, 0xabba);
@@ -1080,9 +1080,9 @@ static int patch_sigmatel_stac9721(struct snd_ac97 * ac97)
return 0;
}
-static int patch_sigmatel_stac9744(struct snd_ac97 * ac97)
+static int patch_sigmatel_stac9744(struct snd_ac97 *ac97)
{
- // patch for SigmaTel
+ /* patch for SigmaTel */
ac97->build_ops = &patch_sigmatel_stac9700_ops;
snd_ac97_write_cache(ac97, AC97_SIGMATEL_CIC1, 0xabba);
snd_ac97_write_cache(ac97, AC97_SIGMATEL_CIC2, 0x0000); /* is this correct? --jk */
@@ -1092,9 +1092,9 @@ static int patch_sigmatel_stac9744(struct snd_ac97 * ac97)
return 0;
}
-static int patch_sigmatel_stac9756(struct snd_ac97 * ac97)
+static int patch_sigmatel_stac9756(struct snd_ac97 *ac97)
{
- // patch for SigmaTel
+ /* patch for SigmaTel */
ac97->build_ops = &patch_sigmatel_stac9700_ops;
snd_ac97_write_cache(ac97, AC97_SIGMATEL_CIC1, 0xabba);
snd_ac97_write_cache(ac97, AC97_SIGMATEL_CIC2, 0x0000); /* is this correct? --jk */
@@ -1269,7 +1269,7 @@ static struct snd_ac97_build_ops patch_sigmatel_stac9758_ops = {
.build_specific = patch_sigmatel_stac9758_specific
};
-static int patch_sigmatel_stac9758(struct snd_ac97 * ac97)
+static int patch_sigmatel_stac9758(struct snd_ac97 *ac97)
{
static unsigned short regs[4] = {
AC97_SIGMATEL_OUTSEL,
@@ -1293,12 +1293,12 @@ static int patch_sigmatel_stac9758(struct snd_ac97 * ac97)
int i;
/* Gateway M675 notebook */
- if (ac97->pci &&
+ if (ac97->pci &&
ac97->subsystem_vendor == 0x107b &&
ac97->subsystem_device == 0x0601)
pregs = m675_regs;
- // patch for SigmaTel
+ /* patch for SigmaTel */
ac97->build_ops = &patch_sigmatel_stac9758_ops;
/* FIXME: assume only page 0 for writing cache */
snd_ac97_update_bits(ac97, AC97_INT_PAGING, AC97_PAGE_MASK, AC97_PAGE_VENDOR);
@@ -1317,7 +1317,7 @@ static const struct snd_kcontrol_new snd_ac97_cirrus_controls_spdif[2] = {
AC97_SINGLE(SNDRV_CTL_NAME_IEC958("",PLAYBACK,NONE) "AC97-SPSA", AC97_CSR_ACMODE, 0, 3, 0)
};
-static int patch_cirrus_build_spdif(struct snd_ac97 * ac97)
+static int patch_cirrus_build_spdif(struct snd_ac97 *ac97)
{
int err;
@@ -1343,7 +1343,7 @@ static struct snd_ac97_build_ops patch_cirrus_ops = {
.build_spdif = patch_cirrus_build_spdif
};
-static int patch_cirrus_spdif(struct snd_ac97 * ac97)
+static int patch_cirrus_spdif(struct snd_ac97 *ac97)
{
/* Basically, the cs4201/cs4205/cs4297a has non-standard sp/dif registers.
WHY CAN'T ANYONE FOLLOW THE BLOODY SPEC? *sigh*
@@ -1357,18 +1357,18 @@ static int patch_cirrus_spdif(struct snd_ac97 * ac97)
*/
ac97->build_ops = &patch_cirrus_ops;
- ac97->flags |= AC97_CS_SPDIF;
+ ac97->flags |= AC97_CS_SPDIF;
ac97->rates[AC97_RATES_SPDIF] &= ~SNDRV_PCM_RATE_32000;
ac97->ext_id |= AC97_EI_SPDIF; /* force the detection of spdif */
snd_ac97_write_cache(ac97, AC97_CSR_ACMODE, 0x0080);
return 0;
}
-static int patch_cirrus_cs4299(struct snd_ac97 * ac97)
+static int patch_cirrus_cs4299(struct snd_ac97 *ac97)
{
/* force the detection of PC Beep */
ac97->flags |= AC97_HAS_PC_BEEP;
-
+
return patch_cirrus_spdif(ac97);
}
@@ -1379,7 +1379,7 @@ static const struct snd_kcontrol_new snd_ac97_conexant_controls_spdif[1] = {
AC97_SINGLE(SNDRV_CTL_NAME_IEC958("",PLAYBACK,SWITCH), AC97_CXR_AUDIO_MISC, 3, 1, 0),
};
-static int patch_conexant_build_spdif(struct snd_ac97 * ac97)
+static int patch_conexant_build_spdif(struct snd_ac97 *ac97)
{
int err;
@@ -1400,7 +1400,7 @@ static struct snd_ac97_build_ops patch_conexant_ops = {
.build_spdif = patch_conexant_build_spdif
};
-static int patch_conexant(struct snd_ac97 * ac97)
+static int patch_conexant(struct snd_ac97 *ac97)
{
ac97->build_ops = &patch_conexant_ops;
ac97->flags |= AC97_CX_SPDIF;
@@ -1434,13 +1434,13 @@ static void ad18xx_resume(struct snd_ac97 *ac97)
}
}
- if (! (ac97->flags & AC97_AD_MULTI))
+ if (!(ac97->flags & AC97_AD_MULTI))
/* normal restore */
snd_ac97_restore_status(ac97);
else {
/* restore the AD18xx codec configurations */
for (codec = 0; codec < 3; codec++) {
- if (! ac97->spec.ad18xx.id[codec])
+ if (!ac97->spec.ad18xx.id[codec])
continue;
/* select single codec */
snd_ac97_update_bits(ac97, AC97_AD_SERIAL_CFG, 0x7000,
@@ -1451,14 +1451,14 @@ static void ad18xx_resume(struct snd_ac97 *ac97)
snd_ac97_update_bits(ac97, AC97_AD_SERIAL_CFG, 0x7000, 0x7000);
/* restore status */
- for (i = 2; i < 0x7c ; i += 2) {
+ for (i = 2; i < 0x7c; i += 2) {
if (i == AC97_POWERDOWN || i == AC97_EXTENDED_ID)
continue;
if (test_bit(i, ac97->reg_accessed)) {
/* handle multi codecs for AD18xx */
if (i == AC97_PCM) {
for (codec = 0; codec < 3; codec++) {
- if (! ac97->spec.ad18xx.id[codec])
+ if (!ac97->spec.ad18xx.id[codec])
continue;
/* select single codec */
snd_ac97_update_bits(ac97, AC97_AD_SERIAL_CFG, 0x7000,
@@ -1501,22 +1501,22 @@ static const struct snd_ac97_res_table ad1819_restbl[] = {
{ } /* terminator */
};
-static int patch_ad1819(struct snd_ac97 * ac97)
+static int patch_ad1819(struct snd_ac97 *ac97)
{
unsigned short scfg;
- // patch for Analog Devices
+ /* patch for Analog Devices */
scfg = snd_ac97_read(ac97, AC97_AD_SERIAL_CFG);
snd_ac97_write_cache(ac97, AC97_AD_SERIAL_CFG, scfg | 0x7000); /* select all codecs */
ac97->res_table = ad1819_restbl;
return 0;
}
-static unsigned short patch_ad1881_unchained(struct snd_ac97 * ac97, int idx, unsigned short mask)
+static unsigned short patch_ad1881_unchained(struct snd_ac97 *ac97, int idx, unsigned short mask)
{
unsigned short val;
- // test for unchained codec
+ /* test for unchained codec */
snd_ac97_update_bits(ac97, AC97_AD_SERIAL_CFG, 0x7000, mask);
snd_ac97_write_cache(ac97, AC97_AD_CODEC_CFG, 0x0000); /* ID0C, ID1C, SDIE = off */
val = snd_ac97_read(ac97, AC97_VENDOR_ID2);
@@ -1528,13 +1528,13 @@ static unsigned short patch_ad1881_unchained(struct snd_ac97 * ac97, int idx, un
return mask;
}
-static int patch_ad1881_chained1(struct snd_ac97 * ac97, int idx, unsigned short codec_bits)
+static int patch_ad1881_chained1(struct snd_ac97 *ac97, int idx, unsigned short codec_bits)
{
static int cfg_bits[3] = { 1<<12, 1<<14, 1<<13 };
unsigned short val;
-
+
snd_ac97_update_bits(ac97, AC97_AD_SERIAL_CFG, 0x7000, cfg_bits[idx]);
- snd_ac97_write_cache(ac97, AC97_AD_CODEC_CFG, 0x0004); // SDIE
+ snd_ac97_write_cache(ac97, AC97_AD_CODEC_CFG, 0x0004); /* SDIE */
val = snd_ac97_read(ac97, AC97_VENDOR_ID2);
if ((val & 0xff40) != 0x5340)
return 0;
@@ -1546,26 +1546,26 @@ static int patch_ad1881_chained1(struct snd_ac97 * ac97, int idx, unsigned short
return 1;
}
-static void patch_ad1881_chained(struct snd_ac97 * ac97, int unchained_idx, int cidx1, int cidx2)
+static void patch_ad1881_chained(struct snd_ac97 *ac97, int unchained_idx, int cidx1, int cidx2)
{
- // already detected?
+ /* already detected? */
if (ac97->spec.ad18xx.unchained[cidx1] || ac97->spec.ad18xx.chained[cidx1])
cidx1 = -1;
if (ac97->spec.ad18xx.unchained[cidx2] || ac97->spec.ad18xx.chained[cidx2])
cidx2 = -1;
if (cidx1 < 0 && cidx2 < 0)
return;
- // test for chained codecs
+ /* test for chained codecs */
snd_ac97_update_bits(ac97, AC97_AD_SERIAL_CFG, 0x7000,
ac97->spec.ad18xx.unchained[unchained_idx]);
- snd_ac97_write_cache(ac97, AC97_AD_CODEC_CFG, 0x0002); // ID1C
+ snd_ac97_write_cache(ac97, AC97_AD_CODEC_CFG, 0x0002); /* ID1C */
ac97->spec.ad18xx.codec_cfg[unchained_idx] = 0x0002;
if (cidx1 >= 0) {
if (cidx2 < 0)
patch_ad1881_chained1(ac97, cidx1, 0);
- else if (patch_ad1881_chained1(ac97, cidx1, 0x0006)) // SDIE | ID1C
+ else if (patch_ad1881_chained1(ac97, cidx1, 0x0006)) /* SDIE | ID1C */
patch_ad1881_chained1(ac97, cidx2, 0);
- else if (patch_ad1881_chained1(ac97, cidx2, 0x0006)) // SDIE | ID1C
+ else if (patch_ad1881_chained1(ac97, cidx2, 0x0006)) /* SDIE | ID1C */
patch_ad1881_chained1(ac97, cidx1, 0);
} else if (cidx2 >= 0) {
patch_ad1881_chained1(ac97, cidx2, 0);
@@ -1578,15 +1578,15 @@ static struct snd_ac97_build_ops patch_ad1881_build_ops = {
#endif
};
-static int patch_ad1881(struct snd_ac97 * ac97)
+static int patch_ad1881(struct snd_ac97 *ac97)
{
static const char cfg_idxs[3][2] = {
{2, 1},
{0, 2},
{0, 1}
};
-
- // patch for Analog Devices
+
+ /* patch for Analog Devices */
unsigned short codecs[3];
unsigned short val;
int idx, num;
@@ -1597,7 +1597,7 @@ static int patch_ad1881(struct snd_ac97 * ac97)
codecs[1] = patch_ad1881_unchained(ac97, 1, (1<<14));
codecs[2] = patch_ad1881_unchained(ac97, 2, (1<<13));
- if (! (codecs[0] || codecs[1] || codecs[2]))
+ if (!(codecs[0] || codecs[1] || codecs[2]))
goto __end;
for (idx = 0; idx < 3; idx++)
@@ -1613,7 +1613,7 @@ static int patch_ad1881(struct snd_ac97 * ac97)
ac97->scaps |= AC97_SCAP_CENTER_LFE_DAC;
}
- __end:
+__end:
/* select all codecs */
snd_ac97_update_bits(ac97, AC97_AD_SERIAL_CFG, 0x7000, 0x7000);
/* check if only one codec is present */
@@ -1623,8 +1623,8 @@ static int patch_ad1881(struct snd_ac97 * ac97)
if (num == 1) {
/* ok, deselect all ID bits */
snd_ac97_write_cache(ac97, AC97_AD_CODEC_CFG, 0x0000);
- ac97->spec.ad18xx.codec_cfg[0] =
- ac97->spec.ad18xx.codec_cfg[1] =
+ ac97->spec.ad18xx.codec_cfg[0] =
+ ac97->spec.ad18xx.codec_cfg[1] =
ac97->spec.ad18xx.codec_cfg[2] = 0x0000;
}
/* required for AD1886/AD1885 combination */
@@ -1648,7 +1648,7 @@ static const struct snd_kcontrol_new snd_ac97_controls_ad1885[] = {
static const DECLARE_TLV_DB_SCALE(db_scale_6bit_6db_max, -8850, 150, 0);
-static int patch_ad1885_specific(struct snd_ac97 * ac97)
+static int patch_ad1885_specific(struct snd_ac97 *ac97)
{
int err;
@@ -1666,7 +1666,7 @@ static struct snd_ac97_build_ops patch_ad1885_build_ops = {
#endif
};
-static int patch_ad1885(struct snd_ac97 * ac97)
+static int patch_ad1885(struct snd_ac97 *ac97)
{
patch_ad1881(ac97);
/* This is required to deal with the Intel D815EEAL2 */
@@ -1679,7 +1679,7 @@ static int patch_ad1885(struct snd_ac97 * ac97)
return 0;
}
-static int patch_ad1886_specific(struct snd_ac97 * ac97)
+static int patch_ad1886_specific(struct snd_ac97 *ac97)
{
reset_tlv(ac97, "Headphone Playback Volume",
db_scale_6bit_6db_max);
@@ -1693,7 +1693,7 @@ static struct snd_ac97_build_ops patch_ad1886_build_ops = {
#endif
};
-static int patch_ad1886(struct snd_ac97 * ac97)
+static int patch_ad1886(struct snd_ac97 *ac97)
{
patch_ad1881(ac97);
/* Presario700 workaround */
@@ -1847,7 +1847,7 @@ static const struct snd_kcontrol_new snd_ac97_ad198x_spdif_source = {
.put = snd_ac97_ad198x_spdif_source_put,
};
-static int patch_ad198x_post_spdif(struct snd_ac97 * ac97)
+static int patch_ad198x_post_spdif(struct snd_ac97 *ac97)
{
return patch_build_controls(ac97, &snd_ac97_ad198x_spdif_source, 1);
}
@@ -1882,7 +1882,7 @@ static int check_list(struct snd_ac97 *ac97, const unsigned int *list)
return 0;
}
-static int patch_ad1981a_specific(struct snd_ac97 * ac97)
+static int patch_ad1981a_specific(struct snd_ac97 *ac97)
{
if (check_list(ac97, ad1981_jacks_blacklist))
return 0;
@@ -2092,10 +2092,10 @@ static struct snd_ac97_build_ops patch_ad1888_build_ops = {
.update_jacks = ad1888_update_jacks,
};
-static int patch_ad1888(struct snd_ac97 * ac97)
+static int patch_ad1888(struct snd_ac97 *ac97)
{
unsigned short misc;
-
+
patch_ad1881(ac97);
ac97->build_ops = &patch_ad1888_build_ops;
@@ -2141,7 +2141,7 @@ static struct snd_ac97_build_ops patch_ad1980_build_ops = {
.update_jacks = ad1888_update_jacks,
};
-static int patch_ad1980(struct snd_ac97 * ac97)
+static int patch_ad1980(struct snd_ac97 *ac97)
{
patch_ad1888(ac97);
ac97->build_ops = &patch_ad1980_build_ops;
@@ -2175,7 +2175,7 @@ static int snd_ac97_ad1985_vrefout_get(struct snd_kcontrol *kcontrol,
return 0;
}
-static int snd_ac97_ad1985_vrefout_put(struct snd_kcontrol *kcontrol,
+static int snd_ac97_ad1985_vrefout_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
static const int ctrl2reg[4] = {1, 2, 0, 3};
@@ -2256,10 +2256,10 @@ static struct snd_ac97_build_ops patch_ad1985_build_ops = {
.update_jacks = ad1985_update_jacks,
};
-static int patch_ad1985(struct snd_ac97 * ac97)
+static int patch_ad1985(struct snd_ac97 *ac97)
{
unsigned short misc;
-
+
patch_ad1881(ac97);
ac97->build_ops = &patch_ad1985_build_ops;
misc = snd_ac97_read(ac97, AC97_AD_MISC);
@@ -2548,7 +2548,7 @@ static struct snd_ac97_build_ops patch_ad1986_build_ops = {
.update_jacks = ad1986_update_jacks,
};
-static int patch_ad1986(struct snd_ac97 * ac97)
+static int patch_ad1986(struct snd_ac97 *ac97)
{
patch_ad1881(ac97);
ac97->build_ops = &patch_ad1986_build_ops;
@@ -2575,7 +2575,7 @@ static int patch_alc203(struct snd_ac97 *ac97)
static void alc650_update_jacks(struct snd_ac97 *ac97)
{
int shared;
-
+
/* shared Line-In / Surround Out */
shared = is_shared_surrout(ac97);
snd_ac97_update_bits(ac97, AC97_ALC650_MULTICH, 1 << 9,
@@ -2628,7 +2628,7 @@ static const struct snd_kcontrol_new snd_ac97_spdif_controls_alc650[] = {
static const DECLARE_TLV_DB_SCALE(db_scale_5bit_3db_max, -4350, 150, 0);
-static int patch_alc650_specific(struct snd_ac97 * ac97)
+static int patch_alc650_specific(struct snd_ac97 *ac97)
{
int err;
@@ -2649,7 +2649,7 @@ static struct snd_ac97_build_ops patch_alc650_ops = {
.update_jacks = alc650_update_jacks
};
-static int patch_alc650(struct snd_ac97 * ac97)
+static int patch_alc650(struct snd_ac97 *ac97)
{
unsigned short val;
@@ -2672,7 +2672,7 @@ static int patch_alc650(struct snd_ac97 * ac97)
ac97->id == 0x414c4723);
/* enable AC97_ALC650_GPIO_SETUP, AC97_ALC650_CLOCK for R/W */
- snd_ac97_write_cache(ac97, AC97_ALC650_GPIO_STATUS,
+ snd_ac97_write_cache(ac97, AC97_ALC650_GPIO_STATUS,
snd_ac97_read(ac97, AC97_ALC650_GPIO_STATUS) | 0x8000);
/* Enable SPDIF-IN only on Rev.E and above */
@@ -2680,7 +2680,7 @@ static int patch_alc650(struct snd_ac97 * ac97)
/* SPDIF IN with pin 47 */
if (ac97->spec.dev_flags &&
/* ASUS A6KM requires EAPD */
- ! (ac97->subsystem_vendor == 0x1043 &&
+ !(ac97->subsystem_vendor == 0x1043 &&
ac97->subsystem_device == 0x1103))
val |= 0x03; /* enable */
else
@@ -2710,7 +2710,7 @@ static int patch_alc650(struct snd_ac97 * ac97)
static void alc655_update_jacks(struct snd_ac97 *ac97)
{
int shared;
-
+
/* shared Line-In / Surround Out */
shared = is_shared_surrout(ac97);
ac97_update_bits_page(ac97, AC97_ALC650_MULTICH, 1 << 9,
@@ -2783,7 +2783,7 @@ static const struct snd_kcontrol_new snd_ac97_spdif_controls_alc655[] = {
},
};
-static int patch_alc655_specific(struct snd_ac97 * ac97)
+static int patch_alc655_specific(struct snd_ac97 *ac97)
{
int err;
@@ -2801,7 +2801,7 @@ static struct snd_ac97_build_ops patch_alc655_ops = {
.update_jacks = alc655_update_jacks
};
-static int patch_alc655(struct snd_ac97 * ac97)
+static int patch_alc655(struct snd_ac97 *ac97)
{
unsigned int val;
@@ -2862,7 +2862,7 @@ static void alc850_update_jacks(struct snd_ac97 *ac97)
{
int shared;
int aux_is_back_surround;
-
+
/* shared Line-In / Surround Out */
shared = is_shared_surrout(ac97);
/* SURR 1kOhm (bit4), Amp (bit5) */
@@ -2963,7 +2963,7 @@ static const struct snd_kcontrol_new snd_ac97_cm9738_controls[] = {
AC97_CHANNEL_MODE_4CH_CTL,
};
-static int patch_cm9738_specific(struct snd_ac97 * ac97)
+static int patch_cm9738_specific(struct snd_ac97 *ac97)
{
return patch_build_controls(ac97, snd_ac97_cm9738_controls, ARRAY_SIZE(snd_ac97_cm9738_controls));
}
@@ -2973,7 +2973,7 @@ static struct snd_ac97_build_ops patch_cm9738_ops = {
.update_jacks = cm9738_update_jacks
};
-static int patch_cm9738(struct snd_ac97 * ac97)
+static int patch_cm9738(struct snd_ac97 *ac97)
{
ac97->build_ops = &patch_cm9738_ops;
/* FIXME: can anyone confirm below? */
@@ -3012,7 +3012,7 @@ static int snd_ac97_cmedia_spdif_playback_source_put(struct snd_kcontrol *kcontr
struct snd_ac97 *ac97 = snd_kcontrol_chip(kcontrol);
return snd_ac97_update_bits(ac97, AC97_CM9739_SPDIF_CTRL,
- 0x01 << 1,
+ 0x01 << 1,
(ucontrol->value.enumerated.item[0] & 0x01) << 1);
}
@@ -3028,7 +3028,7 @@ static const struct snd_kcontrol_new snd_ac97_cm9739_controls_spdif[] = {
/* BIT 2: IG_SPIV */
AC97_SINGLE(SNDRV_CTL_NAME_IEC958("",CAPTURE,NONE) "Valid Switch", AC97_CM9739_SPDIF_CTRL, 2, 1, 0),
/* BIT 3: SPI2F */
- AC97_SINGLE(SNDRV_CTL_NAME_IEC958("",CAPTURE,NONE) "Monitor", AC97_CM9739_SPDIF_CTRL, 3, 1, 0),
+ AC97_SINGLE(SNDRV_CTL_NAME_IEC958("",CAPTURE,NONE) "Monitor", AC97_CM9739_SPDIF_CTRL, 3, 1, 0),
/* BIT 4: SPI2SDI */
AC97_SINGLE(SNDRV_CTL_NAME_IEC958("",CAPTURE,SWITCH), AC97_CM9739_SPDIF_CTRL, 4, 1, 0),
/* BIT 8: SPD32 - 32bit SPDIF - not supported yet */
@@ -3049,12 +3049,12 @@ static const struct snd_kcontrol_new snd_ac97_cm9739_controls[] = {
AC97_CHANNEL_MODE_CTL,
};
-static int patch_cm9739_specific(struct snd_ac97 * ac97)
+static int patch_cm9739_specific(struct snd_ac97 *ac97)
{
return patch_build_controls(ac97, snd_ac97_cm9739_controls, ARRAY_SIZE(snd_ac97_cm9739_controls));
}
-static int patch_cm9739_post_spdif(struct snd_ac97 * ac97)
+static int patch_cm9739_post_spdif(struct snd_ac97 *ac97)
{
return patch_build_controls(ac97, snd_ac97_cm9739_controls_spdif, ARRAY_SIZE(snd_ac97_cm9739_controls_spdif));
}
@@ -3065,7 +3065,7 @@ static struct snd_ac97_build_ops patch_cm9739_ops = {
.update_jacks = cm9739_update_jacks
};
-static int patch_cm9739(struct snd_ac97 * ac97)
+static int patch_cm9739(struct snd_ac97 *ac97)
{
unsigned short val;
@@ -3100,7 +3100,7 @@ static int patch_cm9739(struct snd_ac97 * ac97)
val = snd_ac97_read(ac97, AC97_CM9739_MULTI_CHAN) & (1 << 4);
val |= (1 << 3);
val |= (1 << 13);
- if (! (ac97->ext_id & AC97_EI_SPDIF))
+ if (!(ac97->ext_id & AC97_EI_SPDIF))
val |= (1 << 14);
snd_ac97_write_cache(ac97, AC97_CM9739_MULTI_CHAN, val);
@@ -3216,19 +3216,19 @@ static const struct snd_kcontrol_new snd_ac97_cm9761_controls_spdif[] = {
/* BIT 2: IG_SPIV */
AC97_SINGLE(SNDRV_CTL_NAME_IEC958("",CAPTURE,NONE) "Valid Switch", AC97_CM9761_SPDIF_CTRL, 2, 1, 0),
/* BIT 3: SPI2F */
- AC97_SINGLE(SNDRV_CTL_NAME_IEC958("",CAPTURE,NONE) "Monitor", AC97_CM9761_SPDIF_CTRL, 3, 1, 0),
+ AC97_SINGLE(SNDRV_CTL_NAME_IEC958("",CAPTURE,NONE) "Monitor", AC97_CM9761_SPDIF_CTRL, 3, 1, 0),
/* BIT 4: SPI2SDI */
AC97_SINGLE(SNDRV_CTL_NAME_IEC958("",CAPTURE,SWITCH), AC97_CM9761_SPDIF_CTRL, 4, 1, 0),
/* BIT 9-10: DAC_CTL */
AC97_ENUM("DAC Clock Source", cm9761_dac_clock_enum),
};
-static int patch_cm9761_post_spdif(struct snd_ac97 * ac97)
+static int patch_cm9761_post_spdif(struct snd_ac97 *ac97)
{
return patch_build_controls(ac97, snd_ac97_cm9761_controls_spdif, ARRAY_SIZE(snd_ac97_cm9761_controls_spdif));
}
-static int patch_cm9761_specific(struct snd_ac97 * ac97)
+static int patch_cm9761_specific(struct snd_ac97 *ac97)
{
return patch_build_controls(ac97, snd_ac97_cm9761_controls, ARRAY_SIZE(snd_ac97_cm9761_controls));
}
@@ -3308,7 +3308,7 @@ static int patch_cm9761(struct snd_ac97 *ac97)
return 0;
}
-
+
#define AC97_CM9780_SIDE 0x60
#define AC97_CM9780_JACK 0x62
#define AC97_CM9780_MIXER 0x64
@@ -3418,7 +3418,7 @@ static int snd_ac97_add_vmaster(struct snd_ac97 *ac97, char *name,
return 0;
}
-static int patch_vt1616_specific(struct snd_ac97 * ac97)
+static int patch_vt1616_specific(struct snd_ac97 *ac97)
{
struct snd_kcontrol *kctl;
int err;
@@ -3453,7 +3453,7 @@ static struct snd_ac97_build_ops patch_vt1616_ops = {
.build_specific = patch_vt1616_specific
};
-static int patch_vt1616(struct snd_ac97 * ac97)
+static int patch_vt1616(struct snd_ac97 *ac97)
{
ac97->build_ops = &patch_vt1616_ops;
return 0;
@@ -3480,7 +3480,7 @@ static int snd_ac97_vt1617a_smart51_info(struct snd_kcontrol *kcontrol,
/* ordering in this list reflects vt1617a docs for Reg 20 and
* 7a and Table 6 that lays out the matrix NB WRT Table6: SM51
* is SM51EN *AND* it's Bit14, not Bit15 so the table is very
- * counter-intuitive */
+ * counter-intuitive */
static const char* texts[] = { "LineIn Mic1", "LineIn Mic1 Mic3",
"Surr LFE/C Mic3", "LineIn LFE/C Mic3",
@@ -3492,18 +3492,18 @@ static int snd_ac97_vt1617a_smart51_info(struct snd_kcontrol *kcontrol,
static int snd_ac97_vt1617a_smart51_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
- ushort usSM51, usMS;
+ ushort usSM51, usMS;
struct snd_ac97 *pac97;
-
+
pac97 = snd_kcontrol_chip(kcontrol); /* grab codec handle */
/* grab our desired bits, then mash them together in a manner
* consistent with Table 6 on page 17 in the 1617a docs */
-
+
usSM51 = snd_ac97_read(pac97, 0x7a) >> 14;
usMS = snd_ac97_read(pac97, 0x20) >> 8;
-
+
ucontrol->value.enumerated.item[0] = (usSM51 << 1) + usMS;
return 0;
@@ -3512,7 +3512,7 @@ static int snd_ac97_vt1617a_smart51_get(struct snd_kcontrol *kcontrol,
static int snd_ac97_vt1617a_smart51_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
- ushort usSM51, usMS, usReg;
+ ushort usSM51, usMS, usReg;
struct snd_ac97 *pac97;
@@ -3548,7 +3548,7 @@ static const struct snd_kcontrol_new snd_ac97_controls_vt1617a[] = {
},
};
-static int patch_vt1617a(struct snd_ac97 * ac97)
+static int patch_vt1617a(struct snd_ac97 *ac97)
{
int err = 0;
int val;
@@ -3793,7 +3793,7 @@ static const struct snd_kcontrol_new snd_ac97_spdif_controls_it2646[] = {
AC97_SINGLE("IEC958 Input Monitor", 0x76, 13, 1, 0),
};
-static int patch_it2646_specific(struct snd_ac97 * ac97)
+static int patch_it2646_specific(struct snd_ac97 *ac97)
{
int err;
if ((err = patch_build_controls(ac97, snd_ac97_controls_it2646, ARRAY_SIZE(snd_ac97_controls_it2646))) < 0)
@@ -3808,7 +3808,7 @@ static struct snd_ac97_build_ops patch_it2646_ops = {
.update_jacks = it2646_update_jacks
};
-static int patch_it2646(struct snd_ac97 * ac97)
+static int patch_it2646(struct snd_ac97 *ac97)
{
ac97->build_ops = &patch_it2646_ops;
/* full DAC volume */
@@ -3828,7 +3828,7 @@ static const struct snd_kcontrol_new snd_ac97_controls_si3036[] = {
AC97_DOUBLE("Modem Speaker Volume", 0x5c, 14, 12, 3, 1)
};
-static int patch_si3036_specific(struct snd_ac97 * ac97)
+static int patch_si3036_specific(struct snd_ac97 *ac97)
{
int idx, err;
for (idx = 0; idx < ARRAY_SIZE(snd_ac97_controls_si3036); idx++)
@@ -3841,10 +3841,10 @@ static struct snd_ac97_build_ops patch_si3036_ops = {
.build_specific = patch_si3036_specific,
};
-static int mpatch_si3036(struct snd_ac97 * ac97)
+static int mpatch_si3036(struct snd_ac97 *ac97)
{
ac97->build_ops = &patch_si3036_ops;
- snd_ac97_write_cache(ac97, 0x5c, 0xf210 );
+ snd_ac97_write_cache(ac97, 0x5c, 0xf210);
snd_ac97_write_cache(ac97, 0x68, 0);
return 0;
}
@@ -3879,7 +3879,7 @@ static int patch_lm4550(struct snd_ac97 *ac97)
return 0;
}
-/*
+/*
* UCB1400 codec (http://www.semiconductors.philips.com/acrobat_download/datasheets/UCB1400-0…)
*/
static const struct snd_kcontrol_new snd_ac97_controls_ucb1400[] = {
@@ -3895,7 +3895,7 @@ AC97_SINGLE("DC Filter", 0x6a, 4, 1, 0),
AC97_SINGLE("Smart Low Power Mode", 0x6c, 4, 3, 0),
};
-static int patch_ucb1400_specific(struct snd_ac97 * ac97)
+static int patch_ucb1400_specific(struct snd_ac97 *ac97)
{
int idx, err;
for (idx = 0; idx < ARRAY_SIZE(snd_ac97_controls_ucb1400); idx++)
@@ -3908,7 +3908,7 @@ static struct snd_ac97_build_ops patch_ucb1400_ops = {
.build_specific = patch_ucb1400_specific,
};
-static int patch_ucb1400(struct snd_ac97 * ac97)
+static int patch_ucb1400(struct snd_ac97 *ac97)
{
ac97->build_ops = &patch_ucb1400_ops;
/* enable headphone driver and smart low power mode by default */
diff --git a/sound/pci/ac97/ac97_pcm.c b/sound/pci/ac97/ac97_pcm.c
index 48cbda9..cb86273 100644
--- a/sound/pci/ac97/ac97_pcm.c
+++ b/sound/pci/ac97/ac97_pcm.c
@@ -175,7 +175,7 @@ static int set_spdif_rate(struct snd_ac97 *ac97, unsigned short rate)
unsigned short old, bits, reg, mask;
unsigned int sbits;
- if (! (ac97->ext_id & AC97_EI_SPDIF))
+ if (!(ac97->ext_id & AC97_EI_SPDIF))
return -ENODEV;
/* TODO: double rate support */
@@ -258,7 +258,7 @@ int snd_ac97_set_rate(struct snd_ac97 *ac97, int reg, unsigned int rate)
{
int dbl;
unsigned int tmp;
-
+
dbl = rate > 48000;
if (dbl) {
if (!(ac97->flags & AC97_DOUBLE_RATE))
@@ -281,11 +281,11 @@ int snd_ac97_set_rate(struct snd_ac97 *ac97, int reg, unsigned int rate)
return -EINVAL;
break;
case AC97_PCM_SURR_DAC_RATE:
- if (! (ac97->scaps & AC97_SCAP_SURROUND_DAC))
+ if (!(ac97->scaps & AC97_SCAP_SURROUND_DAC))
return -EINVAL;
break;
case AC97_PCM_LFE_DAC_RATE:
- if (! (ac97->scaps & AC97_SCAP_CENTER_LFE_DAC))
+ if (!(ac97->scaps & AC97_SCAP_CENTER_LFE_DAC))
return -EINVAL;
break;
case AC97_SPDIF:
@@ -618,7 +618,7 @@ int snd_ac97_pcm_open(struct ac97_pcm *pcm, unsigned int rate,
}
if (reg_ok[cidx] & (1 << (reg - AC97_PCM_FRONT_DAC_RATE)))
continue;
- //printk(KERN_DEBUG "setting ac97 reg 0x%x to rate %d\n", reg, rate);
+ /* printk(KERN_DEBUG "setting ac97 reg 0x%x to rate %d\n", reg, rate); */
err = snd_ac97_set_rate(pcm->r[r].codec[cidx], reg, rate);
if (err < 0)
snd_printk(KERN_ERR "error in snd_ac97_set_rate: cidx=%d, reg=0x%x, rate=%d, err=%d\n", cidx, reg, rate, err);
diff --git a/sound/pci/ac97/ac97_proc.c b/sound/pci/ac97/ac97_proc.c
index 060ea59..11f7e50 100644
--- a/sound/pci/ac97/ac97_proc.c
+++ b/sound/pci/ac97/ac97_proc.c
@@ -140,7 +140,7 @@ static void snd_ac97_proc_read_main(struct snd_ac97 *ac97, struct snd_info_buffe
AC97_PAGE_MASK, val & AC97_PAGE_MASK);
}
- // val = snd_ac97_read(ac97, AC97_RESET);
+ /* val = snd_ac97_read(ac97, AC97_RESET); */
val = ac97->caps;
snd_iprintf(buffer, "Capabilities :%s%s%s%s%s%s\n",
val & AC97_BC_DEDICATED_MIC ? " -dedicated MIC PCM IN channel-" : "",
@@ -188,7 +188,7 @@ static void snd_ac97_proc_read_main(struct snd_ac97 *ac97, struct snd_info_buffe
ext = snd_ac97_read(ac97, AC97_EXTENDED_ID);
if (ext == 0)
goto __modem;
-
+
snd_iprintf(buffer, "Extended ID : codec=%i rev=%i%s%s%s%s DSA=%i%s%s%s%s\n",
(ext & AC97_EI_ADDR_MASK) >> AC97_EI_ADDR_SHIFT,
(ext & AC97_EI_REV_MASK) >> AC97_EI_REV_SHIFT,
@@ -295,11 +295,11 @@ static void snd_ac97_proc_read_main(struct snd_ac97 *ac97, struct snd_info_buffe
}
- __modem:
+__modem:
mext = snd_ac97_read(ac97, AC97_EXTENDED_MID);
if (mext == 0)
return;
-
+
snd_iprintf(buffer, "Extended modem ID: codec=%i%s%s%s%s%s\n",
(mext & AC97_MEI_ADDR_MASK) >> AC97_MEI_ADDR_SHIFT,
mext & AC97_MEI_CID2 ? " CID2" : "",
@@ -342,9 +342,9 @@ static void snd_ac97_proc_read_main(struct snd_ac97 *ac97, struct snd_info_buffe
static void snd_ac97_proc_read(struct snd_info_entry *entry, struct snd_info_buffer *buffer)
{
struct snd_ac97 *ac97 = entry->private_data;
-
+
mutex_lock(&ac97->page_mutex);
- if ((ac97->id & 0xffffff40) == AC97_ID_AD1881) { // Analog Devices AD1881/85/86
+ if ((ac97->id & 0xffffff40) == AC97_ID_AD1881) { /* Analog Devices AD1881/85/86 */
int idx;
for (idx = 0; idx < 3; idx++)
if (ac97->spec.ad18xx.id[idx]) {
@@ -356,7 +356,7 @@ static void snd_ac97_proc_read(struct snd_info_entry *entry, struct snd_info_buf
}
/* select all codecs */
snd_ac97_update_bits(ac97, AC97_AD_SERIAL_CFG, 0x7000, 0x7000);
-
+
snd_iprintf(buffer, "\nAD18XX configuration\n");
snd_iprintf(buffer, "Unchained : 0x%04x,0x%04x,0x%04x\n",
ac97->spec.ad18xx.unchained[0],
@@ -401,13 +401,13 @@ static void snd_ac97_proc_regs_read_main(struct snd_ac97 *ac97, struct snd_info_
}
}
-static void snd_ac97_proc_regs_read(struct snd_info_entry *entry,
+static void snd_ac97_proc_regs_read(struct snd_info_entry *entry,
struct snd_info_buffer *buffer)
{
struct snd_ac97 *ac97 = entry->private_data;
mutex_lock(&ac97->page_mutex);
- if ((ac97->id & 0xffffff40) == AC97_ID_AD1881) { // Analog Devices AD1881/85/86
+ if ((ac97->id & 0xffffff40) == AC97_ID_AD1881) { /* Analog Devices AD1881/85/86 */
int idx;
for (idx = 0; idx < 3; idx++)
@@ -421,11 +421,11 @@ static void snd_ac97_proc_regs_read(struct snd_info_entry *entry,
snd_ac97_update_bits(ac97, AC97_AD_SERIAL_CFG, 0x7000, 0x7000);
} else {
snd_ac97_proc_regs_read_main(ac97, buffer, 0);
- }
+ }
mutex_unlock(&ac97->page_mutex);
}
-void snd_ac97_proc_init(struct snd_ac97 * ac97)
+void snd_ac97_proc_init(struct snd_ac97 *ac97)
{
struct snd_info_entry *entry;
char name[32];
@@ -458,7 +458,7 @@ void snd_ac97_proc_init(struct snd_ac97 * ac97)
ac97->proc_regs = entry;
}
-void snd_ac97_proc_done(struct snd_ac97 * ac97)
+void snd_ac97_proc_done(struct snd_ac97 *ac97)
{
snd_info_free_entry(ac97->proc_regs);
ac97->proc_regs = NULL;
2
4
Hi group,
I am making progress with my ALSA apps but in the process I have found
a few bugs.
One of them is in the documentation.
In
http://www.alsa-project.org/alsa-doc/alsa-lib/group___p_c_m.html#g692ad9e59…
Under Parameters=> 'Size frames to be written' should be 'frames to be
read'.
Just FYI.
--
William Estrada
MrUmunhum(a)popdial.com
Mt-Umunhum-Wireless.net ( http://Mt-Umunhum-Wireless.net )
Ymessenger: MrUmunhum
4
3
Hi,
what is the current status in the development of the native emu20k1, (
for the low-end X-fis , Gamer, Music... ) driver?
thanks
- CU beomuex
3
2
[alsa-devel] [PATCH 1/2] ca0106 playback 44100Hz support to SPDIF and playback format & rate constraints
by Ben Stanley 10 Sep '08
by Ben Stanley 10 Sep '08
10 Sep '08
Dear list,
This patch provides the ability to play back digital audio via SPDIF at
a sampling rate of 44100Hz. It also implements rate constraints to
ensure that the hardware restrictions of the card are not violated. Note
that if 44100Hz is used, then all used channels must use that frequency.
For example, opening hw:0,0 at 48000 and then opening hw:0,1 at 44100
will fail due to constraints. However, you may successfully open both
hw:0,0 and hw:0,1 at 44100 (presume no other channels open). Further
details of the restriction may be found in the thread
http://thread.gmane.org/gmane.linux.alsa.devel/52149/focus=52345
This patch also implements playback format restrictions, such that only
one playback format may be in use at any time.
I tested driver playback using the attached script
(Test_ca0106_driver.sh). I get good audio output for all combinations of
sampling rates and formats except for 192kHz S16 (as noted at the end of
the script). Sometimes it works and sometimes it doesn't. The reason for
the failure is not apparent at this time. It could have something to do
with my receiver. I don't know.
The attached script also checks and validates that the rate and format
constraints operate as required.
I periodically have trouble with this driver not producing sound output.
This has been investigated and the cause is explained here
http://thread.gmane.org/gmane.linux.alsa.devel/55384/focus=55410
I intend to submit a new patch to address this in the future.
This patch has been in use for three months on my MythTV system (Ubuntu
8.04). I find it works reliably for me. I also use it with xine, aplay,
mplayer, mame, and childsplay.
I have checked with checkpatch.pl . Patch is against v1.0.18rc1.
Signed-off-by: Ben Stanley Ben.Stanley(a)exemail.com.au
This is the patch against alsa-kmirror.
---
pci/ca0106/ca0106.h | 7 +-
pci/ca0106/ca0106_main.c | 266 ++++++++++++++++++++++++++++++++++++++--------
2 files changed, 229 insertions(+), 44 deletions(-)
diff --git a/pci/ca0106/ca0106.h b/pci/ca0106/ca0106.h
index 74175fc..376fa9c 100644
--- a/pci/ca0106/ca0106.h
+++ b/pci/ca0106/ca0106.h
@@ -1,7 +1,7 @@
/*
* Copyright (c) 2004 James Courtier-Dutton <James(a)superbug.demon.co.uk>
* Driver CA0106 chips. e.g. Sound Blaster Audigy LS and Live 24bit
- * Version: 0.0.22
+ * Version: 0.0.23
*
* FEATURES currently supported:
* See ca0106_main.c for features.
@@ -49,6 +49,8 @@
* Implement support for Line-in capture on SB Live 24bit.
* 0.0.22
* Add support for mute control on SB Live 24bit (cards w/ SPI DAC)
+ * 0.0.23
+ * Add support for playback sampling rate and format constraints.
*
*
* This code was initally based on code from ALSA's emu10k1x.c which is:
@@ -644,6 +646,8 @@
#include "ca_midi.h"
+#define DRVNAME "snd-ca0106"
+
struct snd_ca0106;
struct snd_ca0106_channel {
@@ -659,6 +663,7 @@ struct snd_ca0106_pcm {
struct snd_pcm_substream *substream;
int channel_id;
unsigned short running;
+ unsigned short hw_reserved;
};
struct snd_ca0106_details {
diff --git a/pci/ca0106/ca0106_main.c b/pci/ca0106/ca0106_main.c
index 2f8b28a..33f992b 100644
--- a/pci/ca0106/ca0106_main.c
+++ b/pci/ca0106/ca0106_main.c
@@ -1,7 +1,7 @@
/*
* Copyright (c) 2004 James Courtier-Dutton <James(a)superbug.demon.co.uk>
* Driver CA0106 chips. e.g. Sound Blaster Audigy LS and Live 24bit
- * Version: 0.0.25
+ * Version: 0.0.26
*
* FEATURES currently supported:
* Front, Rear and Center/LFE.
@@ -83,9 +83,14 @@
* Add support for mute control on SB Live 24bit (cards w/ SPI DAC)
* 0.0.25
* Powerdown SPI DAC channels when not in use
+ * 0.0.26 Ben Stanley
+ * Added support for output at 44100Hz rate (SPDIF only).
+ * Implemented constraints system for output rate and format.
*
* BUGS:
* Some stability problems when unloading the snd-ca0106 kernel module.
+ * Some programs fail to produce sound output (tested on SPDIF). See
+ * http://thread.gmane.org/gmane.linux.alsa.devel/55384/focus=55410
* --
*
* TODO:
@@ -145,6 +150,7 @@
#include <sound/core.h>
#include <sound/initval.h>
#include <sound/pcm.h>
+#include <sound/pcm_params.h>
#include <sound/ac97_codec.h>
#include <sound/info.h>
@@ -284,9 +290,9 @@ static struct snd_pcm_hardware snd_ca0106_playback_hw = {
SNDRV_PCM_INFO_MMAP_VALID |
SNDRV_PCM_INFO_SYNC_START,
.formats = SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S32_LE,
- .rates = (SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_96000 |
- SNDRV_PCM_RATE_192000),
- .rate_min = 48000,
+ .rates = (SNDRV_PCM_RATE_44100 | SNDRV_PCM_RATE_48000 |
+ SNDRV_PCM_RATE_96000 | SNDRV_PCM_RATE_192000),
+ .rate_min = 44100,
.rate_max = 192000,
.channels_min = 2, //1,
.channels_max = 2, //6,
@@ -318,6 +324,111 @@ static struct snd_pcm_hardware snd_ca0106_capture_hw = {
.fifo_size = 0,
};
+static unsigned int all_spdif_playback_rates[] =
+ {44100, 48000, 96000, 192000};
+
+static int hw_rule_playback_rate(
+ struct snd_pcm_hw_params *params,
+ struct snd_pcm_hw_rule *rule)
+{
+ struct snd_ca0106 *chip = rule->private;
+ int chi, any_44100 = 0, any_non_44100 = 0, mask = 0;
+ struct snd_ca0106_channel *chp = 0;
+ struct snd_pcm_runtime *runtime;
+ if (snd_BUG_ON(!chip))
+ return -EINVAL;
+
+ if (chip->spdif_enable) {
+ for (chi = 0; chi < 4; ++chi) {
+ chp = &(chip->playback_channels[chi]);
+ if (!chp->use)
+ continue;
+ if (snd_BUG_ON(!chp->epcm))
+ return -EINVAL;
+ if (!chp->epcm->hw_reserved)
+ continue;
+ if (snd_BUG_ON(!chp->epcm->substream))
+ return -EINVAL;
+ if (snd_BUG_ON(!chp->epcm->substream->runtime))
+ return -EINVAL;
+ runtime = chp->epcm->substream->runtime;
+ snd_printd("snd_hw_rule_playback_rate: ch=%d, "
+ "rate=%d.\n", chi, runtime->rate);
+ any_44100 += runtime->rate == 44100;
+ any_non_44100 += runtime->rate != 44100;
+ }
+ if (snd_BUG_ON(any_44100 && any_non_44100))
+ return -EINVAL;
+ if (any_44100)
+ mask = 0x1;
+ else if (any_non_44100)
+ mask = 0xE;
+ else
+ mask = 0xF;
+ } else {
+ /* 44100Hz is not supported for DAC (FIXME Why?) */
+ mask = 0xE;
+ }
+ snd_printd("snd_hw_rule_playback_rate: any_44100=%d, "
+ "any_non_44100=%d, mask=0x%X, spdif=%d\n",
+ any_44100, any_non_44100, mask, chip->spdif_enable);
+ return snd_interval_list(
+ hw_param_interval(params, SNDRV_PCM_HW_PARAM_RATE),
+ ARRAY_SIZE(all_spdif_playback_rates),
+ all_spdif_playback_rates, mask);
+}
+
+static int hw_rule_playback_format(
+ struct snd_pcm_hw_params *params,
+ struct snd_pcm_hw_rule *rule)
+{
+ struct snd_ca0106 *chip = rule->private;
+ int chi, any_S16 = 0, any_S32 = 0;
+ struct snd_ca0106_channel *chp = 0;
+ struct snd_pcm_runtime *runtime;
+ struct snd_mask fmt, *f = hw_param_mask(
+ params, SNDRV_PCM_HW_PARAM_FORMAT);
+ int result;
+ if (snd_BUG_ON(!chip))
+ return -EINVAL;
+ snd_mask_none(&fmt);
+
+ for (chi = 0; chi < 4; ++chi) {
+ chp = &(chip->playback_channels[chi]);
+ if (!chp->use)
+ continue;
+ if (snd_BUG_ON(!chp->epcm))
+ return -EINVAL;
+ if (!chp->epcm->hw_reserved)
+ continue;
+ if (snd_BUG_ON(!chp->epcm->substream))
+ return -EINVAL;
+ if (snd_BUG_ON(!chp->epcm->substream->runtime))
+ return -EINVAL;
+ runtime = chp->epcm->substream->runtime;
+ snd_printd("snd_hw_rule_playback_format: ch=%d, format=%d.\n",
+ chi, runtime->format);
+ any_S16 += runtime->format == SNDRV_PCM_FORMAT_S16_LE;
+ any_S32 += runtime->format == SNDRV_PCM_FORMAT_S32_LE;
+ }
+ if (snd_BUG_ON(any_S16 && any_S32))
+ return -EINVAL;
+ if (any_S16)
+ snd_mask_set(&fmt, SNDRV_PCM_FORMAT_S16_LE);
+ else if (any_S32)
+ snd_mask_set(&fmt, SNDRV_PCM_FORMAT_S32_LE);
+ else {
+ /* No format yet chosen, so both formats are available. */
+ snd_mask_set(&fmt, SNDRV_PCM_FORMAT_S16_LE);
+ snd_mask_set(&fmt, SNDRV_PCM_FORMAT_S32_LE);
+ }
+ result = snd_mask_refine(f, &fmt);
+ snd_printd("snd_hw_rule_playback_format: any_S16=%d, any_S32=%d, "
+ "refined_fmt=0x%X, avail_fmt=0x%X, changed=%d\n",
+ any_S16, any_S32, f->bits[0], fmt.bits[0], result);
+ return result;
+}
+
unsigned int snd_ca0106_ptr_read(struct snd_ca0106 * emu,
unsigned int reg,
unsigned int chn)
@@ -508,10 +619,24 @@ static int snd_ca0106_pcm_open_playback_channel(struct snd_pcm_substream *substr
//printk("open:channel_id=%d, chip=%p, channel=%p\n",channel_id, chip, channel);
//channel->interrupt = snd_ca0106_pcm_channel_interrupt;
channel->epcm = epcm;
- if ((err = snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS)) < 0)
+ err = snd_pcm_hw_constraint_integer(
+ runtime, SNDRV_PCM_HW_PARAM_PERIODS);
+ if (err < 0)
return err;
- if ((err = snd_pcm_hw_constraint_step(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_BYTES, 64)) < 0)
+ err = snd_pcm_hw_constraint_step(
+ runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_BYTES, 64);
+ if (err < 0)
return err;
+ err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_RATE,
+ hw_rule_playback_rate, (void *)chip,
+ SNDRV_PCM_HW_PARAM_RATE, -1);
+ if (err < 0)
+ return err;
+ err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_FORMAT,
+ hw_rule_playback_format, (void *)chip,
+ SNDRV_PCM_HW_PARAM_FORMAT, -1);
+ if (err < 0)
+ return err;
snd_pcm_set_sync(substream);
if (chip->details->spi_dac && channel_id != PCM_FRONT_CHANNEL) {
@@ -646,6 +771,9 @@ static int snd_ca0106_pcm_hw_params_playback(struct snd_pcm_substream *substream
/* hw_free callback */
static int snd_ca0106_pcm_hw_free_playback(struct snd_pcm_substream *substream)
{
+ struct snd_pcm_runtime *runtime = substream->runtime;
+ struct snd_ca0106_pcm *epcm = runtime->private_data;
+ epcm->hw_reserved = 0;
return snd_pcm_lib_free_pages(substream);
}
@@ -667,53 +795,103 @@ static int snd_ca0106_pcm_hw_free_capture(struct snd_pcm_substream *substream)
static int snd_ca0106_pcm_prepare_playback(struct snd_pcm_substream *substream)
{
struct snd_ca0106 *emu = snd_pcm_substream_chip(substream);
- struct snd_pcm_runtime *runtime = substream->runtime;
+ struct snd_pcm_runtime *runtime = substream->runtime, *runtimei = 0;
struct snd_ca0106_pcm *epcm = runtime->private_data;
- int channel = epcm->channel_id;
+ struct snd_ca0106_channel *chp = 0;
+ int channel = epcm->channel_id, chi, any_44100 = 0, any_non_44100 = 0;
u32 *table_base = (u32 *)(emu->buffer.area+(8*16*channel));
u32 period_size_bytes = frames_to_bytes(runtime, runtime->period_size);
u32 hcfg_mask = HCFG_PLAYBACK_S32_LE;
u32 hcfg_set = 0x00000000;
u32 hcfg;
- u32 reg40_mask = 0x30000 << (channel<<1);
+ u32 reg40_mask = 0xFF0000;
u32 reg40_set = 0;
u32 reg40;
- /* FIXME: Depending on mixer selection of SPDIF out or not, select the spdif rate or the DAC rate. */
- u32 reg71_mask = 0x03030000 ; /* Global. Set SPDIF rate. We only support 44100 to spdif, not to DAC. */
+ u32 reg71_mask;
+ u32 reg71_shift;
u32 reg71_set = 0;
u32 reg71;
int i;
- //snd_printk("prepare:channel_number=%d, rate=%d, format=0x%x, channels=%d, buffer_size=%ld, period_size=%ld, periods=%u, frames_to_bytes=%d\n",channel, runtime->rate, runtime->format, runtime->channels, runtime->buffer_size, runtime->period_size, runtime->periods, frames_to_bytes(runtime, 1));
- //snd_printk("dma_addr=%x, dma_area=%p, table_base=%p\n",runtime->dma_addr, runtime->dma_area, table_base);
- //snd_printk("dma_addr=%x, dma_area=%p, dma_bytes(size)=%x\n",emu->buffer.addr, emu->buffer.area, emu->buffer.bytes);
- /* Rate can be set per channel. */
- /* reg40 control host to fifo */
- /* reg71 controls DAC rate. */
- switch (runtime->rate) {
- case 44100:
- reg40_set = 0x10000 << (channel<<1);
- reg71_set = 0x01010000;
- break;
- case 48000:
- reg40_set = 0;
- reg71_set = 0;
- break;
- case 96000:
- reg40_set = 0x20000 << (channel<<1);
- reg71_set = 0x02020000;
- break;
- case 192000:
- reg40_set = 0x30000 << (channel<<1);
- reg71_set = 0x03030000;
- break;
- default:
- reg40_set = 0;
- reg71_set = 0;
- break;
+ epcm->hw_reserved = 1;
+ /* FIXME CLEAN UP IF spdif_enable IS CHANGED WHILE CHANNELS ARE OPENED
+ * OR PREVENT THIS FROM HAPPENING. */
+ if (emu->spdif_enable)
+ reg71_shift = 24; /* SPDIF Output Rate */
+ else
+ reg71_shift = 16; /* I2S Output Rate */
+ reg71_mask = 0x3 << reg71_shift;
+
+ printk(KERN_DEBUG DRVNAME ": prepare_playback: "
+ "channel_number=%d, rate=%d, format=0x%x, channels=%d, "
+ "buffer_size=%ld,period_size=%ld, periods=%u, "
+ "frames_to_bytes=%d\n",
+ channel, runtime->rate, runtime->format, runtime->channels,
+ runtime->buffer_size, runtime->period_size, runtime->periods,
+ frames_to_bytes(runtime, 1));
+ /*printk("dma_addr=%x, dma_area=%p, table_base=%p\n",
+ runtime->dma_addr,runtime->dma_area, table_base);*/
+ /*printk("dma_addr=%x, dma_area=%p, dma_bytes(size)=%x\n",
+ emu->buffer.addr,emu->buffer.area, emu->buffer.bytes);*/
+ /* We are forced to build the settings for all the channels. */
+ for (chi = 0; chi < 4; ++chi) {
+ chp = &(emu->playback_channels[chi]);
+ if (!chp->use)
+ continue;
+ if (snd_BUG_ON(!chp->epcm))
+ return -EINVAL;
+ if (chi != channel && !chp->epcm->hw_reserved)
+ continue;
+ if (snd_BUG_ON(!chp->epcm->substream))
+ return -EINVAL;
+ if (snd_BUG_ON(!chp->epcm->substream->runtime))
+ return -EINVAL;
+ runtimei = chp->epcm->substream->runtime;
+ any_44100 += runtimei->rate == 44100;
+ any_non_44100 += runtimei->rate != 44100;
+ /* Rate can be set per channel. */
+ /* reg40 control host to fifo */
+ /* reg71 controls DAC rate. */
+ switch (runtimei->rate) {
+ case 44100:
+ /* We only support 44100 to spdif, not to DAC.
+ (FIXME WHY?)*/
+ if (emu->spdif_enable) {
+ /* When using 44100, *all* channels
+ must be set to that rate. */
+ reg40_set |= 0x550000;
+ reg71_set |= 0x1 << reg71_shift;
+ break;
+ } else {
+ printk(KERN_ERR DRVNAME
+ "prepare_playback: "
+ "44100Hz is invalid for DAC.\n");
+ }
+ case 48000:
+ /* reg40_set &= !(0x1 << (chi<<1)); */
+ /* reg71_set &= !(0x1 << reg71_shift); */
+ break;
+ case 96000:
+ reg40_set |= 0x20000 << (chi<<1);
+ reg71_set |= 0x2 << reg71_shift;
+ break;
+ case 192000:
+ reg40_set |= 0x30000 << (chi<<1);
+ reg71_set |= 0x3 << reg71_shift;
+ break;
+ default:
+ printk(KERN_ERR DRVNAME
+ ": prepare_playback: "
+ "Bad sampling frequency %d.\n",
+ runtimei->rate);
+ }
}
- /* Format is a global setting */
- /* FIXME: Only let the first channel accessed set this. */
+ printk(KERN_DEBUG DRVNAME ": prepare_playback: any_44100=%d, "
+ "any_non_44100=%d, spdif=%d.\n",
+ any_44100, any_non_44100, emu->spdif_enable);
+ /* Format is a global setting. */
+ /* Only the first channel accessed can set this
+ (enforced by constraints). */
switch (runtime->format) {
case SNDRV_PCM_FORMAT_S16_LE:
hcfg_set = 0;
@@ -1363,8 +1541,8 @@ static int __devinit snd_ca0106_create(int dev, struct snd_card *card,
pci_read_config_dword(pci, PCI_SUBSYSTEM_VENDOR_ID, &chip->serial);
pci_read_config_word(pci, PCI_SUBSYSTEM_ID, &chip->model);
#if 1
- printk(KERN_INFO "snd-ca0106: Model %04x Rev %08x Serial %08x\n", chip->model,
- pci->revision, chip->serial);
+ printk(KERN_INFO DRVNAME ": Model %04x Rev %08x Serial %08x\n",
+ chip->model, pci->revision, chip->serial);
#endif
strcpy(card->driver, "CA0106");
strcpy(card->shortname, "CA0106");
@@ -1378,7 +1556,9 @@ static int __devinit snd_ca0106_create(int dev, struct snd_card *card,
}
chip->details = c;
if (subsystem[dev]) {
- printk(KERN_INFO "snd-ca0106: Sound card name=%s, subsystem=0x%x. Forced to subsystem=0x%x\n",
+ printk(KERN_INFO DRVNAME
+ ": Sound card name=%s, subsystem=0x%x. "
+ "Forced to subsystem=0x%x\n",
c->name, chip->serial, subsystem[dev]);
}
--
1.5.4.3
5
15