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

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6:
ALSA: HDA: Realtek: Avoid unnecessary volume control index on Surround/Side
ASoC: Support !REGULATOR build for sgtl5000
ALSA: hda - VIA: Fix VT1708 can't build up Headphone control issue
ALSA: hda - VIA: Correct stream names for VT1818S
ALSA: hda - VIA: Fix codec type for VT1708BCE at the right timing
ALSA: hda - VIA: Fix invalid A-A path volume adjust issue
ALSA: hda - VIA: Add missing support for VT1718S in A-A path
ALSA: hda - VIA: Fix independent headphone no sound issue
ALSA: hda - VIA: Fix stereo mixer recording no sound issue
ALSA: hda - Set EAPD for Realtek ALC665
ALSA: usb - Remove trailing spaces from USB card name strings
sound: read i_size with i_size_read()
ASoC: Remove bogus check for register validity in debugfs write
ASoC: mini2440: Fix uda134x codec problem.

+109 -29
+7
arch/arm/mach-s3c2440/mach-mini2440.c
··· 488 }, 489 }; 490 491 static struct platform_device *mini2440_devices[] __initdata = { 492 &s3c_device_ohci, 493 &s3c_device_wdt, ··· 508 &s3c_device_nand, 509 &s3c_device_sdi, 510 &s3c_device_iis, 511 &mini2440_audio, 512 }; 513 514 static void __init mini2440_map_io(void)
··· 488 }, 489 }; 490 491 + static struct platform_device uda1340_codec = { 492 + .name = "uda134x-codec", 493 + .id = -1, 494 + }; 495 + 496 static struct platform_device *mini2440_devices[] __initdata = { 497 &s3c_device_ohci, 498 &s3c_device_wdt, ··· 503 &s3c_device_nand, 504 &s3c_device_sdi, 505 &s3c_device_iis, 506 + &uda1340_codec, 507 &mini2440_audio, 508 + &samsung_asoc_dma, 509 }; 510 511 static void __init mini2440_map_io(void)
+19 -8
sound/pci/hda/patch_realtek.c
··· 1265 case 0x10ec0660: 1266 case 0x10ec0662: 1267 case 0x10ec0663: 1268 case 0x10ec0862: 1269 case 0x10ec0889: 1270 set_eapd(codec, 0x14, 1); ··· 4241 case 0x10ec0660: 4242 case 0x10ec0662: 4243 case 0x10ec0663: 4244 case 0x10ec0862: 4245 case 0x10ec0889: 4246 set_eapd(codec, 0x14, 0); ··· 16008 return err; 16009 } else { 16010 const char *name = pfx; 16011 - if (!name) 16012 name = chname[i]; 16013 - err = __alc861_create_out_sw(codec, name, nid, i, 3); 16014 if (err < 0) 16015 return err; 16016 } ··· 17164 return err; 17165 } else { 17166 const char *name = pfx; 17167 - if (!name) 17168 name = chname[i]; 17169 err = __add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, 17170 - name, i, 17171 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, 17172 HDA_OUTPUT)); 17173 if (err < 0) 17174 return err; 17175 err = __add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, 17176 - name, i, 17177 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, 17178 HDA_INPUT)); 17179 if (err < 0) ··· 19225 return err; 19226 } else { 19227 const char *name = pfx; 19228 - if (!name) 19229 name = chname[i]; 19230 - err = __alc662_add_vol_ctl(spec, name, nid, i, 3); 19231 if (err < 0) 19232 return err; 19233 - err = __alc662_add_sw_ctl(spec, name, mix, i, 3); 19234 if (err < 0) 19235 return err; 19236 }
··· 1265 case 0x10ec0660: 1266 case 0x10ec0662: 1267 case 0x10ec0663: 1268 + case 0x10ec0665: 1269 case 0x10ec0862: 1270 case 0x10ec0889: 1271 set_eapd(codec, 0x14, 1); ··· 4240 case 0x10ec0660: 4241 case 0x10ec0662: 4242 case 0x10ec0663: 4243 + case 0x10ec0665: 4244 case 0x10ec0862: 4245 case 0x10ec0889: 4246 set_eapd(codec, 0x14, 0); ··· 16006 return err; 16007 } else { 16008 const char *name = pfx; 16009 + int index = i; 16010 + if (!name) { 16011 name = chname[i]; 16012 + index = 0; 16013 + } 16014 + err = __alc861_create_out_sw(codec, name, nid, index, 3); 16015 if (err < 0) 16016 return err; 16017 } ··· 17159 return err; 17160 } else { 17161 const char *name = pfx; 17162 + int index = i; 17163 + if (!name) { 17164 name = chname[i]; 17165 + index = 0; 17166 + } 17167 err = __add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, 17168 + name, index, 17169 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, 17170 HDA_OUTPUT)); 17171 if (err < 0) 17172 return err; 17173 err = __add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, 17174 + name, index, 17175 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, 17176 HDA_INPUT)); 17177 if (err < 0) ··· 19217 return err; 19218 } else { 19219 const char *name = pfx; 19220 + int index = i; 19221 + if (!name) { 19222 name = chname[i]; 19223 + index = 0; 19224 + } 19225 + err = __alc662_add_vol_ctl(spec, name, nid, index, 3); 19226 if (err < 0) 19227 return err; 19228 + err = __alc662_add_sw_ctl(spec, name, mix, index, 3); 19229 if (err < 0) 19230 return err; 19231 }
+46 -12
sound/pci/hda/patch_via.c
··· 159 #endif 160 }; 161 162 static struct via_spec * via_new_spec(struct hda_codec *codec) 163 { 164 struct via_spec *spec; ··· 170 171 codec->spec = spec; 172 spec->codec = codec; 173 return spec; 174 } 175 ··· 1106 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); 1107 struct via_spec *spec = codec->spec; 1108 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); 1109 1110 if (!spec->mux_nids[adc_idx]) 1111 return -EINVAL; ··· 1115 AC_VERB_GET_POWER_STATE, 0x00) != AC_PWRST_D0) 1116 snd_hda_codec_write(codec, spec->mux_nids[adc_idx], 0, 1117 AC_VERB_SET_POWER_STATE, AC_PWRST_D0); 1118 /* update jack power state */ 1119 set_jack_power_state(codec); 1120 1121 - return snd_hda_input_mux_put(codec, spec->input_mux, ucontrol, 1122 - spec->mux_nids[adc_idx], 1123 - &spec->cur_mux[adc_idx]); 1124 } 1125 1126 static int via_independent_hp_info(struct snd_kcontrol *kcontrol, ··· 1196 /* Get Independent Mode index of headphone pin widget */ 1197 spec->hp_independent_mode = spec->hp_independent_mode_index == pinsel 1198 ? 1 : 0; 1199 - snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, pinsel); 1200 1201 if (spec->multiout.hp_nid && spec->multiout.hp_nid 1202 != spec->multiout.dac_nids[HDA_FRONT]) 1203 snd_hda_codec_setup_stream(codec, spec->multiout.hp_nid, ··· 1224 activate_ctl(codec, "Headphone Playback Switch", 1225 spec->hp_independent_mode); 1226 } 1227 return 0; 1228 } 1229 ··· 1266 break; 1267 } 1268 1269 - nums = snd_hda_get_connections(codec, nid, conn, HDA_MAX_CONNECTIONS); 1270 - if (nums <= 1) 1271 - return 0; 1272 1273 knew = via_clone_control(spec, &via_hp_mixer[0]); 1274 if (knew == NULL) ··· 1330 nid_mixer = 0x16; 1331 start_idx = 2; 1332 end_idx = 4; 1333 break; 1334 default: 1335 return; ··· 2211 for (i = 0; i < spec->num_iverbs; i++) 2212 snd_hda_sequence_write(codec, spec->init_verbs[i]); 2213 2214 - spec->codec_type = get_codec_type(codec); 2215 - if (spec->codec_type == VT1708BCE) 2216 - spec->codec_type = VT1708S; /* VT1708BCE & VT1708S are almost 2217 - same */ 2218 /* Lydia Add for EAPD enable */ 2219 if (!spec->dig_in_nid) { /* No Digital In connection */ 2220 if (spec->dig_in_pin) { ··· 2460 else 2461 type_idx = 0; 2462 label = hda_get_autocfg_input_label(codec, cfg, i); 2463 - err = via_new_analog_input(spec, label, type_idx, idx, cap_nid); 2464 if (err < 0) 2465 return err; 2466 snd_hda_add_imux_item(imux, label, idx, NULL); ··· 4175 "%s %s", codec->vendor_name, codec->chip_name); 4176 spec->stream_name_analog = "VT1708BCE Analog"; 4177 spec->stream_name_digital = "VT1708BCE Digital"; 4178 } 4179 return 0; 4180 }
··· 159 #endif 160 }; 161 162 + static enum VIA_HDA_CODEC get_codec_type(struct hda_codec *codec); 163 static struct via_spec * via_new_spec(struct hda_codec *codec) 164 { 165 struct via_spec *spec; ··· 169 170 codec->spec = spec; 171 spec->codec = codec; 172 + spec->codec_type = get_codec_type(codec); 173 + /* VT1708BCE & VT1708S are almost same */ 174 + if (spec->codec_type == VT1708BCE) 175 + spec->codec_type = VT1708S; 176 return spec; 177 } 178 ··· 1101 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); 1102 struct via_spec *spec = codec->spec; 1103 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); 1104 + int ret; 1105 1106 if (!spec->mux_nids[adc_idx]) 1107 return -EINVAL; ··· 1109 AC_VERB_GET_POWER_STATE, 0x00) != AC_PWRST_D0) 1110 snd_hda_codec_write(codec, spec->mux_nids[adc_idx], 0, 1111 AC_VERB_SET_POWER_STATE, AC_PWRST_D0); 1112 + 1113 + ret = snd_hda_input_mux_put(codec, spec->input_mux, ucontrol, 1114 + spec->mux_nids[adc_idx], 1115 + &spec->cur_mux[adc_idx]); 1116 /* update jack power state */ 1117 set_jack_power_state(codec); 1118 1119 + return ret; 1120 } 1121 1122 static int via_independent_hp_info(struct snd_kcontrol *kcontrol, ··· 1188 /* Get Independent Mode index of headphone pin widget */ 1189 spec->hp_independent_mode = spec->hp_independent_mode_index == pinsel 1190 ? 1 : 0; 1191 + if (spec->codec_type == VT1718S) 1192 + snd_hda_codec_write(codec, nid, 0, 1193 + AC_VERB_SET_CONNECT_SEL, pinsel ? 2 : 0); 1194 + else 1195 + snd_hda_codec_write(codec, nid, 0, 1196 + AC_VERB_SET_CONNECT_SEL, pinsel); 1197 1198 + if (spec->codec_type == VT1812) 1199 + snd_hda_codec_write(codec, 0x35, 0, 1200 + AC_VERB_SET_CONNECT_SEL, pinsel); 1201 if (spec->multiout.hp_nid && spec->multiout.hp_nid 1202 != spec->multiout.dac_nids[HDA_FRONT]) 1203 snd_hda_codec_setup_stream(codec, spec->multiout.hp_nid, ··· 1208 activate_ctl(codec, "Headphone Playback Switch", 1209 spec->hp_independent_mode); 1210 } 1211 + /* update jack power state */ 1212 + set_jack_power_state(codec); 1213 return 0; 1214 } 1215 ··· 1248 break; 1249 } 1250 1251 + if (spec->codec_type != VT1708) { 1252 + nums = snd_hda_get_connections(codec, nid, 1253 + conn, HDA_MAX_CONNECTIONS); 1254 + if (nums <= 1) 1255 + return 0; 1256 + } 1257 1258 knew = via_clone_control(spec, &via_hp_mixer[0]); 1259 if (knew == NULL) ··· 1309 nid_mixer = 0x16; 1310 start_idx = 2; 1311 end_idx = 4; 1312 + break; 1313 + case VT1718S: 1314 + nid_mixer = 0x21; 1315 + start_idx = 1; 1316 + end_idx = 3; 1317 break; 1318 default: 1319 return; ··· 2185 for (i = 0; i < spec->num_iverbs; i++) 2186 snd_hda_sequence_write(codec, spec->init_verbs[i]); 2187 2188 /* Lydia Add for EAPD enable */ 2189 if (!spec->dig_in_nid) { /* No Digital In connection */ 2190 if (spec->dig_in_pin) { ··· 2438 else 2439 type_idx = 0; 2440 label = hda_get_autocfg_input_label(codec, cfg, i); 2441 + if (spec->codec_type == VT1708S || 2442 + spec->codec_type == VT1702 || 2443 + spec->codec_type == VT1716S) 2444 + err = via_new_analog_input(spec, label, type_idx, 2445 + idx+1, cap_nid); 2446 + else 2447 + err = via_new_analog_input(spec, label, type_idx, 2448 + idx, cap_nid); 2449 if (err < 0) 2450 return err; 2451 snd_hda_add_imux_item(imux, label, idx, NULL); ··· 4146 "%s %s", codec->vendor_name, codec->chip_name); 4147 spec->stream_name_analog = "VT1708BCE Analog"; 4148 spec->stream_name_digital = "VT1708BCE Digital"; 4149 + } 4150 + /* correct names for VT1818S */ 4151 + if (codec->vendor_id == 0x11060440) { 4152 + spec->stream_name_analog = "VT1818S Analog"; 4153 + spec->stream_name_digital = "VT1818S Digital"; 4154 } 4155 return 0; 4156 }
+14
sound/soc/codecs/sgtl5000.c
··· 772 return 0; 773 } 774 775 static int ldo_regulator_is_enabled(struct regulator_dev *dev) 776 { 777 struct ldo_regulator *ldo = rdev_get_drvdata(dev); ··· 902 903 return 0; 904 } 905 906 /* 907 * set dac bias
··· 772 return 0; 773 } 774 775 + #ifdef CONFIG_REGULATOR 776 static int ldo_regulator_is_enabled(struct regulator_dev *dev) 777 { 778 struct ldo_regulator *ldo = rdev_get_drvdata(dev); ··· 901 902 return 0; 903 } 904 + #else 905 + static int ldo_regulator_register(struct snd_soc_codec *codec, 906 + struct regulator_init_data *init_data, 907 + int voltage) 908 + { 909 + return -EINVAL; 910 + } 911 + 912 + static int ldo_regulator_remove(struct snd_soc_codec *codec) 913 + { 914 + return 0; 915 + } 916 + #endif 917 918 /* 919 * set dac bias
+2 -1
sound/soc/codecs/uda134x.c
··· 486 static int uda134x_soc_probe(struct snd_soc_codec *codec) 487 { 488 struct uda134x_priv *uda134x; 489 - struct uda134x_platform_data *pd = dev_get_drvdata(codec->card->dev); 490 int ret; 491 492 printk(KERN_INFO "UDA134X SoC Audio Codec\n");
··· 486 static int uda134x_soc_probe(struct snd_soc_codec *codec) 487 { 488 struct uda134x_priv *uda134x; 489 + struct uda134x_platform_data *pd = codec->card->dev->platform_data; 490 + 491 int ret; 492 493 printk(KERN_INFO "UDA134X SoC Audio Codec\n");
+2 -1
sound/soc/samsung/s3c24xx_uda134x.c
··· 219 static struct snd_soc_dai_link s3c24xx_uda134x_dai_link = { 220 .name = "UDA134X", 221 .stream_name = "UDA134X", 222 - .codec_name = "uda134x-hifi", 223 .codec_dai_name = "uda134x-hifi", 224 .cpu_dai_name = "s3c24xx-iis", 225 .ops = &s3c24xx_uda134x_ops, ··· 314 315 platform_set_drvdata(s3c24xx_uda134x_snd_device, 316 &snd_soc_s3c24xx_uda134x); 317 ret = platform_device_add(s3c24xx_uda134x_snd_device); 318 if (ret) { 319 printk(KERN_ERR "S3C24XX_UDA134X SoC Audio: Unable to add\n");
··· 219 static struct snd_soc_dai_link s3c24xx_uda134x_dai_link = { 220 .name = "UDA134X", 221 .stream_name = "UDA134X", 222 + .codec_name = "uda134x-codec", 223 .codec_dai_name = "uda134x-hifi", 224 .cpu_dai_name = "s3c24xx-iis", 225 .ops = &s3c24xx_uda134x_ops, ··· 314 315 platform_set_drvdata(s3c24xx_uda134x_snd_device, 316 &snd_soc_s3c24xx_uda134x); 317 + platform_device_add_data(s3c24xx_uda134x_snd_device, &s3c24xx_uda134x, sizeof(s3c24xx_uda134x)); 318 ret = platform_device_add(s3c24xx_uda134x_snd_device); 319 if (ret) { 320 printk(KERN_ERR "S3C24XX_UDA134X SoC Audio: Unable to add\n");
-2
sound/soc/soc-core.c
··· 259 while (*start == ' ') 260 start++; 261 reg = simple_strtoul(start, &start, 16); 262 - if ((reg >= codec->driver->reg_cache_size) || (reg % step)) 263 - return -EINVAL; 264 while (*start == ' ') 265 start++; 266 if (strict_strtoul(start, 16, &value))
··· 259 while (*start == ' ') 260 start++; 261 reg = simple_strtoul(start, &start, 16); 262 while (*start == ' ') 263 start++; 264 if (strict_strtoul(start, 16, &value))
+1 -1
sound/sound_firmware.c
··· 19 printk(KERN_INFO "Unable to load '%s'.\n", fn); 20 return 0; 21 } 22 - l = filp->f_path.dentry->d_inode->i_size; 23 if (l <= 0 || l > 131072) 24 { 25 printk(KERN_INFO "Invalid firmware '%s'\n", fn);
··· 19 printk(KERN_INFO "Unable to load '%s'.\n", fn); 20 return 0; 21 } 22 + l = i_size_read(filp->f_path.dentry->d_inode); 23 if (l <= 0 || l > 131072) 24 { 25 printk(KERN_INFO "Invalid firmware '%s'\n", fn);
+18 -4
sound/usb/card.c
··· 41 #include <linux/list.h> 42 #include <linux/slab.h> 43 #include <linux/string.h> 44 #include <linux/usb.h> 45 #include <linux/moduleparam.h> 46 #include <linux/mutex.h> ··· 284 return snd_usb_audio_free(chip); 285 } 286 287 288 /* 289 * create a chip instance and set its names. ··· 361 snd_component_add(card, component); 362 363 /* retrieve the device string as shortname */ 364 - if (quirk && quirk->product_name) { 365 strlcpy(card->shortname, quirk->product_name, sizeof(card->shortname)); 366 } else { 367 if (!dev->descriptor.iProduct || ··· 373 USB_ID_PRODUCT(chip->usb_id)); 374 } 375 } 376 377 /* retrieve the vendor and device strings as longname */ 378 - if (quirk && quirk->vendor_name) { 379 len = strlcpy(card->longname, quirk->vendor_name, sizeof(card->longname)); 380 } else { 381 if (dev->descriptor.iManufacturer) ··· 386 len = 0; 387 /* we don't really care if there isn't any vendor string */ 388 } 389 - if (len > 0) 390 - strlcat(card->longname, " ", sizeof(card->longname)); 391 392 strlcat(card->longname, card->shortname, sizeof(card->longname)); 393
··· 41 #include <linux/list.h> 42 #include <linux/slab.h> 43 #include <linux/string.h> 44 + #include <linux/ctype.h> 45 #include <linux/usb.h> 46 #include <linux/moduleparam.h> 47 #include <linux/mutex.h> ··· 283 return snd_usb_audio_free(chip); 284 } 285 286 + static void remove_trailing_spaces(char *str) 287 + { 288 + char *p; 289 + 290 + if (!*str) 291 + return; 292 + for (p = str + strlen(str) - 1; p >= str && isspace(*p); p--) 293 + *p = 0; 294 + } 295 296 /* 297 * create a chip instance and set its names. ··· 351 snd_component_add(card, component); 352 353 /* retrieve the device string as shortname */ 354 + if (quirk && quirk->product_name && *quirk->product_name) { 355 strlcpy(card->shortname, quirk->product_name, sizeof(card->shortname)); 356 } else { 357 if (!dev->descriptor.iProduct || ··· 363 USB_ID_PRODUCT(chip->usb_id)); 364 } 365 } 366 + remove_trailing_spaces(card->shortname); 367 368 /* retrieve the vendor and device strings as longname */ 369 + if (quirk && quirk->vendor_name && *quirk->vendor_name) { 370 len = strlcpy(card->longname, quirk->vendor_name, sizeof(card->longname)); 371 } else { 372 if (dev->descriptor.iManufacturer) ··· 375 len = 0; 376 /* we don't really care if there isn't any vendor string */ 377 } 378 + if (len > 0) { 379 + remove_trailing_spaces(card->longname); 380 + if (*card->longname) 381 + strlcat(card->longname, " ", sizeof(card->longname)); 382 + } 383 384 strlcat(card->longname, card->shortname, sizeof(card->longname)); 385