Skip to content

Commit

Permalink
Merge tag 'sound-fix-3.13-rc1' of git://git.kernel.org/pub/scm/linux/…
Browse files Browse the repository at this point in the history
…kernel/git/tiwai/sound

Pull sound fixes from Takashi Iwai:
 "Two peaks in diffstat are for the audio EQ init of IDT codecs and the
  EMU2004 usb mixer addition, both of which are pretty device-specific,
  so safe to apply.  The rest are a bunch of small fixes, most of them
  are regression fixes"

* tag 'sound-fix-3.13-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound: (26 commits)
  ALSA: hda - load EQ params into IDT codec on HP bNB13 systems
  ASoC: cs42l52: Correct MIC CTL mask
  ASoC: wm8962: Turn on regcache_cache_only before disabling regulator
  ALSA: jack: Unregister input device at disconnection
  ALSA: pcsp: Fix the order of input device unregistration
  ASoC: fsl: imx-pcm-fiq: omit fiq counter to avoid harm in unbalanced situations
  ASoC: blackfin: Fix missing break
  ALSA: usb-audio: add front jack channel selector for EMU0204
  ALSA: hda - Don't clear the power state at snd_hda_codec_reset()
  ASoC: arizona: Fix typo in name of EQ coefficient controls
  ALSA: hda - Control EAPD for Master volume on Lenovo N100
  ALSA: hda - Don't turn off EAPD for headphone on Lenovo N100
  ALSA: isa: not allocating enough space
  ALSA: snd-aoa: two copy and paste bugs
  ASoC: wm8997: Correct typo in ISRC mux routes
  ALSA: hda - Check keep_eapd_on before inv_eapd
  ALSA: hda - Fix Line Out automute on Realtek multifunction jacks
  ALSA: msnd: Avoid duplicated driver name
  ALSA: compress_core: don't return -EBADFD from poll if paused
  ALSA: hda - hdmi: Fix wrong baseline length in ATI/AMD generated ELD
  ...
  • Loading branch information
