Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound:
ALSA: hda - Fix S3/S4 problem on machines with VREF-pin mute-LED
ALSA: hda_intel - revert a quirk that affect VIA chipsets
ALSA: hda - Avoid touching mute-VREF pin for IDT codecs
firmware: Sigma: Fix endianess issues
firmware: Sigma: Skip header during CRC generation
firmware: Sigma: Prevent out of bounds memory access
ALSA: usb-audio - Support for Roland GAIA SH-01 Synthesizer
ASoC: Supply dcs_codes for newer WM1811 revisions
ASoC: Error out if we can't generate a LRCLK at all for WM8994
ASoC: Correct name of Speyside Main Speaker widget
ASoC: skip resume of soc-audio devices without codecs
ASoC: cs42l51: Fix off-by-one for reg_cache_size
ASoC: drop support for PlayPaq with WM8510
ASoC: mpc8610: tell the CS4270 codec that it's the master
ASoC: cs4720: use snd_soc_cache_sync()
ASoC: SAMSUNG: Fix build error
ASoC: max9877: Update register if either val or val2 is changed
ASoC: Fix wrong define for AD1836_ADC_WORD_OFFSET

+137 -575
+59 -24
drivers/firmware/sigma.c
··· 14 14 #include <linux/module.h> 15 15 #include <linux/sigma.h> 16 16 17 - /* Return: 0==OK, <0==error, =1 ==no more actions */ 18 - static int 19 - process_sigma_action(struct i2c_client *client, struct sigma_firmware *ssfw) 17 + static size_t sigma_action_size(struct sigma_action *sa) 20 18 { 21 - struct sigma_action *sa = (void *)(ssfw->fw->data + ssfw->pos); 19 + size_t payload = 0; 20 + 21 + switch (sa->instr) { 22 + case SIGMA_ACTION_WRITEXBYTES: 23 + case SIGMA_ACTION_WRITESINGLE: 24 + case SIGMA_ACTION_WRITESAFELOAD: 25 + payload = sigma_action_len(sa); 26 + break; 27 + default: 28 + break; 29 + } 30 + 31 + payload = ALIGN(payload, 2); 32 + 33 + return payload + sizeof(struct sigma_action); 34 + } 35 + 36 + /* 37 + * Returns a negative error value in case of an error, 0 if processing of 38 + * the firmware should be stopped after this action, 1 otherwise. 39 + */ 40 + static int 41 + process_sigma_action(struct i2c_client *client, struct sigma_action *sa) 42 + { 22 43 size_t len = sigma_action_len(sa); 23 - int ret = 0; 44 + int ret; 24 45 25 46 pr_debug("%s: instr:%i addr:%#x len:%zu\n", __func__, 26 47 sa->instr, sa->addr, len); ··· 50 29 case SIGMA_ACTION_WRITEXBYTES: 51 30 case SIGMA_ACTION_WRITESINGLE: 52 31 case SIGMA_ACTION_WRITESAFELOAD: 53 - if (ssfw->fw->size < ssfw->pos + len) 54 - return -EINVAL; 55 32 ret = i2c_master_send(client, (void *)&sa->addr, len); 56 33 if (ret < 0) 57 34 return -EINVAL; 58 35 break; 59 - 60 36 case SIGMA_ACTION_DELAY: 61 - ret = 0; 62 37 udelay(len); 63 38 len = 0; 64 39 break; 65 - 66 40 case SIGMA_ACTION_END: 67 - return 1; 68 - 41 + return 0; 69 42 default: 70 43 return -EINVAL; 71 44 } 72 45 73 - /* when arrive here ret=0 or sent data */ 74 - ssfw->pos += sigma_action_size(sa, len); 75 - return ssfw->pos == ssfw->fw->size; 46 + return 1; 76 47 } 77 48 78 49 static int 79 50 process_sigma_actions(struct i2c_client *client, struct sigma_firmware *ssfw) 80 51 { 81 - pr_debug("%s: processing %p\n", __func__, ssfw); 52 + struct sigma_action *sa; 53 + size_t size; 54 + int ret; 82 55 83 - while (1) { 84 - int ret = process_sigma_action(client, ssfw); 56 + while (ssfw->pos + sizeof(*sa) <= ssfw->fw->size) { 57 + sa = (struct sigma_action *)(ssfw->fw->data + ssfw->pos); 58 + 59 + size = sigma_action_size(sa); 60 + ssfw->pos += size; 61 + if (ssfw->pos > ssfw->fw->size || size == 0) 62 + break; 63 + 64 + ret = process_sigma_action(client, sa); 65 + 85 66 pr_debug("%s: action returned %i\n", __func__, ret); 86 - if (ret == 1) 87 - return 0; 88 - else if (ret) 67 + 68 + if (ret <= 0) 89 69 return ret; 90 70 } 71 + 72 + if (ssfw->pos != ssfw->fw->size) 73 + return -EINVAL; 74 + 75 + return 0; 91 76 } 92 77 93 78 int process_sigma_firmware(struct i2c_client *client, const char *name) ··· 116 89 117 90 /* then verify the header */ 118 91 ret = -EINVAL; 119 - if (fw->size < sizeof(*ssfw_head)) 92 + 93 + /* 94 + * Reject too small or unreasonable large files. The upper limit has been 95 + * chosen a bit arbitrarily, but it should be enough for all practical 96 + * purposes and having the limit makes it easier to avoid integer 97 + * overflows later in the loading process. 98 + */ 99 + if (fw->size < sizeof(*ssfw_head) || fw->size >= 0x4000000) 120 100 goto done; 121 101 122 102 ssfw_head = (void *)fw->data; 123 103 if (memcmp(ssfw_head->magic, SIGMA_MAGIC, ARRAY_SIZE(ssfw_head->magic))) 124 104 goto done; 125 105 126 - crc = crc32(0, fw->data, fw->size); 106 + crc = crc32(0, fw->data + sizeof(*ssfw_head), 107 + fw->size - sizeof(*ssfw_head)); 127 108 pr_debug("%s: crc=%x\n", __func__, crc); 128 - if (crc != ssfw_head->crc) 109 + if (crc != le32_to_cpu(ssfw_head->crc)) 129 110 goto done; 130 111 131 112 ssfw.pos = sizeof(*ssfw_head);
+4 -9
include/linux/sigma.h
··· 24 24 struct sigma_firmware_header { 25 25 unsigned char magic[7]; 26 26 u8 version; 27 - u32 crc; 27 + __le32 crc; 28 28 }; 29 29 30 30 enum { ··· 40 40 struct sigma_action { 41 41 u8 instr; 42 42 u8 len_hi; 43 - u16 len; 44 - u16 addr; 43 + __le16 len; 44 + __be16 addr; 45 45 unsigned char payload[]; 46 46 }; 47 47 48 48 static inline u32 sigma_action_len(struct sigma_action *sa) 49 49 { 50 - return (sa->len_hi << 16) | sa->len; 51 - } 52 - 53 - static inline size_t sigma_action_size(struct sigma_action *sa, u32 payload_len) 54 - { 55 - return sizeof(*sa) + payload_len + (payload_len % 2); 50 + return (sa->len_hi << 16) | le16_to_cpu(sa->len); 56 51 } 57 52 58 53 extern int process_sigma_firmware(struct i2c_client *client, const char *name);
-1
sound/pci/hda/hda_intel.c
··· 2508 2508 SND_PCI_QUIRK(0x1043, 0x81b3, "ASUS", POS_FIX_LPIB), 2509 2509 SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS M2V", POS_FIX_LPIB), 2510 2510 SND_PCI_QUIRK(0x104d, 0x9069, "Sony VPCS11V9E", POS_FIX_LPIB), 2511 - SND_PCI_QUIRK(0x1106, 0x3288, "ASUS M2V-MX SE", POS_FIX_LPIB), 2512 2511 SND_PCI_QUIRK(0x1297, 0x3166, "Shuttle", POS_FIX_LPIB), 2513 2512 SND_PCI_QUIRK(0x1458, 0xa022, "ga-ma770-ud3", POS_FIX_LPIB), 2514 2513 SND_PCI_QUIRK(0x1462, 0x1002, "MSI Wind U115", POS_FIX_LPIB),
+3 -19
sound/pci/hda/patch_sigmatel.c
··· 4441 4441 int pinctl, def_conf; 4442 4442 4443 4443 /* power on when no jack detection is available */ 4444 - if (!spec->hp_detect) { 4444 + /* or when the VREF is used for controlling LED */ 4445 + if (!spec->hp_detect || 4446 + (spec->gpio_led > 8 && spec->gpio_led == nid)) { 4445 4447 stac_toggle_power_map(codec, nid, 1); 4446 4448 continue; 4447 4449 } ··· 5057 5055 return 0; 5058 5056 } 5059 5057 5060 - static int stac92xx_post_suspend(struct hda_codec *codec) 5061 - { 5062 - struct sigmatel_spec *spec = codec->spec; 5063 - if (spec->gpio_led > 8) { 5064 - /* with vref-out pin used for mute led control 5065 - * codec AFG is prevented from D3 state, but on 5066 - * system suspend it can (and should) be used 5067 - */ 5068 - snd_hda_codec_read(codec, codec->afg, 0, 5069 - AC_VERB_SET_POWER_STATE, AC_PWRST_D3); 5070 - } 5071 - return 0; 5072 - } 5073 - 5074 5058 static void stac92xx_set_power_state(struct hda_codec *codec, hda_nid_t fg, 5075 5059 unsigned int power_state) 5076 5060 { ··· 5656 5668 } else { 5657 5669 codec->patch_ops.set_power_state = 5658 5670 stac92xx_set_power_state; 5659 - codec->patch_ops.post_suspend = 5660 - stac92xx_post_suspend; 5661 5671 } 5662 5672 codec->patch_ops.pre_resume = stac92xx_pre_resume; 5663 5673 codec->patch_ops.check_power_status = ··· 5969 5983 } else { 5970 5984 codec->patch_ops.set_power_state = 5971 5985 stac92xx_set_power_state; 5972 - codec->patch_ops.post_suspend = 5973 - stac92xx_post_suspend; 5974 5986 } 5975 5987 codec->patch_ops.pre_resume = stac92xx_pre_resume; 5976 5988 codec->patch_ops.check_power_status =
+1 -20
sound/soc/atmel/Kconfig
··· 1 1 config SND_ATMEL_SOC 2 2 tristate "SoC Audio for the Atmel System-on-Chip" 3 - depends on ARCH_AT91 || AVR32 3 + depends on ARCH_AT91 4 4 help 5 5 Say Y or M if you want to add support for codecs attached to 6 6 the ATMEL SSC interface. You will also need ··· 23 23 help 24 24 Say Y if you want to add support for SoC audio on WM8731-based 25 25 AT91sam9g20 evaluation board. 26 - 27 - config SND_AT32_SOC_PLAYPAQ 28 - tristate "SoC Audio support for PlayPaq with WM8510" 29 - depends on SND_ATMEL_SOC && BOARD_PLAYPAQ && AT91_PROGRAMMABLE_CLOCKS 30 - select SND_ATMEL_SOC_SSC 31 - select SND_SOC_WM8510 32 - help 33 - Say Y or M here if you want to add support for SoC audio 34 - on the LRS PlayPaq. 35 - 36 - config SND_AT32_SOC_PLAYPAQ_SLAVE 37 - bool "Run CODEC on PlayPaq in slave mode" 38 - depends on SND_AT32_SOC_PLAYPAQ 39 - default n 40 - help 41 - Say Y if you want to run with the AT32 SSC generating the BCLK 42 - and FRAME signals on the PlayPaq. Unless you want to play 43 - with the AT32 as the SSC master, you probably want to say N here, 44 - as this will give you better sound quality. 45 26 46 27 config SND_AT91_SOC_AFEB9260 47 28 tristate "SoC Audio support for AFEB9260 board"
-4
sound/soc/atmel/Makefile
··· 8 8 # AT91 Machine Support 9 9 snd-soc-sam9g20-wm8731-objs := sam9g20_wm8731.o 10 10 11 - # AT32 Machine Support 12 - snd-soc-playpaq-objs := playpaq_wm8510.o 13 - 14 11 obj-$(CONFIG_SND_AT91_SOC_SAM9G20_WM8731) += snd-soc-sam9g20-wm8731.o 15 - obj-$(CONFIG_SND_AT32_SOC_PLAYPAQ) += snd-soc-playpaq.o 16 12 obj-$(CONFIG_SND_AT91_SOC_AFEB9260) += snd-soc-afeb9260.o
-473
sound/soc/atmel/playpaq_wm8510.c
··· 1 - /* sound/soc/at32/playpaq_wm8510.c 2 - * ASoC machine driver for PlayPaq using WM8510 codec 3 - * 4 - * Copyright (C) 2008 Long Range Systems 5 - * Geoffrey Wossum <gwossum@acm.org> 6 - * 7 - * This program is free software; you can redistribute it and/or modify 8 - * it under the terms of the GNU General Public License version 2 as 9 - * published by the Free Software Foundation. 10 - * 11 - * This code is largely inspired by sound/soc/at91/eti_b1_wm8731.c 12 - * 13 - * NOTE: If you don't have the AT32 enhanced portmux configured (which 14 - * isn't currently in the mainline or Atmel patched kernel), you will 15 - * need to set the MCLK pin (PA30) to peripheral A in your board initialization 16 - * code. Something like: 17 - * at32_select_periph(GPIO_PIN_PA(30), GPIO_PERIPH_A, 0); 18 - * 19 - */ 20 - 21 - /* #define DEBUG */ 22 - 23 - #include <linux/module.h> 24 - #include <linux/moduleparam.h> 25 - #include <linux/kernel.h> 26 - #include <linux/errno.h> 27 - #include <linux/clk.h> 28 - #include <linux/timer.h> 29 - #include <linux/interrupt.h> 30 - #include <linux/platform_device.h> 31 - 32 - #include <sound/core.h> 33 - #include <sound/pcm.h> 34 - #include <sound/pcm_params.h> 35 - #include <sound/soc.h> 36 - 37 - #include <mach/at32ap700x.h> 38 - #include <mach/portmux.h> 39 - 40 - #include "../codecs/wm8510.h" 41 - #include "atmel-pcm.h" 42 - #include "atmel_ssc_dai.h" 43 - 44 - 45 - /*-------------------------------------------------------------------------*\ 46 - * constants 47 - \*-------------------------------------------------------------------------*/ 48 - #define MCLK_PIN GPIO_PIN_PA(30) 49 - #define MCLK_PERIPH GPIO_PERIPH_A 50 - 51 - 52 - /*-------------------------------------------------------------------------*\ 53 - * data types 54 - \*-------------------------------------------------------------------------*/ 55 - /* SSC clocking data */ 56 - struct ssc_clock_data { 57 - /* CMR div */ 58 - unsigned int cmr_div; 59 - 60 - /* Frame period (as needed by xCMR.PERIOD) */ 61 - unsigned int period; 62 - 63 - /* The SSC clock rate these settings where calculated for */ 64 - unsigned long ssc_rate; 65 - }; 66 - 67 - 68 - /*-------------------------------------------------------------------------*\ 69 - * module data 70 - \*-------------------------------------------------------------------------*/ 71 - static struct clk *_gclk0; 72 - static struct clk *_pll0; 73 - 74 - #define CODEC_CLK (_gclk0) 75 - 76 - 77 - /*-------------------------------------------------------------------------*\ 78 - * Sound SOC operations 79 - \*-------------------------------------------------------------------------*/ 80 - #if defined CONFIG_SND_AT32_SOC_PLAYPAQ_SLAVE 81 - static struct ssc_clock_data playpaq_wm8510_calc_ssc_clock( 82 - struct snd_pcm_hw_params *params, 83 - struct snd_soc_dai *cpu_dai) 84 - { 85 - struct at32_ssc_info *ssc_p = snd_soc_dai_get_drvdata(cpu_dai); 86 - struct ssc_device *ssc = ssc_p->ssc; 87 - struct ssc_clock_data cd; 88 - unsigned int rate, width_bits, channels; 89 - unsigned int bitrate, ssc_div; 90 - unsigned actual_rate; 91 - 92 - 93 - /* 94 - * Figure out required bitrate 95 - */ 96 - rate = params_rate(params); 97 - channels = params_channels(params); 98 - width_bits = snd_pcm_format_physical_width(params_format(params)); 99 - bitrate = rate * width_bits * channels; 100 - 101 - 102 - /* 103 - * Figure out required SSC divider and period for required bitrate 104 - */ 105 - cd.ssc_rate = clk_get_rate(ssc->clk); 106 - ssc_div = cd.ssc_rate / bitrate; 107 - cd.cmr_div = ssc_div / 2; 108 - if (ssc_div & 1) { 109 - /* round cmr_div up */ 110 - cd.cmr_div++; 111 - } 112 - cd.period = width_bits - 1; 113 - 114 - 115 - /* 116 - * Find actual rate, compare to requested rate 117 - */ 118 - actual_rate = (cd.ssc_rate / (cd.cmr_div * 2)) / (2 * (cd.period + 1)); 119 - pr_debug("playpaq_wm8510: Request rate = %u, actual rate = %u\n", 120 - rate, actual_rate); 121 - 122 - 123 - return cd; 124 - } 125 - #endif /* CONFIG_SND_AT32_SOC_PLAYPAQ_SLAVE */ 126 - 127 - 128 - 129 - static int playpaq_wm8510_hw_params(struct snd_pcm_substream *substream, 130 - struct snd_pcm_hw_params *params) 131 - { 132 - struct snd_soc_pcm_runtime *rtd = substream->private_data; 133 - struct snd_soc_dai *codec_dai = rtd->codec_dai; 134 - struct snd_soc_dai *cpu_dai = rtd->cpu_dai; 135 - struct at32_ssc_info *ssc_p = snd_soc_dai_get_drvdata(cpu_dai); 136 - struct ssc_device *ssc = ssc_p->ssc; 137 - unsigned int pll_out = 0, bclk = 0, mclk_div = 0; 138 - int ret; 139 - 140 - 141 - /* Due to difficulties with getting the correct clocks from the AT32's 142 - * PLL0, we're going to let the CODEC be in charge of all the clocks 143 - */ 144 - #if !defined CONFIG_SND_AT32_SOC_PLAYPAQ_SLAVE 145 - const unsigned int fmt = (SND_SOC_DAIFMT_I2S | 146 - SND_SOC_DAIFMT_NB_NF | 147 - SND_SOC_DAIFMT_CBM_CFM); 148 - #else 149 - struct ssc_clock_data cd; 150 - const unsigned int fmt = (SND_SOC_DAIFMT_I2S | 151 - SND_SOC_DAIFMT_NB_NF | 152 - SND_SOC_DAIFMT_CBS_CFS); 153 - #endif 154 - 155 - if (ssc == NULL) { 156 - pr_warning("playpaq_wm8510_hw_params: ssc is NULL!\n"); 157 - return -EINVAL; 158 - } 159 - 160 - 161 - /* 162 - * Figure out PLL and BCLK dividers for WM8510 163 - */ 164 - switch (params_rate(params)) { 165 - case 48000: 166 - pll_out = 24576000; 167 - mclk_div = WM8510_MCLKDIV_2; 168 - bclk = WM8510_BCLKDIV_8; 169 - break; 170 - 171 - case 44100: 172 - pll_out = 22579200; 173 - mclk_div = WM8510_MCLKDIV_2; 174 - bclk = WM8510_BCLKDIV_8; 175 - break; 176 - 177 - case 22050: 178 - pll_out = 22579200; 179 - mclk_div = WM8510_MCLKDIV_4; 180 - bclk = WM8510_BCLKDIV_8; 181 - break; 182 - 183 - case 16000: 184 - pll_out = 24576000; 185 - mclk_div = WM8510_MCLKDIV_6; 186 - bclk = WM8510_BCLKDIV_8; 187 - break; 188 - 189 - case 11025: 190 - pll_out = 22579200; 191 - mclk_div = WM8510_MCLKDIV_8; 192 - bclk = WM8510_BCLKDIV_8; 193 - break; 194 - 195 - case 8000: 196 - pll_out = 24576000; 197 - mclk_div = WM8510_MCLKDIV_12; 198 - bclk = WM8510_BCLKDIV_8; 199 - break; 200 - 201 - default: 202 - pr_warning("playpaq_wm8510: Unsupported sample rate %d\n", 203 - params_rate(params)); 204 - return -EINVAL; 205 - } 206 - 207 - 208 - /* 209 - * set CPU and CODEC DAI configuration 210 - */ 211 - ret = snd_soc_dai_set_fmt(codec_dai, fmt); 212 - if (ret < 0) { 213 - pr_warning("playpaq_wm8510: " 214 - "Failed to set CODEC DAI format (%d)\n", 215 - ret); 216 - return ret; 217 - } 218 - ret = snd_soc_dai_set_fmt(cpu_dai, fmt); 219 - if (ret < 0) { 220 - pr_warning("playpaq_wm8510: " 221 - "Failed to set CPU DAI format (%d)\n", 222 - ret); 223 - return ret; 224 - } 225 - 226 - 227 - /* 228 - * Set CPU clock configuration 229 - */ 230 - #if defined CONFIG_SND_AT32_SOC_PLAYPAQ_SLAVE 231 - cd = playpaq_wm8510_calc_ssc_clock(params, cpu_dai); 232 - pr_debug("playpaq_wm8510: cmr_div = %d, period = %d\n", 233 - cd.cmr_div, cd.period); 234 - ret = snd_soc_dai_set_clkdiv(cpu_dai, AT32_SSC_CMR_DIV, cd.cmr_div); 235 - if (ret < 0) { 236 - pr_warning("playpaq_wm8510: Failed to set CPU CMR_DIV (%d)\n", 237 - ret); 238 - return ret; 239 - } 240 - ret = snd_soc_dai_set_clkdiv(cpu_dai, AT32_SSC_TCMR_PERIOD, 241 - cd.period); 242 - if (ret < 0) { 243 - pr_warning("playpaq_wm8510: " 244 - "Failed to set CPU transmit period (%d)\n", 245 - ret); 246 - return ret; 247 - } 248 - #endif /* CONFIG_SND_AT32_SOC_PLAYPAQ_SLAVE */ 249 - 250 - 251 - /* 252 - * Set CODEC clock configuration 253 - */ 254 - pr_debug("playpaq_wm8510: " 255 - "pll_in = %ld, pll_out = %u, bclk = %x, mclk = %x\n", 256 - clk_get_rate(CODEC_CLK), pll_out, bclk, mclk_div); 257 - 258 - 259 - #if !defined CONFIG_SND_AT32_SOC_PLAYPAQ_SLAVE 260 - ret = snd_soc_dai_set_clkdiv(codec_dai, WM8510_BCLKDIV, bclk); 261 - if (ret < 0) { 262 - pr_warning 263 - ("playpaq_wm8510: Failed to set CODEC DAI BCLKDIV (%d)\n", 264 - ret); 265 - return ret; 266 - } 267 - #endif /* CONFIG_SND_AT32_SOC_PLAYPAQ_SLAVE */ 268 - 269 - 270 - ret = snd_soc_dai_set_pll(codec_dai, 0, 0, 271 - clk_get_rate(CODEC_CLK), pll_out); 272 - if (ret < 0) { 273 - pr_warning("playpaq_wm8510: Failed to set CODEC DAI PLL (%d)\n", 274 - ret); 275 - return ret; 276 - } 277 - 278 - 279 - ret = snd_soc_dai_set_clkdiv(codec_dai, WM8510_MCLKDIV, mclk_div); 280 - if (ret < 0) { 281 - pr_warning("playpaq_wm8510: Failed to set CODEC MCLKDIV (%d)\n", 282 - ret); 283 - return ret; 284 - } 285 - 286 - 287 - return 0; 288 - } 289 - 290 - 291 - 292 - static struct snd_soc_ops playpaq_wm8510_ops = { 293 - .hw_params = playpaq_wm8510_hw_params, 294 - }; 295 - 296 - 297 - 298 - static const struct snd_soc_dapm_widget playpaq_dapm_widgets[] = { 299 - SND_SOC_DAPM_MIC("Int Mic", NULL), 300 - SND_SOC_DAPM_SPK("Ext Spk", NULL), 301 - }; 302 - 303 - 304 - 305 - static const struct snd_soc_dapm_route intercon[] = { 306 - /* speaker connected to SPKOUT */ 307 - {"Ext Spk", NULL, "SPKOUTP"}, 308 - {"Ext Spk", NULL, "SPKOUTN"}, 309 - 310 - {"Mic Bias", NULL, "Int Mic"}, 311 - {"MICN", NULL, "Mic Bias"}, 312 - {"MICP", NULL, "Mic Bias"}, 313 - }; 314 - 315 - 316 - 317 - static int playpaq_wm8510_init(struct snd_soc_pcm_runtime *rtd) 318 - { 319 - struct snd_soc_codec *codec = rtd->codec; 320 - struct snd_soc_dapm_context *dapm = &codec->dapm; 321 - int i; 322 - 323 - /* 324 - * Add DAPM widgets 325 - */ 326 - for (i = 0; i < ARRAY_SIZE(playpaq_dapm_widgets); i++) 327 - snd_soc_dapm_new_control(dapm, &playpaq_dapm_widgets[i]); 328 - 329 - 330 - 331 - /* 332 - * Setup audio path interconnects 333 - */ 334 - snd_soc_dapm_add_routes(dapm, intercon, ARRAY_SIZE(intercon)); 335 - 336 - 337 - 338 - /* always connected pins */ 339 - snd_soc_dapm_enable_pin(dapm, "Int Mic"); 340 - snd_soc_dapm_enable_pin(dapm, "Ext Spk"); 341 - 342 - 343 - 344 - /* Make CSB show PLL rate */ 345 - snd_soc_dai_set_clkdiv(rtd->codec_dai, WM8510_OPCLKDIV, 346 - WM8510_OPCLKDIV_1 | 4); 347 - 348 - return 0; 349 - } 350 - 351 - 352 - 353 - static struct snd_soc_dai_link playpaq_wm8510_dai = { 354 - .name = "WM8510", 355 - .stream_name = "WM8510 PCM", 356 - .cpu_dai_name= "atmel-ssc-dai.0", 357 - .platform_name = "atmel-pcm-audio", 358 - .codec_name = "wm8510-codec.0-0x1a", 359 - .codec_dai_name = "wm8510-hifi", 360 - .init = playpaq_wm8510_init, 361 - .ops = &playpaq_wm8510_ops, 362 - }; 363 - 364 - 365 - 366 - static struct snd_soc_card snd_soc_playpaq = { 367 - .name = "LRS_PlayPaq_WM8510", 368 - .dai_link = &playpaq_wm8510_dai, 369 - .num_links = 1, 370 - }; 371 - 372 - static struct platform_device *playpaq_snd_device; 373 - 374 - 375 - static int __init playpaq_asoc_init(void) 376 - { 377 - int ret = 0; 378 - 379 - /* 380 - * Configure MCLK for WM8510 381 - */ 382 - _gclk0 = clk_get(NULL, "gclk0"); 383 - if (IS_ERR(_gclk0)) { 384 - _gclk0 = NULL; 385 - ret = PTR_ERR(_gclk0); 386 - goto err_gclk0; 387 - } 388 - _pll0 = clk_get(NULL, "pll0"); 389 - if (IS_ERR(_pll0)) { 390 - _pll0 = NULL; 391 - ret = PTR_ERR(_pll0); 392 - goto err_pll0; 393 - } 394 - ret = clk_set_parent(_gclk0, _pll0); 395 - if (ret) { 396 - pr_warning("snd-soc-playpaq: " 397 - "Failed to set PLL0 as parent for DAC clock\n"); 398 - goto err_set_clk; 399 - } 400 - clk_set_rate(CODEC_CLK, 12000000); 401 - clk_enable(CODEC_CLK); 402 - 403 - #if defined CONFIG_AT32_ENHANCED_PORTMUX 404 - at32_select_periph(MCLK_PIN, MCLK_PERIPH, 0); 405 - #endif 406 - 407 - 408 - /* 409 - * Create and register platform device 410 - */ 411 - playpaq_snd_device = platform_device_alloc("soc-audio", 0); 412 - if (playpaq_snd_device == NULL) { 413 - ret = -ENOMEM; 414 - goto err_device_alloc; 415 - } 416 - 417 - platform_set_drvdata(playpaq_snd_device, &snd_soc_playpaq); 418 - 419 - ret = platform_device_add(playpaq_snd_device); 420 - if (ret) { 421 - pr_warning("playpaq_wm8510: platform_device_add failed (%d)\n", 422 - ret); 423 - goto err_device_add; 424 - } 425 - 426 - return 0; 427 - 428 - 429 - err_device_add: 430 - if (playpaq_snd_device != NULL) { 431 - platform_device_put(playpaq_snd_device); 432 - playpaq_snd_device = NULL; 433 - } 434 - err_device_alloc: 435 - err_set_clk: 436 - if (_pll0 != NULL) { 437 - clk_put(_pll0); 438 - _pll0 = NULL; 439 - } 440 - err_pll0: 441 - if (_gclk0 != NULL) { 442 - clk_put(_gclk0); 443 - _gclk0 = NULL; 444 - } 445 - return ret; 446 - } 447 - 448 - 449 - static void __exit playpaq_asoc_exit(void) 450 - { 451 - if (_gclk0 != NULL) { 452 - clk_put(_gclk0); 453 - _gclk0 = NULL; 454 - } 455 - if (_pll0 != NULL) { 456 - clk_put(_pll0); 457 - _pll0 = NULL; 458 - } 459 - 460 - #if defined CONFIG_AT32_ENHANCED_PORTMUX 461 - at32_free_pin(MCLK_PIN); 462 - #endif 463 - 464 - platform_device_unregister(playpaq_snd_device); 465 - playpaq_snd_device = NULL; 466 - } 467 - 468 - module_init(playpaq_asoc_init); 469 - module_exit(playpaq_asoc_exit); 470 - 471 - MODULE_AUTHOR("Geoffrey Wossum <gwossum@acm.org>"); 472 - MODULE_DESCRIPTION("ASoC machine driver for LRS PlayPaq"); 473 - MODULE_LICENSE("GPL");
+1 -1
sound/soc/codecs/ad1836.h
··· 34 34 35 35 #define AD1836_ADC_CTRL2 13 36 36 #define AD1836_ADC_WORD_LEN_MASK 0x30 37 - #define AD1836_ADC_WORD_OFFSET 5 37 + #define AD1836_ADC_WORD_OFFSET 4 38 38 #define AD1836_ADC_SERFMT_MASK (7 << 6) 39 39 #define AD1836_ADC_SERFMT_PCK256 (0x4 << 6) 40 40 #define AD1836_ADC_SERFMT_PCK128 (0x5 << 6)
+1 -9
sound/soc/codecs/cs4270.c
··· 601 601 static int cs4270_soc_resume(struct snd_soc_codec *codec) 602 602 { 603 603 struct cs4270_private *cs4270 = snd_soc_codec_get_drvdata(codec); 604 - struct i2c_client *i2c_client = to_i2c_client(codec->dev); 605 604 int reg; 606 605 607 606 regulator_bulk_enable(ARRAY_SIZE(cs4270->supplies), ··· 611 612 ndelay(500); 612 613 613 614 /* first restore the entire register cache ... */ 614 - for (reg = CS4270_FIRSTREG; reg <= CS4270_LASTREG; reg++) { 615 - u8 val = snd_soc_read(codec, reg); 616 - 617 - if (i2c_smbus_write_byte_data(i2c_client, reg, val)) { 618 - dev_err(codec->dev, "i2c write failed\n"); 619 - return -EIO; 620 - } 621 - } 615 + snd_soc_cache_sync(codec); 622 616 623 617 /* ... then disable the power-down bits */ 624 618 reg = snd_soc_read(codec, CS4270_PWRCTL);
+1 -1
sound/soc/codecs/cs42l51.c
··· 555 555 556 556 static struct snd_soc_codec_driver soc_codec_device_cs42l51 = { 557 557 .probe = cs42l51_probe, 558 - .reg_cache_size = CS42L51_NUMREGS, 558 + .reg_cache_size = CS42L51_NUMREGS + 1, 559 559 .reg_word_size = sizeof(u8), 560 560 }; 561 561
+5 -5
sound/soc/codecs/max9877.c
··· 106 106 unsigned int mask = mc->max; 107 107 unsigned int val = (ucontrol->value.integer.value[0] & mask); 108 108 unsigned int val2 = (ucontrol->value.integer.value[1] & mask); 109 - unsigned int change = 1; 109 + unsigned int change = 0; 110 110 111 - if (((max9877_regs[reg] >> shift) & mask) == val) 112 - change = 0; 111 + if (((max9877_regs[reg] >> shift) & mask) != val) 112 + change = 1; 113 113 114 - if (((max9877_regs[reg2] >> shift) & mask) == val2) 115 - change = 0; 114 + if (((max9877_regs[reg2] >> shift) & mask) != val2) 115 + change = 1; 116 116 117 117 if (change) { 118 118 max9877_regs[reg] &= ~(mask << shift);
+7
sound/soc/codecs/wm8994.c
··· 2357 2357 bclk |= best << WM8994_AIF1_BCLK_DIV_SHIFT; 2358 2358 2359 2359 lrclk = bclk_rate / params_rate(params); 2360 + if (!lrclk) { 2361 + dev_err(dai->dev, "Unable to generate LRCLK from %dHz BCLK\n", 2362 + bclk_rate); 2363 + return -EINVAL; 2364 + } 2360 2365 dev_dbg(dai->dev, "Using LRCLK rate %d for actual LRCLK %dHz\n", 2361 2366 lrclk, bclk_rate / lrclk); 2362 2367 ··· 3183 3178 switch (wm8994->revision) { 3184 3179 case 0: 3185 3180 case 1: 3181 + case 2: 3182 + case 3: 3186 3183 wm8994->hubs.dcs_codes_l = -9; 3187 3184 wm8994->hubs.dcs_codes_r = -5; 3188 3185 break;
+16 -8
sound/soc/fsl/mpc8610_hpcd.c
··· 392 392 } 393 393 394 394 if (strcasecmp(sprop, "i2s-slave") == 0) { 395 - machine_data->dai_format = SND_SOC_DAIFMT_I2S; 395 + machine_data->dai_format = 396 + SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_CBM_CFM; 396 397 machine_data->codec_clk_direction = SND_SOC_CLOCK_OUT; 397 398 machine_data->cpu_clk_direction = SND_SOC_CLOCK_IN; 398 399 ··· 410 409 } 411 410 machine_data->clk_frequency = be32_to_cpup(iprop); 412 411 } else if (strcasecmp(sprop, "i2s-master") == 0) { 413 - machine_data->dai_format = SND_SOC_DAIFMT_I2S; 412 + machine_data->dai_format = 413 + SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_CBS_CFS; 414 414 machine_data->codec_clk_direction = SND_SOC_CLOCK_IN; 415 415 machine_data->cpu_clk_direction = SND_SOC_CLOCK_OUT; 416 416 } else if (strcasecmp(sprop, "lj-slave") == 0) { 417 - machine_data->dai_format = SND_SOC_DAIFMT_LEFT_J; 417 + machine_data->dai_format = 418 + SND_SOC_DAIFMT_LEFT_J | SND_SOC_DAIFMT_CBM_CFM; 418 419 machine_data->codec_clk_direction = SND_SOC_CLOCK_OUT; 419 420 machine_data->cpu_clk_direction = SND_SOC_CLOCK_IN; 420 421 } else if (strcasecmp(sprop, "lj-master") == 0) { 421 - machine_data->dai_format = SND_SOC_DAIFMT_LEFT_J; 422 + machine_data->dai_format = 423 + SND_SOC_DAIFMT_LEFT_J | SND_SOC_DAIFMT_CBS_CFS; 422 424 machine_data->codec_clk_direction = SND_SOC_CLOCK_IN; 423 425 machine_data->cpu_clk_direction = SND_SOC_CLOCK_OUT; 424 426 } else if (strcasecmp(sprop, "rj-slave") == 0) { 425 - machine_data->dai_format = SND_SOC_DAIFMT_RIGHT_J; 427 + machine_data->dai_format = 428 + SND_SOC_DAIFMT_RIGHT_J | SND_SOC_DAIFMT_CBM_CFM; 426 429 machine_data->codec_clk_direction = SND_SOC_CLOCK_OUT; 427 430 machine_data->cpu_clk_direction = SND_SOC_CLOCK_IN; 428 431 } else if (strcasecmp(sprop, "rj-master") == 0) { 429 - machine_data->dai_format = SND_SOC_DAIFMT_RIGHT_J; 432 + machine_data->dai_format = 433 + SND_SOC_DAIFMT_RIGHT_J | SND_SOC_DAIFMT_CBS_CFS; 430 434 machine_data->codec_clk_direction = SND_SOC_CLOCK_IN; 431 435 machine_data->cpu_clk_direction = SND_SOC_CLOCK_OUT; 432 436 } else if (strcasecmp(sprop, "ac97-slave") == 0) { 433 - machine_data->dai_format = SND_SOC_DAIFMT_AC97; 437 + machine_data->dai_format = 438 + SND_SOC_DAIFMT_AC97 | SND_SOC_DAIFMT_CBM_CFM; 434 439 machine_data->codec_clk_direction = SND_SOC_CLOCK_OUT; 435 440 machine_data->cpu_clk_direction = SND_SOC_CLOCK_IN; 436 441 } else if (strcasecmp(sprop, "ac97-master") == 0) { 437 - machine_data->dai_format = SND_SOC_DAIFMT_AC97; 442 + machine_data->dai_format = 443 + SND_SOC_DAIFMT_AC97 | SND_SOC_DAIFMT_CBS_CFS; 438 444 machine_data->codec_clk_direction = SND_SOC_CLOCK_IN; 439 445 machine_data->cpu_clk_direction = SND_SOC_CLOCK_OUT; 440 446 } else {
+1
sound/soc/samsung/smdk_wm8994.c
··· 9 9 10 10 #include "../codecs/wm8994.h" 11 11 #include <sound/pcm_params.h> 12 + #include <linux/module.h> 12 13 13 14 /* 14 15 * Default CFG switch settings to use this driver:
+1 -1
sound/soc/samsung/speyside.c
··· 191 191 snd_soc_dapm_ignore_suspend(&card->dapm, "Headset Mic"); 192 192 snd_soc_dapm_ignore_suspend(&card->dapm, "Main AMIC"); 193 193 snd_soc_dapm_ignore_suspend(&card->dapm, "Main DMIC"); 194 - snd_soc_dapm_ignore_suspend(&card->dapm, "Speaker"); 194 + snd_soc_dapm_ignore_suspend(&card->dapm, "Main Speaker"); 195 195 snd_soc_dapm_ignore_suspend(&card->dapm, "WM1250 Output"); 196 196 snd_soc_dapm_ignore_suspend(&card->dapm, "WM1250 Input"); 197 197
+6
sound/soc/soc-core.c
··· 709 709 struct snd_soc_card *card = dev_get_drvdata(dev); 710 710 int i, ac97_control = 0; 711 711 712 + /* If the initialization of this soc device failed, there is no codec 713 + * associated with it. Just bail out in this case. 714 + */ 715 + if (list_empty(&card->codec_dev_list)) 716 + return 0; 717 + 712 718 /* AC97 devices might have other drivers hanging off them so 713 719 * need to resume immediately. Other drivers don't have that 714 720 * problem and may take a substantial amount of time to resume
+31
sound/usb/quirks-table.h
··· 1633 1633 } 1634 1634 }, 1635 1635 { 1636 + /* Roland GAIA SH-01 */ 1637 + USB_DEVICE(0x0582, 0x0111), 1638 + .driver_info = (unsigned long) &(const struct snd_usb_audio_quirk) { 1639 + .vendor_name = "Roland", 1640 + .product_name = "GAIA", 1641 + .ifnum = QUIRK_ANY_INTERFACE, 1642 + .type = QUIRK_COMPOSITE, 1643 + .data = (const struct snd_usb_audio_quirk[]) { 1644 + { 1645 + .ifnum = 0, 1646 + .type = QUIRK_AUDIO_STANDARD_INTERFACE 1647 + }, 1648 + { 1649 + .ifnum = 1, 1650 + .type = QUIRK_AUDIO_STANDARD_INTERFACE 1651 + }, 1652 + { 1653 + .ifnum = 2, 1654 + .type = QUIRK_MIDI_FIXED_ENDPOINT, 1655 + .data = &(const struct snd_usb_midi_endpoint_info) { 1656 + .out_cables = 0x0003, 1657 + .in_cables = 0x0003 1658 + } 1659 + }, 1660 + { 1661 + .ifnum = -1 1662 + } 1663 + } 1664 + } 1665 + }, 1666 + { 1636 1667 USB_DEVICE(0x0582, 0x0113), 1637 1668 .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) { 1638 1669 /* .vendor_name = "BOSS", */