Commit 4bbba111 authored by Linus Torvalds's avatar Linus Torvalds

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.
parents 2130781e ce24f58a
...@@ -488,6 +488,11 @@ static struct i2c_board_info mini2440_i2c_devs[] __initdata = { ...@@ -488,6 +488,11 @@ static struct i2c_board_info mini2440_i2c_devs[] __initdata = {
}, },
}; };
static struct platform_device uda1340_codec = {
.name = "uda134x-codec",
.id = -1,
};
static struct platform_device *mini2440_devices[] __initdata = { static struct platform_device *mini2440_devices[] __initdata = {
&s3c_device_ohci, &s3c_device_ohci,
&s3c_device_wdt, &s3c_device_wdt,
...@@ -503,7 +508,9 @@ static struct platform_device *mini2440_devices[] __initdata = { ...@@ -503,7 +508,9 @@ static struct platform_device *mini2440_devices[] __initdata = {
&s3c_device_nand, &s3c_device_nand,
&s3c_device_sdi, &s3c_device_sdi,
&s3c_device_iis, &s3c_device_iis,
&uda1340_codec,
&mini2440_audio, &mini2440_audio,
&samsung_asoc_dma,
}; };
static void __init mini2440_map_io(void) static void __init mini2440_map_io(void)
......
...@@ -1265,6 +1265,7 @@ static void alc_auto_init_amp(struct hda_codec *codec, int type) ...@@ -1265,6 +1265,7 @@ static void alc_auto_init_amp(struct hda_codec *codec, int type)
case 0x10ec0660: case 0x10ec0660:
case 0x10ec0662: case 0x10ec0662:
case 0x10ec0663: case 0x10ec0663:
case 0x10ec0665:
case 0x10ec0862: case 0x10ec0862:
case 0x10ec0889: case 0x10ec0889:
set_eapd(codec, 0x14, 1); set_eapd(codec, 0x14, 1);
...@@ -4240,6 +4241,7 @@ static void alc_power_eapd(struct hda_codec *codec) ...@@ -4240,6 +4241,7 @@ static void alc_power_eapd(struct hda_codec *codec)
case 0x10ec0660: case 0x10ec0660:
case 0x10ec0662: case 0x10ec0662:
case 0x10ec0663: case 0x10ec0663:
case 0x10ec0665:
case 0x10ec0862: case 0x10ec0862:
case 0x10ec0889: case 0x10ec0889:
set_eapd(codec, 0x14, 0); set_eapd(codec, 0x14, 0);
...@@ -16006,9 +16008,12 @@ static int alc861_auto_create_multi_out_ctls(struct hda_codec *codec, ...@@ -16006,9 +16008,12 @@ static int alc861_auto_create_multi_out_ctls(struct hda_codec *codec,
return err; return err;
} else { } else {
const char *name = pfx; const char *name = pfx;
if (!name) int index = i;
if (!name) {
name = chname[i]; name = chname[i];
err = __alc861_create_out_sw(codec, name, nid, i, 3); index = 0;
}
err = __alc861_create_out_sw(codec, name, nid, index, 3);
if (err < 0) if (err < 0)
return err; return err;
} }
...@@ -17159,16 +17164,19 @@ static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec, ...@@ -17159,16 +17164,19 @@ static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec,
return err; return err;
} else { } else {
const char *name = pfx; const char *name = pfx;
if (!name) int index = i;
if (!name) {
name = chname[i]; name = chname[i];
index = 0;
}
err = __add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, err = __add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
name, i, name, index,
HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_COMPOSE_AMP_VAL(nid_v, 3, 0,
HDA_OUTPUT)); HDA_OUTPUT));
if (err < 0) if (err < 0)
return err; return err;
err = __add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, err = __add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
name, i, name, index,
HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_COMPOSE_AMP_VAL(nid_s, 3, 2,
HDA_INPUT)); HDA_INPUT));
if (err < 0) if (err < 0)
...@@ -19217,12 +19225,15 @@ static int alc662_auto_create_multi_out_ctls(struct hda_codec *codec, ...@@ -19217,12 +19225,15 @@ static int alc662_auto_create_multi_out_ctls(struct hda_codec *codec,
return err; return err;
} else { } else {
const char *name = pfx; const char *name = pfx;
if (!name) int index = i;
if (!name) {
name = chname[i]; name = chname[i];
err = __alc662_add_vol_ctl(spec, name, nid, i, 3); index = 0;
}
err = __alc662_add_vol_ctl(spec, name, nid, index, 3);
if (err < 0) if (err < 0)
return err; return err;
err = __alc662_add_sw_ctl(spec, name, mix, i, 3); err = __alc662_add_sw_ctl(spec, name, mix, index, 3);
if (err < 0) if (err < 0)
return err; return err;
} }
......
...@@ -159,6 +159,7 @@ struct via_spec { ...@@ -159,6 +159,7 @@ struct via_spec {
#endif #endif
}; };
static enum VIA_HDA_CODEC get_codec_type(struct hda_codec *codec);
static struct via_spec * via_new_spec(struct hda_codec *codec) static struct via_spec * via_new_spec(struct hda_codec *codec)
{ {
struct via_spec *spec; struct via_spec *spec;
...@@ -169,6 +170,10 @@ static struct via_spec * via_new_spec(struct hda_codec *codec) ...@@ -169,6 +170,10 @@ static struct via_spec * via_new_spec(struct hda_codec *codec)
codec->spec = spec; codec->spec = spec;
spec->codec = codec; spec->codec = codec;
spec->codec_type = get_codec_type(codec);
/* VT1708BCE & VT1708S are almost same */
if (spec->codec_type == VT1708BCE)
spec->codec_type = VT1708S;
return spec; return spec;
} }
...@@ -1101,6 +1106,7 @@ static int via_mux_enum_put(struct snd_kcontrol *kcontrol, ...@@ -1101,6 +1106,7 @@ static int via_mux_enum_put(struct snd_kcontrol *kcontrol,
struct hda_codec *codec = snd_kcontrol_chip(kcontrol); struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
struct via_spec *spec = codec->spec; struct via_spec *spec = codec->spec;
unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
int ret;
if (!spec->mux_nids[adc_idx]) if (!spec->mux_nids[adc_idx])
return -EINVAL; return -EINVAL;
...@@ -1109,12 +1115,14 @@ static int via_mux_enum_put(struct snd_kcontrol *kcontrol, ...@@ -1109,12 +1115,14 @@ static int via_mux_enum_put(struct snd_kcontrol *kcontrol,
AC_VERB_GET_POWER_STATE, 0x00) != AC_PWRST_D0) AC_VERB_GET_POWER_STATE, 0x00) != AC_PWRST_D0)
snd_hda_codec_write(codec, spec->mux_nids[adc_idx], 0, snd_hda_codec_write(codec, spec->mux_nids[adc_idx], 0,
AC_VERB_SET_POWER_STATE, AC_PWRST_D0); AC_VERB_SET_POWER_STATE, AC_PWRST_D0);
/* update jack power state */
set_jack_power_state(codec);
return snd_hda_input_mux_put(codec, spec->input_mux, ucontrol, ret = snd_hda_input_mux_put(codec, spec->input_mux, ucontrol,
spec->mux_nids[adc_idx], spec->mux_nids[adc_idx],
&spec->cur_mux[adc_idx]); &spec->cur_mux[adc_idx]);
/* update jack power state */
set_jack_power_state(codec);
return ret;
} }
static int via_independent_hp_info(struct snd_kcontrol *kcontrol, static int via_independent_hp_info(struct snd_kcontrol *kcontrol,
...@@ -1188,8 +1196,16 @@ static int via_independent_hp_put(struct snd_kcontrol *kcontrol, ...@@ -1188,8 +1196,16 @@ static int via_independent_hp_put(struct snd_kcontrol *kcontrol,
/* Get Independent Mode index of headphone pin widget */ /* Get Independent Mode index of headphone pin widget */
spec->hp_independent_mode = spec->hp_independent_mode_index == pinsel spec->hp_independent_mode = spec->hp_independent_mode_index == pinsel
? 1 : 0; ? 1 : 0;
snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, pinsel); if (spec->codec_type == VT1718S)
snd_hda_codec_write(codec, nid, 0,
AC_VERB_SET_CONNECT_SEL, pinsel ? 2 : 0);
else
snd_hda_codec_write(codec, nid, 0,
AC_VERB_SET_CONNECT_SEL, pinsel);
if (spec->codec_type == VT1812)
snd_hda_codec_write(codec, 0x35, 0,
AC_VERB_SET_CONNECT_SEL, pinsel);
if (spec->multiout.hp_nid && spec->multiout.hp_nid if (spec->multiout.hp_nid && spec->multiout.hp_nid
!= spec->multiout.dac_nids[HDA_FRONT]) != spec->multiout.dac_nids[HDA_FRONT])
snd_hda_codec_setup_stream(codec, spec->multiout.hp_nid, snd_hda_codec_setup_stream(codec, spec->multiout.hp_nid,
...@@ -1208,6 +1224,8 @@ static int via_independent_hp_put(struct snd_kcontrol *kcontrol, ...@@ -1208,6 +1224,8 @@ static int via_independent_hp_put(struct snd_kcontrol *kcontrol,
activate_ctl(codec, "Headphone Playback Switch", activate_ctl(codec, "Headphone Playback Switch",
spec->hp_independent_mode); spec->hp_independent_mode);
} }
/* update jack power state */
set_jack_power_state(codec);
return 0; return 0;
} }
...@@ -1248,9 +1266,12 @@ static int via_hp_build(struct hda_codec *codec) ...@@ -1248,9 +1266,12 @@ static int via_hp_build(struct hda_codec *codec)
break; break;
} }
nums = snd_hda_get_connections(codec, nid, conn, HDA_MAX_CONNECTIONS); if (spec->codec_type != VT1708) {
nums = snd_hda_get_connections(codec, nid,
conn, HDA_MAX_CONNECTIONS);
if (nums <= 1) if (nums <= 1)
return 0; return 0;
}
knew = via_clone_control(spec, &via_hp_mixer[0]); knew = via_clone_control(spec, &via_hp_mixer[0]);
if (knew == NULL) if (knew == NULL)
...@@ -1310,6 +1331,11 @@ static void mute_aa_path(struct hda_codec *codec, int mute) ...@@ -1310,6 +1331,11 @@ static void mute_aa_path(struct hda_codec *codec, int mute)
start_idx = 2; start_idx = 2;
end_idx = 4; end_idx = 4;
break; break;
case VT1718S:
nid_mixer = 0x21;
start_idx = 1;
end_idx = 3;
break;
default: default:
return; return;
} }
...@@ -2185,10 +2211,6 @@ static int via_init(struct hda_codec *codec) ...@@ -2185,10 +2211,6 @@ static int via_init(struct hda_codec *codec)
for (i = 0; i < spec->num_iverbs; i++) for (i = 0; i < spec->num_iverbs; i++)
snd_hda_sequence_write(codec, spec->init_verbs[i]); snd_hda_sequence_write(codec, spec->init_verbs[i]);
spec->codec_type = get_codec_type(codec);
if (spec->codec_type == VT1708BCE)
spec->codec_type = VT1708S; /* VT1708BCE & VT1708S are almost
same */
/* Lydia Add for EAPD enable */ /* Lydia Add for EAPD enable */
if (!spec->dig_in_nid) { /* No Digital In connection */ if (!spec->dig_in_nid) { /* No Digital In connection */
if (spec->dig_in_pin) { if (spec->dig_in_pin) {
...@@ -2438,7 +2460,14 @@ static int vt_auto_create_analog_input_ctls(struct hda_codec *codec, ...@@ -2438,7 +2460,14 @@ static int vt_auto_create_analog_input_ctls(struct hda_codec *codec,
else else
type_idx = 0; type_idx = 0;
label = hda_get_autocfg_input_label(codec, cfg, i); label = hda_get_autocfg_input_label(codec, cfg, i);
err = via_new_analog_input(spec, label, type_idx, idx, cap_nid); if (spec->codec_type == VT1708S ||
spec->codec_type == VT1702 ||
spec->codec_type == VT1716S)
err = via_new_analog_input(spec, label, type_idx,
idx+1, cap_nid);
else
err = via_new_analog_input(spec, label, type_idx,
idx, cap_nid);
if (err < 0) if (err < 0)
return err; return err;
snd_hda_add_imux_item(imux, label, idx, NULL); snd_hda_add_imux_item(imux, label, idx, NULL);
...@@ -4147,6 +4176,11 @@ static int patch_vt1708S(struct hda_codec *codec) ...@@ -4147,6 +4176,11 @@ static int patch_vt1708S(struct hda_codec *codec)
spec->stream_name_analog = "VT1708BCE Analog"; spec->stream_name_analog = "VT1708BCE Analog";
spec->stream_name_digital = "VT1708BCE Digital"; spec->stream_name_digital = "VT1708BCE Digital";
} }
/* correct names for VT1818S */
if (codec->vendor_id == 0x11060440) {
spec->stream_name_analog = "VT1818S Analog";
spec->stream_name_digital = "VT1818S Digital";
}
return 0; return 0;
} }
......
...@@ -772,6 +772,7 @@ static int sgtl5000_pcm_hw_params(struct snd_pcm_substream *substream, ...@@ -772,6 +772,7 @@ static int sgtl5000_pcm_hw_params(struct snd_pcm_substream *substream,
return 0; return 0;
} }
#ifdef CONFIG_REGULATOR
static int ldo_regulator_is_enabled(struct regulator_dev *dev) static int ldo_regulator_is_enabled(struct regulator_dev *dev)
{ {
struct ldo_regulator *ldo = rdev_get_drvdata(dev); struct ldo_regulator *ldo = rdev_get_drvdata(dev);
...@@ -901,6 +902,19 @@ static int ldo_regulator_remove(struct snd_soc_codec *codec) ...@@ -901,6 +902,19 @@ static int ldo_regulator_remove(struct snd_soc_codec *codec)
return 0; return 0;
} }
#else
static int ldo_regulator_register(struct snd_soc_codec *codec,
struct regulator_init_data *init_data,
int voltage)
{
return -EINVAL;
}
static int ldo_regulator_remove(struct snd_soc_codec *codec)
{
return 0;
}
#endif
/* /*
* set dac bias * set dac bias
......
...@@ -486,7 +486,8 @@ static struct snd_soc_dai_driver uda134x_dai = { ...@@ -486,7 +486,8 @@ static struct snd_soc_dai_driver uda134x_dai = {
static int uda134x_soc_probe(struct snd_soc_codec *codec) static int uda134x_soc_probe(struct snd_soc_codec *codec)
{ {
struct uda134x_priv *uda134x; struct uda134x_priv *uda134x;
struct uda134x_platform_data *pd = dev_get_drvdata(codec->card->dev); struct uda134x_platform_data *pd = codec->card->dev->platform_data;
int ret; int ret;
printk(KERN_INFO "UDA134X SoC Audio Codec\n"); printk(KERN_INFO "UDA134X SoC Audio Codec\n");
......
...@@ -219,7 +219,7 @@ static struct snd_soc_ops s3c24xx_uda134x_ops = { ...@@ -219,7 +219,7 @@ static struct snd_soc_ops s3c24xx_uda134x_ops = {
static struct snd_soc_dai_link s3c24xx_uda134x_dai_link = { static struct snd_soc_dai_link s3c24xx_uda134x_dai_link = {
.name = "UDA134X", .name = "UDA134X",
.stream_name = "UDA134X", .stream_name = "UDA134X",
.codec_name = "uda134x-hifi", .codec_name = "uda134x-codec",
.codec_dai_name = "uda134x-hifi", .codec_dai_name = "uda134x-hifi",
.cpu_dai_name = "s3c24xx-iis", .cpu_dai_name = "s3c24xx-iis",
.ops = &s3c24xx_uda134x_ops, .ops = &s3c24xx_uda134x_ops,
...@@ -314,6 +314,7 @@ static int s3c24xx_uda134x_probe(struct platform_device *pdev) ...@@ -314,6 +314,7 @@ static int s3c24xx_uda134x_probe(struct platform_device *pdev)
platform_set_drvdata(s3c24xx_uda134x_snd_device, platform_set_drvdata(s3c24xx_uda134x_snd_device,
&snd_soc_s3c24xx_uda134x); &snd_soc_s3c24xx_uda134x);
platform_device_add_data(s3c24xx_uda134x_snd_device, &s3c24xx_uda134x, sizeof(s3c24xx_uda134x));
ret = platform_device_add(s3c24xx_uda134x_snd_device); ret = platform_device_add(s3c24xx_uda134x_snd_device);
if (ret) { if (ret) {
printk(KERN_ERR "S3C24XX_UDA134X SoC Audio: Unable to add\n"); printk(KERN_ERR "S3C24XX_UDA134X SoC Audio: Unable to add\n");
......
...@@ -259,8 +259,6 @@ static ssize_t codec_reg_write_file(struct file *file, ...@@ -259,8 +259,6 @@ static ssize_t codec_reg_write_file(struct file *file,
while (*start == ' ') while (*start == ' ')
start++; start++;
reg = simple_strtoul(start, &start, 16); reg = simple_strtoul(start, &start, 16);
if ((reg >= codec->driver->reg_cache_size) || (reg % step))
return -EINVAL;
while (*start == ' ') while (*start == ' ')
start++; start++;
if (strict_strtoul(start, 16, &value)) if (strict_strtoul(start, 16, &value))
......
...@@ -19,7 +19,7 @@ static int do_mod_firmware_load(const char *fn, char **fp) ...@@ -19,7 +19,7 @@ static int do_mod_firmware_load(const char *fn, char **fp)
printk(KERN_INFO "Unable to load '%s'.\n", fn); printk(KERN_INFO "Unable to load '%s'.\n", fn);
return 0; return 0;
} }
l = filp->f_path.dentry->d_inode->i_size; l = i_size_read(filp->f_path.dentry->d_inode);
if (l <= 0 || l > 131072) if (l <= 0 || l > 131072)
{ {
printk(KERN_INFO "Invalid firmware '%s'\n", fn); printk(KERN_INFO "Invalid firmware '%s'\n", fn);
......
...@@ -41,6 +41,7 @@ ...@@ -41,6 +41,7 @@
#include <linux/list.h> #include <linux/list.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/string.h> #include <linux/string.h>
#include <linux/ctype.h>
#include <linux/usb.h> #include <linux/usb.h>
#include <linux/moduleparam.h> #include <linux/moduleparam.h>
#include <linux/mutex.h> #include <linux/mutex.h>
...@@ -283,6 +284,15 @@ static int snd_usb_audio_dev_free(struct snd_device *device) ...@@ -283,6 +284,15 @@ static int snd_usb_audio_dev_free(struct snd_device *device)
return snd_usb_audio_free(chip); return snd_usb_audio_free(chip);
} }
static void remove_trailing_spaces(char *str)
{
char *p;
if (!*str)
return;
for (p = str + strlen(str) - 1; p >= str && isspace(*p); p--)
*p = 0;
}
/* /*
* create a chip instance and set its names. * create a chip instance and set its names.
...@@ -351,7 +361,7 @@ static int snd_usb_audio_create(struct usb_device *dev, int idx, ...@@ -351,7 +361,7 @@ static int snd_usb_audio_create(struct usb_device *dev, int idx,
snd_component_add(card, component); snd_component_add(card, component);
/* retrieve the device string as shortname */ /* retrieve the device string as shortname */
if (quirk && quirk->product_name) { if (quirk && quirk->product_name && *quirk->product_name) {
strlcpy(card->shortname, quirk->product_name, sizeof(card->shortname)); strlcpy(card->shortname, quirk->product_name, sizeof(card->shortname));
} else { } else {
if (!dev->descriptor.iProduct || if (!dev->descriptor.iProduct ||
...@@ -363,9 +373,10 @@ static int snd_usb_audio_create(struct usb_device *dev, int idx, ...@@ -363,9 +373,10 @@ static int snd_usb_audio_create(struct usb_device *dev, int idx,
USB_ID_PRODUCT(chip->usb_id)); USB_ID_PRODUCT(chip->usb_id));
} }
} }
remove_trailing_spaces(card->shortname);
/* retrieve the vendor and device strings as longname */ /* retrieve the vendor and device strings as longname */
if (quirk && quirk->vendor_name) { if (quirk && quirk->vendor_name && *quirk->vendor_name) {
len = strlcpy(card->longname, quirk->vendor_name, sizeof(card->longname)); len = strlcpy(card->longname, quirk->vendor_name, sizeof(card->longname));
} else { } else {
if (dev->descriptor.iManufacturer) if (dev->descriptor.iManufacturer)
...@@ -375,8 +386,11 @@ static int snd_usb_audio_create(struct usb_device *dev, int idx, ...@@ -375,8 +386,11 @@ static int snd_usb_audio_create(struct usb_device *dev, int idx,
len = 0; len = 0;
/* we don't really care if there isn't any vendor string */ /* we don't really care if there isn't any vendor string */
} }
if (len > 0) if (len > 0) {
remove_trailing_spaces(card->longname);
if (*card->longname)
strlcat(card->longname, " ", sizeof(card->longname)); strlcat(card->longname, " ", sizeof(card->longname));
}
strlcat(card->longname, card->shortname, sizeof(card->longname)); strlcat(card->longname, card->shortname, sizeof(card->longname));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment