diff --git a/[refs] b/[refs] index 20d189247cbe..96ab5e20bf86 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 0f101fa6bccdc797ddcee40fd4c55e879155a40f +refs/heads/master: c4dc5071859bf666a5a9d6565f16c51a261a88b7 diff --git a/trunk/include/sound/core.h b/trunk/include/sound/core.h index 7e5589472681..e5eec5f73502 100644 --- a/trunk/include/sound/core.h +++ b/trunk/include/sound/core.h @@ -388,13 +388,9 @@ void snd_verbose_printd(const char *file, int line, const char *format, ...) #else /* !CONFIG_SND_DEBUG */ -#define snd_printd(fmt, args...) do { } while (0) -#define snd_BUG() do { } while (0) -static inline int __snd_bug_on(void) -{ - return 0; -} -#define snd_BUG_ON(cond) __snd_bug_on() /* always false */ +#define snd_printd(fmt, args...) /* nothing */ +#define snd_BUG() /* nothing */ +#define snd_BUG_ON(cond) ({/*(void)(cond);*/ 0;}) /* always false */ #endif /* CONFIG_SND_DEBUG */ diff --git a/trunk/include/sound/soc-dapm.h b/trunk/include/sound/soc-dapm.h index ca699a3017f3..c1b26fcc0b5c 100644 --- a/trunk/include/sound/soc-dapm.h +++ b/trunk/include/sound/soc-dapm.h @@ -240,7 +240,6 @@ int snd_soc_dapm_sys_add(struct device *dev); /* dapm audio pin control and status */ int snd_soc_dapm_enable_pin(struct snd_soc_codec *codec, char *pin); int snd_soc_dapm_disable_pin(struct snd_soc_codec *codec, char *pin); -int snd_soc_dapm_nc_pin(struct snd_soc_codec *codec, char *pin); int snd_soc_dapm_get_pin_status(struct snd_soc_codec *codec, char *pin); int snd_soc_dapm_sync(struct snd_soc_codec *codec); diff --git a/trunk/sound/aoa/soundbus/core.c b/trunk/sound/aoa/soundbus/core.c index fa8ab2815a98..f84f3e505788 100644 --- a/trunk/sound/aoa/soundbus/core.c +++ b/trunk/sound/aoa/soundbus/core.c @@ -176,7 +176,7 @@ int soundbus_add_one(struct soundbus_dev *dev) return -EINVAL; } - dev_set_name(&dev->ofdev.dev, "soundbus:%x", ++devcount); + snprintf(dev->ofdev.dev.bus_id, BUS_ID_SIZE, "soundbus:%x", ++devcount); dev->ofdev.dev.bus = &soundbus_bus_type; return of_device_register(&dev->ofdev); } diff --git a/trunk/sound/aoa/soundbus/i2sbus/i2sbus-core.c b/trunk/sound/aoa/soundbus/i2sbus/i2sbus-core.c index b4590df07466..e6beb92c6933 100644 --- a/trunk/sound/aoa/soundbus/i2sbus/i2sbus-core.c +++ b/trunk/sound/aoa/soundbus/i2sbus/i2sbus-core.c @@ -159,7 +159,7 @@ static int i2sbus_add_dev(struct macio_dev *macio, struct i2sbus_dev *dev; struct device_node *child = NULL, *sound = NULL; struct resource *r; - int i, layout = 0, rlen, ok = force; + int i, layout = 0, rlen; static const char *rnames[] = { "i2sbus: %s (control)", "i2sbus: %s (tx)", "i2sbus: %s (rx)" }; @@ -192,7 +192,7 @@ static int i2sbus_add_dev(struct macio_dev *macio, layout = *layout_id; snprintf(dev->sound.modalias, 32, "sound-layout-%d", layout); - ok = 1; + force = 1; } } /* for the time being, until we can handle non-layout-id @@ -201,7 +201,7 @@ static int i2sbus_add_dev(struct macio_dev *macio, * When there are two i2s busses and only one has a layout-id, * then this depends on the order, but that isn't important * either as the second one in that case is just a modem. */ - if (!ok) { + if (!force) { kfree(dev); return -ENODEV; } diff --git a/trunk/sound/arm/pxa2xx-ac97-lib.c b/trunk/sound/arm/pxa2xx-ac97-lib.c index 34c1d94f921e..99026dfb81ea 100644 --- a/trunk/sound/arm/pxa2xx-ac97-lib.c +++ b/trunk/sound/arm/pxa2xx-ac97-lib.c @@ -50,7 +50,7 @@ unsigned short pxa2xx_ac97_read(struct snd_ac97 *ac97, unsigned short reg) mutex_lock(&car_mutex); /* set up primary or secondary codec space */ - if (cpu_is_pxa25x() && reg == AC97_GPIO_STATUS) + if ((cpu_is_pxa21x() || cpu_is_pxa25x()) && 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; @@ -90,7 +90,7 @@ void pxa2xx_ac97_write(struct snd_ac97 *ac97, unsigned short reg, mutex_lock(&car_mutex); /* set up primary or secondary codec space */ - if (cpu_is_pxa25x() && reg == AC97_GPIO_STATUS) + if ((cpu_is_pxa21x() || cpu_is_pxa25x()) && 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; @@ -200,7 +200,7 @@ static inline void pxa_ac97_cold_pxa3xx(void) bool pxa2xx_ac97_try_warm_reset(struct snd_ac97 *ac97) { #ifdef CONFIG_PXA25x - if (cpu_is_pxa25x()) + if (cpu_is_pxa21x() || cpu_is_pxa25x()) pxa_ac97_warm_pxa25x(); else #endif @@ -230,7 +230,7 @@ EXPORT_SYMBOL_GPL(pxa2xx_ac97_try_warm_reset); bool pxa2xx_ac97_try_cold_reset(struct snd_ac97 *ac97) { #ifdef CONFIG_PXA25x - if (cpu_is_pxa25x()) + if (cpu_is_pxa21x() || cpu_is_pxa25x()) pxa_ac97_cold_pxa25x(); else #endif @@ -301,7 +301,7 @@ EXPORT_SYMBOL_GPL(pxa2xx_ac97_hw_suspend); int pxa2xx_ac97_hw_resume(void) { - if (cpu_is_pxa25x() || cpu_is_pxa27x()) { + if (cpu_is_pxa21x() || cpu_is_pxa25x() || cpu_is_pxa27x()) { pxa_gpio_mode(GPIO31_SYNC_AC97_MD); pxa_gpio_mode(GPIO30_SDATA_OUT_AC97_MD); pxa_gpio_mode(GPIO28_BITCLK_AC97_MD); @@ -325,7 +325,7 @@ int __devinit pxa2xx_ac97_hw_probe(struct platform_device *dev) if (ret < 0) goto err; - if (cpu_is_pxa25x() || cpu_is_pxa27x()) { + if (cpu_is_pxa21x() || cpu_is_pxa25x() || cpu_is_pxa27x()) { pxa_gpio_mode(GPIO31_SYNC_AC97_MD); pxa_gpio_mode(GPIO30_SDATA_OUT_AC97_MD); pxa_gpio_mode(GPIO28_BITCLK_AC97_MD); diff --git a/trunk/sound/arm/pxa2xx-pcm-lib.c b/trunk/sound/arm/pxa2xx-pcm-lib.c index 75a0d746fb60..1c93eb77cb99 100644 --- a/trunk/sound/arm/pxa2xx-pcm-lib.c +++ b/trunk/sound/arm/pxa2xx-pcm-lib.c @@ -194,7 +194,7 @@ int __pxa2xx_pcm_open(struct snd_pcm_substream *substream) goto out; ret = -ENOMEM; - rtd = kzalloc(sizeof(*rtd), GFP_KERNEL); + rtd = kmalloc(sizeof(*rtd), GFP_KERNEL); if (!rtd) goto out; rtd->dma_desc_array = diff --git a/trunk/sound/core/control.c b/trunk/sound/core/control.c index b0bf42691047..6d71f9a7ccbb 100644 --- a/trunk/sound/core/control.c +++ b/trunk/sound/core/control.c @@ -225,13 +225,8 @@ struct snd_kcontrol *snd_ctl_new1(const struct snd_kcontrol_new *ncontrol, kctl.id.iface = ncontrol->iface; kctl.id.device = ncontrol->device; kctl.id.subdevice = ncontrol->subdevice; - if (ncontrol->name) { + if (ncontrol->name) strlcpy(kctl.id.name, ncontrol->name, sizeof(kctl.id.name)); - if (strcmp(ncontrol->name, kctl.id.name) != 0) - snd_printk(KERN_WARNING - "Control name '%s' truncated to '%s'\n", - ncontrol->name, kctl.id.name); - } kctl.id.index = ncontrol->index; kctl.count = ncontrol->count ? ncontrol->count : 1; access = ncontrol->access == 0 ? SNDRV_CTL_ELEM_ACCESS_READWRITE : diff --git a/trunk/sound/core/jack.c b/trunk/sound/core/jack.c index bd2d9e6b55e9..8133a2b173a5 100644 --- a/trunk/sound/core/jack.c +++ b/trunk/sound/core/jack.c @@ -147,9 +147,6 @@ EXPORT_SYMBOL(snd_jack_set_parent); */ void snd_jack_report(struct snd_jack *jack, int status) { - if (!jack) - return; - if (jack->type & SND_JACK_HEADPHONE) input_report_switch(jack->input_dev, SW_HEADPHONE_INSERT, status & SND_JACK_HEADPHONE); diff --git a/trunk/sound/core/pcm_lib.c b/trunk/sound/core/pcm_lib.c index 921691080f35..6ea5cfb83998 100644 --- a/trunk/sound/core/pcm_lib.c +++ b/trunk/sound/core/pcm_lib.c @@ -908,12 +908,12 @@ int snd_pcm_hw_rule_add(struct snd_pcm_runtime *runtime, unsigned int cond, EXPORT_SYMBOL(snd_pcm_hw_rule_add); /** - * snd_pcm_hw_constraint_mask - apply the given bitmap mask constraint + * snd_pcm_hw_constraint_mask * @runtime: PCM runtime instance * @var: hw_params variable to apply the mask * @mask: the bitmap mask * - * Apply the constraint of the given bitmap mask to a 32-bit mask parameter. + * Apply the constraint of the given bitmap mask to a mask parameter. */ int snd_pcm_hw_constraint_mask(struct snd_pcm_runtime *runtime, snd_pcm_hw_param_t var, u_int32_t mask) @@ -928,12 +928,12 @@ int snd_pcm_hw_constraint_mask(struct snd_pcm_runtime *runtime, snd_pcm_hw_param } /** - * snd_pcm_hw_constraint_mask64 - apply the given bitmap mask constraint + * snd_pcm_hw_constraint_mask64 * @runtime: PCM runtime instance * @var: hw_params variable to apply the mask * @mask: the 64bit bitmap mask * - * Apply the constraint of the given bitmap mask to a 64-bit mask parameter. + * Apply the constraint of the given bitmap mask to a mask parameter. */ int snd_pcm_hw_constraint_mask64(struct snd_pcm_runtime *runtime, snd_pcm_hw_param_t var, u_int64_t mask) @@ -949,7 +949,7 @@ int snd_pcm_hw_constraint_mask64(struct snd_pcm_runtime *runtime, snd_pcm_hw_par } /** - * snd_pcm_hw_constraint_integer - apply an integer constraint to an interval + * snd_pcm_hw_constraint_integer * @runtime: PCM runtime instance * @var: hw_params variable to apply the integer constraint * @@ -964,7 +964,7 @@ int snd_pcm_hw_constraint_integer(struct snd_pcm_runtime *runtime, snd_pcm_hw_pa EXPORT_SYMBOL(snd_pcm_hw_constraint_integer); /** - * snd_pcm_hw_constraint_minmax - apply a min/max range constraint to an interval + * snd_pcm_hw_constraint_minmax * @runtime: PCM runtime instance * @var: hw_params variable to apply the range * @min: the minimal value @@ -995,7 +995,7 @@ static int snd_pcm_hw_rule_list(struct snd_pcm_hw_params *params, /** - * snd_pcm_hw_constraint_list - apply a list of constraints to a parameter + * snd_pcm_hw_constraint_list * @runtime: PCM runtime instance * @cond: condition bits * @var: hw_params variable to apply the list constraint @@ -1031,7 +1031,7 @@ static int snd_pcm_hw_rule_ratnums(struct snd_pcm_hw_params *params, } /** - * snd_pcm_hw_constraint_ratnums - apply ratnums constraint to a parameter + * snd_pcm_hw_constraint_ratnums * @runtime: PCM runtime instance * @cond: condition bits * @var: hw_params variable to apply the ratnums constraint @@ -1064,7 +1064,7 @@ static int snd_pcm_hw_rule_ratdens(struct snd_pcm_hw_params *params, } /** - * snd_pcm_hw_constraint_ratdens - apply ratdens constraint to a parameter + * snd_pcm_hw_constraint_ratdens * @runtime: PCM runtime instance * @cond: condition bits * @var: hw_params variable to apply the ratdens constraint @@ -1095,7 +1095,7 @@ static int snd_pcm_hw_rule_msbits(struct snd_pcm_hw_params *params, } /** - * snd_pcm_hw_constraint_msbits - add a hw constraint msbits rule + * snd_pcm_hw_constraint_msbits * @runtime: PCM runtime instance * @cond: condition bits * @width: sample bits width @@ -1123,7 +1123,7 @@ static int snd_pcm_hw_rule_step(struct snd_pcm_hw_params *params, } /** - * snd_pcm_hw_constraint_step - add a hw constraint step rule + * snd_pcm_hw_constraint_step * @runtime: PCM runtime instance * @cond: condition bits * @var: hw_params variable to apply the step constraint @@ -1154,7 +1154,7 @@ static int snd_pcm_hw_rule_pow2(struct snd_pcm_hw_params *params, struct snd_pcm } /** - * snd_pcm_hw_constraint_pow2 - add a hw constraint power-of-2 rule + * snd_pcm_hw_constraint_pow2 * @runtime: PCM runtime instance * @cond: condition bits * @var: hw_params variable to apply the power-of-2 constraint @@ -1202,13 +1202,13 @@ void _snd_pcm_hw_params_any(struct snd_pcm_hw_params *params) EXPORT_SYMBOL(_snd_pcm_hw_params_any); /** - * snd_pcm_hw_param_value - return @params field @var value + * snd_pcm_hw_param_value * @params: the hw_params instance * @var: parameter to retrieve - * @dir: pointer to the direction (-1,0,1) or %NULL + * @dir: pointer to the direction (-1,0,1) or NULL * - * Return the value for field @var if it's fixed in configuration space - * defined by @params. Return -%EINVAL otherwise. + * Return the value for field PAR if it's fixed in configuration space + * defined by PARAMS. Return -EINVAL otherwise */ int snd_pcm_hw_param_value(const struct snd_pcm_hw_params *params, snd_pcm_hw_param_t var, int *dir) @@ -1271,13 +1271,13 @@ static int _snd_pcm_hw_param_first(struct snd_pcm_hw_params *params, /** - * snd_pcm_hw_param_first - refine config space and return minimum value + * snd_pcm_hw_param_first * @pcm: PCM instance * @params: the hw_params instance * @var: parameter to retrieve - * @dir: pointer to the direction (-1,0,1) or %NULL + * @dir: pointer to the direction (-1,0,1) or NULL * - * Inside configuration space defined by @params remove from @var all + * Inside configuration space defined by PARAMS remove from PAR all * values > minimum. Reduce configuration space accordingly. * Return the minimum. */ @@ -1317,13 +1317,13 @@ static int _snd_pcm_hw_param_last(struct snd_pcm_hw_params *params, /** - * snd_pcm_hw_param_last - refine config space and return maximum value + * snd_pcm_hw_param_last * @pcm: PCM instance * @params: the hw_params instance * @var: parameter to retrieve - * @dir: pointer to the direction (-1,0,1) or %NULL + * @dir: pointer to the direction (-1,0,1) or NULL * - * Inside configuration space defined by @params remove from @var all + * Inside configuration space defined by PARAMS remove from PAR all * values < maximum. Reduce configuration space accordingly. * Return the maximum. */ @@ -1345,11 +1345,11 @@ int snd_pcm_hw_param_last(struct snd_pcm_substream *pcm, EXPORT_SYMBOL(snd_pcm_hw_param_last); /** - * snd_pcm_hw_param_choose - choose a configuration defined by @params + * snd_pcm_hw_param_choose * @pcm: PCM instance * @params: the hw_params instance * - * Choose one configuration from configuration space defined by @params. + * Choose one configuration from configuration space defined by PARAMS * The configuration chosen is that obtained fixing in this order: * first access, first format, first subformat, min channels, * min rate, min period time, max buffer size, min tick time diff --git a/trunk/sound/core/pcm_misc.c b/trunk/sound/core/pcm_misc.c index ea2bf82c9373..89b7f549bebd 100644 --- a/trunk/sound/core/pcm_misc.c +++ b/trunk/sound/core/pcm_misc.c @@ -319,7 +319,6 @@ EXPORT_SYMBOL(snd_pcm_format_physical_width); /** * snd_pcm_format_size - return the byte size of samples on the given format * @format: the format to check - * @samples: sampling rate * * Returns the byte size of the given samples for the format, or a * negative error code if unknown format. diff --git a/trunk/sound/core/pcm_native.c b/trunk/sound/core/pcm_native.c index aef18682c035..e61e12506ded 100644 --- a/trunk/sound/core/pcm_native.c +++ b/trunk/sound/core/pcm_native.c @@ -875,8 +875,10 @@ static struct action_ops snd_pcm_action_start = { }; /** - * snd_pcm_start - start all linked streams + * snd_pcm_start * @substream: the PCM substream instance + * + * Start all linked streams. */ int snd_pcm_start(struct snd_pcm_substream *substream) { @@ -924,11 +926,12 @@ static struct action_ops snd_pcm_action_stop = { }; /** - * snd_pcm_stop - try to stop all running streams in the substream group + * snd_pcm_stop * @substream: the PCM substream instance * @state: PCM state after stopping the stream * - * The state of each stream is then changed to the given state unconditionally. + * Try to stop all running streams in the substream group. + * The state of each stream is changed to the given value after that unconditionally. */ int snd_pcm_stop(struct snd_pcm_substream *substream, int state) { @@ -938,10 +941,11 @@ int snd_pcm_stop(struct snd_pcm_substream *substream, int state) EXPORT_SYMBOL(snd_pcm_stop); /** - * snd_pcm_drain_done - stop the DMA only when the given stream is playback + * snd_pcm_drain_done * @substream: the PCM substream * - * After stopping, the state is changed to SETUP. + * Stop the DMA only when the given stream is playback. + * The state is changed to SETUP. * Unlike snd_pcm_stop(), this affects only the given stream. */ int snd_pcm_drain_done(struct snd_pcm_substream *substream) @@ -1061,9 +1065,10 @@ static struct action_ops snd_pcm_action_suspend = { }; /** - * snd_pcm_suspend - trigger SUSPEND to all linked streams + * snd_pcm_suspend * @substream: the PCM substream * + * Trigger SUSPEND to all linked streams. * After this call, all streams are changed to SUSPENDED state. */ int snd_pcm_suspend(struct snd_pcm_substream *substream) @@ -1083,9 +1088,10 @@ int snd_pcm_suspend(struct snd_pcm_substream *substream) EXPORT_SYMBOL(snd_pcm_suspend); /** - * snd_pcm_suspend_all - trigger SUSPEND to all substreams in the given pcm + * snd_pcm_suspend_all * @pcm: the PCM instance * + * Trigger SUSPEND to all substreams in the given pcm. * After this call, all streams are changed to SUSPENDED state. */ int snd_pcm_suspend_all(struct snd_pcm *pcm) @@ -1307,9 +1313,11 @@ static struct action_ops snd_pcm_action_prepare = { }; /** - * snd_pcm_prepare - prepare the PCM substream to be triggerable + * snd_pcm_prepare * @substream: the PCM substream instance * @file: file to refer f_flags + * + * Prepare the PCM substream to be triggerable. */ static int snd_pcm_prepare(struct snd_pcm_substream *substream, struct file *file) diff --git a/trunk/sound/core/rawmidi.c b/trunk/sound/core/rawmidi.c index 39672f68ce5d..c4995c9f5730 100644 --- a/trunk/sound/core/rawmidi.c +++ b/trunk/sound/core/rawmidi.c @@ -148,8 +148,6 @@ static int snd_rawmidi_runtime_free(struct snd_rawmidi_substream *substream) static inline void snd_rawmidi_output_trigger(struct snd_rawmidi_substream *substream,int up) { - if (!substream->opened) - return; if (up) { tasklet_hi_schedule(&substream->runtime->tasklet); } else { @@ -160,8 +158,6 @@ static inline void snd_rawmidi_output_trigger(struct snd_rawmidi_substream *subs static void snd_rawmidi_input_trigger(struct snd_rawmidi_substream *substream, int up) { - if (!substream->opened) - return; substream->ops->trigger(substream, up); if (!up && substream->runtime->event) tasklet_kill(&substream->runtime->tasklet); @@ -861,8 +857,6 @@ int snd_rawmidi_receive(struct snd_rawmidi_substream *substream, int result = 0, count1; struct snd_rawmidi_runtime *runtime = substream->runtime; - if (!substream->opened) - return -EBADFD; if (runtime->buffer == NULL) { snd_printd("snd_rawmidi_receive: input is not active!!!\n"); return -EINVAL; @@ -1132,8 +1126,6 @@ int snd_rawmidi_transmit_ack(struct snd_rawmidi_substream *substream, int count) int snd_rawmidi_transmit(struct snd_rawmidi_substream *substream, unsigned char *buffer, int count) { - if (!substream->opened) - return -EBADFD; count = snd_rawmidi_transmit_peek(substream, buffer, count); if (count < 0) return count; diff --git a/trunk/sound/drivers/dummy.c b/trunk/sound/drivers/dummy.c index 73be7e14a603..e5e749f3e0ef 100644 --- a/trunk/sound/drivers/dummy.c +++ b/trunk/sound/drivers/dummy.c @@ -51,7 +51,7 @@ static int emu10k1_playback_constraints(struct snd_pcm_runtime *runtime) if (err < 0) return err; err = snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_BUFFER_BYTES, 256, UINT_MAX); - if (err < 0) + if (err) < 0) return err; return 0; } diff --git a/trunk/sound/drivers/ml403-ac97cr.c b/trunk/sound/drivers/ml403-ac97cr.c index 7783843ca9ae..ecdbeb6d3603 100644 --- a/trunk/sound/drivers/ml403-ac97cr.c +++ b/trunk/sound/drivers/ml403-ac97cr.c @@ -1153,7 +1153,7 @@ snd_ml403_ac97cr_create(struct snd_card *card, struct platform_device *pfdev, /* get irq */ irq = platform_get_irq(pfdev, 0); if (request_irq(irq, snd_ml403_ac97cr_irq, IRQF_DISABLED, - dev_name(&pfdev->dev), (void *)ml403_ac97cr)) { + pfdev->dev.bus_id, (void *)ml403_ac97cr)) { snd_printk(KERN_ERR SND_ML403_AC97CR_DRIVER ": " "unable to grab IRQ %d\n", irq); @@ -1166,7 +1166,7 @@ snd_ml403_ac97cr_create(struct snd_card *card, struct platform_device *pfdev, ml403_ac97cr->irq); irq = platform_get_irq(pfdev, 1); if (request_irq(irq, snd_ml403_ac97cr_irq, IRQF_DISABLED, - dev_name(&pfdev->dev), (void *)ml403_ac97cr)) { + pfdev->dev.bus_id, (void *)ml403_ac97cr)) { snd_printk(KERN_ERR SND_ML403_AC97CR_DRIVER ": " "unable to grab IRQ %d\n", irq); diff --git a/trunk/sound/drivers/pcsp/pcsp_input.c b/trunk/sound/drivers/pcsp/pcsp_input.c index 0444cdeb4bec..cd9b83e7f7d1 100644 --- a/trunk/sound/drivers/pcsp/pcsp_input.c +++ b/trunk/sound/drivers/pcsp/pcsp_input.c @@ -24,13 +24,13 @@ static void pcspkr_do_sound(unsigned int count) spin_lock_irqsave(&i8253_lock, flags); if (count) { + /* enable counter 2 */ + outb_p(inb_p(0x61) | 3, 0x61); /* set command for counter 2, 2 byte write */ outb_p(0xB6, 0x43); /* select desired HZ */ outb_p(count & 0xff, 0x42); outb((count >> 8) & 0xff, 0x42); - /* enable counter 2 */ - outb_p(inb_p(0x61) | 3, 0x61); } else { /* disable counter 2 */ outb(inb_p(0x61) & 0xFC, 0x61); diff --git a/trunk/sound/isa/Kconfig b/trunk/sound/isa/Kconfig index ce0aa044e274..660beb41f767 100644 --- a/trunk/sound/isa/Kconfig +++ b/trunk/sound/isa/Kconfig @@ -211,7 +211,7 @@ config SND_GUSCLASSIC config SND_GUSEXTREME tristate "Gravis UltraSound Extreme" - select SND_OPL3_LIB + select SND_HWDEP select SND_MPU401_UART select SND_PCM help diff --git a/trunk/sound/isa/ad1848/ad1848.c b/trunk/sound/isa/ad1848/ad1848.c index 223a6c038819..b68d20edc20f 100644 --- a/trunk/sound/isa/ad1848/ad1848.c +++ b/trunk/sound/isa/ad1848/ad1848.c @@ -70,15 +70,15 @@ static int __devinit snd_ad1848_match(struct device *dev, unsigned int n) return 0; if (port[n] == SNDRV_AUTO_PORT) { - dev_err(dev, "please specify port\n"); + snd_printk(KERN_ERR "%s: please specify port\n", dev->bus_id); return 0; } if (irq[n] == SNDRV_AUTO_IRQ) { - dev_err(dev, "please specify irq\n"); + snd_printk(KERN_ERR "%s: please specify irq\n", dev->bus_id); return 0; } if (dma1[n] == SNDRV_AUTO_DMA) { - dev_err(dev, "please specify dma1\n"); + snd_printk(KERN_ERR "%s: please specify dma1\n", dev->bus_id); return 0; } return 1; diff --git a/trunk/sound/isa/adlib.c b/trunk/sound/isa/adlib.c index 374b7177e111..efa8c80d05b6 100644 --- a/trunk/sound/isa/adlib.c +++ b/trunk/sound/isa/adlib.c @@ -36,7 +36,7 @@ static int __devinit snd_adlib_match(struct device *dev, unsigned int n) return 0; if (port[n] == SNDRV_AUTO_PORT) { - dev_err(dev, "please specify port\n"); + snd_printk(KERN_ERR "%s: please specify port\n", dev->bus_id); return 0; } return 1; @@ -55,13 +55,13 @@ static int __devinit snd_adlib_probe(struct device *dev, unsigned int n) card = snd_card_new(index[n], id[n], THIS_MODULE, 0); if (!card) { - dev_err(dev, "could not create card\n"); + snd_printk(KERN_ERR "%s: could not create card\n", dev->bus_id); return -EINVAL; } card->private_data = request_region(port[n], 4, CRD_NAME); if (!card->private_data) { - dev_err(dev, "could not grab ports\n"); + snd_printk(KERN_ERR "%s: could not grab ports\n", dev->bus_id); error = -EBUSY; goto out; } @@ -73,13 +73,13 @@ static int __devinit snd_adlib_probe(struct device *dev, unsigned int n) error = snd_opl3_create(card, port[n], port[n] + 2, OPL3_HW_AUTO, 1, &opl3); if (error < 0) { - dev_err(dev, "could not create OPL\n"); + snd_printk(KERN_ERR "%s: could not create OPL\n", dev->bus_id); goto out; } error = snd_opl3_hwdep_new(opl3, 0, 0, NULL); if (error < 0) { - dev_err(dev, "could not create FM\n"); + snd_printk(KERN_ERR "%s: could not create FM\n", dev->bus_id); goto out; } @@ -87,7 +87,7 @@ static int __devinit snd_adlib_probe(struct device *dev, unsigned int n) error = snd_card_register(card); if (error < 0) { - dev_err(dev, "could not register card\n"); + snd_printk(KERN_ERR "%s: could not register card\n", dev->bus_id); goto out; } diff --git a/trunk/sound/isa/cs423x/cs4231.c b/trunk/sound/isa/cs423x/cs4231.c index f019d449e2d6..ddd289120aa8 100644 --- a/trunk/sound/isa/cs423x/cs4231.c +++ b/trunk/sound/isa/cs423x/cs4231.c @@ -74,15 +74,15 @@ static int __devinit snd_cs4231_match(struct device *dev, unsigned int n) return 0; if (port[n] == SNDRV_AUTO_PORT) { - dev_err(dev, "please specify port\n"); + snd_printk(KERN_ERR "%s: please specify port\n", dev->bus_id); return 0; } if (irq[n] == SNDRV_AUTO_IRQ) { - dev_err(dev, "please specify irq\n"); + snd_printk(KERN_ERR "%s: please specify irq\n", dev->bus_id); return 0; } if (dma1[n] == SNDRV_AUTO_DMA) { - dev_err(dev, "please specify dma1\n"); + snd_printk(KERN_ERR "%s: please specify dma1\n", dev->bus_id); return 0; } return 1; @@ -133,7 +133,7 @@ static int __devinit snd_cs4231_probe(struct device *dev, unsigned int n) mpu_port[n], 0, mpu_irq[n], mpu_irq[n] >= 0 ? IRQF_DISABLED : 0, NULL) < 0) - dev_warn(dev, "MPU401 not detected\n"); + printk(KERN_WARNING "%s: MPU401 not detected\n", dev->bus_id); } snd_card_set_dev(card, dev); diff --git a/trunk/sound/isa/cs423x/cs4236.c b/trunk/sound/isa/cs423x/cs4236.c index 019c9401663e..91f9c15d3e30 100644 --- a/trunk/sound/isa/cs423x/cs4236.c +++ b/trunk/sound/isa/cs423x/cs4236.c @@ -488,19 +488,19 @@ static int __devinit snd_cs423x_isa_match(struct device *pdev, return 0; if (port[dev] == SNDRV_AUTO_PORT) { - dev_err(pdev, "please specify port\n"); + snd_printk(KERN_ERR "%s: please specify port\n", pdev->bus_id); return 0; } if (cport[dev] == SNDRV_AUTO_PORT) { - dev_err(pdev, "please specify cport\n"); + snd_printk(KERN_ERR "%s: please specify cport\n", pdev->bus_id); return 0; } if (irq[dev] == SNDRV_AUTO_IRQ) { - dev_err(pdev, "please specify irq\n"); + snd_printk(KERN_ERR "%s: please specify irq\n", pdev->bus_id); return 0; } if (dma1[dev] == SNDRV_AUTO_DMA) { - dev_err(pdev, "please specify dma1\n"); + snd_printk(KERN_ERR "%s: please specify dma1\n", pdev->bus_id); return 0; } return 1; diff --git a/trunk/sound/isa/es1688/es1688.c b/trunk/sound/isa/es1688/es1688.c index b46377139cf8..f88639ea64b2 100644 --- a/trunk/sound/isa/es1688/es1688.c +++ b/trunk/sound/isa/es1688/es1688.c @@ -88,14 +88,16 @@ static int __devinit snd_es1688_legacy_create(struct snd_card *card, if (irq[n] == SNDRV_AUTO_IRQ) { irq[n] = snd_legacy_find_free_irq(possible_irqs); if (irq[n] < 0) { - dev_err(dev, "unable to find a free IRQ\n"); + snd_printk(KERN_ERR "%s: unable to find a free IRQ\n", + dev->bus_id); return -EBUSY; } } if (dma8[n] == SNDRV_AUTO_DMA) { dma8[n] = snd_legacy_find_free_dma(possible_dmas); if (dma8[n] < 0) { - dev_err(dev, "unable to find a free DMA\n"); + snd_printk(KERN_ERR "%s: unable to find a free DMA\n", + dev->bus_id); return -EBUSY; } } @@ -145,7 +147,8 @@ static int __devinit snd_es1688_probe(struct device *dev, unsigned int n) if (snd_opl3_create(card, chip->port, chip->port + 2, OPL3_HW_OPL3, 0, &opl3) < 0) - dev_warn(dev, "opl3 not detected at 0x%lx\n", chip->port); + printk(KERN_WARNING "%s: opl3 not detected at 0x%lx\n", + dev->bus_id, chip->port); else { error = snd_opl3_hwdep_new(opl3, 0, 1, NULL); if (error < 0) diff --git a/trunk/sound/isa/gus/gusclassic.c b/trunk/sound/isa/gus/gusclassic.c index 426532a4d730..8f914b37bf89 100644 --- a/trunk/sound/isa/gus/gusclassic.c +++ b/trunk/sound/isa/gus/gusclassic.c @@ -90,21 +90,24 @@ static int __devinit snd_gusclassic_create(struct snd_card *card, if (irq[n] == SNDRV_AUTO_IRQ) { irq[n] = snd_legacy_find_free_irq(possible_irqs); if (irq[n] < 0) { - dev_err(dev, "unable to find a free IRQ\n"); + snd_printk(KERN_ERR "%s: unable to find a free IRQ\n", + dev->bus_id); return -EBUSY; } } if (dma1[n] == SNDRV_AUTO_DMA) { dma1[n] = snd_legacy_find_free_dma(possible_dmas); if (dma1[n] < 0) { - dev_err(dev, "unable to find a free DMA1\n"); + snd_printk(KERN_ERR "%s: unable to find a free DMA1\n", + dev->bus_id); return -EBUSY; } } if (dma2[n] == SNDRV_AUTO_DMA) { dma2[n] = snd_legacy_find_free_dma(possible_dmas); if (dma2[n] < 0) { - dev_err(dev, "unable to find a free DMA2\n"); + snd_printk(KERN_ERR "%s: unable to find a free DMA2\n", + dev->bus_id); return -EBUSY; } } @@ -171,8 +174,8 @@ static int __devinit snd_gusclassic_probe(struct device *dev, unsigned int n) error = -ENODEV; if (gus->max_flag || gus->ess_flag) { - dev_err(dev, "GUS Classic or ACE soundcard was " - "not detected at 0x%lx\n", gus->gf1.port); + snd_printk(KERN_ERR "%s: GUS Classic or ACE soundcard was " + "not detected at 0x%lx\n", dev->bus_id, gus->gf1.port); goto out; } diff --git a/trunk/sound/isa/gus/gusextreme.c b/trunk/sound/isa/gus/gusextreme.c index 7ad4c3b41a84..da13185eb0a0 100644 --- a/trunk/sound/isa/gus/gusextreme.c +++ b/trunk/sound/isa/gus/gusextreme.c @@ -106,14 +106,16 @@ static int __devinit snd_gusextreme_es1688_create(struct snd_card *card, if (irq[n] == SNDRV_AUTO_IRQ) { irq[n] = snd_legacy_find_free_irq(possible_irqs); if (irq[n] < 0) { - dev_err(dev, "unable to find a free IRQ for ES1688\n"); + snd_printk(KERN_ERR "%s: unable to find a free IRQ " + "for ES1688\n", dev->bus_id); return -EBUSY; } } if (dma8[n] == SNDRV_AUTO_DMA) { dma8[n] = snd_legacy_find_free_dma(possible_dmas); if (dma8[n] < 0) { - dev_err(dev, "unable to find a free DMA for ES1688\n"); + snd_printk(KERN_ERR "%s: unable to find a free DMA " + "for ES1688\n", dev->bus_id); return -EBUSY; } } @@ -141,14 +143,16 @@ static int __devinit snd_gusextreme_gus_card_create(struct snd_card *card, if (gf1_irq[n] == SNDRV_AUTO_IRQ) { gf1_irq[n] = snd_legacy_find_free_irq(possible_irqs); if (gf1_irq[n] < 0) { - dev_err(dev, "unable to find a free IRQ for GF1\n"); + snd_printk(KERN_ERR "%s: unable to find a free IRQ " + "for GF1\n", dev->bus_id); return -EBUSY; } } if (dma1[n] == SNDRV_AUTO_DMA) { dma1[n] = snd_legacy_find_free_dma(possible_dmas); if (dma1[n] < 0) { - dev_err(dev, "unable to find a free DMA for GF1\n"); + snd_printk(KERN_ERR "%s: unable to find a free DMA " + "for GF1\n", dev->bus_id); return -EBUSY; } } @@ -274,8 +278,8 @@ static int __devinit snd_gusextreme_probe(struct device *dev, unsigned int n) error = -ENODEV; if (!gus->ess_flag) { - dev_err(dev, "GUS Extreme soundcard was not " - "detected at 0x%lx\n", gus->gf1.port); + snd_printk(KERN_ERR "%s: GUS Extreme soundcard was not " + "detected at 0x%lx\n", dev->bus_id, gus->gf1.port); goto out; } gus->codec_flag = 1; @@ -306,7 +310,8 @@ static int __devinit snd_gusextreme_probe(struct device *dev, unsigned int n) if (snd_opl3_create(card, es1688->port, es1688->port + 2, OPL3_HW_OPL3, 0, &opl3) < 0) - dev_warn(dev, "opl3 not detected at 0x%lx\n", es1688->port); + printk(KERN_ERR "%s: opl3 not detected at 0x%lx\n", + dev->bus_id, es1688->port); else { error = snd_opl3_hwdep_new(opl3, 0, 2, NULL); if (error < 0) diff --git a/trunk/sound/isa/sb/sb8.c b/trunk/sound/isa/sb/sb8.c index 667eccc676a4..336a34277907 100644 --- a/trunk/sound/isa/sb/sb8.c +++ b/trunk/sound/isa/sb/sb8.c @@ -85,11 +85,11 @@ static int __devinit snd_sb8_match(struct device *pdev, unsigned int dev) if (!enable[dev]) return 0; if (irq[dev] == SNDRV_AUTO_IRQ) { - dev_err(pdev, "please specify irq\n"); + snd_printk(KERN_ERR "%s: please specify irq\n", pdev->bus_id); return 0; } if (dma8[dev] == SNDRV_AUTO_DMA) { - dev_err(pdev, "please specify dma8\n"); + snd_printk(KERN_ERR "%s: please specify dma8\n", pdev->bus_id); return 0; } return 1; diff --git a/trunk/sound/oss/ac97_codec.c b/trunk/sound/oss/ac97_codec.c index 456a1b4d7832..b63839e8f9bd 100644 --- a/trunk/sound/oss/ac97_codec.c +++ b/trunk/sound/oss/ac97_codec.c @@ -30,7 +30,7 @@ ************************************************************************** * * History - * May 02, 2003 Liam Girdwood + * May 02, 2003 Liam Girdwood * Removed non existant WM9700 * Added support for WM9705, WM9708, WM9709, WM9710, WM9711 * WM9712 and WM9717 diff --git a/trunk/sound/oss/kahlua.c b/trunk/sound/oss/kahlua.c index c180598f1710..eb9bc365530d 100644 --- a/trunk/sound/oss/kahlua.c +++ b/trunk/sound/oss/kahlua.c @@ -1,7 +1,7 @@ /* * Initialisation code for Cyrix/NatSemi VSA1 softaudio * - * (C) Copyright 2003 Red Hat Inc + * (C) Copyright 2003 Red Hat Inc * * XpressAudio(tm) is used on the Cyrix MediaGX (now NatSemi Geode) systems. * The older version (VSA1) provides fairly good soundblaster emulation diff --git a/trunk/sound/pci/ac97/ac97_codec.c b/trunk/sound/pci/ac97/ac97_codec.c index bd510eceff1f..6704acbca8c0 100644 --- a/trunk/sound/pci/ac97/ac97_codec.c +++ b/trunk/sound/pci/ac97/ac97_codec.c @@ -1927,9 +1927,9 @@ static int snd_ac97_dev_register(struct snd_device *device) ac97->dev.bus = &ac97_bus_type; ac97->dev.parent = ac97->bus->card->dev; ac97->dev.release = ac97_device_release; - dev_set_name(&ac97->dev, "%d-%d:%s", - ac97->bus->card->number, ac97->num, - snd_ac97_get_short_name(ac97)); + snprintf(ac97->dev.bus_id, BUS_ID_SIZE, "%d-%d:%s", + ac97->bus->card->number, ac97->num, + snd_ac97_get_short_name(ac97)); if ((err = device_register(&ac97->dev)) < 0) { snd_printk(KERN_ERR "Can't register ac97 bus\n"); ac97->dev.bus = NULL; diff --git a/trunk/sound/pci/ac97/ac97_patch.c b/trunk/sound/pci/ac97/ac97_patch.c index 6e831aff1bd0..6ce3cbe98a6a 100644 --- a/trunk/sound/pci/ac97/ac97_patch.c +++ b/trunk/sound/pci/ac97/ac97_patch.c @@ -476,7 +476,7 @@ static int patch_yamaha_ymf753(struct snd_ac97 * ac97) } /* - * May 2, 2003 Liam Girdwood + * May 2, 2003 Liam Girdwood * removed broken wolfson00 patch. * added support for WM9705,WM9708,WM9709,WM9710,WM9711,WM9712 and WM9717. */ diff --git a/trunk/sound/pci/ca0106/ca0106_main.c b/trunk/sound/pci/ca0106/ca0106_main.c index 88fbf285d2b7..a7d89662acf6 100644 --- a/trunk/sound/pci/ca0106/ca0106_main.c +++ b/trunk/sound/pci/ca0106/ca0106_main.c @@ -759,6 +759,7 @@ static int snd_ca0106_pcm_prepare_playback(struct snd_pcm_substream *substream) SPCS_CHANNELNUM_LEFT | SPCS_SOURCENUM_UNSPEC | SPCS_GENERATIONSTATUS | 0x00001200 | 0x00000000 | SPCS_EMPHASIS_NONE | SPCS_COPYRIGHT ); + } #endif return 0; diff --git a/trunk/sound/pci/cs5530.c b/trunk/sound/pci/cs5530.c index 4ba2db2f4250..7ff8b68e997e 100644 --- a/trunk/sound/pci/cs5530.c +++ b/trunk/sound/pci/cs5530.c @@ -2,7 +2,7 @@ * cs5530.c - Initialisation code for Cyrix/NatSemi VSA1 softaudio * * (C) Copyright 2007 Ash Willis - * (C) Copyright 2003 Red Hat Inc + * (C) Copyright 2003 Red Hat Inc * * This driver was ported (shamelessly ripped ;) from oss/kahlua.c but I did * mess with it a bit. The chip seems to have to have trouble with full duplex diff --git a/trunk/sound/pci/emu10k1/emu10k1_main.c b/trunk/sound/pci/emu10k1/emu10k1_main.c index de5ee8f097f6..2f283ea6ad9a 100644 --- a/trunk/sound/pci/emu10k1/emu10k1_main.c +++ b/trunk/sound/pci/emu10k1/emu10k1_main.c @@ -1464,7 +1464,6 @@ static struct snd_emu_chip_details emu_chip_details[] = { .ca0151_chip = 1, .spk71 = 1, .spdif_bug = 1, - .invert_shared_spdif = 1, /* digital/analog switch swapped */ .ac97_chip = 1} , {.vendor = 0x1102, .device = 0x0004, .subsystem = 0x20021102, .driver = "Audigy2", .name = "Audigy 2 ZS [SB0350]", @@ -1474,7 +1473,6 @@ static struct snd_emu_chip_details emu_chip_details[] = { .ca0151_chip = 1, .spk71 = 1, .spdif_bug = 1, - .invert_shared_spdif = 1, /* digital/analog switch swapped */ .ac97_chip = 1} , {.vendor = 0x1102, .device = 0x0004, .subsystem = 0x20011102, .driver = "Audigy2", .name = "Audigy 2 ZS [2001]", @@ -1484,7 +1482,6 @@ static struct snd_emu_chip_details emu_chip_details[] = { .ca0151_chip = 1, .spk71 = 1, .spdif_bug = 1, - .invert_shared_spdif = 1, /* digital/analog switch swapped */ .ac97_chip = 1} , /* Audigy 2 */ /* Tested by James@superbug.co.uk 3rd July 2005 */ diff --git a/trunk/sound/pci/hda/hda_codec.c b/trunk/sound/pci/hda/hda_codec.c index 6447754ae56e..ba1ab737b55f 100644 --- a/trunk/sound/pci/hda/hda_codec.c +++ b/trunk/sound/pci/hda/hda_codec.c @@ -64,6 +64,7 @@ static struct hda_vendor_id hda_vendor_ids[] = { { 0x14f1, "Conexant" }, { 0x17e8, "Chrontel" }, { 0x1854, "LG" }, + { 0x1aec, "Wolfson Microelectronics" }, { 0x434d, "C-Media" }, { 0x8384, "SigmaTel" }, {} /* terminator */ diff --git a/trunk/sound/pci/hda/hda_intel.c b/trunk/sound/pci/hda/hda_intel.c index 9f316c1b2790..c04ac38e2b2e 100644 --- a/trunk/sound/pci/hda/hda_intel.c +++ b/trunk/sound/pci/hda/hda_intel.c @@ -45,6 +45,7 @@ #include #include #include +#include #include #include #include "hda_codec.h" @@ -397,6 +398,9 @@ struct azx { /* for pending irqs */ struct work_struct irq_pending_work; + + /* reboot notifier (for mysterious hangup problem at power-down) */ + struct notifier_block reboot_notifier; }; /* driver types */ @@ -1978,6 +1982,28 @@ static int azx_resume(struct pci_dev *pci) #endif /* CONFIG_PM */ +/* + * reboot notifier for hang-up problem at power-down + */ +static int azx_halt(struct notifier_block *nb, unsigned long event, void *buf) +{ + struct azx *chip = container_of(nb, struct azx, reboot_notifier); + azx_stop_chip(chip); + return NOTIFY_OK; +} + +static void azx_notifier_register(struct azx *chip) +{ + chip->reboot_notifier.notifier_call = azx_halt; + register_reboot_notifier(&chip->reboot_notifier); +} + +static void azx_notifier_unregister(struct azx *chip) +{ + if (chip->reboot_notifier.notifier_call) + unregister_reboot_notifier(&chip->reboot_notifier); +} + /* * destructor */ @@ -1985,6 +2011,8 @@ static int azx_free(struct azx *chip) { int i; + azx_notifier_unregister(chip); + if (chip->initialized) { azx_clear_irq_pending(chip); for (i = 0; i < chip->num_streams; i++) @@ -2348,6 +2376,7 @@ static int __devinit azx_probe(struct pci_dev *pci, pci_set_drvdata(pci, card); chip->running = 1; power_down_all_codecs(chip); + azx_notifier_register(chip); dev++; return err; diff --git a/trunk/sound/pci/hda/hda_proc.c b/trunk/sound/pci/hda/hda_proc.c index 743d77922bce..c39af986bff1 100644 --- a/trunk/sound/pci/hda/hda_proc.c +++ b/trunk/sound/pci/hda/hda_proc.c @@ -483,6 +483,8 @@ static void print_gpio(struct snd_info_buffer *buffer, (gpio & AC_GPIO_UNSOLICITED) ? 1 : 0, (gpio & AC_GPIO_WAKE) ? 1 : 0); max = gpio & AC_GPIO_IO_COUNT; + if (!max || max > 8) + return; enable = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_GPIO_MASK, 0); direction = snd_hda_codec_read(codec, nid, 0, diff --git a/trunk/sound/pci/hda/patch_analog.c b/trunk/sound/pci/hda/patch_analog.c index 2b00c4afdf97..d3fd432cb3ea 100644 --- a/trunk/sound/pci/hda/patch_analog.c +++ b/trunk/sound/pci/hda/patch_analog.c @@ -3860,6 +3860,7 @@ static const char *ad1884a_models[AD1884A_MODELS] = { static struct snd_pci_quirk ad1884a_cfg_tbl[] = { SND_PCI_QUIRK(0x103c, 0x3030, "HP", AD1884A_MOBILE), + SND_PCI_QUIRK(0x103c, 0x3056, "HP", AD1884A_MOBILE), SND_PCI_QUIRK(0x17aa, 0x20ac, "Thinkpad X300", AD1884A_THINKPAD), {} }; diff --git a/trunk/sound/pci/hda/patch_nvhdmi.c b/trunk/sound/pci/hda/patch_nvhdmi.c index 1a65775d28e1..2eed2c8b98da 100644 --- a/trunk/sound/pci/hda/patch_nvhdmi.c +++ b/trunk/sound/pci/hda/patch_nvhdmi.c @@ -116,6 +116,7 @@ static int nvhdmi_build_pcms(struct hda_codec *codec) codec->pcm_info = info; info->name = "NVIDIA HDMI"; + info->pcm_type = HDA_PCM_TYPE_HDMI; info->stream[SNDRV_PCM_STREAM_PLAYBACK] = nvhdmi_pcm_digital_playback; return 0; diff --git a/trunk/sound/pci/hda/patch_realtek.c b/trunk/sound/pci/hda/patch_realtek.c index 0b6e682c46d0..a4666c96a44f 100644 --- a/trunk/sound/pci/hda/patch_realtek.c +++ b/trunk/sound/pci/hda/patch_realtek.c @@ -307,6 +307,13 @@ struct alc_spec { /* for PLL fix */ hda_nid_t pll_nid; unsigned int pll_coef_idx, pll_coef_bit; + +#ifdef SND_HDA_NEEDS_RESUME +#define ALC_MAX_PINS 16 + unsigned int num_pins; + hda_nid_t pin_nids[ALC_MAX_PINS]; + unsigned int pin_cfgs[ALC_MAX_PINS]; +#endif }; /* @@ -822,6 +829,31 @@ static void alc_sku_automute(struct hda_codec *codec) spec->jack_present ? 0 : PIN_OUT); } +#if 0 /* it's broken in some acses -- temporarily disabled */ +static void alc_mic_automute(struct hda_codec *codec) +{ + struct alc_spec *spec = codec->spec; + unsigned int present; + unsigned int mic_nid = spec->autocfg.input_pins[AUTO_PIN_MIC]; + unsigned int fmic_nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC]; + unsigned int mix_nid = spec->capsrc_nids[0]; + unsigned int capsrc_idx_mic, capsrc_idx_fmic; + + capsrc_idx_mic = mic_nid - 0x18; + capsrc_idx_fmic = fmic_nid - 0x18; + present = snd_hda_codec_read(codec, mic_nid, 0, + AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; + snd_hda_codec_write(codec, mix_nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, + 0x7000 | (capsrc_idx_mic << 8) | (present ? 0 : 0x80)); + snd_hda_codec_write(codec, mix_nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, + 0x7000 | (capsrc_idx_fmic << 8) | (present ? 0x80 : 0)); + snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, capsrc_idx_fmic, + HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); +} +#else +#define alc_mic_automute(codec) /* NOP */ +#endif /* disabled */ + /* unsolicited event for HP jack sensing */ static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res) { @@ -829,10 +861,17 @@ static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res) res >>= 28; else res >>= 26; - if (res != ALC880_HP_EVENT) - return; + if (res == ALC880_HP_EVENT) + alc_sku_automute(codec); + + if (res == ALC880_MIC_EVENT) + alc_mic_automute(codec); +} +static void alc_inithook(struct hda_codec *codec) +{ alc_sku_automute(codec); + alc_mic_automute(codec); } /* additional initialization for ALC888 variants */ @@ -1018,10 +1057,19 @@ static void alc_subsystem_id(struct hda_codec *codec, else return; } - - snd_hda_codec_write(codec, spec->autocfg.hp_pins[0], 0, - AC_VERB_SET_UNSOLICITED_ENABLE, - AC_USRSP_EN | ALC880_HP_EVENT); + if (spec->autocfg.hp_pins[0]) + snd_hda_codec_write(codec, spec->autocfg.hp_pins[0], 0, + AC_VERB_SET_UNSOLICITED_ENABLE, + AC_USRSP_EN | ALC880_HP_EVENT); + +#if 0 /* it's broken in some acses -- temporarily disabled */ + if (spec->autocfg.input_pins[AUTO_PIN_MIC] && + spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC]) + snd_hda_codec_write(codec, + spec->autocfg.input_pins[AUTO_PIN_MIC], 0, + AC_VERB_SET_UNSOLICITED_ENABLE, + AC_USRSP_EN | ALC880_MIC_EVENT); +#endif /* disabled */ spec->unsol_event = alc_sku_unsol_event; } @@ -2743,6 +2791,64 @@ static void alc_free(struct hda_codec *codec) codec->spec = NULL; /* to be sure */ } +#ifdef SND_HDA_NEEDS_RESUME +static void store_pin_configs(struct hda_codec *codec) +{ + struct alc_spec *spec = codec->spec; + hda_nid_t nid, end_nid; + + end_nid = codec->start_nid + codec->num_nodes; + for (nid = codec->start_nid; nid < end_nid; nid++) { + unsigned int wid_caps = get_wcaps(codec, nid); + unsigned int wid_type = + (wid_caps & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; + if (wid_type != AC_WID_PIN) + continue; + if (spec->num_pins >= ARRAY_SIZE(spec->pin_nids)) + break; + spec->pin_nids[spec->num_pins] = nid; + spec->pin_cfgs[spec->num_pins] = + snd_hda_codec_read(codec, nid, 0, + AC_VERB_GET_CONFIG_DEFAULT, 0); + spec->num_pins++; + } +} + +static void resume_pin_configs(struct hda_codec *codec) +{ + struct alc_spec *spec = codec->spec; + int i; + + for (i = 0; i < spec->num_pins; i++) { + hda_nid_t pin_nid = spec->pin_nids[i]; + unsigned int pin_config = spec->pin_cfgs[i]; + snd_hda_codec_write(codec, pin_nid, 0, + AC_VERB_SET_CONFIG_DEFAULT_BYTES_0, + pin_config & 0x000000ff); + snd_hda_codec_write(codec, pin_nid, 0, + AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, + (pin_config & 0x0000ff00) >> 8); + snd_hda_codec_write(codec, pin_nid, 0, + AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, + (pin_config & 0x00ff0000) >> 16); + snd_hda_codec_write(codec, pin_nid, 0, + AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, + pin_config >> 24); + } +} + +static int alc_resume(struct hda_codec *codec) +{ + resume_pin_configs(codec); + codec->patch_ops.init(codec); + snd_hda_codec_resume_amp(codec); + snd_hda_codec_resume_cache(codec); + return 0; +} +#else +#define store_pin_configs(codec) +#endif + /* */ static struct hda_codec_ops alc_patch_ops = { @@ -2751,6 +2857,9 @@ static struct hda_codec_ops alc_patch_ops = { .init = alc_init, .free = alc_free, .unsol_event = alc_unsol_event, +#ifdef SND_HDA_NEEDS_RESUME + .resume = alc_resume, +#endif #ifdef CONFIG_SND_HDA_POWER_SAVE .check_power_status = alc_check_power_status, #endif @@ -3797,6 +3906,7 @@ static int alc880_parse_auto_config(struct hda_codec *codec) spec->num_mux_defs = 1; spec->input_mux = &spec->private_imux; + store_pin_configs(codec); return 1; } @@ -3808,7 +3918,7 @@ static void alc880_auto_init(struct hda_codec *codec) alc880_auto_init_extra_out(codec); alc880_auto_init_analog_input(codec); if (spec->unsol_event) - alc_sku_automute(codec); + alc_inithook(codec); } /* @@ -4961,7 +5071,7 @@ static struct hda_verb alc260_test_init_verbs[] = { */ static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid, - const char *pfx) + const char *pfx, int *vol_bits) { hda_nid_t nid_vol; unsigned long vol_val, sw_val; @@ -4983,10 +5093,14 @@ static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid, } else return 0; /* N/A */ - snprintf(name, sizeof(name), "%s Playback Volume", pfx); - err = add_control(spec, ALC_CTL_WIDGET_VOL, name, vol_val); - if (err < 0) - return err; + if (!(*vol_bits & (1 << nid_vol))) { + /* first control for the volume widget */ + snprintf(name, sizeof(name), "%s Playback Volume", pfx); + err = add_control(spec, ALC_CTL_WIDGET_VOL, name, vol_val); + if (err < 0) + return err; + *vol_bits |= (1 << nid_vol); + } snprintf(name, sizeof(name), "%s Playback Switch", pfx); err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, sw_val); if (err < 0) @@ -5000,6 +5114,7 @@ static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec, { hda_nid_t nid; int err; + int vols = 0; spec->multiout.num_dacs = 1; spec->multiout.dac_nids = spec->private_dac_nids; @@ -5007,21 +5122,22 @@ static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec, nid = cfg->line_out_pins[0]; if (nid) { - err = alc260_add_playback_controls(spec, nid, "Front"); + err = alc260_add_playback_controls(spec, nid, "Front", &vols); if (err < 0) return err; } nid = cfg->speaker_pins[0]; if (nid) { - err = alc260_add_playback_controls(spec, nid, "Speaker"); + err = alc260_add_playback_controls(spec, nid, "Speaker", &vols); if (err < 0) return err; } nid = cfg->hp_pins[0]; if (nid) { - err = alc260_add_playback_controls(spec, nid, "Headphone"); + err = alc260_add_playback_controls(spec, nid, "Headphone", + &vols); if (err < 0) return err; } @@ -5209,6 +5325,7 @@ static int alc260_parse_auto_config(struct hda_codec *codec) } spec->num_mixers++; + store_pin_configs(codec); return 1; } @@ -5219,7 +5336,7 @@ static void alc260_auto_init(struct hda_codec *codec) alc260_auto_init_multi_out(codec); alc260_auto_init_analog_input(codec); if (spec->unsol_event) - alc_sku_automute(codec); + alc_inithook(codec); } #ifdef CONFIG_SND_HDA_POWER_SAVE @@ -6629,7 +6746,7 @@ static void alc882_auto_init(struct hda_codec *codec) alc882_auto_init_analog_input(codec); alc882_auto_init_input_src(codec); if (spec->unsol_event) - alc_sku_automute(codec); + alc_inithook(codec); } static int patch_alc883(struct hda_codec *codec); /* called in patch_alc882() */ @@ -8297,6 +8414,7 @@ static const char *alc883_models[ALC883_MODEL_LAST] = { static struct snd_pci_quirk alc883_cfg_tbl[] = { SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC883_3ST_6ch_DIG), SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE), + SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE), SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE), SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE), SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE), @@ -8306,8 +8424,8 @@ static struct snd_pci_quirk alc883_cfg_tbl[] = { SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP), SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP), SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG), + SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V), SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG), - SND_PCI_QUIRK(0x1043, 0x8317, "Asus M90V", ALC888_ASUS_M90V), SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601), SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG), SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC883_6ST_DIG), @@ -8758,7 +8876,7 @@ static void alc883_auto_init(struct hda_codec *codec) alc883_auto_init_analog_input(codec); alc883_auto_init_input_src(codec); if (spec->unsol_event) - alc_sku_automute(codec); + alc_inithook(codec); } static int patch_alc883(struct hda_codec *codec) @@ -8802,8 +8920,13 @@ static int patch_alc883(struct hda_codec *codec) switch (codec->vendor_id) { case 0x10ec0888: - spec->stream_name_analog = "ALC888 Analog"; - spec->stream_name_digital = "ALC888 Digital"; + if (codec->revision_id == 0x100101) { + spec->stream_name_analog = "ALC1200 Analog"; + spec->stream_name_digital = "ALC1200 Digital"; + } else { + spec->stream_name_analog = "ALC888 Analog"; + spec->stream_name_digital = "ALC888 Digital"; + } break; case 0x10ec0889: spec->stream_name_analog = "ALC889 Analog"; @@ -10267,6 +10390,7 @@ static int alc262_parse_auto_config(struct hda_codec *codec) if (err < 0) return err; + store_pin_configs(codec); return 1; } @@ -10285,7 +10409,7 @@ static void alc262_auto_init(struct hda_codec *codec) alc262_auto_init_analog_input(codec); alc262_auto_init_input_src(codec); if (spec->unsol_event) - alc_sku_automute(codec); + alc_inithook(codec); } /* @@ -10343,7 +10467,7 @@ static struct snd_pci_quirk alc262_cfg_tbl[] = { SND_PCI_QUIRK(0x104d, 0x9015, "Sony 0x9015", ALC262_SONY_ASSAMD), SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1", ALC262_TOSHIBA_RX1), - SND_PCI_QUIRK(0x1179, 0x0268, "Toshiba S06", ALC262_TOSHIBA_S06), + SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06), SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU), SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU), SND_PCI_QUIRK(0x144d, 0xc032, "Samsung Q1 Ultra", ALC262_ULTRA), @@ -11401,6 +11525,7 @@ static int alc268_parse_auto_config(struct hda_codec *codec) if (err < 0) return err; + store_pin_configs(codec); return 1; } @@ -11417,7 +11542,7 @@ static void alc268_auto_init(struct hda_codec *codec) alc268_auto_init_mono_speaker_out(codec); alc268_auto_init_analog_input(codec); if (spec->unsol_event) - alc_sku_automute(codec); + alc_inithook(codec); } /* @@ -12120,8 +12245,26 @@ static int alc269_auto_create_multi_out_ctls(struct alc_spec *spec, return 0; } -#define alc269_auto_create_analog_input_ctls \ - alc880_auto_create_analog_input_ctls +static int alc269_auto_create_analog_input_ctls(struct alc_spec *spec, + const struct auto_pin_cfg *cfg) +{ + int err; + + err = alc880_auto_create_analog_input_ctls(spec, cfg); + if (err < 0) + return err; + /* digital-mic input pin is excluded in alc880_auto_create..() + * because it's under 0x18 + */ + if (cfg->input_pins[AUTO_PIN_MIC] == 0x12 || + cfg->input_pins[AUTO_PIN_FRONT_MIC] == 0x12) { + struct hda_input_mux *imux = &spec->private_imux; + imux->items[imux->num_items].label = "Int Mic"; + imux->items[imux->num_items].index = 0x05; + imux->num_items++; + } + return 0; +} #ifdef CONFIG_SND_HDA_POWER_SAVE #define alc269_loopbacks alc880_loopbacks @@ -12184,6 +12327,7 @@ static int alc269_parse_auto_config(struct hda_codec *codec) spec->mixers[spec->num_mixers] = alc269_capture_mixer; spec->num_mixers++; + store_pin_configs(codec); return 1; } @@ -12200,7 +12344,7 @@ static void alc269_auto_init(struct hda_codec *codec) alc269_auto_init_hp_out(codec); alc269_auto_init_analog_input(codec); if (spec->unsol_event) - alc_sku_automute(codec); + alc_inithook(codec); } /* @@ -13270,6 +13414,7 @@ static int alc861_parse_auto_config(struct hda_codec *codec) spec->mixers[spec->num_mixers] = alc861_capture_mixer; spec->num_mixers++; + store_pin_configs(codec); return 1; } @@ -13281,7 +13426,7 @@ static void alc861_auto_init(struct hda_codec *codec) alc861_auto_init_hp_out(codec); alc861_auto_init_analog_input(codec); if (spec->unsol_event) - alc_sku_automute(codec); + alc_inithook(codec); } #ifdef CONFIG_SND_HDA_POWER_SAVE @@ -14381,6 +14526,7 @@ static int alc861vd_parse_auto_config(struct hda_codec *codec) if (err < 0) return err; + store_pin_configs(codec); return 1; } @@ -14393,7 +14539,7 @@ static void alc861vd_auto_init(struct hda_codec *codec) alc861vd_auto_init_analog_input(codec); alc861vd_auto_init_input_src(codec); if (spec->unsol_event) - alc_sku_automute(codec); + alc_inithook(codec); } static int patch_alc861vd(struct hda_codec *codec) @@ -15667,7 +15813,7 @@ static const char *alc662_models[ALC662_MODEL_LAST] = { static struct snd_pci_quirk alc662_cfg_tbl[] = { SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA), - SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS M51VA", ALC663_ASUS_G50V), + SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V), SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG), SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701), SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20), @@ -15680,6 +15826,7 @@ static struct snd_pci_quirk alc662_cfg_tbl[] = { SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1), SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1), SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1), + SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1), SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2), SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2), SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2), @@ -16211,6 +16358,8 @@ static int alc662_parse_auto_config(struct hda_codec *codec) spec->mixers[spec->num_mixers] = alc662_capture_mixer; spec->num_mixers++; + + store_pin_configs(codec); return 1; } @@ -16223,7 +16372,7 @@ static void alc662_auto_init(struct hda_codec *codec) alc662_auto_init_analog_input(codec); alc662_auto_init_input_src(codec); if (spec->unsol_event) - alc_sku_automute(codec); + alc_inithook(codec); } static int patch_alc662(struct hda_codec *codec) @@ -16268,6 +16417,9 @@ static int patch_alc662(struct hda_codec *codec) if (codec->vendor_id == 0x10ec0663) { spec->stream_name_analog = "ALC663 Analog"; spec->stream_name_digital = "ALC663 Digital"; + } else if (codec->vendor_id == 0x10ec0272) { + spec->stream_name_analog = "ALC272 Analog"; + spec->stream_name_digital = "ALC272 Digital"; } else { spec->stream_name_analog = "ALC662 Analog"; spec->stream_name_digital = "ALC662 Digital"; @@ -16305,6 +16457,7 @@ struct hda_codec_preset snd_hda_preset_realtek[] = { { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 }, { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 }, { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 }, + { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 }, { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660", .patch = patch_alc861 }, { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd }, @@ -16323,7 +16476,10 @@ struct hda_codec_preset snd_hda_preset_realtek[] = { { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A", .patch = patch_alc882 }, /* should be patch_alc883() in future */ { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 }, + { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc883 }, { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc883 }, + { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200", + .patch = patch_alc883 }, { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc883 }, {} /* terminator */ }; diff --git a/trunk/sound/pci/hda/patch_sigmatel.c b/trunk/sound/pci/hda/patch_sigmatel.c index c59065513118..e6085915d86d 100644 --- a/trunk/sound/pci/hda/patch_sigmatel.c +++ b/trunk/sound/pci/hda/patch_sigmatel.c @@ -69,6 +69,7 @@ enum { enum { STAC_92HD73XX_REF, STAC_DELL_M6, + STAC_DELL_EQ, STAC_92HD73XX_MODELS }; @@ -566,10 +567,8 @@ static int stac92xx_smux_enum_put(struct snd_kcontrol *kcontrol, nid = codec->slave_dig_outs[smux_idx - 1]; if (spec->cur_smux[smux_idx] == smux->num_items - 1) val = AMP_OUT_MUTE; - if (smux_idx == 0) - nid = spec->multiout.dig_out_nid; else - nid = codec->slave_dig_outs[smux_idx - 1]; + val = AMP_OUT_UNMUTE; /* un/mute SPDIF out */ snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, val); @@ -775,9 +774,7 @@ static struct hda_verb dell_eq_core_init[] = { }; static struct hda_verb dell_m6_core_init[] = { - /* set master volume to max value without distortion - * and direct control */ - { 0x1f, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xec}, + { 0x1f, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff}, /* setup audio connections */ { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00}, { 0x0a, AC_VERB_SET_CONNECT_SEL, 0x01}, @@ -1282,7 +1279,7 @@ static int stac92xx_build_controls(struct hda_codec *codec) return err; spec->multiout.share_spdif = 1; } - if (spec->dig_in_nid && (!spec->gpio_dir & 0x01)) { + if (spec->dig_in_nid && !(spec->gpio_dir & 0x01)) { err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid); if (err < 0) return err; @@ -1602,11 +1599,13 @@ static unsigned int dell_m6_pin_configs[13] = { static unsigned int *stac92hd73xx_brd_tbl[STAC_92HD73XX_MODELS] = { [STAC_92HD73XX_REF] = ref92hd73xx_pin_configs, [STAC_DELL_M6] = dell_m6_pin_configs, + [STAC_DELL_EQ] = dell_m6_pin_configs, }; static const char *stac92hd73xx_models[STAC_92HD73XX_MODELS] = { [STAC_92HD73XX_REF] = "ref", [STAC_DELL_M6] = "dell-m6", + [STAC_DELL_EQ] = "dell-eq", }; static struct snd_pci_quirk stac92hd73xx_cfg_tbl[] = { @@ -2816,7 +2815,7 @@ static int stac92xx_auto_create_multi_out_ctls(struct hda_codec *codec, static const char *chname[4] = { "Front", "Surround", NULL /*CLFE*/, "Side" }; - hda_nid_t nid; + hda_nid_t nid = 0; int i, err; struct sigmatel_spec *spec = codec->spec; @@ -4133,12 +4132,17 @@ static int patch_stac92hd73xx(struct hda_codec *codec) sizeof(stac92hd73xx_dmux)); switch (spec->board_config) { - case STAC_DELL_M6: + case STAC_DELL_EQ: spec->init = dell_eq_core_init; + /* fallthru */ + case STAC_DELL_M6: spec->num_smuxes = 0; spec->mixer = &stac92hd73xx_6ch_mixer[DELL_M6_MIXER]; spec->amp_nids = &stac92hd73xx_amp_nids[DELL_M6_AMP]; spec->num_amps = 1; + + if (!spec->init) + spec->init = dell_m6_core_init; switch (codec->subsystem_id) { case 0x1028025e: /* Analog Mics */ case 0x1028025f: @@ -4148,8 +4152,6 @@ static int patch_stac92hd73xx(struct hda_codec *codec) break; case 0x10280271: /* Digital Mics */ case 0x10280272: - spec->init = dell_m6_core_init; - /* fall-through */ case 0x10280254: case 0x10280255: stac92xx_set_config_reg(codec, 0x13, 0x90A60160); diff --git a/trunk/sound/pci/ice1712/ice1712.c b/trunk/sound/pci/ice1712/ice1712.c index 58d7cda03de5..5b442383fcda 100644 --- a/trunk/sound/pci/ice1712/ice1712.c +++ b/trunk/sound/pci/ice1712/ice1712.c @@ -2688,13 +2688,12 @@ static int __devinit snd_ice1712_probe(struct pci_dev *pci, return err; } - if (ice_has_con_ac97(ice)) { + if (ice_has_con_ac97(ice)) err = snd_ice1712_pcm(ice, pcm_dev++, NULL); if (err < 0) { snd_card_free(card); return err; } - } err = snd_ice1712_ac97_mixer(ice); if (err < 0) { @@ -2716,13 +2715,12 @@ static int __devinit snd_ice1712_probe(struct pci_dev *pci, } } - if (ice_has_con_ac97(ice)) { + if (ice_has_con_ac97(ice)) err = snd_ice1712_pcm_ds(ice, pcm_dev++, NULL); if (err < 0) { snd_card_free(card); return err; } - } if (!c->no_mpu401) { err = snd_mpu401_uart_new(card, 0, MPU401_HW_ICE1712, diff --git a/trunk/sound/pci/intel8x0.c b/trunk/sound/pci/intel8x0.c index 19d3391e229f..c88d1eace1c4 100644 --- a/trunk/sound/pci/intel8x0.c +++ b/trunk/sound/pci/intel8x0.c @@ -2702,7 +2702,6 @@ static struct snd_pci_quirk intel8x0_clock_list[] __devinitdata = { SND_PCI_QUIRK(0x0e11, 0x008a, "AD1885", 41000), SND_PCI_QUIRK(0x1028, 0x00be, "AD1885", 44100), SND_PCI_QUIRK(0x1028, 0x0177, "AD1980", 48000), - SND_PCI_QUIRK(0x1028, 0x01ad, "AD1981B", 48000), SND_PCI_QUIRK(0x1043, 0x80f3, "AD1985", 48000), { } /* terminator */ }; diff --git a/trunk/sound/pci/rme9652/hdsp.c b/trunk/sound/pci/rme9652/hdsp.c index 736246f98acc..d723543beadd 100644 --- a/trunk/sound/pci/rme9652/hdsp.c +++ b/trunk/sound/pci/rme9652/hdsp.c @@ -4548,20 +4548,11 @@ static int snd_hdsp_hwdep_ioctl(struct snd_hwdep *hw, struct file *file, unsigne { struct hdsp *hdsp = (struct hdsp *)hw->private_data; void __user *argp = (void __user *)arg; - int err; switch (cmd) { case SNDRV_HDSP_IOCTL_GET_PEAK_RMS: { struct hdsp_peak_rms __user *peak_rms = (struct hdsp_peak_rms __user *)arg; - err = hdsp_check_for_iobox(hdsp); - if (err < 0) - return err; - - err = hdsp_check_for_firmware(hdsp, 1); - if (err < 0) - return err; - if (!(hdsp->state & HDSP_FirmwareLoaded)) { snd_printk(KERN_ERR "Hammerfall-DSP: firmware needs to be uploaded to the card.\n"); return -EINVAL; @@ -4581,14 +4572,10 @@ static int snd_hdsp_hwdep_ioctl(struct snd_hwdep *hw, struct file *file, unsigne unsigned long flags; int i; - err = hdsp_check_for_iobox(hdsp); - if (err < 0) - return err; - - err = hdsp_check_for_firmware(hdsp, 1); - if (err < 0) - return err; - + if (!(hdsp->state & HDSP_FirmwareLoaded)) { + snd_printk(KERN_ERR "Hammerfall-DSP: Firmware needs to be uploaded to the card.\n"); + return -EINVAL; + } spin_lock_irqsave(&hdsp->lock, flags); info.pref_sync_ref = (unsigned char)hdsp_pref_sync_ref(hdsp); info.wordclock_sync_check = (unsigned char)hdsp_wc_sync_check(hdsp); @@ -5058,10 +5045,6 @@ static int __devinit snd_hdsp_create(struct snd_card *card, /* we wait 2 seconds to let freshly inserted cardbus cards do their hardware init */ ssleep(2); - err = hdsp_check_for_iobox(hdsp); - if (err < 0) - return err; - if ((hdsp_read (hdsp, HDSP_statusRegister) & HDSP_DllError) != 0) { #ifdef HDSP_FW_LOADER if ((err = hdsp_request_fw_loader(hdsp)) < 0) @@ -5074,7 +5057,7 @@ static int __devinit snd_hdsp_create(struct snd_card *card, /* init is complete, we return */ return 0; #endif - /* we defer initialization */ + /* no iobox connected, we defer initialization */ snd_printk(KERN_INFO "Hammerfall-DSP: card initialization pending : waiting for firmware\n"); if ((err = snd_hdsp_create_hwdep(card, hdsp)) < 0) return err; diff --git a/trunk/sound/soc/at91/Kconfig b/trunk/sound/soc/at91/Kconfig index 85a883299c2e..905186502e00 100644 --- a/trunk/sound/soc/at91/Kconfig +++ b/trunk/sound/soc/at91/Kconfig @@ -8,3 +8,20 @@ config SND_AT91_SOC config SND_AT91_SOC_SSC tristate + +config SND_AT91_SOC_ETI_B1_WM8731 + tristate "SoC Audio support for WM8731-based Endrelia ETI-B1 boards" + depends on SND_AT91_SOC && (MACH_ETI_B1 || MACH_ETI_C1) + select SND_AT91_SOC_SSC + select SND_SOC_WM8731 + help + Say Y if you want to add support for SoC audio on WM8731-based + Endrelia Technologies Inc ETI-B1 or ETI-C1 boards. + +config SND_AT91_SOC_ETI_SLAVE + bool "Run codec in slave Mode on Endrelia boards" + depends on SND_AT91_SOC_ETI_B1_WM8731 + default n + help + Say Y if you want to run with the AT91 SSC generating the BCLK + and LRC signals on Endrelia boards. diff --git a/trunk/sound/soc/at91/Makefile b/trunk/sound/soc/at91/Makefile index b817f11df286..f23da17cc328 100644 --- a/trunk/sound/soc/at91/Makefile +++ b/trunk/sound/soc/at91/Makefile @@ -4,3 +4,8 @@ snd-soc-at91-ssc-objs := at91-ssc.o obj-$(CONFIG_SND_AT91_SOC) += snd-soc-at91.o obj-$(CONFIG_SND_AT91_SOC_SSC) += snd-soc-at91-ssc.o + +# AT91 Machine Support +snd-soc-eti-b1-wm8731-objs := eti_b1_wm8731.o + +obj-$(CONFIG_SND_AT91_SOC_ETI_B1_WM8731) += snd-soc-eti-b1-wm8731.o diff --git a/trunk/sound/soc/at91/at91-ssc.c b/trunk/sound/soc/at91/at91-ssc.c index 1b61cc461261..a5b1a79ebffb 100644 --- a/trunk/sound/soc/at91/at91-ssc.c +++ b/trunk/sound/soc/at91/at91-ssc.c @@ -5,7 +5,7 @@ * Endrelia Technologies Inc. * * Based on pxa2xx Platform drivers by - * Liam Girdwood + * Liam Girdwood * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/trunk/sound/soc/at91/eti_b1_wm8731.c b/trunk/sound/soc/at91/eti_b1_wm8731.c new file mode 100644 index 000000000000..684781e4088b --- /dev/null +++ b/trunk/sound/soc/at91/eti_b1_wm8731.c @@ -0,0 +1,349 @@ +/* + * eti_b1_wm8731 -- SoC audio for AT91RM9200-based Endrelia ETI_B1 board. + * + * Author: Frank Mandarino + * Endrelia Technologies Inc. + * Created: Mar 29, 2006 + * + * Based on corgi.c by: + * + * Copyright 2005 Wolfson Microelectronics PLC. + * Copyright 2005 Openedhand Ltd. + * + * Authors: Liam Girdwood + * Richard Purdie + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include "../codecs/wm8731.h" +#include "at91-pcm.h" +#include "at91-ssc.h" + +#if 0 +#define DBG(x...) printk(KERN_INFO "eti_b1_wm8731: " x) +#else +#define DBG(x...) +#endif + +static struct clk *pck1_clk; +static struct clk *pllb_clk; + + +static int eti_b1_startup(struct snd_pcm_substream *substream) +{ + struct snd_soc_pcm_runtime *rtd = substream->private_data; + struct snd_soc_dai *codec_dai = rtd->dai->codec_dai; + struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai; + int ret; + + /* cpu clock is the AT91 master clock sent to the SSC */ + ret = snd_soc_dai_set_sysclk(cpu_dai, AT91_SYSCLK_MCK, + 60000000, SND_SOC_CLOCK_IN); + if (ret < 0) + return ret; + + /* codec system clock is supplied by PCK1, set to 12MHz */ + ret = snd_soc_dai_set_sysclk(codec_dai, WM8731_SYSCLK, + 12000000, SND_SOC_CLOCK_IN); + if (ret < 0) + return ret; + + /* Start PCK1 clock. */ + clk_enable(pck1_clk); + DBG("pck1 started\n"); + + return 0; +} + +static void eti_b1_shutdown(struct snd_pcm_substream *substream) +{ + /* Stop PCK1 clock. */ + clk_disable(pck1_clk); + DBG("pck1 stopped\n"); +} + +static int eti_b1_hw_params(struct snd_pcm_substream *substream, + struct snd_pcm_hw_params *params) +{ + struct snd_soc_pcm_runtime *rtd = substream->private_data; + struct snd_soc_dai *codec_dai = rtd->dai->codec_dai; + struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai; + int ret; + +#ifdef CONFIG_SND_AT91_SOC_ETI_SLAVE + unsigned int rate; + int cmr_div, period; + + /* set codec DAI configuration */ + ret = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_I2S | + SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBS_CFS); + if (ret < 0) + return ret; + + /* set cpu DAI configuration */ + ret = snd_soc_dai_set_fmt(cpu_dai, SND_SOC_DAIFMT_I2S | + SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBS_CFS); + if (ret < 0) + return ret; + + /* + * The SSC clock dividers depend on the sample rate. The CMR.DIV + * field divides the system master clock MCK to drive the SSC TK + * signal which provides the codec BCLK. The TCMR.PERIOD and + * RCMR.PERIOD fields further divide the BCLK signal to drive + * the SSC TF and RF signals which provide the codec DACLRC and + * ADCLRC clocks. + * + * The dividers were determined through trial and error, where a + * CMR.DIV value is chosen such that the resulting BCLK value is + * divisible, or almost divisible, by (2 * sample rate), and then + * the TCMR.PERIOD or RCMR.PERIOD is BCLK / (2 * sample rate) - 1. + */ + rate = params_rate(params); + + switch (rate) { + case 8000: + cmr_div = 25; /* BCLK = 60MHz/(2*25) = 1.2MHz */ + period = 74; /* LRC = BCLK/(2*(74+1)) = 8000Hz */ + break; + case 32000: + cmr_div = 7; /* BCLK = 60MHz/(2*7) ~= 4.28571428MHz */ + period = 66; /* LRC = BCLK/(2*(66+1)) = 31982.942Hz */ + break; + case 48000: + cmr_div = 13; /* BCLK = 60MHz/(2*13) ~= 2.3076923MHz */ + period = 23; /* LRC = BCLK/(2*(23+1)) = 48076.923Hz */ + break; + default: + printk(KERN_WARNING "unsupported rate %d on ETI-B1 board\n", rate); + return -EINVAL; + } + + /* set the MCK divider for BCLK */ + ret = snd_soc_dai_set_clkdiv(cpu_dai, AT91SSC_CMR_DIV, cmr_div); + if (ret < 0) + return ret; + + if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { + /* set the BCLK divider for DACLRC */ + ret = snd_soc_dai_set_clkdiv(cpu_dai, + AT91SSC_TCMR_PERIOD, period); + } else { + /* set the BCLK divider for ADCLRC */ + ret = snd_soc_dai_set_clkdiv(cpu_dai, + AT91SSC_RCMR_PERIOD, period); + } + if (ret < 0) + return ret; + +#else /* CONFIG_SND_AT91_SOC_ETI_SLAVE */ + /* + * Codec in Master Mode. + */ + + /* set codec DAI configuration */ + ret = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_I2S | + SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBM_CFM); + if (ret < 0) + return ret; + + /* set cpu DAI configuration */ + ret = snd_soc_dai_set_fmt(cpu_dai, SND_SOC_DAIFMT_I2S | + SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBM_CFM); + if (ret < 0) + return ret; + +#endif /* CONFIG_SND_AT91_SOC_ETI_SLAVE */ + + return 0; +} + +static struct snd_soc_ops eti_b1_ops = { + .startup = eti_b1_startup, + .hw_params = eti_b1_hw_params, + .shutdown = eti_b1_shutdown, +}; + + +static const struct snd_soc_dapm_widget eti_b1_dapm_widgets[] = { + SND_SOC_DAPM_MIC("Int Mic", NULL), + SND_SOC_DAPM_SPK("Ext Spk", NULL), +}; + +static const struct snd_soc_dapm_route intercon[] = { + + /* speaker connected to LHPOUT */ + {"Ext Spk", NULL, "LHPOUT"}, + + /* mic is connected to Mic Jack, with WM8731 Mic Bias */ + {"MICIN", NULL, "Mic Bias"}, + {"Mic Bias", NULL, "Int Mic"}, +}; + +/* + * Logic for a wm8731 as connected on a Endrelia ETI-B1 board. + */ +static int eti_b1_wm8731_init(struct snd_soc_codec *codec) +{ + DBG("eti_b1_wm8731_init() called\n"); + + /* Add specific widgets */ + snd_soc_dapm_new_controls(codec, eti_b1_dapm_widgets, + ARRAY_SIZE(eti_b1_dapm_widgets)); + + /* Set up specific audio path interconnects */ + snd_soc_dapm_add_route(codec, intercon, ARRAY_SIZE(intercon)); + + /* not connected */ + snd_soc_dapm_disable_pin(codec, "RLINEIN"); + snd_soc_dapm_disable_pin(codec, "LLINEIN"); + + /* always connected */ + snd_soc_dapm_enable_pin(codec, "Int Mic"); + snd_soc_dapm_enable_pin(codec, "Ext Spk"); + + snd_soc_dapm_sync(codec); + + return 0; +} + +static struct snd_soc_dai_link eti_b1_dai = { + .name = "WM8731", + .stream_name = "WM8731 PCM", + .cpu_dai = &at91_ssc_dai[1], + .codec_dai = &wm8731_dai, + .init = eti_b1_wm8731_init, + .ops = &eti_b1_ops, +}; + +static struct snd_soc_machine snd_soc_machine_eti_b1 = { + .name = "ETI_B1_WM8731", + .dai_link = &eti_b1_dai, + .num_links = 1, +}; + +static struct wm8731_setup_data eti_b1_wm8731_setup = { + .i2c_bus = 0, + .i2c_address = 0x1a, +}; + +static struct snd_soc_device eti_b1_snd_devdata = { + .machine = &snd_soc_machine_eti_b1, + .platform = &at91_soc_platform, + .codec_dev = &soc_codec_dev_wm8731, + .codec_data = &eti_b1_wm8731_setup, +}; + +static struct platform_device *eti_b1_snd_device; + +static int __init eti_b1_init(void) +{ + int ret; + struct at91_ssc_periph *ssc = eti_b1_dai.cpu_dai->private_data; + + if (!request_mem_region(AT91RM9200_BASE_SSC1, SZ_16K, "soc-audio")) { + DBG("SSC1 memory region is busy\n"); + return -EBUSY; + } + + ssc->base = ioremap(AT91RM9200_BASE_SSC1, SZ_16K); + if (!ssc->base) { + DBG("SSC1 memory ioremap failed\n"); + ret = -ENOMEM; + goto fail_release_mem; + } + + ssc->pid = AT91RM9200_ID_SSC1; + + eti_b1_snd_device = platform_device_alloc("soc-audio", -1); + if (!eti_b1_snd_device) { + DBG("platform device allocation failed\n"); + ret = -ENOMEM; + goto fail_io_unmap; + } + + platform_set_drvdata(eti_b1_snd_device, &eti_b1_snd_devdata); + eti_b1_snd_devdata.dev = &eti_b1_snd_device->dev; + + ret = platform_device_add(eti_b1_snd_device); + if (ret) { + DBG("platform device add failed\n"); + platform_device_put(eti_b1_snd_device); + goto fail_io_unmap; + } + + at91_set_A_periph(AT91_PIN_PB6, 0); /* TF1 */ + at91_set_A_periph(AT91_PIN_PB7, 0); /* TK1 */ + at91_set_A_periph(AT91_PIN_PB8, 0); /* TD1 */ + at91_set_A_periph(AT91_PIN_PB9, 0); /* RD1 */ +/* at91_set_A_periph(AT91_PIN_PB10, 0);*/ /* RK1 */ + at91_set_A_periph(AT91_PIN_PB11, 0); /* RF1 */ + + /* + * Set PCK1 parent to PLLB and its rate to 12 Mhz. + */ + pllb_clk = clk_get(NULL, "pllb"); + pck1_clk = clk_get(NULL, "pck1"); + + clk_set_parent(pck1_clk, pllb_clk); + clk_set_rate(pck1_clk, 12000000); + + DBG("MCLK rate %luHz\n", clk_get_rate(pck1_clk)); + + /* assign the GPIO pin to PCK1 */ + at91_set_B_periph(AT91_PIN_PA24, 0); + +#ifdef CONFIG_SND_AT91_SOC_ETI_SLAVE + printk(KERN_INFO "eti_b1_wm8731: Codec in Slave Mode\n"); +#else + printk(KERN_INFO "eti_b1_wm8731: Codec in Master Mode\n"); +#endif + return ret; + +fail_io_unmap: + iounmap(ssc->base); +fail_release_mem: + release_mem_region(AT91RM9200_BASE_SSC1, SZ_16K); + return ret; +} + +static void __exit eti_b1_exit(void) +{ + struct at91_ssc_periph *ssc = eti_b1_dai.cpu_dai->private_data; + + clk_put(pck1_clk); + clk_put(pllb_clk); + + platform_device_unregister(eti_b1_snd_device); + + iounmap(ssc->base); + release_mem_region(AT91RM9200_BASE_SSC1, SZ_16K); +} + +module_init(eti_b1_init); +module_exit(eti_b1_exit); + +/* Module information */ +MODULE_AUTHOR("Frank Mandarino "); +MODULE_DESCRIPTION("ALSA SoC ETI-B1-WM8731"); +MODULE_LICENSE("GPL"); diff --git a/trunk/sound/soc/blackfin/Kconfig b/trunk/sound/soc/blackfin/Kconfig index dc006206f622..f98331d099e7 100644 --- a/trunk/sound/soc/blackfin/Kconfig +++ b/trunk/sound/soc/blackfin/Kconfig @@ -17,22 +17,6 @@ config SND_BF5XX_SOC_SSM2602 help Say Y if you want to add support for SoC audio on BF527-EZKIT. -config SND_BF5XX_SOC_AD73311 - tristate "SoC AD73311 Audio support for Blackfin" - depends on SND_BF5XX_I2S - select SND_BF5XX_SOC_I2S - select SND_SOC_AD73311 - help - Say Y if you want to add support for AD73311 codec on Blackfin. - -config SND_BFIN_AD73311_SE - int "PF pin for AD73311L Chip Select" - depends on SND_BF5XX_SOC_AD73311 - default 4 - help - Enter the GPIO used to control AD73311's SE pin. Acceptable - values are 0 to 7 - config SND_BF5XX_AC97 tristate "SoC AC97 Audio for the ADI BF5xx chip" depends on BLACKFIN && SND_SOC diff --git a/trunk/sound/soc/blackfin/Makefile b/trunk/sound/soc/blackfin/Makefile index 97bb37a6359c..9ea8bd9e0ba3 100644 --- a/trunk/sound/soc/blackfin/Makefile +++ b/trunk/sound/soc/blackfin/Makefile @@ -14,8 +14,7 @@ obj-$(CONFIG_SND_BF5XX_SOC_I2S) += snd-soc-bf5xx-i2s.o # Blackfin Machine Support snd-ad1980-objs := bf5xx-ad1980.o snd-ssm2602-objs := bf5xx-ssm2602.o -snd-ad73311-objs := bf5xx-ad73311.o + obj-$(CONFIG_SND_BF5XX_SOC_AD1980) += snd-ad1980.o obj-$(CONFIG_SND_BF5XX_SOC_SSM2602) += snd-ssm2602.o -obj-$(CONFIG_SND_BF5XX_SOC_AD73311) += snd-ad73311.o diff --git a/trunk/sound/soc/blackfin/bf5xx-ac97-pcm.c b/trunk/sound/soc/blackfin/bf5xx-ac97-pcm.c index 25e50d2ea1ec..51f4907c4831 100644 --- a/trunk/sound/soc/blackfin/bf5xx-ac97-pcm.c +++ b/trunk/sound/soc/blackfin/bf5xx-ac97-pcm.c @@ -56,7 +56,6 @@ static void bf5xx_mmap_copy(struct snd_pcm_substream *substream, sport->tx_pos += runtime->period_size; if (sport->tx_pos >= runtime->buffer_size) sport->tx_pos %= runtime->buffer_size; - sport->tx_delay_pos = sport->tx_pos; } else { bf5xx_ac97_to_pcm( (struct ac97_frame *)sport->rx_dma_buf + sport->rx_pos, @@ -73,15 +72,7 @@ static void bf5xx_dma_irq(void *data) struct snd_pcm_substream *pcm = data; #if defined(CONFIG_SND_MMAP_SUPPORT) struct snd_pcm_runtime *runtime = pcm->runtime; - struct sport_device *sport = runtime->private_data; bf5xx_mmap_copy(pcm, runtime->period_size); - if (pcm->stream == SNDRV_PCM_STREAM_PLAYBACK) { - if (sport->once == 0) { - snd_pcm_period_elapsed(pcm); - bf5xx_mmap_copy(pcm, runtime->period_size); - sport->once = 1; - } - } #endif snd_pcm_period_elapsed(pcm); } @@ -123,10 +114,6 @@ static int bf5xx_pcm_hw_params(struct snd_pcm_substream *substream, static int bf5xx_pcm_hw_free(struct snd_pcm_substream *substream) { - struct snd_pcm_runtime *runtime = substream->runtime; - - if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) - memset(runtime->dma_area, 0, runtime->buffer_size); snd_pcm_lib_free_pages(substream); return 0; } @@ -140,11 +127,16 @@ static int bf5xx_pcm_prepare(struct snd_pcm_substream *substream) * SPORT working in TMD mode(include AC97). */ #if defined(CONFIG_SND_MMAP_SUPPORT) + size_t size = bf5xx_pcm_hardware.buffer_bytes_max + * sizeof(struct ac97_frame) / 4; + /*clean up intermediate buffer*/ if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { + memset(sport->tx_dma_buf, 0, size); sport_set_tx_callback(sport, bf5xx_dma_irq, substream); sport_config_tx_dma(sport, sport->tx_dma_buf, runtime->periods, runtime->period_size * sizeof(struct ac97_frame)); } else { + memset(sport->rx_dma_buf, 0, size); sport_set_rx_callback(sport, bf5xx_dma_irq, substream); sport_config_rx_dma(sport, sport->rx_dma_buf, runtime->periods, runtime->period_size * sizeof(struct ac97_frame)); @@ -172,12 +164,8 @@ static int bf5xx_pcm_trigger(struct snd_pcm_substream *substream, int cmd) pr_debug("%s enter\n", __func__); switch (cmd) { case SNDRV_PCM_TRIGGER_START: - if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { - bf5xx_mmap_copy(substream, runtime->period_size); - snd_pcm_period_elapsed(substream); - sport->tx_delay_pos = 0; + if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) sport_tx_start(sport); - } else sport_rx_start(sport); break; @@ -210,7 +198,7 @@ static snd_pcm_uframes_t bf5xx_pcm_pointer(struct snd_pcm_substream *substream) #if defined(CONFIG_SND_MMAP_SUPPORT) if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) - curr = sport->tx_delay_pos; + curr = sport->tx_pos; else curr = sport->rx_pos; #else @@ -249,21 +237,6 @@ static int bf5xx_pcm_open(struct snd_pcm_substream *substream) return ret; } -static int bf5xx_pcm_close(struct snd_pcm_substream *substream) -{ - struct snd_pcm_runtime *runtime = substream->runtime; - struct sport_device *sport = runtime->private_data; - - pr_debug("%s enter\n", __func__); - if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { - sport->once = 0; - memset(sport->tx_dma_buf, 0, runtime->buffer_size * sizeof(struct ac97_frame)); - } else - memset(sport->rx_dma_buf, 0, runtime->buffer_size * sizeof(struct ac97_frame)); - - return 0; -} - #ifdef CONFIG_SND_MMAP_SUPPORT static int bf5xx_pcm_mmap(struct snd_pcm_substream *substream, struct vm_area_struct *vma) @@ -299,7 +272,6 @@ static int bf5xx_pcm_copy(struct snd_pcm_substream *substream, int channel, struct snd_pcm_ops bf5xx_pcm_ac97_ops = { .open = bf5xx_pcm_open, - .close = bf5xx_pcm_close, .ioctl = snd_pcm_lib_ioctl, .hw_params = bf5xx_pcm_hw_params, .hw_free = bf5xx_pcm_hw_free, diff --git a/trunk/sound/soc/blackfin/bf5xx-ac97.c b/trunk/sound/soc/blackfin/bf5xx-ac97.c index 5e5aafb6485f..c782e311fd56 100644 --- a/trunk/sound/soc/blackfin/bf5xx-ac97.c +++ b/trunk/sound/soc/blackfin/bf5xx-ac97.c @@ -128,6 +128,7 @@ static void enqueue_cmd(struct snd_ac97 *ac97, __u16 addr, __u16 data) int nextfrag = sport_tx_curr_frag(sport); struct ac97_frame *nextwrite; + sport_incfrag(sport, &nextfrag, 1); sport_incfrag(sport, &nextfrag, 1); nextwrite = (struct ac97_frame *)(sport->tx_buf + \ diff --git a/trunk/sound/soc/blackfin/bf5xx-ad73311.c b/trunk/sound/soc/blackfin/bf5xx-ad73311.c deleted file mode 100644 index 622c9b909532..000000000000 --- a/trunk/sound/soc/blackfin/bf5xx-ad73311.c +++ /dev/null @@ -1,240 +0,0 @@ -/* - * File: sound/soc/blackfin/bf5xx-ad73311.c - * Author: Cliff Cai - * - * Created: Thur Sep 25 2008 - * Description: Board driver for ad73311 sound chip - * - * Modified: - * Copyright 2008 Analog Devices Inc. - * - * Bugs: Enter bugs at http://blackfin.uclinux.org/ - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, see the file COPYING, or write - * to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -#include "../codecs/ad73311.h" -#include "bf5xx-sport.h" -#include "bf5xx-i2s-pcm.h" -#include "bf5xx-i2s.h" - -#if CONFIG_SND_BF5XX_SPORT_NUM == 0 -#define bfin_write_SPORT_TCR1 bfin_write_SPORT0_TCR1 -#define bfin_read_SPORT_TCR1 bfin_read_SPORT0_TCR1 -#define bfin_write_SPORT_TCR2 bfin_write_SPORT0_TCR2 -#define bfin_write_SPORT_TX16 bfin_write_SPORT0_TX16 -#define bfin_read_SPORT_STAT bfin_read_SPORT0_STAT -#else -#define bfin_write_SPORT_TCR1 bfin_write_SPORT1_TCR1 -#define bfin_read_SPORT_TCR1 bfin_read_SPORT1_TCR1 -#define bfin_write_SPORT_TCR2 bfin_write_SPORT1_TCR2 -#define bfin_write_SPORT_TX16 bfin_write_SPORT1_TX16 -#define bfin_read_SPORT_STAT bfin_read_SPORT1_STAT -#endif - -#define GPIO_SE CONFIG_SND_BFIN_AD73311_SE - -static struct snd_soc_machine bf5xx_ad73311; - -static int snd_ad73311_startup(void) -{ - pr_debug("%s enter\n", __func__); - - /* Pull up SE pin on AD73311L */ - gpio_set_value(GPIO_SE, 1); - return 0; -} - -static int snd_ad73311_configure(void) -{ - unsigned short ctrl_regs[6]; - unsigned short status = 0; - int count = 0; - - /* DMCLK = MCLK = 16.384 MHz - * SCLK = DMCLK/8 = 2.048 MHz - * Sample Rate = DMCLK/2048 = 8 KHz - */ - ctrl_regs[0] = AD_CONTROL | AD_WRITE | CTRL_REG_B | REGB_MCDIV(0) | \ - REGB_SCDIV(0) | REGB_DIRATE(0); - ctrl_regs[1] = AD_CONTROL | AD_WRITE | CTRL_REG_C | REGC_PUDEV | \ - REGC_PUADC | REGC_PUDAC | REGC_PUREF | REGC_REFUSE ; - ctrl_regs[2] = AD_CONTROL | AD_WRITE | CTRL_REG_D | REGD_OGS(2) | \ - REGD_IGS(2); - ctrl_regs[3] = AD_CONTROL | AD_WRITE | CTRL_REG_E | REGE_DA(0x1f); - ctrl_regs[4] = AD_CONTROL | AD_WRITE | CTRL_REG_F | REGF_SEEN ; - ctrl_regs[5] = AD_CONTROL | AD_WRITE | CTRL_REG_A | REGA_MODE_DATA; - - local_irq_disable(); - snd_ad73311_startup(); - udelay(1); - - bfin_write_SPORT_TCR1(TFSR); - bfin_write_SPORT_TCR2(0xF); - SSYNC(); - - /* SPORT Tx Register is a 8 x 16 FIFO, all the data can be put to - * FIFO before enable SPORT to transfer the data - */ - for (count = 0; count < 6; count++) - bfin_write_SPORT_TX16(ctrl_regs[count]); - SSYNC(); - bfin_write_SPORT_TCR1(bfin_read_SPORT_TCR1() | TSPEN); - SSYNC(); - - /* When TUVF is set, the data is already send out */ - while (!(status & TUVF) && count++ < 10000) { - udelay(1); - status = bfin_read_SPORT_STAT(); - SSYNC(); - } - bfin_write_SPORT_TCR1(bfin_read_SPORT_TCR1() & ~TSPEN); - SSYNC(); - local_irq_enable(); - - if (count == 10000) { - printk(KERN_ERR "ad73311: failed to configure codec\n"); - return -1; - } - return 0; -} - -static int bf5xx_probe(struct platform_device *pdev) -{ - int err; - if (gpio_request(GPIO_SE, "AD73311_SE")) { - printk(KERN_ERR "%s: Failed ro request GPIO_%d\n", __func__, GPIO_SE); - return -EBUSY; - } - - gpio_direction_output(GPIO_SE, 0); - - err = snd_ad73311_configure(); - if (err < 0) - return -EFAULT; - - return 0; -} - -static int bf5xx_ad73311_startup(struct snd_pcm_substream *substream) -{ - struct snd_soc_pcm_runtime *rtd = substream->private_data; - struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai; - - pr_debug("%s enter\n", __func__); - cpu_dai->private_data = sport_handle; - return 0; -} - -static int bf5xx_ad73311_hw_params(struct snd_pcm_substream *substream, - struct snd_pcm_hw_params *params) -{ - struct snd_soc_pcm_runtime *rtd = substream->private_data; - struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai; - int ret = 0; - - pr_debug("%s rate %d format %x\n", __func__, params_rate(params), - params_format(params)); - - /* set cpu DAI configuration */ - ret = cpu_dai->dai_ops.set_fmt(cpu_dai, SND_SOC_DAIFMT_DSP_A | - SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBM_CFM); - if (ret < 0) - return ret; - - return 0; -} - - -static struct snd_soc_ops bf5xx_ad73311_ops = { - .startup = bf5xx_ad73311_startup, - .hw_params = bf5xx_ad73311_hw_params, -}; - -static struct snd_soc_dai_link bf5xx_ad73311_dai = { - .name = "ad73311", - .stream_name = "AD73311", - .cpu_dai = &bf5xx_i2s_dai, - .codec_dai = &ad73311_dai, - .ops = &bf5xx_ad73311_ops, -}; - -static struct snd_soc_machine bf5xx_ad73311 = { - .name = "bf5xx_ad73311", - .probe = bf5xx_probe, - .dai_link = &bf5xx_ad73311_dai, - .num_links = 1, -}; - -static struct snd_soc_device bf5xx_ad73311_snd_devdata = { - .machine = &bf5xx_ad73311, - .platform = &bf5xx_i2s_soc_platform, - .codec_dev = &soc_codec_dev_ad73311, -}; - -static struct platform_device *bf52x_ad73311_snd_device; - -static int __init bf5xx_ad73311_init(void) -{ - int ret; - - pr_debug("%s enter\n", __func__); - bf52x_ad73311_snd_device = platform_device_alloc("soc-audio", -1); - if (!bf52x_ad73311_snd_device) - return -ENOMEM; - - platform_set_drvdata(bf52x_ad73311_snd_device, &bf5xx_ad73311_snd_devdata); - bf5xx_ad73311_snd_devdata.dev = &bf52x_ad73311_snd_device->dev; - ret = platform_device_add(bf52x_ad73311_snd_device); - - if (ret) - platform_device_put(bf52x_ad73311_snd_device); - - return ret; -} - -static void __exit bf5xx_ad73311_exit(void) -{ - pr_debug("%s enter\n", __func__); - platform_device_unregister(bf52x_ad73311_snd_device); -} - -module_init(bf5xx_ad73311_init); -module_exit(bf5xx_ad73311_exit); - -/* Module information */ -MODULE_AUTHOR("Cliff Cai"); -MODULE_DESCRIPTION("ALSA SoC AD73311 Blackfin"); -MODULE_LICENSE("GPL"); - diff --git a/trunk/sound/soc/blackfin/bf5xx-i2s.c b/trunk/sound/soc/blackfin/bf5xx-i2s.c index 827587f08180..43a4092eeb89 100644 --- a/trunk/sound/soc/blackfin/bf5xx-i2s.c +++ b/trunk/sound/soc/blackfin/bf5xx-i2s.c @@ -70,13 +70,6 @@ static struct sport_param sport_params[2] = { } }; -static u16 sport_req[][7] = { - { P_SPORT0_DTPRI, P_SPORT0_TSCLK, P_SPORT0_RFS, - P_SPORT0_DRPRI, P_SPORT0_RSCLK, 0}, - { P_SPORT1_DTPRI, P_SPORT1_TSCLK, P_SPORT1_RFS, - P_SPORT1_DRPRI, P_SPORT1_RSCLK, 0}, -}; - static int bf5xx_i2s_set_dai_fmt(struct snd_soc_dai *cpu_dai, unsigned int fmt) { @@ -85,14 +78,6 @@ static int bf5xx_i2s_set_dai_fmt(struct snd_soc_dai *cpu_dai, /* interface format:support I2S,slave mode */ switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) { case SND_SOC_DAIFMT_I2S: - bf5xx_i2s.tcr1 |= TFSR | TCKFE; - bf5xx_i2s.rcr1 |= RFSR | RCKFE; - bf5xx_i2s.tcr2 |= TSFSE; - bf5xx_i2s.rcr2 |= RSFSE; - break; - case SND_SOC_DAIFMT_DSP_A: - bf5xx_i2s.tcr1 |= TFSR; - bf5xx_i2s.rcr1 |= RFSR; break; case SND_SOC_DAIFMT_LEFT_J: ret = -EINVAL; @@ -142,17 +127,14 @@ static int bf5xx_i2s_hw_params(struct snd_pcm_substream *substream, case SNDRV_PCM_FORMAT_S16_LE: bf5xx_i2s.tcr2 |= 15; bf5xx_i2s.rcr2 |= 15; - sport_handle->wdsize = 2; break; case SNDRV_PCM_FORMAT_S24_LE: bf5xx_i2s.tcr2 |= 23; bf5xx_i2s.rcr2 |= 23; - sport_handle->wdsize = 3; break; case SNDRV_PCM_FORMAT_S32_LE: bf5xx_i2s.tcr2 |= 31; bf5xx_i2s.rcr2 |= 31; - sport_handle->wdsize = 4; break; } @@ -163,17 +145,17 @@ static int bf5xx_i2s_hw_params(struct snd_pcm_substream *substream, * need to configure both of them at the time when the first * stream is opened. * - * CPU DAI:slave mode. + * CPU DAI format:I2S, slave mode. */ - ret = sport_config_rx(sport_handle, bf5xx_i2s.rcr1, - bf5xx_i2s.rcr2, 0, 0); + ret = sport_config_rx(sport_handle, RFSR | RCKFE, + RSFSE|bf5xx_i2s.rcr2, 0, 0); if (ret) { pr_err("SPORT is busy!\n"); return -EBUSY; } - ret = sport_config_tx(sport_handle, bf5xx_i2s.tcr1, - bf5xx_i2s.tcr2, 0, 0); + ret = sport_config_tx(sport_handle, TFSR | TCKFE, + TSFSE|bf5xx_i2s.tcr2, 0, 0); if (ret) { pr_err("SPORT is busy!\n"); return -EBUSY; @@ -192,6 +174,13 @@ static void bf5xx_i2s_shutdown(struct snd_pcm_substream *substream) static int bf5xx_i2s_probe(struct platform_device *pdev, struct snd_soc_dai *dai) { + u16 sport_req[][7] = { + { P_SPORT0_DTPRI, P_SPORT0_TSCLK, P_SPORT0_RFS, + P_SPORT0_DRPRI, P_SPORT0_RSCLK, 0}, + { P_SPORT1_DTPRI, P_SPORT1_TSCLK, P_SPORT1_RFS, + P_SPORT1_DRPRI, P_SPORT1_RSCLK, 0}, + }; + pr_debug("%s enter\n", __func__); if (peripheral_request_list(&sport_req[sport_num][0], "soc-audio")) { pr_err("Requesting Peripherals failed\n"); @@ -209,13 +198,6 @@ static int bf5xx_i2s_probe(struct platform_device *pdev, return 0; } -static void bf5xx_i2s_remove(struct platform_device *pdev, - struct snd_soc_dai *dai) -{ - pr_debug("%s enter\n", __func__); - peripheral_free_list(&sport_req[sport_num][0]); -} - #ifdef CONFIG_PM static int bf5xx_i2s_suspend(struct platform_device *dev, struct snd_soc_dai *dai) @@ -281,16 +263,15 @@ struct snd_soc_dai bf5xx_i2s_dai = { .id = 0, .type = SND_SOC_DAI_I2S, .probe = bf5xx_i2s_probe, - .remove = bf5xx_i2s_remove, .suspend = bf5xx_i2s_suspend, .resume = bf5xx_i2s_resume, .playback = { - .channels_min = 1, + .channels_min = 2, .channels_max = 2, .rates = BF5XX_I2S_RATES, .formats = BF5XX_I2S_FORMATS,}, .capture = { - .channels_min = 1, + .channels_min = 2, .channels_max = 2, .rates = BF5XX_I2S_RATES, .formats = BF5XX_I2S_FORMATS,}, diff --git a/trunk/sound/soc/blackfin/bf5xx-sport.h b/trunk/sound/soc/blackfin/bf5xx-sport.h index fcadcc081f7f..4c163454bbf8 100644 --- a/trunk/sound/soc/blackfin/bf5xx-sport.h +++ b/trunk/sound/soc/blackfin/bf5xx-sport.h @@ -123,8 +123,6 @@ struct sport_device { int rx_pos; unsigned int tx_buffer_size; unsigned int rx_buffer_size; - int tx_delay_pos; - int once; #endif void *private_data; }; diff --git a/trunk/sound/soc/codecs/Kconfig b/trunk/sound/soc/codecs/Kconfig index 4975d8573e4f..e0b9869df0f1 100644 --- a/trunk/sound/soc/codecs/Kconfig +++ b/trunk/sound/soc/codecs/Kconfig @@ -3,11 +3,9 @@ config SND_SOC_ALL_CODECS depends on I2C select SPI select SPI_MASTER - select SND_SOC_AD73311 select SND_SOC_AK4535 select SND_SOC_CS4270 select SND_SOC_SSM2602 - select SND_SOC_TLV320AIC23 select SND_SOC_TLV320AIC26 select SND_SOC_TLV320AIC3X select SND_SOC_UDA1380 @@ -36,9 +34,6 @@ config SND_SOC_AC97_CODEC config SND_SOC_AD1980 tristate -config SND_SOC_AD73311 - tristate - config SND_SOC_AK4535 tristate @@ -63,13 +58,9 @@ config SND_SOC_CS4270_VD33_ERRATA config SND_SOC_SSM2602 tristate -config SND_SOC_TLV320AIC23 - tristate - depends on I2C - config SND_SOC_TLV320AIC26 tristate "TI TLV320AIC26 Codec support" - depends on SPI + depends on SND_SOC && SPI config SND_SOC_TLV320AIC3X tristate diff --git a/trunk/sound/soc/codecs/Makefile b/trunk/sound/soc/codecs/Makefile index 90f0a585fc70..f977978a3409 100644 --- a/trunk/sound/soc/codecs/Makefile +++ b/trunk/sound/soc/codecs/Makefile @@ -1,10 +1,8 @@ snd-soc-ac97-objs := ac97.o snd-soc-ad1980-objs := ad1980.o -snd-soc-ad73311-objs := ad73311.o snd-soc-ak4535-objs := ak4535.o snd-soc-cs4270-objs := cs4270.o snd-soc-ssm2602-objs := ssm2602.o -snd-soc-tlv320aic23-objs := tlv320aic23.o snd-soc-tlv320aic26-objs := tlv320aic26.o snd-soc-tlv320aic3x-objs := tlv320aic3x.o snd-soc-uda1380-objs := uda1380.o @@ -22,11 +20,9 @@ snd-soc-wm9713-objs := wm9713.o obj-$(CONFIG_SND_SOC_AC97_CODEC) += snd-soc-ac97.o obj-$(CONFIG_SND_SOC_AD1980) += snd-soc-ad1980.o -obj-$(CONFIG_SND_SOC_AD73311) += snd-soc-ad73311.o obj-$(CONFIG_SND_SOC_AK4535) += snd-soc-ak4535.o obj-$(CONFIG_SND_SOC_CS4270) += snd-soc-cs4270.o obj-$(CONFIG_SND_SOC_SSM2602) += snd-soc-ssm2602.o -obj-$(CONFIG_SND_SOC_TLV320AIC23) += snd-soc-tlv320aic23.o obj-$(CONFIG_SND_SOC_TLV320AIC26) += snd-soc-tlv320aic26.o obj-$(CONFIG_SND_SOC_TLV320AIC3X) += snd-soc-tlv320aic3x.o obj-$(CONFIG_SND_SOC_UDA1380) += snd-soc-uda1380.o diff --git a/trunk/sound/soc/codecs/ac97.c b/trunk/sound/soc/codecs/ac97.c index bd1ebdc6c86c..61fd96ca7bc7 100644 --- a/trunk/sound/soc/codecs/ac97.c +++ b/trunk/sound/soc/codecs/ac97.c @@ -2,7 +2,8 @@ * ac97.c -- ALSA Soc AC97 codec support * * Copyright 2005 Wolfson Microelectronics PLC. - * Author: Liam Girdwood + * Author: Liam Girdwood + * liam.girdwood@wolfsonmicro.com or linux@wolfsonmicro.com * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/trunk/sound/soc/codecs/ad1980.c b/trunk/sound/soc/codecs/ad1980.c index 1397b8e06c0b..4e09c1f2c063 100644 --- a/trunk/sound/soc/codecs/ad1980.c +++ b/trunk/sound/soc/codecs/ad1980.c @@ -13,6 +13,7 @@ #include #include +#include #include #include #include diff --git a/trunk/sound/soc/codecs/ad73311.c b/trunk/sound/soc/codecs/ad73311.c deleted file mode 100644 index 37af8607b00a..000000000000 --- a/trunk/sound/soc/codecs/ad73311.c +++ /dev/null @@ -1,107 +0,0 @@ -/* - * ad73311.c -- ALSA Soc AD73311 codec support - * - * Copyright: Analog Device Inc. - * Author: Cliff Cai - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * Revision history - * 25th Sep 2008 Initial version. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "ad73311.h" - -struct snd_soc_dai ad73311_dai = { - .name = "AD73311", - .playback = { - .stream_name = "Playback", - .channels_min = 1, - .channels_max = 1, - .rates = SNDRV_PCM_RATE_8000, - .formats = SNDRV_PCM_FMTBIT_S16_LE, }, - .capture = { - .stream_name = "Capture", - .channels_min = 1, - .channels_max = 1, - .rates = SNDRV_PCM_RATE_8000, - .formats = SNDRV_PCM_FMTBIT_S16_LE, }, -}; -EXPORT_SYMBOL_GPL(ad73311_dai); - -static int ad73311_soc_probe(struct platform_device *pdev) -{ - struct snd_soc_device *socdev = platform_get_drvdata(pdev); - struct snd_soc_codec *codec; - int ret = 0; - - codec = kzalloc(sizeof(struct snd_soc_codec), GFP_KERNEL); - if (codec == NULL) - return -ENOMEM; - mutex_init(&codec->mutex); - codec->name = "AD73311"; - codec->owner = THIS_MODULE; - codec->dai = &ad73311_dai; - codec->num_dai = 1; - socdev->codec = codec; - INIT_LIST_HEAD(&codec->dapm_widgets); - INIT_LIST_HEAD(&codec->dapm_paths); - - /* register pcms */ - ret = snd_soc_new_pcms(socdev, SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1); - if (ret < 0) { - printk(KERN_ERR "ad73311: failed to create pcms\n"); - goto pcm_err; - } - - ret = snd_soc_register_card(socdev); - if (ret < 0) { - printk(KERN_ERR "ad73311: failed to register card\n"); - goto register_err; - } - - return ret; - -register_err: - snd_soc_free_pcms(socdev); -pcm_err: - kfree(socdev->codec); - socdev->codec = NULL; - return ret; -} - -static int ad73311_soc_remove(struct platform_device *pdev) -{ - struct snd_soc_device *socdev = platform_get_drvdata(pdev); - struct snd_soc_codec *codec = socdev->codec; - - if (codec == NULL) - return 0; - snd_soc_free_pcms(socdev); - kfree(codec); - return 0; -} - -struct snd_soc_codec_device soc_codec_dev_ad73311 = { - .probe = ad73311_soc_probe, - .remove = ad73311_soc_remove, -}; -EXPORT_SYMBOL_GPL(soc_codec_dev_ad73311); - -MODULE_DESCRIPTION("ASoC ad73311 driver"); -MODULE_AUTHOR("Cliff Cai "); -MODULE_LICENSE("GPL"); diff --git a/trunk/sound/soc/codecs/ad73311.h b/trunk/sound/soc/codecs/ad73311.h deleted file mode 100644 index 507ce0c30edf..000000000000 --- a/trunk/sound/soc/codecs/ad73311.h +++ /dev/null @@ -1,90 +0,0 @@ -/* - * File: sound/soc/codec/ad73311.h - * Based on: - * Author: Cliff Cai - * - * Created: Thur Sep 25, 2008 - * Description: definitions for AD73311 registers - * - * - * Modified: - * Copyright 2006 Analog Devices Inc. - * - * Bugs: Enter bugs at http://blackfin.uclinux.org/ - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, see the file COPYING, or write - * to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef __AD73311_H__ -#define __AD73311_H__ - -#define AD_CONTROL 0x8000 -#define AD_DATA 0x0000 -#define AD_READ 0x4000 -#define AD_WRITE 0x0000 - -/* Control register A */ -#define CTRL_REG_A (0 << 8) - -#define REGA_MODE_PRO 0x00 -#define REGA_MODE_DATA 0x01 -#define REGA_MODE_MIXED 0x03 -#define REGA_DLB 0x04 -#define REGA_SLB 0x08 -#define REGA_DEVC(x) ((x & 0x7) << 4) -#define REGA_RESET 0x80 - -/* Control register B */ -#define CTRL_REG_B (1 << 8) - -#define REGB_DIRATE(x) (x & 0x3) -#define REGB_SCDIV(x) ((x & 0x3) << 2) -#define REGB_MCDIV(x) ((x & 0x7) << 4) -#define REGB_CEE (1 << 7) - -/* Control register C */ -#define CTRL_REG_C (2 << 8) - -#define REGC_PUDEV (1 << 0) -#define REGC_PUADC (1 << 3) -#define REGC_PUDAC (1 << 4) -#define REGC_PUREF (1 << 5) -#define REGC_REFUSE (1 << 6) - -/* Control register D */ -#define CTRL_REG_D (3 << 8) - -#define REGD_IGS(x) (x & 0x7) -#define REGD_RMOD (1 << 3) -#define REGD_OGS(x) ((x & 0x7) << 4) -#define REGD_MUTE (x << 7) - -/* Control register E */ -#define CTRL_REG_E (4 << 8) - -#define REGE_DA(x) (x & 0x1f) -#define REGE_IBYP (1 << 5) - -/* Control register F */ -#define CTRL_REG_F (5 << 8) - -#define REGF_SEEN (1 << 5) -#define REGF_INV (1 << 6) -#define REGF_ALB (1 << 7) - -extern struct snd_soc_dai ad73311_dai; -extern struct snd_soc_codec_device soc_codec_dev_ad73311; -#endif diff --git a/trunk/sound/soc/codecs/ak4535.c b/trunk/sound/soc/codecs/ak4535.c index 2a89b5888e11..088cf9927720 100644 --- a/trunk/sound/soc/codecs/ak4535.c +++ b/trunk/sound/soc/codecs/ak4535.c @@ -28,6 +28,7 @@ #include "ak4535.h" +#define AUDIO_NAME "ak4535" #define AK4535_VERSION "0.3" struct snd_soc_codec_device soc_codec_dev_ak4535; diff --git a/trunk/sound/soc/codecs/ssm2602.c b/trunk/sound/soc/codecs/ssm2602.c index 44ef0dacd564..940ce1c3522e 100644 --- a/trunk/sound/soc/codecs/ssm2602.c +++ b/trunk/sound/soc/codecs/ssm2602.c @@ -42,6 +42,7 @@ #include "ssm2602.h" +#define AUDIO_NAME "ssm2602" #define SSM2602_VERSION "0.1" struct snd_soc_codec_device soc_codec_dev_ssm2602; diff --git a/trunk/sound/soc/codecs/tlv320aic23.c b/trunk/sound/soc/codecs/tlv320aic23.c deleted file mode 100644 index bac7815e00fb..000000000000 --- a/trunk/sound/soc/codecs/tlv320aic23.c +++ /dev/null @@ -1,714 +0,0 @@ -/* - * ALSA SoC TLV320AIC23 codec driver - * - * Author: Arun KS, - * Copyright: (C) 2008 Mistral Solutions Pvt Ltd., - * - * Based on sound/soc/codecs/wm8731.c by Richard Purdie - * - * 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. - * - * Notes: - * The AIC23 is a driver for a low power stereo audio - * codec tlv320aic23 - * - * The machine layer should disable unsupported inputs/outputs by - * snd_soc_dapm_disable_pin(codec, "LHPOUT"), etc. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "tlv320aic23.h" - -#define AIC23_VERSION "0.1" - -struct tlv320aic23_srate_reg_info { - u32 sample_rate; - u8 control; /* SR3, SR2, SR1, SR0 and BOSR */ - u8 divider; /* if 0 CLKIN = MCLK, if 1 CLKIN = MCLK/2 */ -}; - -/* - * AIC23 register cache - */ -static const u16 tlv320aic23_reg[] = { - 0x0097, 0x0097, 0x00F9, 0x00F9, /* 0 */ - 0x001A, 0x0004, 0x0007, 0x0001, /* 4 */ - 0x0020, 0x0000, 0x0000, 0x0000, /* 8 */ - 0x0000, 0x0000, 0x0000, 0x0000, /* 12 */ -}; - -/* - * read tlv320aic23 register cache - */ -static inline unsigned int tlv320aic23_read_reg_cache(struct snd_soc_codec - *codec, unsigned int reg) -{ - u16 *cache = codec->reg_cache; - if (reg >= ARRAY_SIZE(tlv320aic23_reg)) - return -1; - return cache[reg]; -} - -/* - * write tlv320aic23 register cache - */ -static inline void tlv320aic23_write_reg_cache(struct snd_soc_codec *codec, - u8 reg, u16 value) -{ - u16 *cache = codec->reg_cache; - if (reg >= ARRAY_SIZE(tlv320aic23_reg)) - return; - cache[reg] = value; -} - -/* - * write to the tlv320aic23 register space - */ -static int tlv320aic23_write(struct snd_soc_codec *codec, unsigned int reg, - unsigned int value) -{ - - u8 data; - - /* TLV320AIC23 has 7 bit address and 9 bits of data - * so we need to switch one data bit into reg and rest - * of data into val - */ - - if ((reg < 0 || reg > 9) && (reg != 15)) { - printk(KERN_WARNING "%s Invalid register R%d\n", __func__, reg); - return -1; - } - - data = (reg << 1) | (value >> 8 & 0x01); - - tlv320aic23_write_reg_cache(codec, reg, value); - - if (codec->hw_write(codec->control_data, data, - (value & 0xff)) == 0) - return 0; - - printk(KERN_ERR "%s cannot write %03x to register R%d\n", __func__, - value, reg); - - return -EIO; -} - -static const char *rec_src_text[] = { "Line", "Mic" }; -static const char *deemph_text[] = {"None", "32Khz", "44.1Khz", "48Khz"}; - -static const struct soc_enum rec_src_enum = - SOC_ENUM_SINGLE(TLV320AIC23_ANLG, 2, 2, rec_src_text); - -static const struct snd_kcontrol_new tlv320aic23_rec_src_mux_controls = -SOC_DAPM_ENUM("Input Select", rec_src_enum); - -static const struct soc_enum tlv320aic23_rec_src = - SOC_ENUM_SINGLE(TLV320AIC23_ANLG, 2, 2, rec_src_text); -static const struct soc_enum tlv320aic23_deemph = - SOC_ENUM_SINGLE(TLV320AIC23_DIGT, 1, 4, deemph_text); - -static const DECLARE_TLV_DB_SCALE(out_gain_tlv, -12100, 100, 0); -static const DECLARE_TLV_DB_SCALE(input_gain_tlv, -1725, 75, 0); -static const DECLARE_TLV_DB_SCALE(sidetone_vol_tlv, -1800, 300, 0); - -static int snd_soc_tlv320aic23_put_volsw(struct snd_kcontrol *kcontrol, - struct snd_ctl_elem_value *ucontrol) -{ - struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); - u16 val, reg; - - val = (ucontrol->value.integer.value[0] & 0x07); - - /* linear conversion to userspace - * 000 = -6db - * 001 = -9db - * 010 = -12db - * 011 = -18db (Min) - * 100 = 0db (Max) - */ - val = (val >= 4) ? 4 : (3 - val); - - reg = tlv320aic23_read_reg_cache(codec, TLV320AIC23_ANLG) & (~0x1C0); - tlv320aic23_write(codec, TLV320AIC23_ANLG, reg | (val << 6)); - - return 0; -} - -static int snd_soc_tlv320aic23_get_volsw(struct snd_kcontrol *kcontrol, - struct snd_ctl_elem_value *ucontrol) -{ - struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); - u16 val; - - val = tlv320aic23_read_reg_cache(codec, TLV320AIC23_ANLG) & (0x1C0); - val = val >> 6; - val = (val >= 4) ? 4 : (3 - val); - ucontrol->value.integer.value[0] = val; - return 0; - -} - -#define SOC_TLV320AIC23_SINGLE_TLV(xname, reg, shift, max, invert, tlv_array) \ -{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ - .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ |\ - SNDRV_CTL_ELEM_ACCESS_READWRITE,\ - .tlv.p = (tlv_array), \ - .info = snd_soc_info_volsw, .get = snd_soc_tlv320aic23_get_volsw,\ - .put = snd_soc_tlv320aic23_put_volsw, \ - .private_value = SOC_SINGLE_VALUE(reg, shift, max, invert) } - -static const struct snd_kcontrol_new tlv320aic23_snd_controls[] = { - SOC_DOUBLE_R_TLV("Digital Playback Volume", TLV320AIC23_LCHNVOL, - TLV320AIC23_RCHNVOL, 0, 127, 0, out_gain_tlv), - SOC_SINGLE("Digital Playback Switch", TLV320AIC23_DIGT, 3, 1, 1), - SOC_DOUBLE_R("Line Input Switch", TLV320AIC23_LINVOL, - TLV320AIC23_RINVOL, 7, 1, 0), - SOC_DOUBLE_R_TLV("Line Input Volume", TLV320AIC23_LINVOL, - TLV320AIC23_RINVOL, 0, 31, 0, input_gain_tlv), - SOC_SINGLE("Mic Input Switch", TLV320AIC23_ANLG, 1, 1, 1), - SOC_SINGLE("Mic Booster Switch", TLV320AIC23_ANLG, 0, 1, 0), - SOC_TLV320AIC23_SINGLE_TLV("Sidetone Volume", TLV320AIC23_ANLG, - 6, 4, 0, sidetone_vol_tlv), - SOC_ENUM("Playback De-emphasis", tlv320aic23_deemph), -}; - -/* add non dapm controls */ -static int tlv320aic23_add_controls(struct snd_soc_codec *codec) -{ - - int err, i; - - for (i = 0; i < ARRAY_SIZE(tlv320aic23_snd_controls); i++) { - err = snd_ctl_add(codec->card, - snd_soc_cnew(&tlv320aic23_snd_controls[i], - codec, NULL)); - if (err < 0) - return err; - } - - return 0; - -} - -/* PGA Mixer controls for Line and Mic switch */ -static const struct snd_kcontrol_new tlv320aic23_output_mixer_controls[] = { - SOC_DAPM_SINGLE("Line Bypass Switch", TLV320AIC23_ANLG, 3, 1, 0), - SOC_DAPM_SINGLE("Mic Sidetone Switch", TLV320AIC23_ANLG, 5, 1, 0), - SOC_DAPM_SINGLE("Playback Switch", TLV320AIC23_ANLG, 4, 1, 0), -}; - -static const struct snd_soc_dapm_widget tlv320aic23_dapm_widgets[] = { - SND_SOC_DAPM_DAC("DAC", "Playback", TLV320AIC23_PWR, 3, 1), - SND_SOC_DAPM_ADC("ADC", "Capture", TLV320AIC23_PWR, 2, 1), - SND_SOC_DAPM_MUX("Capture Source", SND_SOC_NOPM, 0, 0, - &tlv320aic23_rec_src_mux_controls), - SND_SOC_DAPM_MIXER("Output Mixer", TLV320AIC23_PWR, 4, 1, - &tlv320aic23_output_mixer_controls[0], - ARRAY_SIZE(tlv320aic23_output_mixer_controls)), - SND_SOC_DAPM_PGA("Line Input", TLV320AIC23_PWR, 0, 1, NULL, 0), - SND_SOC_DAPM_PGA("Mic Input", TLV320AIC23_PWR, 1, 1, NULL, 0), - - SND_SOC_DAPM_OUTPUT("LHPOUT"), - SND_SOC_DAPM_OUTPUT("RHPOUT"), - SND_SOC_DAPM_OUTPUT("LOUT"), - SND_SOC_DAPM_OUTPUT("ROUT"), - - SND_SOC_DAPM_INPUT("LLINEIN"), - SND_SOC_DAPM_INPUT("RLINEIN"), - - SND_SOC_DAPM_INPUT("MICIN"), -}; - -static const struct snd_soc_dapm_route intercon[] = { - /* Output Mixer */ - {"Output Mixer", "Line Bypass Switch", "Line Input"}, - {"Output Mixer", "Playback Switch", "DAC"}, - {"Output Mixer", "Mic Sidetone Switch", "Mic Input"}, - - /* Outputs */ - {"RHPOUT", NULL, "Output Mixer"}, - {"LHPOUT", NULL, "Output Mixer"}, - {"LOUT", NULL, "Output Mixer"}, - {"ROUT", NULL, "Output Mixer"}, - - /* Inputs */ - {"Line Input", "NULL", "LLINEIN"}, - {"Line Input", "NULL", "RLINEIN"}, - - {"Mic Input", "NULL", "MICIN"}, - - /* input mux */ - {"Capture Source", "Line", "Line Input"}, - {"Capture Source", "Mic", "Mic Input"}, - {"ADC", NULL, "Capture Source"}, - -}; - -/* tlv320aic23 related */ -static const struct tlv320aic23_srate_reg_info srate_reg_info[] = { - {4000, 0x06, 1}, /* 4000 */ - {8000, 0x06, 0}, /* 8000 */ - {16000, 0x0C, 1}, /* 16000 */ - {22050, 0x11, 1}, /* 22050 */ - {24000, 0x00, 1}, /* 24000 */ - {32000, 0x0C, 0}, /* 32000 */ - {44100, 0x11, 0}, /* 44100 */ - {48000, 0x00, 0}, /* 48000 */ - {88200, 0x1F, 0}, /* 88200 */ - {96000, 0x0E, 0}, /* 96000 */ -}; - -static int tlv320aic23_add_widgets(struct snd_soc_codec *codec) -{ - snd_soc_dapm_new_controls(codec, tlv320aic23_dapm_widgets, - ARRAY_SIZE(tlv320aic23_dapm_widgets)); - - /* set up audio path interconnects */ - snd_soc_dapm_add_routes(codec, intercon, ARRAY_SIZE(intercon)); - - snd_soc_dapm_new_widgets(codec); - return 0; -} - -static int tlv320aic23_hw_params(struct snd_pcm_substream *substream, - struct snd_pcm_hw_params *params) -{ - struct snd_soc_pcm_runtime *rtd = substream->private_data; - struct snd_soc_device *socdev = rtd->socdev; - struct snd_soc_codec *codec = socdev->codec; - u16 iface_reg, data; - u8 count = 0; - - iface_reg = - tlv320aic23_read_reg_cache(codec, - TLV320AIC23_DIGT_FMT) & ~(0x03 << 2); - - /* Search for the right sample rate */ - /* Verify what happens if the rate is not supported - * now it goes to 96Khz */ - while ((srate_reg_info[count].sample_rate != params_rate(params)) && - (count < ARRAY_SIZE(srate_reg_info))) { - count++; - } - - data = (srate_reg_info[count].divider << TLV320AIC23_CLKIN_SHIFT) | - (srate_reg_info[count]. control << TLV320AIC23_BOSR_SHIFT) | - TLV320AIC23_USB_CLK_ON; - - tlv320aic23_write(codec, TLV320AIC23_SRATE, data); - - switch (params_format(params)) { - case SNDRV_PCM_FORMAT_S16_LE: - break; - case SNDRV_PCM_FORMAT_S20_3LE: - iface_reg |= (0x01 << 2); - break; - case SNDRV_PCM_FORMAT_S24_LE: - iface_reg |= (0x02 << 2); - break; - case SNDRV_PCM_FORMAT_S32_LE: - iface_reg |= (0x03 << 2); - break; - } - tlv320aic23_write(codec, TLV320AIC23_DIGT_FMT, iface_reg); - - return 0; -} - -static int tlv320aic23_pcm_prepare(struct snd_pcm_substream *substream) -{ - struct snd_soc_pcm_runtime *rtd = substream->private_data; - struct snd_soc_device *socdev = rtd->socdev; - struct snd_soc_codec *codec = socdev->codec; - - /* set active */ - tlv320aic23_write(codec, TLV320AIC23_ACTIVE, 0x0001); - - return 0; -} - -static void tlv320aic23_shutdown(struct snd_pcm_substream *substream) -{ - struct snd_soc_pcm_runtime *rtd = substream->private_data; - struct snd_soc_device *socdev = rtd->socdev; - struct snd_soc_codec *codec = socdev->codec; - - /* deactivate */ - if (!codec->active) { - udelay(50); - tlv320aic23_write(codec, TLV320AIC23_ACTIVE, 0x0); - } -} - -static int tlv320aic23_mute(struct snd_soc_dai *dai, int mute) -{ - struct snd_soc_codec *codec = dai->codec; - u16 reg; - - reg = tlv320aic23_read_reg_cache(codec, TLV320AIC23_DIGT); - if (mute) - reg |= TLV320AIC23_DACM_MUTE; - - else - reg &= ~TLV320AIC23_DACM_MUTE; - - tlv320aic23_write(codec, TLV320AIC23_DIGT, reg); - - return 0; -} - -static int tlv320aic23_set_dai_fmt(struct snd_soc_dai *codec_dai, - unsigned int fmt) -{ - struct snd_soc_codec *codec = codec_dai->codec; - u16 iface_reg; - - iface_reg = - tlv320aic23_read_reg_cache(codec, TLV320AIC23_DIGT_FMT) & (~0x03); - - /* set master/slave audio interface */ - switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) { - case SND_SOC_DAIFMT_CBM_CFM: - iface_reg |= TLV320AIC23_MS_MASTER; - break; - case SND_SOC_DAIFMT_CBS_CFS: - break; - default: - return -EINVAL; - - } - - /* interface format */ - switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) { - case SND_SOC_DAIFMT_I2S: - iface_reg |= TLV320AIC23_FOR_I2S; - break; - case SND_SOC_DAIFMT_DSP_A: - iface_reg |= TLV320AIC23_FOR_DSP; - break; - case SND_SOC_DAIFMT_RIGHT_J: - break; - case SND_SOC_DAIFMT_LEFT_J: - iface_reg |= TLV320AIC23_FOR_LJUST; - break; - default: - return -EINVAL; - - } - - tlv320aic23_write(codec, TLV320AIC23_DIGT_FMT, iface_reg); - - return 0; -} - -static int tlv320aic23_set_dai_sysclk(struct snd_soc_dai *codec_dai, - int clk_id, unsigned int freq, int dir) -{ - struct snd_soc_codec *codec = codec_dai->codec; - - switch (freq) { - case 12000000: - return 0; - } - return -EINVAL; -} - -static int tlv320aic23_set_bias_level(struct snd_soc_codec *codec, - enum snd_soc_bias_level level) -{ - u16 reg = tlv320aic23_read_reg_cache(codec, TLV320AIC23_PWR) & 0xff7f; - - switch (level) { - case SND_SOC_BIAS_ON: - /* vref/mid, osc on, dac unmute */ - tlv320aic23_write(codec, TLV320AIC23_PWR, reg); - break; - case SND_SOC_BIAS_PREPARE: - break; - case SND_SOC_BIAS_STANDBY: - /* everything off except vref/vmid, */ - tlv320aic23_write(codec, TLV320AIC23_PWR, reg | 0x0040); - break; - case SND_SOC_BIAS_OFF: - /* everything off, dac mute, inactive */ - tlv320aic23_write(codec, TLV320AIC23_ACTIVE, 0x0); - tlv320aic23_write(codec, TLV320AIC23_PWR, 0xffff); - break; - } - codec->bias_level = level; - return 0; -} - -#define AIC23_RATES SNDRV_PCM_RATE_8000_96000 -#define AIC23_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE | \ - SNDRV_PCM_FMTBIT_S24_3LE | SNDRV_PCM_FMTBIT_S32_LE) - -struct snd_soc_dai tlv320aic23_dai = { - .name = "tlv320aic23", - .playback = { - .stream_name = "Playback", - .channels_min = 2, - .channels_max = 2, - .rates = AIC23_RATES, - .formats = AIC23_FORMATS,}, - .capture = { - .stream_name = "Capture", - .channels_min = 2, - .channels_max = 2, - .rates = AIC23_RATES, - .formats = AIC23_FORMATS,}, - .ops = { - .prepare = tlv320aic23_pcm_prepare, - .hw_params = tlv320aic23_hw_params, - .shutdown = tlv320aic23_shutdown, - }, - .dai_ops = { - .digital_mute = tlv320aic23_mute, - .set_fmt = tlv320aic23_set_dai_fmt, - .set_sysclk = tlv320aic23_set_dai_sysclk, - } -}; -EXPORT_SYMBOL_GPL(tlv320aic23_dai); - -static int tlv320aic23_suspend(struct platform_device *pdev, - pm_message_t state) -{ - struct snd_soc_device *socdev = platform_get_drvdata(pdev); - struct snd_soc_codec *codec = socdev->codec; - - tlv320aic23_write(codec, TLV320AIC23_ACTIVE, 0x0); - tlv320aic23_set_bias_level(codec, SND_SOC_BIAS_OFF); - - return 0; -} - -static int tlv320aic23_resume(struct platform_device *pdev) -{ - struct snd_soc_device *socdev = platform_get_drvdata(pdev); - struct snd_soc_codec *codec = socdev->codec; - int i; - u16 reg; - - /* Sync reg_cache with the hardware */ - for (reg = 0; reg < ARRAY_SIZE(tlv320aic23_reg); i++) { - u16 val = tlv320aic23_read_reg_cache(codec, reg); - tlv320aic23_write(codec, reg, val); - } - - tlv320aic23_set_bias_level(codec, SND_SOC_BIAS_STANDBY); - tlv320aic23_set_bias_level(codec, codec->suspend_bias_level); - - return 0; -} - -/* - * initialise the AIC23 driver - * register the mixer and dsp interfaces with the kernel - */ -static int tlv320aic23_init(struct snd_soc_device *socdev) -{ - struct snd_soc_codec *codec = socdev->codec; - int ret = 0; - u16 reg; - - codec->name = "tlv320aic23"; - codec->owner = THIS_MODULE; - codec->read = tlv320aic23_read_reg_cache; - codec->write = tlv320aic23_write; - codec->set_bias_level = tlv320aic23_set_bias_level; - codec->dai = &tlv320aic23_dai; - codec->num_dai = 1; - codec->reg_cache_size = ARRAY_SIZE(tlv320aic23_reg); - codec->reg_cache = - kmemdup(tlv320aic23_reg, sizeof(tlv320aic23_reg), GFP_KERNEL); - if (codec->reg_cache == NULL) - return -ENOMEM; - - /* Reset codec */ - tlv320aic23_write(codec, TLV320AIC23_RESET, 0); - - /* register pcms */ - ret = snd_soc_new_pcms(socdev, SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1); - if (ret < 0) { - printk(KERN_ERR "tlv320aic23: failed to create pcms\n"); - goto pcm_err; - } - - /* power on device */ - tlv320aic23_set_bias_level(codec, SND_SOC_BIAS_STANDBY); - - tlv320aic23_write(codec, TLV320AIC23_DIGT, TLV320AIC23_DEEMP_44K); - - /* Unmute input */ - reg = tlv320aic23_read_reg_cache(codec, TLV320AIC23_LINVOL); - tlv320aic23_write(codec, TLV320AIC23_LINVOL, - (reg & (~TLV320AIC23_LIM_MUTED)) | - (TLV320AIC23_LRS_ENABLED)); - - reg = tlv320aic23_read_reg_cache(codec, TLV320AIC23_RINVOL); - tlv320aic23_write(codec, TLV320AIC23_RINVOL, - (reg & (~TLV320AIC23_LIM_MUTED)) | - TLV320AIC23_LRS_ENABLED); - - reg = tlv320aic23_read_reg_cache(codec, TLV320AIC23_ANLG); - tlv320aic23_write(codec, TLV320AIC23_ANLG, - (reg) & (~TLV320AIC23_BYPASS_ON) & - (~TLV320AIC23_MICM_MUTED)); - - /* Default output volume */ - tlv320aic23_write(codec, TLV320AIC23_LCHNVOL, - TLV320AIC23_DEFAULT_OUT_VOL & - TLV320AIC23_OUT_VOL_MASK); - tlv320aic23_write(codec, TLV320AIC23_RCHNVOL, - TLV320AIC23_DEFAULT_OUT_VOL & - TLV320AIC23_OUT_VOL_MASK); - - tlv320aic23_write(codec, TLV320AIC23_ACTIVE, 0x1); - - tlv320aic23_add_controls(codec); - tlv320aic23_add_widgets(codec); - ret = snd_soc_register_card(socdev); - if (ret < 0) { - printk(KERN_ERR "tlv320aic23: failed to register card\n"); - goto card_err; - } - - return ret; - -card_err: - snd_soc_free_pcms(socdev); - snd_soc_dapm_free(socdev); -pcm_err: - kfree(codec->reg_cache); - return ret; -} -static struct snd_soc_device *tlv320aic23_socdev; - -#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE) -/* - * If the i2c layer weren't so broken, we could pass this kind of data - * around - */ -static int tlv320aic23_codec_probe(struct i2c_client *i2c, - const struct i2c_device_id *i2c_id) -{ - struct snd_soc_device *socdev = tlv320aic23_socdev; - struct snd_soc_codec *codec = socdev->codec; - int ret; - - if (!i2c_check_functionality(i2c->adapter, I2C_FUNC_SMBUS_BYTE_DATA)) - return -EINVAL; - - i2c_set_clientdata(i2c, codec); - codec->control_data = i2c; - - ret = tlv320aic23_init(socdev); - if (ret < 0) { - printk(KERN_ERR "tlv320aic23: failed to initialise AIC23\n"); - goto err; - } - return ret; - -err: - kfree(codec); - kfree(i2c); - return ret; -} -static int __exit tlv320aic23_i2c_remove(struct i2c_client *i2c) -{ - put_device(&i2c->dev); - return 0; -} - -static const struct i2c_device_id tlv320aic23_id[] = { - {"tlv320aic23", 0}, - {} -}; - -MODULE_DEVICE_TABLE(i2c, tlv320aic23_id); - -static struct i2c_driver tlv320aic23_i2c_driver = { - .driver = { - .name = "tlv320aic23", - }, - .probe = tlv320aic23_codec_probe, - .remove = __exit_p(tlv320aic23_i2c_remove), - .id_table = tlv320aic23_id, -}; - -#endif - -static int tlv320aic23_probe(struct platform_device *pdev) -{ - struct snd_soc_device *socdev = platform_get_drvdata(pdev); - struct snd_soc_codec *codec; - int ret = 0; - - printk(KERN_INFO "AIC23 Audio Codec %s\n", AIC23_VERSION); - - codec = kzalloc(sizeof(struct snd_soc_codec), GFP_KERNEL); - if (codec == NULL) - return -ENOMEM; - - socdev->codec = codec; - mutex_init(&codec->mutex); - INIT_LIST_HEAD(&codec->dapm_widgets); - INIT_LIST_HEAD(&codec->dapm_paths); - - tlv320aic23_socdev = socdev; -#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE) - codec->hw_write = (hw_write_t) i2c_smbus_write_byte_data; - codec->hw_read = NULL; - ret = i2c_add_driver(&tlv320aic23_i2c_driver); - if (ret != 0) - printk(KERN_ERR "can't add i2c driver"); -#endif - return ret; -} - -static int tlv320aic23_remove(struct platform_device *pdev) -{ - struct snd_soc_device *socdev = platform_get_drvdata(pdev); - struct snd_soc_codec *codec = socdev->codec; - - if (codec->control_data) - tlv320aic23_set_bias_level(codec, SND_SOC_BIAS_OFF); - - snd_soc_free_pcms(socdev); - snd_soc_dapm_free(socdev); -#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE) - i2c_del_driver(&tlv320aic23_i2c_driver); -#endif - kfree(codec->reg_cache); - kfree(codec); - - return 0; -} -struct snd_soc_codec_device soc_codec_dev_tlv320aic23 = { - .probe = tlv320aic23_probe, - .remove = tlv320aic23_remove, - .suspend = tlv320aic23_suspend, - .resume = tlv320aic23_resume, -}; -EXPORT_SYMBOL_GPL(soc_codec_dev_tlv320aic23); - -MODULE_DESCRIPTION("ASoC TLV320AIC23 codec driver"); -MODULE_AUTHOR("Arun KS "); -MODULE_LICENSE("GPL"); diff --git a/trunk/sound/soc/codecs/tlv320aic23.h b/trunk/sound/soc/codecs/tlv320aic23.h deleted file mode 100644 index 79d1faf8e570..000000000000 --- a/trunk/sound/soc/codecs/tlv320aic23.h +++ /dev/null @@ -1,122 +0,0 @@ -/* - * ALSA SoC TLV320AIC23 codec driver - * - * Author: Arun KS, - * Copyright: (C) 2008 Mistral Solutions Pvt Ltd - * - * 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. - */ - -#ifndef _TLV320AIC23_H -#define _TLV320AIC23_H - -/* Codec TLV320AIC23 */ -#define TLV320AIC23_LINVOL 0x00 -#define TLV320AIC23_RINVOL 0x01 -#define TLV320AIC23_LCHNVOL 0x02 -#define TLV320AIC23_RCHNVOL 0x03 -#define TLV320AIC23_ANLG 0x04 -#define TLV320AIC23_DIGT 0x05 -#define TLV320AIC23_PWR 0x06 -#define TLV320AIC23_DIGT_FMT 0x07 -#define TLV320AIC23_SRATE 0x08 -#define TLV320AIC23_ACTIVE 0x09 -#define TLV320AIC23_RESET 0x0F - -/* Left (right) line input volume control register */ -#define TLV320AIC23_LRS_ENABLED 0x0100 -#define TLV320AIC23_LIM_MUTED 0x0080 -#define TLV320AIC23_LIV_DEFAULT 0x0017 -#define TLV320AIC23_LIV_MAX 0x001f -#define TLV320AIC23_LIV_MIN 0x0000 - -/* Left (right) channel headphone volume control register */ -#define TLV320AIC23_LZC_ON 0x0080 -#define TLV320AIC23_LHV_DEFAULT 0x0079 -#define TLV320AIC23_LHV_MAX 0x007f -#define TLV320AIC23_LHV_MIN 0x0000 - -/* Analog audio path control register */ -#define TLV320AIC23_STA_REG(x) ((x)<<6) -#define TLV320AIC23_STE_ENABLED 0x0020 -#define TLV320AIC23_DAC_SELECTED 0x0010 -#define TLV320AIC23_BYPASS_ON 0x0008 -#define TLV320AIC23_INSEL_MIC 0x0004 -#define TLV320AIC23_MICM_MUTED 0x0002 -#define TLV320AIC23_MICB_20DB 0x0001 - -/* Digital audio path control register */ -#define TLV320AIC23_DACM_MUTE 0x0008 -#define TLV320AIC23_DEEMP_32K 0x0002 -#define TLV320AIC23_DEEMP_44K 0x0004 -#define TLV320AIC23_DEEMP_48K 0x0006 -#define TLV320AIC23_ADCHP_ON 0x0001 - -/* Power control down register */ -#define TLV320AIC23_DEVICE_PWR_OFF 0x0080 -#define TLV320AIC23_CLK_OFF 0x0040 -#define TLV320AIC23_OSC_OFF 0x0020 -#define TLV320AIC23_OUT_OFF 0x0010 -#define TLV320AIC23_DAC_OFF 0x0008 -#define TLV320AIC23_ADC_OFF 0x0004 -#define TLV320AIC23_MIC_OFF 0x0002 -#define TLV320AIC23_LINE_OFF 0x0001 - -/* Digital audio interface register */ -#define TLV320AIC23_MS_MASTER 0x0040 -#define TLV320AIC23_LRSWAP_ON 0x0020 -#define TLV320AIC23_LRP_ON 0x0010 -#define TLV320AIC23_IWL_16 0x0000 -#define TLV320AIC23_IWL_20 0x0004 -#define TLV320AIC23_IWL_24 0x0008 -#define TLV320AIC23_IWL_32 0x000C -#define TLV320AIC23_FOR_I2S 0x0002 -#define TLV320AIC23_FOR_DSP 0x0003 -#define TLV320AIC23_FOR_LJUST 0x0001 - -/* Sample rate control register */ -#define TLV320AIC23_CLKOUT_HALF 0x0080 -#define TLV320AIC23_CLKIN_HALF 0x0040 -#define TLV320AIC23_BOSR_384fs 0x0002 /* BOSR_272fs in USB mode */ -#define TLV320AIC23_USB_CLK_ON 0x0001 -#define TLV320AIC23_SR_MASK 0xf -#define TLV320AIC23_CLKOUT_SHIFT 7 -#define TLV320AIC23_CLKIN_SHIFT 6 -#define TLV320AIC23_SR_SHIFT 2 -#define TLV320AIC23_BOSR_SHIFT 1 - -/* Digital interface register */ -#define TLV320AIC23_ACT_ON 0x0001 - -/* - * AUDIO related MACROS - */ - -#define TLV320AIC23_DEFAULT_OUT_VOL 0x70 -#define TLV320AIC23_DEFAULT_IN_VOLUME 0x10 - -#define TLV320AIC23_OUT_VOL_MIN TLV320AIC23_LHV_MIN -#define TLV320AIC23_OUT_VOL_MAX TLV320AIC23_LHV_MAX -#define TLV320AIC23_OUT_VO_RANGE (TLV320AIC23_OUT_VOL_MAX - \ - TLV320AIC23_OUT_VOL_MIN) -#define TLV320AIC23_OUT_VOL_MASK TLV320AIC23_OUT_VOL_MAX - -#define TLV320AIC23_IN_VOL_MIN TLV320AIC23_LIV_MIN -#define TLV320AIC23_IN_VOL_MAX TLV320AIC23_LIV_MAX -#define TLV320AIC23_IN_VOL_RANGE (TLV320AIC23_IN_VOL_MAX - \ - TLV320AIC23_IN_VOL_MIN) -#define TLV320AIC23_IN_VOL_MASK TLV320AIC23_IN_VOL_MAX - -#define TLV320AIC23_SIDETONE_MASK 0x1c0 -#define TLV320AIC23_SIDETONE_0 0x100 -#define TLV320AIC23_SIDETONE_6 0x000 -#define TLV320AIC23_SIDETONE_9 0x040 -#define TLV320AIC23_SIDETONE_12 0x080 -#define TLV320AIC23_SIDETONE_18 0x0c0 - -extern struct snd_soc_dai tlv320aic23_dai; -extern struct snd_soc_codec_device soc_codec_dev_tlv320aic23; - -#endif /* _TLV320AIC23_H */ diff --git a/trunk/sound/soc/codecs/tlv320aic3x.c b/trunk/sound/soc/codecs/tlv320aic3x.c index 05336ed7e493..566a427c928f 100644 --- a/trunk/sound/soc/codecs/tlv320aic3x.c +++ b/trunk/sound/soc/codecs/tlv320aic3x.c @@ -48,6 +48,7 @@ #include "tlv320aic3x.h" +#define AUDIO_NAME "aic3x" #define AIC3X_VERSION "0.2" /* codec private data */ @@ -990,7 +991,7 @@ EXPORT_SYMBOL_GPL(aic3x_headset_detected); SNDRV_PCM_FMTBIT_S24_3LE | SNDRV_PCM_FMTBIT_S32_LE) struct snd_soc_dai aic3x_dai = { - .name = "tlv320aic3x", + .name = "aic3x", .playback = { .stream_name = "Playback", .channels_min = 1, @@ -1054,7 +1055,7 @@ static int aic3x_init(struct snd_soc_device *socdev) struct aic3x_setup_data *setup = socdev->codec_data; int reg, ret = 0; - codec->name = "tlv320aic3x"; + codec->name = "aic3x"; codec->owner = THIS_MODULE; codec->read = aic3x_read_reg_cache; codec->write = aic3x_write; diff --git a/trunk/sound/soc/codecs/uda1380.c b/trunk/sound/soc/codecs/uda1380.c index a69ee72a7af5..d206d7f892b6 100644 --- a/trunk/sound/soc/codecs/uda1380.c +++ b/trunk/sound/soc/codecs/uda1380.c @@ -36,6 +36,7 @@ #include "uda1380.h" #define UDA1380_VERSION "0.6" +#define AUDIO_NAME "uda1380" /* * uda1380 register cache diff --git a/trunk/sound/soc/codecs/wm8510.c b/trunk/sound/soc/codecs/wm8510.c index d8ca2da8d634..9a37c8d95ed2 100644 --- a/trunk/sound/soc/codecs/wm8510.c +++ b/trunk/sound/soc/codecs/wm8510.c @@ -3,7 +3,7 @@ * * Copyright 2006 Wolfson Microelectronics PLC. * - * Author: Liam Girdwood + * Author: Liam Girdwood * * 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 @@ -18,7 +18,6 @@ #include #include #include -#include #include #include #include @@ -28,6 +27,7 @@ #include "wm8510.h" +#define AUDIO_NAME "wm8510" #define WM8510_VERSION "0.6" struct snd_soc_codec_device soc_codec_dev_wm8510; @@ -55,9 +55,6 @@ static const u16 wm8510_reg[WM8510_CACHEREGNUM] = { 0x0001, }; -#define WM8510_POWER1_BIASEN 0x08 -#define WM8510_POWER1_BUFIOEN 0x10 - /* * read wm8510 register cache */ @@ -227,9 +224,9 @@ SND_SOC_DAPM_PGA("SpkN Out", WM8510_POWER3, 5, 0, NULL, 0), SND_SOC_DAPM_PGA("SpkP Out", WM8510_POWER3, 6, 0, NULL, 0), SND_SOC_DAPM_PGA("Mono Out", WM8510_POWER3, 7, 0, NULL, 0), -SND_SOC_DAPM_MIXER("Mic PGA", WM8510_POWER2, 2, 0, - &wm8510_micpga_controls[0], - ARRAY_SIZE(wm8510_micpga_controls)), +SND_SOC_DAPM_PGA("Mic PGA", WM8510_POWER2, 2, 0, + &wm8510_micpga_controls[0], + ARRAY_SIZE(wm8510_micpga_controls)), SND_SOC_DAPM_MIXER("Boost Mixer", WM8510_POWER2, 4, 0, &wm8510_boost_controls[0], ARRAY_SIZE(wm8510_boost_controls)), @@ -529,35 +526,23 @@ static int wm8510_mute(struct snd_soc_dai *dai, int mute) static int wm8510_set_bias_level(struct snd_soc_codec *codec, enum snd_soc_bias_level level) { - u16 power1 = wm8510_read_reg_cache(codec, WM8510_POWER1) & ~0x3; switch (level) { case SND_SOC_BIAS_ON: - case SND_SOC_BIAS_PREPARE: - power1 |= 0x1; /* VMID 50k */ - wm8510_write(codec, WM8510_POWER1, power1); + wm8510_write(codec, WM8510_POWER1, 0x1ff); + wm8510_write(codec, WM8510_POWER2, 0x1ff); + wm8510_write(codec, WM8510_POWER3, 0x1ff); break; - + case SND_SOC_BIAS_PREPARE: case SND_SOC_BIAS_STANDBY: - power1 |= WM8510_POWER1_BIASEN | WM8510_POWER1_BUFIOEN; - - if (codec->bias_level == SND_SOC_BIAS_OFF) { - /* Initial cap charge at VMID 5k */ - wm8510_write(codec, WM8510_POWER1, power1 | 0x3); - mdelay(100); - } - - power1 |= 0x2; /* VMID 500k */ - wm8510_write(codec, WM8510_POWER1, power1); break; - case SND_SOC_BIAS_OFF: - wm8510_write(codec, WM8510_POWER1, 0); - wm8510_write(codec, WM8510_POWER2, 0); - wm8510_write(codec, WM8510_POWER3, 0); + /* everything off, dac mute, inactive */ + wm8510_write(codec, WM8510_POWER1, 0x0); + wm8510_write(codec, WM8510_POWER2, 0x0); + wm8510_write(codec, WM8510_POWER3, 0x0); break; } - codec->bias_level = level; return 0; } @@ -655,7 +640,6 @@ static int wm8510_init(struct snd_soc_device *socdev) } /* power on device */ - codec->bias_level = SND_SOC_BIAS_OFF; wm8510_set_bias_level(codec, SND_SOC_BIAS_STANDBY); wm8510_add_controls(codec); wm8510_add_widgets(codec); @@ -763,62 +747,6 @@ static int wm8510_add_i2c_device(struct platform_device *pdev, } #endif -#if defined(CONFIG_SPI_MASTER) -static int __devinit wm8510_spi_probe(struct spi_device *spi) -{ - struct snd_soc_device *socdev = wm8510_socdev; - struct snd_soc_codec *codec = socdev->codec; - int ret; - - codec->control_data = spi; - - ret = wm8510_init(socdev); - if (ret < 0) - dev_err(&spi->dev, "failed to initialise WM8510\n"); - - return ret; -} - -static int __devexit wm8510_spi_remove(struct spi_device *spi) -{ - return 0; -} - -static struct spi_driver wm8510_spi_driver = { - .driver = { - .name = "wm8510", - .bus = &spi_bus_type, - .owner = THIS_MODULE, - }, - .probe = wm8510_spi_probe, - .remove = __devexit_p(wm8510_spi_remove), -}; - -static int wm8510_spi_write(struct spi_device *spi, const char *data, int len) -{ - struct spi_transfer t; - struct spi_message m; - u8 msg[2]; - - if (len <= 0) - return 0; - - msg[0] = data[0]; - msg[1] = data[1]; - - spi_message_init(&m); - memset(&t, 0, (sizeof t)); - - t.tx_buf = &msg[0]; - t.len = len; - - spi_message_add_tail(&t, &m); - spi_sync(spi, &m); - - return len; -} -#endif /* CONFIG_SPI_MASTER */ - static int wm8510_probe(struct platform_device *pdev) { struct snd_soc_device *socdev = platform_get_drvdata(pdev); @@ -844,14 +772,8 @@ static int wm8510_probe(struct platform_device *pdev) codec->hw_write = (hw_write_t)i2c_master_send; ret = wm8510_add_i2c_device(pdev, setup); } -#endif -#if defined(CONFIG_SPI_MASTER) - if (setup->spi) { - codec->hw_write = (hw_write_t)wm8510_spi_write; - ret = spi_register_driver(&wm8510_spi_driver); - if (ret != 0) - printk(KERN_ERR "can't add spi driver"); - } +#else + /* Add other interfaces here */ #endif if (ret != 0) @@ -873,9 +795,6 @@ static int wm8510_remove(struct platform_device *pdev) #if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE) i2c_unregister_device(codec->control_data); i2c_del_driver(&wm8510_i2c_driver); -#endif -#if defined(CONFIG_SPI_MASTER) - spi_unregister_driver(&wm8510_spi_driver); #endif kfree(codec); diff --git a/trunk/sound/soc/codecs/wm8510.h b/trunk/sound/soc/codecs/wm8510.h index bdefcf5c69ff..c53683960456 100644 --- a/trunk/sound/soc/codecs/wm8510.h +++ b/trunk/sound/soc/codecs/wm8510.h @@ -94,7 +94,6 @@ #define WM8510_MCLKDIV_12 (7 << 5) struct wm8510_setup_data { - int spi; int i2c_bus; unsigned short i2c_address; }; diff --git a/trunk/sound/soc/codecs/wm8580.c b/trunk/sound/soc/codecs/wm8580.c index 627ebfb4209b..df1ffbe305bf 100644 --- a/trunk/sound/soc/codecs/wm8580.c +++ b/trunk/sound/soc/codecs/wm8580.c @@ -18,6 +18,7 @@ #include #include +#include #include #include #include @@ -35,6 +36,7 @@ #include "wm8580.h" +#define AUDIO_NAME "wm8580" #define WM8580_VERSION "0.1" struct pll_state { diff --git a/trunk/sound/soc/codecs/wm8731.c b/trunk/sound/soc/codecs/wm8731.c index 7f8a7e36b33e..7b64d9a7ff76 100644 --- a/trunk/sound/soc/codecs/wm8731.c +++ b/trunk/sound/soc/codecs/wm8731.c @@ -29,6 +29,7 @@ #include "wm8731.h" +#define AUDIO_NAME "wm8731" #define WM8731_VERSION "0.13" struct snd_soc_codec_device soc_codec_dev_wm8731; diff --git a/trunk/sound/soc/codecs/wm8750.c b/trunk/sound/soc/codecs/wm8750.c index 9b7296ee5b08..4892e398a598 100644 --- a/trunk/sound/soc/codecs/wm8750.c +++ b/trunk/sound/soc/codecs/wm8750.c @@ -29,6 +29,7 @@ #include "wm8750.h" +#define AUDIO_NAME "WM8750" #define WM8750_VERSION "0.12" /* codec private data */ diff --git a/trunk/sound/soc/codecs/wm8753.c b/trunk/sound/soc/codecs/wm8753.c index d426eaa22185..8c4df44f3345 100644 --- a/trunk/sound/soc/codecs/wm8753.c +++ b/trunk/sound/soc/codecs/wm8753.c @@ -2,7 +2,8 @@ * wm8753.c -- WM8753 ALSA Soc Audio driver * * Copyright 2003 Wolfson Microelectronics PLC. - * Author: Liam Girdwood + * Author: Liam Girdwood + * liam.girdwood@wolfsonmicro.com or linux@wolfsonmicro.com * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -39,7 +40,6 @@ #include #include #include -#include #include #include #include @@ -51,6 +51,7 @@ #include "wm8753.h" +#define AUDIO_NAME "wm8753" #define WM8753_VERSION "0.16" static int caps_charge = 2000; @@ -1718,63 +1719,6 @@ static int wm8753_add_i2c_device(struct platform_device *pdev, } #endif -#if defined(CONFIG_SPI_MASTER) -static int __devinit wm8753_spi_probe(struct spi_device *spi) -{ - struct snd_soc_device *socdev = wm8753_socdev; - struct snd_soc_codec *codec = socdev->codec; - int ret; - - codec->control_data = spi; - - ret = wm8753_init(socdev); - if (ret < 0) - dev_err(&spi->dev, "failed to initialise WM8753\n"); - - return ret; -} - -static int __devexit wm8753_spi_remove(struct spi_device *spi) -{ - return 0; -} - -static struct spi_driver wm8753_spi_driver = { - .driver = { - .name = "wm8753", - .bus = &spi_bus_type, - .owner = THIS_MODULE, - }, - .probe = wm8753_spi_probe, - .remove = __devexit_p(wm8753_spi_remove), -}; - -static int wm8753_spi_write(struct spi_device *spi, const char *data, int len) -{ - struct spi_transfer t; - struct spi_message m; - u8 msg[2]; - - if (len <= 0) - return 0; - - msg[0] = data[0]; - msg[1] = data[1]; - - spi_message_init(&m); - memset(&t, 0, (sizeof t)); - - t.tx_buf = &msg[0]; - t.len = len; - - spi_message_add_tail(&t, &m); - spi_sync(spi, &m); - - return len; -} -#endif - - static int wm8753_probe(struct platform_device *pdev) { struct snd_soc_device *socdev = platform_get_drvdata(pdev); @@ -1809,14 +1753,8 @@ static int wm8753_probe(struct platform_device *pdev) codec->hw_write = (hw_write_t)i2c_master_send; ret = wm8753_add_i2c_device(pdev, setup); } -#endif -#if defined(CONFIG_SPI_MASTER) - if (setup->spi) { - codec->hw_write = (hw_write_t)wm8753_spi_write; - ret = spi_register_driver(&wm8753_spi_driver); - if (ret != 0) - printk(KERN_ERR "can't add spi driver"); - } +#else + /* Add other interfaces here */ #endif if (ret != 0) { @@ -1859,9 +1797,6 @@ static int wm8753_remove(struct platform_device *pdev) #if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE) i2c_unregister_device(codec->control_data); i2c_del_driver(&wm8753_i2c_driver); -#endif -#if defined(CONFIG_SPI_MASTER) - spi_unregister_driver(&wm8753_spi_driver); #endif kfree(codec->private_data); kfree(codec); diff --git a/trunk/sound/soc/codecs/wm8753.h b/trunk/sound/soc/codecs/wm8753.h index f55704ce931b..7defde069f1d 100644 --- a/trunk/sound/soc/codecs/wm8753.h +++ b/trunk/sound/soc/codecs/wm8753.h @@ -2,7 +2,8 @@ * wm8753.h -- audio driver for WM8753 * * Copyright 2003 Wolfson Microelectronics PLC. - * Author: Liam Girdwood + * Author: Liam Girdwood + * liam.girdwood@wolfsonmicro.com or linux@wolfsonmicro.com * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -78,7 +79,6 @@ #define WM8753_ADCTL2 0x3f struct wm8753_setup_data { - int spi; int i2c_bus; unsigned short i2c_address; }; diff --git a/trunk/sound/soc/codecs/wm8900.c b/trunk/sound/soc/codecs/wm8900.c index 3b326c9b5586..0b8c6d38b48f 100644 --- a/trunk/sound/soc/codecs/wm8900.c +++ b/trunk/sound/soc/codecs/wm8900.c @@ -18,6 +18,7 @@ #include #include +#include #include #include #include diff --git a/trunk/sound/soc/codecs/wm8903.c b/trunk/sound/soc/codecs/wm8903.c index ce40d7877605..a3f54ec4226e 100644 --- a/trunk/sound/soc/codecs/wm8903.c +++ b/trunk/sound/soc/codecs/wm8903.c @@ -653,14 +653,14 @@ static const struct snd_kcontrol_new wm8903_snd_controls[] = { /* Input PGAs - No TLV since the scale depends on PGA mode */ SOC_SINGLE("Left Input PGA Switch", WM8903_ANALOGUE_LEFT_INPUT_0, - 7, 1, 1), + 7, 1, 0), SOC_SINGLE("Left Input PGA Volume", WM8903_ANALOGUE_LEFT_INPUT_0, 0, 31, 0), SOC_SINGLE("Left Input PGA Common Mode Switch", WM8903_ANALOGUE_LEFT_INPUT_1, 6, 1, 0), SOC_SINGLE("Right Input PGA Switch", WM8903_ANALOGUE_RIGHT_INPUT_0, - 7, 1, 1), + 7, 1, 0), SOC_SINGLE("Right Input PGA Volume", WM8903_ANALOGUE_RIGHT_INPUT_0, 0, 31, 0), SOC_SINGLE("Right Input PGA Common Mode Switch", WM8903_ANALOGUE_RIGHT_INPUT_1, diff --git a/trunk/sound/soc/codecs/wm8971.c b/trunk/sound/soc/codecs/wm8971.c index f41a578ddd4f..974a4cd0f3fd 100644 --- a/trunk/sound/soc/codecs/wm8971.c +++ b/trunk/sound/soc/codecs/wm8971.c @@ -29,6 +29,7 @@ #include "wm8971.h" +#define AUDIO_NAME "wm8971" #define WM8971_VERSION "0.9" #define WM8971_REG_COUNT 43 diff --git a/trunk/sound/soc/codecs/wm8990.c b/trunk/sound/soc/codecs/wm8990.c index 572d22b0880b..63410d7b5efb 100644 --- a/trunk/sound/soc/codecs/wm8990.c +++ b/trunk/sound/soc/codecs/wm8990.c @@ -30,6 +30,7 @@ #include "wm8990.h" +#define AUDIO_NAME "wm8990" #define WM8990_VERSION "0.2" /* codec private data */ diff --git a/trunk/sound/soc/codecs/wm9712.c b/trunk/sound/soc/codecs/wm9712.c index ffb471e420e2..2f1c91b1d556 100644 --- a/trunk/sound/soc/codecs/wm9712.c +++ b/trunk/sound/soc/codecs/wm9712.c @@ -2,7 +2,8 @@ * wm9712.c -- ALSA Soc WM9712 codec support * * Copyright 2006 Wolfson Microelectronics PLC. - * Author: Liam Girdwood + * Author: Liam Girdwood + * liam.girdwood@wolfsonmicro.com or linux@wolfsonmicro.com * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/trunk/sound/soc/codecs/wm9713.c b/trunk/sound/soc/codecs/wm9713.c index aba402b3c999..441d0580db1f 100644 --- a/trunk/sound/soc/codecs/wm9713.c +++ b/trunk/sound/soc/codecs/wm9713.c @@ -2,7 +2,8 @@ * wm9713.c -- ALSA Soc WM9713 codec support * * Copyright 2006 Wolfson Microelectronics PLC. - * Author: Liam Girdwood + * Author: Liam Girdwood + * liam.girdwood@wolfsonmicro.com or linux@wolfsonmicro.com * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/trunk/sound/soc/omap/Kconfig b/trunk/sound/soc/omap/Kconfig index 8b7766b998d7..aea27e70043c 100644 --- a/trunk/sound/soc/omap/Kconfig +++ b/trunk/sound/soc/omap/Kconfig @@ -13,11 +13,3 @@ config SND_OMAP_SOC_N810 select SND_SOC_TLV320AIC3X help Say Y if you want to add support for SoC audio on Nokia N810. - -config SND_OMAP_SOC_OSK5912 - tristate "SoC Audio support for omap osk5912" - depends on SND_OMAP_SOC && MACH_OMAP_OSK - select SND_OMAP_SOC_MCBSP - select SND_SOC_TLV320AIC23 - help - Say Y if you want to add support for SoC audio on osk5912. diff --git a/trunk/sound/soc/omap/Makefile b/trunk/sound/soc/omap/Makefile index e09d1f297f64..d8d8d58075e3 100644 --- a/trunk/sound/soc/omap/Makefile +++ b/trunk/sound/soc/omap/Makefile @@ -7,7 +7,5 @@ obj-$(CONFIG_SND_OMAP_SOC_MCBSP) += snd-soc-omap-mcbsp.o # OMAP Machine Support snd-soc-n810-objs := n810.o -snd-soc-osk5912-objs := osk5912.o obj-$(CONFIG_SND_OMAP_SOC_N810) += snd-soc-n810.o -obj-$(CONFIG_SND_OMAP_SOC_OSK5912) += snd-soc-osk5912.o diff --git a/trunk/sound/soc/omap/n810.c b/trunk/sound/soc/omap/n810.c index fae3ad36e0bf..d166b6b2a60d 100644 --- a/trunk/sound/soc/omap/n810.c +++ b/trunk/sound/soc/omap/n810.c @@ -247,9 +247,9 @@ static int n810_aic33_init(struct snd_soc_codec *codec) int i, err; /* Not connected */ - snd_soc_dapm_nc_pin(codec, "MONO_LOUT"); - snd_soc_dapm_nc_pin(codec, "HPLCOM"); - snd_soc_dapm_nc_pin(codec, "HPRCOM"); + snd_soc_dapm_disable_pin(codec, "MONO_LOUT"); + snd_soc_dapm_disable_pin(codec, "HPLCOM"); + snd_soc_dapm_disable_pin(codec, "HPRCOM"); /* Add N810 specific controls */ for (i = 0; i < ARRAY_SIZE(aic33_n810_controls); i++) { diff --git a/trunk/sound/soc/omap/omap-mcbsp.c b/trunk/sound/soc/omap/omap-mcbsp.c index 0a063a98a661..35310e16d7f3 100644 --- a/trunk/sound/soc/omap/omap-mcbsp.c +++ b/trunk/sound/soc/omap/omap-mcbsp.c @@ -59,7 +59,12 @@ static struct omap_mcbsp_data mcbsp_data[NUM_LINKS]; * Stream DMA parameters. DMA request line and port address are set runtime * since they are different between OMAP1 and later OMAPs */ -static struct omap_pcm_dma_data omap_mcbsp_dai_dma_params[NUM_LINKS][2]; +static struct omap_pcm_dma_data omap_mcbsp_dai_dma_params[NUM_LINKS][2] = { +{ + { .name = "I2S PCM Stereo out", }, + { .name = "I2S PCM Stereo in", }, +}, +}; #if defined(CONFIG_ARCH_OMAP15XX) || defined(CONFIG_ARCH_OMAP16XX) static const int omap1_dma_reqs[][2] = { @@ -79,22 +84,11 @@ static const unsigned long omap1_mcbsp_port[][2] = { static const int omap1_dma_reqs[][2] = {}; static const unsigned long omap1_mcbsp_port[][2] = {}; #endif - -#if defined(CONFIG_ARCH_OMAP24XX) || defined(CONFIG_ARCH_OMAP34XX) -static const int omap24xx_dma_reqs[][2] = { +#if defined(CONFIG_ARCH_OMAP2420) +static const int omap2420_dma_reqs[][2] = { { OMAP24XX_DMA_MCBSP1_TX, OMAP24XX_DMA_MCBSP1_RX }, { OMAP24XX_DMA_MCBSP2_TX, OMAP24XX_DMA_MCBSP2_RX }, -#if defined(CONFIG_ARCH_OMAP2430) || defined(CONFIG_ARCH_OMAP34XX) - { OMAP24XX_DMA_MCBSP3_TX, OMAP24XX_DMA_MCBSP3_RX }, - { OMAP24XX_DMA_MCBSP4_TX, OMAP24XX_DMA_MCBSP4_RX }, - { OMAP24XX_DMA_MCBSP5_TX, OMAP24XX_DMA_MCBSP5_RX }, -#endif }; -#else -static const int omap24xx_dma_reqs[][2] = {}; -#endif - -#if defined(CONFIG_ARCH_OMAP2420) static const unsigned long omap2420_mcbsp_port[][2] = { { OMAP24XX_MCBSP1_BASE + OMAP_MCBSP_REG_DXR1, OMAP24XX_MCBSP1_BASE + OMAP_MCBSP_REG_DRR1 }, @@ -102,43 +96,10 @@ static const unsigned long omap2420_mcbsp_port[][2] = { OMAP24XX_MCBSP2_BASE + OMAP_MCBSP_REG_DRR1 }, }; #else +static const int omap2420_dma_reqs[][2] = {}; static const unsigned long omap2420_mcbsp_port[][2] = {}; #endif -#if defined(CONFIG_ARCH_OMAP2430) -static const unsigned long omap2430_mcbsp_port[][2] = { - { OMAP24XX_MCBSP1_BASE + OMAP_MCBSP_REG_DXR, - OMAP24XX_MCBSP1_BASE + OMAP_MCBSP_REG_DRR }, - { OMAP24XX_MCBSP2_BASE + OMAP_MCBSP_REG_DXR, - OMAP24XX_MCBSP2_BASE + OMAP_MCBSP_REG_DRR }, - { OMAP2430_MCBSP3_BASE + OMAP_MCBSP_REG_DXR, - OMAP2430_MCBSP3_BASE + OMAP_MCBSP_REG_DRR }, - { OMAP2430_MCBSP4_BASE + OMAP_MCBSP_REG_DXR, - OMAP2430_MCBSP4_BASE + OMAP_MCBSP_REG_DRR }, - { OMAP2430_MCBSP5_BASE + OMAP_MCBSP_REG_DXR, - OMAP2430_MCBSP5_BASE + OMAP_MCBSP_REG_DRR }, -}; -#else -static const unsigned long omap2430_mcbsp_port[][2] = {}; -#endif - -#if defined(CONFIG_ARCH_OMAP34XX) -static const unsigned long omap34xx_mcbsp_port[][2] = { - { OMAP34XX_MCBSP1_BASE + OMAP_MCBSP_REG_DXR, - OMAP34XX_MCBSP1_BASE + OMAP_MCBSP_REG_DRR }, - { OMAP34XX_MCBSP2_BASE + OMAP_MCBSP_REG_DXR, - OMAP34XX_MCBSP2_BASE + OMAP_MCBSP_REG_DRR }, - { OMAP34XX_MCBSP3_BASE + OMAP_MCBSP_REG_DXR, - OMAP34XX_MCBSP3_BASE + OMAP_MCBSP_REG_DRR }, - { OMAP34XX_MCBSP4_BASE + OMAP_MCBSP_REG_DXR, - OMAP34XX_MCBSP4_BASE + OMAP_MCBSP_REG_DRR }, - { OMAP34XX_MCBSP5_BASE + OMAP_MCBSP_REG_DXR, - OMAP34XX_MCBSP5_BASE + OMAP_MCBSP_REG_DRR }, -}; -#else -static const unsigned long omap34xx_mcbsp_port[][2] = {}; -#endif - static int omap_mcbsp_dai_startup(struct snd_pcm_substream *substream) { struct snd_soc_pcm_runtime *rtd = substream->private_data; @@ -206,19 +167,14 @@ static int omap_mcbsp_dai_hw_params(struct snd_pcm_substream *substream, dma = omap1_dma_reqs[bus_id][substream->stream]; port = omap1_mcbsp_port[bus_id][substream->stream]; } else if (cpu_is_omap2420()) { - dma = omap24xx_dma_reqs[bus_id][substream->stream]; + dma = omap2420_dma_reqs[bus_id][substream->stream]; port = omap2420_mcbsp_port[bus_id][substream->stream]; - } else if (cpu_is_omap2430()) { - dma = omap24xx_dma_reqs[bus_id][substream->stream]; - port = omap2430_mcbsp_port[bus_id][substream->stream]; - } else if (cpu_is_omap343x()) { - dma = omap24xx_dma_reqs[bus_id][substream->stream]; - port = omap34xx_mcbsp_port[bus_id][substream->stream]; } else { + /* + * TODO: Add support for 2430 and 3430 + */ return -ENODEV; } - omap_mcbsp_dai_dma_params[id][substream->stream].name = - substream->stream ? "Audio Capture" : "Audio Playback"; omap_mcbsp_dai_dma_params[id][substream->stream].dma_req = dma; omap_mcbsp_dai_dma_params[id][substream->stream].port_addr = port; cpu_dai->dma_data = &omap_mcbsp_dai_dma_params[id][substream->stream]; @@ -289,11 +245,6 @@ static int omap_mcbsp_dai_set_dai_fmt(struct snd_soc_dai *cpu_dai, regs->rcr2 |= RDATDLY(1); regs->xcr2 |= XDATDLY(1); break; - case SND_SOC_DAIFMT_DSP_A: - /* 0-bit data delay */ - regs->rcr2 |= RDATDLY(0); - regs->xcr2 |= XDATDLY(0); - break; default: /* Unsupported data format */ return -EINVAL; @@ -359,7 +310,7 @@ static int omap_mcbsp_dai_set_clks_src(struct omap_mcbsp_data *mcbsp_data, int clk_id) { int sel_bit; - u16 reg, reg_devconf1 = OMAP243X_CONTROL_DEVCONF1; + u16 reg; if (cpu_class_is_omap1()) { /* OMAP1's can use only external source clock */ @@ -369,12 +320,6 @@ static int omap_mcbsp_dai_set_clks_src(struct omap_mcbsp_data *mcbsp_data, return 0; } - if (cpu_is_omap2420() && mcbsp_data->bus_id > 1) - return -EINVAL; - - if (cpu_is_omap343x()) - reg_devconf1 = OMAP343X_CONTROL_DEVCONF1; - switch (mcbsp_data->bus_id) { case 0: reg = OMAP2_CONTROL_DEVCONF0; @@ -384,26 +329,20 @@ static int omap_mcbsp_dai_set_clks_src(struct omap_mcbsp_data *mcbsp_data, reg = OMAP2_CONTROL_DEVCONF0; sel_bit = 6; break; - case 2: - reg = reg_devconf1; - sel_bit = 0; - break; - case 3: - reg = reg_devconf1; - sel_bit = 2; - break; - case 4: - reg = reg_devconf1; - sel_bit = 4; - break; + /* TODO: Support for ports 3 - 5 in OMAP2430 and OMAP34xx */ default: return -EINVAL; } - if (clk_id == OMAP_MCBSP_SYSCLK_CLKS_FCLK) - omap_ctrl_writel(omap_ctrl_readl(reg) & ~(1 << sel_bit), reg); - else - omap_ctrl_writel(omap_ctrl_readl(reg) | (1 << sel_bit), reg); + if (cpu_class_is_omap2()) { + if (clk_id == OMAP_MCBSP_SYSCLK_CLKS_FCLK) { + omap_ctrl_writel(omap_ctrl_readl(reg) & + ~(1 << sel_bit), reg); + } else { + omap_ctrl_writel(omap_ctrl_readl(reg) | + (1 << sel_bit), reg); + } + } return 0; } @@ -437,49 +376,37 @@ static int omap_mcbsp_dai_set_dai_sysclk(struct snd_soc_dai *cpu_dai, return err; } -#define OMAP_MCBSP_DAI_BUILDER(link_id) \ -{ \ - .name = "omap-mcbsp-dai-(link_id)", \ - .id = (link_id), \ - .type = SND_SOC_DAI_I2S, \ - .playback = { \ - .channels_min = 2, \ - .channels_max = 2, \ - .rates = OMAP_MCBSP_RATES, \ - .formats = SNDRV_PCM_FMTBIT_S16_LE, \ - }, \ - .capture = { \ - .channels_min = 2, \ - .channels_max = 2, \ - .rates = OMAP_MCBSP_RATES, \ - .formats = SNDRV_PCM_FMTBIT_S16_LE, \ - }, \ - .ops = { \ - .startup = omap_mcbsp_dai_startup, \ - .shutdown = omap_mcbsp_dai_shutdown, \ - .trigger = omap_mcbsp_dai_trigger, \ - .hw_params = omap_mcbsp_dai_hw_params, \ - }, \ - .dai_ops = { \ - .set_fmt = omap_mcbsp_dai_set_dai_fmt, \ - .set_clkdiv = omap_mcbsp_dai_set_clkdiv, \ - .set_sysclk = omap_mcbsp_dai_set_dai_sysclk, \ - }, \ - .private_data = &mcbsp_data[(link_id)].bus_id, \ -} - -struct snd_soc_dai omap_mcbsp_dai[] = { - OMAP_MCBSP_DAI_BUILDER(0), - OMAP_MCBSP_DAI_BUILDER(1), -#if NUM_LINKS >= 3 - OMAP_MCBSP_DAI_BUILDER(2), -#endif -#if NUM_LINKS == 5 - OMAP_MCBSP_DAI_BUILDER(3), - OMAP_MCBSP_DAI_BUILDER(4), -#endif +struct snd_soc_dai omap_mcbsp_dai[NUM_LINKS] = { +{ + .name = "omap-mcbsp-dai", + .id = 0, + .type = SND_SOC_DAI_I2S, + .playback = { + .channels_min = 2, + .channels_max = 2, + .rates = OMAP_MCBSP_RATES, + .formats = SNDRV_PCM_FMTBIT_S16_LE, + }, + .capture = { + .channels_min = 2, + .channels_max = 2, + .rates = OMAP_MCBSP_RATES, + .formats = SNDRV_PCM_FMTBIT_S16_LE, + }, + .ops = { + .startup = omap_mcbsp_dai_startup, + .shutdown = omap_mcbsp_dai_shutdown, + .trigger = omap_mcbsp_dai_trigger, + .hw_params = omap_mcbsp_dai_hw_params, + }, + .dai_ops = { + .set_fmt = omap_mcbsp_dai_set_dai_fmt, + .set_clkdiv = omap_mcbsp_dai_set_clkdiv, + .set_sysclk = omap_mcbsp_dai_set_dai_sysclk, + }, + .private_data = &mcbsp_data[0].bus_id, +}, }; - EXPORT_SYMBOL_GPL(omap_mcbsp_dai); MODULE_AUTHOR("Jarkko Nikula "); diff --git a/trunk/sound/soc/omap/omap-mcbsp.h b/trunk/sound/soc/omap/omap-mcbsp.h index df7ad13ba73d..ed8afb550671 100644 --- a/trunk/sound/soc/omap/omap-mcbsp.h +++ b/trunk/sound/soc/omap/omap-mcbsp.h @@ -38,17 +38,11 @@ enum omap_mcbsp_div { OMAP_MCBSP_CLKGDV, /* Sample rate generator divider */ }; -#if defined(CONFIG_ARCH_OMAP2420) -#define NUM_LINKS 2 -#endif -#if defined(CONFIG_ARCH_OMAP15XX) || defined(CONFIG_ARCH_OMAP16XX) -#undef NUM_LINKS -#define NUM_LINKS 3 -#endif -#if defined(CONFIG_ARCH_OMAP2430) || defined(CONFIG_ARCH_OMAP34XX) -#undef NUM_LINKS -#define NUM_LINKS 5 -#endif +/* + * REVISIT: Preparation for the ASoC v2. Let the number of available links to + * be same than number of McBSP ports found in OMAP(s) we are compiling for. + */ +#define NUM_LINKS 1 extern struct snd_soc_dai omap_mcbsp_dai[NUM_LINKS]; diff --git a/trunk/sound/soc/omap/omap-pcm.c b/trunk/sound/soc/omap/omap-pcm.c index e9084fdd2082..690bfeaec4a0 100644 --- a/trunk/sound/soc/omap/omap-pcm.c +++ b/trunk/sound/soc/omap/omap-pcm.c @@ -97,7 +97,7 @@ static int omap_pcm_hw_params(struct snd_pcm_substream *substream, prtd->dma_data = dma_data; err = omap_request_dma(dma_data->dma_req, dma_data->name, omap_pcm_dma_irq, substream, &prtd->dma_ch); - if (!err & !cpu_is_omap1510()) { + if (!cpu_is_omap1510()) { /* * Link channel with itself so DMA doesn't need any * reprogramming while looping the buffer @@ -147,14 +147,12 @@ static int omap_pcm_prepare(struct snd_pcm_substream *substream) dma_params.src_or_dst_synch = OMAP_DMA_DST_SYNC; dma_params.src_start = runtime->dma_addr; dma_params.dst_start = dma_data->port_addr; - dma_params.dst_port = OMAP_DMA_PORT_MPUI; } else { dma_params.src_amode = OMAP_DMA_AMODE_CONSTANT; dma_params.dst_amode = OMAP_DMA_AMODE_POST_INC; dma_params.src_or_dst_synch = OMAP_DMA_SRC_SYNC; dma_params.src_start = dma_data->port_addr; dma_params.dst_start = runtime->dma_addr; - dma_params.src_port = OMAP_DMA_PORT_MPUI; } /* * Set DMA transfer frame size equal to ALSA period size and frame diff --git a/trunk/sound/soc/omap/osk5912.c b/trunk/sound/soc/omap/osk5912.c deleted file mode 100644 index 0fe733796898..000000000000 --- a/trunk/sound/soc/omap/osk5912.c +++ /dev/null @@ -1,232 +0,0 @@ -/* - * osk5912.c -- SoC audio for OSK 5912 - * - * Copyright (C) 2008 Mistral Solutions - * - * Contact: Arun KS - * - * 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. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA - * - */ - -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -#include "omap-mcbsp.h" -#include "omap-pcm.h" -#include "../codecs/tlv320aic23.h" - -#define CODEC_CLOCK 12000000 - -static struct clk *tlv320aic23_mclk; - -static int osk_startup(struct snd_pcm_substream *substream) -{ - return clk_enable(tlv320aic23_mclk); -} - -static void osk_shutdown(struct snd_pcm_substream *substream) -{ - clk_disable(tlv320aic23_mclk); -} - -static int osk_hw_params(struct snd_pcm_substream *substream, - struct snd_pcm_hw_params *params) -{ - struct snd_soc_pcm_runtime *rtd = substream->private_data; - struct snd_soc_dai *codec_dai = rtd->dai->codec_dai; - struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai; - int err; - - /* Set codec DAI configuration */ - err = snd_soc_dai_set_fmt(codec_dai, - SND_SOC_DAIFMT_DSP_A | - SND_SOC_DAIFMT_NB_IF | - SND_SOC_DAIFMT_CBM_CFM); - if (err < 0) { - printk(KERN_ERR "can't set codec DAI configuration\n"); - return err; - } - - /* Set cpu DAI configuration */ - err = snd_soc_dai_set_fmt(cpu_dai, - SND_SOC_DAIFMT_DSP_A | - SND_SOC_DAIFMT_NB_IF | - SND_SOC_DAIFMT_CBM_CFM); - if (err < 0) { - printk(KERN_ERR "can't set cpu DAI configuration\n"); - return err; - } - - /* Set the codec system clock for DAC and ADC */ - err = - snd_soc_dai_set_sysclk(codec_dai, 0, CODEC_CLOCK, SND_SOC_CLOCK_IN); - - if (err < 0) { - printk(KERN_ERR "can't set codec system clock\n"); - return err; - } - - return err; -} - -static struct snd_soc_ops osk_ops = { - .startup = osk_startup, - .hw_params = osk_hw_params, - .shutdown = osk_shutdown, -}; - -static const struct snd_soc_dapm_widget tlv320aic23_dapm_widgets[] = { - SND_SOC_DAPM_HP("Headphone Jack", NULL), - SND_SOC_DAPM_LINE("Line In", NULL), - SND_SOC_DAPM_MIC("Mic Jack", NULL), -}; - -static const struct snd_soc_dapm_route audio_map[] = { - {"Headphone Jack", NULL, "LHPOUT"}, - {"Headphone Jack", NULL, "RHPOUT"}, - - {"LLINEIN", NULL, "Line In"}, - {"RLINEIN", NULL, "Line In"}, - - {"MICIN", NULL, "Mic Jack"}, -}; - -static int osk_tlv320aic23_init(struct snd_soc_codec *codec) -{ - - /* Add osk5912 specific widgets */ - snd_soc_dapm_new_controls(codec, tlv320aic23_dapm_widgets, - ARRAY_SIZE(tlv320aic23_dapm_widgets)); - - /* Set up osk5912 specific audio path audio_map */ - snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map)); - - snd_soc_dapm_enable_pin(codec, "Headphone Jack"); - snd_soc_dapm_enable_pin(codec, "Line In"); - snd_soc_dapm_enable_pin(codec, "Mic Jack"); - - snd_soc_dapm_sync(codec); - - return 0; -} - -/* Digital audio interface glue - connects codec <--> CPU */ -static struct snd_soc_dai_link osk_dai = { - .name = "TLV320AIC23", - .stream_name = "AIC23", - .cpu_dai = &omap_mcbsp_dai[0], - .codec_dai = &tlv320aic23_dai, - .init = osk_tlv320aic23_init, - .ops = &osk_ops, -}; - -/* Audio machine driver */ -static struct snd_soc_machine snd_soc_machine_osk = { - .name = "OSK5912", - .dai_link = &osk_dai, - .num_links = 1, -}; - -/* Audio subsystem */ -static struct snd_soc_device osk_snd_devdata = { - .machine = &snd_soc_machine_osk, - .platform = &omap_soc_platform, - .codec_dev = &soc_codec_dev_tlv320aic23, -}; - -static struct platform_device *osk_snd_device; - -static int __init osk_soc_init(void) -{ - int err; - u32 curRate; - struct device *dev; - - if (!(machine_is_omap_osk())) - return -ENODEV; - - osk_snd_device = platform_device_alloc("soc-audio", -1); - if (!osk_snd_device) - return -ENOMEM; - - platform_set_drvdata(osk_snd_device, &osk_snd_devdata); - osk_snd_devdata.dev = &osk_snd_device->dev; - *(unsigned int *)osk_dai.cpu_dai->private_data = 0; /* McBSP1 */ - err = platform_device_add(osk_snd_device); - if (err) - goto err1; - - dev = &osk_snd_device->dev; - - tlv320aic23_mclk = clk_get(dev, "mclk"); - if (IS_ERR(tlv320aic23_mclk)) { - printk(KERN_ERR "Could not get mclk clock\n"); - return -ENODEV; - } - - if (clk_get_usecount(tlv320aic23_mclk) > 0) { - /* MCLK is already in use */ - printk(KERN_WARNING - "MCLK in use at %d Hz. We change it to %d Hz\n", - (uint) clk_get_rate(tlv320aic23_mclk), CODEC_CLOCK); - } - - /* - * Configure 12 MHz output on MCLK. - */ - curRate = (uint) clk_get_rate(tlv320aic23_mclk); - if (curRate != CODEC_CLOCK) { - if (clk_set_rate(tlv320aic23_mclk, CODEC_CLOCK)) { - printk(KERN_ERR "Cannot set MCLK for AIC23 CODEC\n"); - err = -ECANCELED; - goto err1; - } - } - - printk(KERN_INFO "MCLK = %d [%d], usecount = %d\n", - (uint) clk_get_rate(tlv320aic23_mclk), CODEC_CLOCK, - clk_get_usecount(tlv320aic23_mclk)); - - return 0; -err1: - clk_put(tlv320aic23_mclk); - platform_device_del(osk_snd_device); - platform_device_put(osk_snd_device); - - return err; - -} - -static void __exit osk_soc_exit(void) -{ - platform_device_unregister(osk_snd_device); -} - -module_init(osk_soc_init); -module_exit(osk_soc_exit); - -MODULE_AUTHOR("Arun KS "); -MODULE_DESCRIPTION("ALSA SoC OSK 5912"); -MODULE_LICENSE("GPL"); diff --git a/trunk/sound/soc/pxa/corgi.c b/trunk/sound/soc/pxa/corgi.c index dd7fa0b329c7..72b7a5140bf8 100644 --- a/trunk/sound/soc/pxa/corgi.c +++ b/trunk/sound/soc/pxa/corgi.c @@ -4,7 +4,7 @@ * Copyright 2005 Wolfson Microelectronics PLC. * Copyright 2005 Openedhand Ltd. * - * Authors: Liam Girdwood + * Authors: Liam Girdwood * Richard Purdie * * This program is free software; you can redistribute it and/or modify it @@ -289,8 +289,8 @@ static int corgi_wm8731_init(struct snd_soc_codec *codec) { int i, err; - snd_soc_dapm_nc_pin(codec, "LLINEIN"); - snd_soc_dapm_nc_pin(codec, "RLINEIN"); + snd_soc_dapm_disable_pin(codec, "LLINEIN"); + snd_soc_dapm_disable_pin(codec, "RLINEIN"); /* Add corgi specific controls */ for (i = 0; i < ARRAY_SIZE(wm8731_corgi_controls); i++) { diff --git a/trunk/sound/soc/pxa/em-x270.c b/trunk/sound/soc/pxa/em-x270.c index e6ff6929ab4b..d9c3f7b28be2 100644 --- a/trunk/sound/soc/pxa/em-x270.c +++ b/trunk/sound/soc/pxa/em-x270.c @@ -9,7 +9,7 @@ * Copyright 2005 Wolfson Microelectronics PLC. * Copyright 2005 Openedhand Ltd. * - * Authors: Liam Girdwood + * Authors: Liam Girdwood * Richard Purdie * * This program is free software; you can redistribute it and/or modify it diff --git a/trunk/sound/soc/pxa/poodle.c b/trunk/sound/soc/pxa/poodle.c index 4d9930c52789..f84f7d8db09a 100644 --- a/trunk/sound/soc/pxa/poodle.c +++ b/trunk/sound/soc/pxa/poodle.c @@ -4,7 +4,7 @@ * Copyright 2005 Wolfson Microelectronics PLC. * Copyright 2005 Openedhand Ltd. * - * Authors: Liam Girdwood + * Authors: Liam Girdwood * Richard Purdie * * This program is free software; you can redistribute it and/or modify it @@ -242,8 +242,8 @@ static int poodle_wm8731_init(struct snd_soc_codec *codec) { int i, err; - snd_soc_dapm_nc_pin(codec, "LLINEIN"); - snd_soc_dapm_nc_pin(codec, "RLINEIN"); + snd_soc_dapm_disable_pin(codec, "LLINEIN"); + snd_soc_dapm_disable_pin(codec, "RLINEIN"); snd_soc_dapm_enable_pin(codec, "MICIN"); /* Add poodle specific controls */ diff --git a/trunk/sound/soc/pxa/pxa2xx-i2s.c b/trunk/sound/soc/pxa/pxa2xx-i2s.c index 64057b1d220d..39d19212f6d3 100644 --- a/trunk/sound/soc/pxa/pxa2xx-i2s.c +++ b/trunk/sound/soc/pxa/pxa2xx-i2s.c @@ -3,7 +3,7 @@ * * Copyright 2005 Wolfson Microelectronics PLC. * Author: Liam Girdwood - * lrg@slimlogic.co.uk + * liam.girdwood@wolfsonmicro.com or linux@wolfsonmicro.com * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -366,6 +366,6 @@ module_init(pxa2xx_i2s_init); module_exit(pxa2xx_i2s_exit); /* Module information */ -MODULE_AUTHOR("Liam Girdwood, lrg@slimlogic.co.uk"); +MODULE_AUTHOR("Liam Girdwood, liam.girdwood@wolfsonmicro.com, www.wolfsonmicro.com"); MODULE_DESCRIPTION("pxa2xx I2S SoC Interface"); MODULE_LICENSE("GPL"); diff --git a/trunk/sound/soc/pxa/spitz.c b/trunk/sound/soc/pxa/spitz.c index 8f89188e541e..3d4738c06e7e 100644 --- a/trunk/sound/soc/pxa/spitz.c +++ b/trunk/sound/soc/pxa/spitz.c @@ -4,7 +4,7 @@ * Copyright 2005 Wolfson Microelectronics PLC. * Copyright 2005 Openedhand Ltd. * - * Authors: Liam Girdwood + * Authors: Liam Girdwood * Richard Purdie * * This program is free software; you can redistribute it and/or modify it @@ -291,13 +291,13 @@ static int spitz_wm8750_init(struct snd_soc_codec *codec) int i, err; /* NC codec pins */ - snd_soc_dapm_nc_pin(codec, "RINPUT1"); - snd_soc_dapm_nc_pin(codec, "LINPUT2"); - snd_soc_dapm_nc_pin(codec, "RINPUT2"); - snd_soc_dapm_nc_pin(codec, "LINPUT3"); - snd_soc_dapm_nc_pin(codec, "RINPUT3"); - snd_soc_dapm_nc_pin(codec, "OUT3"); - snd_soc_dapm_nc_pin(codec, "MONO1"); + snd_soc_dapm_disable_pin(codec, "RINPUT1"); + snd_soc_dapm_disable_pin(codec, "LINPUT2"); + snd_soc_dapm_disable_pin(codec, "RINPUT2"); + snd_soc_dapm_disable_pin(codec, "LINPUT3"); + snd_soc_dapm_disable_pin(codec, "RINPUT3"); + snd_soc_dapm_disable_pin(codec, "OUT3"); + snd_soc_dapm_disable_pin(codec, "MONO1"); /* Add spitz specific controls */ for (i = 0; i < ARRAY_SIZE(wm8750_spitz_controls); i++) { diff --git a/trunk/sound/soc/pxa/tosa.c b/trunk/sound/soc/pxa/tosa.c index afefe41b8c46..2baaa750f123 100644 --- a/trunk/sound/soc/pxa/tosa.c +++ b/trunk/sound/soc/pxa/tosa.c @@ -4,7 +4,7 @@ * Copyright 2005 Wolfson Microelectronics PLC. * Copyright 2005 Openedhand Ltd. * - * Authors: Liam Girdwood + * Authors: Liam Girdwood * Richard Purdie * * This program is free software; you can redistribute it and/or modify it @@ -190,8 +190,8 @@ static int tosa_ac97_init(struct snd_soc_codec *codec) { int i, err; - snd_soc_dapm_nc_pin(codec, "OUT3"); - snd_soc_dapm_nc_pin(codec, "MONOOUT"); + snd_soc_dapm_disable_pin(codec, "OUT3"); + snd_soc_dapm_disable_pin(codec, "MONOOUT"); /* add tosa specific controls */ for (i = 0; i < ARRAY_SIZE(tosa_controls); i++) { diff --git a/trunk/sound/soc/s3c24xx/neo1973_wm8753.c b/trunk/sound/soc/s3c24xx/neo1973_wm8753.c index 87ddfefcc2fb..73a50e93a9a2 100644 --- a/trunk/sound/soc/s3c24xx/neo1973_wm8753.c +++ b/trunk/sound/soc/s3c24xx/neo1973_wm8753.c @@ -511,20 +511,21 @@ static int neo1973_wm8753_init(struct snd_soc_codec *codec) DBG("Entered %s\n", __func__); /* set up NC codec pins */ - snd_soc_dapm_nc_pin(codec, "LOUT2"); - snd_soc_dapm_nc_pin(codec, "ROUT2"); - snd_soc_dapm_nc_pin(codec, "OUT3"); - snd_soc_dapm_nc_pin(codec, "OUT4"); - snd_soc_dapm_nc_pin(codec, "LINE1"); - snd_soc_dapm_nc_pin(codec, "LINE2"); + snd_soc_dapm_disable_pin(codec, "LOUT2"); + snd_soc_dapm_disable_pin(codec, "ROUT2"); + snd_soc_dapm_disable_pin(codec, "OUT3"); + snd_soc_dapm_disable_pin(codec, "OUT4"); + snd_soc_dapm_disable_pin(codec, "LINE1"); + snd_soc_dapm_disable_pin(codec, "LINE2"); - /* Add neo1973 specific widgets */ - snd_soc_dapm_new_controls(codec, wm8753_dapm_widgets, - ARRAY_SIZE(wm8753_dapm_widgets)); /* set endpoints to default mode */ set_scenario_endpoints(codec, NEO_AUDIO_OFF); + /* Add neo1973 specific widgets */ + snd_soc_dapm_new_controls(codec, wm8753_dapm_widgets, + ARRAY_SIZE(wm8753_dapm_widgets)); + /* add neo1973 specific controls */ for (i = 0; i < ARRAY_SIZE(wm8753_neo1973_controls); i++) { err = snd_ctl_add(codec->card, @@ -602,8 +603,6 @@ static int lm4857_i2c_probe(struct i2c_client *client, { DBG("Entered %s\n", __func__); - i2c = client; - lm4857_write_regs(); return 0; } @@ -612,8 +611,6 @@ static int lm4857_i2c_remove(struct i2c_client *client) { DBG("Entered %s\n", __func__); - i2c = NULL; - return 0; } @@ -653,7 +650,7 @@ static void lm4857_shutdown(struct i2c_client *dev) } static const struct i2c_device_id lm4857_i2c_id[] = { - { "neo1973_lm4857", 0 }, + { "neo1973_lm4857", 0 } { } }; @@ -671,6 +668,48 @@ static struct i2c_driver lm4857_i2c_driver = { }; static struct platform_device *neo1973_snd_device; +static struct i2c_client *lm4857_client; + +static int __init neo1973_add_lm4857_device(struct platform_device *pdev, + int i2c_bus, + unsigned short i2c_address) +{ + struct i2c_board_info info; + struct i2c_adapter *adapter; + struct i2c_client *client; + int ret; + + ret = i2c_add_driver(&lm4857_i2c_driver); + if (ret != 0) { + dev_err(&pdev->dev, "can't add lm4857 driver\n"); + return ret; + } + + memset(&info, 0, sizeof(struct i2c_board_info)); + info.addr = i2c_address; + strlcpy(info.type, "neo1973_lm4857", I2C_NAME_SIZE); + + adapter = i2c_get_adapter(i2c_bus); + if (!adapter) { + dev_err(&pdev->dev, "can't get i2c adapter %d\n", i2c_bus); + goto err_driver; + } + + client = i2c_new_device(adapter, &info); + i2c_put_adapter(adapter); + if (!client) { + dev_err(&pdev->dev, "can't add lm4857 device at 0x%x\n", + (unsigned int)info.addr); + goto err_driver; + } + + lm4857_client = client; + return 0; + +err_driver: + i2c_del_driver(&lm4857_i2c_driver); + return -ENODEV; +} static int __init neo1973_init(void) { @@ -697,8 +736,8 @@ static int __init neo1973_init(void) return ret; } - ret = i2c_add_driver(&lm4857_i2c_driver); - + ret = neo1973_add_lm4857_device(neo1973_snd_device, + neo1973_wm8753_setup, 0x7C); if (ret != 0) platform_device_unregister(neo1973_snd_device); @@ -709,6 +748,7 @@ static void __exit neo1973_exit(void) { DBG("Entered %s\n", __func__); + i2c_unregister_device(lm4857_client); i2c_del_driver(&lm4857_i2c_driver); platform_device_unregister(neo1973_snd_device); } diff --git a/trunk/sound/soc/soc-core.c b/trunk/sound/soc/soc-core.c index 0af3bbde5bbe..ad381138fc2e 100644 --- a/trunk/sound/soc/soc-core.c +++ b/trunk/sound/soc/soc-core.c @@ -4,7 +4,8 @@ * Copyright 2005 Wolfson Microelectronics PLC. * Copyright 2005 Openedhand Ltd. * - * Author: Liam Girdwood + * Author: Liam Girdwood + * liam.girdwood@wolfsonmicro.com or linux@wolfsonmicro.com * with code, comments and ideas from :- * Richard Purdie * @@ -95,8 +96,8 @@ static int soc_ac97_dev_register(struct snd_soc_codec *codec) codec->ac97->dev.parent = NULL; codec->ac97->dev.release = soc_ac97_device_release; - dev_set_name(&codec->ac97->dev, "%d-%d:%s", - codec->card->number, 0, codec->name); + snprintf(codec->ac97->dev.bus_id, BUS_ID_SIZE, "%d-%d:%s", + codec->card->number, 0, codec->name); err = device_register(&codec->ac97->dev); if (err < 0) { snd_printk(KERN_ERR "Can't register ac97 bus\n"); @@ -1885,7 +1886,7 @@ module_init(snd_soc_init); module_exit(snd_soc_exit); /* Module information */ -MODULE_AUTHOR("Liam Girdwood, lrg@slimlogic.co.uk"); +MODULE_AUTHOR("Liam Girdwood, liam.girdwood@wolfsonmicro.com, www.wolfsonmicro.com"); MODULE_DESCRIPTION("ALSA SoC Core"); MODULE_LICENSE("GPL"); MODULE_ALIAS("platform:soc-audio"); diff --git a/trunk/sound/soc/soc-dapm.c b/trunk/sound/soc/soc-dapm.c index efbd0b37810a..9ca9c08610fa 100644 --- a/trunk/sound/soc/soc-dapm.c +++ b/trunk/sound/soc/soc-dapm.c @@ -2,7 +2,8 @@ * soc-dapm.c -- ALSA SoC Dynamic Audio Power Management * * Copyright 2005 Wolfson Microelectronics PLC. - * Author: Liam Girdwood + * Author: Liam Girdwood + * liam.girdwood@wolfsonmicro.com or linux@wolfsonmicro.com * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -1482,26 +1483,6 @@ int snd_soc_dapm_disable_pin(struct snd_soc_codec *codec, char *pin) } EXPORT_SYMBOL_GPL(snd_soc_dapm_disable_pin); -/** - * snd_soc_dapm_nc_pin - permanently disable pin. - * @codec: SoC codec - * @pin: pin name - * - * Marks the specified pin as being not connected, disabling it along - * any parent or child widgets. At present this is identical to - * snd_soc_dapm_disable_pin() but in future it will be extended to do - * additional things such as disabling controls which only affect - * paths through the pin. - * - * NOTE: snd_soc_dapm_sync() needs to be called after this for DAPM to - * do any widget power switching. - */ -int snd_soc_dapm_nc_pin(struct snd_soc_codec *codec, char *pin) -{ - return snd_soc_dapm_set_pin(codec, pin, 0); -} -EXPORT_SYMBOL_GPL(snd_soc_dapm_nc_pin); - /** * snd_soc_dapm_get_pin_status - get audio pin status * @codec: audio codec @@ -1540,6 +1521,6 @@ void snd_soc_dapm_free(struct snd_soc_device *socdev) EXPORT_SYMBOL_GPL(snd_soc_dapm_free); /* Module information */ -MODULE_AUTHOR("Liam Girdwood, lrg@slimlogic.co.uk"); +MODULE_AUTHOR("Liam Girdwood, liam.girdwood@wolfsonmicro.com, www.wolfsonmicro.com"); MODULE_DESCRIPTION("Dynamic Audio Power Management core for ALSA SoC"); MODULE_LICENSE("GPL"); diff --git a/trunk/sound/sound_core.c b/trunk/sound/sound_core.c index ee66d43f848c..4ae07e236b36 100644 --- a/trunk/sound/sound_core.c +++ b/trunk/sound/sound_core.c @@ -57,7 +57,7 @@ module_exit(cleanup_soundcore); /* * OSS sound core handling. Breaks out sound functions to submodules * - * Author: Alan Cox + * Author: Alan Cox * * Fixes: * diff --git a/trunk/sound/usb/usbquirks.h b/trunk/sound/usb/usbquirks.h index 92115755d98e..69689e79bf79 100644 --- a/trunk/sound/usb/usbquirks.h +++ b/trunk/sound/usb/usbquirks.h @@ -1480,36 +1480,6 @@ YAMAHA_DEVICE(0x7010, "UB99"), } } }, -{ - /* Advanced modes of the Edirol UA-25EX. - * For the standard mode, UA-25EX has ID 0582:00e7, which - * offers only 16-bit PCM at 44.1 kHz and no MIDI. - */ - USB_DEVICE_VENDOR_SPEC(0x0582, 0x00e6), - .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) { - .vendor_name = "EDIROL", - .product_name = "UA-25EX", - .ifnum = QUIRK_ANY_INTERFACE, - .type = QUIRK_COMPOSITE, - .data = (const struct snd_usb_audio_quirk[]) { - { - .ifnum = 0, - .type = QUIRK_AUDIO_EDIROL_UAXX - }, - { - .ifnum = 1, - .type = QUIRK_AUDIO_EDIROL_UAXX - }, - { - .ifnum = 2, - .type = QUIRK_AUDIO_EDIROL_UAXX - }, - { - .ifnum = -1 - } - } - } -}, /* Guillemot devices */ { diff --git a/trunk/sound/usb/usx2y/us122l.c b/trunk/sound/usb/usx2y/us122l.c index c2515b680f9f..b441fe2cd190 100644 --- a/trunk/sound/usb/usx2y/us122l.c +++ b/trunk/sound/usb/usx2y/us122l.c @@ -118,11 +118,12 @@ static int usb_stream_hwdep_vm_fault(struct vm_area_struct *area, void *vaddr; struct us122l *us122l = area->vm_private_data; struct usb_stream *s; + int vm_f = VM_FAULT_SIGBUS; mutex_lock(&us122l->mutex); s = us122l->sk.s; if (!s) - goto unlock; + goto out; offset = vmf->pgoff << PAGE_SHIFT; if (offset < PAGE_ALIGN(s->read_size)) @@ -130,7 +131,7 @@ static int usb_stream_hwdep_vm_fault(struct vm_area_struct *area, else { offset -= PAGE_ALIGN(s->read_size); if (offset >= PAGE_ALIGN(s->write_size)) - goto unlock; + goto out; vaddr = us122l->sk.write_page + offset; } @@ -140,11 +141,9 @@ static int usb_stream_hwdep_vm_fault(struct vm_area_struct *area, mutex_unlock(&us122l->mutex); vmf->page = page; - - return 0; -unlock: - mutex_unlock(&us122l->mutex); - return VM_FAULT_SIGBUS; + vm_f = 0; +out: + return vm_f; } static void usb_stream_hwdep_vm_close(struct vm_area_struct *area)