···3131/* these minors can still be used for autoloading devices (/dev/aload*) */3232#define SNDRV_MINOR_CONTROL 0 /* 0 */3333#define SNDRV_MINOR_GLOBAL 1 /* 1 */3434-#define SNDRV_MINOR_SEQUENCER (SNDRV_MINOR_GLOBAL + 0 * 32)3535-#define SNDRV_MINOR_TIMER (SNDRV_MINOR_GLOBAL + 1 * 32)3434+#define SNDRV_MINOR_SEQUENCER 1 /* SNDRV_MINOR_GLOBAL + 0 * 32 */3535+#define SNDRV_MINOR_TIMER 33 /* SNDRV_MINOR_GLOBAL + 1 * 32 */36363737#ifndef CONFIG_SND_DYNAMIC_MINORS3838 /* 2 - 3 (reserved) */
+1
include/sound/pcm.h
···297297 unsigned int info;298298 unsigned int rate_num;299299 unsigned int rate_den;300300+ unsigned int no_period_wakeup: 1;300301301302 /* -- SW params -- */302303 int tstamp_mode; /* mmap timestamp is updated */
+2-2
sound/ac97_bus.c
···19192020/*2121 * Let drivers decide whether they want to support given codec from their2222- * probe method. Drivers have direct access to the struct snd_ac97 structure and may2323- * decide based on the id field amongst other things.2222+ * probe method. Drivers have direct access to the struct snd_ac972323+ * structure and may decide based on the id field amongst other things.2424 */2525static int ac97_bus_match(struct device *dev, struct device_driver *drv)2626{
···107107108108 /* make sure no work is pending before freeing109109 * all things */110110- cancel_delayed_work(&rt->headphone_notify.work);111111- cancel_delayed_work(&rt->line_in_notify.work);112112- cancel_delayed_work(&rt->line_out_notify.work);113113- flush_scheduled_work();110110+ cancel_delayed_work_sync(&rt->headphone_notify.work);111111+ cancel_delayed_work_sync(&rt->line_in_notify.work);112112+ cancel_delayed_work_sync(&rt->line_out_notify.work);114113115114 mutex_destroy(&rt->headphone_notify.mutex);116115 mutex_destroy(&rt->line_in_notify.mutex);
+27-1
sound/core/control.c
···14881488}1489148914901490/*14911491- * Frequently used control callbacks14911491+ * Frequently used control callbacks/helpers14921492 */14931493int snd_ctl_boolean_mono_info(struct snd_kcontrol *kcontrol,14941494 struct snd_ctl_elem_info *uinfo)···15131513}1514151415151515EXPORT_SYMBOL(snd_ctl_boolean_stereo_info);15161516+15171517+/**15181518+ * snd_ctl_enum_info - fills the info structure for an enumerated control15191519+ * @info: the structure to be filled15201520+ * @channels: the number of the control's channels; often one15211521+ * @items: the number of control values; also the size of @names15221522+ * @names: an array containing the names of all control values15231523+ *15241524+ * Sets all required fields in @info to their appropriate values.15251525+ * If the control's accessibility is not the default (readable and writable),15261526+ * the caller has to fill @info->access.15271527+ */15281528+int snd_ctl_enum_info(struct snd_ctl_elem_info *info, unsigned int channels,15291529+ unsigned int items, const char *const names[])15301530+{15311531+ info->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;15321532+ info->count = channels;15331533+ info->value.enumerated.items = items;15341534+ if (info->value.enumerated.item >= items)15351535+ info->value.enumerated.item = items - 1;15361536+ strlcpy(info->value.enumerated.name,15371537+ names[info->value.enumerated.item],15381538+ sizeof(info->value.enumerated.name));15391539+ return 0;15401540+}15411541+EXPORT_SYMBOL(snd_ctl_enum_info);
+3-1
sound/core/oss/pcm_oss.c
···453453 } else {454454 *params = *save;455455 max = snd_pcm_hw_param_max(pcm, params, var, max, &maxdir);456456- if (max < 0)456456+ if (max < 0) {457457+ kfree(save);457458 return max;459459+ }458460 last = 1;459461 }460462 _end:
+22
sound/core/pcm_lib.c
···373373 (unsigned long)new_hw_ptr,374374 (unsigned long)runtime->hw_ptr_base);375375 }376376+377377+ if (runtime->no_period_wakeup) {378378+ /*379379+ * Without regular period interrupts, we have to check380380+ * the elapsed time to detect xruns.381381+ */382382+ jdelta = jiffies - runtime->hw_ptr_jiffies;383383+ if (jdelta < runtime->hw_ptr_buffer_jiffies / 2)384384+ goto no_delta_check;385385+ hdelta = jdelta - delta * HZ / runtime->rate;386386+ while (hdelta > runtime->hw_ptr_buffer_jiffies / 2 + 1) {387387+ delta += runtime->buffer_size;388388+ hw_base += runtime->buffer_size;389389+ if (hw_base >= runtime->boundary)390390+ hw_base = 0;391391+ new_hw_ptr = hw_base + pos;392392+ hdelta -= runtime->hw_ptr_buffer_jiffies;393393+ }394394+ goto no_delta_check;395395+ }396396+376397 /* something must be really wrong */377398 if (delta >= runtime->buffer_size + runtime->period_size) {378399 hw_ptr_error(substream,···463442 (long)old_hw_ptr);464443 }465444445445+ no_delta_check:466446 if (runtime->status->hw_ptr == new_hw_ptr)467447 return 0;468448
···3232#include "seq_timer.h"3333#include "seq_system.h"3434#include "seq_info.h"3535+#include <sound/minors.h>3536#include <sound/seq_device.h>36373738#if defined(CONFIG_SND_SEQ_DUMMY_MODULE)···7372MODULE_PARM_DESC(seq_default_timer_subdevice, "The default timer subdevice number.");7473module_param(seq_default_timer_resolution, int, 0644);7574MODULE_PARM_DESC(seq_default_timer_resolution, "The default timer resolution in Hz.");7575+7676+MODULE_ALIAS_CHARDEV(CONFIG_SND_MAJOR, SNDRV_MINOR_SEQUENCER);7777+MODULE_ALIAS("devname:snd/seq");76787779/*7880 * INIT PART
+13-5
sound/core/sound.c
···188188};189189190190#ifdef CONFIG_SND_DYNAMIC_MINORS191191-static int snd_find_free_minor(void)191191+static int snd_find_free_minor(int type)192192{193193 int minor;194194195195+ /* static minors for module auto loading */196196+ if (type == SNDRV_DEVICE_TYPE_SEQUENCER)197197+ return SNDRV_MINOR_SEQUENCER;198198+ if (type == SNDRV_DEVICE_TYPE_TIMER)199199+ return SNDRV_MINOR_TIMER;200200+195201 for (minor = 0; minor < ARRAY_SIZE(snd_minors); ++minor) {196196- /* skip minors still used statically for autoloading devices */197197- if (SNDRV_MINOR_DEVICE(minor) == SNDRV_MINOR_CONTROL ||198198- minor == SNDRV_MINOR_SEQUENCER)202202+ /* skip static minors still used for module auto loading */203203+ if (SNDRV_MINOR_DEVICE(minor) == SNDRV_MINOR_CONTROL)204204+ continue;205205+ if (minor == SNDRV_MINOR_SEQUENCER ||206206+ minor == SNDRV_MINOR_TIMER)199207 continue;200208 if (!snd_minors[minor])201209 return minor;···277269 preg->private_data = private_data;278270 mutex_lock(&sound_mutex);279271#ifdef CONFIG_SND_DYNAMIC_MINORS280280- minor = snd_find_free_minor();272272+ minor = snd_find_free_minor(type);281273#else282274 minor = snd_kernel_minor(type, card, dev);283275 if (minor >= 0 && snd_minors[minor])
···209209 tristate210210211211config SND_OXYGEN212212- tristate "C-Media 8788 (Oxygen)"212212+ tristate "C-Media 8786, 8787, 8788 (Oxygen)"213213 select SND_OXYGEN_LIB214214 select SND_PCM215215 select SND_MPU401_UART···217217 Say Y here to include support for sound cards based on the218218 C-Media CMI8788 (Oxygen HD Audio) chip:219219 * Asound A-8788220220+ * Asus Xonar DG220221 * AuzenTech X-Meridian222222+ * AuzenTech X-Meridian 2G221223 * Bgears b-Enspirer222224 * Club3D Theatron DTS223225 * HT-Omega Claro (plus)224226 * HT-Omega Claro halo (XT)227227+ * Kuroutoshikou CMI8787-HG2PCI225228 * Razer Barracuda AC-1226229 * Sondigo Inferno230230+ * TempoTec/MediaTek HiFier Fantasia231231+ * TempoTec/MediaTek HiFier Serenade227232228233 To compile this driver as a module, choose M here: the module229234 will be called snd-oxygen.···583578 To compile this driver as a module, choose M here: the module584579 will be called snd-hdspm.585580586586-config SND_HIFIER587587- tristate "TempoTec HiFier Fantasia"588588- select SND_OXYGEN_LIB589589- select SND_PCM590590- select SND_MPU401_UART591591- help592592- Say Y here to include support for the MediaTek/TempoTec HiFier593593- Fantasia sound card.594594-595595- To compile this driver as a module, choose M here: the module596596- will be called snd-hifier.597597-598581config SND_ICE1712599582 tristate "ICEnsemble ICE1712 (Envy24)"600583 select SND_MPU401_UART···819826 Say Y here to include support for sound cards based on the820827 Asus AV66/AV100/AV200 chips, i.e., Xonar D1, DX, D2, D2X, DS,821828 Essence ST (Deluxe), and Essence STX.822822- Support for the HDAV1.3 (Deluxe) is incomplete; for the823823- HDAV1.3 Slim and Xense, missing.829829+ Support for the HDAV1.3 (Deluxe) and HDAV1.3 Slim is experimental;830830+ for the Xense, missing.824831825832 To compile this driver as a module, choose M here: the module826833 will be called snd-virtuoso.
+2-4
sound/pci/ac97/ac97_codec.c
···10141014{10151015 if (ac97) {10161016#ifdef CONFIG_SND_AC97_POWER_SAVE10171017- cancel_delayed_work(&ac97->power_work);10181018- flush_scheduled_work();10171017+ cancel_delayed_work_sync(&ac97->power_work);10191018#endif10201019 snd_ac97_proc_done(ac97);10211020 if (ac97->bus)···24552456 if (ac97->build_ops->suspend)24562457 ac97->build_ops->suspend(ac97);24572458#ifdef CONFIG_SND_AC97_POWER_SAVE24582458- cancel_delayed_work(&ac97->power_work);24592459- flush_scheduled_work();24592459+ cancel_delayed_work_sync(&ac97->power_work);24602460#endif24612461 snd_ac97_powerdown(ac97);24622462}
+205-201
sound/pci/azt3328.c
···11/*22 * azt3328.c - driver for Aztech AZF3328 based soundcards (e.g. PCI168).33- * Copyright (C) 2002, 2005 - 2009 by Andreas Mohr <andi AT lisas.de>33+ * Copyright (C) 2002, 2005 - 2010 by Andreas Mohr <andi AT lisas.de>44 *55 * Framework borrowed from Bart Hartgers's als4000.c.66 * Driver developed on PCI168 AP(W) version (PCI rev. 10, subsystem ID 1801),···175175176176#include <asm/io.h>177177#include <linux/init.h>178178+#include <linux/bug.h> /* WARN_ONCE */178179#include <linux/pci.h>179180#include <linux/delay.h>180181#include <linux/slab.h>···202201203202/* === Debug settings ===204203 Further diagnostic functionality than the settings below205205- does not need to be provided, since one can easily write a bash script204204+ does not need to be provided, since one can easily write a POSIX shell script206205 to dump the card's I/O ports (those listed in lspci -v -v):207207- function dump()206206+ dump()208207 {209208 local descr=$1; local addr=$2; local count=$3210209211210 echo "${descr}: ${count} @ ${addr}:"212212- dd if=/dev/port skip=$[${addr}] count=${count} bs=1 2>/dev/null| hexdump -C211211+ dd if=/dev/port skip=`printf %d ${addr}` count=${count} bs=1 \212212+ 2>/dev/null| hexdump -C213213 }214214 and then use something like215215 "dump joy200 0x200 8", "dump mpu388 0x388 4", "dump joy 0xb400 8",···218216 possibly within a "while true; do ... sleep 1; done" loop.219217 Tweaking ports could be done using220218 VALSTRING="`printf "%02x" $value`"221221- printf "\x""$VALSTRING"|dd of=/dev/port seek=$[${addr}] bs=1 2>/dev/null219219+ printf "\x""$VALSTRING"|dd of=/dev/port seek=`printf %d ${addr}` bs=1 \220220+ 2>/dev/null222221*/223222224223#define DEBUG_MISC 0225224#define DEBUG_CALLS 0226225#define DEBUG_MIXER 0227226#define DEBUG_CODEC 0228228-#define DEBUG_IO 0229227#define DEBUG_TIMER 0230228#define DEBUG_GAME 0231229#define DEBUG_PM 0···293291module_param(seqtimer_scaling, int, 0444);294292MODULE_PARM_DESC(seqtimer_scaling, "Set 1024000Hz sequencer timer scale factor (lockup danger!). Default 128.");295293296296-struct snd_azf3328_codec_data {297297- unsigned long io_base;298298- struct snd_pcm_substream *substream;299299- bool running;300300- const char *name;301301-};302302-303294enum snd_azf3328_codec_type {295295+ /* warning: fixed indices (also used for bitmask checks!) */304296 AZF_CODEC_PLAYBACK = 0,305297 AZF_CODEC_CAPTURE = 1,306298 AZF_CODEC_I2S_OUT = 2,299299+};300300+301301+struct snd_azf3328_codec_data {302302+ unsigned long io_base; /* keep first! (avoid offset calc) */303303+ unsigned int dma_base; /* helper to avoid an indirection in hotpath */304304+ spinlock_t *lock; /* TODO: convert to our own per-codec lock member */305305+ struct snd_pcm_substream *substream;306306+ bool running;307307+ enum snd_azf3328_codec_type type;308308+ const char *name;307309};308310309311struct snd_azf3328 {···368362static int369363snd_azf3328_io_reg_setb(unsigned reg, u8 mask, bool do_set)370364{365365+ /* Well, strictly spoken, the inb/outb sequence isn't atomic366366+ and would need locking. However we currently don't care367367+ since it potentially complicates matters. */371368 u8 prev = inb(reg), new;372369373370 new = (do_set) ? (prev|mask) : (prev & ~mask);···420411)421412{422413 outl(value, codec->io_base + reg);414414+}415415+416416+static inline void417417+snd_azf3328_codec_outl_multi(const struct snd_azf3328_codec_data *codec,418418+ unsigned reg, const void *buffer, int count419419+)420420+{421421+ unsigned long addr = codec->io_base + reg;422422+ if (count) {423423+ const u32 *buf = buffer;424424+ do {425425+ outl(*buf++, addr);426426+ addr += 4;427427+ } while (--count);428428+ }423429}424430425431static inline u32···967943}968944969945static void970970-snd_azf3328_codec_setfmt(struct snd_azf3328 *chip,971971- enum snd_azf3328_codec_type codec_type,946946+snd_azf3328_codec_setfmt(struct snd_azf3328_codec_data *codec,972947 enum azf_freq_t bitrate,973948 unsigned int format_width,974949 unsigned int channels975950)976951{977952 unsigned long flags;978978- const struct snd_azf3328_codec_data *codec = &chip->codecs[codec_type];979953 u16 val = 0xff00;954954+ u8 freq = 0;980955981956 snd_azf3328_dbgcallenter();982957 switch (bitrate) {983983- case AZF_FREQ_4000: val |= SOUNDFORMAT_FREQ_SUSPECTED_4000; break;984984- case AZF_FREQ_4800: val |= SOUNDFORMAT_FREQ_SUSPECTED_4800; break;985985- case AZF_FREQ_5512:986986- /* the AZF3328 names it "5510" for some strange reason */987987- val |= SOUNDFORMAT_FREQ_5510; break;988988- case AZF_FREQ_6620: val |= SOUNDFORMAT_FREQ_6620; break;989989- case AZF_FREQ_8000: val |= SOUNDFORMAT_FREQ_8000; break;990990- case AZF_FREQ_9600: val |= SOUNDFORMAT_FREQ_9600; break;991991- case AZF_FREQ_11025: val |= SOUNDFORMAT_FREQ_11025; break;992992- case AZF_FREQ_13240: val |= SOUNDFORMAT_FREQ_SUSPECTED_13240; break;993993- case AZF_FREQ_16000: val |= SOUNDFORMAT_FREQ_16000; break;994994- case AZF_FREQ_22050: val |= SOUNDFORMAT_FREQ_22050; break;995995- case AZF_FREQ_32000: val |= SOUNDFORMAT_FREQ_32000; break;958958+#define AZF_FMT_XLATE(in_freq, out_bits) \959959+ do { \960960+ case AZF_FREQ_ ## in_freq: \961961+ freq = SOUNDFORMAT_FREQ_ ## out_bits; \962962+ break; \963963+ } while (0);964964+ AZF_FMT_XLATE(4000, SUSPECTED_4000)965965+ AZF_FMT_XLATE(4800, SUSPECTED_4800)966966+ /* the AZF3328 names it "5510" for some strange reason: */967967+ AZF_FMT_XLATE(5512, 5510)968968+ AZF_FMT_XLATE(6620, 6620)969969+ AZF_FMT_XLATE(8000, 8000)970970+ AZF_FMT_XLATE(9600, 9600)971971+ AZF_FMT_XLATE(11025, 11025)972972+ AZF_FMT_XLATE(13240, SUSPECTED_13240)973973+ AZF_FMT_XLATE(16000, 16000)974974+ AZF_FMT_XLATE(22050, 22050)975975+ AZF_FMT_XLATE(32000, 32000)996976 default:997977 snd_printk(KERN_WARNING "unknown bitrate %d, assuming 44.1kHz!\n", bitrate);998978 /* fall-through */999999- case AZF_FREQ_44100: val |= SOUNDFORMAT_FREQ_44100; break;10001000- case AZF_FREQ_48000: val |= SOUNDFORMAT_FREQ_48000; break;10011001- case AZF_FREQ_66200: val |= SOUNDFORMAT_FREQ_SUSPECTED_66200; break;979979+ AZF_FMT_XLATE(44100, 44100)980980+ AZF_FMT_XLATE(48000, 48000)981981+ AZF_FMT_XLATE(66200, SUSPECTED_66200)982982+#undef AZF_FMT_XLATE1002983 }1003984 /* val = 0xff07; 3m27.993s (65301Hz; -> 64000Hz???) hmm, 66120, 65967, 66123 */1004985 /* val = 0xff09; 17m15.098s (13123,478Hz; -> 12000Hz???) hmm, 13237.2Hz? */···1015986 /* val = 0xff0d; 41m23.135s (5523,600Hz; -> 5512Hz???) */1016987 /* val = 0xff0e; 28m30.777s (8017Hz; -> 8000Hz???) */1017988989989+ val |= freq;990990+1018991 if (channels == 2)1019992 val |= SOUNDFORMAT_FLAG_2CHANNELS;10209931021994 if (format_width == 16)1022995 val |= SOUNDFORMAT_FLAG_16BIT;102399610241024- spin_lock_irqsave(&chip->reg_lock, flags);997997+ spin_lock_irqsave(codec->lock, flags);10259981026999 /* set bitrate/format */10271000 snd_azf3328_codec_outw(codec, IDX_IO_CODEC_SOUNDFORMAT, val);···10351004 * (FIXME: yes, it works, but what exactly am I doing here?? :)10361005 * FIXME: does this have some side effects for full-duplex10371006 * or other dramatic side effects? */10381038- if (codec_type == AZF_CODEC_PLAYBACK) /* only do it for playback */10071007+ /* do it for non-capture codecs only */10081008+ if (codec->type != AZF_CODEC_CAPTURE)10391009 snd_azf3328_codec_outw(codec, IDX_IO_CODEC_DMA_FLAGS,10401010 snd_azf3328_codec_inw(codec, IDX_IO_CODEC_DMA_FLAGS) |10411011 DMA_RUN_SOMETHING1 |···10461014 DMA_SOMETHING_ELSE10471015 );1048101610491049- spin_unlock_irqrestore(&chip->reg_lock, flags);10171017+ spin_unlock_irqrestore(codec->lock, flags);10501018 snd_azf3328_dbgcallleave();10511019}1052102010531021static inline void10541054-snd_azf3328_codec_setfmt_lowpower(struct snd_azf3328 *chip,10551055- enum snd_azf3328_codec_type codec_type10221022+snd_azf3328_codec_setfmt_lowpower(struct snd_azf3328_codec_data *codec10561023)10571024{10581025 /* choose lowest frequency for low power consumption.10591026 * While this will cause louder noise due to rather coarse frequency,10601027 * it should never matter since output should always10611028 * get disabled properly when idle anyway. */10621062- snd_azf3328_codec_setfmt(chip, codec_type, AZF_FREQ_4000, 8, 1);10291029+ snd_azf3328_codec_setfmt(codec, AZF_FREQ_4000, 8, 1);10631030}1064103110651032static void···11321101 /* ...and adjust clock, too11331102 * (reduce noise and power consumption) */11341103 if (!enable)11351135- snd_azf3328_codec_setfmt_lowpower(11361136- chip,11371137- codec_type11381138- );11041104+ snd_azf3328_codec_setfmt_lowpower(codec);11391105 codec->running = enable;11401106 }11411107}1142110811431109static void11441144-snd_azf3328_codec_setdmaa(struct snd_azf3328 *chip,11451145- enum snd_azf3328_codec_type codec_type,11101110+snd_azf3328_codec_setdmaa(struct snd_azf3328_codec_data *codec,11461111 unsigned long addr,11471147- unsigned int count,11481148- unsigned int size11121112+ unsigned int period_bytes,11131113+ unsigned int buffer_bytes11491114)11501115{11511151- const struct snd_azf3328_codec_data *codec = &chip->codecs[codec_type];11521116 snd_azf3328_dbgcallenter();11171117+ WARN_ONCE(period_bytes & 1, "odd period length!?\n");11181118+ WARN_ONCE(buffer_bytes != 2 * period_bytes,11191119+ "missed our input expectations! %u vs. %u\n",11201120+ buffer_bytes, period_bytes);11531121 if (!codec->running) {11541122 /* AZF3328 uses a two buffer pointer DMA transfer approach */1155112311561156- unsigned long flags, addr_area2;11241124+ unsigned long flags;1157112511581126 /* width 32bit (prevent overflow): */11591159- u32 count_areas, lengths;11271127+ u32 area_length;11281128+ struct codec_setup_io {11291129+ u32 dma_start_1;11301130+ u32 dma_start_2;11311131+ u32 dma_lengths;11321132+ } __attribute__((packed)) setup_io;1160113311611161- count_areas = size/2;11621162- addr_area2 = addr+count_areas;11631163- snd_azf3328_dbgcodec("setdma: buffers %08lx[%u] / %08lx[%u]\n",11641164- addr, count_areas, addr_area2, count_areas);11341134+ area_length = buffer_bytes/2;1165113511661166- count_areas--; /* max. index */11361136+ setup_io.dma_start_1 = addr;11371137+ setup_io.dma_start_2 = addr+area_length;11381138+11391139+ snd_azf3328_dbgcodec(11401140+ "setdma: buffers %08x[%u] / %08x[%u], %u, %u\n",11411141+ setup_io.dma_start_1, area_length,11421142+ setup_io.dma_start_2, area_length,11431143+ period_bytes, buffer_bytes);11441144+11451145+ /* Hmm, are we really supposed to decrement this by 1??11461146+ Most definitely certainly not: configuring full length does11471147+ work properly (i.e. likely better), and BTW we11481148+ violated possibly differing frame sizes with this...11491149+11501150+ area_length--; |* max. index *|11511151+ */1167115211681153 /* build combined I/O buffer length word */11691169- lengths = (count_areas << 16) | (count_areas);11701170- spin_lock_irqsave(&chip->reg_lock, flags);11711171- snd_azf3328_codec_outl(codec, IDX_IO_CODEC_DMA_START_1, addr);11721172- snd_azf3328_codec_outl(codec, IDX_IO_CODEC_DMA_START_2,11731173- addr_area2);11741174- snd_azf3328_codec_outl(codec, IDX_IO_CODEC_DMA_LENGTHS,11751175- lengths);11761176- spin_unlock_irqrestore(&chip->reg_lock, flags);11541154+ setup_io.dma_lengths = (area_length << 16) | (area_length);11551155+11561156+ spin_lock_irqsave(codec->lock, flags);11571157+ snd_azf3328_codec_outl_multi(11581158+ codec, IDX_IO_CODEC_DMA_START_1, &setup_io, 311591159+ );11601160+ spin_unlock_irqrestore(codec->lock, flags);11771161 }11781162 snd_azf3328_dbgcallleave();11791163}1180116411811165static int11821182-snd_azf3328_codec_prepare(struct snd_pcm_substream *substream)11661166+snd_azf3328_pcm_prepare(struct snd_pcm_substream *substream)11831167{11841184-#if 011851185- struct snd_azf3328 *chip = snd_pcm_substream_chip(substream);11861168 struct snd_pcm_runtime *runtime = substream->runtime;11691169+ struct snd_azf3328_codec_data *codec = runtime->private_data;11701170+#if 011871171 unsigned int size = snd_pcm_lib_buffer_bytes(substream);11881172 unsigned int count = snd_pcm_lib_period_bytes(substream);11891173#endif1190117411911175 snd_azf3328_dbgcallenter();11761176+11771177+ codec->dma_base = runtime->dma_addr;11781178+11921179#if 011931193- snd_azf3328_codec_setfmt(chip, AZF_CODEC_...,11801180+ snd_azf3328_codec_setfmt(codec,11941181 runtime->rate,11951182 snd_pcm_format_width(runtime->format),11961183 runtime->channels);11971197- snd_azf3328_codec_setdmaa(chip, AZF_CODEC_...,11841184+ snd_azf3328_codec_setdmaa(codec,11981185 runtime->dma_addr, count, size);11991186#endif12001187 snd_azf3328_dbgcallleave();···12201171}1221117212221173static int12231223-snd_azf3328_codec_trigger(enum snd_azf3328_codec_type codec_type,12241224- struct snd_pcm_substream *substream, int cmd)11741174+snd_azf3328_pcm_trigger(struct snd_pcm_substream *substream, int cmd)12251175{12261176 struct snd_azf3328 *chip = snd_pcm_substream_chip(substream);12271227- const struct snd_azf3328_codec_data *codec = &chip->codecs[codec_type];12281177 struct snd_pcm_runtime *runtime = substream->runtime;11781178+ struct snd_azf3328_codec_data *codec = runtime->private_data;12291179 int result = 0;12301180 u16 flags1;12311181 bool previously_muted = 0;12321232- bool is_playback_codec = (AZF_CODEC_PLAYBACK == codec_type);11821182+ bool is_main_mixer_playback_codec = (AZF_CODEC_PLAYBACK == codec->type);1233118312341234- snd_azf3328_dbgcalls("snd_azf3328_codec_trigger cmd %d\n", cmd);11841184+ snd_azf3328_dbgcalls("snd_azf3328_pcm_trigger cmd %d\n", cmd);1235118512361186 switch (cmd) {12371187 case SNDRV_PCM_TRIGGER_START:12381188 snd_azf3328_dbgcodec("START %s\n", codec->name);1239118912401240- if (is_playback_codec) {11901190+ if (is_main_mixer_playback_codec) {12411191 /* mute WaveOut (avoid clicking during setup) */12421192 previously_muted =12431193 snd_azf3328_mixer_set_mute(···12441196 );12451197 }1246119812471247- snd_azf3328_codec_setfmt(chip, codec_type,11991199+ snd_azf3328_codec_setfmt(codec,12481200 runtime->rate,12491201 snd_pcm_format_width(runtime->format),12501202 runtime->channels);1251120312521252- spin_lock(&chip->reg_lock);12041204+ spin_lock(codec->lock);12531205 /* first, remember current value: */12541206 flags1 = snd_azf3328_codec_inw(codec, IDX_IO_CODEC_DMA_FLAGS);12551207···1259121112601212 /* FIXME: clear interrupts or what??? */12611213 snd_azf3328_codec_outw(codec, IDX_IO_CODEC_IRQTYPE, 0xffff);12621262- spin_unlock(&chip->reg_lock);12141214+ spin_unlock(codec->lock);1263121512641264- snd_azf3328_codec_setdmaa(chip, codec_type, runtime->dma_addr,12161216+ snd_azf3328_codec_setdmaa(codec, runtime->dma_addr,12651217 snd_pcm_lib_period_bytes(substream),12661218 snd_pcm_lib_buffer_bytes(substream)12671219 );1268122012691269- spin_lock(&chip->reg_lock);12211221+ spin_lock(codec->lock);12701222#ifdef WIN9X12711223 /* FIXME: enable playback/recording??? */12721224 flags1 |= DMA_RUN_SOMETHING1 | DMA_RUN_SOMETHING2;···12901242 DMA_EPILOGUE_SOMETHING |12911243 DMA_SOMETHING_ELSE);12921244#endif12931293- spin_unlock(&chip->reg_lock);12941294- snd_azf3328_ctrl_codec_activity(chip, codec_type, 1);12451245+ spin_unlock(codec->lock);12461246+ snd_azf3328_ctrl_codec_activity(chip, codec->type, 1);1295124712961296- if (is_playback_codec) {12481248+ if (is_main_mixer_playback_codec) {12971249 /* now unmute WaveOut */12981250 if (!previously_muted)12991251 snd_azf3328_mixer_set_mute(···13061258 case SNDRV_PCM_TRIGGER_RESUME:13071259 snd_azf3328_dbgcodec("RESUME %s\n", codec->name);13081260 /* resume codec if we were active */13091309- spin_lock(&chip->reg_lock);12611261+ spin_lock(codec->lock);13101262 if (codec->running)13111263 snd_azf3328_codec_outw(codec, IDX_IO_CODEC_DMA_FLAGS,13121264 snd_azf3328_codec_inw(13131265 codec, IDX_IO_CODEC_DMA_FLAGS13141266 ) | DMA_RESUME13151267 );13161316- spin_unlock(&chip->reg_lock);12681268+ spin_unlock(codec->lock);13171269 break;13181270 case SNDRV_PCM_TRIGGER_STOP:13191271 snd_azf3328_dbgcodec("STOP %s\n", codec->name);1320127213211321- if (is_playback_codec) {12731273+ if (is_main_mixer_playback_codec) {13221274 /* mute WaveOut (avoid clicking during setup) */13231275 previously_muted =13241276 snd_azf3328_mixer_set_mute(···13261278 );13271279 }1328128013291329- spin_lock(&chip->reg_lock);12811281+ spin_lock(codec->lock);13301282 /* first, remember current value: */13311283 flags1 = snd_azf3328_codec_inw(codec, IDX_IO_CODEC_DMA_FLAGS);13321284···1341129313421294 flags1 &= ~DMA_RUN_SOMETHING1;13431295 snd_azf3328_codec_outw(codec, IDX_IO_CODEC_DMA_FLAGS, flags1);13441344- spin_unlock(&chip->reg_lock);13451345- snd_azf3328_ctrl_codec_activity(chip, codec_type, 0);12961296+ spin_unlock(codec->lock);12971297+ snd_azf3328_ctrl_codec_activity(chip, codec->type, 0);1346129813471347- if (is_playback_codec) {12991299+ if (is_main_mixer_playback_codec) {13481300 /* now unmute WaveOut */13491301 if (!previously_muted)13501302 snd_azf3328_mixer_set_mute(···13781330 return result;13791331}1380133213811381-static int13821382-snd_azf3328_codec_playback_trigger(struct snd_pcm_substream *substream, int cmd)13831383-{13841384- return snd_azf3328_codec_trigger(AZF_CODEC_PLAYBACK, substream, cmd);13851385-}13861386-13871387-static int13881388-snd_azf3328_codec_capture_trigger(struct snd_pcm_substream *substream, int cmd)13891389-{13901390- return snd_azf3328_codec_trigger(AZF_CODEC_CAPTURE, substream, cmd);13911391-}13921392-13931393-static int13941394-snd_azf3328_codec_i2s_out_trigger(struct snd_pcm_substream *substream, int cmd)13951395-{13961396- return snd_azf3328_codec_trigger(AZF_CODEC_I2S_OUT, substream, cmd);13971397-}13981398-13991333static snd_pcm_uframes_t14001400-snd_azf3328_codec_pointer(struct snd_pcm_substream *substream,14011401- enum snd_azf3328_codec_type codec_type13341334+snd_azf3328_pcm_pointer(struct snd_pcm_substream *substream14021335)14031336{14041404- const struct snd_azf3328 *chip = snd_pcm_substream_chip(substream);14051405- const struct snd_azf3328_codec_data *codec = &chip->codecs[codec_type];14061406- unsigned long bufptr, result;13371337+ const struct snd_azf3328_codec_data *codec =13381338+ substream->runtime->private_data;13391339+ unsigned long result;14071340 snd_pcm_uframes_t frmres;1408134114091409-#ifdef QUERY_HARDWARE14101410- bufptr = snd_azf3328_codec_inl(codec, IDX_IO_CODEC_DMA_START_1);14111411-#else14121412- bufptr = substream->runtime->dma_addr;14131413-#endif14141342 result = snd_azf3328_codec_inl(codec, IDX_IO_CODEC_DMA_CURRPOS);1415134314161344 /* calculate offset */14171417- result -= bufptr;13451345+#ifdef QUERY_HARDWARE13461346+ result -= snd_azf3328_codec_inl(codec, IDX_IO_CODEC_DMA_START_1);13471347+#else13481348+ result -= codec->dma_base;13491349+#endif14181350 frmres = bytes_to_frames( substream->runtime, result);14191419- snd_azf3328_dbgcodec("%s @ 0x%8lx, frames %8ld\n",14201420- codec->name, result, frmres);13511351+ snd_azf3328_dbgcodec("%08li %s @ 0x%8lx, frames %8ld\n",13521352+ jiffies, codec->name, result, frmres);14211353 return frmres;14221422-}14231423-14241424-static snd_pcm_uframes_t14251425-snd_azf3328_codec_playback_pointer(struct snd_pcm_substream *substream)14261426-{14271427- return snd_azf3328_codec_pointer(substream, AZF_CODEC_PLAYBACK);14281428-}14291429-14301430-static snd_pcm_uframes_t14311431-snd_azf3328_codec_capture_pointer(struct snd_pcm_substream *substream)14321432-{14331433- return snd_azf3328_codec_pointer(substream, AZF_CODEC_CAPTURE);14341434-}14351435-14361436-static snd_pcm_uframes_t14371437-snd_azf3328_codec_i2s_out_pointer(struct snd_pcm_substream *substream)14381438-{14391439- return snd_azf3328_codec_pointer(substream, AZF_CODEC_I2S_OUT);14401354}1441135514421356/******************************************************************/···15421532 }15431533 }1544153415451545- /* trigger next axes sampling, to be evaluated the next time we15351535+ /* trigger next sampling of axes, to be evaluated the next time we15461536 * enter this function */1547153715481538 /* for some very, very strange reason we cannot enable···16341624}1635162516361626static inline void16371637-snd_azf3328_codec_interrupt(struct snd_azf3328 *chip, u8 status)16271627+snd_azf3328_pcm_interrupt(const struct snd_azf3328_codec_data *first_codec,16281628+ u8 status16291629+)16381630{16391631 u8 which;16401632 enum snd_azf3328_codec_type codec_type;16411641- const struct snd_azf3328_codec_data *codec;16331633+ const struct snd_azf3328_codec_data *codec = first_codec;1642163416431635 for (codec_type = AZF_CODEC_PLAYBACK;16441636 codec_type <= AZF_CODEC_I2S_OUT;16451645- ++codec_type) {16371637+ ++codec_type, ++codec) {1646163816471639 /* skip codec if there's no interrupt for it */16481640 if (!(status & (1 << codec_type)))16491641 continue;1650164216511651- codec = &chip->codecs[codec_type];16521652-16531653- spin_lock(&chip->reg_lock);16431643+ spin_lock(codec->lock);16541644 which = snd_azf3328_codec_inb(codec, IDX_IO_CODEC_IRQTYPE);16551645 /* ack all IRQ types immediately */16561646 snd_azf3328_codec_outb(codec, IDX_IO_CODEC_IRQTYPE, which);16571657- spin_unlock(&chip->reg_lock);16471647+ spin_unlock(codec->lock);1658164816591659- if ((chip->pcm[codec_type]) && (codec->substream)) {16491649+ if (codec->substream) {16601650 snd_pcm_period_elapsed(codec->substream);16611651 snd_azf3328_dbgcodec("%s period done (#%x), @ %x\n",16621652 codec->name,···17111701 }1712170217131703 if (status & (IRQ_PLAYBACK|IRQ_RECORDING|IRQ_I2S_OUT))17141714- snd_azf3328_codec_interrupt(chip, status);17041704+ snd_azf3328_pcm_interrupt(chip->codecs, status);1715170517161706 if (status & IRQ_GAMEPORT)17171707 snd_azf3328_gameport_interrupt(chip);···17991789{18001790 struct snd_azf3328 *chip = snd_pcm_substream_chip(substream);18011791 struct snd_pcm_runtime *runtime = substream->runtime;17921792+ struct snd_azf3328_codec_data *codec = &chip->codecs[codec_type];1802179318031794 snd_azf3328_dbgcallenter();18041804- chip->codecs[codec_type].substream = substream;17951795+ codec->substream = substream;1805179618061797 /* same parameters for all our codecs - at least we think so... */18071798 runtime->hw = snd_azf3328_hardware;1808179918091800 snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_RATE,18101801 &snd_azf3328_hw_constraints_rates);18021802+ runtime->private_data = codec;18111803 snd_azf3328_dbgcallleave();18121804 return 0;18131805}1814180618151807static int18161816-snd_azf3328_playback_open(struct snd_pcm_substream *substream)18081808+snd_azf3328_pcm_playback_open(struct snd_pcm_substream *substream)18171809{18181810 return snd_azf3328_pcm_open(substream, AZF_CODEC_PLAYBACK);18191811}1820181218211813static int18221822-snd_azf3328_capture_open(struct snd_pcm_substream *substream)18141814+snd_azf3328_pcm_capture_open(struct snd_pcm_substream *substream)18231815{18241816 return snd_azf3328_pcm_open(substream, AZF_CODEC_CAPTURE);18251817}1826181818271819static int18281828-snd_azf3328_i2s_out_open(struct snd_pcm_substream *substream)18201820+snd_azf3328_pcm_i2s_out_open(struct snd_pcm_substream *substream)18291821{18301822 return snd_azf3328_pcm_open(substream, AZF_CODEC_I2S_OUT);18311823}1832182418331825static int18341834-snd_azf3328_pcm_close(struct snd_pcm_substream *substream,18351835- enum snd_azf3328_codec_type codec_type18261826+snd_azf3328_pcm_close(struct snd_pcm_substream *substream18361827)18371828{18381838- struct snd_azf3328 *chip = snd_pcm_substream_chip(substream);18291829+ struct snd_azf3328_codec_data *codec =18301830+ substream->runtime->private_data;1839183118401832 snd_azf3328_dbgcallenter();18411841- chip->codecs[codec_type].substream = NULL;18331833+ codec->substream = NULL;18421834 snd_azf3328_dbgcallleave();18431835 return 0;18441844-}18451845-18461846-static int18471847-snd_azf3328_playback_close(struct snd_pcm_substream *substream)18481848-{18491849- return snd_azf3328_pcm_close(substream, AZF_CODEC_PLAYBACK);18501850-}18511851-18521852-static int18531853-snd_azf3328_capture_close(struct snd_pcm_substream *substream)18541854-{18551855- return snd_azf3328_pcm_close(substream, AZF_CODEC_CAPTURE);18561856-}18571857-18581858-static int18591859-snd_azf3328_i2s_out_close(struct snd_pcm_substream *substream)18601860-{18611861- return snd_azf3328_pcm_close(substream, AZF_CODEC_I2S_OUT);18621836}1863183718641838/******************************************************************/1865183918661840static struct snd_pcm_ops snd_azf3328_playback_ops = {18671867- .open = snd_azf3328_playback_open,18681868- .close = snd_azf3328_playback_close,18411841+ .open = snd_azf3328_pcm_playback_open,18421842+ .close = snd_azf3328_pcm_close,18691843 .ioctl = snd_pcm_lib_ioctl,18701844 .hw_params = snd_azf3328_hw_params,18711845 .hw_free = snd_azf3328_hw_free,18721872- .prepare = snd_azf3328_codec_prepare,18731873- .trigger = snd_azf3328_codec_playback_trigger,18741874- .pointer = snd_azf3328_codec_playback_pointer18461846+ .prepare = snd_azf3328_pcm_prepare,18471847+ .trigger = snd_azf3328_pcm_trigger,18481848+ .pointer = snd_azf3328_pcm_pointer18751849};1876185018771851static struct snd_pcm_ops snd_azf3328_capture_ops = {18781878- .open = snd_azf3328_capture_open,18791879- .close = snd_azf3328_capture_close,18521852+ .open = snd_azf3328_pcm_capture_open,18531853+ .close = snd_azf3328_pcm_close,18801854 .ioctl = snd_pcm_lib_ioctl,18811855 .hw_params = snd_azf3328_hw_params,18821856 .hw_free = snd_azf3328_hw_free,18831883- .prepare = snd_azf3328_codec_prepare,18841884- .trigger = snd_azf3328_codec_capture_trigger,18851885- .pointer = snd_azf3328_codec_capture_pointer18571857+ .prepare = snd_azf3328_pcm_prepare,18581858+ .trigger = snd_azf3328_pcm_trigger,18591859+ .pointer = snd_azf3328_pcm_pointer18861860};1887186118881862static struct snd_pcm_ops snd_azf3328_i2s_out_ops = {18891889- .open = snd_azf3328_i2s_out_open,18901890- .close = snd_azf3328_i2s_out_close,18631863+ .open = snd_azf3328_pcm_i2s_out_open,18641864+ .close = snd_azf3328_pcm_close,18911865 .ioctl = snd_pcm_lib_ioctl,18921866 .hw_params = snd_azf3328_hw_params,18931867 .hw_free = snd_azf3328_hw_free,18941894- .prepare = snd_azf3328_codec_prepare,18951895- .trigger = snd_azf3328_codec_i2s_out_trigger,18961896- .pointer = snd_azf3328_codec_i2s_out_pointer18681868+ .prepare = snd_azf3328_pcm_prepare,18691869+ .trigger = snd_azf3328_pcm_trigger,18701870+ .pointer = snd_azf3328_pcm_pointer18971871};1898187218991873static int __devinit···19601966 snd_azf3328_dbgtimer("delay was too low (%d)!\n", delay);19611967 delay = 49; /* minimum time is 49 ticks */19621968 }19631963- snd_azf3328_dbgtimer("setting timer countdown value %d, add COUNTDOWN|IRQ\n", delay);19691969+ snd_azf3328_dbgtimer("setting timer countdown value %d\n", delay);19641970 delay |= TIMER_COUNTDOWN_ENABLE | TIMER_IRQ_ENABLE;19651971 spin_lock_irqsave(&chip->reg_lock, flags);19661972 snd_azf3328_ctrl_outl(chip, IDX_IO_TIMER_VALUE, delay);···21742180 };21752181 u8 dma_init;21762182 enum snd_azf3328_codec_type codec_type;21832183+ struct snd_azf3328_codec_data *codec_setup;2177218421782185 *rchip = NULL;21792186···22122217 chip->opl3_io = pci_resource_start(pci, 3);22132218 chip->mixer_io = pci_resource_start(pci, 4);2214221922152215- chip->codecs[AZF_CODEC_PLAYBACK].io_base =22162216- chip->ctrl_io + AZF_IO_OFFS_CODEC_PLAYBACK;22172217- chip->codecs[AZF_CODEC_PLAYBACK].name = "PLAYBACK";22182218- chip->codecs[AZF_CODEC_CAPTURE].io_base =22192219- chip->ctrl_io + AZF_IO_OFFS_CODEC_CAPTURE;22202220- chip->codecs[AZF_CODEC_CAPTURE].name = "CAPTURE";22212221- chip->codecs[AZF_CODEC_I2S_OUT].io_base =22222222- chip->ctrl_io + AZF_IO_OFFS_CODEC_I2S_OUT;22232223- chip->codecs[AZF_CODEC_I2S_OUT].name = "I2S_OUT";22202220+ codec_setup = &chip->codecs[AZF_CODEC_PLAYBACK];22212221+ codec_setup->io_base = chip->ctrl_io + AZF_IO_OFFS_CODEC_PLAYBACK;22222222+ codec_setup->lock = &chip->reg_lock;22232223+ codec_setup->type = AZF_CODEC_PLAYBACK;22242224+ codec_setup->name = "PLAYBACK";22252225+22262226+ codec_setup = &chip->codecs[AZF_CODEC_CAPTURE];22272227+ codec_setup->io_base = chip->ctrl_io + AZF_IO_OFFS_CODEC_CAPTURE;22282228+ codec_setup->lock = &chip->reg_lock;22292229+ codec_setup->type = AZF_CODEC_CAPTURE;22302230+ codec_setup->name = "CAPTURE";22312231+22322232+ codec_setup = &chip->codecs[AZF_CODEC_I2S_OUT];22332233+ codec_setup->io_base = chip->ctrl_io + AZF_IO_OFFS_CODEC_I2S_OUT;22342234+ codec_setup->lock = &chip->reg_lock;22352235+ codec_setup->type = AZF_CODEC_I2S_OUT;22362236+ codec_setup->name = "I2S_OUT";2224223722252238 if (request_irq(pci->irq, snd_azf3328_interrupt,22262239 IRQF_SHARED, card->shortname, chip)) {···22602257 struct snd_azf3328_codec_data *codec =22612258 &chip->codecs[codec_type];2262225922632263- /* shutdown codecs to save power */22602260+ /* shutdown codecs to reduce power / noise */22642261 /* have ...ctrl_codec_activity() act properly */22652262 codec->running = 1;22662263 snd_azf3328_ctrl_codec_activity(chip, codec_type, 0);2267226422682268- spin_lock_irq(&chip->reg_lock);22652265+ spin_lock_irq(codec->lock);22692266 snd_azf3328_codec_outb(codec, IDX_IO_CODEC_DMA_FLAGS,22702267 dma_init);22712271- spin_unlock_irq(&chip->reg_lock);22682268+ spin_unlock_irq(codec->lock);22722269 }2273227022742271 snd_card_set_dev(card, &pci->dev);···2422241924232420 snd_power_change_state(card, SNDRV_CTL_POWER_D3hot);2424242124222422+ /* same pcm object for playback/capture */24252423 snd_pcm_suspend_all(chip->pcm[AZF_CODEC_PLAYBACK]);24262424 snd_pcm_suspend_all(chip->pcm[AZF_CODEC_I2S_OUT]);24272425
···1085710857 return 0;1085810858}10859108591086010860+static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec,1086110861+ const struct auto_pin_cfg *cfg);1086210862+1086010863/* almost identical with ALC880 parser... */1086110864static int alc882_parse_auto_config(struct hda_codec *codec)1086210865{···1087710874 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);1087810875 if (err < 0)1087910876 return err;1088010880- err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);1087710877+ if (codec->vendor_id == 0x10ec0887)1087810878+ err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg);1087910879+ else1088010880+ err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);1088110881 if (err < 0)1088210882 return err;1088310883 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],···1704917043#define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c)17050170441705117045/* add playback controls from the parsed DAC table */1705217052-/* Based on ALC880 version. But ALC861VD has separate,1704617046+/* Based on ALC880 version. But ALC861VD and ALC887 have separate,1705317047 * different NIDs for mute/unmute switch and volume control */1705417048static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec,1705517049 const struct auto_pin_cfg *cfg)
···197197{198198 unsigned int count;199199200200- /* should not need more than 7.68 us (24 * 320 ns) */200200+ /* should not need more than 30.72 us (24 * 1.28 us) */201201 count = 10;202202 while ((oxygen_read8(chip, OXYGEN_SPI_CONTROL) & OXYGEN_SPI_BUSY)203203 && count > 0) {204204- udelay(1);204204+ udelay(4);205205 --count;206206 }207207
+44-27
sound/pci/oxygen/oxygen_lib.c
···202202 struct oxygen *chip = entry->private_data;203203 int i, j;204204205205- snd_iprintf(buffer, "CMI8788\n\n");205205+ switch (oxygen_read8(chip, OXYGEN_REVISION) & OXYGEN_PACKAGE_ID_MASK) {206206+ case OXYGEN_PACKAGE_ID_8786: i = '6'; break;207207+ case OXYGEN_PACKAGE_ID_8787: i = '7'; break;208208+ case OXYGEN_PACKAGE_ID_8788: i = '8'; break;209209+ default: i = '?'; break;210210+ }211211+ snd_iprintf(buffer, "CMI878%c:\n", i);206212 for (i = 0; i < OXYGEN_IO_SIZE; i += 0x10) {207213 snd_iprintf(buffer, "%02x:", i);208214 for (j = 0; j < 0x10; ++j)···218212 if (mutex_lock_interruptible(&chip->mutex) < 0)219213 return;220214 if (chip->has_ac97_0) {221221- snd_iprintf(buffer, "\nAC97\n");215215+ snd_iprintf(buffer, "\nAC97:\n");222216 for (i = 0; i < 0x80; i += 0x10) {223217 snd_iprintf(buffer, "%02x:", i);224218 for (j = 0; j < 0x10; j += 2)···228222 }229223 }230224 if (chip->has_ac97_1) {231231- snd_iprintf(buffer, "\nAC97 2\n");225225+ snd_iprintf(buffer, "\nAC97 2:\n");232226 for (i = 0; i < 0x80; i += 0x10) {233227 snd_iprintf(buffer, "%02x:", i);234228 for (j = 0; j < 0x10; j += 2)···238232 }239233 }240234 mutex_unlock(&chip->mutex);235235+ if (chip->model.dump_registers)236236+ chip->model.dump_registers(chip, buffer);241237}242238243239static void oxygen_proc_init(struct oxygen *chip)244240{245241 struct snd_info_entry *entry;246242247247- if (!snd_card_proc_new(chip->card, "cmi8788", &entry))243243+ if (!snd_card_proc_new(chip->card, "oxygen", &entry))248244 snd_info_set_text_ops(entry, chip, oxygen_proc_read);249245}250246#else···270262 */271263 subdevice = oxygen_read_eeprom(chip, 2);272264 /* use default ID if EEPROM is missing */273273- if (subdevice == 0xffff)265265+ if (subdevice == 0xffff && oxygen_read_eeprom(chip, 1) == 0xffff)274266 subdevice = 0x8788;275267 /*276268 * We use only the subsystem device ID for searching because it is···372364 (IEC958_AES1_CON_PCM_CODER << OXYGEN_SPDIF_CATEGORY_SHIFT);373365 chip->spdif_pcm_bits = chip->spdif_bits;374366375375- if (oxygen_read8(chip, OXYGEN_REVISION) & OXYGEN_REVISION_2)376376- chip->revision = 2;377377- else378378- chip->revision = 1;379379-380380- if (chip->revision == 1)367367+ if (!(oxygen_read8(chip, OXYGEN_REVISION) & OXYGEN_REVISION_2))381368 oxygen_set_bits8(chip, OXYGEN_MISC,382369 OXYGEN_MISC_PCI_MEM_W_1_CLOCK);383370···409406 (OXYGEN_FORMAT_16 << OXYGEN_MULTICH_FORMAT_SHIFT));410407 oxygen_write8(chip, OXYGEN_REC_CHANNELS, OXYGEN_REC_CHANNELS_2_2_2);411408 oxygen_write16(chip, OXYGEN_I2S_MULTICH_FORMAT,412412- OXYGEN_RATE_48000 | chip->model.dac_i2s_format |413413- OXYGEN_I2S_MCLK_256 | OXYGEN_I2S_BITS_16 |414414- OXYGEN_I2S_MASTER | OXYGEN_I2S_BCLK_64);409409+ OXYGEN_RATE_48000 |410410+ chip->model.dac_i2s_format |411411+ OXYGEN_I2S_MCLK(chip->model.dac_mclks) |412412+ OXYGEN_I2S_BITS_16 |413413+ OXYGEN_I2S_MASTER |414414+ OXYGEN_I2S_BCLK_64);415415 if (chip->model.device_config & CAPTURE_0_FROM_I2S_1)416416 oxygen_write16(chip, OXYGEN_I2S_A_FORMAT,417417- OXYGEN_RATE_48000 | chip->model.adc_i2s_format |418418- OXYGEN_I2S_MCLK_256 | OXYGEN_I2S_BITS_16 |419419- OXYGEN_I2S_MASTER | OXYGEN_I2S_BCLK_64);417417+ OXYGEN_RATE_48000 |418418+ chip->model.adc_i2s_format |419419+ OXYGEN_I2S_MCLK(chip->model.adc_mclks) |420420+ OXYGEN_I2S_BITS_16 |421421+ OXYGEN_I2S_MASTER |422422+ OXYGEN_I2S_BCLK_64);420423 else421424 oxygen_write16(chip, OXYGEN_I2S_A_FORMAT,422422- OXYGEN_I2S_MASTER | OXYGEN_I2S_MUTE_MCLK);425425+ OXYGEN_I2S_MASTER |426426+ OXYGEN_I2S_MUTE_MCLK);423427 if (chip->model.device_config & (CAPTURE_0_FROM_I2S_2 |424428 CAPTURE_2_FROM_I2S_2))425429 oxygen_write16(chip, OXYGEN_I2S_B_FORMAT,426426- OXYGEN_RATE_48000 | chip->model.adc_i2s_format |427427- OXYGEN_I2S_MCLK_256 | OXYGEN_I2S_BITS_16 |428428- OXYGEN_I2S_MASTER | OXYGEN_I2S_BCLK_64);430430+ OXYGEN_RATE_48000 |431431+ chip->model.adc_i2s_format |432432+ OXYGEN_I2S_MCLK(chip->model.adc_mclks) |433433+ OXYGEN_I2S_BITS_16 |434434+ OXYGEN_I2S_MASTER |435435+ OXYGEN_I2S_BCLK_64);429436 else430437 oxygen_write16(chip, OXYGEN_I2S_B_FORMAT,431431- OXYGEN_I2S_MASTER | OXYGEN_I2S_MUTE_MCLK);438438+ OXYGEN_I2S_MASTER |439439+ OXYGEN_I2S_MUTE_MCLK);432440 oxygen_write16(chip, OXYGEN_I2S_C_FORMAT,433433- OXYGEN_I2S_MASTER | OXYGEN_I2S_MUTE_MCLK);441441+ OXYGEN_I2S_MASTER |442442+ OXYGEN_I2S_MUTE_MCLK);434443 oxygen_clear_bits32(chip, OXYGEN_SPDIF_CONTROL,435444 OXYGEN_SPDIF_OUT_ENABLE |436445 OXYGEN_SPDIF_LOOPBACK);···572557 oxygen_shutdown(chip);573558 if (chip->irq >= 0)574559 free_irq(chip->irq, chip);575575- flush_scheduled_work();560560+ flush_work_sync(&chip->spdif_input_bits_work);561561+ flush_work_sync(&chip->gpio_work);576562 chip->model.cleanup(chip);577563 kfree(chip->model_data);578564 mutex_destroy(&chip->mutex);···664648665649 strcpy(card->driver, chip->model.chip);666650 strcpy(card->shortname, chip->model.shortname);667667- sprintf(card->longname, "%s (rev %u) at %#lx, irq %i",668668- chip->model.longname, chip->revision, chip->addr, chip->irq);651651+ sprintf(card->longname, "%s at %#lx, irq %i",652652+ chip->model.longname, chip->addr, chip->irq);669653 strcpy(card->mixername, chip->model.chip);670654 snd_component_add(card, chip->model.chip);671655···749733 spin_unlock_irq(&chip->reg_lock);750734751735 synchronize_irq(chip->irq);752752- flush_scheduled_work();736736+ flush_work_sync(&chip->spdif_input_bits_work);737737+ flush_work_sync(&chip->gpio_work);753738 chip->interrupt_mask = saved_interrupt_mask;754739755740 pci_disable_device(pci);
···16261626{16271627 struct wm8350_data *priv = snd_soc_codec_get_drvdata(codec);16281628 struct wm8350 *wm8350 = dev_get_platdata(codec->dev);16291629- int ret;1630162916311630 wm8350_clear_bits(wm8350, WM8350_JACK_DETECT,16321631 WM8350_JDL_ENA | WM8350_JDR_ENA);···16401641 priv->hpr.jack = NULL;16411642 priv->mic.jack = NULL;1642164316431643- /* cancel any work waiting to be queued. */16441644- ret = cancel_delayed_work(&codec->delayed_work);16451645-16461644 /* if there was any work waiting then we run it now and16471645 * wait for its completion */16481648- if (ret) {16491649- schedule_delayed_work(&codec->delayed_work, 0);16501650- flush_scheduled_work();16511651- }16461646+ flush_delayed_work_sync(&codec->delayed_work);1652164716531648 wm8350_set_bias_level(codec, SND_SOC_BIAS_OFF);16541649
+1-20
sound/soc/codecs/wm8753.c
···14761476 return 0;14771477}1478147814791479-/*14801480- * This function forces any delayed work to be queued and run.14811481- */14821482-static int run_delayed_work(struct delayed_work *dwork)14831483-{14841484- int ret;14851485-14861486- /* cancel any work waiting to be queued. */14871487- ret = cancel_delayed_work(dwork);14881488-14891489- /* if there was any work waiting then we run it now and14901490- * wait for it's completion */14911491- if (ret) {14921492- schedule_delayed_work(dwork, 0);14931493- flush_scheduled_work();14941494- }14951495- return ret;14961496-}14971497-14981479static int wm8753_probe(struct snd_soc_codec *codec)14991480{15001481 struct wm8753_priv *wm8753 = snd_soc_codec_get_drvdata(codec);···15251544/* power down chip */15261545static int wm8753_remove(struct snd_soc_codec *codec)15271546{15281528- run_delayed_work(&codec->delayed_work);15471547+ flush_delayed_work_sync(&codec->delayed_work);15291548 wm8753_set_bias_level(codec, SND_SOC_BIAS_OFF);1530154915311550 return 0;
+3-22
sound/soc/soc-core.c
···6767module_param(pmdown_time, int, 0);6868MODULE_PARM_DESC(pmdown_time, "DAPM stream powerdown time (msecs)");69697070-/*7171- * This function forces any delayed work to be queued and run.7272- */7373-static int run_delayed_work(struct delayed_work *dwork)7474-{7575- int ret;7676-7777- /* cancel any work waiting to be queued. */7878- ret = cancel_delayed_work(dwork);7979-8080- /* if there was any work waiting then we run it now and8181- * wait for it's completion */8282- if (ret) {8383- schedule_delayed_work(dwork, 0);8484- flush_scheduled_work();8585- }8686- return ret;8787-}8888-8970/* codec register dump */9071static ssize_t soc_codec_reg_show(struct snd_soc_codec *codec, char *buf)9172{···99710169981017 /* close any waiting streams and save state */9991018 for (i = 0; i < card->num_rtd; i++) {10001000- run_delayed_work(&card->rtd[i].delayed_work);10191019+ flush_delayed_work_sync(&card->rtd[i].delayed_work);10011020 card->rtd[i].codec->suspend_bias_level = card->rtd[i].codec->bias_level;10021021 }10031022···16701689 /* make sure any delayed work runs */16711690 for (i = 0; i < card->num_rtd; i++) {16721691 struct snd_soc_pcm_runtime *rtd = &card->rtd[i];16731673- run_delayed_work(&rtd->delayed_work);16921692+ flush_delayed_work_sync(&rtd->delayed_work);16741693 }1675169416761695 /* remove and free each DAI */···17011720 * now, we're shutting down so no imminent restart. */17021721 for (i = 0; i < card->num_rtd; i++) {17031722 struct snd_soc_pcm_runtime *rtd = &card->rtd[i];17041704- run_delayed_work(&rtd->delayed_work);17231723+ flush_delayed_work_sync(&rtd->delayed_work);17051724 }1706172517071726 snd_soc_dapm_shutdown(card);
+4-1
sound/usb/format.c
···7676 format = 1 << UAC_FORMAT_TYPE_I_PCM;7777 }7878 if (format & (1 << UAC_FORMAT_TYPE_I_PCM)) {7979- if (sample_width > sample_bytes * 8) {7979+ if (chip->usb_id == USB_ID(0x0582, 0x0016) /* Edirol SD-90 */ &&8080+ sample_width == 24 && sample_bytes == 2)8181+ sample_bytes = 3;8282+ else if (sample_width > sample_bytes * 8) {8083 snd_printk(KERN_INFO "%d:%u:%d : sample bitwidth %d in over sample bytes %d\n",8184 chip->dev->devnum, fp->iface, fp->altsetting,8285 sample_width, sample_bytes);