diff --git a/[refs] b/[refs] index ad38673dd67c..1e725d47ea6b 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: b7ef37d0e382298bcf7ba399ce67b044d9add23a +refs/heads/master: 8fed54aec8fa5bc6ebfee95454a2cb33101ad917 diff --git a/trunk/Documentation/sound/alsa/ALSA-Configuration.txt b/trunk/Documentation/sound/alsa/ALSA-Configuration.txt index d90d8ec2853d..4e4d0bc9816f 100644 --- a/trunk/Documentation/sound/alsa/ALSA-Configuration.txt +++ b/trunk/Documentation/sound/alsa/ALSA-Configuration.txt @@ -860,14 +860,8 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed. [Multiple options for each card instance] model - force the model name - position_fix - Fix DMA pointer - -1 = system default: choose appropriate one per controller - hardware - 0 = auto: falls back to LPIB when POSBUF doesn't work - 1 = use LPIB - 2 = POSBUF: use position buffer - 3 = VIACOMBO: VIA-specific workaround for capture - 4 = COMBO: use LPIB for playback, auto for capture stream + position_fix - Fix DMA pointer (0 = auto, 1 = use LPIB, 2 = POSBUF, + 3 = VIACOMBO, 4 = COMBO) probe_mask - Bitmask to probe codecs (default = -1, meaning all slots) When the bit 8 (0x100) is set, the lower 8 bits are used as the "fixed" codec slots; i.e. the driver probes the diff --git a/trunk/Documentation/sound/alsa/Channel-Mapping-API.txt b/trunk/Documentation/sound/alsa/Channel-Mapping-API.txt deleted file mode 100644 index 3c43d1a4ca0e..000000000000 --- a/trunk/Documentation/sound/alsa/Channel-Mapping-API.txt +++ /dev/null @@ -1,153 +0,0 @@ -ALSA PCM channel-mapping API -============================ - Takashi Iwai - -GENERAL -------- - -The channel mapping API allows user to query the possible channel maps -and the current channel map, also optionally to modify the channel map -of the current stream. - -A channel map is an array of position for each PCM channel. -Typically, a stereo PCM stream has a channel map of - { front_left, front_right } -while a 4.0 surround PCM stream has a channel map of - { front left, front right, rear left, rear right }. - -The problem, so far, was that we had no standard channel map -explicitly, and applications had no way to know which channel -corresponds to which (speaker) position. Thus, applications applied -wrong channels for 5.1 outputs, and you hear suddenly strange sound -from rear. Or, some devices secretly assume that center/LFE is the -third/fourth channels while others that C/LFE as 5th/6th channels. - -Also, some devices such as HDMI are configurable for different speaker -positions even with the same number of total channels. However, there -was no way to specify this because of lack of channel map -specification. These are the main motivations for the new channel -mapping API. - - -DESIGN ------- - -Actually, "the channel mapping API" doesn't introduce anything new in -the kernel/user-space ABI perspective. It uses only the existing -control element features. - -As a ground design, each PCM substream may contain a control element -providing the channel mapping information and configuration. This -element is specified by: - iface = SNDRV_CTL_ELEM_IFACE_PCM - name = "Playback Channel Map" or "Capture Channel Map" - device = the same device number for the assigned PCM substream - index = the same index number for the assigned PCM substream - -Note the name is different depending on the PCM substream direction. - -Each control element provides at least the TLV read operation and the -read operation. Optionally, the write operation can be provided to -allow user to change the channel map dynamically. - -* TLV - -The TLV operation gives the list of available channel -maps. A list item of a channel map is usually a TLV of - type data-bytes ch0 ch1 ch2... -where type is the TLV type value, the second argument is the total -bytes (not the numbers) of channel values, and the rest are the -position value for each channel. - -As a TLV type, either SNDRV_CTL_TLVT_CHMAP_FIXED, -SNDRV_CTL_TLV_CHMAP_VAR or SNDRV_CTL_TLVT_CHMAP_PAIRED can be used. -The _FIXED type is for a channel map with the fixed channel position -while the latter two are for flexible channel positions. _VAR type is -for a channel map where all channels are freely swappable and _PAIRED -type is where pair-wise channels are swappable. For example, when you -have {FL/FR/RL/RR} channel map, _PAIRED type would allow you to swap -only {RL/RR/FL/FR} while _VAR type would allow even swapping FL and -RR. - -These new TLV types are defined in sound/tlv.h. - -The available channel position values are defined in sound/asound.h, -here is a cut: - -/* channel positions */ -enum { - SNDRV_CHMAP_UNKNOWN = 0, - SNDRV_CHMAP_NA, /* N/A, silent */ - SNDRV_CHMAP_MONO, /* mono stream */ - /* this follows the alsa-lib mixer channel value + 3 */ - SNDRV_CHMAP_FL, /* front left */ - SNDRV_CHMAP_FR, /* front right */ - SNDRV_CHMAP_RL, /* rear left */ - SNDRV_CHMAP_RR, /* rear right */ - SNDRV_CHMAP_FC, /* front center */ - SNDRV_CHMAP_LFE, /* LFE */ - SNDRV_CHMAP_SL, /* side left */ - SNDRV_CHMAP_SR, /* side right */ - SNDRV_CHMAP_RC, /* rear center */ - /* new definitions */ - SNDRV_CHMAP_FLC, /* front left center */ - SNDRV_CHMAP_FRC, /* front right center */ - SNDRV_CHMAP_RLC, /* rear left center */ - SNDRV_CHMAP_RRC, /* rear right center */ - SNDRV_CHMAP_FLW, /* front left wide */ - SNDRV_CHMAP_FRW, /* front right wide */ - SNDRV_CHMAP_FLH, /* front left high */ - SNDRV_CHMAP_FCH, /* front center high */ - SNDRV_CHMAP_FRH, /* front right high */ - SNDRV_CHMAP_TC, /* top center */ - SNDRV_CHMAP_TFL, /* top front left */ - SNDRV_CHMAP_TFR, /* top front right */ - SNDRV_CHMAP_TFC, /* top front center */ - SNDRV_CHMAP_TRL, /* top rear left */ - SNDRV_CHMAP_TRR, /* top rear right */ - SNDRV_CHMAP_TRC, /* top rear center */ - SNDRV_CHMAP_LAST = SNDRV_CHMAP_TRC, -}; - -When a PCM stream can provide more than one channel map, you can -provide multiple channel maps in a TLV container type. The TLV data -to be returned will contain such as: - SNDRV_CTL_TLVT_CONTAINER 96 - SNDRV_CTL_TLVT_CHMAP_FIXED 4 SNDRV_CHMAP_FC - SNDRV_CTL_TLVT_CHMAP_FIXED 8 SNDRV_CHMAP_FL SNDRV_CHMAP_FR - SNDRV_CTL_TLVT_CHMAP_FIXED 16 NDRV_CHMAP_FL SNDRV_CHMAP_FR \ - SNDRV_CHMAP_RL SNDRV_CHMAP_RR - -The channel position is provided in LSB 16bits. The upper bits are -used for bit flags. - -#define SNDRV_CHMAP_POSITION_MASK 0xffff -#define SNDRV_CHMAP_PHASE_INVERSE (0x01 << 16) -#define SNDRV_CHMAP_DRIVER_SPEC (0x02 << 16) - -SNDRV_CHMAP_PHASE_INVERSE indicates the channel is phase inverted, -(thus summing left and right channels would result in almost silence). -Some digital mic devices have this. - -When SNDRV_CHMAP_DRIVER_SPEC is set, all the channel position values -don't follow the standard definition above but driver-specific. - -* READ OPERATION - -The control read operation is for providing the current channel map of -the given stream. The control element returns an integer array -containing the position of each channel. - -When this is performed before the number of the channel is specified -(i.e. hw_params is set), it should return all channels set to -UNKNOWN. - -* WRITE OPERATION - -The control write operation is optional, and only for devices that can -change the channel configuration on the fly, such as HDMI. User needs -to pass an integer value containing the valid channel positions for -all channels of the assigned PCM substream. - -This operation is allowed only at PCM PREPARED state. When called in -other states, it shall return an error. diff --git a/trunk/Documentation/sound/alsa/HD-Audio-Models.txt b/trunk/Documentation/sound/alsa/HD-Audio-Models.txt index 16dfe57f1731..a92bba816843 100644 --- a/trunk/Documentation/sound/alsa/HD-Audio-Models.txt +++ b/trunk/Documentation/sound/alsa/HD-Audio-Models.txt @@ -74,8 +74,7 @@ CMI9880 AD1882 / AD1882A ================ - 3stack 3-stack mode - 3stack-automute 3-stack with automute front HP (default) + 3stack 3-stack mode (default) 6stack 6-stack mode AD1884A / AD1883 / AD1984A / AD1984B diff --git a/trunk/arch/arm/plat-samsung/dma-ops.c b/trunk/arch/arm/plat-samsung/dma-ops.c index d088afa034e8..c38d75489240 100644 --- a/trunk/arch/arm/plat-samsung/dma-ops.c +++ b/trunk/arch/arm/plat-samsung/dma-ops.c @@ -91,8 +91,7 @@ static int samsung_dmadev_prepare(unsigned ch, break; case DMA_CYCLIC: desc = dmaengine_prep_dma_cyclic(chan, param->buf, - param->len, param->period, param->direction, - DMA_PREP_INTERRUPT | DMA_CTRL_ACK); + param->len, param->period, param->direction); break; default: dev_err(&chan->dev->device, "unsupported format\n"); diff --git a/trunk/include/linux/dmaengine.h b/trunk/include/linux/dmaengine.h index d3201e438d16..09da4e565297 100644 --- a/trunk/include/linux/dmaengine.h +++ b/trunk/include/linux/dmaengine.h @@ -653,8 +653,7 @@ static inline struct dma_async_tx_descriptor *dmaengine_prep_rio_sg( static inline struct dma_async_tx_descriptor *dmaengine_prep_dma_cyclic( struct dma_chan *chan, dma_addr_t buf_addr, size_t buf_len, - size_t period_len, enum dma_transfer_direction dir, - unsigned long flags) + size_t period_len, enum dma_transfer_direction dir) { return chan->device->device_prep_dma_cyclic(chan, buf_addr, buf_len, period_len, dir, flags, NULL); diff --git a/trunk/include/sound/ac97_codec.h b/trunk/include/sound/ac97_codec.h index 4458b87649ff..02cbb50225bb 100644 --- a/trunk/include/sound/ac97_codec.h +++ b/trunk/include/sound/ac97_codec.h @@ -422,7 +422,6 @@ */ struct snd_ac97; -struct snd_pcm_chmap; struct snd_ac97_build_ops { int (*build_3d) (struct snd_ac97 *ac97); @@ -529,8 +528,6 @@ struct snd_ac97 { struct delayed_work power_work; #endif struct device dev; - - struct snd_pcm_chmap *chmaps[2]; /* channel-maps (optional) */ }; #define to_ac97_t(d) container_of(d, struct snd_ac97, dev) diff --git a/trunk/include/sound/ad1816a.h b/trunk/include/sound/ad1816a.h index 2a89f0d71440..d010858c33c2 100644 --- a/trunk/include/sound/ad1816a.h +++ b/trunk/include/sound/ad1816a.h @@ -147,9 +147,6 @@ struct snd_ad1816a { unsigned int c_dma_size; struct snd_timer *timer; -#ifdef CONFIG_PM - unsigned short image[48]; -#endif }; @@ -168,15 +165,11 @@ struct snd_ad1816a { extern int snd_ad1816a_create(struct snd_card *card, unsigned long port, int irq, int dma1, int dma2, - struct snd_ad1816a *chip); + struct snd_ad1816a **chip); extern int snd_ad1816a_pcm(struct snd_ad1816a *chip, int device, struct snd_pcm **rpcm); extern int snd_ad1816a_mixer(struct snd_ad1816a *chip); extern int snd_ad1816a_timer(struct snd_ad1816a *chip, int device, struct snd_timer **rtimer); -#ifdef CONFIG_PM -extern void snd_ad1816a_suspend(struct snd_ad1816a *chip); -extern void snd_ad1816a_resume(struct snd_ad1816a *chip); -#endif #endif /* __SOUND_AD1816A_H */ diff --git a/trunk/include/sound/asound.h b/trunk/include/sound/asound.h index dfe7d441748c..0876a1e76aef 100644 --- a/trunk/include/sound/asound.h +++ b/trunk/include/sound/asound.h @@ -472,45 +472,6 @@ enum { SNDRV_PCM_TSTAMP_TYPE_LAST = SNDRV_PCM_TSTAMP_TYPE_MONOTONIC, }; -/* channel positions */ -enum { - SNDRV_CHMAP_UNKNOWN = 0, - SNDRV_CHMAP_NA, /* N/A, silent */ - SNDRV_CHMAP_MONO, /* mono stream */ - /* this follows the alsa-lib mixer channel value + 3 */ - SNDRV_CHMAP_FL, /* front left */ - SNDRV_CHMAP_FR, /* front right */ - SNDRV_CHMAP_RL, /* rear left */ - SNDRV_CHMAP_RR, /* rear right */ - SNDRV_CHMAP_FC, /* front center */ - SNDRV_CHMAP_LFE, /* LFE */ - SNDRV_CHMAP_SL, /* side left */ - SNDRV_CHMAP_SR, /* side right */ - SNDRV_CHMAP_RC, /* rear center */ - /* new definitions */ - SNDRV_CHMAP_FLC, /* front left center */ - SNDRV_CHMAP_FRC, /* front right center */ - SNDRV_CHMAP_RLC, /* rear left center */ - SNDRV_CHMAP_RRC, /* rear right center */ - SNDRV_CHMAP_FLW, /* front left wide */ - SNDRV_CHMAP_FRW, /* front right wide */ - SNDRV_CHMAP_FLH, /* front left high */ - SNDRV_CHMAP_FCH, /* front center high */ - SNDRV_CHMAP_FRH, /* front right high */ - SNDRV_CHMAP_TC, /* top center */ - SNDRV_CHMAP_TFL, /* top front left */ - SNDRV_CHMAP_TFR, /* top front right */ - SNDRV_CHMAP_TFC, /* top front center */ - SNDRV_CHMAP_TRL, /* top rear left */ - SNDRV_CHMAP_TRR, /* top rear right */ - SNDRV_CHMAP_TRC, /* top rear center */ - SNDRV_CHMAP_LAST = SNDRV_CHMAP_TRC, -}; - -#define SNDRV_CHMAP_POSITION_MASK 0xffff -#define SNDRV_CHMAP_PHASE_INVERSE (0x01 << 16) -#define SNDRV_CHMAP_DRIVER_SPEC (0x02 << 16) - #define SNDRV_PCM_IOCTL_PVERSION _IOR('A', 0x00, int) #define SNDRV_PCM_IOCTL_INFO _IOR('A', 0x01, struct snd_pcm_info) #define SNDRV_PCM_IOCTL_TSTAMP _IOW('A', 0x02, int) diff --git a/trunk/include/sound/compress_params.h b/trunk/include/sound/compress_params.h index 602dc6c45d1a..da4a456de032 100644 --- a/trunk/include/sound/compress_params.h +++ b/trunk/include/sound/compress_params.h @@ -72,7 +72,6 @@ #define SND_AUDIOCODEC_IEC61937 ((__u32) 0x0000000B) #define SND_AUDIOCODEC_G723_1 ((__u32) 0x0000000C) #define SND_AUDIOCODEC_G729 ((__u32) 0x0000000D) -#define SND_AUDIOCODEC_MAX SND_AUDIOCODEC_G729 /* * Profile and modes are listed with bit masks. This allows for a diff --git a/trunk/include/sound/emu10k1.h b/trunk/include/sound/emu10k1.h index 1a33f48ebe78..4f865df42f0f 100644 --- a/trunk/include/sound/emu10k1.h +++ b/trunk/include/sound/emu10k1.h @@ -1788,7 +1788,7 @@ struct snd_emu10k1 { unsigned int efx_voices_mask[2]; unsigned int next_free_voice; -#ifdef CONFIG_PM_SLEEP +#ifdef CONFIG_PM unsigned int *saved_ptr; unsigned int *saved_gpr; unsigned int *tram_val_saved; @@ -1856,7 +1856,7 @@ unsigned short snd_emu10k1_ac97_read(struct snd_ac97 *ac97, unsigned short reg); void snd_emu10k1_ac97_write(struct snd_ac97 *ac97, unsigned short reg, unsigned short data); unsigned int snd_emu10k1_rate_to_pitch(unsigned int rate); -#ifdef CONFIG_PM_SLEEP +#ifdef CONFIG_PM void snd_emu10k1_suspend_regs(struct snd_emu10k1 *emu); void snd_emu10k1_resume_init(struct snd_emu10k1 *emu); void snd_emu10k1_resume_regs(struct snd_emu10k1 *emu); diff --git a/trunk/include/sound/initval.h b/trunk/include/sound/initval.h index ac62c67e6f42..f99a0d2ddfe7 100644 --- a/trunk/include/sound/initval.h +++ b/trunk/include/sound/initval.h @@ -50,20 +50,6 @@ #define SNDRV_DEFAULT_DMA_SIZE { [0 ... (SNDRV_CARDS-1)] = SNDRV_AUTO_DMA_SIZE } #define SNDRV_DEFAULT_PTR SNDRV_DEFAULT_STR -#ifdef SNDRV_LEGACY_FIND_FREE_IOPORT -static long snd_legacy_find_free_ioport(long *port_table, long size) -{ - while (*port_table != -1) { - if (request_region(*port_table, size, "ALSA test")) { - release_region(*port_table, size); - return *port_table; - } - port_table++; - } - return -1; -} -#endif - #ifdef SNDRV_LEGACY_FIND_FREE_IRQ #include diff --git a/trunk/include/sound/memalloc.h b/trunk/include/sound/memalloc.h index 844af65af626..c42506212649 100644 --- a/trunk/include/sound/memalloc.h +++ b/trunk/include/sound/memalloc.h @@ -98,10 +98,8 @@ static inline unsigned int snd_sgbuf_aligned_pages(size_t size) /* * return the physical address at the corresponding offset */ -static inline dma_addr_t snd_sgbuf_get_addr(struct snd_dma_buffer *dmab, - size_t offset) +static inline dma_addr_t snd_sgbuf_get_addr(struct snd_sg_buf *sgbuf, size_t offset) { - struct snd_sg_buf *sgbuf = dmab->private_data; dma_addr_t addr = sgbuf->table[offset >> PAGE_SHIFT].addr; addr &= PAGE_MASK; return addr + offset % PAGE_SIZE; @@ -110,31 +108,10 @@ static inline dma_addr_t snd_sgbuf_get_addr(struct snd_dma_buffer *dmab, /* * return the virtual address at the corresponding offset */ -static inline void *snd_sgbuf_get_ptr(struct snd_dma_buffer *dmab, - size_t offset) +static inline void *snd_sgbuf_get_ptr(struct snd_sg_buf *sgbuf, size_t offset) { - struct snd_sg_buf *sgbuf = dmab->private_data; return sgbuf->table[offset >> PAGE_SHIFT].buf + offset % PAGE_SIZE; } - -unsigned int snd_sgbuf_get_chunk_size(struct snd_dma_buffer *dmab, - unsigned int ofs, unsigned int size); -#else -/* non-SG versions */ -static inline dma_addr_t snd_sgbuf_get_addr(struct snd_dma_buffer *dmab, - size_t offset) -{ - return dmab->addr + offset; -} - -static inline void *snd_sgbuf_get_ptr(struct snd_dma_buffer *dmab, - size_t offset) -{ - return dmab->area + offset; -} - -#define snd_sgbuf_get_chunk_size(dmab, ofs, size) (size) - #endif /* CONFIG_SND_DMA_SGBUF */ /* allocate/release a buffer */ diff --git a/trunk/include/sound/pcm.h b/trunk/include/sound/pcm.h index 7e4e4e380106..cdca2ab1e711 100644 --- a/trunk/include/sound/pcm.h +++ b/trunk/include/sound/pcm.h @@ -437,7 +437,6 @@ struct snd_pcm_str { struct snd_info_entry *proc_xrun_debug_entry; #endif #endif - struct snd_kcontrol *chmap_kctl; /* channel-mapping controls */ }; struct snd_pcm { @@ -983,42 +982,53 @@ static int snd_pcm_lib_alloc_vmalloc_32_buffer _snd_pcm_lib_alloc_vmalloc_buffer \ (subs, size, GFP_KERNEL | GFP_DMA32 | __GFP_ZERO) -#define snd_pcm_get_dma_buf(substream) ((substream)->runtime->dma_buffer_p) - #ifdef CONFIG_SND_DMA_SGBUF /* * SG-buffer handling */ #define snd_pcm_substream_sgbuf(substream) \ - snd_pcm_get_dma_buf(substream)->private_data + ((substream)->runtime->dma_buffer_p->private_data) + +static inline dma_addr_t +snd_pcm_sgbuf_get_addr(struct snd_pcm_substream *substream, unsigned int ofs) +{ + struct snd_sg_buf *sg = snd_pcm_substream_sgbuf(substream); + return snd_sgbuf_get_addr(sg, ofs); +} + +static inline void * +snd_pcm_sgbuf_get_ptr(struct snd_pcm_substream *substream, unsigned int ofs) +{ + struct snd_sg_buf *sg = snd_pcm_substream_sgbuf(substream); + return snd_sgbuf_get_ptr(sg, ofs); +} struct page *snd_pcm_sgbuf_ops_page(struct snd_pcm_substream *substream, unsigned long offset); +unsigned int snd_pcm_sgbuf_get_chunk_size(struct snd_pcm_substream *substream, + unsigned int ofs, unsigned int size); + #else /* !SND_DMA_SGBUF */ /* * fake using a continuous buffer */ -#define snd_pcm_sgbuf_ops_page NULL -#endif /* SND_DMA_SGBUF */ - static inline dma_addr_t snd_pcm_sgbuf_get_addr(struct snd_pcm_substream *substream, unsigned int ofs) { - return snd_sgbuf_get_addr(snd_pcm_get_dma_buf(substream), ofs); + return substream->runtime->dma_addr + ofs; } static inline void * snd_pcm_sgbuf_get_ptr(struct snd_pcm_substream *substream, unsigned int ofs) { - return snd_sgbuf_get_ptr(snd_pcm_get_dma_buf(substream), ofs); + return substream->runtime->dma_area + ofs; } -static inline unsigned int -snd_pcm_sgbuf_get_chunk_size(struct snd_pcm_substream *substream, - unsigned int ofs, unsigned int size) -{ - return snd_sgbuf_get_chunk_size(snd_pcm_get_dma_buf(substream), ofs, size); -} +#define snd_pcm_sgbuf_ops_page NULL + +#define snd_pcm_sgbuf_get_chunk_size(subs, ofs, size) (size) + +#endif /* SND_DMA_SGBUF */ /* handle mmap counter - PCM mmap callback should handle this counter properly */ static inline void snd_pcm_mmap_data_open(struct vm_area_struct *area) @@ -1076,51 +1086,4 @@ static inline const char *snd_pcm_stream_str(struct snd_pcm_substream *substream return "Capture"; } -/* - * PCM channel-mapping control API - */ -/* array element of channel maps */ -struct snd_pcm_chmap_elem { - unsigned char channels; - unsigned char map[15]; -}; - -/* channel map information; retrieved via snd_kcontrol_chip() */ -struct snd_pcm_chmap { - struct snd_pcm *pcm; /* assigned PCM instance */ - int stream; /* PLAYBACK or CAPTURE */ - struct snd_kcontrol *kctl; - const struct snd_pcm_chmap_elem *chmap; - unsigned int max_channels; - unsigned int channel_mask; /* optional: active channels bitmask */ - void *private_data; /* optional: private data pointer */ -}; - -/* get the PCM substream assigned to the given chmap info */ -static inline struct snd_pcm_substream * -snd_pcm_chmap_substream(struct snd_pcm_chmap *info, unsigned int idx) -{ - struct snd_pcm_substream *s; - for (s = info->pcm->streams[info->stream].substream; s; s = s->next) - if (s->number == idx) - return s; - return NULL; -} - -/* ALSA-standard channel maps (RL/RR prior to C/LFE) */ -extern const struct snd_pcm_chmap_elem snd_pcm_std_chmaps[]; -/* Other world's standard channel maps (C/LFE prior to RL/RR) */ -extern const struct snd_pcm_chmap_elem snd_pcm_alt_chmaps[]; - -/* bit masks to be passed to snd_pcm_chmap.channel_mask field */ -#define SND_PCM_CHMAP_MASK_24 ((1U << 2) | (1U << 4)) -#define SND_PCM_CHMAP_MASK_246 (SND_PCM_CHMAP_MASK_24 | (1U << 6)) -#define SND_PCM_CHMAP_MASK_2468 (SND_PCM_CHMAP_MASK_246 | (1U << 8)) - -int snd_pcm_add_chmap_ctls(struct snd_pcm *pcm, int stream, - const struct snd_pcm_chmap_elem *chmap, - int max_channels, - unsigned long private_value, - struct snd_pcm_chmap **info_ret); - #endif /* __SOUND_PCM_H */ diff --git a/trunk/include/sound/tlv.h b/trunk/include/sound/tlv.h index 28c65e1ada21..a64d8fe3f855 100644 --- a/trunk/include/sound/tlv.h +++ b/trunk/include/sound/tlv.h @@ -86,12 +86,4 @@ #define TLV_DB_GAIN_MUTE -9999999 -/* - * channel-mapping TLV items - * TLV length must match with num_channels - */ -#define SNDRV_CTL_TLVT_CHMAP_FIXED 0x101 /* fixed channel position */ -#define SNDRV_CTL_TLVT_CHMAP_VAR 0x102 /* channels freely swappable */ -#define SNDRV_CTL_TLVT_CHMAP_PAIRED 0x103 /* pair-wise swappable */ - #endif /* __SOUND_TLV_H */ diff --git a/trunk/include/sound/version.h b/trunk/include/sound/version.h new file mode 100644 index 000000000000..cc75024c1089 --- /dev/null +++ b/trunk/include/sound/version.h @@ -0,0 +1,3 @@ +/* include/version.h */ +#define CONFIG_SND_VERSION "1.0.25" +#define CONFIG_SND_DATE "" diff --git a/trunk/sound/core/compress_offload.c b/trunk/sound/core/compress_offload.c index c40ae573346d..eb60cb8dbb8a 100644 --- a/trunk/sound/core/compress_offload.c +++ b/trunk/sound/core/compress_offload.c @@ -425,26 +425,6 @@ static int snd_compr_allocate_buffer(struct snd_compr_stream *stream, return 0; } -static int snd_compress_check_input(struct snd_compr_params *params) -{ - /* first let's check the buffer parameter's */ - if (params->buffer.fragment_size == 0 || - params->buffer.fragments > SIZE_MAX / params->buffer.fragment_size) - return -EINVAL; - - /* now codec parameters */ - if (params->codec.id == 0 || params->codec.id > SND_AUDIOCODEC_MAX) - return -EINVAL; - - if (params->codec.ch_in == 0 || params->codec.ch_out == 0) - return -EINVAL; - - if (!(params->codec.sample_rate & SNDRV_PCM_RATE_8000_192000)) - return -EINVAL; - - return 0; -} - static int snd_compr_set_params(struct snd_compr_stream *stream, unsigned long arg) { @@ -463,17 +443,11 @@ snd_compr_set_params(struct snd_compr_stream *stream, unsigned long arg) retval = -EFAULT; goto out; } - - retval = snd_compress_check_input(params); - if (retval) - goto out; - retval = snd_compr_allocate_buffer(stream, params); if (retval) { retval = -ENOMEM; goto out; } - retval = stream->ops->set_params(stream, params); if (retval) goto out; diff --git a/trunk/sound/core/control.c b/trunk/sound/core/control.c index 7e86a5b9f3b5..2487a6bb1c54 100644 --- a/trunk/sound/core/control.c +++ b/trunk/sound/core/control.c @@ -246,7 +246,6 @@ struct snd_kcontrol *snd_ctl_new1(const struct snd_kcontrol_new *ncontrol, kctl.count = ncontrol->count ? ncontrol->count : 1; access = ncontrol->access == 0 ? SNDRV_CTL_ELEM_ACCESS_READWRITE : (ncontrol->access & (SNDRV_CTL_ELEM_ACCESS_READWRITE| - SNDRV_CTL_ELEM_ACCESS_VOLATILE| SNDRV_CTL_ELEM_ACCESS_INACTIVE| SNDRV_CTL_ELEM_ACCESS_TLV_READWRITE| SNDRV_CTL_ELEM_ACCESS_TLV_COMMAND| diff --git a/trunk/sound/core/info.c b/trunk/sound/core/info.c index 6b368d25073b..c1e611c65c8f 100644 --- a/trunk/sound/core/info.c +++ b/trunk/sound/core/info.c @@ -28,7 +28,7 @@ #include #include #include -#include +#include #include #include #include @@ -986,8 +986,9 @@ static struct snd_info_entry *snd_info_version_entry; static void snd_info_version_read(struct snd_info_entry *entry, struct snd_info_buffer *buffer) { snd_iprintf(buffer, - "Advanced Linux Sound Architecture Driver Version k%s.\n", - init_utsname()->release); + "Advanced Linux Sound Architecture Driver Version " + CONFIG_SND_VERSION CONFIG_SND_DATE ".\n" + ); } static int __init snd_info_version_init(void) diff --git a/trunk/sound/core/info_oss.c b/trunk/sound/core/info_oss.c index 83c29dbff9c0..cf42ab5080eb 100644 --- a/trunk/sound/core/info_oss.c +++ b/trunk/sound/core/info_oss.c @@ -26,6 +26,7 @@ #include #include #include +#include #include #include @@ -93,7 +94,7 @@ static int snd_sndstat_show_strings(struct snd_info_buffer *buf, char *id, int d static void snd_sndstat_proc_read(struct snd_info_entry *entry, struct snd_info_buffer *buffer) { - snd_iprintf(buffer, "Sound Driver:3.8.1a-980706 (ALSA emulation code)\n"); + snd_iprintf(buffer, "Sound Driver:3.8.1a-980706 (ALSA v" CONFIG_SND_VERSION " emulation code)\n"); snd_iprintf(buffer, "Kernel: %s %s %s %s %s\n", init_utsname()->sysname, init_utsname()->nodename, diff --git a/trunk/sound/core/oss/mixer_oss.c b/trunk/sound/core/oss/mixer_oss.c index 29f6ded02555..18297f7f2c55 100644 --- a/trunk/sound/core/oss/mixer_oss.c +++ b/trunk/sound/core/oss/mixer_oss.c @@ -1046,7 +1046,6 @@ static int snd_mixer_oss_build_input(struct snd_mixer_oss *mixer, struct snd_mix if (kctl->info(kctl, uinfo)) { up_read(&mixer->card->controls_rwsem); - kfree(uinfo); return 0; } strcpy(str, ptr->name); @@ -1062,7 +1061,6 @@ static int snd_mixer_oss_build_input(struct snd_mixer_oss *mixer, struct snd_mix uinfo->value.enumerated.item = slot.capture_item; if (kctl->info(kctl, uinfo)) { up_read(&mixer->card->controls_rwsem); - kfree(uinfo); return 0; } if (!strcmp(uinfo->value.enumerated.name, str)) { diff --git a/trunk/sound/core/pcm.c b/trunk/sound/core/pcm.c index f2991940b271..1a3070b4e5b5 100644 --- a/trunk/sound/core/pcm.c +++ b/trunk/sound/core/pcm.c @@ -1105,10 +1105,6 @@ static int snd_pcm_dev_disconnect(struct snd_device *device) break; } snd_unregister_device(devtype, pcm->card, pcm->device); - if (pcm->streams[cidx].chmap_kctl) { - snd_ctl_remove(pcm->card, pcm->streams[cidx].chmap_kctl); - pcm->streams[cidx].chmap_kctl = NULL; - } } unlock: mutex_unlock(®ister_mutex); diff --git a/trunk/sound/core/pcm_lib.c b/trunk/sound/core/pcm_lib.c index f42c10a43315..7ae671923393 100644 --- a/trunk/sound/core/pcm_lib.c +++ b/trunk/sound/core/pcm_lib.c @@ -26,7 +26,6 @@ #include #include #include -#include #include #include #include @@ -2303,216 +2302,3 @@ snd_pcm_sframes_t snd_pcm_lib_readv(struct snd_pcm_substream *substream, } EXPORT_SYMBOL(snd_pcm_lib_readv); - -/* - * standard channel mapping helpers - */ - -/* default channel maps for multi-channel playbacks, up to 8 channels */ -const struct snd_pcm_chmap_elem snd_pcm_std_chmaps[] = { - { .channels = 1, - .map = { SNDRV_CHMAP_MONO } }, - { .channels = 2, - .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR } }, - { .channels = 4, - .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, - SNDRV_CHMAP_RL, SNDRV_CHMAP_RR } }, - { .channels = 6, - .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, - SNDRV_CHMAP_RL, SNDRV_CHMAP_RR, - SNDRV_CHMAP_FC, SNDRV_CHMAP_LFE } }, - { .channels = 8, - .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, - SNDRV_CHMAP_RL, SNDRV_CHMAP_RR, - SNDRV_CHMAP_FC, SNDRV_CHMAP_LFE, - SNDRV_CHMAP_SL, SNDRV_CHMAP_SR } }, - { } -}; -EXPORT_SYMBOL_GPL(snd_pcm_std_chmaps); - -/* alternative channel maps with CLFE <-> surround swapped for 6/8 channels */ -const struct snd_pcm_chmap_elem snd_pcm_alt_chmaps[] = { - { .channels = 1, - .map = { SNDRV_CHMAP_MONO } }, - { .channels = 2, - .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR } }, - { .channels = 4, - .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, - SNDRV_CHMAP_RL, SNDRV_CHMAP_RR } }, - { .channels = 6, - .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, - SNDRV_CHMAP_FC, SNDRV_CHMAP_LFE, - SNDRV_CHMAP_RL, SNDRV_CHMAP_RR } }, - { .channels = 8, - .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, - SNDRV_CHMAP_FC, SNDRV_CHMAP_LFE, - SNDRV_CHMAP_RL, SNDRV_CHMAP_RR, - SNDRV_CHMAP_SL, SNDRV_CHMAP_SR } }, - { } -}; -EXPORT_SYMBOL_GPL(snd_pcm_alt_chmaps); - -static bool valid_chmap_channels(const struct snd_pcm_chmap *info, int ch) -{ - if (ch > info->max_channels) - return false; - return !info->channel_mask || (info->channel_mask & (1U << ch)); -} - -static int pcm_chmap_ctl_info(struct snd_kcontrol *kcontrol, - struct snd_ctl_elem_info *uinfo) -{ - struct snd_pcm_chmap *info = snd_kcontrol_chip(kcontrol); - - uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; - uinfo->count = 0; - uinfo->count = info->max_channels; - uinfo->value.integer.min = 0; - uinfo->value.integer.max = SNDRV_CHMAP_LAST; - return 0; -} - -/* get callback for channel map ctl element - * stores the channel position firstly matching with the current channels - */ -static int pcm_chmap_ctl_get(struct snd_kcontrol *kcontrol, - struct snd_ctl_elem_value *ucontrol) -{ - struct snd_pcm_chmap *info = snd_kcontrol_chip(kcontrol); - unsigned int idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); - struct snd_pcm_substream *substream; - const struct snd_pcm_chmap_elem *map; - - if (snd_BUG_ON(!info->chmap)) - return -EINVAL; - substream = snd_pcm_chmap_substream(info, idx); - if (!substream) - return -ENODEV; - memset(ucontrol->value.integer.value, 0, - sizeof(ucontrol->value.integer.value)); - if (!substream->runtime) - return 0; /* no channels set */ - for (map = info->chmap; map->channels; map++) { - int i; - if (map->channels == substream->runtime->channels && - valid_chmap_channels(info, map->channels)) { - for (i = 0; i < map->channels; i++) - ucontrol->value.integer.value[i] = map->map[i]; - return 0; - } - } - return -EINVAL; -} - -/* tlv callback for channel map ctl element - * expands the pre-defined channel maps in a form of TLV - */ -static int pcm_chmap_ctl_tlv(struct snd_kcontrol *kcontrol, int op_flag, - unsigned int size, unsigned int __user *tlv) -{ - struct snd_pcm_chmap *info = snd_kcontrol_chip(kcontrol); - const struct snd_pcm_chmap_elem *map; - unsigned int __user *dst; - int c, count = 0; - - if (snd_BUG_ON(!info->chmap)) - return -EINVAL; - if (size < 8) - return -ENOMEM; - if (put_user(SNDRV_CTL_TLVT_CONTAINER, tlv)) - return -EFAULT; - size -= 8; - dst = tlv + 2; - for (map = info->chmap; map->channels; map++) { - int chs_bytes = map->channels * 4; - if (!valid_chmap_channels(info, map->channels)) - continue; - if (size < 8) - return -ENOMEM; - if (put_user(SNDRV_CTL_TLVT_CHMAP_FIXED, dst) || - put_user(chs_bytes, dst + 1)) - return -EFAULT; - dst += 2; - size -= 8; - count += 8; - if (size < chs_bytes) - return -ENOMEM; - size -= chs_bytes; - count += chs_bytes; - for (c = 0; c < map->channels; c++) { - if (put_user(map->map[c], dst)) - return -EFAULT; - dst++; - } - } - if (put_user(count, tlv + 1)) - return -EFAULT; - return 0; -} - -static void pcm_chmap_ctl_private_free(struct snd_kcontrol *kcontrol) -{ - struct snd_pcm_chmap *info = snd_kcontrol_chip(kcontrol); - info->pcm->streams[info->stream].chmap_kctl = NULL; - kfree(info); -} - -/** - * snd_pcm_add_chmap_ctls - create channel-mapping control elements - * @pcm: the assigned PCM instance - * @stream: stream direction - * @chmap: channel map elements (for query) - * @max_channels: the max number of channels for the stream - * @private_value: the value passed to each kcontrol's private_value field - * @info_ret: store struct snd_pcm_chmap instance if non-NULL - * - * Create channel-mapping control elements assigned to the given PCM stream(s). - * Returns zero if succeed, or a negative error value. - */ -int snd_pcm_add_chmap_ctls(struct snd_pcm *pcm, int stream, - const struct snd_pcm_chmap_elem *chmap, - int max_channels, - unsigned long private_value, - struct snd_pcm_chmap **info_ret) -{ - struct snd_pcm_chmap *info; - struct snd_kcontrol_new knew = { - .iface = SNDRV_CTL_ELEM_IFACE_PCM, - .access = SNDRV_CTL_ELEM_ACCESS_READ | - SNDRV_CTL_ELEM_ACCESS_TLV_READ | - SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK, - .info = pcm_chmap_ctl_info, - .get = pcm_chmap_ctl_get, - .tlv.c = pcm_chmap_ctl_tlv, - }; - int err; - - info = kzalloc(sizeof(*info), GFP_KERNEL); - if (!info) - return -ENOMEM; - info->pcm = pcm; - info->stream = stream; - info->chmap = chmap; - info->max_channels = max_channels; - if (stream == SNDRV_PCM_STREAM_PLAYBACK) - knew.name = "Playback Channel Map"; - else - knew.name = "Capture Channel Map"; - knew.device = pcm->device; - knew.count = pcm->streams[stream].substream_count; - knew.private_value = private_value; - info->kctl = snd_ctl_new1(&knew, info); - if (!info->kctl) { - kfree(info); - return -ENOMEM; - } - info->kctl->private_free = pcm_chmap_ctl_private_free; - err = snd_ctl_add(pcm->card, info->kctl); - if (err < 0) - return err; - pcm->streams[stream].chmap_kctl = info->kctl; - if (info_ret) - *info_ret = info; - return 0; -} -EXPORT_SYMBOL_GPL(snd_pcm_add_chmap_ctls); diff --git a/trunk/sound/core/pcm_memory.c b/trunk/sound/core/pcm_memory.c index 69e01c4fc32d..957131366dd9 100644 --- a/trunk/sound/core/pcm_memory.c +++ b/trunk/sound/core/pcm_memory.c @@ -327,6 +327,32 @@ struct page *snd_pcm_sgbuf_ops_page(struct snd_pcm_substream *substream, unsigne } EXPORT_SYMBOL(snd_pcm_sgbuf_ops_page); + +/* + * compute the max chunk size with continuous pages on sg-buffer + */ +unsigned int snd_pcm_sgbuf_get_chunk_size(struct snd_pcm_substream *substream, + unsigned int ofs, unsigned int size) +{ + struct snd_sg_buf *sg = snd_pcm_substream_sgbuf(substream); + unsigned int start, end, pg; + + start = ofs >> PAGE_SHIFT; + end = (ofs + size - 1) >> PAGE_SHIFT; + /* check page continuity */ + pg = sg->table[start].addr >> PAGE_SHIFT; + for (;;) { + start++; + if (start > end) + break; + pg++; + if ((sg->table[start].addr >> PAGE_SHIFT) != pg) + return (start << PAGE_SHIFT) - ofs; + } + /* ok, all on continuous pages */ + return size; +} +EXPORT_SYMBOL(snd_pcm_sgbuf_get_chunk_size); #endif /* CONFIG_SND_DMA_SGBUF */ /** diff --git a/trunk/sound/core/seq/seq_device.c b/trunk/sound/core/seq/seq_device.c index 60e8fc1b3440..5cf8d65ed5ef 100644 --- a/trunk/sound/core/seq/seq_device.c +++ b/trunk/sound/core/seq/seq_device.c @@ -569,7 +569,5 @@ EXPORT_SYMBOL(snd_seq_device_load_drivers); EXPORT_SYMBOL(snd_seq_device_new); EXPORT_SYMBOL(snd_seq_device_register_driver); EXPORT_SYMBOL(snd_seq_device_unregister_driver); -#ifdef CONFIG_MODULES EXPORT_SYMBOL(snd_seq_autoload_lock); EXPORT_SYMBOL(snd_seq_autoload_unlock); -#endif diff --git a/trunk/sound/core/sgbuf.c b/trunk/sound/core/sgbuf.c index 0a418503ec41..d0f00356fc11 100644 --- a/trunk/sound/core/sgbuf.c +++ b/trunk/sound/core/sgbuf.c @@ -22,7 +22,6 @@ #include #include #include -#include #include @@ -137,29 +136,3 @@ void *snd_malloc_sgbuf_pages(struct device *device, snd_free_sgbuf_pages(dmab); /* free the table */ return NULL; } - -/* - * compute the max chunk size with continuous pages on sg-buffer - */ -unsigned int snd_sgbuf_get_chunk_size(struct snd_dma_buffer *dmab, - unsigned int ofs, unsigned int size) -{ - struct snd_sg_buf *sg = dmab->private_data; - unsigned int start, end, pg; - - start = ofs >> PAGE_SHIFT; - end = (ofs + size - 1) >> PAGE_SHIFT; - /* check page continuity */ - pg = sg->table[start].addr >> PAGE_SHIFT; - for (;;) { - start++; - if (start > end) - break; - pg++; - if ((sg->table[start].addr >> PAGE_SHIFT) != pg) - return (start << PAGE_SHIFT) - ofs; - } - /* ok, all on continuous pages */ - return size; -} -EXPORT_SYMBOL(snd_sgbuf_get_chunk_size); diff --git a/trunk/sound/core/sound.c b/trunk/sound/core/sound.c index 643976000ce8..28f35593a750 100644 --- a/trunk/sound/core/sound.c +++ b/trunk/sound/core/sound.c @@ -27,6 +27,7 @@ #include #include #include +#include #include #include #include @@ -467,7 +468,7 @@ static int __init alsa_sound_init(void) } snd_info_minor_register(); #ifndef MODULE - printk(KERN_INFO "Advanced Linux Sound Architecture Driver Initialized.\n"); + printk(KERN_INFO "Advanced Linux Sound Architecture Driver Version " CONFIG_SND_VERSION CONFIG_SND_DATE ".\n"); #endif return 0; } diff --git a/trunk/sound/drivers/opl4/opl4_synth.c b/trunk/sound/drivers/opl4/opl4_synth.c index 4b91adc0238c..49b9e240915c 100644 --- a/trunk/sound/drivers/opl4/opl4_synth.c +++ b/trunk/sound/drivers/opl4/opl4_synth.c @@ -504,7 +504,8 @@ void snd_opl4_note_on(void *private_data, int note, int vel, struct snd_midi_cha spin_lock_irqsave(&opl4->reg_lock, flags); for (i = 0; i < voices; i++) { voice[i] = snd_opl4_get_voice(opl4); - list_move_tail(&voice[i]->list, &opl4->on_voices); + list_del(&voice[i]->list); + list_add_tail(&voice[i]->list, &opl4->on_voices); voice[i]->chan = chan; voice[i]->note = note; voice[i]->velocity = vel & 0x7f; @@ -554,7 +555,8 @@ void snd_opl4_note_on(void *private_data, int note, int vel, struct snd_midi_cha static void snd_opl4_voice_off(struct snd_opl4 *opl4, struct opl4_voice *voice) { - list_move_tail(&voice->list, &opl4->off_voices); + list_del(&voice->list); + list_add_tail(&voice->list, &opl4->off_voices); voice->reg_misc &= ~OPL4_KEY_ON_BIT; snd_opl4_write(opl4, OPL4_REG_MISC + voice->number, voice->reg_misc); @@ -569,7 +571,8 @@ void snd_opl4_note_off(void *private_data, int note, int vel, struct snd_midi_ch static void snd_opl4_terminate_voice(struct snd_opl4 *opl4, struct opl4_voice *voice) { - list_move_tail(&voice->list, &opl4->off_voices); + list_del(&voice->list); + list_add_tail(&voice->list, &opl4->off_voices); voice->reg_misc = (voice->reg_misc & ~OPL4_KEY_ON_BIT) | OPL4_DAMP_BIT; snd_opl4_write(opl4, OPL4_REG_MISC + voice->number, voice->reg_misc); diff --git a/trunk/sound/isa/Kconfig b/trunk/sound/isa/Kconfig index a38d9643e9d8..52064cfa91f3 100644 --- a/trunk/sound/isa/Kconfig +++ b/trunk/sound/isa/Kconfig @@ -117,18 +117,6 @@ config SND_AZT2320 To compile this driver as a module, choose M here: the module will be called snd-azt2320. -config SND_CMI8328 - tristate "C-Media CMI8328" - select SND_WSS_LIB - select SND_OPL3_LIB - select SND_MPU401_UART - help - Say Y here to include support for soundcards based on the - C-Media CMI8328 chip. - - To compile this driver as a module, choose M here: the module - will be called snd-cmi8328. - config SND_CMI8330 tristate "C-Media CMI8330" select SND_WSS_LIB diff --git a/trunk/sound/isa/Makefile b/trunk/sound/isa/Makefile index 9a15f1497b10..8d781e419e2e 100644 --- a/trunk/sound/isa/Makefile +++ b/trunk/sound/isa/Makefile @@ -6,7 +6,6 @@ snd-adlib-objs := adlib.o snd-als100-objs := als100.o snd-azt2320-objs := azt2320.o -snd-cmi8328-objs := cmi8328.o snd-cmi8330-objs := cmi8330.o snd-es18xx-objs := es18xx.o snd-opl3sa2-objs := opl3sa2.o @@ -17,7 +16,6 @@ snd-sscape-objs := sscape.o obj-$(CONFIG_SND_ADLIB) += snd-adlib.o obj-$(CONFIG_SND_ALS100) += snd-als100.o obj-$(CONFIG_SND_AZT2320) += snd-azt2320.o -obj-$(CONFIG_SND_CMI8328) += snd-cmi8328.o obj-$(CONFIG_SND_CMI8330) += snd-cmi8330.o obj-$(CONFIG_SND_ES18XX) += snd-es18xx.o obj-$(CONFIG_SND_OPL3SA2) += snd-opl3sa2.o diff --git a/trunk/sound/isa/ad1816a/ad1816a.c b/trunk/sound/isa/ad1816a/ad1816a.c index 2c2f829c3fd7..94b83b6e46a3 100644 --- a/trunk/sound/isa/ad1816a/ad1816a.c +++ b/trunk/sound/isa/ad1816a/ad1816a.c @@ -63,6 +63,11 @@ MODULE_PARM_DESC(enable, "Enable ad1816a based soundcard."); module_param_array(clockfreq, int, NULL, 0444); MODULE_PARM_DESC(clockfreq, "Clock frequency for ad1816a driver (default = 0)."); +struct snd_card_ad1816a { + struct pnp_dev *dev; + struct pnp_dev *devmpu; +}; + static struct pnp_card_device_id snd_ad1816a_pnpids[] = { /* Analog Devices AD1815 */ { .id = "ADS7150", .devs = { { .id = "ADS7150" }, { .id = "ADS7151" } } }, @@ -94,16 +99,25 @@ MODULE_DEVICE_TABLE(pnp_card, snd_ad1816a_pnpids); #define DRIVER_NAME "snd-card-ad1816a" -static int __devinit snd_card_ad1816a_pnp(int dev, struct pnp_card_link *card, +static int __devinit snd_card_ad1816a_pnp(int dev, struct snd_card_ad1816a *acard, + struct pnp_card_link *card, const struct pnp_card_device_id *id) { struct pnp_dev *pdev; int err; - pdev = pnp_request_card_device(card, id->devs[0].id, NULL); - if (pdev == NULL) + acard->dev = pnp_request_card_device(card, id->devs[0].id, NULL); + if (acard->dev == NULL) return -EBUSY; + acard->devmpu = pnp_request_card_device(card, id->devs[1].id, NULL); + if (acard->devmpu == NULL) { + mpu_port[dev] = -1; + snd_printk(KERN_WARNING PFX "MPU401 device busy, skipping.\n"); + } + + pdev = acard->dev; + err = pnp_activate_dev(pdev); if (err < 0) { printk(KERN_ERR PFX "AUDIO PnP configure failure\n"); @@ -116,17 +130,16 @@ static int __devinit snd_card_ad1816a_pnp(int dev, struct pnp_card_link *card, dma2[dev] = pnp_dma(pdev, 1); irq[dev] = pnp_irq(pdev, 0); - pdev = pnp_request_card_device(card, id->devs[1].id, NULL); - if (pdev == NULL) { - mpu_port[dev] = -1; - snd_printk(KERN_WARNING PFX "MPU401 device busy, skipping.\n"); + if (acard->devmpu == NULL) return 0; - } + + pdev = acard->devmpu; err = pnp_activate_dev(pdev); if (err < 0) { printk(KERN_ERR PFX "MPU401 PnP configure failure\n"); mpu_port[dev] = -1; + acard->devmpu = NULL; } else { mpu_port[dev] = pnp_port_start(pdev, 0); mpu_irq[dev] = pnp_irq(pdev, 0); @@ -140,17 +153,18 @@ static int __devinit snd_card_ad1816a_probe(int dev, struct pnp_card_link *pcard { int error; struct snd_card *card; + struct snd_card_ad1816a *acard; struct snd_ad1816a *chip; struct snd_opl3 *opl3; struct snd_timer *timer; error = snd_card_create(index[dev], id[dev], THIS_MODULE, - sizeof(struct snd_ad1816a), &card); + sizeof(struct snd_card_ad1816a), &card); if (error < 0) return error; - chip = card->private_data; + acard = card->private_data; - if ((error = snd_card_ad1816a_pnp(dev, pcard, pid))) { + if ((error = snd_card_ad1816a_pnp(dev, acard, pcard, pid))) { snd_card_free(card); return error; } @@ -160,7 +174,7 @@ static int __devinit snd_card_ad1816a_probe(int dev, struct pnp_card_link *pcard irq[dev], dma1[dev], dma2[dev], - chip)) < 0) { + &chip)) < 0) { snd_card_free(card); return error; } @@ -244,37 +258,13 @@ static void __devexit snd_ad1816a_pnp_remove(struct pnp_card_link * pcard) pnp_set_card_drvdata(pcard, NULL); } -#ifdef CONFIG_PM -static int snd_ad1816a_pnp_suspend(struct pnp_card_link *pcard, - pm_message_t state) -{ - struct snd_card *card = pnp_get_card_drvdata(pcard); - - snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); - snd_ad1816a_suspend(card->private_data); - return 0; -} - -static int snd_ad1816a_pnp_resume(struct pnp_card_link *pcard) -{ - struct snd_card *card = pnp_get_card_drvdata(pcard); - - snd_ad1816a_resume(card->private_data); - snd_power_change_state(card, SNDRV_CTL_POWER_D0); - return 0; -} -#endif - static struct pnp_card_driver ad1816a_pnpc_driver = { .flags = PNP_DRIVER_RES_DISABLE, .name = "ad1816a", .id_table = snd_ad1816a_pnpids, .probe = snd_ad1816a_pnp_detect, .remove = __devexit_p(snd_ad1816a_pnp_remove), -#ifdef CONFIG_PM - .suspend = snd_ad1816a_pnp_suspend, - .resume = snd_ad1816a_pnp_resume, -#endif + /* FIXME: suspend/resume */ }; static int __init alsa_card_ad1816a_init(void) diff --git a/trunk/sound/isa/ad1816a/ad1816a_lib.c b/trunk/sound/isa/ad1816a/ad1816a_lib.c index db64df6023e0..177eed3271bc 100644 --- a/trunk/sound/isa/ad1816a/ad1816a_lib.c +++ b/trunk/sound/isa/ad1816a/ad1816a_lib.c @@ -491,7 +491,7 @@ static int snd_ad1816a_capture_close(struct snd_pcm_substream *substream) } -static void snd_ad1816a_init(struct snd_ad1816a *chip) +static void __devinit snd_ad1816a_init(struct snd_ad1816a *chip) { unsigned long flags; @@ -511,32 +511,6 @@ static void snd_ad1816a_init(struct snd_ad1816a *chip) spin_unlock_irqrestore(&chip->lock, flags); } -#ifdef CONFIG_PM -void snd_ad1816a_suspend(struct snd_ad1816a *chip) -{ - int reg; - unsigned long flags; - - snd_pcm_suspend_all(chip->pcm); - spin_lock_irqsave(&chip->lock, flags); - for (reg = 0; reg < 48; reg++) - chip->image[reg] = snd_ad1816a_read(chip, reg); - spin_unlock_irqrestore(&chip->lock, flags); -} - -void snd_ad1816a_resume(struct snd_ad1816a *chip) -{ - int reg; - unsigned long flags; - - snd_ad1816a_init(chip); - spin_lock_irqsave(&chip->lock, flags); - for (reg = 0; reg < 48; reg++) - snd_ad1816a_write(chip, reg, chip->image[reg]); - spin_unlock_irqrestore(&chip->lock, flags); -} -#endif - static int __devinit snd_ad1816a_probe(struct snd_ad1816a *chip) { unsigned long flags; @@ -574,6 +548,7 @@ static int snd_ad1816a_free(struct snd_ad1816a *chip) snd_dma_disable(chip->dma2); free_dma(chip->dma2); } + kfree(chip); return 0; } @@ -598,13 +573,19 @@ static const char __devinit *snd_ad1816a_chip_id(struct snd_ad1816a *chip) int __devinit snd_ad1816a_create(struct snd_card *card, unsigned long port, int irq, int dma1, int dma2, - struct snd_ad1816a *chip) + struct snd_ad1816a **rchip) { static struct snd_device_ops ops = { .dev_free = snd_ad1816a_dev_free, }; int error; + struct snd_ad1816a *chip; + + *rchip = NULL; + chip = kzalloc(sizeof(*chip), GFP_KERNEL); + if (chip == NULL) + return -ENOMEM; chip->irq = -1; chip->dma1 = -1; chip->dma2 = -1; @@ -650,6 +631,7 @@ int __devinit snd_ad1816a_create(struct snd_card *card, return error; } + *rchip = chip; return 0; } diff --git a/trunk/sound/isa/cmi8328.c b/trunk/sound/isa/cmi8328.c deleted file mode 100644 index bde60139bb95..000000000000 --- a/trunk/sound/isa/cmi8328.c +++ /dev/null @@ -1,483 +0,0 @@ -/* - * Driver for C-Media CMI8328-based soundcards, such as AudioExcel AV500 - * Copyright (c) 2012 Ondrej Zary - * - * AudioExcel AV500 card consists of: - * - CMI8328 - main chip (SB Pro emulation, gameport, OPL3, MPU401, CD-ROM) - * - CS4231A - WSS codec - * - Dream SAM9233+GMS950400+RAM+ROM: Wavetable MIDI, connected to MPU401 - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#define SNDRV_LEGACY_FIND_FREE_IOPORT -#define SNDRV_LEGACY_FIND_FREE_IRQ -#define SNDRV_LEGACY_FIND_FREE_DMA -#include - -MODULE_AUTHOR("Ondrej Zary "); -MODULE_DESCRIPTION("C-Media CMI8328"); -MODULE_LICENSE("GPL"); - -#if defined(CONFIG_GAMEPORT) || defined(CONFIG_GAMEPORT_MODULE) -#define SUPPORT_JOYSTICK 1 -#endif - -/* I/O port is configured by jumpers on the card to one of these */ -static int cmi8328_ports[] = { 0x530, 0xe80, 0xf40, 0x604 }; -#define CMI8328_MAX ARRAY_SIZE(cmi8328_ports) - -static int index[CMI8328_MAX] = {[0 ... (CMI8328_MAX-1)] = -1}; -static char *id[CMI8328_MAX] = {[0 ... (CMI8328_MAX-1)] = NULL}; -static long port[CMI8328_MAX] = {[0 ... (CMI8328_MAX-1)] = SNDRV_AUTO_PORT}; -static int irq[CMI8328_MAX] = {[0 ... (CMI8328_MAX-1)] = SNDRV_AUTO_IRQ}; -static int dma1[CMI8328_MAX] = {[0 ... (CMI8328_MAX-1)] = SNDRV_AUTO_DMA}; -static int dma2[CMI8328_MAX] = {[0 ... (CMI8328_MAX-1)] = SNDRV_AUTO_DMA}; -static long mpuport[CMI8328_MAX] = {[0 ... (CMI8328_MAX-1)] = SNDRV_AUTO_PORT}; -static int mpuirq[CMI8328_MAX] = {[0 ... (CMI8328_MAX-1)] = SNDRV_AUTO_IRQ}; -#ifdef SUPPORT_JOYSTICK -static bool gameport[CMI8328_MAX] = {[0 ... (CMI8328_MAX-1)] = true}; -#endif - -module_param_array(index, int, NULL, 0444); -MODULE_PARM_DESC(index, "Index value for CMI8328 soundcard."); -module_param_array(id, charp, NULL, 0444); -MODULE_PARM_DESC(id, "ID string for CMI8328 soundcard."); - -module_param_array(port, long, NULL, 0444); -MODULE_PARM_DESC(port, "Port # for CMI8328 driver."); -module_param_array(irq, int, NULL, 0444); -MODULE_PARM_DESC(irq, "IRQ # for CMI8328 driver."); -module_param_array(dma1, int, NULL, 0444); -MODULE_PARM_DESC(dma1, "DMA1 for CMI8328 driver."); -module_param_array(dma2, int, NULL, 0444); -MODULE_PARM_DESC(dma2, "DMA2 for CMI8328 driver."); - -module_param_array(mpuport, long, NULL, 0444); -MODULE_PARM_DESC(mpuport, "MPU-401 port # for CMI8328 driver."); -module_param_array(mpuirq, int, NULL, 0444); -MODULE_PARM_DESC(mpuirq, "IRQ # for CMI8328 MPU-401 port."); -#ifdef SUPPORT_JOYSTICK -module_param_array(gameport, bool, NULL, 0444); -MODULE_PARM_DESC(gameport, "Enable gameport."); -#endif - -struct snd_cmi8328 { - u16 port; - u8 cfg[3]; - u8 wss_cfg; - struct snd_card *card; - struct snd_wss *wss; -#ifdef SUPPORT_JOYSTICK - struct gameport *gameport; -#endif -}; - -/* CMI8328 configuration registers */ -#define CFG1 0x61 -#define CFG1_SB_DISABLE (1 << 0) -#define CFG1_GAMEPORT (1 << 1) -/* - * bit 0: SB: 0=enabled, 1=disabled - * bit 1: gameport: 0=disabled, 1=enabled - * bits 2-4: SB IRQ: 001=3, 010=5, 011=7, 100=9, 101=10, 110=11 - * bits 5-6: SB DMA: 00=disabled (when SB disabled), 01=DMA0, 10=DMA1, 11=DMA3 - * bit 7: SB port: 0=0x220, 1=0x240 - */ -#define CFG2 0x62 -#define CFG2_MPU_ENABLE (1 << 2) -/* - * bits 0-1: CD-ROM mode: 00=disabled, 01=Panasonic, 10=Sony/Mitsumi/Wearnes, - 11=IDE - * bit 2: MPU401: 0=disabled, 1=enabled - * bits 3-4: MPU401 IRQ: 00=3, 01=5, 10=7, 11=9, - * bits 5-7: MPU401 port: 000=0x300, 001=0x310, 010=0x320, 011=0x330, 100=0x332, - 101=0x334, 110=0x336 - */ -#define CFG3 0x63 -/* - * bits 0-2: CD-ROM IRQ: 000=disabled, 001=3, 010=5, 011=7, 100=9, 101=10, - 110=11 - * bits 3-4: CD-ROM DMA: 00=disabled, 01=DMA0, 10=DMA1, 11=DMA3 - * bits 5-7: CD-ROM port: 000=0x300, 001=0x310, 010=0x320, 011=0x330, 100=0x340, - 101=0x350, 110=0x360, 111=0x370 - */ - -static u8 snd_cmi8328_cfg_read(u16 port, u8 reg) -{ - outb(0x43, port + 3); - outb(0x21, port + 3); - outb(reg, port + 3); - return inb(port); -} - -static void snd_cmi8328_cfg_write(u16 port, u8 reg, u8 val) -{ - outb(0x43, port + 3); - outb(0x21, port + 3); - outb(reg, port + 3); - outb(val, port + 3); /* yes, value goes to the same port as index */ -} - -static void snd_cmi8328_cfg_save(u16 port, u8 cfg[]) -{ - cfg[0] = snd_cmi8328_cfg_read(port, CFG1); - cfg[1] = snd_cmi8328_cfg_read(port, CFG2); - cfg[2] = snd_cmi8328_cfg_read(port, CFG3); -} - -static void snd_cmi8328_cfg_restore(u16 port, u8 cfg[]) -{ - snd_cmi8328_cfg_write(port, CFG1, cfg[0]); - snd_cmi8328_cfg_write(port, CFG2, cfg[1]); - snd_cmi8328_cfg_write(port, CFG3, cfg[2]); -} - -static int __devinit snd_cmi8328_mixer(struct snd_wss *chip) -{ - struct snd_card *card; - struct snd_ctl_elem_id id1, id2; - int err; - - card = chip->card; - - memset(&id1, 0, sizeof(id1)); - memset(&id2, 0, sizeof(id2)); - id1.iface = id2.iface = SNDRV_CTL_ELEM_IFACE_MIXER; - /* rename AUX0 switch to CD */ - strcpy(id1.name, "Aux Playback Switch"); - strcpy(id2.name, "CD Playback Switch"); - err = snd_ctl_rename_id(card, &id1, &id2); - if (err < 0) { - snd_printk(KERN_ERR "error renaming control\n"); - return err; - } - /* rename AUX0 volume to CD */ - strcpy(id1.name, "Aux Playback Volume"); - strcpy(id2.name, "CD Playback Volume"); - err = snd_ctl_rename_id(card, &id1, &id2); - if (err < 0) { - snd_printk(KERN_ERR "error renaming control\n"); - return err; - } - /* rename AUX1 switch to Synth */ - strcpy(id1.name, "Aux Playback Switch"); - id1.index = 1; - strcpy(id2.name, "Synth Playback Switch"); - err = snd_ctl_rename_id(card, &id1, &id2); - if (err < 0) { - snd_printk(KERN_ERR "error renaming control\n"); - return err; - } - /* rename AUX1 volume to Synth */ - strcpy(id1.name, "Aux Playback Volume"); - id1.index = 1; - strcpy(id2.name, "Synth Playback Volume"); - err = snd_ctl_rename_id(card, &id1, &id2); - if (err < 0) { - snd_printk(KERN_ERR "error renaming control\n"); - return err; - } - - return 0; -} - -/* find index of an item in "-1"-ended array */ -int array_find(int array[], int item) -{ - int i; - - for (i = 0; array[i] != -1; i++) - if (array[i] == item) - return i; - - return -1; -} -/* the same for long */ -int array_find_l(long array[], long item) -{ - int i; - - for (i = 0; array[i] != -1; i++) - if (array[i] == item) - return i; - - return -1; -} - -static int __devinit snd_cmi8328_probe(struct device *pdev, unsigned int ndev) -{ - struct snd_card *card; - struct snd_opl3 *opl3; - struct snd_cmi8328 *cmi; -#ifdef SUPPORT_JOYSTICK - struct resource *res; -#endif - int err, pos; - static long mpu_ports[] = { 0x330, 0x300, 0x310, 0x320, 0x332, 0x334, - 0x336, -1 }; - static u8 mpu_port_bits[] = { 3, 0, 1, 2, 4, 5, 6 }; - static int mpu_irqs[] = { 9, 7, 5, 3, -1 }; - static u8 mpu_irq_bits[] = { 3, 2, 1, 0 }; - static int irqs[] = { 9, 10, 11, 7, -1 }; - static u8 irq_bits[] = { 2, 3, 4, 1 }; - static int dma1s[] = { 3, 1, 0, -1 }; - static u8 dma_bits[] = { 3, 2, 1 }; - static int dma2s[][2] = { {1, -1}, {0, -1}, {-1, -1}, {0, -1} }; - u16 port = cmi8328_ports[ndev]; - u8 val; - - /* 0xff is invalid configuration (but settable - hope it isn't set) */ - if (snd_cmi8328_cfg_read(port, CFG1) == 0xff) - return -ENODEV; - /* the SB disable bit must NEVER EVER be cleared or the WSS dies */ - snd_cmi8328_cfg_write(port, CFG1, CFG1_SB_DISABLE); - if (snd_cmi8328_cfg_read(port, CFG1) != CFG1_SB_DISABLE) - return -ENODEV; - /* disable everything first */ - snd_cmi8328_cfg_write(port, CFG2, 0); /* disable CDROM and MPU401 */ - snd_cmi8328_cfg_write(port, CFG3, 0); /* disable CDROM IRQ and DMA */ - - if (irq[ndev] == SNDRV_AUTO_IRQ) { - irq[ndev] = snd_legacy_find_free_irq(irqs); - if (irq[ndev] < 0) { - snd_printk(KERN_ERR "unable to find a free IRQ\n"); - return -EBUSY; - } - } - if (dma1[ndev] == SNDRV_AUTO_DMA) { - dma1[ndev] = snd_legacy_find_free_dma(dma1s); - if (dma1[ndev] < 0) { - snd_printk(KERN_ERR "unable to find a free DMA1\n"); - return -EBUSY; - } - } - if (dma2[ndev] == SNDRV_AUTO_DMA) { - dma2[ndev] = snd_legacy_find_free_dma(dma2s[dma1[ndev] % 4]); - if (dma2[ndev] < 0) { - snd_printk(KERN_WARNING "unable to find a free DMA2, full-duplex will not work\n"); - dma2[ndev] = -1; - } - } - /* configure WSS IRQ... */ - pos = array_find(irqs, irq[ndev]); - if (pos < 0) { - snd_printk(KERN_ERR "invalid IRQ %d\n", irq[ndev]); - return -EINVAL; - } - val = irq_bits[pos] << 3; - /* ...and DMA... */ - pos = array_find(dma1s, dma1[ndev]); - if (pos < 0) { - snd_printk(KERN_ERR "invalid DMA1 %d\n", dma1[ndev]); - return -EINVAL; - } - val |= dma_bits[pos]; - /* ...and DMA2 */ - if (dma2[ndev] >= 0 && dma1[ndev] != dma2[ndev]) { - pos = array_find(dma2s[dma1[ndev]], dma2[ndev]); - if (pos < 0) { - snd_printk(KERN_ERR "invalid DMA2 %d\n", dma2[ndev]); - return -EINVAL; - } - val |= 0x04; /* enable separate capture DMA */ - } - outb(val, port); - - err = snd_card_create(index[ndev], id[ndev], THIS_MODULE, - sizeof(struct snd_cmi8328), &card); - if (err < 0) - return err; - cmi = card->private_data; - cmi->card = card; - cmi->port = port; - cmi->wss_cfg = val; - snd_card_set_dev(card, pdev); - - err = snd_wss_create(card, port + 4, -1, irq[ndev], dma1[ndev], - dma2[ndev], WSS_HW_DETECT, 0, &cmi->wss); - if (err < 0) - goto error; - - err = snd_wss_pcm(cmi->wss, 0, NULL); - if (err < 0) - goto error; - - err = snd_wss_mixer(cmi->wss); - if (err < 0) - goto error; - err = snd_cmi8328_mixer(cmi->wss); - if (err < 0) - goto error; - - if (snd_wss_timer(cmi->wss, 0, NULL) < 0) - snd_printk(KERN_WARNING "error initializing WSS timer\n"); - - if (mpuport[ndev] == SNDRV_AUTO_PORT) { - mpuport[ndev] = snd_legacy_find_free_ioport(mpu_ports, 2); - if (mpuport[ndev] < 0) - snd_printk(KERN_ERR "unable to find a free MPU401 port\n"); - } - if (mpuirq[ndev] == SNDRV_AUTO_IRQ) { - mpuirq[ndev] = snd_legacy_find_free_irq(mpu_irqs); - if (mpuirq[ndev] < 0) - snd_printk(KERN_ERR "unable to find a free MPU401 IRQ\n"); - } - /* enable and configure MPU401 */ - if (mpuport[ndev] > 0 && mpuirq[ndev] > 0) { - val = CFG2_MPU_ENABLE; - pos = array_find_l(mpu_ports, mpuport[ndev]); - if (pos < 0) - snd_printk(KERN_WARNING "invalid MPU401 port 0x%lx\n", - mpuport[ndev]); - else { - val |= mpu_port_bits[pos] << 5; - pos = array_find(mpu_irqs, mpuirq[ndev]); - if (pos < 0) - snd_printk(KERN_WARNING "invalid MPU401 IRQ %d\n", - mpuirq[ndev]); - else { - val |= mpu_irq_bits[pos] << 3; - snd_cmi8328_cfg_write(port, CFG2, val); - if (snd_mpu401_uart_new(card, 0, - MPU401_HW_MPU401, mpuport[ndev], - 0, mpuirq[ndev], NULL) < 0) - snd_printk(KERN_ERR "error initializing MPU401\n"); - } - } - } - /* OPL3 is hardwired to 0x388 and cannot be disabled */ - if (snd_opl3_create(card, 0x388, 0x38a, OPL3_HW_AUTO, 0, &opl3) < 0) - snd_printk(KERN_ERR "error initializing OPL3\n"); - else - if (snd_opl3_hwdep_new(opl3, 0, 1, NULL) < 0) - snd_printk(KERN_WARNING "error initializing OPL3 hwdep\n"); - - strcpy(card->driver, "CMI8328"); - strcpy(card->shortname, "C-Media CMI8328"); - sprintf(card->longname, "%s at 0x%lx, irq %d, dma %d,%d", - card->shortname, cmi->wss->port, irq[ndev], dma1[ndev], - (dma2[ndev] >= 0) ? dma2[ndev] : dma1[ndev]); - - dev_set_drvdata(pdev, card); - err = snd_card_register(card); - if (err < 0) - goto error; -#ifdef SUPPORT_JOYSTICK - if (!gameport[ndev]) - return 0; - /* gameport is hardwired to 0x200 */ - res = request_region(0x200, 8, "CMI8328 gameport"); - if (!res) - snd_printk(KERN_WARNING "unable to allocate gameport I/O port\n"); - else { - struct gameport *gp = cmi->gameport = gameport_allocate_port(); - if (!cmi->gameport) - release_and_free_resource(res); - else { - gameport_set_name(gp, "CMI8328 Gameport"); - gameport_set_phys(gp, "%s/gameport0", dev_name(pdev)); - gameport_set_dev_parent(gp, pdev); - gp->io = 0x200; - gameport_set_port_data(gp, res); - /* Enable gameport */ - snd_cmi8328_cfg_write(port, CFG1, - CFG1_SB_DISABLE | CFG1_GAMEPORT); - gameport_register_port(gp); - } - } -#endif - return 0; -error: - snd_card_free(card); - - return err; -} - -static int __devexit snd_cmi8328_remove(struct device *pdev, unsigned int dev) -{ - struct snd_card *card = dev_get_drvdata(pdev); - struct snd_cmi8328 *cmi = card->private_data; - -#ifdef SUPPORT_JOYSTICK - if (cmi->gameport) { - struct resource *res = gameport_get_port_data(cmi->gameport); - gameport_unregister_port(cmi->gameport); - release_and_free_resource(res); - } -#endif - /* disable everything */ - snd_cmi8328_cfg_write(cmi->port, CFG1, CFG1_SB_DISABLE); - snd_cmi8328_cfg_write(cmi->port, CFG2, 0); - snd_cmi8328_cfg_write(cmi->port, CFG3, 0); - snd_card_free(card); - dev_set_drvdata(pdev, NULL); - return 0; -} - -#ifdef CONFIG_PM -static int snd_cmi8328_suspend(struct device *pdev, unsigned int n, - pm_message_t state) -{ - struct snd_card *card = dev_get_drvdata(pdev); - struct snd_cmi8328 *cmi; - - if (!card) /* ignore absent devices */ - return 0; - cmi = card->private_data; - snd_cmi8328_cfg_save(cmi->port, cmi->cfg); - snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); - snd_pcm_suspend_all(cmi->wss->pcm); - cmi->wss->suspend(cmi->wss); - - return 0; -} - -static int snd_cmi8328_resume(struct device *pdev, unsigned int n) -{ - struct snd_card *card = dev_get_drvdata(pdev); - struct snd_cmi8328 *cmi; - - if (!card) /* ignore absent devices */ - return 0; - cmi = card->private_data; - snd_cmi8328_cfg_restore(cmi->port, cmi->cfg); - outb(cmi->wss_cfg, cmi->port); - cmi->wss->resume(cmi->wss); - snd_power_change_state(card, SNDRV_CTL_POWER_D0); - - return 0; -} -#endif - -static struct isa_driver snd_cmi8328_driver = { - .probe = snd_cmi8328_probe, - .remove = __devexit_p(snd_cmi8328_remove), -#ifdef CONFIG_PM - .suspend = snd_cmi8328_suspend, - .resume = snd_cmi8328_resume, -#endif - .driver = { - .name = "cmi8328" - }, -}; - -static int __init alsa_card_cmi8328_init(void) -{ - return isa_register_driver(&snd_cmi8328_driver, CMI8328_MAX); -} - -static void __exit alsa_card_cmi8328_exit(void) -{ - isa_unregister_driver(&snd_cmi8328_driver); -} - -module_init(alsa_card_cmi8328_init) -module_exit(alsa_card_cmi8328_exit) diff --git a/trunk/sound/isa/gus/interwave.c b/trunk/sound/isa/gus/interwave.c index 3fc8b66fd167..a76bc8d27c1d 100644 --- a/trunk/sound/isa/gus/interwave.c +++ b/trunk/sound/isa/gus/interwave.c @@ -443,8 +443,9 @@ static void __devinit snd_interwave_detect_memory(struct snd_gus_card * gus) for (i = 0; i < 8; ++i) iwave[i] = snd_gf1_peek(gus, bank_pos + i); #ifdef CONFIG_SND_DEBUG_ROM - printk(KERN_DEBUG "ROM at 0x%06x = %*phC\n", bank_pos, - 8, iwave); + printk(KERN_DEBUG "ROM at 0x%06x = %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x\n", bank_pos, + iwave[0], iwave[1], iwave[2], iwave[3], + iwave[4], iwave[5], iwave[6], iwave[7]); #endif if (strncmp(iwave, "INTRWAVE", 8)) continue; /* first check */ diff --git a/trunk/sound/isa/opti9xx/miro.c b/trunk/sound/isa/opti9xx/miro.c index 3d1afb612b35..c24594c866f4 100644 --- a/trunk/sound/isa/opti9xx/miro.c +++ b/trunk/sound/isa/opti9xx/miro.c @@ -37,7 +37,6 @@ #include #include #include -#define SNDRV_LEGACY_FIND_FREE_IOPORT #define SNDRV_LEGACY_FIND_FREE_IRQ #define SNDRV_LEGACY_FIND_FREE_DMA #include @@ -771,6 +770,20 @@ static int __devinit snd_miro_mixer(struct snd_card *card, return 0; } +static long snd_legacy_find_free_ioport(long *port_table, long size) +{ + while (*port_table != -1) { + struct resource *res; + if ((res = request_region(*port_table, size, + "ALSA test")) != NULL) { + release_and_free_resource(res); + return *port_table; + } + port_table++; + } + return -1; +} + static int __devinit snd_miro_init(struct snd_miro *chip, unsigned short hardware) { diff --git a/trunk/sound/isa/opti9xx/opti92x-ad1848.c b/trunk/sound/isa/opti9xx/opti92x-ad1848.c index 2899c9fd1ceb..f8fbe22515c9 100644 --- a/trunk/sound/isa/opti9xx/opti92x-ad1848.c +++ b/trunk/sound/isa/opti9xx/opti92x-ad1848.c @@ -39,7 +39,6 @@ #ifndef OPTi93X #include #endif -#define SNDRV_LEGACY_FIND_FREE_IOPORT #define SNDRV_LEGACY_FIND_FREE_IRQ #define SNDRV_LEGACY_FIND_FREE_DMA #include @@ -186,6 +185,19 @@ static char * snd_opti9xx_names[] = { "82C930", "82C931", "82C933" }; + +static long __devinit snd_legacy_find_free_ioport(long *port_table, long size) +{ + while (*port_table != -1) { + if (request_region(*port_table, size, "ALSA test")) { + release_region(*port_table, size); + return *port_table; + } + port_table++; + } + return -1; +} + static int __devinit snd_opti9xx_init(struct snd_opti9xx *chip, unsigned short hardware) { diff --git a/trunk/sound/isa/sb/emu8000.c b/trunk/sound/isa/sb/emu8000.c index 2aae6a0efbcd..71887874679c 100644 --- a/trunk/sound/isa/sb/emu8000.c +++ b/trunk/sound/isa/sb/emu8000.c @@ -417,6 +417,9 @@ size_dram(struct snd_emu8000 *emu) EMU8000_SMLD_READ(emu); /* discard stale data */ if (EMU8000_SMLD_READ(emu) != UNIQUE_ID2) break; /* no memory at this address */ + + detected_size = size; + snd_emu8000_read_wait(emu); /* @@ -429,18 +432,6 @@ size_dram(struct snd_emu8000 *emu) if (EMU8000_SMLD_READ(emu) != UNIQUE_ID1) break; /* we must have wrapped around */ snd_emu8000_read_wait(emu); - - /* Otherwise, it's valid memory. */ - detected_size = size + 512 * 1024; - } - - /* Distinguish 512 KiB from 0. */ - if (detected_size == 0) { - snd_emu8000_read_wait(emu); - EMU8000_SMALR_WRITE(emu, EMU8000_DRAM_OFFSET); - EMU8000_SMLD_READ(emu); /* discard stale data */ - if (EMU8000_SMLD_READ(emu) == UNIQUE_ID1) - detected_size = 512 * 1024; } /* wait until FULL bit in SMAxW register is false */ diff --git a/trunk/sound/last.c b/trunk/sound/last.c index 43f222825038..7ffc182e0844 100644 --- a/trunk/sound/last.c +++ b/trunk/sound/last.c @@ -19,6 +19,7 @@ * */ +#define SNDRV_MAIN_OBJECT_FILE #include #include diff --git a/trunk/sound/pci/ac97/ac97_patch.c b/trunk/sound/pci/ac97/ac97_patch.c index 66a3bc95fb84..a872d0a82976 100644 --- a/trunk/sound/pci/ac97/ac97_patch.c +++ b/trunk/sound/pci/ac97/ac97_patch.c @@ -2595,21 +2595,6 @@ static void alc650_update_jacks(struct snd_ac97 *ac97) shared ? 0 : 0x100); } -static int alc650_swap_surround_put(struct snd_kcontrol *kcontrol, - struct snd_ctl_elem_value *ucontrol) -{ - struct snd_ac97 *ac97 = snd_kcontrol_chip(kcontrol); - struct snd_pcm_chmap *map = ac97->chmaps[SNDRV_PCM_STREAM_PLAYBACK]; - - if (map) { - if (ucontrol->value.integer.value[0]) - map->chmap = snd_pcm_std_chmaps; - else - map->chmap = snd_pcm_alt_chmaps; - } - return snd_ac97_put_volsw(kcontrol, ucontrol); -} - static const struct snd_kcontrol_new snd_ac97_controls_alc650[] = { AC97_SINGLE("Duplicate Front", AC97_ALC650_MULTICH, 0, 1, 0), AC97_SINGLE("Surround Down Mix", AC97_ALC650_MULTICH, 1, 1, 0), @@ -2623,14 +2608,7 @@ static const struct snd_kcontrol_new snd_ac97_controls_alc650[] = { /* 9: Line-In/Surround share */ /* 10: Mic/CLFE share */ /* 11-13: in IEC958 controls */ - { - .iface = SNDRV_CTL_ELEM_IFACE_MIXER, - .name = "Swap Surround Slot", - .info = snd_ac97_info_volsw, - .get = snd_ac97_get_volsw, - .put = alc650_swap_surround_put, - .private_value = AC97_SINGLE_VALUE(AC97_ALC650_MULTICH, 14, 1, 0), - }, + AC97_SINGLE("Swap Surround Slot", AC97_ALC650_MULTICH, 14, 1, 0), #if 0 /* always set in patch_alc650 */ AC97_SINGLE("IEC958 Input Clock Enable", AC97_ALC650_CLOCK, 0, 1, 0), AC97_SINGLE("IEC958 Input Pin Enable", AC97_ALC650_CLOCK, 1, 1, 0), diff --git a/trunk/sound/pci/ali5451/ali5451.c b/trunk/sound/pci/ali5451/ali5451.c index c7e3c533316e..ee895f3c8605 100644 --- a/trunk/sound/pci/ali5451/ali5451.c +++ b/trunk/sound/pci/ali5451/ali5451.c @@ -270,7 +270,7 @@ struct snd_ali { spinlock_t reg_lock; spinlock_t voice_alloc; -#ifdef CONFIG_PM_SLEEP +#ifdef CONFIG_PM struct snd_ali_image *image; #endif }; @@ -1883,7 +1883,7 @@ static int __devinit snd_ali_mixer(struct snd_ali * codec) return 0; } -#ifdef CONFIG_PM_SLEEP +#ifdef CONFIG_PM static int ali_suspend(struct device *dev) { struct pci_dev *pci = to_pci_dev(dev); @@ -1989,7 +1989,7 @@ static SIMPLE_DEV_PM_OPS(ali_pm, ali_suspend, ali_resume); #define ALI_PM_OPS &ali_pm #else #define ALI_PM_OPS NULL -#endif /* CONFIG_PM_SLEEP */ +#endif /* CONFIG_PM */ static int snd_ali_free(struct snd_ali * codec) { @@ -2000,7 +2000,7 @@ static int snd_ali_free(struct snd_ali * codec) if (codec->port) pci_release_regions(codec->pci); pci_disable_device(codec->pci); -#ifdef CONFIG_PM_SLEEP +#ifdef CONFIG_PM kfree(codec->image); #endif pci_dev_put(codec->pci_m1533); @@ -2232,7 +2232,7 @@ static int __devinit snd_ali_create(struct snd_card *card, return err; } -#ifdef CONFIG_PM_SLEEP +#ifdef CONFIG_PM codec->image = kmalloc(sizeof(*codec->image), GFP_KERNEL); if (!codec->image) snd_printk(KERN_WARNING "can't allocate apm buffer\n"); diff --git a/trunk/sound/pci/als300.c b/trunk/sound/pci/als300.c index 00f157a2cf64..68c4469c6d19 100644 --- a/trunk/sound/pci/als300.c +++ b/trunk/sound/pci/als300.c @@ -765,7 +765,7 @@ static int __devinit snd_als300_create(struct snd_card *card, return 0; } -#ifdef CONFIG_PM_SLEEP +#ifdef CONFIG_PM static int snd_als300_suspend(struct device *dev) { struct pci_dev *pci = to_pci_dev(dev); diff --git a/trunk/sound/pci/als4000.c b/trunk/sound/pci/als4000.c index feb2a1436830..0eeca49c5754 100644 --- a/trunk/sound/pci/als4000.c +++ b/trunk/sound/pci/als4000.c @@ -987,7 +987,7 @@ static void __devexit snd_card_als4000_remove(struct pci_dev *pci) pci_set_drvdata(pci, NULL); } -#ifdef CONFIG_PM_SLEEP +#ifdef CONFIG_PM static int snd_als4000_suspend(struct device *dev) { struct pci_dev *pci = to_pci_dev(dev); @@ -1040,7 +1040,7 @@ static SIMPLE_DEV_PM_OPS(snd_als4000_pm, snd_als4000_suspend, snd_als4000_resume #define SND_ALS4000_PM_OPS &snd_als4000_pm #else #define SND_ALS4000_PM_OPS NULL -#endif /* CONFIG_PM_SLEEP */ +#endif /* CONFIG_PM */ static struct pci_driver als4000_driver = { .name = KBUILD_MODNAME, diff --git a/trunk/sound/pci/asihpi/asihpi.c b/trunk/sound/pci/asihpi/asihpi.c index a51e3ce3c800..e8de831f98bc 100644 --- a/trunk/sound/pci/asihpi/asihpi.c +++ b/trunk/sound/pci/asihpi/asihpi.c @@ -2968,7 +2968,7 @@ static struct pci_driver driver = { .id_table = asihpi_pci_tbl, .probe = snd_asihpi_probe, .remove = __devexit_p(snd_asihpi_remove), -#ifdef CONFIG_PM_SLEEP +#ifdef CONFIG_PM /* .suspend = snd_asihpi_suspend, .resume = snd_asihpi_resume, */ #endif diff --git a/trunk/sound/pci/atiixp.c b/trunk/sound/pci/atiixp.c index 368df8b0853e..31020d2a868b 100644 --- a/trunk/sound/pci/atiixp.c +++ b/trunk/sound/pci/atiixp.c @@ -535,7 +535,7 @@ static int snd_atiixp_aclink_reset(struct atiixp *chip) return 0; } -#ifdef CONFIG_PM_SLEEP +#ifdef CONFIG_PM static int snd_atiixp_aclink_down(struct atiixp *chip) { // if (atiixp_read(chip, MODEM_MIRROR) & 0x1) /* modem running, too? */ @@ -1250,7 +1250,6 @@ static struct atiixp_dma_ops snd_atiixp_spdif_dma_ops = { static int __devinit snd_atiixp_pcm_new(struct atiixp *chip) { struct snd_pcm *pcm; - struct snd_pcm_chmap *chmap; struct snd_ac97_bus *pbus = chip->ac97_bus; int err, i, num_pcms; @@ -1294,14 +1293,6 @@ static int __devinit snd_atiixp_pcm_new(struct atiixp *chip) snd_dma_pci_data(chip->pci), 64*1024, 128*1024); - err = snd_pcm_add_chmap_ctls(pcm, SNDRV_PCM_STREAM_PLAYBACK, - snd_pcm_alt_chmaps, chip->max_channels, 0, - &chmap); - if (err < 0) - return err; - chmap->channel_mask = SND_PCM_CHMAP_MASK_2468; - chip->ac97[0]->chmaps[SNDRV_PCM_STREAM_PLAYBACK] = chmap; - /* no SPDIF support on codec? */ if (chip->pcms[ATI_PCM_SPDIF] && ! chip->pcms[ATI_PCM_SPDIF]->rates) return 0; @@ -1467,7 +1458,7 @@ static int __devinit snd_atiixp_mixer_new(struct atiixp *chip, int clock, } -#ifdef CONFIG_PM_SLEEP +#ifdef CONFIG_PM /* * power management */ @@ -1542,7 +1533,7 @@ static SIMPLE_DEV_PM_OPS(snd_atiixp_pm, snd_atiixp_suspend, snd_atiixp_resume); #define SND_ATIIXP_PM_OPS &snd_atiixp_pm #else #define SND_ATIIXP_PM_OPS NULL -#endif /* CONFIG_PM_SLEEP */ +#endif /* CONFIG_PM */ #ifdef CONFIG_PROC_FS diff --git a/trunk/sound/pci/atiixp_modem.c b/trunk/sound/pci/atiixp_modem.c index 6fc03d9f2cff..79e204ec623f 100644 --- a/trunk/sound/pci/atiixp_modem.c +++ b/trunk/sound/pci/atiixp_modem.c @@ -511,7 +511,7 @@ static int snd_atiixp_aclink_reset(struct atiixp_modem *chip) return 0; } -#ifdef CONFIG_PM_SLEEP +#ifdef CONFIG_PM static int snd_atiixp_aclink_down(struct atiixp_modem *chip) { // if (atiixp_read(chip, MODEM_MIRROR) & 0x1) /* modem running, too? */ @@ -1113,7 +1113,7 @@ static int __devinit snd_atiixp_mixer_new(struct atiixp_modem *chip, int clock) } -#ifdef CONFIG_PM_SLEEP +#ifdef CONFIG_PM /* * power management */ @@ -1169,7 +1169,7 @@ static SIMPLE_DEV_PM_OPS(snd_atiixp_pm, snd_atiixp_suspend, snd_atiixp_resume); #define SND_ATIIXP_PM_OPS &snd_atiixp_pm #else #define SND_ATIIXP_PM_OPS NULL -#endif /* CONFIG_PM_SLEEP */ +#endif /* CONFIG_PM */ #ifdef CONFIG_PROC_FS /* diff --git a/trunk/sound/pci/azt3328.c b/trunk/sound/pci/azt3328.c index c03b66b784a3..4dddd871548b 100644 --- a/trunk/sound/pci/azt3328.c +++ b/trunk/sound/pci/azt3328.c @@ -365,7 +365,7 @@ struct snd_azf3328 { * CONFIG_PM register storage below, but that's slightly difficult. */ u16 shadow_reg_ctrl_6AH; -#ifdef CONFIG_PM_SLEEP +#ifdef CONFIG_PM /* register value containers for power management * Note: not always full I/O range preserved (similar to Win driver!) */ u32 saved_regs_ctrl[AZF_ALIGN(AZF_IO_SIZE_CTRL_PM) / 4]; @@ -2729,7 +2729,7 @@ snd_azf3328_remove(struct pci_dev *pci) snd_azf3328_dbgcallleave(); } -#ifdef CONFIG_PM_SLEEP +#ifdef CONFIG_PM static inline void snd_azf3328_suspend_regs(unsigned long io_addr, unsigned count, u32 *saved_regs) { @@ -2866,7 +2866,7 @@ static SIMPLE_DEV_PM_OPS(snd_azf3328_pm, snd_azf3328_suspend, snd_azf3328_resume #define SND_AZF3328_PM_OPS &snd_azf3328_pm #else #define SND_AZF3328_PM_OPS NULL -#endif /* CONFIG_PM_SLEEP */ +#endif /* CONFIG_PM */ static struct pci_driver azf3328_driver = { .name = KBUILD_MODNAME, diff --git a/trunk/sound/pci/ca0106/ca0106.h b/trunk/sound/pci/ca0106/ca0106.h index 04402c14cb23..e8e8ccc96403 100644 --- a/trunk/sound/pci/ca0106/ca0106.h +++ b/trunk/sound/pci/ca0106/ca0106.h @@ -710,7 +710,7 @@ struct snd_ca0106 { u16 spi_dac_reg[16]; -#ifdef CONFIG_PM_SLEEP +#ifdef CONFIG_PM #define NUM_SAVED_VOLUMES 9 unsigned int saved_vol[NUM_SAVED_VOLUMES]; #endif @@ -733,7 +733,7 @@ int snd_ca0106_i2c_write(struct snd_ca0106 *emu, u32 reg, u32 value); int snd_ca0106_spi_write(struct snd_ca0106 * emu, unsigned int data); -#ifdef CONFIG_PM_SLEEP +#ifdef CONFIG_PM void snd_ca0106_mixer_suspend(struct snd_ca0106 *chip); void snd_ca0106_mixer_resume(struct snd_ca0106 *chip); #else diff --git a/trunk/sound/pci/ca0106/ca0106_main.c b/trunk/sound/pci/ca0106/ca0106_main.c index 65c55910566b..83277b747b36 100644 --- a/trunk/sound/pci/ca0106/ca0106_main.c +++ b/trunk/sound/pci/ca0106/ca0106_main.c @@ -1334,29 +1334,10 @@ static irqreturn_t snd_ca0106_interrupt(int irq, void *dev_id) return IRQ_HANDLED; } -static const struct snd_pcm_chmap_elem surround_map[] = { - { .channels = 2, - .map = { SNDRV_CHMAP_RL, SNDRV_CHMAP_RR } }, - { } -}; - -static const struct snd_pcm_chmap_elem clfe_map[] = { - { .channels = 2, - .map = { SNDRV_CHMAP_FC, SNDRV_CHMAP_LFE } }, - { } -}; - -static const struct snd_pcm_chmap_elem side_map[] = { - { .channels = 2, - .map = { SNDRV_CHMAP_SL, SNDRV_CHMAP_SR } }, - { } -}; - static int __devinit snd_ca0106_pcm(struct snd_ca0106 *emu, int device) { struct snd_pcm *pcm; struct snd_pcm_substream *substream; - const struct snd_pcm_chmap_elem *map = NULL; int err; err = snd_pcm_new(emu->card, "ca0106", device, 1, 1, &pcm); @@ -1369,22 +1350,18 @@ static int __devinit snd_ca0106_pcm(struct snd_ca0106 *emu, int device) case 0: snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_ca0106_playback_front_ops); snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_ca0106_capture_0_ops); - map = snd_pcm_std_chmaps; break; case 1: snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_ca0106_playback_rear_ops); snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_ca0106_capture_1_ops); - map = surround_map; break; case 2: snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_ca0106_playback_center_lfe_ops); snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_ca0106_capture_2_ops); - map = clfe_map; break; case 3: snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_ca0106_playback_unknown_ops); snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_ca0106_capture_3_ops); - map = side_map; break; } @@ -1411,11 +1388,6 @@ static int __devinit snd_ca0106_pcm(struct snd_ca0106 *emu, int device) return err; } - err = snd_pcm_add_chmap_ctls(pcm, SNDRV_PCM_STREAM_PLAYBACK, map, 2, - 1 << 2, NULL); - if (err < 0) - return err; - emu->pcm[device] = pcm; return 0; @@ -1899,7 +1871,7 @@ static void __devexit snd_ca0106_remove(struct pci_dev *pci) pci_set_drvdata(pci, NULL); } -#ifdef CONFIG_PM_SLEEP +#ifdef CONFIG_PM static int snd_ca0106_suspend(struct device *dev) { struct pci_dev *pci = to_pci_dev(dev); diff --git a/trunk/sound/pci/ca0106/ca0106_mixer.c b/trunk/sound/pci/ca0106/ca0106_mixer.c index 68eacf7002d6..84f3f92436b5 100644 --- a/trunk/sound/pci/ca0106/ca0106_mixer.c +++ b/trunk/sound/pci/ca0106/ca0106_mixer.c @@ -907,7 +907,7 @@ int __devinit snd_ca0106_mixer(struct snd_ca0106 *emu) return 0; } -#ifdef CONFIG_PM_SLEEP +#ifdef CONFIG_PM struct ca0106_vol_tbl { unsigned int channel_id; unsigned int reg; @@ -953,4 +953,4 @@ void snd_ca0106_mixer_resume(struct snd_ca0106 *chip) if (chip->details->i2c_adc) ca0106_set_capture_mic_line_in(chip); } -#endif /* CONFIG_PM_SLEEP */ +#endif /* CONFIG_PM */ diff --git a/trunk/sound/pci/cmipci.c b/trunk/sound/pci/cmipci.c index 22122ff26e34..b7d6f2b886ef 100644 --- a/trunk/sound/pci/cmipci.c +++ b/trunk/sound/pci/cmipci.c @@ -504,7 +504,7 @@ struct cmipci { spinlock_t reg_lock; -#ifdef CONFIG_PM_SLEEP +#ifdef CONFIG_PM unsigned int saved_regs[0x20]; unsigned char saved_mixers[0x20]; #endif @@ -1962,12 +1962,6 @@ static int __devinit snd_cmipci_pcm_spdif_new(struct cmipci *cm, int device) snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(cm->pci), 64*1024, 128*1024); - err = snd_pcm_add_chmap_ctls(pcm, SNDRV_PCM_STREAM_PLAYBACK, - snd_pcm_alt_chmaps, cm->max_channels, 0, - NULL); - if (err < 0) - return err; - return 0; } @@ -3321,7 +3315,7 @@ static void __devexit snd_cmipci_remove(struct pci_dev *pci) } -#ifdef CONFIG_PM_SLEEP +#ifdef CONFIG_PM /* * power management */ @@ -3409,7 +3403,7 @@ static SIMPLE_DEV_PM_OPS(snd_cmipci_pm, snd_cmipci_suspend, snd_cmipci_resume); #define SND_CMIPCI_PM_OPS &snd_cmipci_pm #else #define SND_CMIPCI_PM_OPS NULL -#endif /* CONFIG_PM_SLEEP */ +#endif /* CONFIG_PM */ static struct pci_driver cmipci_driver = { .name = KBUILD_MODNAME, diff --git a/trunk/sound/pci/cs4281.c b/trunk/sound/pci/cs4281.c index 8e86ec0031fc..45a8317085f4 100644 --- a/trunk/sound/pci/cs4281.c +++ b/trunk/sound/pci/cs4281.c @@ -486,7 +486,7 @@ struct cs4281 { struct gameport *gameport; -#ifdef CONFIG_PM_SLEEP +#ifdef CONFIG_PM u32 suspend_regs[SUSPEND_REGISTERS]; #endif @@ -1977,7 +1977,7 @@ static void __devexit snd_cs4281_remove(struct pci_dev *pci) /* * Power Management */ -#ifdef CONFIG_PM_SLEEP +#ifdef CONFIG_PM static int saved_regs[SUSPEND_REGISTERS] = { BA0_JSCTL, @@ -2089,7 +2089,7 @@ static SIMPLE_DEV_PM_OPS(cs4281_pm, cs4281_suspend, cs4281_resume); #define CS4281_PM_OPS &cs4281_pm #else #define CS4281_PM_OPS NULL -#endif /* CONFIG_PM_SLEEP */ +#endif /* CONFIG_PM */ static struct pci_driver cs4281_driver = { .name = KBUILD_MODNAME, diff --git a/trunk/sound/pci/cs46xx/cs46xx.c b/trunk/sound/pci/cs46xx/cs46xx.c index 575bed0836ff..1e007c736a8b 100644 --- a/trunk/sound/pci/cs46xx/cs46xx.c +++ b/trunk/sound/pci/cs46xx/cs46xx.c @@ -166,7 +166,7 @@ static struct pci_driver cs46xx_driver = { .id_table = snd_cs46xx_ids, .probe = snd_card_cs46xx_probe, .remove = __devexit_p(snd_card_cs46xx_remove), -#ifdef CONFIG_PM_SLEEP +#ifdef CONFIG_PM .driver = { .pm = &snd_cs46xx_pm, }, diff --git a/trunk/sound/pci/cs46xx/cs46xx.h b/trunk/sound/pci/cs46xx/cs46xx.h index fc339ef0a0ae..29d8a8da1ba7 100644 --- a/trunk/sound/pci/cs46xx/cs46xx.h +++ b/trunk/sound/pci/cs46xx/cs46xx.h @@ -1721,7 +1721,7 @@ struct snd_cs46xx { unsigned int play_ctl; #endif -#ifdef CONFIG_PM_SLEEP +#ifdef CONFIG_PM u32 *saved_regs; #endif }; diff --git a/trunk/sound/pci/cs46xx/cs46xx_lib.c b/trunk/sound/pci/cs46xx/cs46xx_lib.c index a2bb8c91ebe6..a71d1c14a0f6 100644 --- a/trunk/sound/pci/cs46xx/cs46xx_lib.c +++ b/trunk/sound/pci/cs46xx/cs46xx_lib.c @@ -2797,7 +2797,7 @@ static int snd_cs46xx_free(struct snd_cs46xx *chip) } #endif -#ifdef CONFIG_PM_SLEEP +#ifdef CONFIG_PM kfree(chip->saved_regs); #endif @@ -3590,7 +3590,7 @@ static struct cs_card_type __devinitdata cards[] = { /* * APM support */ -#ifdef CONFIG_PM_SLEEP +#ifdef CONFIG_PM static unsigned int saved_regs[] = { BA0_ACOSV, /*BA0_ASER_FADDR,*/ @@ -3711,7 +3711,7 @@ static int snd_cs46xx_resume(struct device *dev) } SIMPLE_DEV_PM_OPS(snd_cs46xx_pm, snd_cs46xx_suspend, snd_cs46xx_resume); -#endif /* CONFIG_PM_SLEEP */ +#endif /* CONFIG_PM */ /* @@ -3868,7 +3868,7 @@ int __devinit snd_cs46xx_create(struct snd_card *card, snd_cs46xx_proc_init(card, chip); -#ifdef CONFIG_PM_SLEEP +#ifdef CONFIG_PM chip->saved_regs = kmalloc(sizeof(*chip->saved_regs) * ARRAY_SIZE(saved_regs), GFP_KERNEL); if (!chip->saved_regs) { diff --git a/trunk/sound/pci/cs46xx/cs46xx_lib.h b/trunk/sound/pci/cs46xx/cs46xx_lib.h index 86f14620f817..b5189495d58a 100644 --- a/trunk/sound/pci/cs46xx/cs46xx_lib.h +++ b/trunk/sound/pci/cs46xx/cs46xx_lib.h @@ -90,7 +90,7 @@ static inline unsigned int snd_cs46xx_peekBA0(struct snd_cs46xx *chip, unsigned struct dsp_spos_instance *cs46xx_dsp_spos_create (struct snd_cs46xx * chip); void cs46xx_dsp_spos_destroy (struct snd_cs46xx * chip); int cs46xx_dsp_load_module (struct snd_cs46xx * chip, struct dsp_module_desc * module); -#ifdef CONFIG_PM_SLEEP +#ifdef CONFIG_PM int cs46xx_dsp_resume(struct snd_cs46xx * chip); #endif struct dsp_symbol_entry *cs46xx_dsp_lookup_symbol (struct snd_cs46xx * chip, char * symbol_name, diff --git a/trunk/sound/pci/cs46xx/dsp_spos.c b/trunk/sound/pci/cs46xx/dsp_spos.c index 1686b4f4c44f..56fec0bc0efb 100644 --- a/trunk/sound/pci/cs46xx/dsp_spos.c +++ b/trunk/sound/pci/cs46xx/dsp_spos.c @@ -287,7 +287,7 @@ void cs46xx_dsp_spos_destroy (struct snd_cs46xx * chip) if (ins->scbs[i].deleted) continue; cs46xx_dsp_proc_free_scb_desc ( (ins->scbs + i) ); -#ifdef CONFIG_PM_SLEEP +#ifdef CONFIG_PM kfree(ins->scbs[i].data); #endif } @@ -1019,7 +1019,7 @@ cs46xx_dsp_create_scb (struct snd_cs46xx *chip, char * name, u32 * scb_data, u32 { struct dsp_scb_descriptor * desc; -#ifdef CONFIG_PM_SLEEP +#ifdef CONFIG_PM /* copy the data for resume */ scb_data = kmemdup(scb_data, SCB_BYTES, GFP_KERNEL); if (!scb_data) @@ -1032,7 +1032,7 @@ cs46xx_dsp_create_scb (struct snd_cs46xx *chip, char * name, u32 * scb_data, u32 _dsp_create_scb(chip,scb_data,dest); } else { snd_printk(KERN_ERR "dsp_spos: failed to map SCB\n"); -#ifdef CONFIG_PM_SLEEP +#ifdef CONFIG_PM kfree(scb_data); #endif } @@ -1937,7 +1937,7 @@ int cs46xx_dsp_set_iec958_volume (struct snd_cs46xx * chip, u16 left, u16 right) return 0; } -#ifdef CONFIG_PM_SLEEP +#ifdef CONFIG_PM int cs46xx_dsp_resume(struct snd_cs46xx * chip) { struct dsp_spos_instance * ins = chip->dsp_spos_instance; diff --git a/trunk/sound/pci/cs46xx/dsp_spos_scb_lib.c b/trunk/sound/pci/cs46xx/dsp_spos_scb_lib.c index 409e8764fbeb..c2c695b07f8c 100644 --- a/trunk/sound/pci/cs46xx/dsp_spos_scb_lib.c +++ b/trunk/sound/pci/cs46xx/dsp_spos_scb_lib.c @@ -203,7 +203,7 @@ void cs46xx_dsp_remove_scb (struct snd_cs46xx *chip, struct dsp_scb_descriptor * remove_symbol (chip,scb->scb_symbol); ins->scbs[scb->index].deleted = 1; -#ifdef CONFIG_PM_SLEEP +#ifdef CONFIG_PM kfree(ins->scbs[scb->index].data); ins->scbs[scb->index].data = NULL; #endif diff --git a/trunk/sound/pci/cs5530.c b/trunk/sound/pci/cs5530.c index d1cca2831575..f1e4229993af 100644 --- a/trunk/sound/pci/cs5530.c +++ b/trunk/sound/pci/cs5530.c @@ -142,7 +142,8 @@ static int __devinit snd_cs5530_create(struct snd_card *card, mem = pci_ioremap_bar(pci, 0); if (mem == NULL) { - snd_cs5530_free(chip); + kfree(chip); + pci_disable_device(pci); return -EBUSY; } diff --git a/trunk/sound/pci/cs5535audio/Makefile b/trunk/sound/pci/cs5535audio/Makefile index a8f75f8dfda9..ccc642269b9e 100644 --- a/trunk/sound/pci/cs5535audio/Makefile +++ b/trunk/sound/pci/cs5535audio/Makefile @@ -3,7 +3,7 @@ # snd-cs5535audio-y := cs5535audio.o cs5535audio_pcm.o -snd-cs5535audio-$(CONFIG_PM_SLEEP) += cs5535audio_pm.o +snd-cs5535audio-$(CONFIG_PM) += cs5535audio_pm.o snd-cs5535audio-$(CONFIG_OLPC) += cs5535audio_olpc.o # Toplevel Module Dependency diff --git a/trunk/sound/pci/cs5535audio/cs5535audio.c b/trunk/sound/pci/cs5535audio/cs5535audio.c index 4915efa551fc..51f64ba5facf 100644 --- a/trunk/sound/pci/cs5535audio/cs5535audio.c +++ b/trunk/sound/pci/cs5535audio/cs5535audio.c @@ -399,7 +399,7 @@ static struct pci_driver cs5535audio_driver = { .id_table = snd_cs5535audio_ids, .probe = snd_cs5535audio_probe, .remove = __devexit_p(snd_cs5535audio_remove), -#ifdef CONFIG_PM_SLEEP +#ifdef CONFIG_PM .driver = { .pm = &snd_cs5535audio_pm, }, diff --git a/trunk/sound/pci/ctxfi/ctatc.c b/trunk/sound/pci/ctxfi/ctatc.c index a2f997a9977a..2f6e9c762d3f 100644 --- a/trunk/sound/pci/ctxfi/ctatc.c +++ b/trunk/sound/pci/ctxfi/ctatc.c @@ -1536,7 +1536,7 @@ static void atc_connect_resources(struct ct_atc *atc) } } -#ifdef CONFIG_PM_SLEEP +#ifdef CONFIG_PM static int atc_suspend(struct ct_atc *atc) { int i; @@ -1647,7 +1647,7 @@ static struct ct_atc atc_preset __devinitdata = { .output_switch_put = atc_output_switch_put, .mic_source_switch_get = atc_mic_source_switch_get, .mic_source_switch_put = atc_mic_source_switch_put, -#ifdef CONFIG_PM_SLEEP +#ifdef CONFIG_PM .suspend = atc_suspend, .resume = atc_resume, #endif diff --git a/trunk/sound/pci/ctxfi/ctatc.h b/trunk/sound/pci/ctxfi/ctatc.h index 69b51f9d345e..653e813ad142 100644 --- a/trunk/sound/pci/ctxfi/ctatc.h +++ b/trunk/sound/pci/ctxfi/ctatc.h @@ -143,7 +143,7 @@ struct ct_atc { struct ct_timer *timer; -#ifdef CONFIG_PM_SLEEP +#ifdef CONFIG_PM int (*suspend)(struct ct_atc *atc); int (*resume)(struct ct_atc *atc); #define NUM_PCMS (NUM_CTALSADEVS - 1) diff --git a/trunk/sound/pci/ctxfi/cthardware.h b/trunk/sound/pci/ctxfi/cthardware.h index 5977e9a24b5c..c56fe533b3f3 100644 --- a/trunk/sound/pci/ctxfi/cthardware.h +++ b/trunk/sound/pci/ctxfi/cthardware.h @@ -72,7 +72,7 @@ struct hw { int (*card_init)(struct hw *hw, struct card_conf *info); int (*card_stop)(struct hw *hw); int (*pll_init)(struct hw *hw, unsigned int rsr); -#ifdef CONFIG_PM_SLEEP +#ifdef CONFIG_PM int (*suspend)(struct hw *hw); int (*resume)(struct hw *hw, struct card_conf *info); #endif diff --git a/trunk/sound/pci/ctxfi/cthw20k1.c b/trunk/sound/pci/ctxfi/cthw20k1.c index 4507f7088b24..dc1969bc67d4 100644 --- a/trunk/sound/pci/ctxfi/cthw20k1.c +++ b/trunk/sound/pci/ctxfi/cthw20k1.c @@ -2085,7 +2085,7 @@ static int hw_card_init(struct hw *hw, struct card_conf *info) return 0; } -#ifdef CONFIG_PM_SLEEP +#ifdef CONFIG_PM static int hw_suspend(struct hw *hw) { struct pci_dev *pci = hw->pci; @@ -2180,7 +2180,7 @@ static struct hw ct20k1_preset __devinitdata = { .is_adc_source_selected = hw_is_adc_input_selected, .select_adc_source = hw_adc_input_select, .capabilities = hw_capabilities, -#ifdef CONFIG_PM_SLEEP +#ifdef CONFIG_PM .suspend = hw_suspend, .resume = hw_resume, #endif diff --git a/trunk/sound/pci/ctxfi/cthw20k2.c b/trunk/sound/pci/ctxfi/cthw20k2.c index b9c9349058bc..9d1231dc4ae2 100644 --- a/trunk/sound/pci/ctxfi/cthw20k2.c +++ b/trunk/sound/pci/ctxfi/cthw20k2.c @@ -2201,7 +2201,7 @@ static int hw_card_init(struct hw *hw, struct card_conf *info) return 0; } -#ifdef CONFIG_PM_SLEEP +#ifdef CONFIG_PM static int hw_suspend(struct hw *hw) { struct pci_dev *pci = hw->pci; @@ -2250,7 +2250,7 @@ static struct hw ct20k2_preset __devinitdata = { .output_switch_put = hw_output_switch_put, .mic_source_switch_get = hw_mic_source_switch_get, .mic_source_switch_put = hw_mic_source_switch_put, -#ifdef CONFIG_PM_SLEEP +#ifdef CONFIG_PM .suspend = hw_suspend, .resume = hw_resume, #endif diff --git a/trunk/sound/pci/ctxfi/ctmixer.c b/trunk/sound/pci/ctxfi/ctmixer.c index 48fe0e39c2be..0cc13eeef8da 100644 --- a/trunk/sound/pci/ctxfi/ctmixer.c +++ b/trunk/sound/pci/ctxfi/ctmixer.c @@ -1118,7 +1118,7 @@ mixer_set_input_right(struct ct_mixer *mixer, return 0; } -#ifdef CONFIG_PM_SLEEP +#ifdef CONFIG_PM static int mixer_resume(struct ct_mixer *mixer) { int i, state; @@ -1188,7 +1188,7 @@ int ct_mixer_create(struct ct_atc *atc, struct ct_mixer **rmixer) mixer->get_output_ports = mixer_get_output_ports; mixer->set_input_left = mixer_set_input_left; mixer->set_input_right = mixer_set_input_right; -#ifdef CONFIG_PM_SLEEP +#ifdef CONFIG_PM mixer->resume = mixer_resume; #endif diff --git a/trunk/sound/pci/ctxfi/ctmixer.h b/trunk/sound/pci/ctxfi/ctmixer.h index be881c639fee..b009e989e77d 100644 --- a/trunk/sound/pci/ctxfi/ctmixer.h +++ b/trunk/sound/pci/ctxfi/ctmixer.h @@ -56,7 +56,7 @@ struct ct_mixer { enum MIXER_PORT_T type, struct rsc *rsc); int (*set_input_right)(struct ct_mixer *mixer, enum MIXER_PORT_T type, struct rsc *rsc); -#ifdef CONFIG_PM_SLEEP +#ifdef CONFIG_PM int (*resume)(struct ct_mixer *mixer); #endif }; diff --git a/trunk/sound/pci/ctxfi/ctpcm.c b/trunk/sound/pci/ctxfi/ctpcm.c index e8a4feb1ed86..2c8622617c8c 100644 --- a/trunk/sound/pci/ctxfi/ctpcm.c +++ b/trunk/sound/pci/ctxfi/ctpcm.c @@ -395,38 +395,12 @@ static struct snd_pcm_ops ct_pcm_capture_ops = { .page = snd_pcm_sgbuf_ops_page, }; -static const struct snd_pcm_chmap_elem surround_map[] = { - { .channels = 1, - .map = { SNDRV_CHMAP_MONO } }, - { .channels = 2, - .map = { SNDRV_CHMAP_RL, SNDRV_CHMAP_RR } }, - { } -}; - -static const struct snd_pcm_chmap_elem clfe_map[] = { - { .channels = 1, - .map = { SNDRV_CHMAP_MONO } }, - { .channels = 2, - .map = { SNDRV_CHMAP_FC, SNDRV_CHMAP_LFE } }, - { } -}; - -static const struct snd_pcm_chmap_elem side_map[] = { - { .channels = 1, - .map = { SNDRV_CHMAP_MONO } }, - { .channels = 2, - .map = { SNDRV_CHMAP_SL, SNDRV_CHMAP_SR } }, - { } -}; - /* Create ALSA pcm device */ int ct_alsa_pcm_create(struct ct_atc *atc, enum CTALSADEVS device, const char *device_name) { struct snd_pcm *pcm; - const struct snd_pcm_chmap_elem *map; - int chs; int err; int playback_count, capture_count; @@ -453,31 +427,7 @@ int ct_alsa_pcm_create(struct ct_atc *atc, snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV_SG, snd_dma_pci_data(atc->pci), 128*1024, 128*1024); - chs = 2; - switch (device) { - case FRONT: - chs = 8; - map = snd_pcm_std_chmaps; - break; - case SURROUND: - map = surround_map; - break; - case CLFE: - map = clfe_map; - break; - case SIDE: - map = side_map; - break; - default: - map = snd_pcm_std_chmaps; - break; - } - err = snd_pcm_add_chmap_ctls(pcm, SNDRV_PCM_STREAM_PLAYBACK, map, chs, - 0, NULL); - if (err < 0) - return err; - -#ifdef CONFIG_PM_SLEEP +#ifdef CONFIG_PM atc->pcms[device] = pcm; #endif diff --git a/trunk/sound/pci/ctxfi/xfi.c b/trunk/sound/pci/ctxfi/xfi.c index 07c07d752fd8..e002183ef8b2 100644 --- a/trunk/sound/pci/ctxfi/xfi.c +++ b/trunk/sound/pci/ctxfi/xfi.c @@ -125,7 +125,7 @@ static void __devexit ct_card_remove(struct pci_dev *pci) pci_set_drvdata(pci, NULL); } -#ifdef CONFIG_PM_SLEEP +#ifdef CONFIG_PM static int ct_card_suspend(struct device *dev) { struct snd_card *card = dev_get_drvdata(dev); diff --git a/trunk/sound/pci/echoaudio/echoaudio.c b/trunk/sound/pci/echoaudio/echoaudio.c index abb0b86c41c9..0ff754f180d0 100644 --- a/trunk/sound/pci/echoaudio/echoaudio.c +++ b/trunk/sound/pci/echoaudio/echoaudio.c @@ -46,7 +46,7 @@ static int get_firmware(const struct firmware **fw_entry, int err; char name[30]; -#ifdef CONFIG_PM_SLEEP +#ifdef CONFIG_PM if (chip->fw_cache[fw_index]) { DE_ACT(("firmware requested: %s is cached\n", card_fw[fw_index].data)); *fw_entry = chip->fw_cache[fw_index]; @@ -59,7 +59,7 @@ static int get_firmware(const struct firmware **fw_entry, err = request_firmware(fw_entry, name, pci_device(chip)); if (err < 0) snd_printk(KERN_ERR "get_firmware(): Firmware not available (%d)\n", err); -#ifdef CONFIG_PM_SLEEP +#ifdef CONFIG_PM else chip->fw_cache[fw_index] = *fw_entry; #endif @@ -70,7 +70,7 @@ static int get_firmware(const struct firmware **fw_entry, static void free_firmware(const struct firmware *fw_entry) { -#ifdef CONFIG_PM_SLEEP +#ifdef CONFIG_PM DE_ACT(("firmware not released (kept in cache)\n")); #else release_firmware(fw_entry); @@ -82,7 +82,7 @@ static void free_firmware(const struct firmware *fw_entry) static void free_firmware_cache(struct echoaudio *chip) { -#ifdef CONFIG_PM_SLEEP +#ifdef CONFIG_PM int i; for (i = 0; i < 8 ; i++) @@ -2203,7 +2203,7 @@ static int __devinit snd_echo_probe(struct pci_dev *pci, -#if defined(CONFIG_PM_SLEEP) +#if defined(CONFIG_PM) static int snd_echo_suspend(struct device *dev) { @@ -2313,7 +2313,7 @@ static SIMPLE_DEV_PM_OPS(snd_echo_pm, snd_echo_suspend, snd_echo_resume); #define SND_ECHO_PM_OPS &snd_echo_pm #else #define SND_ECHO_PM_OPS NULL -#endif /* CONFIG_PM_SLEEP */ +#endif /* CONFIG_PM */ static void __devexit snd_echo_remove(struct pci_dev *pci) diff --git a/trunk/sound/pci/echoaudio/echoaudio.h b/trunk/sound/pci/echoaudio/echoaudio.h index e158369f5faa..1df974dcb5f4 100644 --- a/trunk/sound/pci/echoaudio/echoaudio.h +++ b/trunk/sound/pci/echoaudio/echoaudio.h @@ -449,7 +449,7 @@ struct echoaudio { volatile u32 __iomem *dsp_registers; /* DSP's register base */ u32 active_mask; /* Chs. active mask or * punks out */ -#ifdef CONFIG_PM_SLEEP +#ifdef CONFIG_PM const struct firmware *fw_cache[8]; /* Cached firmwares */ #endif diff --git a/trunk/sound/pci/emu10k1/emu10k1.c b/trunk/sound/pci/emu10k1/emu10k1.c index b7c1875ba90e..ddac4e6d660d 100644 --- a/trunk/sound/pci/emu10k1/emu10k1.c +++ b/trunk/sound/pci/emu10k1/emu10k1.c @@ -206,7 +206,7 @@ static void __devexit snd_card_emu10k1_remove(struct pci_dev *pci) } -#ifdef CONFIG_PM_SLEEP +#ifdef CONFIG_PM static int snd_emu10k1_suspend(struct device *dev) { struct pci_dev *pci = to_pci_dev(dev); @@ -268,7 +268,7 @@ static SIMPLE_DEV_PM_OPS(snd_emu10k1_pm, snd_emu10k1_suspend, snd_emu10k1_resume #define SND_EMU10K1_PM_OPS &snd_emu10k1_pm #else #define SND_EMU10K1_PM_OPS NULL -#endif /* CONFIG_PM_SLEEP */ +#endif /* CONFIG_PM */ static struct pci_driver emu10k1_driver = { .name = KBUILD_MODNAME, diff --git a/trunk/sound/pci/emu10k1/emu10k1_main.c b/trunk/sound/pci/emu10k1/emu10k1_main.c index bed4485f34f6..754924081d0a 100644 --- a/trunk/sound/pci/emu10k1/emu10k1_main.c +++ b/trunk/sound/pci/emu10k1/emu10k1_main.c @@ -1241,7 +1241,7 @@ static int snd_emu10k1_emu1010_init(struct snd_emu10k1 *emu) * Create the EMU10K1 instance */ -#ifdef CONFIG_PM_SLEEP +#ifdef CONFIG_PM static int alloc_pm_buffer(struct snd_emu10k1 *emu); static void free_pm_buffer(struct snd_emu10k1 *emu); #endif @@ -1275,7 +1275,7 @@ static int snd_emu10k1_free(struct snd_emu10k1 *emu) snd_dma_free_pages(&emu->ptb_pages); vfree(emu->page_ptr_table); vfree(emu->page_addr_table); -#ifdef CONFIG_PM_SLEEP +#ifdef CONFIG_PM free_pm_buffer(emu); #endif if (emu->port) @@ -1971,7 +1971,7 @@ int __devinit snd_emu10k1_create(struct snd_card *card, err = snd_emu10k1_init(emu, enable_ir, 0); if (err < 0) goto error; -#ifdef CONFIG_PM_SLEEP +#ifdef CONFIG_PM err = alloc_pm_buffer(emu); if (err < 0) goto error; @@ -2000,7 +2000,7 @@ int __devinit snd_emu10k1_create(struct snd_card *card, return err; } -#ifdef CONFIG_PM_SLEEP +#ifdef CONFIG_PM static unsigned char saved_regs[] = { CPF, PTRX, CVCF, VTFT, Z1, Z2, PSST, DSL, CCCA, CCR, CLP, FXRT, MAPA, MAPB, ENVVOL, ATKHLDV, DCYSUSV, LFOVAL1, ENVVAL, diff --git a/trunk/sound/pci/emu10k1/emu10k1x.c b/trunk/sound/pci/emu10k1/emu10k1x.c index 556fd6f456e3..5c8978b2c4d9 100644 --- a/trunk/sound/pci/emu10k1/emu10k1x.c +++ b/trunk/sound/pci/emu10k1/emu10k1x.c @@ -830,22 +830,9 @@ static irqreturn_t snd_emu10k1x_interrupt(int irq, void *dev_id) return IRQ_HANDLED; } -static const struct snd_pcm_chmap_elem surround_map[] = { - { .channels = 2, - .map = { SNDRV_CHMAP_RL, SNDRV_CHMAP_RR } }, - { } -}; - -static const struct snd_pcm_chmap_elem clfe_map[] = { - { .channels = 2, - .map = { SNDRV_CHMAP_FC, SNDRV_CHMAP_LFE } }, - { } -}; - static int __devinit snd_emu10k1x_pcm(struct emu10k1x *emu, int device, struct snd_pcm **rpcm) { struct snd_pcm *pcm; - const struct snd_pcm_chmap_elem *map = NULL; int err; int capture = 0; @@ -874,15 +861,12 @@ static int __devinit snd_emu10k1x_pcm(struct emu10k1x *emu, int device, struct s switch(device) { case 0: strcpy(pcm->name, "EMU10K1X Front"); - map = snd_pcm_std_chmaps; break; case 1: strcpy(pcm->name, "EMU10K1X Rear"); - map = surround_map; break; case 2: strcpy(pcm->name, "EMU10K1X Center/LFE"); - map = clfe_map; break; } emu->pcm = pcm; @@ -891,11 +875,6 @@ static int __devinit snd_emu10k1x_pcm(struct emu10k1x *emu, int device, struct s snd_dma_pci_data(emu->pci), 32*1024, 32*1024); - err = snd_pcm_add_chmap_ctls(pcm, SNDRV_PCM_STREAM_PLAYBACK, map, 2, - 1 << 2, NULL); - if (err < 0) - return err; - if (rpcm) *rpcm = pcm; diff --git a/trunk/sound/pci/emu10k1/emufx.c b/trunk/sound/pci/emu10k1/emufx.c index 52419959178c..dae4050ede5c 100644 --- a/trunk/sound/pci/emu10k1/emufx.c +++ b/trunk/sound/pci/emu10k1/emufx.c @@ -2646,7 +2646,7 @@ int __devinit snd_emu10k1_fx8010_new(struct snd_emu10k1 *emu, int device, struct return 0; } -#ifdef CONFIG_PM_SLEEP +#ifdef CONFIG_PM int __devinit snd_emu10k1_efx_alloc_pm_buffer(struct snd_emu10k1 *emu) { int len; diff --git a/trunk/sound/pci/emu10k1/memory.c b/trunk/sound/pci/emu10k1/memory.c index ae709c1ab3a8..0a436626182b 100644 --- a/trunk/sound/pci/emu10k1/memory.c +++ b/trunk/sound/pci/emu10k1/memory.c @@ -263,8 +263,8 @@ int snd_emu10k1_memblk_map(struct snd_emu10k1 *emu, struct snd_emu10k1_memblk *b spin_lock_irqsave(&emu->memblk_lock, flags); if (blk->mapped_page >= 0) { /* update order link */ - list_move_tail(&blk->mapped_order_link, - &emu->mapped_order_link_head); + list_del(&blk->mapped_order_link); + list_add_tail(&blk->mapped_order_link, &emu->mapped_order_link_head); spin_unlock_irqrestore(&emu->memblk_lock, flags); return 0; } diff --git a/trunk/sound/pci/emu10k1/p16v.c b/trunk/sound/pci/emu10k1/p16v.c index 88cec6b7dd41..a81dc44228ea 100644 --- a/trunk/sound/pci/emu10k1/p16v.c +++ b/trunk/sound/pci/emu10k1/p16v.c @@ -893,7 +893,7 @@ int __devinit snd_p16v_mixer(struct snd_emu10k1 *emu) return 0; } -#ifdef CONFIG_PM_SLEEP +#ifdef CONFIG_PM #define NUM_CHS 1 /* up to 4, but only first channel is used */ diff --git a/trunk/sound/pci/ens1370.c b/trunk/sound/pci/ens1370.c index 5674cc316530..f7e6f73186e1 100644 --- a/trunk/sound/pci/ens1370.c +++ b/trunk/sound/pci/ens1370.c @@ -55,10 +55,8 @@ #ifdef CHIP1370 #define DRIVER_NAME "ENS1370" -#define CHIP_NAME "ES1370" /* it can be ENS but just to keep compatibility... */ #else #define DRIVER_NAME "ENS1371" -#define CHIP_NAME "ES1371" #endif @@ -1260,14 +1258,6 @@ static struct snd_pcm_ops snd_ensoniq_capture_ops = { .pointer = snd_ensoniq_capture_pointer, }; -static const struct snd_pcm_chmap_elem surround_map[] = { - { .channels = 1, - .map = { SNDRV_CHMAP_MONO } }, - { .channels = 2, - .map = { SNDRV_CHMAP_RL, SNDRV_CHMAP_RR } }, - { } -}; - static int __devinit snd_ensoniq_pcm(struct ensoniq * ensoniq, int device, struct snd_pcm ** rpcm) { @@ -1276,7 +1266,11 @@ static int __devinit snd_ensoniq_pcm(struct ensoniq * ensoniq, int device, if (rpcm) *rpcm = NULL; - err = snd_pcm_new(ensoniq->card, CHIP_NAME "/1", device, 1, 1, &pcm); +#ifdef CHIP1370 + err = snd_pcm_new(ensoniq->card, "ES1370/1", device, 1, 1, &pcm); +#else + err = snd_pcm_new(ensoniq->card, "ES1371/1", device, 1, 1, &pcm); +#endif if (err < 0) return err; @@ -1289,22 +1283,16 @@ static int __devinit snd_ensoniq_pcm(struct ensoniq * ensoniq, int device, pcm->private_data = ensoniq; pcm->info_flags = 0; - strcpy(pcm->name, CHIP_NAME " DAC2/ADC"); +#ifdef CHIP1370 + strcpy(pcm->name, "ES1370 DAC2/ADC"); +#else + strcpy(pcm->name, "ES1371 DAC2/ADC"); +#endif ensoniq->pcm1 = pcm; snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(ensoniq->pci), 64*1024, 128*1024); -#ifdef CHIP1370 - err = snd_pcm_add_chmap_ctls(pcm, SNDRV_PCM_STREAM_PLAYBACK, - surround_map, 2, 0, NULL); -#else - err = snd_pcm_add_chmap_ctls(pcm, SNDRV_PCM_STREAM_PLAYBACK, - snd_pcm_std_chmaps, 2, 0, NULL); -#endif - if (err < 0) - return err; - if (rpcm) *rpcm = pcm; return 0; @@ -1318,7 +1306,11 @@ static int __devinit snd_ensoniq_pcm2(struct ensoniq * ensoniq, int device, if (rpcm) *rpcm = NULL; - err = snd_pcm_new(ensoniq->card, CHIP_NAME "/2", device, 1, 0, &pcm); +#ifdef CHIP1370 + err = snd_pcm_new(ensoniq->card, "ES1370/2", device, 1, 0, &pcm); +#else + err = snd_pcm_new(ensoniq->card, "ES1371/2", device, 1, 0, &pcm); +#endif if (err < 0) return err; @@ -1329,22 +1321,16 @@ static int __devinit snd_ensoniq_pcm2(struct ensoniq * ensoniq, int device, #endif pcm->private_data = ensoniq; pcm->info_flags = 0; - strcpy(pcm->name, CHIP_NAME " DAC1"); +#ifdef CHIP1370 + strcpy(pcm->name, "ES1370 DAC1"); +#else + strcpy(pcm->name, "ES1371 DAC1"); +#endif ensoniq->pcm2 = pcm; snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(ensoniq->pci), 64*1024, 128*1024); -#ifdef CHIP1370 - err = snd_pcm_add_chmap_ctls(pcm, SNDRV_PCM_STREAM_PLAYBACK, - snd_pcm_std_chmaps, 2, 0, NULL); -#else - err = snd_pcm_add_chmap_ctls(pcm, SNDRV_PCM_STREAM_PLAYBACK, - surround_map, 2, 0, NULL); -#endif - if (err < 0) - return err; - if (rpcm) *rpcm = pcm; return 0; @@ -1899,7 +1885,11 @@ static void snd_ensoniq_proc_read(struct snd_info_entry *entry, { struct ensoniq *ensoniq = entry->private_data; - snd_iprintf(buffer, "Ensoniq AudioPCI " CHIP_NAME "\n\n"); +#ifdef CHIP1370 + snd_iprintf(buffer, "Ensoniq AudioPCI ES1370\n\n"); +#else + snd_iprintf(buffer, "Ensoniq AudioPCI ES1371\n\n"); +#endif snd_iprintf(buffer, "Joystick enable : %s\n", ensoniq->ctrl & ES_JYSTK_EN ? "on" : "off"); #ifdef CHIP1370 @@ -2042,7 +2032,7 @@ static void snd_ensoniq_chip_init(struct ensoniq *ensoniq) synchronize_irq(ensoniq->irq); } -#ifdef CONFIG_PM_SLEEP +#ifdef CONFIG_PM static int snd_ensoniq_suspend(struct device *dev) { struct pci_dev *pci = to_pci_dev(dev); @@ -2104,7 +2094,7 @@ static SIMPLE_DEV_PM_OPS(snd_ensoniq_pm, snd_ensoniq_suspend, snd_ensoniq_resume #define SND_ENSONIQ_PM_OPS &snd_ensoniq_pm #else #define SND_ENSONIQ_PM_OPS NULL -#endif /* CONFIG_PM_SLEEP */ +#endif /* CONFIG_PM */ static int __devinit snd_ensoniq_create(struct snd_card *card, struct pci_dev *pci, @@ -2371,7 +2361,11 @@ static int __devinit snd_ensoniq_midi(struct ensoniq * ensoniq, int device, *rrawmidi = NULL; if ((err = snd_rawmidi_new(ensoniq->card, "ES1370/1", device, 1, 1, &rmidi)) < 0) return err; - strcpy(rmidi->name, CHIP_NAME); +#ifdef CHIP1370 + strcpy(rmidi->name, "ES1370"); +#else + strcpy(rmidi->name, "ES1371"); +#endif snd_rawmidi_set_ops(rmidi, SNDRV_RAWMIDI_STREAM_OUTPUT, &snd_ensoniq_midi_output); snd_rawmidi_set_ops(rmidi, SNDRV_RAWMIDI_STREAM_INPUT, &snd_ensoniq_midi_input); rmidi->info_flags |= SNDRV_RAWMIDI_INFO_OUTPUT | SNDRV_RAWMIDI_INFO_INPUT | diff --git a/trunk/sound/pci/es1938.c b/trunk/sound/pci/es1938.c index 394c5d413530..dbb81807bc1a 100644 --- a/trunk/sound/pci/es1938.c +++ b/trunk/sound/pci/es1938.c @@ -236,7 +236,7 @@ struct es1938 { #ifdef SUPPORT_JOYSTICK struct gameport *gameport; #endif -#ifdef CONFIG_PM_SLEEP +#ifdef CONFIG_PM unsigned char saved_regs[SAVED_REG_SIZE]; #endif }; @@ -1456,7 +1456,7 @@ static void snd_es1938_chip_init(struct es1938 *chip) outb(0, SLDM_REG(chip, DMACLEAR)); } -#ifdef CONFIG_PM_SLEEP +#ifdef CONFIG_PM /* * PM support */ @@ -1536,7 +1536,7 @@ static SIMPLE_DEV_PM_OPS(es1938_pm, es1938_suspend, es1938_resume); #define ES1938_PM_OPS &es1938_pm #else #define ES1938_PM_OPS NULL -#endif /* CONFIG_PM_SLEEP */ +#endif /* CONFIG_PM */ #ifdef SUPPORT_JOYSTICK static int __devinit snd_es1938_create_gameport(struct es1938 *chip) diff --git a/trunk/sound/pci/es1968.c b/trunk/sound/pci/es1968.c index 5d0e568fdea1..fb4c90b99c00 100644 --- a/trunk/sound/pci/es1968.c +++ b/trunk/sound/pci/es1968.c @@ -491,7 +491,7 @@ struct esschan { /* linked list */ struct list_head list; -#ifdef CONFIG_PM_SLEEP +#ifdef CONFIG_PM u16 wc_map[4]; #endif }; @@ -544,7 +544,7 @@ struct es1968 { struct list_head substream_list; spinlock_t substream_lock; -#ifdef CONFIG_PM_SLEEP +#ifdef CONFIG_PM u16 apu_map[NR_APUS][NR_APU_REGS]; #endif @@ -706,7 +706,7 @@ static void __apu_set_register(struct es1968 *chip, u16 channel, u8 reg, u16 dat { if (snd_BUG_ON(channel >= NR_APUS)) return; -#ifdef CONFIG_PM_SLEEP +#ifdef CONFIG_PM chip->apu_map[channel][reg] = data; #endif reg |= (channel << 4); @@ -993,7 +993,7 @@ static void snd_es1968_program_wavecache(struct es1968 *chip, struct esschan *es /* set the wavecache control reg */ wave_set_register(chip, es->apu[channel] << 3, tmpval); -#ifdef CONFIG_PM_SLEEP +#ifdef CONFIG_PM es->wc_map[channel] = tmpval; #endif } @@ -2377,7 +2377,7 @@ static void snd_es1968_start_irq(struct es1968 *chip) outw(w, chip->io_port + ESM_PORT_HOST_IRQ); } -#ifdef CONFIG_PM_SLEEP +#ifdef CONFIG_PM /* * PM support */ @@ -2461,7 +2461,7 @@ static SIMPLE_DEV_PM_OPS(es1968_pm, es1968_suspend, es1968_resume); #define ES1968_PM_OPS &es1968_pm #else #define ES1968_PM_OPS NULL -#endif /* CONFIG_PM_SLEEP */ +#endif /* CONFIG_PM */ #ifdef SUPPORT_JOYSTICK #define JOYSTICK_ADDR 0x200 diff --git a/trunk/sound/pci/fm801.c b/trunk/sound/pci/fm801.c index cc2e91d15538..522c8706f244 100644 --- a/trunk/sound/pci/fm801.c +++ b/trunk/sound/pci/fm801.c @@ -205,7 +205,7 @@ struct fm801 { struct snd_tea575x tea; #endif -#ifdef CONFIG_PM_SLEEP +#ifdef CONFIG_PM u16 saved_regs[0x20]; #endif }; @@ -711,13 +711,6 @@ static int __devinit snd_fm801_pcm(struct fm801 *chip, int device, struct snd_pc snd_dma_pci_data(chip->pci), chip->multichannel ? 128*1024 : 64*1024, 128*1024); - err = snd_pcm_add_chmap_ctls(pcm, SNDRV_PCM_STREAM_PLAYBACK, - snd_pcm_alt_chmaps, - chip->multichannel ? 6 : 2, 0, - NULL); - if (err < 0) - return err; - if (rpcm) *rpcm = pcm; return 0; @@ -1368,7 +1361,7 @@ static void __devexit snd_card_fm801_remove(struct pci_dev *pci) pci_set_drvdata(pci, NULL); } -#ifdef CONFIG_PM_SLEEP +#ifdef CONFIG_PM static unsigned char saved_regs[] = { FM801_PCM_VOL, FM801_I2S_VOL, FM801_FM_VOL, FM801_REC_SRC, FM801_PLY_CTRL, FM801_PLY_COUNT, FM801_PLY_BUF1, FM801_PLY_BUF2, @@ -1428,7 +1421,7 @@ static SIMPLE_DEV_PM_OPS(snd_fm801_pm, snd_fm801_suspend, snd_fm801_resume); #define SND_FM801_PM_OPS &snd_fm801_pm #else #define SND_FM801_PM_OPS NULL -#endif /* CONFIG_PM_SLEEP */ +#endif /* CONFIG_PM */ static struct pci_driver fm801_driver = { .name = KBUILD_MODNAME, diff --git a/trunk/sound/pci/hda/Kconfig b/trunk/sound/pci/hda/Kconfig index 7105c3de1bca..194d625c1f83 100644 --- a/trunk/sound/pci/hda/Kconfig +++ b/trunk/sound/pci/hda/Kconfig @@ -228,9 +228,17 @@ config SND_HDA_GENERIC Say Y here to enable the generic HD-audio codec parser in snd-hda-intel driver. +config SND_HDA_POWER_SAVE + bool "Aggressive power-saving on HD-audio" + depends on PM + help + Say Y here to enable more aggressive power-saving mode on + HD-audio driver. The power-saving timeout can be configured + via power_save option or over sysfs on-the-fly. + config SND_HDA_POWER_SAVE_DEFAULT int "Default time-out for HD-audio power-save mode" - depends on PM + depends on SND_HDA_POWER_SAVE default 0 help The default time-out value in seconds for HD-audio automatic diff --git a/trunk/sound/pci/hda/hda_auto_parser.c b/trunk/sound/pci/hda/hda_auto_parser.c index a98e25ebfd63..4f7d2dfcef7b 100644 --- a/trunk/sound/pci/hda/hda_auto_parser.c +++ b/trunk/sound/pci/hda/hda_auto_parser.c @@ -141,6 +141,7 @@ int snd_hda_parse_pin_defcfg(struct hda_codec *codec, memset(sequences_hp, 0, sizeof(sequences_hp)); assoc_line_out = 0; + codec->ignore_misc_bit = true; 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); @@ -156,6 +157,9 @@ int snd_hda_parse_pin_defcfg(struct hda_codec *codec, continue; def_conf = snd_hda_codec_get_pincfg(codec, nid); + if (!(get_defcfg_misc(snd_hda_codec_get_pincfg(codec, nid)) & + AC_DEFCFG_MISC_NO_PRESENCE)) + codec->ignore_misc_bit = false; conn = get_defcfg_connect(def_conf); if (conn == AC_JACK_PORT_NONE) continue; @@ -735,8 +739,7 @@ void snd_hda_pick_fixup(struct hda_codec *codec, for (q = quirk; q->subvendor; q++) { unsigned int vendorid = q->subdevice | (q->subvendor << 16); - unsigned int mask = 0xffff0000 | q->subdevice_mask; - if ((codec->subsystem_id & mask) == (vendorid & mask)) { + if (vendorid == codec->subsystem_id) { id = q->value; #ifdef CONFIG_SND_DEBUG_VERBOSE name = q->name; diff --git a/trunk/sound/pci/hda/hda_codec.c b/trunk/sound/pci/hda/hda_codec.c index 960800b862ab..1c65cc5e3a31 100644 --- a/trunk/sound/pci/hda/hda_codec.c +++ b/trunk/sound/pci/hda/hda_codec.c @@ -94,19 +94,13 @@ int snd_hda_delete_codec_preset(struct hda_codec_preset_list *preset) } EXPORT_SYMBOL_HDA(snd_hda_delete_codec_preset); -#ifdef CONFIG_PM +#ifdef CONFIG_SND_HDA_POWER_SAVE static void hda_power_work(struct work_struct *work); static void hda_keep_power_on(struct hda_codec *codec); #define hda_codec_is_power_on(codec) ((codec)->power_on) -static inline void hda_call_pm_notify(struct hda_bus *bus, bool power_up) -{ - if (bus->ops.pm_notify) - bus->ops.pm_notify(bus, power_up); -} #else static inline void hda_keep_power_on(struct hda_codec *codec) {} #define hda_codec_is_power_on(codec) 1 -#define hda_call_pm_notify(bus, state) {} #endif /** @@ -814,7 +808,7 @@ find_codec_preset(struct hda_codec *codec) { struct hda_codec_preset_list *tbl; const struct hda_codec_preset *preset; - unsigned int mod_requested = 0; + int mod_requested = 0; if (is_generic_config(codec)) return NULL; /* use the generic parser */ @@ -1192,7 +1186,7 @@ static void snd_hda_codec_free(struct hda_codec *codec) return; snd_hda_jack_tbl_clear(codec); restore_init_pincfgs(codec); -#ifdef CONFIG_PM +#ifdef CONFIG_SND_HDA_POWER_SAVE cancel_delayed_work(&codec->power_work); flush_workqueue(codec->bus->workq); #endif @@ -1205,10 +1199,6 @@ static void snd_hda_codec_free(struct hda_codec *codec) codec->bus->caddr_tbl[codec->addr] = NULL; if (codec->patch_ops.free) codec->patch_ops.free(codec); -#ifdef CONFIG_PM - if (!codec->pm_down_notified) /* cancel leftover refcounts */ - hda_call_pm_notify(codec->bus, false); -#endif module_put(codec->owner); free_hda_cache(&codec->amp_cache); free_hda_cache(&codec->cmd_cache); @@ -1222,7 +1212,7 @@ static void snd_hda_codec_free(struct hda_codec *codec) static bool snd_hda_codec_get_supported_ps(struct hda_codec *codec, hda_nid_t fg, unsigned int power_state); -static unsigned int hda_set_power_state(struct hda_codec *codec, +static void hda_set_power_state(struct hda_codec *codec, hda_nid_t fg, unsigned int power_state); /** @@ -1239,7 +1229,6 @@ int /*__devinit*/ snd_hda_codec_new(struct hda_bus *bus, { struct hda_codec *codec; char component[31]; - hda_nid_t fg; int err; if (snd_BUG_ON(!bus)) @@ -1274,7 +1263,7 @@ int /*__devinit*/ snd_hda_codec_new(struct hda_bus *bus, snd_array_init(&codec->conn_lists, sizeof(hda_nid_t), 64); snd_array_init(&codec->spdif_out, sizeof(struct hda_spdif_out), 16); -#ifdef CONFIG_PM +#ifdef CONFIG_SND_HDA_POWER_SAVE spin_lock_init(&codec->power_lock); INIT_DELAYED_WORK(&codec->power_work, hda_power_work); /* snd_hda_codec_new() marks the codec as power-up, and leave it as is. @@ -1282,7 +1271,6 @@ int /*__devinit*/ snd_hda_codec_new(struct hda_bus *bus, * phase. */ hda_keep_power_on(codec); - hda_call_pm_notify(bus, true); #endif if (codec->bus->modelname) { @@ -1316,8 +1304,7 @@ int /*__devinit*/ snd_hda_codec_new(struct hda_bus *bus, goto error; } - fg = codec->afg ? codec->afg : codec->mfg; - err = read_widget_caps(codec, fg); + err = read_widget_caps(codec, codec->afg ? codec->afg : codec->mfg); if (err < 0) { snd_printk(KERN_ERR "hda_codec: cannot malloc\n"); goto error; @@ -1327,22 +1314,20 @@ int /*__devinit*/ snd_hda_codec_new(struct hda_bus *bus, goto error; if (!codec->subsystem_id) { + hda_nid_t nid = codec->afg ? codec->afg : codec->mfg; codec->subsystem_id = - snd_hda_codec_read(codec, fg, 0, + snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_SUBSYSTEM_ID, 0); } -#ifdef CONFIG_PM - codec->d3_stop_clk = snd_hda_codec_get_supported_ps(codec, fg, - AC_PWRST_CLKSTOP); - if (!codec->d3_stop_clk) - bus->power_keep_link_on = 1; -#endif - codec->epss = snd_hda_codec_get_supported_ps(codec, fg, + codec->epss = snd_hda_codec_get_supported_ps(codec, + codec->afg ? codec->afg : codec->mfg, AC_PWRST_EPSS); /* power-up all before initialization */ - hda_set_power_state(codec, AC_PWRST_D0); + hda_set_power_state(codec, + codec->afg ? codec->afg : codec->mfg, + AC_PWRST_D0); snd_hda_codec_proc_new(codec); @@ -2350,7 +2335,7 @@ int snd_hda_codec_reset(struct hda_codec *codec) /* OK, let it free */ -#ifdef CONFIG_PM +#ifdef CONFIG_SND_HDA_POWER_SAVE cancel_delayed_work_sync(&codec->power_work); codec->power_on = 0; codec->power_transition = 0; @@ -3515,6 +3500,20 @@ void snd_hda_codec_set_power_to_all(struct hda_codec *codec, hda_nid_t fg, snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_POWER_STATE, power_state); } + + if (power_state == AC_PWRST_D0) { + unsigned long end_time; + int state; + /* wait until the codec reachs to D0 */ + end_time = jiffies + msecs_to_jiffies(500); + do { + state = snd_hda_codec_read(codec, fg, 0, + AC_VERB_GET_POWER_STATE, 0); + if (state == power_state) + break; + msleep(1); + } while (time_after_eq(end_time, jiffies)); + } } EXPORT_SYMBOL_HDA(snd_hda_codec_set_power_to_all); @@ -3535,41 +3534,19 @@ static bool snd_hda_codec_get_supported_ps(struct hda_codec *codec, hda_nid_t fg } /* - * wait until the state is reached, returns the current state - */ -static unsigned int hda_sync_power_state(struct hda_codec *codec, - hda_nid_t fg, - unsigned int power_state) -{ - unsigned long end_time = jiffies + msecs_to_jiffies(500); - unsigned int state, actual_state; - - for (;;) { - state = snd_hda_codec_read(codec, fg, 0, - AC_VERB_GET_POWER_STATE, 0); - if (state & AC_PWRST_ERROR) - break; - actual_state = (state >> 4) & 0x0f; - if (actual_state == power_state) - break; - if (time_after_eq(jiffies, end_time)) - break; - /* wait until the codec reachs to the target state */ - msleep(1); - } - return state; -} - -/* - * set power state of the codec, and return the power state + * set power state of the codec */ -static unsigned int hda_set_power_state(struct hda_codec *codec, - unsigned int power_state) +static void hda_set_power_state(struct hda_codec *codec, hda_nid_t fg, + unsigned int power_state) { - hda_nid_t fg = codec->afg ? codec->afg : codec->mfg; int count; unsigned int state; + if (codec->patch_ops.set_power_state) { + codec->patch_ops.set_power_state(codec, fg, power_state); + return; + } + /* this delay seems necessary to avoid click noise at power-down */ if (power_state == AC_PWRST_D3) { /* transition time less than 10ms for power down */ @@ -3578,22 +3555,14 @@ static unsigned int hda_set_power_state(struct hda_codec *codec, /* repeat power states setting at most 10 times*/ for (count = 0; count < 10; count++) { - if (codec->patch_ops.set_power_state) - codec->patch_ops.set_power_state(codec, fg, - power_state); - else { - snd_hda_codec_read(codec, fg, 0, - AC_VERB_SET_POWER_STATE, - power_state); - snd_hda_codec_set_power_to_all(codec, fg, power_state, - true); - } - state = hda_sync_power_state(codec, fg, power_state); + snd_hda_codec_read(codec, fg, 0, AC_VERB_SET_POWER_STATE, + power_state); + snd_hda_codec_set_power_to_all(codec, fg, power_state, true); + state = snd_hda_codec_read(codec, fg, 0, + AC_VERB_GET_POWER_STATE, 0); if (!(state & AC_PWRST_ERROR)) break; } - - return state; } #ifdef CONFIG_SND_HDA_HWDEP @@ -3610,16 +3579,16 @@ static inline void hda_exec_init_verbs(struct hda_codec *codec) {} #ifdef CONFIG_PM /* * call suspend and power-down; used both from PM and power-save - * this function returns the power state in the end */ -static unsigned int hda_call_codec_suspend(struct hda_codec *codec) +static void hda_call_codec_suspend(struct hda_codec *codec) { - unsigned int state; - if (codec->patch_ops.suspend) codec->patch_ops.suspend(codec); hda_cleanup_all_streams(codec); - state = hda_set_power_state(codec, AC_PWRST_D3); + hda_set_power_state(codec, + codec->afg ? codec->afg : codec->mfg, + AC_PWRST_D3); +#ifdef CONFIG_SND_HDA_POWER_SAVE cancel_delayed_work(&codec->power_work); spin_lock(&codec->power_lock); snd_hda_update_power_acct(codec); @@ -3628,7 +3597,7 @@ static unsigned int hda_call_codec_suspend(struct hda_codec *codec) codec->power_transition = 0; codec->power_jiffies = jiffies; spin_unlock(&codec->power_lock); - return state; +#endif } /* @@ -3640,7 +3609,9 @@ static void hda_call_codec_resume(struct hda_codec *codec) * in the resume / power-save sequence */ hda_keep_power_on(codec); - hda_set_power_state(codec, AC_PWRST_D0); + hda_set_power_state(codec, + codec->afg ? codec->afg : codec->mfg, + AC_PWRST_D0); restore_pincfgs(codec); /* restore all current pin configs */ restore_shutup_pins(codec); hda_exec_init_verbs(codec); @@ -3653,7 +3624,6 @@ static void hda_call_codec_resume(struct hda_codec *codec) snd_hda_codec_resume_amp(codec); snd_hda_codec_resume_cache(codec); } - snd_hda_jack_report_sync(codec); snd_hda_power_down(codec); /* flag down before returning */ } #endif /* CONFIG_PM */ @@ -3688,36 +3658,6 @@ int /*__devinit*/ snd_hda_build_controls(struct hda_bus *bus) } EXPORT_SYMBOL_HDA(snd_hda_build_controls); -/* - * add standard channel maps if not specified - */ -static int add_std_chmaps(struct hda_codec *codec) -{ - int i, str, err; - - for (i = 0; i < codec->num_pcms; i++) { - for (str = 0; str < 2; str++) { - struct snd_pcm *pcm = codec->pcm_info[i].pcm; - struct hda_pcm_stream *hinfo = - &codec->pcm_info[i].stream[str]; - struct snd_pcm_chmap *chmap; - - if (codec->pcm_info[i].own_chmap) - continue; - if (!pcm || !hinfo->substreams) - continue; - err = snd_pcm_add_chmap_ctls(pcm, str, - snd_pcm_std_chmaps, - hinfo->channels_max, - 0, &chmap); - if (err < 0) - return err; - chmap->channel_mask = SND_PCM_CHMAP_MASK_2468; - } - } - return 0; -} - int snd_hda_codec_build_controls(struct hda_codec *codec) { int err = 0; @@ -3729,13 +3669,6 @@ int snd_hda_codec_build_controls(struct hda_codec *codec) err = codec->patch_ops.build_controls(codec); if (err < 0) return err; - - /* we create chmaps here instead of build_pcms */ - err = add_std_chmaps(codec); - if (err < 0) - return err; - - snd_hda_jack_report_sync(codec); /* call at the last init point */ return 0; } @@ -4278,7 +4211,7 @@ int snd_hda_codec_build_pcms(struct hda_codec *codec) * * This function returns 0 if successful, or a negative error code. */ -int snd_hda_build_pcms(struct hda_bus *bus) +int __devinit snd_hda_build_pcms(struct hda_bus *bus) { struct hda_codec *codec; @@ -4458,13 +4391,12 @@ int snd_hda_add_new_ctls(struct hda_codec *codec, } EXPORT_SYMBOL_HDA(snd_hda_add_new_ctls); -#ifdef CONFIG_PM +#ifdef CONFIG_SND_HDA_POWER_SAVE static void hda_power_work(struct work_struct *work) { struct hda_codec *codec = container_of(work, struct hda_codec, power_work.work); struct hda_bus *bus = codec->bus; - unsigned int state; spin_lock(&codec->power_lock); if (codec->power_transition > 0) { /* during power-up sequence? */ @@ -4478,12 +4410,9 @@ static void hda_power_work(struct work_struct *work) } spin_unlock(&codec->power_lock); - state = hda_call_codec_suspend(codec); - codec->pm_down_notified = 0; - if (!bus->power_keep_link_on && (state & AC_PWRST_CLK_STOP_OK)) { - codec->pm_down_notified = 1; - hda_call_pm_notify(bus, false); - } + hda_call_codec_suspend(codec); + if (bus->ops.pm_notify) + bus->ops.pm_notify(bus); } static void hda_keep_power_on(struct hda_codec *codec) @@ -4509,16 +4438,19 @@ void snd_hda_update_power_acct(struct hda_codec *codec) /* Transition to powered up, if wait_power_down then wait for a pending * transition to D3 to complete. A pending D3 transition is indicated * with power_transition == -1. */ -/* call this with codec->power_lock held! */ static void __snd_hda_power_up(struct hda_codec *codec, bool wait_power_down) { struct hda_bus *bus = codec->bus; + spin_lock(&codec->power_lock); + codec->power_count++; /* Return if power_on or transitioning to power_on, unless currently * powering down. */ if ((codec->power_on || codec->power_transition > 0) && - !(wait_power_down && codec->power_transition < 0)) + !(wait_power_down && codec->power_transition < 0)) { + spin_unlock(&codec->power_lock); return; + } spin_unlock(&codec->power_lock); cancel_delayed_work_sync(&codec->power_work); @@ -4530,9 +4462,9 @@ static void __snd_hda_power_up(struct hda_codec *codec, bool wait_power_down) if (codec->power_on) { if (codec->power_transition < 0) codec->power_transition = 0; + spin_unlock(&codec->power_lock); return; } - trace_hda_power_up(codec); snd_hda_update_power_acct(codec); codec->power_on = 1; @@ -4540,54 +4472,71 @@ static void __snd_hda_power_up(struct hda_codec *codec, bool wait_power_down) codec->power_transition = 1; /* avoid reentrance */ spin_unlock(&codec->power_lock); - if (codec->pm_down_notified) { - codec->pm_down_notified = 0; - hda_call_pm_notify(bus, true); - } - + if (bus->ops.pm_notify) + bus->ops.pm_notify(bus); hda_call_codec_resume(codec); spin_lock(&codec->power_lock); codec->power_transition = 0; + spin_unlock(&codec->power_lock); } -#define power_save(codec) \ - ((codec)->bus->power_save ? *(codec)->bus->power_save : 0) - -/* Transition to powered down */ -static void __snd_hda_power_down(struct hda_codec *codec) +/** + * snd_hda_power_up - Power-up the codec + * @codec: HD-audio codec + * + * Increment the power-up counter and power up the hardware really when + * not turned on yet. + */ +void snd_hda_power_up(struct hda_codec *codec) { - if (!codec->power_on || codec->power_count || codec->power_transition) - return; + __snd_hda_power_up(codec, false); +} +EXPORT_SYMBOL_HDA(snd_hda_power_up); - if (power_save(codec)) { - codec->power_transition = -1; /* avoid reentrance */ - queue_delayed_work(codec->bus->workq, &codec->power_work, - msecs_to_jiffies(power_save(codec) * 1000)); - } +/** + * snd_hda_power_up_d3wait - Power-up the codec after waiting for any pending + * D3 transition to complete. This differs from snd_hda_power_up() when + * power_transition == -1. snd_hda_power_up sees this case as a nop, + * snd_hda_power_up_d3wait waits for the D3 transition to complete then powers + * back up. + * @codec: HD-audio codec + * + * Cancel any power down operation hapenning on the work queue, then power up. + */ +void snd_hda_power_up_d3wait(struct hda_codec *codec) +{ + /* This will cancel and wait for pending power_work to complete. */ + __snd_hda_power_up(codec, true); } +EXPORT_SYMBOL_HDA(snd_hda_power_up_d3wait); + +#define power_save(codec) \ + ((codec)->bus->power_save ? *(codec)->bus->power_save : 0) /** - * snd_hda_power_save - Power-up/down/sync the codec + * snd_hda_power_down - Power-down the codec * @codec: HD-audio codec - * @delta: the counter delta to change * - * Change the power-up counter via @delta, and power up or down the hardware - * appropriately. For the power-down, queue to the delayed action. - * Passing zero to @delta means to synchronize the power state. + * Decrement the power-up counter and schedules the power-off work if + * the counter rearches to zero. */ -void snd_hda_power_save(struct hda_codec *codec, int delta, bool d3wait) +void snd_hda_power_down(struct hda_codec *codec) { spin_lock(&codec->power_lock); - codec->power_count += delta; - trace_hda_power_count(codec); - if (delta > 0) - __snd_hda_power_up(codec, d3wait); - else - __snd_hda_power_down(codec); + --codec->power_count; + if (!codec->power_on || codec->power_count || codec->power_transition) { + spin_unlock(&codec->power_lock); + return; + } + if (power_save(codec)) { + codec->power_transition = -1; /* avoid reentrance */ + queue_delayed_work(codec->bus->workq, &codec->power_work, + msecs_to_jiffies(power_save(codec) * 1000)); + } spin_unlock(&codec->power_lock); } -EXPORT_SYMBOL_HDA(snd_hda_power_save); +EXPORT_SYMBOL_HDA(snd_hda_power_down); /** * snd_hda_check_amp_list_power - Check the amp list and update the power @@ -5138,6 +5087,9 @@ EXPORT_SYMBOL_HDA(snd_hda_suspend); * @bus: the HDA bus * * Returns 0 if successful. + * + * This function is defined only when POWER_SAVE isn't set. + * In the power-save mode, the codec is resumed dynamically. */ int snd_hda_resume(struct hda_bus *bus) { diff --git a/trunk/sound/pci/hda/hda_codec.h b/trunk/sound/pci/hda/hda_codec.h index 507fe8a917b6..e5a7e19a8071 100644 --- a/trunk/sound/pci/hda/hda_codec.h +++ b/trunk/sound/pci/hda/hda_codec.h @@ -386,10 +386,6 @@ enum { /* DIGITAL2 bits */ #define AC_DIG2_CC (0x7f<<0) -/* DIGITAL3 bits */ -#define AC_DIG3_ICT (0xf<<0) -#define AC_DIG3_KAE (1<<7) - /* Pin widget control - 8bit */ #define AC_PINCTL_EPT (0x3<<0) #define AC_PINCTL_EPT_NATIVE 0 @@ -614,9 +610,9 @@ struct hda_bus_ops { struct hda_pcm *pcm); /* reset bus for retry verb */ void (*bus_reset)(struct hda_bus *bus); -#ifdef CONFIG_PM +#ifdef CONFIG_SND_HDA_POWER_SAVE /* notify power-up/down from codec to controller */ - void (*pm_notify)(struct hda_bus *bus, bool power_up); + void (*pm_notify)(struct hda_bus *bus); #endif }; @@ -712,6 +708,8 @@ struct hda_codec_ops { #ifdef CONFIG_PM int (*suspend)(struct hda_codec *codec); int (*resume)(struct hda_codec *codec); +#endif +#ifdef CONFIG_SND_HDA_POWER_SAVE int (*check_power_status)(struct hda_codec *codec, hda_nid_t nid); #endif void (*reboot_notify)(struct hda_codec *codec); @@ -776,7 +774,6 @@ struct hda_pcm { unsigned int pcm_type; /* HDA_PCM_TYPE_XXX */ int device; /* device number to assign */ struct snd_pcm *pcm; /* assigned PCM instance */ - bool own_chmap; /* codec driver provides own channel maps */ }; /* codec information */ @@ -862,13 +859,12 @@ struct hda_codec { unsigned int no_sticky_stream:1; /* no sticky-PCM stream assignment */ unsigned int pins_shutup:1; /* pins are shut up */ unsigned int no_trigger_sense:1; /* don't trigger at pin-sensing */ + unsigned int ignore_misc_bit:1; /* ignore MISC_NO_PRESENCE bit */ unsigned int no_jack_detect:1; /* Machine has no jack-detection */ unsigned int pcm_format_first:1; /* PCM format must be set first */ unsigned int epss:1; /* supporting EPSS? */ -#ifdef CONFIG_PM +#ifdef CONFIG_SND_HDA_POWER_SAVE unsigned int power_on :1; /* current (global) power-state */ - unsigned int d3_stop_clk:1; /* support D3 operation without BCLK */ - unsigned int pm_down_notified:1; /* PM notified to controller */ int power_transition; /* power-state in transition */ int power_count; /* current (global) power refcount */ struct delayed_work power_work; /* delayed task for powerdown */ @@ -1046,7 +1042,7 @@ int snd_hda_resume(struct hda_bus *bus); static inline int hda_call_check_power_status(struct hda_codec *codec, hda_nid_t nid) { -#ifdef CONFIG_PM +#ifdef CONFIG_SND_HDA_POWER_SAVE if (codec->patch_ops.check_power_status) return codec->patch_ops.check_power_status(codec, nid); #endif @@ -1063,70 +1059,22 @@ const char *snd_hda_get_jack_location(u32 cfg); /* * power saving */ -#ifdef CONFIG_PM -void snd_hda_power_save(struct hda_codec *codec, int delta, bool d3wait); +#ifdef CONFIG_SND_HDA_POWER_SAVE +void snd_hda_power_up(struct hda_codec *codec); +void snd_hda_power_up_d3wait(struct hda_codec *codec); +void snd_hda_power_down(struct hda_codec *codec); void snd_hda_update_power_acct(struct hda_codec *codec); #else -static inline void snd_hda_power_save(struct hda_codec *codec, int delta, - bool d3wait) {} +static inline void snd_hda_power_up(struct hda_codec *codec) {} +static inline void snd_hda_power_up_d3wait(struct hda_codec *codec) {} +static inline void snd_hda_power_down(struct hda_codec *codec) {} #endif -/** - * snd_hda_power_up - Power-up the codec - * @codec: HD-audio codec - * - * Increment the power-up counter and power up the hardware really when - * not turned on yet. - */ -static inline void snd_hda_power_up(struct hda_codec *codec) -{ - snd_hda_power_save(codec, 1, false); -} - -/** - * snd_hda_power_up_d3wait - Power-up the codec after waiting for any pending - * D3 transition to complete. This differs from snd_hda_power_up() when - * power_transition == -1. snd_hda_power_up sees this case as a nop, - * snd_hda_power_up_d3wait waits for the D3 transition to complete then powers - * back up. - * @codec: HD-audio codec - * - * Cancel any power down operation hapenning on the work queue, then power up. - */ -static inline void snd_hda_power_up_d3wait(struct hda_codec *codec) -{ - snd_hda_power_save(codec, 1, true); -} - -/** - * snd_hda_power_down - Power-down the codec - * @codec: HD-audio codec - * - * Decrement the power-up counter and schedules the power-off work if - * the counter rearches to zero. - */ -static inline void snd_hda_power_down(struct hda_codec *codec) -{ - snd_hda_power_save(codec, -1, false); -} - -/** - * snd_hda_power_sync - Synchronize the power-save status - * @codec: HD-audio codec - * - * Synchronize the actual power state with the power account; - * called when power_save parameter is changed - */ -static inline void snd_hda_power_sync(struct hda_codec *codec) -{ - snd_hda_power_save(codec, 0, false); -} - #ifdef CONFIG_SND_HDA_PATCH_LOADER /* * patch firmware */ -int snd_hda_load_patch(struct hda_bus *bus, size_t size, const void *buf); +int snd_hda_load_patch(struct hda_bus *bus, const char *patch); #endif /* diff --git a/trunk/sound/pci/hda/hda_generic.c b/trunk/sound/pci/hda/hda_generic.c index b81d3d0b952d..431bf868711e 100644 --- a/trunk/sound/pci/hda/hda_generic.c +++ b/trunk/sound/pci/hda/hda_generic.c @@ -70,7 +70,7 @@ struct hda_gspec { struct list_head nid_list; /* list of widgets */ -#ifdef CONFIG_PM +#ifdef CONFIG_SND_HDA_POWER_SAVE #define MAX_LOOPBACK_AMPS 7 struct hda_loopback_check loopback; int num_loopbacks; @@ -654,7 +654,7 @@ static int parse_input(struct hda_codec *codec) return 0; } -#ifdef CONFIG_PM +#ifdef CONFIG_SND_HDA_POWER_SAVE static void add_input_loopback(struct hda_codec *codec, hda_nid_t nid, int dir, int idx) { @@ -1028,7 +1028,7 @@ static int build_generic_pcms(struct hda_codec *codec) return 0; } -#ifdef CONFIG_PM +#ifdef CONFIG_SND_HDA_POWER_SAVE static int generic_check_power_status(struct hda_codec *codec, hda_nid_t nid) { struct hda_gspec *spec = codec->spec; @@ -1043,7 +1043,7 @@ static struct hda_codec_ops generic_patch_ops = { .build_controls = build_generic_controls, .build_pcms = build_generic_pcms, .free = snd_hda_generic_free, -#ifdef CONFIG_PM +#ifdef CONFIG_SND_HDA_POWER_SAVE .check_power_status = generic_check_power_status, #endif }; diff --git a/trunk/sound/pci/hda/hda_hwdep.c b/trunk/sound/pci/hda/hda_hwdep.c index 1af86d40eb23..6b2efb8cb1f9 100644 --- a/trunk/sound/pci/hda/hda_hwdep.c +++ b/trunk/sound/pci/hda/hda_hwdep.c @@ -25,6 +25,7 @@ #include #include #include +#include #include #include #include "hda_codec.h" @@ -155,7 +156,7 @@ int /*__devinit*/ snd_hda_create_hwdep(struct hda_codec *codec) return 0; } -#ifdef CONFIG_PM +#ifdef CONFIG_SND_HDA_POWER_SAVE static ssize_t power_on_acct_show(struct device *dev, struct device_attribute *attr, char *buf) @@ -191,7 +192,7 @@ int snd_hda_hwdep_add_power_sysfs(struct hda_codec *codec) hwdep->device, &power_attrs[i]); return 0; } -#endif /* CONFIG_PM */ +#endif /* CONFIG_SND_HDA_POWER_SAVE */ #ifdef CONFIG_SND_HDA_RECONFIG @@ -746,21 +747,18 @@ static int parse_line_mode(char *buf, struct hda_bus *bus) * * the spaces at the beginning and the end of the line are stripped */ -static int get_line_from_fw(char *buf, int size, size_t *fw_size_p, - const void **fw_data_p) +static int get_line_from_fw(char *buf, int size, struct firmware *fw) { int len; - size_t fw_size = *fw_size_p; - const char *p = *fw_data_p; - - while (isspace(*p) && fw_size) { + const char *p = fw->data; + while (isspace(*p) && fw->size) { p++; - fw_size--; + fw->size--; } - if (!fw_size) + if (!fw->size) return 0; - for (len = 0; len < fw_size; len++) { + for (len = 0; len < fw->size; len++) { if (!*p) break; if (*p == '\n') { @@ -772,8 +770,8 @@ static int get_line_from_fw(char *buf, int size, size_t *fw_size_p, *buf++ = *p++; } *buf = 0; - *fw_size_p = fw_size - len; - *fw_data_p = p; + fw->size -= len; + fw->data = p; remove_trail_spaces(buf); return 1; } @@ -781,15 +779,29 @@ static int get_line_from_fw(char *buf, int size, size_t *fw_size_p, /* * load a "patch" firmware file and parse it */ -int snd_hda_load_patch(struct hda_bus *bus, size_t fw_size, const void *fw_buf) +int snd_hda_load_patch(struct hda_bus *bus, const char *patch) { + int err; + const struct firmware *fw; + struct firmware tmp; char buf[128]; struct hda_codec *codec; int line_mode; + struct device *dev = bus->card->dev; + + if (snd_BUG_ON(!dev)) + return -ENODEV; + err = request_firmware(&fw, patch, dev); + if (err < 0) { + printk(KERN_ERR "hda-codec: Cannot load the patch '%s'\n", + patch); + return err; + } + tmp = *fw; line_mode = LINE_MODE_NONE; codec = NULL; - while (get_line_from_fw(buf, sizeof(buf) - 1, &fw_size, &fw_buf)) { + while (get_line_from_fw(buf, sizeof(buf) - 1, &tmp)) { if (!*buf || *buf == '#' || *buf == '\n') continue; if (*buf == '[') @@ -798,6 +810,7 @@ int snd_hda_load_patch(struct hda_bus *bus, size_t fw_size, const void *fw_buf) (codec || !patch_items[line_mode].need_codec)) patch_items[line_mode].parser(buf, bus, &codec); } + release_firmware(fw); return 0; } EXPORT_SYMBOL_HDA(snd_hda_load_patch); diff --git a/trunk/sound/pci/hda/hda_intel.c b/trunk/sound/pci/hda/hda_intel.c index f09ff6c14041..c4763c52eaf6 100644 --- a/trunk/sound/pci/hda/hda_intel.c +++ b/trunk/sound/pci/hda/hda_intel.c @@ -46,7 +46,6 @@ #include #include #include -#include #ifdef CONFIG_X86 /* for snoop control */ #include @@ -56,7 +55,6 @@ #include #include #include -#include #include "hda_codec.h" @@ -64,7 +62,7 @@ static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; static char *model[SNDRV_CARDS]; -static int position_fix[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS-1)] = -1}; +static int position_fix[SNDRV_CARDS]; static int bdl_pos_adj[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS-1)] = -1}; static int probe_mask[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS-1)] = -1}; static int probe_only[SNDRV_CARDS]; @@ -88,7 +86,7 @@ module_param_array(model, charp, NULL, 0444); MODULE_PARM_DESC(model, "Use the given board model."); module_param_array(position_fix, int, NULL, 0444); MODULE_PARM_DESC(position_fix, "DMA pointer read method." - "(-1 = system default, 0 = auto, 1 = LPIB, 2 = POSBUF, 3 = VIACOMBO, 4 = COMBO)."); + "(0 = auto, 1 = LPIB, 2 = POSBUF, 3 = VIACOMBO, 4 = COMBO)."); module_param_array(bdl_pos_adj, int, NULL, 0644); MODULE_PARM_DESC(bdl_pos_adj, "BDL position adjustment offset."); module_param_array(probe_mask, int, NULL, 0444); @@ -110,16 +108,9 @@ MODULE_PARM_DESC(beep_mode, "Select HDA Beep registration mode " "(0=off, 1=on) (default=1)."); #endif -#ifdef CONFIG_PM -static int param_set_xint(const char *val, const struct kernel_param *kp); -static struct kernel_param_ops param_ops_xint = { - .set = param_set_xint, - .get = param_get_int, -}; -#define param_check_xint param_check_int - +#ifdef CONFIG_SND_HDA_POWER_SAVE static int power_save = CONFIG_SND_HDA_POWER_SAVE_DEFAULT; -module_param(power_save, xint, 0644); +module_param(power_save, int, 0644); MODULE_PARM_DESC(power_save, "Automatic power-saving timeout " "(in second, 0 = disable)."); @@ -130,7 +121,7 @@ MODULE_PARM_DESC(power_save, "Automatic power-saving timeout " static bool power_save_controller = 1; module_param(power_save_controller, bool, 0644); MODULE_PARM_DESC(power_save_controller, "Reset controller in power save mode."); -#endif /* CONFIG_PM */ +#endif static int align_buffer_size = -1; module_param(align_buffer_size, bint, 0644); @@ -415,7 +406,6 @@ struct azx_dev { */ unsigned int insufficient :1; unsigned int wc_marked:1; - unsigned int no_period_wakeup:1; }; /* CORB/RIRB */ @@ -481,10 +471,6 @@ struct azx { struct snd_dma_buffer rb; struct snd_dma_buffer posbuf; -#ifdef CONFIG_SND_HDA_PATCH_LOADER - const struct firmware *fw; -#endif - /* flags */ int position_fix[2]; /* for both playback/capture streams */ int poll_count; @@ -512,9 +498,6 @@ struct azx { /* reboot notifier (for mysterious hangup problem at power-down) */ struct notifier_block reboot_notifier; - - /* card list (for power_save trigger) */ - struct list_head list; }; /* driver types */ @@ -555,7 +538,6 @@ enum { #define AZX_DCAPS_ALIGN_BUFSIZE (1 << 22) /* buffer size alignment */ #define AZX_DCAPS_4K_BDLE_BOUNDARY (1 << 23) /* BDLE in 4k boundary */ #define AZX_DCAPS_POSFIX_COMBO (1 << 24) /* Use COMBO as default */ -#define AZX_DCAPS_COUNT_LPIB_DELAY (1 << 25) /* Take LPIB as delay */ /* quirks for ATI SB / AMD Hudson */ #define AZX_DCAPS_PRESET_ATI_SB \ @@ -578,17 +560,13 @@ enum { * VGA-switcher support */ #ifdef SUPPORT_VGA_SWITCHEROO -#define use_vga_switcheroo(chip) ((chip)->use_vga_switcheroo) -#else -#define use_vga_switcheroo(chip) 0 -#endif - -#if defined(SUPPORT_VGA_SWITCHEROO) || defined(CONFIG_SND_HDA_PATCH_LOADER) #define DELAYED_INIT_MARK #define DELAYED_INITDATA_MARK +#define use_vga_switcheroo(chip) ((chip)->use_vga_switcheroo) #else #define DELAYED_INIT_MARK __devinit #define DELAYED_INITDATA_MARK __devinitdata +#define use_vga_switcheroo(chip) 0 #endif static char *driver_short_names[] DELAYED_INITDATA_MARK = { @@ -1034,8 +1012,8 @@ static unsigned int azx_get_response(struct hda_bus *bus, return azx_rirb_get_response(bus, addr); } -#ifdef CONFIG_PM -static void azx_power_notify(struct hda_bus *bus, bool power_up); +#ifdef CONFIG_SND_HDA_POWER_SAVE +static void azx_power_notify(struct hda_bus *bus); #endif /* reset codec link */ @@ -1291,11 +1269,6 @@ static irqreturn_t azx_interrupt(int irq, void *dev_id) u8 sd_status; int i, ok; -#ifdef CONFIG_PM_RUNTIME - if (chip->pci->dev.power.runtime_status != RPM_ACTIVE) - return IRQ_NONE; -#endif - spin_lock(&chip->reg_lock); if (chip->disabled) { @@ -1421,7 +1394,7 @@ static int azx_setup_periods(struct azx *chip, ofs = 0; azx_dev->frags = 0; pos_adj = bdl_pos_adj[chip->dev_index]; - if (!azx_dev->no_period_wakeup && pos_adj > 0) { + if (pos_adj > 0) { struct snd_pcm_runtime *runtime = substream->runtime; int pos_align = pos_adj; pos_adj = (pos_adj * runtime->rate + 47999) / 48000; @@ -1437,7 +1410,8 @@ static int azx_setup_periods(struct azx *chip, pos_adj = 0; } else { ofs = setup_bdle(chip, substream, azx_dev, - &bdl, ofs, pos_adj, true); + &bdl, ofs, pos_adj, + !substream->runtime->no_period_wakeup); if (ofs < 0) goto error; } @@ -1450,7 +1424,7 @@ static int azx_setup_periods(struct azx *chip, else ofs = setup_bdle(chip, substream, azx_dev, &bdl, ofs, period_bytes, - !azx_dev->no_period_wakeup); + !substream->runtime->no_period_wakeup); if (ofs < 0) goto error; } @@ -1606,7 +1580,7 @@ static int DELAYED_INIT_MARK azx_codec_create(struct azx *chip, const char *mode bus_temp.ops.get_response = azx_get_response; bus_temp.ops.attach_pcm = azx_attach_pcm_stream; bus_temp.ops.bus_reset = azx_bus_reset; -#ifdef CONFIG_PM +#ifdef CONFIG_SND_HDA_POWER_SAVE bus_temp.power_save = &power_save; bus_temp.ops.pm_notify = azx_power_notify; #endif @@ -1923,12 +1897,10 @@ static int azx_pcm_prepare(struct snd_pcm_substream *substream) if (bufsize != azx_dev->bufsize || period_bytes != azx_dev->period_bytes || - format_val != azx_dev->format_val || - runtime->no_period_wakeup != azx_dev->no_period_wakeup) { + format_val != azx_dev->format_val) { azx_dev->bufsize = bufsize; azx_dev->period_bytes = period_bytes; azx_dev->format_val = format_val; - azx_dev->no_period_wakeup = runtime->no_period_wakeup; err = azx_setup_periods(chip, substream, azx_dev); if (err < 0) return err; @@ -1987,14 +1959,14 @@ static int azx_pcm_trigger(struct snd_pcm_substream *substream, int cmd) } spin_lock(&chip->reg_lock); - - /* first, set SYNC bits of corresponding streams */ - if (chip->driver_caps & AZX_DCAPS_OLD_SSYNC) - azx_writel(chip, OLD_SSYNC, - azx_readl(chip, OLD_SSYNC) | sbits); - else - azx_writel(chip, SSYNC, azx_readl(chip, SSYNC) | sbits); - + if (nsync > 1) { + /* first, set SYNC bits of corresponding streams */ + if (chip->driver_caps & AZX_DCAPS_OLD_SSYNC) + azx_writel(chip, OLD_SSYNC, + azx_readl(chip, OLD_SSYNC) | sbits); + else + azx_writel(chip, SSYNC, azx_readl(chip, SSYNC) | sbits); + } snd_pcm_group_for_each_entry(s, substream) { if (s->pcm->card != substream->pcm->card) continue; @@ -2012,6 +1984,8 @@ static int azx_pcm_trigger(struct snd_pcm_substream *substream, int cmd) } spin_unlock(&chip->reg_lock); if (start) { + if (nsync == 1) + return 0; /* wait until all FIFOs get ready */ for (timeout = 5000; timeout; timeout--) { nwait = 0; @@ -2044,14 +2018,16 @@ static int azx_pcm_trigger(struct snd_pcm_substream *substream, int cmd) cpu_relax(); } } - spin_lock(&chip->reg_lock); - /* reset SYNC bits */ - if (chip->driver_caps & AZX_DCAPS_OLD_SSYNC) - azx_writel(chip, OLD_SSYNC, - azx_readl(chip, OLD_SSYNC) & ~sbits); - else - azx_writel(chip, SSYNC, azx_readl(chip, SSYNC) & ~sbits); - spin_unlock(&chip->reg_lock); + if (nsync > 1) { + spin_lock(&chip->reg_lock); + /* reset SYNC bits */ + if (chip->driver_caps & AZX_DCAPS_OLD_SSYNC) + azx_writel(chip, OLD_SSYNC, + azx_readl(chip, OLD_SSYNC) & ~sbits); + else + azx_writel(chip, SSYNC, azx_readl(chip, SSYNC) & ~sbits); + spin_unlock(&chip->reg_lock); + } return 0; } @@ -2144,27 +2120,6 @@ static unsigned int azx_get_position(struct azx *chip, if (pos >= azx_dev->bufsize) pos = 0; - - /* calculate runtime delay from LPIB */ - if (azx_dev->substream->runtime && - chip->position_fix[stream] == POS_FIX_POSBUF && - (chip->driver_caps & AZX_DCAPS_COUNT_LPIB_DELAY)) { - unsigned int lpib_pos = azx_sd_readl(azx_dev, SD_LPIB); - int delay; - if (stream == SNDRV_PCM_STREAM_PLAYBACK) - delay = pos - lpib_pos; - else - delay = lpib_pos - pos; - if (delay < 0) - delay += azx_dev->bufsize; - if (delay >= azx_dev->period_bytes) { - snd_printdd("delay %d > period_bytes %d\n", - delay, azx_dev->period_bytes); - delay = 0; /* something is wrong */ - } - azx_dev->substream->runtime->delay = - bytes_to_frames(azx_dev->substream->runtime, delay); - } return pos; } @@ -2424,65 +2379,33 @@ static void azx_stop_chip(struct azx *chip) chip->initialized = 0; } -#ifdef CONFIG_PM +#ifdef CONFIG_SND_HDA_POWER_SAVE /* power-up/down the controller */ -static void azx_power_notify(struct hda_bus *bus, bool power_up) +static void azx_power_notify(struct hda_bus *bus) { struct azx *chip = bus->private_data; - - if (power_up) - pm_runtime_get_sync(&chip->pci->dev); - else - pm_runtime_put_sync(&chip->pci->dev); -} - -static DEFINE_MUTEX(card_list_lock); -static LIST_HEAD(card_list); - -static void azx_add_card_list(struct azx *chip) -{ - mutex_lock(&card_list_lock); - list_add(&chip->list, &card_list); - mutex_unlock(&card_list_lock); -} - -static void azx_del_card_list(struct azx *chip) -{ - mutex_lock(&card_list_lock); - list_del_init(&chip->list); - mutex_unlock(&card_list_lock); -} - -/* trigger power-save check at writing parameter */ -static int param_set_xint(const char *val, const struct kernel_param *kp) -{ - struct azx *chip; struct hda_codec *c; - int prev = power_save; - int ret = param_set_int(val, kp); - - if (ret || prev == power_save) - return ret; + int power_on = 0; - mutex_lock(&card_list_lock); - list_for_each_entry(chip, &card_list, list) { - if (!chip->bus || chip->disabled) - continue; - list_for_each_entry(c, &chip->bus->codec_list, list) - snd_hda_power_sync(c); + list_for_each_entry(c, &bus->codec_list, list) { + if (c->power_on) { + power_on = 1; + break; + } } - mutex_unlock(&card_list_lock); - return 0; + if (power_on) + azx_init_chip(chip, 1); + else if (chip->running && power_save_controller && + !bus->power_keep_link_on) + azx_stop_chip(chip); } -#else -#define azx_add_card_list(chip) /* NOP */ -#define azx_del_card_list(chip) /* NOP */ -#endif /* CONFIG_PM */ +#endif /* CONFIG_SND_HDA_POWER_SAVE */ -#if defined(CONFIG_PM_SLEEP) || defined(SUPPORT_VGA_SWITCHEROO) +#ifdef CONFIG_PM /* * power management */ + static int azx_suspend(struct device *dev) { struct pci_dev *pci = to_pci_dev(dev); @@ -2537,41 +2460,11 @@ static int azx_resume(struct device *dev) snd_power_change_state(card, SNDRV_CTL_POWER_D0); return 0; } -#endif /* CONFIG_PM_SLEEP || SUPPORT_VGA_SWITCHEROO */ - -#ifdef CONFIG_PM_RUNTIME -static int azx_runtime_suspend(struct device *dev) -{ - struct snd_card *card = dev_get_drvdata(dev); - struct azx *chip = card->private_data; - - if (!power_save_controller) - return -EAGAIN; - - azx_stop_chip(chip); - azx_clear_irq_pending(chip); - return 0; -} - -static int azx_runtime_resume(struct device *dev) -{ - struct snd_card *card = dev_get_drvdata(dev); - struct azx *chip = card->private_data; - - azx_init_pci(chip); - azx_init_chip(chip, 1); - return 0; -} -#endif /* CONFIG_PM_RUNTIME */ - -#ifdef CONFIG_PM -static const struct dev_pm_ops azx_pm = { - SET_SYSTEM_SLEEP_PM_OPS(azx_suspend, azx_resume) - SET_RUNTIME_PM_OPS(azx_runtime_suspend, azx_runtime_resume, NULL) -}; - +static SIMPLE_DEV_PM_OPS(azx_pm, azx_suspend, azx_resume); #define AZX_PM_OPS &azx_pm #else +#define azx_suspend(dev) +#define azx_resume(dev) #define AZX_PM_OPS NULL #endif /* CONFIG_PM */ @@ -2706,8 +2599,6 @@ static int azx_free(struct azx *chip) { int i; - azx_del_card_list(chip); - azx_notifier_unregister(chip); if (use_vga_switcheroo(chip)) { @@ -2749,10 +2640,6 @@ static int azx_free(struct azx *chip) pci_release_regions(chip->pci); pci_disable_device(chip->pci); kfree(chip->azx_dev); -#ifdef CONFIG_SND_HDA_PATCH_LOADER - if (chip->fw) - release_firmware(chip->fw); -#endif kfree(chip); return 0; @@ -2832,7 +2719,6 @@ static int __devinit check_position_fix(struct azx *chip, int fix) const struct snd_pci_quirk *q; switch (fix) { - case POS_FIX_AUTO: case POS_FIX_LPIB: case POS_FIX_POSBUF: case POS_FIX_VIACOMBO: @@ -3018,7 +2904,6 @@ static int __devinit azx_create(struct snd_card *card, struct pci_dev *pci, chip->dev_index = dev; INIT_WORK(&chip->irq_pending_work, azx_irq_pending_work); INIT_LIST_HEAD(&chip->pcm_list); - INIT_LIST_HEAD(&chip->list); init_vga_switcheroo(chip); chip->position_fix[0] = chip->position_fix[1] = @@ -3253,7 +3138,7 @@ static int DELAYED_INIT_MARK azx_first_init(struct azx *chip) static void power_down_all_codecs(struct azx *chip) { -#ifdef CONFIG_PM +#ifdef CONFIG_SND_HDA_POWER_SAVE /* The codecs were powered up in snd_hda_codec_new(). * Now all initialization done, so turn them down if possible */ @@ -3264,40 +3149,12 @@ static void power_down_all_codecs(struct azx *chip) #endif } -#ifdef CONFIG_SND_HDA_PATCH_LOADER -/* callback from request_firmware_nowait() */ -static void azx_firmware_cb(const struct firmware *fw, void *context) -{ - struct snd_card *card = context; - struct azx *chip = card->private_data; - struct pci_dev *pci = chip->pci; - - if (!fw) { - snd_printk(KERN_ERR SFX "Cannot load firmware, aborting\n"); - goto error; - } - - chip->fw = fw; - if (!chip->disabled) { - /* continue probing */ - if (azx_probe_continue(chip)) - goto error; - } - return; /* OK */ - - error: - snd_card_free(card); - pci_set_drvdata(pci, NULL); -} -#endif - static int __devinit azx_probe(struct pci_dev *pci, const struct pci_device_id *pci_id) { static int dev; struct snd_card *card; struct azx *chip; - bool probe_now; int err; if (dev >= SNDRV_CARDS) @@ -3313,28 +3170,15 @@ static int __devinit azx_probe(struct pci_dev *pci, return err; } + /* set this here since it's referred in snd_hda_load_patch() */ snd_card_set_dev(card, &pci->dev); err = azx_create(card, pci, dev, pci_id->driver_data, &chip); if (err < 0) goto out_free; card->private_data = chip; - probe_now = !chip->disabled; -#ifdef CONFIG_SND_HDA_PATCH_LOADER - if (patch[dev] && *patch[dev]) { - snd_printk(KERN_ERR SFX "Applying patch firmware '%s'\n", - patch[dev]); - err = request_firmware_nowait(THIS_MODULE, true, patch[dev], - &pci->dev, GFP_KERNEL, card, - azx_firmware_cb); - if (err < 0) - goto out_free; - probe_now = false; /* continued in azx_firmware_cb() */ - } -#endif /* CONFIG_SND_HDA_PATCH_LOADER */ - - if (probe_now) { + if (!chip->disabled) { err = azx_probe_continue(chip); if (err < 0) goto out_free; @@ -3342,9 +3186,6 @@ static int __devinit azx_probe(struct pci_dev *pci, pci_set_drvdata(pci, card); - if (pci_dev_run_wake(pci)) - pm_runtime_put_noidle(&pci->dev); - dev++; return 0; @@ -3367,13 +3208,12 @@ static int DELAYED_INIT_MARK azx_probe_continue(struct azx *chip) if (err < 0) goto out_free; #ifdef CONFIG_SND_HDA_PATCH_LOADER - if (chip->fw) { - err = snd_hda_load_patch(chip->bus, chip->fw->size, - chip->fw->data); + if (patch[dev] && *patch[dev]) { + snd_printk(KERN_ERR SFX "Applying patch firmware '%s'\n", + patch[dev]); + err = snd_hda_load_patch(chip->bus, patch[dev]); if (err < 0) goto out_free; - release_firmware(chip->fw); /* no longer needed */ - chip->fw = NULL; } #endif if ((probe_only[dev] & 1) == 0) { @@ -3399,7 +3239,6 @@ static int DELAYED_INIT_MARK azx_probe_continue(struct azx *chip) chip->running = 1; power_down_all_codecs(chip); azx_notifier_register(chip); - azx_add_card_list(chip); return 0; @@ -3411,10 +3250,6 @@ static int DELAYED_INIT_MARK azx_probe_continue(struct azx *chip) static void __devexit azx_remove(struct pci_dev *pci) { struct snd_card *card = pci_get_drvdata(pci); - - if (pci_dev_run_wake(pci)) - pm_runtime_get_noresume(&pci->dev); - if (card) snd_card_free(card); pci_set_drvdata(pci, NULL); @@ -3425,7 +3260,7 @@ static DEFINE_PCI_DEVICE_TABLE(azx_ids) = { /* CPT */ { PCI_DEVICE(0x8086, 0x1c20), .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_SCH_SNOOP | - AZX_DCAPS_BUFSIZE | AZX_DCAPS_COUNT_LPIB_DELAY }, + AZX_DCAPS_BUFSIZE | AZX_DCAPS_POSFIX_COMBO }, /* PBG */ { PCI_DEVICE(0x8086, 0x1d20), .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_SCH_SNOOP | @@ -3433,30 +3268,23 @@ static DEFINE_PCI_DEVICE_TABLE(azx_ids) = { /* Panther Point */ { PCI_DEVICE(0x8086, 0x1e20), .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_SCH_SNOOP | - AZX_DCAPS_BUFSIZE | AZX_DCAPS_COUNT_LPIB_DELAY }, + AZX_DCAPS_BUFSIZE | AZX_DCAPS_POSFIX_COMBO }, /* Lynx Point */ { PCI_DEVICE(0x8086, 0x8c20), .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_SCH_SNOOP | - AZX_DCAPS_BUFSIZE | AZX_DCAPS_COUNT_LPIB_DELAY }, + AZX_DCAPS_BUFSIZE | AZX_DCAPS_POSFIX_COMBO }, /* Lynx Point-LP */ { PCI_DEVICE(0x8086, 0x9c20), .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_SCH_SNOOP | - AZX_DCAPS_BUFSIZE | AZX_DCAPS_COUNT_LPIB_DELAY }, + AZX_DCAPS_BUFSIZE | AZX_DCAPS_POSFIX_COMBO }, /* Lynx Point-LP */ { PCI_DEVICE(0x8086, 0x9c21), .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_SCH_SNOOP | - AZX_DCAPS_BUFSIZE | AZX_DCAPS_COUNT_LPIB_DELAY }, + AZX_DCAPS_BUFSIZE | AZX_DCAPS_POSFIX_COMBO }, /* Haswell */ { PCI_DEVICE(0x8086, 0x0c0c), .driver_data = AZX_DRIVER_SCH | AZX_DCAPS_SCH_SNOOP | - AZX_DCAPS_BUFSIZE | AZX_DCAPS_COUNT_LPIB_DELAY }, - { PCI_DEVICE(0x8086, 0x0d0c), - .driver_data = AZX_DRIVER_SCH | AZX_DCAPS_SCH_SNOOP | - AZX_DCAPS_BUFSIZE | AZX_DCAPS_COUNT_LPIB_DELAY }, - /* 5 Series/3400 */ - { PCI_DEVICE(0x8086, 0x3b56), - .driver_data = AZX_DRIVER_SCH | AZX_DCAPS_SCH_SNOOP | - AZX_DCAPS_BUFSIZE | AZX_DCAPS_COUNT_LPIB_DELAY }, + AZX_DCAPS_BUFSIZE | AZX_DCAPS_POSFIX_COMBO }, /* SCH */ { PCI_DEVICE(0x8086, 0x811b), .driver_data = AZX_DRIVER_SCH | AZX_DCAPS_SCH_SNOOP | diff --git a/trunk/sound/pci/hda/hda_jack.c b/trunk/sound/pci/hda/hda_jack.c index c9333c9688fb..aaccc0236bda 100644 --- a/trunk/sound/pci/hda/hda_jack.c +++ b/trunk/sound/pci/hda/hda_jack.c @@ -26,8 +26,9 @@ bool is_jack_detectable(struct hda_codec *codec, hda_nid_t nid) return false; if (!(snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_PRES_DETECT)) return false; - if (get_defcfg_misc(snd_hda_codec_get_pincfg(codec, nid)) & - AC_DEFCFG_MISC_NO_PRESENCE) + if (!codec->ignore_misc_bit && + (get_defcfg_misc(snd_hda_codec_get_pincfg(codec, nid)) & + AC_DEFCFG_MISC_NO_PRESENCE)) return false; if (!(get_wcaps(codec, nid) & AC_WCAP_UNSOL_CAP)) return false; diff --git a/trunk/sound/pci/hda/hda_local.h b/trunk/sound/pci/hda/hda_local.h index 09dbdc37f781..1b4c12941baa 100644 --- a/trunk/sound/pci/hda/hda_local.h +++ b/trunk/sound/pci/hda/hda_local.h @@ -529,7 +529,7 @@ int snd_hda_create_hwdep(struct hda_codec *codec); static inline int snd_hda_create_hwdep(struct hda_codec *codec) { return 0; } #endif -#if defined(CONFIG_PM) && defined(CONFIG_SND_HDA_HWDEP) +#if defined(CONFIG_SND_HDA_POWER_SAVE) && defined(CONFIG_SND_HDA_HWDEP) int snd_hda_hwdep_add_power_sysfs(struct hda_codec *codec); #else static inline int snd_hda_hwdep_add_power_sysfs(struct hda_codec *codec) diff --git a/trunk/sound/pci/hda/hda_proc.c b/trunk/sound/pci/hda/hda_proc.c index 045e5d32f5de..6894ec66258c 100644 --- a/trunk/sound/pci/hda/hda_proc.c +++ b/trunk/sound/pci/hda/hda_proc.c @@ -402,9 +402,6 @@ static void print_digital_conv(struct snd_info_buffer *buffer, { unsigned int digi1 = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_DIGI_CONVERT_1, 0); - unsigned char digi2 = digi1 >> 8; - unsigned char digi3 = digi1 >> 16; - snd_iprintf(buffer, " Digital:"); if (digi1 & AC_DIG1_ENABLE) snd_iprintf(buffer, " Enabled"); @@ -422,13 +419,9 @@ static void print_digital_conv(struct snd_info_buffer *buffer, snd_iprintf(buffer, " Pro"); if (digi1 & AC_DIG1_LEVEL) snd_iprintf(buffer, " GenLevel"); - if (digi3 & AC_DIG3_KAE) - snd_iprintf(buffer, " KAE"); snd_iprintf(buffer, "\n"); snd_iprintf(buffer, " Digital category: 0x%x\n", - digi2 & AC_DIG2_CC); - snd_iprintf(buffer, " IEC Coding Type: 0x%x\n", - digi3 & AC_DIG3_ICT); + (digi1 >> 8) & AC_DIG2_CC); } static const char *get_pwr_state(u32 state) diff --git a/trunk/sound/pci/hda/hda_trace.h b/trunk/sound/pci/hda/hda_trace.h index 3a1c63161eb1..9884871ddb00 100644 --- a/trunk/sound/pci/hda/hda_trace.h +++ b/trunk/sound/pci/hda/hda_trace.h @@ -58,7 +58,6 @@ TRACE_EVENT(hda_bus_reset, TP_printk("[%d]", __entry->card) ); -#ifdef CONFIG_PM DECLARE_EVENT_CLASS(hda_power, TP_PROTO(struct hda_codec *codec), @@ -88,31 +87,6 @@ DEFINE_EVENT(hda_power, hda_power_up, TP_ARGS(codec) ); -TRACE_EVENT(hda_power_count, - TP_PROTO(struct hda_codec *codec), - TP_ARGS(codec), - TP_STRUCT__entry( - __field( unsigned int, card ) - __field( unsigned int, addr ) - __field( int, power_count ) - __field( int, power_on ) - __field( int, power_transition ) - ), - - TP_fast_assign( - __entry->card = (codec)->bus->card->number; - __entry->addr = (codec)->addr; - __entry->power_count = (codec)->power_count; - __entry->power_on = (codec)->power_on; - __entry->power_transition = (codec)->power_transition; - ), - - TP_printk("[%d:%d] power_count=%d, power_on=%d, power_transition=%d", - __entry->card, __entry->addr, __entry->power_count, - __entry->power_on, __entry->power_transition) -); -#endif /* CONFIG_PM */ - TRACE_EVENT(hda_unsol_event, TP_PROTO(struct hda_bus *bus, u32 res, u32 res_ex), diff --git a/trunk/sound/pci/hda/patch_analog.c b/trunk/sound/pci/hda/patch_analog.c index cdd43eadbc67..0208fa121e5a 100644 --- a/trunk/sound/pci/hda/patch_analog.c +++ b/trunk/sound/pci/hda/patch_analog.c @@ -85,7 +85,7 @@ struct ad198x_spec { unsigned int analog_beep: 1; /* analog beep input present */ unsigned int avoid_init_slave_vol:1; -#ifdef CONFIG_PM +#ifdef CONFIG_SND_HDA_POWER_SAVE struct hda_loopback_check loopback; #endif /* for virtual master */ @@ -269,7 +269,7 @@ static int ad198x_build_controls(struct hda_codec *codec) return 0; } -#ifdef CONFIG_PM +#ifdef CONFIG_SND_HDA_POWER_SAVE static int ad198x_check_power_status(struct hda_codec *codec, hda_nid_t nid) { struct ad198x_spec *spec = codec->spec; @@ -654,8 +654,10 @@ static const struct hda_codec_ops ad198x_patch_ops = { .build_pcms = ad198x_build_pcms, .init = ad198x_init, .free = ad198x_free, -#ifdef CONFIG_PM +#ifdef CONFIG_SND_HDA_POWER_SAVE .check_power_status = ad198x_check_power_status, +#endif +#ifdef CONFIG_PM .suspend = ad198x_suspend, #endif .reboot_notify = ad198x_shutup, @@ -1229,7 +1231,7 @@ static const struct snd_pci_quirk ad1986a_cfg_tbl[] = { {} }; -#ifdef CONFIG_PM +#ifdef CONFIG_SND_HDA_POWER_SAVE static const struct hda_amp_list ad1986a_loopbacks[] = { { 0x13, HDA_OUTPUT, 0 }, /* Mic */ { 0x14, HDA_OUTPUT, 0 }, /* Phone */ @@ -1276,7 +1278,7 @@ static int patch_ad1986a(struct hda_codec *codec) spec->mixers[0] = ad1986a_mixers; spec->num_init_verbs = 1; spec->init_verbs[0] = ad1986a_init_verbs; -#ifdef CONFIG_PM +#ifdef CONFIG_SND_HDA_POWER_SAVE spec->loopback.amplist = ad1986a_loopbacks; #endif spec->vmaster_nid = 0x1b; @@ -1535,7 +1537,7 @@ static const struct hda_verb ad1983_init_verbs[] = { { } /* end */ }; -#ifdef CONFIG_PM +#ifdef CONFIG_SND_HDA_POWER_SAVE static const struct hda_amp_list ad1983_loopbacks[] = { { 0x12, HDA_OUTPUT, 0 }, /* Mic */ { 0x13, HDA_OUTPUT, 0 }, /* Line */ @@ -1574,7 +1576,7 @@ static int patch_ad1983(struct hda_codec *codec) spec->num_init_verbs = 1; spec->init_verbs[0] = ad1983_init_verbs; spec->spdif_route = 0; -#ifdef CONFIG_PM +#ifdef CONFIG_SND_HDA_POWER_SAVE spec->loopback.amplist = ad1983_loopbacks; #endif spec->vmaster_nid = 0x05; @@ -1702,7 +1704,7 @@ static const struct hda_verb ad1981_init_verbs[] = { { } /* end */ }; -#ifdef CONFIG_PM +#ifdef CONFIG_SND_HDA_POWER_SAVE static const struct hda_amp_list ad1981_loopbacks[] = { { 0x12, HDA_OUTPUT, 0 }, /* Front Mic */ { 0x13, HDA_OUTPUT, 0 }, /* Line */ @@ -1810,7 +1812,7 @@ static const struct hda_input_mux ad1981_hp_capture_source = { .num_items = 3, .items = { { "Mic", 0x0 }, - { "Dock Mic", 0x1 }, + { "Docking-Station", 0x1 }, { "Mix", 0x2 }, }, }; @@ -1834,8 +1836,8 @@ static const struct snd_kcontrol_new ad1981_hp_mixers[] = { */ HDA_CODEC_VOLUME("Mic Playback Volume", 0x12, 0x0, HDA_OUTPUT), HDA_CODEC_MUTE("Mic Playback Switch", 0x12, 0x0, HDA_OUTPUT), - HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x13, 0x0, HDA_OUTPUT), - HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x13, 0x0, HDA_OUTPUT), + HDA_CODEC_VOLUME("Docking-Station Playback Volume", 0x13, 0x0, HDA_OUTPUT), + HDA_CODEC_MUTE("Docking-Station Playback Switch", 0x13, 0x0, HDA_OUTPUT), HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x1c, 0x0, HDA_OUTPUT), HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x1c, 0x0, HDA_OUTPUT), /* FIXME: does this laptop have analog CD connection? */ @@ -1980,7 +1982,7 @@ static int patch_ad1981(struct hda_codec *codec) spec->num_init_verbs = 1; spec->init_verbs[0] = ad1981_init_verbs; spec->spdif_route = 0; -#ifdef CONFIG_PM +#ifdef CONFIG_SND_HDA_POWER_SAVE spec->loopback.amplist = ad1981_loopbacks; #endif spec->vmaster_nid = 0x05; @@ -2805,7 +2807,7 @@ static void ad1988_laptop_unsol_event(struct hda_codec *codec, unsigned int res) snd_hda_sequence_write(codec, ad1988_laptop_hp_off); } -#ifdef CONFIG_PM +#ifdef CONFIG_SND_HDA_POWER_SAVE static const struct hda_amp_list ad1988_loopbacks[] = { { 0x20, HDA_INPUT, 0 }, /* Front Mic */ { 0x20, HDA_INPUT, 1 }, /* Line */ @@ -3397,7 +3399,7 @@ static int patch_ad1988(struct hda_codec *codec) codec->patch_ops.unsol_event = ad1988_laptop_unsol_event; break; } -#ifdef CONFIG_PM +#ifdef CONFIG_SND_HDA_POWER_SAVE spec->loopback.amplist = ad1988_loopbacks; #endif spec->vmaster_nid = 0x04; @@ -3553,7 +3555,7 @@ static const struct hda_verb ad1884_init_verbs[] = { { } /* end */ }; -#ifdef CONFIG_PM +#ifdef CONFIG_SND_HDA_POWER_SAVE static const struct hda_amp_list ad1884_loopbacks[] = { { 0x20, HDA_INPUT, 0 }, /* Front Mic */ { 0x20, HDA_INPUT, 1 }, /* Mic */ @@ -3565,7 +3567,7 @@ static const struct hda_amp_list ad1884_loopbacks[] = { static const char * const ad1884_slave_vols[] = { "PCM", "Mic", "Mono", "Front Mic", "Mic", "CD", - "Internal Mic", "Dock Mic", /* "Beep", */ "IEC958", + "Internal Mic", "Docking Mic", /* "Beep", */ "IEC958", NULL }; @@ -3600,7 +3602,7 @@ static int patch_ad1884(struct hda_codec *codec) spec->num_init_verbs = 1; spec->init_verbs[0] = ad1884_init_verbs; spec->spdif_route = 0; -#ifdef CONFIG_PM +#ifdef CONFIG_SND_HDA_POWER_SAVE spec->loopback.amplist = ad1884_loopbacks; #endif spec->vmaster_nid = 0x04; @@ -3626,7 +3628,7 @@ static const struct hda_input_mux ad1984_thinkpad_capture_source = { { "Mic", 0x0 }, { "Internal Mic", 0x1 }, { "Mix", 0x3 }, - { "Dock Mic", 0x4 }, + { "Docking-Station", 0x4 }, }, }; @@ -3655,8 +3657,8 @@ static const struct snd_kcontrol_new ad1984_thinkpad_mixers[] = { HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x20, 0x01, HDA_INPUT), HDA_CODEC_VOLUME("Beep Playback Volume", 0x20, 0x03, HDA_INPUT), HDA_CODEC_MUTE("Beep Playback Switch", 0x20, 0x03, HDA_INPUT), - HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x20, 0x04, HDA_INPUT), - HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x20, 0x04, HDA_INPUT), + HDA_CODEC_VOLUME("Docking Mic Playback Volume", 0x20, 0x04, HDA_INPUT), + HDA_CODEC_MUTE("Docking Mic Playback Switch", 0x20, 0x04, HDA_INPUT), HDA_CODEC_VOLUME("Mic Boost Volume", 0x14, 0x0, HDA_INPUT), HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x15, 0x0, HDA_INPUT), HDA_CODEC_VOLUME("Dock Mic Boost Volume", 0x25, 0x0, HDA_OUTPUT), @@ -3992,7 +3994,7 @@ static const struct hda_verb ad1884a_init_verbs[] = { { } /* end */ }; -#ifdef CONFIG_PM +#ifdef CONFIG_SND_HDA_POWER_SAVE static const struct hda_amp_list ad1884a_loopbacks[] = { { 0x20, HDA_INPUT, 0 }, /* Front Mic */ { 0x20, HDA_INPUT, 1 }, /* Mic */ @@ -4600,7 +4602,7 @@ static int patch_ad1884a(struct hda_codec *codec) spec->num_init_verbs = 1; spec->init_verbs[0] = ad1884a_init_verbs; spec->spdif_route = 0; -#ifdef CONFIG_PM +#ifdef CONFIG_SND_HDA_POWER_SAVE spec->loopback.amplist = ad1884a_loopbacks; #endif codec->patch_ops = ad198x_patch_ops; @@ -4812,32 +4814,6 @@ static const struct snd_kcontrol_new ad1882_3stack_mixers[] = { { } /* end */ }; -/* simple auto-mute control for AD1882 3-stack board */ -#define AD1882_HP_EVENT 0x01 - -static void ad1882_3stack_automute(struct hda_codec *codec) -{ - bool mute = snd_hda_jack_detect(codec, 0x11); - snd_hda_codec_write(codec, 0x12, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, - mute ? 0 : PIN_OUT); -} - -static int ad1882_3stack_automute_init(struct hda_codec *codec) -{ - ad198x_init(codec); - ad1882_3stack_automute(codec); - return 0; -} - -static void ad1882_3stack_unsol_event(struct hda_codec *codec, unsigned int res) -{ - switch (res >> 26) { - case AD1882_HP_EVENT: - ad1882_3stack_automute(codec); - break; - } -} - static const struct snd_kcontrol_new ad1882_6stack_mixers[] = { HDA_CODEC_MUTE("Surround Playback Switch", 0x16, 0x0, HDA_OUTPUT), HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x24, 1, 0x0, HDA_OUTPUT), @@ -4952,12 +4928,7 @@ static const struct hda_verb ad1882_init_verbs[] = { { } /* end */ }; -static const struct hda_verb ad1882_3stack_automute_verbs[] = { - {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | AD1882_HP_EVENT}, - { } /* end */ -}; - -#ifdef CONFIG_PM +#ifdef CONFIG_SND_HDA_POWER_SAVE static const struct hda_amp_list ad1882_loopbacks[] = { { 0x20, HDA_INPUT, 0 }, /* Front Mic */ { 0x20, HDA_INPUT, 1 }, /* Mic */ @@ -4971,14 +4942,12 @@ static const struct hda_amp_list ad1882_loopbacks[] = { enum { AD1882_3STACK, AD1882_6STACK, - AD1882_3STACK_AUTOMUTE, AD1882_MODELS }; static const char * const ad1882_models[AD1986A_MODELS] = { [AD1882_3STACK] = "3stack", [AD1882_6STACK] = "6stack", - [AD1882_3STACK_AUTOMUTE] = "3stack-automute", }; @@ -5020,7 +4989,7 @@ static int patch_ad1882(struct hda_codec *codec) spec->num_init_verbs = 1; spec->init_verbs[0] = ad1882_init_verbs; spec->spdif_route = 0; -#ifdef CONFIG_PM +#ifdef CONFIG_SND_HDA_POWER_SAVE spec->loopback.amplist = ad1882_loopbacks; #endif spec->vmaster_nid = 0x04; @@ -5033,7 +5002,6 @@ static int patch_ad1882(struct hda_codec *codec) switch (board_config) { default: case AD1882_3STACK: - case AD1882_3STACK_AUTOMUTE: spec->num_mixers = 3; spec->mixers[2] = ad1882_3stack_mixers; spec->channel_mode = ad1882_modes; @@ -5041,12 +5009,6 @@ static int patch_ad1882(struct hda_codec *codec) spec->need_dac_fix = 1; spec->multiout.max_channels = 2; spec->multiout.num_dacs = 1; - if (board_config != AD1882_3STACK) { - spec->init_verbs[spec->num_init_verbs++] = - ad1882_3stack_automute_verbs; - codec->patch_ops.unsol_event = ad1882_3stack_unsol_event; - codec->patch_ops.init = ad1882_3stack_automute_init; - } break; case AD1882_6STACK: spec->num_mixers = 3; diff --git a/trunk/sound/pci/hda/patch_cirrus.c b/trunk/sound/pci/hda/patch_cirrus.c index fcfc9f0a056b..0c4c1a61b378 100644 --- a/trunk/sound/pci/hda/patch_cirrus.c +++ b/trunk/sound/pci/hda/patch_cirrus.c @@ -34,8 +34,7 @@ */ struct cs_spec { - struct hda_gen_spec gen; - + int board_config; struct auto_pin_cfg autocfg; struct hda_multi_out multiout; struct snd_kcontrol *vmaster_sw; @@ -81,20 +80,16 @@ enum { CS420X_MBP53, CS420X_MBP55, CS420X_IMAC27, - CS420X_GPIO_13, - CS420X_GPIO_23, - CS420X_MBP101, - CS420X_MBP101_COEF, + CS420X_IMAC27_122, + CS420X_APPLE, CS420X_AUTO, - /* aliases */ - CS420X_IMAC27_122 = CS420X_GPIO_23, - CS420X_APPLE = CS420X_GPIO_13, + CS420X_MODELS }; /* CS421x boards */ enum { CS421X_CDB4210, - CS421X_SENSE_B, + CS421X_MODELS }; /* Vendor-specific processing widget */ @@ -1162,14 +1157,6 @@ static const struct hda_verb cs_errata_init_verbs[] = { {} /* terminator */ }; -static const struct hda_verb mbp101_init_verbs[] = { - {0x11, AC_VERB_SET_COEF_INDEX, 0x0002}, - {0x11, AC_VERB_SET_PROC_COEF, 0x100a}, - {0x11, AC_VERB_SET_COEF_INDEX, 0x0004}, - {0x11, AC_VERB_SET_PROC_COEF, 0x000f}, - {} -}; - /* SPDIF setup */ static void init_digital(struct hda_codec *codec) { @@ -1206,6 +1193,7 @@ static int cs_init(struct hda_codec *codec) init_output(codec); init_input(codec); init_digital(codec); + snd_hda_jack_report_sync(codec); return 0; } @@ -1291,32 +1279,38 @@ static int cs_parse_auto_config(struct hda_codec *codec) return 0; } -static const struct hda_model_fixup cs420x_models[] = { - { .id = CS420X_MBP53, .name = "mbp53" }, - { .id = CS420X_MBP55, .name = "mbp55" }, - { .id = CS420X_IMAC27, .name = "imac27" }, - { .id = CS420X_IMAC27_122, .name = "imac27_122" }, - { .id = CS420X_APPLE, .name = "apple" }, - { .id = CS420X_MBP101, .name = "mbp101" }, - {} +static const char * const cs420x_models[CS420X_MODELS] = { + [CS420X_MBP53] = "mbp53", + [CS420X_MBP55] = "mbp55", + [CS420X_IMAC27] = "imac27", + [CS420X_IMAC27_122] = "imac27_122", + [CS420X_APPLE] = "apple", + [CS420X_AUTO] = "auto", }; -static const struct snd_pci_quirk cs420x_fixup_tbl[] = { + +static const struct snd_pci_quirk cs420x_cfg_tbl[] = { SND_PCI_QUIRK(0x10de, 0x0ac0, "MacBookPro 5,3", CS420X_MBP53), SND_PCI_QUIRK(0x10de, 0x0d94, "MacBookAir 3,1(2)", CS420X_MBP55), SND_PCI_QUIRK(0x10de, 0xcb79, "MacBookPro 5,5", CS420X_MBP55), SND_PCI_QUIRK(0x10de, 0xcb89, "MacBookPro 7,1", CS420X_MBP55), /* this conflicts with too many other models */ /*SND_PCI_QUIRK(0x8086, 0x7270, "IMac 27 Inch", CS420X_IMAC27),*/ + {} /* terminator */ +}; - /* codec SSID */ +static const struct snd_pci_quirk cs420x_codec_cfg_tbl[] = { SND_PCI_QUIRK(0x106b, 0x2000, "iMac 12,2", CS420X_IMAC27_122), - SND_PCI_QUIRK(0x106b, 0x2800, "MacBookPro 10,1", CS420X_MBP101), SND_PCI_QUIRK_VENDOR(0x106b, "Apple", CS420X_APPLE), {} /* terminator */ }; -static const struct hda_pintbl mbp53_pincfgs[] = { +struct cs_pincfg { + hda_nid_t nid; + u32 val; +}; + +static const struct cs_pincfg mbp53_pincfgs[] = { { 0x09, 0x012b4050 }, { 0x0a, 0x90100141 }, { 0x0b, 0x90100140 }, @@ -1330,7 +1324,7 @@ static const struct hda_pintbl mbp53_pincfgs[] = { {} /* terminator */ }; -static const struct hda_pintbl mbp55_pincfgs[] = { +static const struct cs_pincfg mbp55_pincfgs[] = { { 0x09, 0x012b4030 }, { 0x0a, 0x90100121 }, { 0x0b, 0x90100120 }, @@ -1344,7 +1338,7 @@ static const struct hda_pintbl mbp55_pincfgs[] = { {} /* terminator */ }; -static const struct hda_pintbl imac27_pincfgs[] = { +static const struct cs_pincfg imac27_pincfgs[] = { { 0x09, 0x012b4050 }, { 0x0a, 0x90100140 }, { 0x0b, 0x90100142 }, @@ -1358,78 +1352,22 @@ static const struct hda_pintbl imac27_pincfgs[] = { {} /* terminator */ }; -static const struct hda_pintbl mbp101_pincfgs[] = { - { 0x0d, 0x40ab90f0 }, - { 0x0e, 0x90a600f0 }, - { 0x12, 0x50a600f0 }, - {} /* terminator */ +static const struct cs_pincfg *cs_pincfgs[CS420X_MODELS] = { + [CS420X_MBP53] = mbp53_pincfgs, + [CS420X_MBP55] = mbp55_pincfgs, + [CS420X_IMAC27] = imac27_pincfgs, }; -static void cs420x_fixup_gpio_13(struct hda_codec *codec, - const struct hda_fixup *fix, int action) +static void fix_pincfg(struct hda_codec *codec, int model, + const struct cs_pincfg **pin_configs) { - if (action == HDA_FIXUP_ACT_PRE_PROBE) { - struct cs_spec *spec = codec->spec; - spec->gpio_eapd_hp = 2; /* GPIO1 = headphones */ - spec->gpio_eapd_speaker = 8; /* GPIO3 = speakers */ - spec->gpio_mask = spec->gpio_dir = - spec->gpio_eapd_hp | spec->gpio_eapd_speaker; - } + const struct cs_pincfg *cfg = pin_configs[model]; + if (!cfg) + return; + for (; cfg->nid; cfg++) + snd_hda_codec_set_pincfg(codec, cfg->nid, cfg->val); } -static void cs420x_fixup_gpio_23(struct hda_codec *codec, - const struct hda_fixup *fix, int action) -{ - if (action == HDA_FIXUP_ACT_PRE_PROBE) { - struct cs_spec *spec = codec->spec; - spec->gpio_eapd_hp = 4; /* GPIO2 = headphones */ - spec->gpio_eapd_speaker = 8; /* GPIO3 = speakers */ - spec->gpio_mask = spec->gpio_dir = - spec->gpio_eapd_hp | spec->gpio_eapd_speaker; - } -} - -static const struct hda_fixup cs420x_fixups[] = { - [CS420X_MBP53] = { - .type = HDA_FIXUP_PINS, - .v.pins = mbp53_pincfgs, - .chained = true, - .chain_id = CS420X_APPLE, - }, - [CS420X_MBP55] = { - .type = HDA_FIXUP_PINS, - .v.pins = mbp55_pincfgs, - .chained = true, - .chain_id = CS420X_GPIO_13, - }, - [CS420X_IMAC27] = { - .type = HDA_FIXUP_PINS, - .v.pins = imac27_pincfgs, - .chained = true, - .chain_id = CS420X_GPIO_13, - }, - [CS420X_GPIO_13] = { - .type = HDA_FIXUP_FUNC, - .v.func = cs420x_fixup_gpio_13, - }, - [CS420X_GPIO_23] = { - .type = HDA_FIXUP_FUNC, - .v.func = cs420x_fixup_gpio_23, - }, - [CS420X_MBP101] = { - .type = HDA_FIXUP_PINS, - .v.pins = mbp101_pincfgs, - .chained = true, - .chain_id = CS420X_MBP101_COEF, - }, - [CS420X_MBP101_COEF] = { - .type = HDA_FIXUP_VERBS, - .v.verbs = mbp101_init_verbs, - .chained = true, - .chain_id = CS420X_GPIO_13, - }, -}; - static int patch_cs420x(struct hda_codec *codec) { struct cs_spec *spec; @@ -1442,9 +1380,33 @@ static int patch_cs420x(struct hda_codec *codec) spec->vendor_nid = CS420X_VENDOR_NID; - snd_hda_pick_fixup(codec, cs420x_models, cs420x_fixup_tbl, - cs420x_fixups); - snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); + spec->board_config = + snd_hda_check_board_config(codec, CS420X_MODELS, + cs420x_models, cs420x_cfg_tbl); + if (spec->board_config < 0) + spec->board_config = + snd_hda_check_board_codec_sid_config(codec, + CS420X_MODELS, NULL, cs420x_codec_cfg_tbl); + if (spec->board_config >= 0) + fix_pincfg(codec, spec->board_config, cs_pincfgs); + + switch (spec->board_config) { + case CS420X_IMAC27: + case CS420X_MBP53: + case CS420X_MBP55: + case CS420X_APPLE: + spec->gpio_eapd_hp = 2; /* GPIO1 = headphones */ + spec->gpio_eapd_speaker = 8; /* GPIO3 = speakers */ + spec->gpio_mask = spec->gpio_dir = + spec->gpio_eapd_hp | spec->gpio_eapd_speaker; + break; + case CS420X_IMAC27_122: + spec->gpio_eapd_hp = 4; /* GPIO2 = headphones */ + spec->gpio_eapd_speaker = 8; /* GPIO3 = speakers */ + spec->gpio_mask = spec->gpio_dir = + spec->gpio_eapd_hp | spec->gpio_eapd_speaker; + break; + } err = cs_parse_auto_config(codec); if (err < 0) @@ -1452,8 +1414,6 @@ static int patch_cs420x(struct hda_codec *codec) codec->patch_ops = cs_patch_ops; - snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); - return 0; error: @@ -1471,12 +1431,11 @@ static int patch_cs420x(struct hda_codec *codec) */ /* CS4210 board names */ -static const struct hda_model_fixup cs421x_models[] = { - { .id = CS421X_CDB4210, .name = "cdb4210" }, - {} +static const char *cs421x_models[CS421X_MODELS] = { + [CS421X_CDB4210] = "cdb4210", }; -static const struct snd_pci_quirk cs421x_fixup_tbl[] = { +static const struct snd_pci_quirk cs421x_cfg_tbl[] = { /* Test Intel board + CDB2410 */ SND_PCI_QUIRK(0x8086, 0x5001, "DP45SG/CDB4210", CS421X_CDB4210), {} /* terminator */ @@ -1484,7 +1443,7 @@ static const struct snd_pci_quirk cs421x_fixup_tbl[] = { /* CS4210 board pinconfigs */ /* Default CS4210 (CDB4210)*/ -static const struct hda_pintbl cdb4210_pincfgs[] = { +static const struct cs_pincfg cdb4210_pincfgs[] = { { 0x05, 0x0321401f }, { 0x06, 0x90170010 }, { 0x07, 0x03813031 }, @@ -1494,26 +1453,8 @@ static const struct hda_pintbl cdb4210_pincfgs[] = { {} /* terminator */ }; -/* Setup GPIO/SENSE for each board (if used) */ -static void cs421x_fixup_sense_b(struct hda_codec *codec, - const struct hda_fixup *fix, int action) -{ - struct cs_spec *spec = codec->spec; - if (action == HDA_FIXUP_ACT_PRE_PROBE) - spec->sense_b = 1; -} - -static const struct hda_fixup cs421x_fixups[] = { - [CS421X_CDB4210] = { - .type = HDA_FIXUP_PINS, - .v.pins = cdb4210_pincfgs, - .chained = true, - .chain_id = CS421X_SENSE_B, - }, - [CS421X_SENSE_B] = { - .type = HDA_FIXUP_FUNC, - .v.func = cs421x_fixup_sense_b, - } +static const struct cs_pincfg *cs421x_pincfgs[CS421X_MODELS] = { + [CS421X_CDB4210] = cdb4210_pincfgs, }; static const struct hda_verb cs421x_coef_init_verbs[] = { @@ -1702,6 +1643,7 @@ static int cs421x_init(struct hda_codec *codec) init_output(codec); init_input(codec); init_cs421x_digital(codec); + snd_hda_jack_report_sync(codec); return 0; } @@ -1995,9 +1937,26 @@ static int patch_cs4210(struct hda_codec *codec) spec->vendor_nid = CS4210_VENDOR_NID; - snd_hda_pick_fixup(codec, cs421x_models, cs421x_fixup_tbl, - cs421x_fixups); - snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); + spec->board_config = + snd_hda_check_board_config(codec, CS421X_MODELS, + cs421x_models, cs421x_cfg_tbl); + if (spec->board_config >= 0) + fix_pincfg(codec, spec->board_config, cs421x_pincfgs); + /* + Setup GPIO/SENSE for each board (if used) + */ + switch (spec->board_config) { + case CS421X_CDB4210: + snd_printd("CS4210 board: %s\n", + cs421x_models[spec->board_config]); +/* spec->gpio_mask = 3; + spec->gpio_dir = 3; + spec->gpio_data = 3; +*/ + spec->sense_b = 1; + + break; + } /* Update the GPIO/DMIC/SENSE_B pinmux before the configuration @@ -2012,8 +1971,6 @@ static int patch_cs4210(struct hda_codec *codec) codec->patch_ops = cs421x_patch_ops; - snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); - return 0; error: diff --git a/trunk/sound/pci/hda/patch_conexant.c b/trunk/sound/pci/hda/patch_conexant.c index c03d3b8e42b2..5e22a8f43d2e 100644 --- a/trunk/sound/pci/hda/patch_conexant.c +++ b/trunk/sound/pci/hda/patch_conexant.c @@ -553,7 +553,7 @@ static int conexant_build_controls(struct hda_codec *codec) return 0; } -#ifdef CONFIG_PM +#ifdef CONFIG_SND_HDA_POWER_SAVE static int conexant_suspend(struct hda_codec *codec) { snd_hda_shutup_pins(codec); @@ -567,7 +567,7 @@ static const struct hda_codec_ops conexant_patch_ops = { .init = conexant_init, .free = conexant_free, .set_power_state = conexant_set_power, -#ifdef CONFIG_PM +#ifdef CONFIG_SND_HDA_POWER_SAVE .suspend = conexant_suspend, #endif .reboot_notify = snd_hda_shutup_pins, @@ -1710,8 +1710,8 @@ static const struct snd_kcontrol_new cxt5051_capture_mixers[] = { HDA_CODEC_MUTE("Internal Mic Switch", 0x14, 0x00, HDA_INPUT), HDA_CODEC_VOLUME("Mic Volume", 0x14, 0x01, HDA_INPUT), HDA_CODEC_MUTE("Mic Switch", 0x14, 0x01, HDA_INPUT), - HDA_CODEC_VOLUME("Dock Mic Volume", 0x15, 0x00, HDA_INPUT), - HDA_CODEC_MUTE("Dock Mic Switch", 0x15, 0x00, HDA_INPUT), + HDA_CODEC_VOLUME("Docking Mic Volume", 0x15, 0x00, HDA_INPUT), + HDA_CODEC_MUTE("Docking Mic Switch", 0x15, 0x00, HDA_INPUT), {} }; @@ -3540,9 +3540,8 @@ static int __select_input_connection(struct hda_codec *codec, hda_nid_t mux, hda_nid_t pin, hda_nid_t *srcp, bool do_select, int depth) { - struct conexant_spec *spec = codec->spec; hda_nid_t conn[HDA_MAX_NUM_INPUTS]; - int startidx, i, nums; + int i, nums; switch (get_wcaps_type(get_wcaps(codec, mux))) { case AC_WID_AUD_IN: @@ -3566,25 +3565,14 @@ static int __select_input_connection(struct hda_codec *codec, hda_nid_t mux, depth++; if (depth == 2) return -1; - - /* Try to rotate around connections to avoid one boost controlling - another input path as well */ - startidx = 0; - for (i = 0; i < spec->private_imux.num_items; i++) - if (spec->imux_info[i].pin == pin) { - startidx = i; - break; - } - for (i = 0; i < nums; i++) { - int j = (i + startidx) % nums; - int ret = __select_input_connection(codec, conn[j], pin, srcp, + int ret = __select_input_connection(codec, conn[i], pin, srcp, do_select, depth); if (ret >= 0) { if (do_select) snd_hda_codec_write(codec, mux, 0, - AC_VERB_SET_CONNECT_SEL, j); - return j; + AC_VERB_SET_CONNECT_SEL, i); + return i; } } return -1; @@ -4073,6 +4061,7 @@ static int cx_auto_init(struct hda_codec *codec) cx_auto_init_output(codec); cx_auto_init_input(codec); cx_auto_init_digital(codec); + snd_hda_jack_report_sync(codec); snd_hda_sync_vmaster_hook(&spec->vmaster_mute); return 0; } @@ -4407,7 +4396,7 @@ static const struct hda_codec_ops cx_auto_patch_ops = { .init = cx_auto_init, .free = conexant_free, .unsol_event = cx_auto_unsol_event, -#ifdef CONFIG_PM +#ifdef CONFIG_SND_HDA_POWER_SAVE .suspend = conexant_suspend, #endif .reboot_notify = snd_hda_shutup_pins, diff --git a/trunk/sound/pci/hda/patch_hdmi.c b/trunk/sound/pci/hda/patch_hdmi.c index 71555cc54db1..8f23374fa642 100644 --- a/trunk/sound/pci/hda/patch_hdmi.c +++ b/trunk/sound/pci/hda/patch_hdmi.c @@ -34,8 +34,6 @@ #include #include #include -#include -#include #include "hda_codec.h" #include "hda_local.h" #include "hda_jack.h" @@ -73,9 +71,6 @@ struct hdmi_spec_per_pin { struct hdmi_eld sink_eld; struct delayed_work work; int repoll_count; - bool non_pcm; - bool chmap_set; /* channel-map override by ALSA API? */ - unsigned char chmap[8]; /* ALSA API channel-map */ }; struct hdmi_spec { @@ -85,7 +80,6 @@ struct hdmi_spec { int num_pins; struct hdmi_spec_per_pin pins[MAX_HDMI_PINS]; struct hda_pcm pcm_rec[MAX_HDMI_PINS]; - unsigned int channels_max; /* max over all cvts */ /* * Non-generic ATI/NVIDIA specific @@ -475,17 +469,6 @@ static void init_channel_allocations(void) } } -static int get_channel_allocation_order(int ca) -{ - int i; - - for (i = 0; i < ARRAY_SIZE(channel_allocations); i++) { - if (channel_allocations[i].ca_index == ca) - break; - } - return i; -} - /* * The transformation takes two steps: * @@ -552,36 +535,24 @@ static void hdmi_debug_channel_mapping(struct hda_codec *codec, } -static void hdmi_std_setup_channel_mapping(struct hda_codec *codec, +static void hdmi_setup_channel_mapping(struct hda_codec *codec, hda_nid_t pin_nid, - bool non_pcm, int ca) { int i; int err; - int order; - int non_pcm_mapping[8]; - - order = get_channel_allocation_order(ca); if (hdmi_channel_mapping[ca][1] == 0) { - for (i = 0; i < channel_allocations[order].channels; i++) + for (i = 0; i < channel_allocations[ca].channels; i++) hdmi_channel_mapping[ca][i] = i | (i << 4); for (; i < 8; i++) hdmi_channel_mapping[ca][i] = 0xf | (i << 4); } - if (non_pcm) { - for (i = 0; i < channel_allocations[order].channels; i++) - non_pcm_mapping[i] = i | (i << 4); - for (; i < 8; i++) - non_pcm_mapping[i] = 0xf | (i << 4); - } - for (i = 0; i < 8; i++) { err = snd_hda_codec_write(codec, pin_nid, 0, AC_VERB_SET_HDMI_CHAN_SLOT, - non_pcm ? non_pcm_mapping[i] : hdmi_channel_mapping[ca][i]); + hdmi_channel_mapping[ca][i]); if (err) { snd_printdd(KERN_NOTICE "HDMI: channel mapping failed\n"); @@ -592,136 +563,6 @@ static void hdmi_std_setup_channel_mapping(struct hda_codec *codec, hdmi_debug_channel_mapping(codec, pin_nid); } -struct channel_map_table { - unsigned char map; /* ALSA API channel map position */ - unsigned char cea_slot; /* CEA slot value */ - int spk_mask; /* speaker position bit mask */ -}; - -static struct channel_map_table map_tables[] = { - { SNDRV_CHMAP_FL, 0x00, FL }, - { SNDRV_CHMAP_FR, 0x01, FR }, - { SNDRV_CHMAP_RL, 0x04, RL }, - { SNDRV_CHMAP_RR, 0x05, RR }, - { SNDRV_CHMAP_LFE, 0x02, LFE }, - { SNDRV_CHMAP_FC, 0x03, FC }, - { SNDRV_CHMAP_RLC, 0x06, RLC }, - { SNDRV_CHMAP_RRC, 0x07, RRC }, - {} /* terminator */ -}; - -/* from ALSA API channel position to speaker bit mask */ -static int to_spk_mask(unsigned char c) -{ - struct channel_map_table *t = map_tables; - for (; t->map; t++) { - if (t->map == c) - return t->spk_mask; - } - return 0; -} - -/* from ALSA API channel position to CEA slot */ -static int to_cea_slot(unsigned char c) -{ - struct channel_map_table *t = map_tables; - for (; t->map; t++) { - if (t->map == c) - return t->cea_slot; - } - return 0x0f; -} - -/* from CEA slot to ALSA API channel position */ -static int from_cea_slot(unsigned char c) -{ - struct channel_map_table *t = map_tables; - for (; t->map; t++) { - if (t->cea_slot == c) - return t->map; - } - return 0; -} - -/* from speaker bit mask to ALSA API channel position */ -static int spk_to_chmap(int spk) -{ - struct channel_map_table *t = map_tables; - for (; t->map; t++) { - if (t->spk_mask == spk) - return t->map; - } - return 0; -} - -/* get the CA index corresponding to the given ALSA API channel map */ -static int hdmi_manual_channel_allocation(int chs, unsigned char *map) -{ - int i, spks = 0, spk_mask = 0; - - for (i = 0; i < chs; i++) { - int mask = to_spk_mask(map[i]); - if (mask) { - spk_mask |= mask; - spks++; - } - } - - for (i = 0; i < ARRAY_SIZE(channel_allocations); i++) { - if ((chs == channel_allocations[i].channels || - spks == channel_allocations[i].channels) && - (spk_mask & channel_allocations[i].spk_mask) == - channel_allocations[i].spk_mask) - return channel_allocations[i].ca_index; - } - return -1; -} - -/* set up the channel slots for the given ALSA API channel map */ -static int hdmi_manual_setup_channel_mapping(struct hda_codec *codec, - hda_nid_t pin_nid, - int chs, unsigned char *map) -{ - int i; - for (i = 0; i < 8; i++) { - int val, err; - if (i < chs) - val = to_cea_slot(map[i]); - else - val = 0xf; - val |= (i << 4); - err = snd_hda_codec_write(codec, pin_nid, 0, - AC_VERB_SET_HDMI_CHAN_SLOT, val); - if (err) - return -EINVAL; - } - return 0; -} - -/* store ALSA API channel map from the current default map */ -static void hdmi_setup_fake_chmap(unsigned char *map, int ca) -{ - int i; - for (i = 0; i < 8; i++) { - if (i < channel_allocations[ca].channels) - map[i] = from_cea_slot((hdmi_channel_mapping[ca][i] >> 4) & 0x0f); - else - map[i] = 0; - } -} - -static void hdmi_setup_channel_mapping(struct hda_codec *codec, - hda_nid_t pin_nid, bool non_pcm, int ca, - int channels, unsigned char *map) -{ - if (!non_pcm && map) { - hdmi_manual_setup_channel_mapping(codec, pin_nid, - channels, map); - } else { - hdmi_std_setup_channel_mapping(codec, pin_nid, non_pcm, ca); - hdmi_setup_fake_chmap(map, ca); - } -} /* * Audio InfoFrame routines @@ -845,8 +686,7 @@ static bool hdmi_infoframe_uptodate(struct hda_codec *codec, hda_nid_t pin_nid, } static void hdmi_setup_audio_infoframe(struct hda_codec *codec, int pin_idx, - bool non_pcm, - struct snd_pcm_substream *substream) + struct snd_pcm_substream *substream) { struct hdmi_spec *spec = codec->spec; struct hdmi_spec_per_pin *per_pin = &spec->pins[pin_idx]; @@ -860,12 +700,7 @@ static void hdmi_setup_audio_infoframe(struct hda_codec *codec, int pin_idx, if (!eld->monitor_present) return; - if (!non_pcm && per_pin->chmap_set) - ca = hdmi_manual_channel_allocation(channels, per_pin->chmap); - else - ca = hdmi_channel_allocation(eld, channels); - if (ca < 0) - ca = 0; + ca = hdmi_channel_allocation(eld, channels); memset(&ai, 0, sizeof(ai)); if (eld->conn_type == 0) { /* HDMI */ @@ -902,21 +737,12 @@ static void hdmi_setup_audio_infoframe(struct hda_codec *codec, int pin_idx, "pin=%d channels=%d\n", pin_nid, channels); - hdmi_setup_channel_mapping(codec, pin_nid, non_pcm, ca, - channels, per_pin->chmap); + hdmi_setup_channel_mapping(codec, pin_nid, ca); hdmi_stop_infoframe_trans(codec, pin_nid); hdmi_fill_audio_infoframe(codec, pin_nid, ai.bytes, sizeof(ai)); hdmi_start_infoframe_trans(codec, pin_nid); - } else { - /* For non-pcm audio switch, setup new channel mapping - * accordingly */ - if (per_pin->non_pcm != non_pcm) - hdmi_setup_channel_mapping(codec, pin_nid, non_pcm, ca, - channels, per_pin->chmap); } - - per_pin->non_pcm = non_pcm; } @@ -1209,7 +1035,6 @@ static int hdmi_add_pin(struct hda_codec *codec, hda_nid_t pin_nid) per_pin = &spec->pins[pin_idx]; per_pin->pin_nid = pin_nid; - per_pin->non_pcm = false; err = hdmi_read_pin_conn(codec, pin_idx); if (err < 0) @@ -1239,11 +1064,8 @@ static int hdmi_add_cvt(struct hda_codec *codec, hda_nid_t cvt_nid) per_cvt->cvt_nid = cvt_nid; per_cvt->channels_min = 2; - if (chans <= 16) { + if (chans <= 16) per_cvt->channels_max = chans; - if (chans > spec->channels_max) - spec->channels_max = chans; - } err = snd_hda_query_supported_pcm(codec, cvt_nid, &per_cvt->rates, @@ -1293,7 +1115,7 @@ static int hdmi_parse_codec(struct hda_codec *codec) * can be lost and presence sense verb will become inaccurate if the * HDA link is powered off at hot plug or hw initialization time. */ -#ifdef CONFIG_PM +#ifdef CONFIG_SND_HDA_POWER_SAVE if (!(snd_hda_param_read(codec, codec->afg, AC_PAR_POWER_STATE) & AC_PWRST_EPSS)) codec->bus->power_keep_link_on = 1; @@ -1311,19 +1133,6 @@ static char *get_hdmi_pcm_name(int idx) return &names[idx][0]; } -static bool check_non_pcm_per_cvt(struct hda_codec *codec, hda_nid_t cvt_nid) -{ - struct hda_spdif_out *spdif; - bool non_pcm; - - mutex_lock(&codec->spdif_mutex); - spdif = snd_hda_spdif_out_of_nid(codec, cvt_nid); - non_pcm = !!(spdif->status & IEC958_AES0_NONAUDIO); - mutex_unlock(&codec->spdif_mutex); - return non_pcm; -} - - /* * HDMI callbacks */ @@ -1339,13 +1148,10 @@ static int generic_hdmi_playback_pcm_prepare(struct hda_pcm_stream *hinfo, int pin_idx = hinfo_to_pin_index(spec, hinfo); hda_nid_t pin_nid = spec->pins[pin_idx].pin_nid; int pinctl; - bool non_pcm; - - non_pcm = check_non_pcm_per_cvt(codec, cvt_nid); hdmi_set_channel_count(codec, cvt_nid, substream->runtime->channels); - hdmi_setup_audio_infoframe(codec, pin_idx, non_pcm, substream); + hdmi_setup_audio_infoframe(codec, pin_idx, substream); pinctl = snd_hda_codec_read(codec, pin_nid, 0, AC_VERB_GET_PIN_WIDGET_CONTROL, 0); @@ -1394,10 +1200,7 @@ static int hdmi_pcm_close(struct hda_pcm_stream *hinfo, AC_VERB_SET_PIN_WIDGET_CONTROL, pinctl & ~PIN_OUT); snd_hda_spdif_ctls_unassign(codec, pin_idx); - per_pin->chmap_set = false; - memset(per_pin->chmap, 0, sizeof(per_pin->chmap)); } - return 0; } @@ -1408,135 +1211,6 @@ static const struct hda_pcm_ops generic_ops = { .cleanup = generic_hdmi_playback_pcm_cleanup, }; -/* - * ALSA API channel-map control callbacks - */ -static int hdmi_chmap_ctl_info(struct snd_kcontrol *kcontrol, - struct snd_ctl_elem_info *uinfo) -{ - struct snd_pcm_chmap *info = snd_kcontrol_chip(kcontrol); - struct hda_codec *codec = info->private_data; - struct hdmi_spec *spec = codec->spec; - uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; - uinfo->count = spec->channels_max; - uinfo->value.integer.min = 0; - uinfo->value.integer.max = SNDRV_CHMAP_LAST; - return 0; -} - -static int hdmi_chmap_ctl_tlv(struct snd_kcontrol *kcontrol, int op_flag, - unsigned int size, unsigned int __user *tlv) -{ - struct snd_pcm_chmap *info = snd_kcontrol_chip(kcontrol); - struct hda_codec *codec = info->private_data; - struct hdmi_spec *spec = codec->spec; - const unsigned int valid_mask = - FL | FR | RL | RR | LFE | FC | RLC | RRC; - unsigned int __user *dst; - int chs, count = 0; - - if (size < 8) - return -ENOMEM; - if (put_user(SNDRV_CTL_TLVT_CONTAINER, tlv)) - return -EFAULT; - size -= 8; - dst = tlv + 2; - for (chs = 2; chs <= spec->channels_max; chs++) { - int i, c; - struct cea_channel_speaker_allocation *cap; - cap = channel_allocations; - for (i = 0; i < ARRAY_SIZE(channel_allocations); i++, cap++) { - int chs_bytes = chs * 4; - if (cap->channels != chs) - continue; - if (cap->spk_mask & ~valid_mask) - continue; - if (size < 8) - return -ENOMEM; - if (put_user(SNDRV_CTL_TLVT_CHMAP_VAR, dst) || - put_user(chs_bytes, dst + 1)) - return -EFAULT; - dst += 2; - size -= 8; - count += 8; - if (size < chs_bytes) - return -ENOMEM; - size -= chs_bytes; - count += chs_bytes; - for (c = 7; c >= 0; c--) { - int spk = cap->speakers[c]; - if (!spk) - continue; - if (put_user(spk_to_chmap(spk), dst)) - return -EFAULT; - dst++; - } - } - } - if (put_user(count, tlv + 1)) - return -EFAULT; - return 0; -} - -static int hdmi_chmap_ctl_get(struct snd_kcontrol *kcontrol, - struct snd_ctl_elem_value *ucontrol) -{ - struct snd_pcm_chmap *info = snd_kcontrol_chip(kcontrol); - struct hda_codec *codec = info->private_data; - struct hdmi_spec *spec = codec->spec; - int pin_idx = kcontrol->private_value; - struct hdmi_spec_per_pin *per_pin = &spec->pins[pin_idx]; - int i; - - for (i = 0; i < ARRAY_SIZE(per_pin->chmap); i++) - ucontrol->value.integer.value[i] = per_pin->chmap[i]; - return 0; -} - -static int hdmi_chmap_ctl_put(struct snd_kcontrol *kcontrol, - struct snd_ctl_elem_value *ucontrol) -{ - struct snd_pcm_chmap *info = snd_kcontrol_chip(kcontrol); - struct hda_codec *codec = info->private_data; - struct hdmi_spec *spec = codec->spec; - int pin_idx = kcontrol->private_value; - struct hdmi_spec_per_pin *per_pin = &spec->pins[pin_idx]; - unsigned int ctl_idx; - struct snd_pcm_substream *substream; - unsigned char chmap[8]; - int i, ca, prepared = 0; - - ctl_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); - substream = snd_pcm_chmap_substream(info, ctl_idx); - if (!substream || !substream->runtime) - return -EBADFD; - switch (substream->runtime->status->state) { - case SNDRV_PCM_STATE_OPEN: - case SNDRV_PCM_STATE_SETUP: - break; - case SNDRV_PCM_STATE_PREPARED: - prepared = 1; - break; - default: - return -EBUSY; - } - memset(chmap, 0, sizeof(chmap)); - for (i = 0; i < ARRAY_SIZE(chmap); i++) - chmap[i] = ucontrol->value.integer.value[i]; - if (!memcmp(chmap, per_pin->chmap, sizeof(chmap))) - return 0; - ca = hdmi_manual_channel_allocation(ARRAY_SIZE(chmap), chmap); - if (ca < 0) - return -EINVAL; - per_pin->chmap_set = true; - memcpy(per_pin->chmap, chmap, sizeof(chmap)); - if (prepared) - hdmi_setup_audio_infoframe(codec, pin_idx, per_pin->non_pcm, - substream); - - return 0; -} - static int generic_hdmi_build_pcms(struct hda_codec *codec) { struct hdmi_spec *spec = codec->spec; @@ -1549,7 +1223,6 @@ static int generic_hdmi_build_pcms(struct hda_codec *codec) info = &spec->pcm_rec[pin_idx]; info->name = get_hdmi_pcm_name(pin_idx); info->pcm_type = HDA_PCM_TYPE_HDMI; - info->own_chmap = true; pstr = &info->stream[SNDRV_PCM_STREAM_PLAYBACK]; pstr->substreams = 1; @@ -1607,27 +1280,6 @@ static int generic_hdmi_build_controls(struct hda_codec *codec) hdmi_present_sense(per_pin, 0); } - /* add channel maps */ - for (pin_idx = 0; pin_idx < spec->num_pins; pin_idx++) { - struct snd_pcm_chmap *chmap; - struct snd_kcontrol *kctl; - int i; - err = snd_pcm_add_chmap_ctls(codec->pcm_info[pin_idx].pcm, - SNDRV_PCM_STREAM_PLAYBACK, - NULL, 0, pin_idx, &chmap); - if (err < 0) - return err; - /* override handlers */ - chmap->private_data = codec; - kctl = chmap->kctl; - for (i = 0; i < kctl->count; i++) - kctl->vd[i].access |= SNDRV_CTL_ELEM_ACCESS_WRITE; - kctl->info = hdmi_chmap_ctl_info; - kctl->get = hdmi_chmap_ctl_get; - kctl->put = hdmi_chmap_ctl_put; - kctl->tlv.c = hdmi_chmap_ctl_tlv; - } - return 0; } @@ -1659,6 +1311,7 @@ static int generic_hdmi_init(struct hda_codec *codec) hdmi_init_pin(codec, pin_nid); snd_hda_jack_detect_enable(codec, pin_nid, pin_nid); } + snd_hda_jack_report_sync(codec); return 0; } @@ -1775,6 +1428,7 @@ static int simple_playback_init(struct hda_codec *codec) snd_hda_codec_write(codec, pin, 0, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE); snd_hda_jack_detect_enable(codec, pin, pin); + snd_hda_jack_report_sync(codec); return 0; } @@ -2155,43 +1809,6 @@ static int patch_nvhdmi_2ch(struct hda_codec *codec) return 0; } -static int nvhdmi_7x_8ch_build_pcms(struct hda_codec *codec) -{ - struct hdmi_spec *spec = codec->spec; - int err = simple_playback_build_pcms(codec); - spec->pcm_rec[0].own_chmap = true; - return err; -} - -static int nvhdmi_7x_8ch_build_controls(struct hda_codec *codec) -{ - struct hdmi_spec *spec = codec->spec; - struct snd_pcm_chmap *chmap; - int err; - - err = simple_playback_build_controls(codec); - if (err < 0) - return err; - - /* add channel maps */ - err = snd_pcm_add_chmap_ctls(spec->pcm_rec[0].pcm, - SNDRV_PCM_STREAM_PLAYBACK, - snd_pcm_alt_chmaps, 8, 0, &chmap); - if (err < 0) - return err; - switch (codec->preset->id) { - case 0x10de0002: - case 0x10de0003: - case 0x10de0005: - case 0x10de0006: - chmap->channel_mask = (1U << 2) | (1U << 8); - break; - case 0x10de0007: - chmap->channel_mask = (1U << 2) | (1U << 6) | (1U << 8); - } - return 0; -} - static int patch_nvhdmi_8ch_7x(struct hda_codec *codec) { struct hdmi_spec *spec; @@ -2202,8 +1819,6 @@ static int patch_nvhdmi_8ch_7x(struct hda_codec *codec) spec->multiout.max_channels = 8; spec->pcm_playback = nvhdmi_pcm_playback_8ch_7x; codec->patch_ops.init = nvhdmi_7x_init_8ch; - codec->patch_ops.build_pcms = nvhdmi_7x_8ch_build_pcms; - codec->patch_ops.build_controls = nvhdmi_7x_8ch_build_controls; /* Initialize the audio infoframe channel mask and checksum to something * valid */ diff --git a/trunk/sound/pci/hda/patch_realtek.c b/trunk/sound/pci/hda/patch_realtek.c index 3d440fc7c200..4f81dd44c837 100644 --- a/trunk/sound/pci/hda/patch_realtek.c +++ b/trunk/sound/pci/hda/patch_realtek.c @@ -174,7 +174,7 @@ struct alc_spec { /* hooks */ void (*init_hook)(struct hda_codec *codec); -#ifdef CONFIG_PM +#ifdef CONFIG_SND_HDA_POWER_SAVE void (*power_hook)(struct hda_codec *codec); #endif void (*shutup)(struct hda_codec *codec); @@ -215,7 +215,7 @@ struct alc_spec { /* for virtual master */ hda_nid_t vmaster_nid; struct hda_vmaster_mute_hook vmaster_mute; -#ifdef CONFIG_PM +#ifdef CONFIG_SND_HDA_POWER_SAVE struct hda_loopback_check loopback; int num_loopbacks; struct hda_amp_list loopback_list[8]; @@ -2053,11 +2053,13 @@ static int alc_init(struct hda_codec *codec) alc_apply_fixup(codec, ALC_FIXUP_ACT_INIT); + snd_hda_jack_report_sync(codec); + hda_call_check_power_status(codec, 0x01); return 0; } -#ifdef CONFIG_PM +#ifdef CONFIG_SND_HDA_POWER_SAVE static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid) { struct alc_spec *spec = codec->spec; @@ -2287,8 +2289,6 @@ static int alc_build_pcms(struct hda_codec *codec) p = &alc_pcm_analog_playback; info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *p; info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0]; - info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = - spec->multiout.max_channels; } if (spec->adc_nids) { p = spec->stream_analog_capture; @@ -2437,7 +2437,7 @@ static void alc_free(struct hda_codec *codec) snd_hda_detach_beep_device(codec); } -#ifdef CONFIG_PM +#ifdef CONFIG_SND_HDA_POWER_SAVE static void alc_power_eapd(struct hda_codec *codec) { alc_auto_setup_eapd(codec, false); @@ -2477,7 +2477,7 @@ static const struct hda_codec_ops alc_patch_ops = { #ifdef CONFIG_PM .resume = alc_resume, #endif -#ifdef CONFIG_PM +#ifdef CONFIG_SND_HDA_POWER_SAVE .suspend = alc_suspend, .check_power_status = alc_check_power_status, #endif @@ -2633,7 +2633,7 @@ static const char *alc_get_line_out_pfx(struct alc_spec *spec, int ch, return channel_name[ch]; } -#ifdef CONFIG_PM +#ifdef CONFIG_SND_HDA_POWER_SAVE /* add the powersave loopback-list entry */ static void add_loopback_list(struct alc_spec *spec, hda_nid_t mix, int idx) { @@ -6189,7 +6189,6 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { SND_PCI_QUIRK(0x1025, 0x0349, "Acer AOD260", ALC269_FIXUP_INV_DMIC), SND_PCI_QUIRK(0x103c, 0x1586, "HP", ALC269_FIXUP_MIC2_MUTE_LED), SND_PCI_QUIRK(0x1043, 0x1427, "Asus Zenbook UX31E", ALC269VB_FIXUP_DMIC), - SND_PCI_QUIRK(0x1043, 0x1517, "Asus Zenbook UX31A", ALC269VB_FIXUP_DMIC), SND_PCI_QUIRK(0x1043, 0x1a13, "Asus G73Jw", ALC269_FIXUP_ASUS_G73JW), SND_PCI_QUIRK(0x1043, 0x1b13, "Asus U41SV", ALC269_FIXUP_INV_DMIC), SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_FIXUP_STEREO_DMIC), @@ -6504,7 +6503,7 @@ static int patch_alc861(struct hda_codec *codec) } codec->patch_ops = alc_patch_ops; -#ifdef CONFIG_PM +#ifdef CONFIG_SND_HDA_POWER_SAVE spec->power_hook = alc_power_eapd; #endif diff --git a/trunk/sound/pci/hda/patch_sigmatel.c b/trunk/sound/pci/hda/patch_sigmatel.c index bb6c50e7b5da..3d4722f0a1ca 100644 --- a/trunk/sound/pci/hda/patch_sigmatel.c +++ b/trunk/sound/pci/hda/patch_sigmatel.c @@ -103,7 +103,6 @@ enum { STAC_HP_ZEPHYR, STAC_92HD83XXX_HP_LED, STAC_92HD83XXX_HP_INV_LED, - STAC_92HD83XXX_HP_MIC_LED, STAC_92HD83XXX_MODELS }; @@ -216,9 +215,6 @@ struct sigmatel_spec { unsigned int vref_mute_led_nid; /* pin NID for mute-LED vref control */ unsigned int vref_led; - unsigned int mic_mute_led_gpio; /* capture mute LED GPIO */ - bool mic_mute_led_on; /* current mic mute state */ - /* stream */ unsigned int stream_delay; @@ -1683,7 +1679,6 @@ static const char * const stac92hd83xxx_models[STAC_92HD83XXX_MODELS] = { [STAC_HP_ZEPHYR] = "hp-zephyr", [STAC_92HD83XXX_HP_LED] = "hp-led", [STAC_92HD83XXX_HP_INV_LED] = "hp-inv-led", - [STAC_92HD83XXX_HP_MIC_LED] = "hp-mic-led", }; static const struct snd_pci_quirk stac92hd83xxx_cfg_tbl[] = { @@ -1708,8 +1703,6 @@ static const struct snd_pci_quirk stac92hd83xxx_cfg_tbl[] = { "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD), SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x165B, "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD), - SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x18df, - "HP Folio", STAC_92HD83XXX_HP_MIC_LED), SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3388, "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD), SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3389, @@ -2798,27 +2791,18 @@ stac_control_new(struct sigmatel_spec *spec, return knew; } -static struct snd_kcontrol_new * -add_control_temp(struct sigmatel_spec *spec, - const struct snd_kcontrol_new *ktemp, - int idx, const char *name, - unsigned long val) +static int stac92xx_add_control_temp(struct sigmatel_spec *spec, + const struct snd_kcontrol_new *ktemp, + int idx, const char *name, + unsigned long val) { struct snd_kcontrol_new *knew = stac_control_new(spec, ktemp, name, HDA_SUBDEV_AMP_FLAG); if (!knew) - return NULL; + return -ENOMEM; knew->index = idx; knew->private_value = val; - return knew; -} - -static int stac92xx_add_control_temp(struct sigmatel_spec *spec, - const struct snd_kcontrol_new *ktemp, - int idx, const char *name, - unsigned long val) -{ - return add_control_temp(spec, ktemp, idx, name, val) ? 0 : -ENOMEM; + return 0; } static inline int stac92xx_add_control_idx(struct sigmatel_spec *spec, @@ -3242,12 +3226,9 @@ static int create_multi_out_ctls(struct hda_codec *codec, int num_outs, idx = i; break; case AUTO_PIN_SPEAKER_OUT: - if (num_outs <= 1) { - name = "Speaker"; - idx = i; - break; - } - /* Fall through in case of multi speaker outs */ + name = "Speaker"; + idx = i; + break; default: name = chname[i]; idx = 0; @@ -3261,56 +3242,18 @@ static int create_multi_out_ctls(struct hda_codec *codec, int num_outs, return 0; } -static void stac_gpio_set(struct hda_codec *codec, unsigned int mask, - unsigned int dir_mask, unsigned int data); - -/* hook for controlling mic-mute LED GPIO */ -static int stac92xx_capture_sw_put_led(struct snd_kcontrol *kcontrol, - struct snd_ctl_elem_value *ucontrol) -{ - struct hda_codec *codec = snd_kcontrol_chip(kcontrol); - struct sigmatel_spec *spec = codec->spec; - int err; - bool mute; - - err = snd_hda_mixer_amp_switch_put(kcontrol, ucontrol); - if (err <= 0) - return err; - mute = !(ucontrol->value.integer.value[0] && - ucontrol->value.integer.value[1]); - if (spec->mic_mute_led_on != mute) { - spec->mic_mute_led_on = mute; - if (mute) - spec->gpio_data |= spec->mic_mute_led_gpio; - else - spec->gpio_data &= ~spec->mic_mute_led_gpio; - stac_gpio_set(codec, spec->gpio_mask, - spec->gpio_dir, spec->gpio_data); - } - return err; -} - static int stac92xx_add_capvol_ctls(struct hda_codec *codec, unsigned long vol, unsigned long sw, int idx) { - struct sigmatel_spec *spec = codec->spec; - struct snd_kcontrol_new *knew; int err; - err = stac92xx_add_control_idx(codec->spec, STAC_CTL_WIDGET_VOL, idx, "Capture Volume", vol); if (err < 0) return err; - - knew = add_control_temp(spec, - &stac92xx_control_templates[STAC_CTL_WIDGET_MUTE], - idx, "Capture Switch", sw); - if (!knew) - return -ENOMEM; - /* add a LED hook for some HP laptops */ - if (spec->mic_mute_led_gpio) - knew->put = stac92xx_capture_sw_put_led; - + err = stac92xx_add_control_idx(codec->spec, STAC_CTL_WIDGET_MUTE, idx, + "Capture Switch", sw); + if (err < 0) + return err; return 0; } @@ -4475,6 +4418,8 @@ static int stac92xx_init(struct hda_codec *codec) stac_toggle_power_map(codec, nid, 0); } + snd_hda_jack_report_sync(codec); + /* sync mute LED */ if (spec->gpio_led) { if (spec->vmaster_mute.hook) @@ -5633,9 +5578,6 @@ static int patch_stac92hd83xxx(struct hda_codec *codec) case STAC_92HD83XXX_HP_INV_LED: default_polarity = 1; break; - case STAC_92HD83XXX_HP_MIC_LED: - spec->mic_mute_led_gpio = 0x08; /* GPIO3 */ - break; } if (find_mute_led_cfg(codec, default_polarity)) @@ -5654,13 +5596,6 @@ static int patch_stac92hd83xxx(struct hda_codec *codec) } } - if (spec->mic_mute_led_gpio) { - spec->gpio_mask |= spec->mic_mute_led_gpio; - spec->gpio_dir |= spec->mic_mute_led_gpio; - spec->mic_mute_led_on = true; - spec->gpio_data |= spec->mic_mute_led_gpio; - } - err = stac92xx_parse_auto_config(codec); if (!err) { if (spec->board_config < 0) { diff --git a/trunk/sound/pci/hda/patch_via.c b/trunk/sound/pci/hda/patch_via.c index 5a45a912aedc..430771776915 100644 --- a/trunk/sound/pci/hda/patch_via.c +++ b/trunk/sound/pci/hda/patch_via.c @@ -1672,8 +1672,7 @@ static void via_hp_automute(struct hda_codec *codec) struct via_spec *spec = codec->spec; if (!spec->hp_independent_mode && spec->autocfg.hp_pins[0] && - (spec->codec_type != VT1708 || spec->vt1708_jack_detect) && - is_jack_detectable(codec, spec->autocfg.hp_pins[0])) + (spec->codec_type != VT1708 || spec->vt1708_jack_detect)) present = snd_hda_jack_detect(codec, spec->autocfg.hp_pins[0]); if (spec->smart51_enabled) @@ -1765,7 +1764,7 @@ static int via_suspend(struct hda_codec *codec) } #endif -#ifdef CONFIG_PM +#ifdef CONFIG_SND_HDA_POWER_SAVE static int via_check_power_status(struct hda_codec *codec, hda_nid_t nid) { struct via_spec *spec = codec->spec; @@ -1786,6 +1785,8 @@ static const struct hda_codec_ops via_patch_ops = { .unsol_event = via_unsol_event, #ifdef CONFIG_PM .suspend = via_suspend, +#endif +#ifdef CONFIG_SND_HDA_POWER_SAVE .check_power_status = via_check_power_status, #endif }; @@ -2814,6 +2815,7 @@ static int via_init(struct hda_codec *codec) via_hp_automute(codec); vt1708_update_hp_work(spec); + snd_hda_jack_report_sync(codec); return 0; } @@ -3667,32 +3669,6 @@ static void set_widgets_power_state_vt2002P(struct hda_codec *codec) update_power_state(codec, 0x21, AC_PWRST_D3); } -/* - * pin fix-up - */ -enum { - VIA_FIXUP_INTMIC_BOOST, -}; - -static void via_fixup_intmic_boost(struct hda_codec *codec, - const struct hda_fixup *fix, int action) -{ - if (action == HDA_FIXUP_ACT_PRE_PROBE) - override_mic_boost(codec, 0x30, 0, 2, 40); -} - -static const struct hda_fixup via_fixups[] = { - [VIA_FIXUP_INTMIC_BOOST] = { - .type = HDA_FIXUP_FUNC, - .v.func = via_fixup_intmic_boost, - }, -}; - -static const struct snd_pci_quirk vt2002p_fixups[] = { - SND_PCI_QUIRK(0x1043, 0x8532, "Asus X202E", VIA_FIXUP_INTMIC_BOOST), - {} -}; - /* patch for vt2002P */ static int patch_vt2002P(struct hda_codec *codec) { @@ -3709,9 +3685,6 @@ static int patch_vt2002P(struct hda_codec *codec) override_mic_boost(codec, 0x29, 0, 3, 40); add_secret_dac_path(codec); - snd_hda_pick_fixup(codec, NULL, vt2002p_fixups, via_fixups); - snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); - /* automatic parse from the BIOS config */ err = via_parse_auto_config(codec); if (err < 0) { diff --git a/trunk/sound/pci/ice1712/aureon.c b/trunk/sound/pci/ice1712/aureon.c index 20bcddea2eab..3e4f8c12ffce 100644 --- a/trunk/sound/pci/ice1712/aureon.c +++ b/trunk/sound/pci/ice1712/aureon.c @@ -2103,7 +2103,7 @@ static int aureon_reset(struct snd_ice1712 *ice) /* * suspend/resume */ -#ifdef CONFIG_PM_SLEEP +#ifdef CONFIG_PM static int aureon_resume(struct snd_ice1712 *ice) { struct aureon_spec *spec = ice->spec; @@ -2160,7 +2160,7 @@ static int __devinit aureon_init(struct snd_ice1712 *ice) wm_set_vol(ice, i, spec->vol[i], spec->master[i % 2]); } -#ifdef CONFIG_PM_SLEEP +#ifdef CONFIG_PM ice->pm_resume = aureon_resume; ice->pm_suspend_enabled = 1; #endif diff --git a/trunk/sound/pci/ice1712/ice1712.h b/trunk/sound/pci/ice1712/ice1712.h index d0e7d87f09f0..0da778a69ef8 100644 --- a/trunk/sound/pci/ice1712/ice1712.h +++ b/trunk/sound/pci/ice1712/ice1712.h @@ -384,7 +384,7 @@ struct snd_ice1712 { char **ext_clock_names; int ext_clock_count; void (*pro_open)(struct snd_ice1712 *, struct snd_pcm_substream *); -#ifdef CONFIG_PM_SLEEP +#ifdef CONFIG_PM int (*pm_suspend)(struct snd_ice1712 *); int (*pm_resume)(struct snd_ice1712 *); unsigned int pm_suspend_enabled:1; diff --git a/trunk/sound/pci/ice1712/ice1724.c b/trunk/sound/pci/ice1712/ice1724.c index 3050a5279253..bed9f34f4efe 100644 --- a/trunk/sound/pci/ice1712/ice1724.c +++ b/trunk/sound/pci/ice1712/ice1724.c @@ -2792,7 +2792,7 @@ static void __devexit snd_vt1724_remove(struct pci_dev *pci) pci_set_drvdata(pci, NULL); } -#ifdef CONFIG_PM_SLEEP +#ifdef CONFIG_PM static int snd_vt1724_suspend(struct device *dev) { struct pci_dev *pci = to_pci_dev(dev); @@ -2878,7 +2878,7 @@ static SIMPLE_DEV_PM_OPS(snd_vt1724_pm, snd_vt1724_suspend, snd_vt1724_resume); #define SND_VT1724_PM_OPS &snd_vt1724_pm #else #define SND_VT1724_PM_OPS NULL -#endif /* CONFIG_PM_SLEEP */ +#endif /* CONFIG_PM */ static struct pci_driver vt1724_driver = { .name = KBUILD_MODNAME, diff --git a/trunk/sound/pci/ice1712/juli.c b/trunk/sound/pci/ice1712/juli.c index 14fd536b6452..98bc3b7681b5 100644 --- a/trunk/sound/pci/ice1712/juli.c +++ b/trunk/sound/pci/ice1712/juli.c @@ -486,7 +486,7 @@ static int __devinit juli_add_controls(struct snd_ice1712 *ice) * suspend/resume * */ -#ifdef CONFIG_PM_SLEEP +#ifdef CONFIG_PM static int juli_resume(struct snd_ice1712 *ice) { struct snd_akm4xxx *ak = ice->akm; @@ -652,7 +652,7 @@ static int __devinit juli_init(struct snd_ice1712 *ice) ice->spdif.ops.open = juli_spdif_in_open; -#ifdef CONFIG_PM_SLEEP +#ifdef CONFIG_PM ice->pm_resume = juli_resume; ice->pm_suspend = juli_suspend; ice->pm_suspend_enabled = 1; diff --git a/trunk/sound/pci/ice1712/prodigy_hifi.c b/trunk/sound/pci/ice1712/prodigy_hifi.c index 7bf093c51ce5..075d5aa1fee0 100644 --- a/trunk/sound/pci/ice1712/prodigy_hifi.c +++ b/trunk/sound/pci/ice1712/prodigy_hifi.c @@ -1100,7 +1100,7 @@ static void ak4396_init(struct snd_ice1712 *ice) ak4396_write(ice, ak4396_inits[i], ak4396_inits[i+1]); } -#ifdef CONFIG_PM_SLEEP +#ifdef CONFIG_PM static int prodigy_hd2_resume(struct snd_ice1712 *ice) { /* initialize ak4396 codec and restore previous mixer volumes */ @@ -1141,7 +1141,7 @@ static int __devinit prodigy_hd2_init(struct snd_ice1712 *ice) return -ENOMEM; ice->spec = spec; -#ifdef CONFIG_PM_SLEEP +#ifdef CONFIG_PM ice->pm_resume = &prodigy_hd2_resume; ice->pm_suspend_enabled = 1; #endif diff --git a/trunk/sound/pci/intel8x0.c b/trunk/sound/pci/intel8x0.c index 848102e5d864..cd553f592e2d 100644 --- a/trunk/sound/pci/intel8x0.c +++ b/trunk/sound/pci/intel8x0.c @@ -1541,26 +1541,6 @@ static int __devinit snd_intel8x0_pcm1(struct intel8x0 *chip, int device, snd_dma_pci_data(chip->pci), rec->prealloc_size, rec->prealloc_max_size); - if (rec->ac97_idx == ICHD_PCMOUT && rec->playback_ops) { - struct snd_pcm_chmap *chmap; - int chs = 2; - if (rec->ac97_idx == ICHD_PCMOUT) { - if (chip->multi8) - chs = 8; - else if (chip->multi6) - chs = 6; - else if (chip->multi4) - chs = 4; - } - err = snd_pcm_add_chmap_ctls(pcm, SNDRV_PCM_STREAM_PLAYBACK, - snd_pcm_alt_chmaps, chs, 0, - &chmap); - if (err < 0) - return err; - chmap->channel_mask = SND_PCM_CHMAP_MASK_2468; - chip->ac97[0]->chmaps[SNDRV_PCM_STREAM_PLAYBACK] = chmap; - } - return 0; } @@ -2640,7 +2620,7 @@ static int snd_intel8x0_free(struct intel8x0 *chip) return 0; } -#ifdef CONFIG_PM_SLEEP +#ifdef CONFIG_PM /* * power management */ @@ -2761,7 +2741,7 @@ static SIMPLE_DEV_PM_OPS(intel8x0_pm, intel8x0_suspend, intel8x0_resume); #define INTEL8X0_PM_OPS &intel8x0_pm #else #define INTEL8X0_PM_OPS NULL -#endif /* CONFIG_PM_SLEEP */ +#endif /* CONFIG_PM */ #define INTEL8X0_TESTBUF_SIZE 32768 /* enough large for one shot */ diff --git a/trunk/sound/pci/intel8x0m.c b/trunk/sound/pci/intel8x0m.c index 4d551736531e..da44bb3f8e7a 100644 --- a/trunk/sound/pci/intel8x0m.c +++ b/trunk/sound/pci/intel8x0m.c @@ -1008,7 +1008,7 @@ static int snd_intel8x0m_free(struct intel8x0m *chip) return 0; } -#ifdef CONFIG_PM_SLEEP +#ifdef CONFIG_PM /* * power management */ @@ -1067,7 +1067,7 @@ static SIMPLE_DEV_PM_OPS(intel8x0m_pm, intel8x0m_suspend, intel8x0m_resume); #define INTEL8X0M_PM_OPS &intel8x0m_pm #else #define INTEL8X0M_PM_OPS NULL -#endif /* CONFIG_PM_SLEEP */ +#endif /* CONFIG_PM */ #ifdef CONFIG_PROC_FS static void snd_intel8x0m_proc_read(struct snd_info_entry * entry, diff --git a/trunk/sound/pci/korg1212/korg1212.c b/trunk/sound/pci/korg1212/korg1212.c index 8a67ce95f246..e69ce5f9c31e 100644 --- a/trunk/sound/pci/korg1212/korg1212.c +++ b/trunk/sound/pci/korg1212/korg1212.c @@ -196,8 +196,8 @@ enum MonitorModeSelector { #define K1212_ADAT_BUF_SIZE (K1212_ADAT_CHANNELS * 2 * kPlayBufferFrames * kNumBuffers) #define K1212_MAX_BUF_SIZE (K1212_ANALOG_BUF_SIZE + K1212_ADAT_BUF_SIZE) -#define k1212MinADCSens 0x00 -#define k1212MaxADCSens 0x7f +#define k1212MinADCSens 0x7f +#define k1212MaxADCSens 0x00 #define k1212MaxVolume 0x7fff #define k1212MaxWaveVolume 0xffff #define k1212MinVolume 0x0000 diff --git a/trunk/sound/pci/maestro3.c b/trunk/sound/pci/maestro3.c index eb3cd3a4315e..c85d1ffcc955 100644 --- a/trunk/sound/pci/maestro3.c +++ b/trunk/sound/pci/maestro3.c @@ -789,7 +789,7 @@ struct snd_m3 { unsigned int in_suspend; -#ifdef CONFIG_PM_SLEEP +#ifdef CONFIG_PM u16 *suspend_mem; #endif @@ -2368,7 +2368,7 @@ static int snd_m3_free(struct snd_m3 *chip) outw(0, chip->iobase + HOST_INT_CTRL); /* disable ints */ } -#ifdef CONFIG_PM_SLEEP +#ifdef CONFIG_PM vfree(chip->suspend_mem); #endif @@ -2390,7 +2390,7 @@ static int snd_m3_free(struct snd_m3 *chip) /* * APM support */ -#ifdef CONFIG_PM_SLEEP +#ifdef CONFIG_PM static int m3_suspend(struct device *dev) { struct pci_dev *pci = to_pci_dev(dev); @@ -2485,7 +2485,7 @@ static SIMPLE_DEV_PM_OPS(m3_pm, m3_suspend, m3_resume); #define M3_PM_OPS &m3_pm #else #define M3_PM_OPS NULL -#endif /* CONFIG_PM_SLEEP */ +#endif /* CONFIG_PM */ #ifdef CONFIG_SND_MAESTRO3_INPUT static int __devinit snd_m3_input_register(struct snd_m3 *chip) @@ -2656,7 +2656,7 @@ snd_m3_create(struct snd_card *card, struct pci_dev *pci, } chip->irq = pci->irq; -#ifdef CONFIG_PM_SLEEP +#ifdef CONFIG_PM chip->suspend_mem = vmalloc(sizeof(u16) * (REV_B_CODE_MEMORY_LENGTH + REV_B_DATA_MEMORY_LENGTH)); if (chip->suspend_mem == NULL) snd_printk(KERN_WARNING "can't allocate apm buffer\n"); diff --git a/trunk/sound/pci/nm256/nm256.c b/trunk/sound/pci/nm256/nm256.c index e80e9a1e84aa..465cff25b146 100644 --- a/trunk/sound/pci/nm256/nm256.c +++ b/trunk/sound/pci/nm256/nm256.c @@ -1377,7 +1377,7 @@ snd_nm256_peek_for_sig(struct nm256 *chip) return 0; } -#ifdef CONFIG_PM_SLEEP +#ifdef CONFIG_PM /* * APM event handler, so the card is properly reinitialized after a power * event. @@ -1441,7 +1441,7 @@ static SIMPLE_DEV_PM_OPS(nm256_pm, nm256_suspend, nm256_resume); #define NM256_PM_OPS &nm256_pm #else #define NM256_PM_OPS NULL -#endif /* CONFIG_PM_SLEEP */ +#endif /* CONFIG_PM */ static int snd_nm256_free(struct nm256 *chip) { diff --git a/trunk/sound/pci/oxygen/oxygen.c b/trunk/sound/pci/oxygen/oxygen.c index 2becae155a48..37520a2b4dcf 100644 --- a/trunk/sound/pci/oxygen/oxygen.c +++ b/trunk/sound/pci/oxygen/oxygen.c @@ -872,7 +872,7 @@ static struct pci_driver oxygen_driver = { .id_table = oxygen_ids, .probe = generic_oxygen_probe, .remove = __devexit_p(oxygen_pci_remove), -#ifdef CONFIG_PM_SLEEP +#ifdef CONFIG_PM .driver = { .pm = &oxygen_pci_pm, }, diff --git a/trunk/sound/pci/oxygen/oxygen.h b/trunk/sound/pci/oxygen/oxygen.h index 09a24b24958b..7112a89fb8bd 100644 --- a/trunk/sound/pci/oxygen/oxygen.h +++ b/trunk/sound/pci/oxygen/oxygen.h @@ -161,7 +161,7 @@ int oxygen_pci_probe(struct pci_dev *pci, int index, char *id, ) ); void oxygen_pci_remove(struct pci_dev *pci); -#ifdef CONFIG_PM_SLEEP +#ifdef CONFIG_PM extern const struct dev_pm_ops oxygen_pci_pm; #endif void oxygen_pci_shutdown(struct pci_dev *pci); diff --git a/trunk/sound/pci/oxygen/oxygen_lib.c b/trunk/sound/pci/oxygen/oxygen_lib.c index 25697584b94c..ab8738e21ad1 100644 --- a/trunk/sound/pci/oxygen/oxygen_lib.c +++ b/trunk/sound/pci/oxygen/oxygen_lib.c @@ -726,7 +726,7 @@ void oxygen_pci_remove(struct pci_dev *pci) } EXPORT_SYMBOL(oxygen_pci_remove); -#ifdef CONFIG_PM_SLEEP +#ifdef CONFIG_PM static int oxygen_pci_suspend(struct device *dev) { struct pci_dev *pci = to_pci_dev(dev); @@ -824,7 +824,7 @@ static int oxygen_pci_resume(struct device *dev) SIMPLE_DEV_PM_OPS(oxygen_pci_pm, oxygen_pci_suspend, oxygen_pci_resume); EXPORT_SYMBOL(oxygen_pci_pm); -#endif /* CONFIG_PM_SLEEP */ +#endif /* CONFIG_PM */ void oxygen_pci_shutdown(struct pci_dev *pci) { diff --git a/trunk/sound/pci/oxygen/virtuoso.c b/trunk/sound/pci/oxygen/virtuoso.c index 3d71423b23bc..d3b606b69f3b 100644 --- a/trunk/sound/pci/oxygen/virtuoso.c +++ b/trunk/sound/pci/oxygen/virtuoso.c @@ -93,7 +93,7 @@ static struct pci_driver xonar_driver = { .id_table = xonar_ids, .probe = xonar_probe, .remove = __devexit_p(oxygen_pci_remove), -#ifdef CONFIG_PM_SLEEP +#ifdef CONFIG_PM .driver = { .pm = &oxygen_pci_pm, }, diff --git a/trunk/sound/pci/pcxhr/pcxhr.c b/trunk/sound/pci/pcxhr/pcxhr.c index be4f1456009a..e3ac1f768ff6 100644 --- a/trunk/sound/pci/pcxhr/pcxhr.c +++ b/trunk/sound/pci/pcxhr/pcxhr.c @@ -91,14 +91,6 @@ enum { PCI_ID_PCX924E, PCI_ID_PCX924HRMIC, PCI_ID_PCX924E_MIC, - PCI_ID_VX442HR, - PCI_ID_PCX442HR, - PCI_ID_VX442E, - PCI_ID_PCX442E, - PCI_ID_VX822HR, - PCI_ID_PCX822HR, - PCI_ID_VX822E, - PCI_ID_PCX822E, PCI_ID_LAST }; @@ -129,14 +121,6 @@ static DEFINE_PCI_DEVICE_TABLE(pcxhr_ids) = { { 0x10b5, 0x9056, 0x1369, 0xbb21, 0, 0, PCI_ID_PCX924E, }, { 0x10b5, 0x9056, 0x1369, 0xbf01, 0, 0, PCI_ID_PCX924HRMIC, }, { 0x10b5, 0x9056, 0x1369, 0xbf21, 0, 0, PCI_ID_PCX924E_MIC, }, - { 0x10b5, 0x9656, 0x1369, 0xd001, 0, 0, PCI_ID_VX442HR, }, - { 0x10b5, 0x9656, 0x1369, 0xd101, 0, 0, PCI_ID_PCX442HR, }, - { 0x10b5, 0x9056, 0x1369, 0xd021, 0, 0, PCI_ID_VX442E, }, - { 0x10b5, 0x9056, 0x1369, 0xd121, 0, 0, PCI_ID_PCX442E, }, - { 0x10b5, 0x9656, 0x1369, 0xd201, 0, 0, PCI_ID_VX822HR, }, - { 0x10b5, 0x9656, 0x1369, 0xd301, 0, 0, PCI_ID_PCX822HR, }, - { 0x10b5, 0x9056, 0x1369, 0xd221, 0, 0, PCI_ID_VX822E, }, - { 0x10b5, 0x9056, 0x1369, 0xd321, 0, 0, PCI_ID_PCX822E, }, { 0, } }; @@ -176,14 +160,6 @@ static struct board_parameters pcxhr_board_params[] = { [PCI_ID_PCX924E] = { "PCX924e", 1, 1, 5, 44 }, [PCI_ID_PCX924HRMIC] = { "PCX924HR-Mic", 1, 1, 5, 44 }, [PCI_ID_PCX924E_MIC] = { "PCX924e-Mic", 1, 1, 5, 44 }, -[PCI_ID_VX442HR] = { "VX442HR", 2, 2, 0, 41 }, -[PCI_ID_PCX442HR] = { "PCX442HR", 2, 2, 0, 41 }, -[PCI_ID_VX442E] = { "VX442e", 2, 2, 1, 41 }, -[PCI_ID_PCX442E] = { "PCX442e", 2, 2, 1, 41 }, -[PCI_ID_VX822HR] = { "VX822HR", 4, 1, 2, 42 }, -[PCI_ID_PCX822HR] = { "PCX822HR", 4, 1, 2, 42 }, -[PCI_ID_VX822E] = { "VX822e", 4, 1, 3, 42 }, -[PCI_ID_PCX822E] = { "PCX822e", 4, 1, 3, 42 }, }; /* boards without hw AES1 and SRC onboard are all using fw_file_set==4 */ diff --git a/trunk/sound/pci/pcxhr/pcxhr_hwdep.c b/trunk/sound/pci/pcxhr/pcxhr_hwdep.c index bf207e317f71..ec1587cddb0c 100644 --- a/trunk/sound/pci/pcxhr/pcxhr_hwdep.c +++ b/trunk/sound/pci/pcxhr/pcxhr_hwdep.c @@ -66,10 +66,10 @@ static int pcxhr_init_board(struct pcxhr_mgr *mgr) err = pcxhr_send_msg(mgr, &rmh); if (err) return err; - /* test 4, 8 or 12 phys out */ - if ((rmh.stat[0] & MASK_FIRST_FIELD) < mgr->playback_chips * 2) + /* test 8 or 12 phys out */ + if ((rmh.stat[0] & MASK_FIRST_FIELD) != mgr->playback_chips * 2) return -EINVAL; - /* test 4, 8 or 2 phys in */ + /* test 8 or 2 phys in */ if (((rmh.stat[0] >> (2 * FIELD_SIZE)) & MASK_FIRST_FIELD) < mgr->capture_chips * 2) return -EINVAL; diff --git a/trunk/sound/pci/riptide/riptide.c b/trunk/sound/pci/riptide/riptide.c index 7d291542c5ba..760ee467cd9a 100644 --- a/trunk/sound/pci/riptide/riptide.c +++ b/trunk/sound/pci/riptide/riptide.c @@ -464,7 +464,7 @@ struct snd_riptide { unsigned long received_irqs; unsigned long handled_irqs; -#ifdef CONFIG_PM_SLEEP +#ifdef CONFIG_PM int in_suspend; #endif }; @@ -1150,7 +1150,7 @@ static void riptide_handleirq(unsigned long dev_id) } } -#ifdef CONFIG_PM_SLEEP +#ifdef CONFIG_PM static int riptide_suspend(struct device *dev) { struct pci_dev *pci = to_pci_dev(dev); @@ -1193,7 +1193,7 @@ static SIMPLE_DEV_PM_OPS(riptide_pm, riptide_suspend, riptide_resume); #define RIPTIDE_PM_OPS &riptide_pm #else #define RIPTIDE_PM_OPS NULL -#endif /* CONFIG_PM_SLEEP */ +#endif /* CONFIG_PM */ static int try_to_load_firmware(struct cmdif *cif, struct snd_riptide *chip) { diff --git a/trunk/sound/pci/sis7019.c b/trunk/sound/pci/sis7019.c index 51e43407ebc5..805ab6e9a78f 100644 --- a/trunk/sound/pci/sis7019.c +++ b/trunk/sound/pci/sis7019.c @@ -103,7 +103,7 @@ struct voice { * we're not doing power management, we still need to allocate a page * for the silence buffer. */ -#ifdef CONFIG_PM_SLEEP +#ifdef CONFIG_PM #define SIS_SUSPEND_PAGES 4 #else #define SIS_SUSPEND_PAGES 1 @@ -1208,7 +1208,7 @@ static int sis_chip_init(struct sis7019 *sis) return 0; } -#ifdef CONFIG_PM_SLEEP +#ifdef CONFIG_PM static int sis_suspend(struct device *dev) { struct pci_dev *pci = to_pci_dev(dev); @@ -1305,7 +1305,7 @@ static SIMPLE_DEV_PM_OPS(sis_pm, sis_suspend, sis_resume); #define SIS_PM_OPS &sis_pm #else #define SIS_PM_OPS NULL -#endif /* CONFIG_PM_SLEEP */ +#endif /* CONFIG_PM */ static int sis_alloc_suspend(struct sis7019 *sis) { diff --git a/trunk/sound/pci/trident/trident.c b/trunk/sound/pci/trident/trident.c index 8a6f1f76e870..d36e6ca147e1 100644 --- a/trunk/sound/pci/trident/trident.c +++ b/trunk/sound/pci/trident/trident.c @@ -177,7 +177,7 @@ static struct pci_driver trident_driver = { .id_table = snd_trident_ids, .probe = snd_trident_probe, .remove = __devexit_p(snd_trident_remove), -#ifdef CONFIG_PM_SLEEP +#ifdef CONFIG_PM .driver = { .pm = &snd_trident_pm, }, diff --git a/trunk/sound/pci/trident/trident_main.c b/trunk/sound/pci/trident/trident_main.c index 06b10d1a76e5..94011dcae731 100644 --- a/trunk/sound/pci/trident/trident_main.c +++ b/trunk/sound/pci/trident/trident_main.c @@ -3919,7 +3919,7 @@ static void snd_trident_clear_voices(struct snd_trident * trident, unsigned shor } } -#ifdef CONFIG_PM_SLEEP +#ifdef CONFIG_PM static int snd_trident_suspend(struct device *dev) { struct pci_dev *pci = to_pci_dev(dev); @@ -3983,4 +3983,4 @@ static int snd_trident_resume(struct device *dev) } SIMPLE_DEV_PM_OPS(snd_trident_pm, snd_trident_suspend, snd_trident_resume); -#endif /* CONFIG_PM_SLEEP */ +#endif /* CONFIG_PM */ diff --git a/trunk/sound/pci/via82xx.c b/trunk/sound/pci/via82xx.c index f0b4efdb483c..0eb7245dd362 100644 --- a/trunk/sound/pci/via82xx.c +++ b/trunk/sound/pci/via82xx.c @@ -362,7 +362,7 @@ struct via82xx { unsigned char old_legacy; unsigned char old_legacy_cfg; -#ifdef CONFIG_PM_SLEEP +#ifdef CONFIG_PM unsigned char legacy_saved; unsigned char legacy_cfg_saved; unsigned char spdif_ctrl_saved; @@ -1440,7 +1440,6 @@ static void init_viadev(struct via82xx *chip, int idx, unsigned int reg_offset, static int __devinit snd_via8233_pcm_new(struct via82xx *chip) { struct snd_pcm *pcm; - struct snd_pcm_chmap *chmap; int i, err; chip->playback_devno = 0; /* x 4 */ @@ -1468,12 +1467,6 @@ static int __devinit snd_via8233_pcm_new(struct via82xx *chip) snd_dma_pci_data(chip->pci), 64*1024, VIA_MAX_BUFSIZE); - err = snd_pcm_add_chmap_ctls(pcm, SNDRV_PCM_STREAM_PLAYBACK, - snd_pcm_std_chmaps, 2, 0, - &chmap); - if (err < 0) - return err; - /* PCM #1: multi-channel playback and 2nd capture */ err = snd_pcm_new(chip->card, chip->card->shortname, 1, 1, 1, &pcm); if (err < 0) @@ -1491,14 +1484,6 @@ static int __devinit snd_via8233_pcm_new(struct via82xx *chip) snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV_SG, snd_dma_pci_data(chip->pci), 64*1024, VIA_MAX_BUFSIZE); - - err = snd_pcm_add_chmap_ctls(pcm, SNDRV_PCM_STREAM_PLAYBACK, - snd_pcm_alt_chmaps, 6, 0, - &chmap); - if (err < 0) - return err; - chip->ac97->chmaps[SNDRV_PCM_STREAM_PLAYBACK] = chmap; - return 0; } @@ -1508,7 +1493,6 @@ static int __devinit snd_via8233_pcm_new(struct via82xx *chip) static int __devinit snd_via8233a_pcm_new(struct via82xx *chip) { struct snd_pcm *pcm; - struct snd_pcm_chmap *chmap; int err; chip->multi_devno = 0; @@ -1535,13 +1519,6 @@ static int __devinit snd_via8233a_pcm_new(struct via82xx *chip) snd_dma_pci_data(chip->pci), 64*1024, VIA_MAX_BUFSIZE); - err = snd_pcm_add_chmap_ctls(pcm, SNDRV_PCM_STREAM_PLAYBACK, - snd_pcm_alt_chmaps, 6, 0, - &chmap); - if (err < 0) - return err; - chip->ac97->chmaps[SNDRV_PCM_STREAM_PLAYBACK] = chmap; - /* SPDIF supported? */ if (! ac97_can_spdif(chip->ac97)) return 0; @@ -2061,7 +2038,7 @@ static int __devinit snd_via686_init_misc(struct via82xx *chip) if (mpu_port >= 0x200) { /* force MIDI */ mpu_port &= 0xfffc; pci_write_config_dword(chip->pci, 0x18, mpu_port | 0x01); -#ifdef CONFIG_PM_SLEEP +#ifdef CONFIG_PM chip->mpu_port_saved = mpu_port; #endif } else { @@ -2113,7 +2090,7 @@ static int __devinit snd_via686_init_misc(struct via82xx *chip) snd_via686_create_gameport(chip, &legacy); -#ifdef CONFIG_PM_SLEEP +#ifdef CONFIG_PM chip->legacy_saved = legacy; chip->legacy_cfg_saved = legacy_cfg; #endif @@ -2261,7 +2238,7 @@ static int snd_via82xx_chip_init(struct via82xx *chip) return 0; } -#ifdef CONFIG_PM_SLEEP +#ifdef CONFIG_PM /* * power management */ @@ -2336,7 +2313,7 @@ static SIMPLE_DEV_PM_OPS(snd_via82xx_pm, snd_via82xx_suspend, snd_via82xx_resume #define SND_VIA82XX_PM_OPS &snd_via82xx_pm #else #define SND_VIA82XX_PM_OPS NULL -#endif /* CONFIG_PM_SLEEP */ +#endif /* CONFIG_PM */ static int snd_via82xx_free(struct via82xx *chip) { diff --git a/trunk/sound/pci/via82xx_modem.c b/trunk/sound/pci/via82xx_modem.c index 8e0efc416f22..e886bc16999d 100644 --- a/trunk/sound/pci/via82xx_modem.c +++ b/trunk/sound/pci/via82xx_modem.c @@ -1019,7 +1019,7 @@ static int snd_via82xx_chip_init(struct via82xx_modem *chip) return 0; } -#ifdef CONFIG_PM_SLEEP +#ifdef CONFIG_PM /* * power management */ @@ -1076,7 +1076,7 @@ static SIMPLE_DEV_PM_OPS(snd_via82xx_pm, snd_via82xx_suspend, snd_via82xx_resume #define SND_VIA82XX_PM_OPS &snd_via82xx_pm #else #define SND_VIA82XX_PM_OPS NULL -#endif /* CONFIG_PM_SLEEP */ +#endif /* CONFIG_PM */ static int snd_via82xx_free(struct via82xx_modem *chip) { diff --git a/trunk/sound/pci/vx222/vx222.c b/trunk/sound/pci/vx222/vx222.c index fdfbaf857233..b89e7a86e9d8 100644 --- a/trunk/sound/pci/vx222/vx222.c +++ b/trunk/sound/pci/vx222/vx222.c @@ -257,7 +257,7 @@ static void __devexit snd_vx222_remove(struct pci_dev *pci) pci_set_drvdata(pci, NULL); } -#ifdef CONFIG_PM_SLEEP +#ifdef CONFIG_PM static int snd_vx222_suspend(struct device *dev) { struct pci_dev *pci = to_pci_dev(dev); diff --git a/trunk/sound/pci/ymfpci/ymfpci.c b/trunk/sound/pci/ymfpci/ymfpci.c index e01fe34db9ec..4810356b97ba 100644 --- a/trunk/sound/pci/ymfpci/ymfpci.c +++ b/trunk/sound/pci/ymfpci/ymfpci.c @@ -355,7 +355,7 @@ static struct pci_driver ymfpci_driver = { .id_table = snd_ymfpci_ids, .probe = snd_card_ymfpci_probe, .remove = __devexit_p(snd_card_ymfpci_remove), -#ifdef CONFIG_PM_SLEEP +#ifdef CONFIG_PM .driver = { .pm = &snd_ymfpci_pm, }, diff --git a/trunk/sound/pci/ymfpci/ymfpci.h b/trunk/sound/pci/ymfpci/ymfpci.h index 4631a2348915..bddc4052286b 100644 --- a/trunk/sound/pci/ymfpci/ymfpci.h +++ b/trunk/sound/pci/ymfpci/ymfpci.h @@ -363,7 +363,7 @@ struct snd_ymfpci { const struct firmware *dsp_microcode; const struct firmware *controller_microcode; -#ifdef CONFIG_PM_SLEEP +#ifdef CONFIG_PM u32 *saved_regs; u32 saved_ydsxgr_mode; u16 saved_dsxg_legacy; diff --git a/trunk/sound/pci/ymfpci/ymfpci_main.c b/trunk/sound/pci/ymfpci/ymfpci_main.c index 3a6f03f9b02f..62b23635b754 100644 --- a/trunk/sound/pci/ymfpci/ymfpci_main.c +++ b/trunk/sound/pci/ymfpci/ymfpci_main.c @@ -1166,11 +1166,6 @@ int __devinit snd_ymfpci_pcm(struct snd_ymfpci *chip, int device, struct snd_pcm snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(chip->pci), 64*1024, 256*1024); - err = snd_pcm_add_chmap_ctls(pcm, SNDRV_PCM_STREAM_PLAYBACK, - snd_pcm_std_chmaps, 2, 0, NULL); - if (err < 0) - return err; - if (rpcm) *rpcm = pcm; return 0; @@ -1262,14 +1257,6 @@ static struct snd_pcm_ops snd_ymfpci_playback_4ch_ops = { .pointer = snd_ymfpci_playback_pointer, }; -static const struct snd_pcm_chmap_elem surround_map[] = { - { .channels = 1, - .map = { SNDRV_CHMAP_MONO } }, - { .channels = 2, - .map = { SNDRV_CHMAP_RL, SNDRV_CHMAP_RR } }, - { } -}; - int __devinit snd_ymfpci_pcm_4ch(struct snd_ymfpci *chip, int device, struct snd_pcm ** rpcm) { struct snd_pcm *pcm; @@ -1291,11 +1278,6 @@ int __devinit snd_ymfpci_pcm_4ch(struct snd_ymfpci *chip, int device, struct snd snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(chip->pci), 64*1024, 256*1024); - err = snd_pcm_add_chmap_ctls(pcm, SNDRV_PCM_STREAM_PLAYBACK, - surround_map, 2, 0, NULL); - if (err < 0) - return err; - if (rpcm) *rpcm = pcm; return 0; @@ -2260,7 +2242,7 @@ static int snd_ymfpci_free(struct snd_ymfpci *chip) pci_set_power_state(chip->pci, 3); #endif -#ifdef CONFIG_PM_SLEEP +#ifdef CONFIG_PM vfree(chip->saved_regs); #endif if (chip->irq >= 0) @@ -2290,7 +2272,7 @@ static int snd_ymfpci_dev_free(struct snd_device *device) return snd_ymfpci_free(chip); } -#ifdef CONFIG_PM_SLEEP +#ifdef CONFIG_PM static int saved_regs_index[] = { /* spdif */ YDSXGR_SPDIFOUTCTRL, @@ -2392,7 +2374,7 @@ static int snd_ymfpci_resume(struct device *dev) } SIMPLE_DEV_PM_OPS(snd_ymfpci_pm, snd_ymfpci_suspend, snd_ymfpci_resume); -#endif /* CONFIG_PM_SLEEP */ +#endif /* CONFIG_PM */ int __devinit snd_ymfpci_create(struct snd_card *card, struct pci_dev * pci, @@ -2470,7 +2452,7 @@ int __devinit snd_ymfpci_create(struct snd_card *card, return err; } -#ifdef CONFIG_PM_SLEEP +#ifdef CONFIG_PM chip->saved_regs = vmalloc(YDSXGR_NUM_SAVED_REGS * sizeof(u32)); if (chip->saved_regs == NULL) { snd_ymfpci_free(chip); diff --git a/trunk/sound/soc/codecs/wm2000.c b/trunk/sound/soc/codecs/wm2000.c index 89cd6fcad015..6675477a63cb 100644 --- a/trunk/sound/soc/codecs/wm2000.c +++ b/trunk/sound/soc/codecs/wm2000.c @@ -760,7 +760,7 @@ static int __devinit wm2000_i2c_probe(struct i2c_client *i2c, dev_set_drvdata(&i2c->dev, wm2000); - wm2000->regmap = regmap_init_i2c(i2c, &wm2000_regmap); + wm2000->regmap = devm_regmap_init_i2c(i2c, &wm2000_regmap); if (IS_ERR(wm2000->regmap)) { ret = PTR_ERR(wm2000->regmap); dev_err(&i2c->dev, "Failed to allocate register map: %d\n", @@ -777,7 +777,7 @@ static int __devinit wm2000_i2c_probe(struct i2c_client *i2c, if (id != 0x2000) { dev_err(&i2c->dev, "Device is not a WM2000 - ID %x\n", id); ret = -ENODEV; - goto out_regmap_exit; + goto out; } reg = wm2000_read(i2c, WM2000_REG_REVISON); @@ -796,7 +796,7 @@ static int __devinit wm2000_i2c_probe(struct i2c_client *i2c, ret = request_firmware(&fw, filename, &i2c->dev); if (ret != 0) { dev_err(&i2c->dev, "Failed to acquire ANC data: %d\n", ret); - goto out_regmap_exit; + goto out; } /* Pre-cook the concatenation of the register address onto the image */ @@ -807,7 +807,7 @@ static int __devinit wm2000_i2c_probe(struct i2c_client *i2c, if (wm2000->anc_download == NULL) { dev_err(&i2c->dev, "Out of memory\n"); ret = -ENOMEM; - goto out_regmap_exit; + goto out; } wm2000->anc_download[0] = 0x80; @@ -825,8 +825,6 @@ static int __devinit wm2000_i2c_probe(struct i2c_client *i2c, if (!ret) goto out; -out_regmap_exit: - regmap_exit(wm2000->regmap); out: release_firmware(fw); return ret; @@ -834,10 +832,7 @@ static int __devinit wm2000_i2c_probe(struct i2c_client *i2c, static __devexit int wm2000_i2c_remove(struct i2c_client *i2c) { - struct wm2000_priv *wm2000 = dev_get_drvdata(&i2c->dev); - snd_soc_unregister_codec(&i2c->dev); - regmap_exit(wm2000->regmap); return 0; } diff --git a/trunk/sound/soc/soc-dmaengine-pcm.c b/trunk/sound/soc/soc-dmaengine-pcm.c index bbc125748a38..5df529eda251 100644 --- a/trunk/sound/soc/soc-dmaengine-pcm.c +++ b/trunk/sound/soc/soc-dmaengine-pcm.c @@ -140,18 +140,14 @@ static int dmaengine_pcm_prepare_and_submit(struct snd_pcm_substream *substream) struct dma_chan *chan = prtd->dma_chan; struct dma_async_tx_descriptor *desc; enum dma_transfer_direction direction; - unsigned long flags = DMA_CTRL_ACK; direction = snd_pcm_substream_to_dma_direction(substream); - if (!substream->runtime->no_period_wakeup) - flags |= DMA_PREP_INTERRUPT; - prtd->pos = 0; desc = dmaengine_prep_dma_cyclic(chan, substream->runtime->dma_addr, snd_pcm_lib_buffer_bytes(substream), - snd_pcm_lib_period_bytes(substream), direction, flags); + snd_pcm_lib_period_bytes(substream), direction); if (!desc) return -ENOMEM; diff --git a/trunk/sound/usb/6fire/firmware.c b/trunk/sound/usb/6fire/firmware.c index a1d9b0792a1e..56ad923bf6b5 100644 --- a/trunk/sound/usb/6fire/firmware.c +++ b/trunk/sound/usb/6fire/firmware.c @@ -346,10 +346,11 @@ static int usb6fire_fw_check(u8 *version) if (!memcmp(version, known_fw_versions + i, 4)) return 0; - snd_printk(KERN_ERR PREFIX "invalid fimware version in device: %*ph. " + snd_printk(KERN_ERR PREFIX "invalid fimware version in device: " + "%02x %02x %02x %02x. " "please reconnect to power. if this failure " "still happens, check your firmware installation.", - 4, version); + version[0], version[1], version[2], version[3]); return -EINVAL; } diff --git a/trunk/sound/usb/card.c b/trunk/sound/usb/card.c index 561bb74fd364..4a469f0cb6d4 100644 --- a/trunk/sound/usb/card.c +++ b/trunk/sound/usb/card.c @@ -646,8 +646,6 @@ static int usb_audio_suspend(struct usb_interface *intf, pm_message_t message) list_for_each(p, &chip->pcm_list) { as = list_entry(p, struct snd_usb_stream, list); snd_pcm_suspend_all(as->pcm); - as->substream[0].need_setup_ep = - as->substream[1].need_setup_ep = true; } } } else { diff --git a/trunk/sound/usb/card.h b/trunk/sound/usb/card.h index afa4f9e9b27a..2b9fffff23b6 100644 --- a/trunk/sound/usb/card.h +++ b/trunk/sound/usb/card.h @@ -92,8 +92,6 @@ struct snd_usb_endpoint { unsigned char silence_value; unsigned int stride; int iface, alt_idx; - int skip_packets; /* quirks for devices to ignore the first n packets - in a stream */ spinlock_t lock; struct list_head list; @@ -107,8 +105,6 @@ struct snd_usb_substream { int interface; /* current interface */ int endpoint; /* assigned endpoint */ struct audioformat *cur_audiofmt; /* current audioformat pointer (for hw_params callback) */ - snd_pcm_format_t pcm_format; /* current audio format (for hw_params callback) */ - unsigned int channels; /* current number of channels (for hw_params callback) */ unsigned int cur_rate; /* current rate (for hw_params callback) */ unsigned int period_bytes; /* current period bytes (for hw_params callback) */ unsigned int altset_idx; /* USB data format: index of alternate setting */ @@ -119,13 +115,14 @@ struct snd_usb_substream { unsigned int hwptr_done; /* processed byte position in the buffer */ unsigned int transfer_done; /* processed frames since last period update */ + unsigned long active_mask; /* bitmask of active urbs */ + unsigned long unlink_mask; /* bitmask of unlinked urbs */ /* data and sync endpoints for this stream */ unsigned int ep_num; /* the endpoint number */ struct snd_usb_endpoint *data_endpoint; struct snd_usb_endpoint *sync_endpoint; unsigned long flags; - bool need_setup_ep; /* (re)configure EP at prepare? */ u64 formats; /* format bitmasks (all or'ed) */ unsigned int num_formats; /* number of supported audio formats (list) */ diff --git a/trunk/sound/usb/endpoint.c b/trunk/sound/usb/endpoint.c index 152bfd48a311..d6e2bb49c59c 100644 --- a/trunk/sound/usb/endpoint.c +++ b/trunk/sound/usb/endpoint.c @@ -31,7 +31,6 @@ #include "card.h" #include "endpoint.h" #include "pcm.h" -#include "quirks.h" #define EP_FLAG_ACTIVATED 0 #define EP_FLAG_RUNNING 1 @@ -171,11 +170,6 @@ static void retire_inbound_urb(struct snd_usb_endpoint *ep, { struct urb *urb = urb_ctx->urb; - if (unlikely(ep->skip_packets > 0)) { - ep->skip_packets--; - return; - } - if (ep->sync_slave) snd_usb_handle_sync_urb(ep->sync_slave, ep, urb); @@ -567,19 +561,20 @@ static void release_urbs(struct snd_usb_endpoint *ep, int force) * configure a data endpoint */ static int data_ep_set_params(struct snd_usb_endpoint *ep, - snd_pcm_format_t pcm_format, - unsigned int channels, - unsigned int period_bytes, + struct snd_pcm_hw_params *hw_params, struct audioformat *fmt, struct snd_usb_endpoint *sync_ep) { unsigned int maxsize, i, urb_packs, total_packs, packs_per_ms; + int period_bytes = params_period_bytes(hw_params); + int format = params_format(hw_params); int is_playback = usb_pipeout(ep->pipe); - int frame_bits = snd_pcm_format_physical_width(pcm_format) * channels; + int frame_bits = snd_pcm_format_physical_width(params_format(hw_params)) * + params_channels(hw_params); ep->datainterval = fmt->datainterval; ep->stride = frame_bits >> 3; - ep->silence_value = pcm_format == SNDRV_PCM_FORMAT_U8 ? 0x80 : 0; + ep->silence_value = format == SNDRV_PCM_FORMAT_U8 ? 0x80 : 0; /* calculate max. frequency */ if (ep->maxpacksize) { @@ -692,6 +687,7 @@ static int data_ep_set_params(struct snd_usb_endpoint *ep, * configure a sync endpoint */ static int sync_ep_set_params(struct snd_usb_endpoint *ep, + struct snd_pcm_hw_params *hw_params, struct audioformat *fmt) { int i; @@ -734,10 +730,7 @@ static int sync_ep_set_params(struct snd_usb_endpoint *ep, * snd_usb_endpoint_set_params: configure an snd_usb_endpoint * * @ep: the snd_usb_endpoint to configure - * @pcm_format: the audio fomat. - * @channels: the number of audio channels. - * @period_bytes: the number of bytes in one alsa period. - * @rate: the frame rate. + * @hw_params: the hardware parameters * @fmt: the USB audio format information * @sync_ep: the sync endpoint to use, if any * @@ -746,10 +739,7 @@ static int sync_ep_set_params(struct snd_usb_endpoint *ep, * An endpoint that is already running can not be reconfigured. */ int snd_usb_endpoint_set_params(struct snd_usb_endpoint *ep, - snd_pcm_format_t pcm_format, - unsigned int channels, - unsigned int period_bytes, - unsigned int rate, + struct snd_pcm_hw_params *hw_params, struct audioformat *fmt, struct snd_usb_endpoint *sync_ep) { @@ -769,9 +759,9 @@ int snd_usb_endpoint_set_params(struct snd_usb_endpoint *ep, ep->fill_max = !!(fmt->attributes & UAC_EP_CS_ATTR_FILL_MAX); if (snd_usb_get_speed(ep->chip->dev) == USB_SPEED_FULL) - ep->freqn = get_usb_full_speed_rate(rate); + ep->freqn = get_usb_full_speed_rate(params_rate(hw_params)); else - ep->freqn = get_usb_high_speed_rate(rate); + ep->freqn = get_usb_high_speed_rate(params_rate(hw_params)); /* calculate the frequency in 16.16 format */ ep->freqm = ep->freqn; @@ -781,11 +771,10 @@ int snd_usb_endpoint_set_params(struct snd_usb_endpoint *ep, switch (ep->type) { case SND_USB_ENDPOINT_TYPE_DATA: - err = data_ep_set_params(ep, pcm_format, channels, - period_bytes, fmt, sync_ep); + err = data_ep_set_params(ep, hw_params, fmt, sync_ep); break; case SND_USB_ENDPOINT_TYPE_SYNC: - err = sync_ep_set_params(ep, fmt); + err = sync_ep_set_params(ep, hw_params, fmt); break; default: err = -EINVAL; @@ -833,8 +822,6 @@ int snd_usb_endpoint_start(struct snd_usb_endpoint *ep, int can_sleep) ep->unlink_mask = 0; ep->phase = 0; - snd_usb_endpoint_start_quirk(ep); - /* * If this endpoint has a data endpoint as implicit feedback source, * don't start the urbs here. Instead, mark them all as available, diff --git a/trunk/sound/usb/endpoint.h b/trunk/sound/usb/endpoint.h index 6376ccf10fd4..cbbbdf226d66 100644 --- a/trunk/sound/usb/endpoint.h +++ b/trunk/sound/usb/endpoint.h @@ -9,10 +9,7 @@ struct snd_usb_endpoint *snd_usb_add_endpoint(struct snd_usb_audio *chip, int ep_num, int direction, int type); int snd_usb_endpoint_set_params(struct snd_usb_endpoint *ep, - snd_pcm_format_t pcm_format, - unsigned int channels, - unsigned int period_bytes, - unsigned int rate, + struct snd_pcm_hw_params *hw_params, struct audioformat *fmt, struct snd_usb_endpoint *sync_ep); diff --git a/trunk/sound/usb/helper.c b/trunk/sound/usb/helper.c index c1db28f874c2..9eed8f40b179 100644 --- a/trunk/sound/usb/helper.c +++ b/trunk/sound/usb/helper.c @@ -21,7 +21,6 @@ #include "usbaudio.h" #include "helper.h" -#include "quirks.h" /* * combine bytes and get an integer value @@ -98,10 +97,6 @@ int snd_usb_ctl_msg(struct usb_device *dev, unsigned int pipe, __u8 request, memcpy(data, buf, size); kfree(buf); } - - snd_usb_ctl_msg_quirk(dev, pipe, request, requesttype, - value, index, data, size); - return err; } diff --git a/trunk/sound/usb/mixer.c b/trunk/sound/usb/mixer.c index fe56c9da38e9..4f40ba823163 100644 --- a/trunk/sound/usb/mixer.c +++ b/trunk/sound/usb/mixer.c @@ -1267,13 +1267,6 @@ static int parse_audio_feature_unit(struct mixer_build *state, int unitid, void /* disable non-functional volume control */ master_bits &= ~UAC_CONTROL_BIT(UAC_FU_VOLUME); break; - case USB_ID(0x1130, 0xf211): - snd_printk(KERN_INFO - "usbmixer: volume control quirk for Tenx TP6911 Audio Headset\n"); - /* disable non-functional volume control */ - channels = 0; - break; - } if (channels > 0) first_ch_bits = snd_usb_combine_bytes(bmaControls + csize, csize); diff --git a/trunk/sound/usb/pcm.c b/trunk/sound/usb/pcm.c index 55e19e1b80ec..f782ce19bf5a 100644 --- a/trunk/sound/usb/pcm.c +++ b/trunk/sound/usb/pcm.c @@ -82,7 +82,8 @@ static snd_pcm_uframes_t snd_usb_pcm_pointer(struct snd_pcm_substream *substream /* * find a matching audio format */ -static struct audioformat *find_format(struct snd_usb_substream *subs) +static struct audioformat *find_format(struct snd_usb_substream *subs, unsigned int format, + unsigned int rate, unsigned int channels) { struct list_head *p; struct audioformat *found = NULL; @@ -91,17 +92,16 @@ static struct audioformat *find_format(struct snd_usb_substream *subs) list_for_each(p, &subs->fmt_list) { struct audioformat *fp; fp = list_entry(p, struct audioformat, list); - if (!(fp->formats & (1uLL << subs->pcm_format))) + if (!(fp->formats & (1uLL << format))) continue; - if (fp->channels != subs->channels) + if (fp->channels != channels) continue; - if (subs->cur_rate < fp->rate_min || - subs->cur_rate > fp->rate_max) + if (rate < fp->rate_min || rate > fp->rate_max) continue; if (! (fp->rates & SNDRV_PCM_RATE_CONTINUOUS)) { unsigned int i; for (i = 0; i < fp->nr_rates; i++) - if (fp->rate_table[i] == subs->cur_rate) + if (fp->rate_table[i] == rate) break; if (i >= fp->nr_rates) continue; @@ -435,42 +435,6 @@ static int set_format(struct snd_usb_substream *subs, struct audioformat *fmt) return 0; } -/* - * configure endpoint params - * - * called during initial setup and upon resume - */ -static int configure_endpoint(struct snd_usb_substream *subs) -{ - int ret; - - mutex_lock(&subs->stream->chip->shutdown_mutex); - /* format changed */ - stop_endpoints(subs, 0, 0, 0); - ret = snd_usb_endpoint_set_params(subs->data_endpoint, - subs->pcm_format, - subs->channels, - subs->period_bytes, - subs->cur_rate, - subs->cur_audiofmt, - subs->sync_endpoint); - if (ret < 0) - goto unlock; - - if (subs->sync_endpoint) - ret = snd_usb_endpoint_set_params(subs->data_endpoint, - subs->pcm_format, - subs->channels, - subs->period_bytes, - subs->cur_rate, - subs->cur_audiofmt, - NULL); - -unlock: - mutex_unlock(&subs->stream->chip->shutdown_mutex); - return ret; -} - /* * hw_params callback * @@ -486,33 +450,63 @@ static int snd_usb_hw_params(struct snd_pcm_substream *substream, { struct snd_usb_substream *subs = substream->runtime->private_data; struct audioformat *fmt; - int ret; + unsigned int channels, rate, format; + int ret, changed; ret = snd_pcm_lib_alloc_vmalloc_buffer(substream, params_buffer_bytes(hw_params)); if (ret < 0) return ret; - subs->pcm_format = params_format(hw_params); - subs->period_bytes = params_period_bytes(hw_params); - subs->channels = params_channels(hw_params); - subs->cur_rate = params_rate(hw_params); - - fmt = find_format(subs); + format = params_format(hw_params); + rate = params_rate(hw_params); + channels = params_channels(hw_params); + fmt = find_format(subs, format, rate, channels); if (!fmt) { snd_printd(KERN_DEBUG "cannot set format: format = %#x, rate = %d, channels = %d\n", - subs->pcm_format, subs->cur_rate, subs->channels); + format, rate, channels); return -EINVAL; } + changed = subs->cur_audiofmt != fmt || + subs->period_bytes != params_period_bytes(hw_params) || + subs->cur_rate != rate; if ((ret = set_format(subs, fmt)) < 0) return ret; - subs->interface = fmt->iface; - subs->altset_idx = fmt->altset_idx; - subs->need_setup_ep = true; + if (subs->cur_rate != rate) { + struct usb_host_interface *alts; + struct usb_interface *iface; + iface = usb_ifnum_to_if(subs->dev, fmt->iface); + alts = &iface->altsetting[fmt->altset_idx]; + ret = snd_usb_init_sample_rate(subs->stream->chip, fmt->iface, alts, fmt, rate); + if (ret < 0) + return ret; + subs->cur_rate = rate; + } - return 0; + if (changed) { + mutex_lock(&subs->stream->chip->shutdown_mutex); + /* format changed */ + stop_endpoints(subs, 0, 0, 0); + ret = snd_usb_endpoint_set_params(subs->data_endpoint, hw_params, fmt, + subs->sync_endpoint); + if (ret < 0) + goto unlock; + + if (subs->sync_endpoint) + ret = snd_usb_endpoint_set_params(subs->sync_endpoint, + hw_params, fmt, NULL); +unlock: + mutex_unlock(&subs->stream->chip->shutdown_mutex); + } + + if (ret == 0) { + subs->interface = fmt->iface; + subs->altset_idx = fmt->altset_idx; + } + + return ret; } /* @@ -543,9 +537,6 @@ static int snd_usb_pcm_prepare(struct snd_pcm_substream *substream) { struct snd_pcm_runtime *runtime = substream->runtime; struct snd_usb_substream *subs = runtime->private_data; - struct usb_host_interface *alts; - struct usb_interface *iface; - int ret; if (! subs->cur_audiofmt) { snd_printk(KERN_ERR "usbaudio: no format is specified!\n"); @@ -555,27 +546,6 @@ static int snd_usb_pcm_prepare(struct snd_pcm_substream *substream) if (snd_BUG_ON(!subs->data_endpoint)) return -EIO; - ret = set_format(subs, subs->cur_audiofmt); - if (ret < 0) - return ret; - - iface = usb_ifnum_to_if(subs->dev, subs->cur_audiofmt->iface); - alts = &iface->altsetting[subs->cur_audiofmt->altset_idx]; - ret = snd_usb_init_sample_rate(subs->stream->chip, - subs->cur_audiofmt->iface, - alts, - subs->cur_audiofmt, - subs->cur_rate); - if (ret < 0) - return ret; - - if (subs->need_setup_ep) { - ret = configure_endpoint(subs); - if (ret < 0) - return ret; - subs->need_setup_ep = false; - } - /* some unit conversions in runtime */ subs->data_endpoint->maxframesize = bytes_to_frames(runtime, subs->data_endpoint->maxpacksize); diff --git a/trunk/sound/usb/quirks-table.h b/trunk/sound/usb/quirks-table.h index d73ac9bc4272..79780fa57a43 100644 --- a/trunk/sound/usb/quirks-table.h +++ b/trunk/sound/usb/quirks-table.h @@ -2781,59 +2781,6 @@ YAMAHA_DEVICE(0x7010, "UB99"), } }, -/* Microsoft XboxLive Headset/Xbox Communicator */ -{ - USB_DEVICE(0x045e, 0x0283), - .bInterfaceClass = USB_CLASS_PER_INTERFACE, - .driver_info = (unsigned long) &(const struct snd_usb_audio_quirk) { - .vendor_name = "Microsoft", - .product_name = "XboxLive Headset/Xbox Communicator", - .ifnum = QUIRK_ANY_INTERFACE, - .type = QUIRK_COMPOSITE, - .data = &(const struct snd_usb_audio_quirk[]) { - { - /* playback */ - .ifnum = 0, - .type = QUIRK_AUDIO_FIXED_ENDPOINT, - .data = &(const struct audioformat) { - .formats = SNDRV_PCM_FMTBIT_S16_LE, - .channels = 1, - .iface = 0, - .altsetting = 0, - .altset_idx = 0, - .attributes = 0, - .endpoint = 0x04, - .ep_attr = 0x05, - .rates = SNDRV_PCM_RATE_CONTINUOUS, - .rate_min = 22050, - .rate_max = 22050 - } - }, - { - /* capture */ - .ifnum = 1, - .type = QUIRK_AUDIO_FIXED_ENDPOINT, - .data = &(const struct audioformat) { - .formats = SNDRV_PCM_FMTBIT_S16_LE, - .channels = 1, - .iface = 1, - .altsetting = 0, - .altset_idx = 0, - .attributes = 0, - .endpoint = 0x85, - .ep_attr = 0x05, - .rates = SNDRV_PCM_RATE_CONTINUOUS, - .rate_min = 16000, - .rate_max = 16000 - } - }, - { - .ifnum = -1 - } - } - } -}, - { /* * Some USB MIDI devices don't have an audio control interface, diff --git a/trunk/sound/usb/quirks.c b/trunk/sound/usb/quirks.c index 0f58b4b6d702..27817266867a 100644 --- a/trunk/sound/usb/quirks.c +++ b/trunk/sound/usb/quirks.c @@ -761,27 +761,3 @@ void snd_usb_set_format_quirk(struct snd_usb_substream *subs, } } -void snd_usb_endpoint_start_quirk(struct snd_usb_endpoint *ep) -{ - /* - * "Playback Design" products send bogus feedback data at the start - * of the stream. Ignore them. - */ - if ((le16_to_cpu(ep->chip->dev->descriptor.idVendor) == 0x23ba) && - ep->type == SND_USB_ENDPOINT_TYPE_SYNC) - ep->skip_packets = 4; -} - -void snd_usb_ctl_msg_quirk(struct usb_device *dev, unsigned int pipe, - __u8 request, __u8 requesttype, __u16 value, - __u16 index, void *data, __u16 size) -{ - /* - * "Playback Design" products need a 20ms delay after each - * class compliant request - */ - if ((le16_to_cpu(dev->descriptor.idVendor) == 0x23ba) && - (requesttype & USB_TYPE_MASK) == USB_TYPE_CLASS) - mdelay(20); -} - diff --git a/trunk/sound/usb/quirks.h b/trunk/sound/usb/quirks.h index 0ca9e91067a6..03e5e94098cd 100644 --- a/trunk/sound/usb/quirks.h +++ b/trunk/sound/usb/quirks.h @@ -1,10 +1,6 @@ #ifndef __USBAUDIO_QUIRKS_H #define __USBAUDIO_QUIRKS_H -struct audioformat; -struct snd_usb_endpoint; -struct snd_usb_substream; - int snd_usb_create_quirk(struct snd_usb_audio *chip, struct usb_interface *iface, struct usb_driver *driver, @@ -24,10 +20,4 @@ void snd_usb_set_format_quirk(struct snd_usb_substream *subs, int snd_usb_is_big_endian_format(struct snd_usb_audio *chip, struct audioformat *fp); -void snd_usb_endpoint_start_quirk(struct snd_usb_endpoint *ep); - -void snd_usb_ctl_msg_quirk(struct usb_device *dev, unsigned int pipe, - __u8 request, __u8 requesttype, __u16 value, - __u16 index, void *data, __u16 size); - #endif /* __USBAUDIO_QUIRKS_H */