torvalds committed Nov 16, 2013
2 parents 71f777e + abfe69d commit 73d75ba
Show file tree
Hide file tree
Showing 24 changed files with 803 additions and 76 deletions.
4 changes: 2 additions & 2 deletions sound/aoa/fabrics/layout.c
Original file line number Diff line number Diff line change
Expand Up @@ -644,7 +644,7 @@ static int n##_control_put(struct snd_kcontrol *kcontrol, \
struct snd_ctl_elem_value *ucontrol) \
{ \
struct gpio_runtime *gpio = snd_kcontrol_chip(kcontrol); \
if (gpio->methods && gpio->methods->get_##n) \
if (gpio->methods && gpio->methods->set_##n) \
gpio->methods->set_##n(gpio, \
!!ucontrol->value.integer.value[0]); \
return 1; \
Expand Down Expand Up @@ -1135,7 +1135,7 @@ static int aoa_fabric_layout_resume(struct soundbus_dev *sdev)
{
struct layout_dev *ldev = dev_get_drvdata(&sdev->ofdev.dev);

if (ldev->gpio.methods && ldev->gpio.methods->all_amps_off)
if (ldev->gpio.methods && ldev->gpio.methods->all_amps_restore)
ldev->gpio.methods->all_amps_restore(&ldev->gpio);

return 0;
Expand Down
3 changes: 1 addition & 2 deletions sound/core/compress_offload.c
Original file line number Diff line number Diff line change
Expand Up @@ -384,8 +384,7 @@ static unsigned int snd_compr_poll(struct file *f, poll_table *wait)
return -EFAULT;

mutex_lock(&stream->device->lock);
if (stream->runtime->state == SNDRV_PCM_STATE_PAUSED ||
stream->runtime->state == SNDRV_PCM_STATE_OPEN) {
if (stream->runtime->state == SNDRV_PCM_STATE_OPEN) {
retval = -EBADFD;
goto out;
}
Expand Down
19 changes: 16 additions & 3 deletions sound/core/jack.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,31 @@ static int jack_switch_types[SND_JACK_SWITCH_TYPES] = {
SW_LINEIN_INSERT,
};

static int snd_jack_dev_free(struct snd_device *device)
static int snd_jack_dev_disconnect(struct snd_device *device)
{
struct snd_jack *jack = device->device_data;

if (jack->private_free)
jack->private_free(jack);
if (!jack->input_dev)
return 0;

/* If the input device is registered with the input subsystem
* then we need to use a different deallocator. */
if (jack->registered)
input_unregister_device(jack->input_dev);
else
input_free_device(jack->input_dev);
jack->input_dev = NULL;
return 0;
}

static int snd_jack_dev_free(struct snd_device *device)
{
struct snd_jack *jack = device->device_data;

if (jack->private_free)
jack->private_free(jack);

snd_jack_dev_disconnect(device);

kfree(jack->id);
kfree(jack);
Expand Down Expand Up @@ -110,6 +122,7 @@ int snd_jack_new(struct snd_card *card, const char *id, int type,
static struct snd_device_ops ops = {
.dev_free = snd_jack_dev_free,
.dev_register = snd_jack_dev_register,
.dev_disconnect = snd_jack_dev_disconnect,
};

jack = kzalloc(sizeof(struct snd_jack), GFP_KERNEL);
Expand Down
2 changes: 1 addition & 1 deletion sound/drivers/pcsp/pcsp.c
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,8 @@ static int pcsp_probe(struct platform_device *dev)
static int pcsp_remove(struct platform_device *dev)
{
struct snd_pcsp *chip = platform_get_drvdata(dev);
alsa_card_pcsp_exit(chip);
pcspkr_input_remove(chip->input_dev);
alsa_card_pcsp_exit(chip);
return 0;
}

Expand Down
4 changes: 2 additions & 2 deletions sound/isa/msnd/msnd_pinnacle.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,11 @@
#ifdef MSND_CLASSIC
# include "msnd_classic.h"
# define LOGNAME "msnd_classic"
# define DEV_NAME "msnd-classic"
#else
# include "msnd_pinnacle.h"
# define LOGNAME "snd_msnd_pinnacle"
# define DEV_NAME "msnd-pinnacle"
#endif

static void set_default_audio_parameters(struct snd_msnd *chip)
Expand Down Expand Up @@ -1067,8 +1069,6 @@ static int snd_msnd_isa_remove(struct device *pdev, unsigned int dev)
return 0;
}

#define DEV_NAME "msnd-pinnacle"

static struct isa_driver snd_msnd_driver = {
.match = snd_msnd_isa_match,
.probe = snd_msnd_isa_probe,
Expand Down
2 changes: 1 addition & 1 deletion sound/isa/wavefront/wavefront_synth.c
Original file line number Diff line number Diff line change
Expand Up @@ -1196,7 +1196,7 @@ wavefront_send_multisample (snd_wavefront_t *dev, wavefront_patch_info *header)
int num_samples;
unsigned char *msample_hdr;

msample_hdr = kmalloc(sizeof(WF_MSAMPLE_BYTES), GFP_KERNEL);
msample_hdr = kmalloc(WF_MSAMPLE_BYTES, GFP_KERNEL);
if (! msample_hdr)
return -ENOMEM;

Expand Down
3 changes: 0 additions & 3 deletions sound/pci/hda/hda_codec.c
Original file line number Diff line number Diff line change
Expand Up @@ -2579,9 +2579,6 @@ int snd_hda_codec_reset(struct hda_codec *codec)
cancel_delayed_work_sync(&codec->jackpoll_work);
#ifdef CONFIG_PM
cancel_delayed_work_sync(&codec->power_work);
codec->power_on = 0;
codec->power_transition = 0;
codec->power_jiffies = jiffies;
flush_workqueue(bus->workq);
#endif
snd_hda_ctls_clear(codec);
Expand Down
37 changes: 29 additions & 8 deletions sound/pci/hda/hda_eld.c
Original file line number Diff line number Diff line change
Expand Up @@ -680,7 +680,7 @@ int snd_hdmi_get_eld_ati(struct hda_codec *codec, hda_nid_t nid,

spkalloc = snd_hda_codec_read(codec, nid, 0, ATI_VERB_GET_SPEAKER_ALLOCATION, 0);

if (!spkalloc) {
if (spkalloc <= 0) {
snd_printd(KERN_INFO "HDMI ATI/AMD: no speaker allocation for ELD\n");
return -EINVAL;
}
Expand Down Expand Up @@ -742,6 +742,9 @@ int snd_hdmi_get_eld_ati(struct hda_codec *codec, hda_nid_t nid,
snd_hda_codec_write(codec, nid, 0, ATI_VERB_SET_AUDIO_DESCRIPTOR, i << 3);
ati_sad = snd_hda_codec_read(codec, nid, 0, ATI_VERB_GET_AUDIO_DESCRIPTOR, 0);

if (ati_sad <= 0)
continue;

if (ati_sad & ATI_AUDIODESC_RATES) {
/* format is supported, copy SAD as-is */
buf[pos++] = (ati_sad & 0x0000ff) >> 0;
Expand All @@ -765,21 +768,39 @@ int snd_hdmi_get_eld_ati(struct hda_codec *codec, hda_nid_t nid,
return -EINVAL;
}

/*
* HDMI VSDB latency format:
* separately for both audio and video:
* 0 field not valid or unknown latency
* [1..251] msecs = (x-1)*2 (max 500ms with x = 251 = 0xfb)
* 255 audio/video not supported
*
* HDA latency format:
* single value indicating video latency relative to audio:
* 0 unknown or 0ms
* [1..250] msecs = x*2 (max 500ms with x = 250 = 0xfa)
* [251..255] reserved
*/
aud_synch = snd_hda_codec_read(codec, nid, 0, ATI_VERB_GET_AUDIO_VIDEO_DELAY, 0);
if ((aud_synch & ATI_DELAY_VIDEO_LATENCY) && (aud_synch & ATI_DELAY_AUDIO_LATENCY)) {
int video_latency = (aud_synch & ATI_DELAY_VIDEO_LATENCY) - 1;
int audio_latency = ((aud_synch & ATI_DELAY_AUDIO_LATENCY) >> 8) - 1;
int video_latency_hdmi = (aud_synch & ATI_DELAY_VIDEO_LATENCY);
int audio_latency_hdmi = (aud_synch & ATI_DELAY_AUDIO_LATENCY) >> 8;

if (video_latency > audio_latency)
buf[6] = min(video_latency - audio_latency, 0xfa);
if (video_latency_hdmi <= 0xfb && audio_latency_hdmi <= 0xfb &&
video_latency_hdmi > audio_latency_hdmi)
buf[6] = video_latency_hdmi - audio_latency_hdmi;
/* else unknown/invalid or 0ms or video ahead of audio, so use zero */
}

/* Baseline length */
buf[2] = pos - 4;

/* SAD count */
buf[5] |= ((pos - ELD_FIXED_BYTES - sink_desc_len) / 3) << 4;

/* Baseline ELD block length is 4-byte aligned */
pos = round_up(pos, 4);

/* Baseline ELD length (4-byte header is not counted in) */
buf[2] = (pos - 4) / 4;

*eld_size = pos;

return 0;
Expand Down
4 changes: 2 additions & 2 deletions sound/pci/hda/hda_generic.c
Original file line number Diff line number Diff line change
Expand Up @@ -796,10 +796,10 @@ static void set_pin_eapd(struct hda_codec *codec, hda_nid_t pin, bool enable)
if (spec->own_eapd_ctl ||
!(snd_hda_query_pin_caps(codec, pin) & AC_PINCAP_EAPD))
return;
if (codec->inv_eapd)
enable = !enable;
if (spec->keep_eapd_on && !enable)
return;
if (codec->inv_eapd)
enable = !enable;
snd_hda_codec_update_cache(codec, pin, 0,
AC_VERB_SET_EAPD_BTLENABLE,
enable ? 0x02 : 0x00);
Expand Down
33 changes: 19 additions & 14 deletions sound/pci/hda/patch_analog.c
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,18 @@ static int ad198x_suspend(struct hda_codec *codec)
}
#endif

/* follow EAPD via vmaster hook */
static void ad_vmaster_eapd_hook(void *private_data, int enabled)
{
struct hda_codec *codec = private_data;
struct ad198x_spec *spec = codec->spec;

if (!spec->eapd_nid)
return;
snd_hda_codec_update_cache(codec, spec->eapd_nid, 0,
AC_VERB_SET_EAPD_BTLENABLE,
enabled ? 0x02 : 0x00);
}

/*
* Automatic parse of I/O pins from the BIOS configuration
Expand Down Expand Up @@ -219,8 +231,14 @@ static int alloc_ad_spec(struct hda_codec *codec)
static void ad_fixup_inv_jack_detect(struct hda_codec *codec,
const struct hda_fixup *fix, int action)
{
if (action == HDA_FIXUP_ACT_PRE_PROBE)
struct ad198x_spec *spec = codec->spec;

if (action == HDA_FIXUP_ACT_PRE_PROBE) {
codec->inv_jack_detect = 1;
spec->gen.keep_eapd_on = 1;
spec->gen.vmaster_mute.hook = ad_vmaster_eapd_hook;
spec->eapd_nid = 0x1b;
}
}

enum {
Expand Down Expand Up @@ -465,19 +483,6 @@ static int patch_ad1983(struct hda_codec *codec)
* AD1981 HD specific
*/

/* follow EAPD via vmaster hook */
static void ad_vmaster_eapd_hook(void *private_data, int enabled)
{
struct hda_codec *codec = private_data;
struct ad198x_spec *spec = codec->spec;

if (!spec->eapd_nid)
return;
snd_hda_codec_update_cache(codec, spec->eapd_nid, 0,
AC_VERB_SET_EAPD_BTLENABLE,
enabled ? 0x02 : 0x00);
}

static void ad1981_fixup_hp_eapd(struct hda_codec *codec,
const struct hda_fixup *fix, int action)
{
Expand Down
56 changes: 55 additions & 1 deletion sound/pci/hda/patch_cirrus.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ struct cs_spec {
unsigned int spdif_present:1;
unsigned int sense_b:1;
hda_nid_t vendor_nid;

/* for MBP SPDIF control */
int (*spdif_sw_put)(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol);
};

/* available models with CS420x */
Expand Down Expand Up @@ -331,10 +335,21 @@ static int cs_init(struct hda_codec *codec)
return 0;
}

static int cs_build_controls(struct hda_codec *codec)
{
int err;

err = snd_hda_gen_build_controls(codec);
if (err < 0)
return err;
snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_BUILD);
return 0;
}

#define cs_free snd_hda_gen_free

static const struct hda_codec_ops cs_patch_ops = {
.build_controls = snd_hda_gen_build_controls,
.build_controls = cs_build_controls,
.build_pcms = snd_hda_gen_build_pcms,
.init = cs_init,
.free = cs_free,
Expand Down Expand Up @@ -599,12 +614,14 @@ static int patch_cs420x(struct hda_codec *codec)
enum {
CS4208_MAC_AUTO,
CS4208_MBA6,
CS4208_MBP11,
CS4208_GPIO0,
};

static const struct hda_model_fixup cs4208_models[] = {
{ .id = CS4208_GPIO0, .name = "gpio0" },
{ .id = CS4208_MBA6, .name = "mba6" },
{ .id = CS4208_MBP11, .name = "mbp11" },
{}
};

Expand All @@ -615,6 +632,7 @@ static const struct snd_pci_quirk cs4208_fixup_tbl[] = {

/* codec SSID matching */
static const struct snd_pci_quirk cs4208_mac_fixup_tbl[] = {
SND_PCI_QUIRK(0x106b, 0x5e00, "MacBookPro 11,2", CS4208_MBP11),
SND_PCI_QUIRK(0x106b, 0x7100, "MacBookAir 6,1", CS4208_MBA6),
SND_PCI_QUIRK(0x106b, 0x7200, "MacBookAir 6,2", CS4208_MBA6),
{} /* terminator */
Expand Down Expand Up @@ -646,13 +664,49 @@ static void cs4208_fixup_mac(struct hda_codec *codec,
snd_hda_apply_fixup(codec, action);
}

static int cs4208_spdif_sw_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
struct cs_spec *spec = codec->spec;
hda_nid_t pin = spec->gen.autocfg.dig_out_pins[0];
int pinctl = ucontrol->value.integer.value[0] ? PIN_OUT : 0;

snd_hda_set_pin_ctl_cache(codec, pin, pinctl);
return spec->spdif_sw_put(kcontrol, ucontrol);
}

/* hook the SPDIF switch */
static void cs4208_fixup_spdif_switch(struct hda_codec *codec,
const struct hda_fixup *fix, int action)
{
if (action == HDA_FIXUP_ACT_BUILD) {
struct cs_spec *spec = codec->spec;
struct snd_kcontrol *kctl;

if (!spec->gen.autocfg.dig_out_pins[0])
return;
kctl = snd_hda_find_mixer_ctl(codec, "IEC958 Playback Switch");
if (!kctl)
return;
spec->spdif_sw_put = kctl->put;
kctl->put = cs4208_spdif_sw_put;
}
}

static const struct hda_fixup cs4208_fixups[] = {
[CS4208_MBA6] = {
.type = HDA_FIXUP_PINS,
.v.pins = mba6_pincfgs,
.chained = true,
.chain_id = CS4208_GPIO0,
},
[CS4208_MBP11] = {
.type = HDA_FIXUP_FUNC,
.v.func = cs4208_fixup_spdif_switch,
.chained = true,
.chain_id = CS4208_GPIO0,
},
[CS4208_GPIO0] = {
.type = HDA_FIXUP_FUNC,
.v.func = cs4208_fixup_gpio0,
Expand Down
11 changes: 7 additions & 4 deletions sound/pci/hda/patch_hdmi.c
Original file line number Diff line number Diff line change
Expand Up @@ -763,12 +763,12 @@ static struct channel_map_table map_tables[] = {
{ SNDRV_CHMAP_RC, RC },
{ SNDRV_CHMAP_FLC, FLC },
{ SNDRV_CHMAP_FRC, FRC },
{ SNDRV_CHMAP_FLH, FLH },
{ SNDRV_CHMAP_FRH, FRH },
{ SNDRV_CHMAP_TFL, FLH },
{ SNDRV_CHMAP_TFR, FRH },
{ SNDRV_CHMAP_FLW, FLW },
{ SNDRV_CHMAP_FRW, FRW },
{ SNDRV_CHMAP_TC, TC },
{ SNDRV_CHMAP_FCH, FCH },
{ SNDRV_CHMAP_TFC, FCH },
{} /* terminator */
};

Expand Down Expand Up @@ -1247,6 +1247,9 @@ static int hdmi_pin_hbr_setup(struct hda_codec *codec, hda_nid_t pin_nid,
pinctl = snd_hda_codec_read(codec, pin_nid, 0,
AC_VERB_GET_PIN_WIDGET_CONTROL, 0);

if (pinctl < 0)
return hbr ? -EINVAL : 0;

new_pinctl = pinctl & ~AC_PINCTL_EPT;
if (hbr)
new_pinctl |= AC_PINCTL_EPT_HBR;
Expand Down Expand Up @@ -3091,7 +3094,7 @@ static int atihdmi_pin_hbr_setup(struct hda_codec *codec, hda_nid_t pin_nid,
int hbr_ctl, hbr_ctl_new;

hbr_ctl = snd_hda_codec_read(codec, pin_nid, 0, ATI_VERB_GET_HBR_CONTROL, 0);
if (hbr_ctl & ATI_HBR_CAPABLE) {
if (hbr_ctl >= 0 && (hbr_ctl & ATI_HBR_CAPABLE)) {
if (hbr)
hbr_ctl_new = hbr_ctl | ATI_HBR_ENABLE;
else
Expand Down
Loading

0 comments on commit 73d75ba

Please sign in to comment.