Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 316159
b: refs/heads/master
c: 61eab00
h: refs/heads/master
i:
  316157: 513dc1d
  316155: d382a97
  316151: c5825ed
  316143: 58c94e0
  316127: 77ce2fc
  316095: 8e67cba
  316031: 27ec30c
  315903: 4d9d6a2
v: v3
  • Loading branch information
Takashi Iwai committed Jul 18, 2012
1 parent 5a3a15a commit 0ccb1b8
Show file tree
Hide file tree
Showing 7 changed files with 75 additions and 95 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 4e01ec636e64707d202a1ca21a47bbc6d53085b7
refs/heads/master: 61eab000f3536f080eab43fd5eed3fd817ded76e
28 changes: 28 additions & 0 deletions trunk/sound/pci/hda/patch_realtek.c
Original file line number Diff line number Diff line change
Expand Up @@ -6873,6 +6873,31 @@ static const struct alc_model_fixup alc662_fixup_models[] = {
{}
};

static void alc662_fill_coef(struct hda_codec *codec)
{
int val, coef;

coef = alc_get_coef0(codec);

switch (codec->vendor_id) {
case 0x10ec0662:
if ((coef & 0x00f0) == 0x0030) {
val = alc_read_coef_idx(codec, 0x4); /* EAPD Ctrl */
alc_write_coef_idx(codec, 0x4, val & ~(1<<10));
}
break;
case 0x10ec0272:
case 0x10ec0273:
case 0x10ec0663:
case 0x10ec0665:
case 0x10ec0670:
case 0x10ec0671:
case 0x10ec0672:
val = alc_read_coef_idx(codec, 0xd); /* EAPD Ctrl */
alc_write_coef_idx(codec, 0xd, val | (1<<14));
break;
}
}

/*
*/
Expand All @@ -6892,6 +6917,9 @@ static int patch_alc662(struct hda_codec *codec)

alc_fix_pll_init(codec, 0x20, 0x04, 15);

spec->init_hook = alc662_fill_coef;
alc662_fill_coef(codec);

alc_pick_fixup(codec, alc662_fixup_models,
alc662_fixup_tbl, alc662_fixups);
alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE);
Expand Down
4 changes: 1 addition & 3 deletions trunk/sound/soc/codecs/tlv320aic3x.c
Original file line number Diff line number Diff line change
Expand Up @@ -935,9 +935,7 @@ static int aic3x_hw_params(struct snd_pcm_substream *substream,
}

found:
data = snd_soc_read(codec, AIC3X_PLL_PROGA_REG);
snd_soc_write(codec, AIC3X_PLL_PROGA_REG,
data | (pll_p << PLLP_SHIFT));
snd_soc_update_bits(codec, AIC3X_PLL_PROGA_REG, PLLP_MASK, pll_p);
snd_soc_write(codec, AIC3X_OVRF_STATUS_AND_PLLR_REG,
pll_r << PLLR_SHIFT);
snd_soc_write(codec, AIC3X_PLL_PROGB_REG, pll_j << PLLJ_SHIFT);
Expand Down
1 change: 1 addition & 0 deletions trunk/sound/soc/codecs/tlv320aic3x.h
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@

/* PLL registers bitfields */
#define PLLP_SHIFT 0
#define PLLP_MASK 7
#define PLLQ_SHIFT 3
#define PLLR_SHIFT 0
#define PLLJ_SHIFT 2
Expand Down
1 change: 1 addition & 0 deletions trunk/sound/soc/codecs/wm2200.c
Original file line number Diff line number Diff line change
Expand Up @@ -1491,6 +1491,7 @@ static int wm2200_bclk_rates_dat[WM2200_NUM_BCLK_RATES] = {

static int wm2200_bclk_rates_cd[WM2200_NUM_BCLK_RATES] = {
5644800,
3763200,
2882400,
1881600,
1411200,
Expand Down
73 changes: 6 additions & 67 deletions trunk/sound/usb/endpoint.c
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ struct snd_usb_endpoint *snd_usb_add_endpoint(struct snd_usb_audio *chip,
{
struct list_head *p;
struct snd_usb_endpoint *ep;
int ret, is_playback = direction == SNDRV_PCM_STREAM_PLAYBACK;
int is_playback = direction == SNDRV_PCM_STREAM_PLAYBACK;

mutex_lock(&chip->mutex);

Expand All @@ -434,16 +434,6 @@ struct snd_usb_endpoint *snd_usb_add_endpoint(struct snd_usb_audio *chip,
type == SND_USB_ENDPOINT_TYPE_DATA ? "data" : "sync",
ep_num);

/* select the alt setting once so the endpoints become valid */
ret = usb_set_interface(chip->dev, alts->desc.bInterfaceNumber,
alts->desc.bAlternateSetting);
if (ret < 0) {
snd_printk(KERN_ERR "%s(): usb_set_interface() failed, ret = %d\n",
__func__, ret);
ep = NULL;
goto __exit_unlock;
}

ep = kzalloc(sizeof(*ep), GFP_KERNEL);
if (!ep)
goto __exit_unlock;
Expand Down Expand Up @@ -831,9 +821,6 @@ int snd_usb_endpoint_start(struct snd_usb_endpoint *ep)
if (++ep->use_count != 1)
return 0;

if (snd_BUG_ON(!test_bit(EP_FLAG_ACTIVATED, &ep->flags)))
return -EINVAL;

/* just to be sure */
deactivate_urbs(ep, 0, 1);
wait_clear_urbs(ep);
Expand Down Expand Up @@ -911,9 +898,6 @@ void snd_usb_endpoint_stop(struct snd_usb_endpoint *ep,
if (snd_BUG_ON(ep->use_count == 0))
return;

if (snd_BUG_ON(!test_bit(EP_FLAG_ACTIVATED, &ep->flags)))
return;

if (--ep->use_count == 0) {
deactivate_urbs(ep, force, can_sleep);
ep->data_subs = NULL;
Expand All @@ -926,42 +910,6 @@ void snd_usb_endpoint_stop(struct snd_usb_endpoint *ep,
}
}

/**
* snd_usb_endpoint_activate: activate an snd_usb_endpoint
*
* @ep: the endpoint to activate
*
* If the endpoint is not currently in use, this functions will select the
* correct alternate interface setting for the interface of this endpoint.
*
* In case of any active users, this functions does nothing.
*
* Returns an error if usb_set_interface() failed, 0 in all other
* cases.
*/
int snd_usb_endpoint_activate(struct snd_usb_endpoint *ep)
{
if (ep->use_count != 0)
return 0;

if (!ep->chip->shutdown &&
!test_and_set_bit(EP_FLAG_ACTIVATED, &ep->flags)) {
int ret;

ret = usb_set_interface(ep->chip->dev, ep->iface, ep->alt_idx);
if (ret < 0) {
snd_printk(KERN_ERR "%s() usb_set_interface() failed, ret = %d\n",
__func__, ret);
clear_bit(EP_FLAG_ACTIVATED, &ep->flags);
return ret;
}

return 0;
}

return -EBUSY;
}

/**
* snd_usb_endpoint_deactivate: deactivate an snd_usb_endpoint
*
Expand All @@ -980,24 +928,15 @@ int snd_usb_endpoint_deactivate(struct snd_usb_endpoint *ep)
if (!ep)
return -EINVAL;

deactivate_urbs(ep, 1, 1);
wait_clear_urbs(ep);

if (ep->use_count != 0)
return 0;

if (!ep->chip->shutdown &&
test_and_clear_bit(EP_FLAG_ACTIVATED, &ep->flags)) {
int ret;

ret = usb_set_interface(ep->chip->dev, ep->iface, 0);
if (ret < 0) {
snd_printk(KERN_ERR "%s(): usb_set_interface() failed, ret = %d\n",
__func__, ret);
return ret;
}
clear_bit(EP_FLAG_ACTIVATED, &ep->flags);

return 0;
}

return -EBUSY;
return 0;
}

/**
Expand Down
61 changes: 37 additions & 24 deletions trunk/sound/usb/pcm.c
Original file line number Diff line number Diff line change
Expand Up @@ -261,19 +261,6 @@ static void stop_endpoints(struct snd_usb_substream *subs,
force, can_sleep, wait);
}

static int activate_endpoints(struct snd_usb_substream *subs)
{
if (subs->sync_endpoint) {
int ret;

ret = snd_usb_endpoint_activate(subs->sync_endpoint);
if (ret < 0)
return ret;
}

return snd_usb_endpoint_activate(subs->data_endpoint);
}

static int deactivate_endpoints(struct snd_usb_substream *subs)
{
int reta, retb;
Expand Down Expand Up @@ -314,6 +301,33 @@ static int set_format(struct snd_usb_substream *subs, struct audioformat *fmt)
if (fmt == subs->cur_audiofmt)
return 0;

/* close the old interface */
if (subs->interface >= 0 && subs->interface != fmt->iface) {
err = usb_set_interface(subs->dev, subs->interface, 0);
if (err < 0) {
snd_printk(KERN_ERR "%d:%d:%d: return to setting 0 failed (%d)\n",
dev->devnum, fmt->iface, fmt->altsetting, err);
return -EIO;
}
subs->interface = -1;
subs->altset_idx = 0;
}

/* set interface */
if (subs->interface != fmt->iface ||
subs->altset_idx != fmt->altset_idx) {
err = usb_set_interface(dev, fmt->iface, fmt->altsetting);
if (err < 0) {
snd_printk(KERN_ERR "%d:%d:%d: usb_set_interface failed (%d)\n",
dev->devnum, fmt->iface, fmt->altsetting, err);
return -EIO;
}
snd_printdd(KERN_INFO "setting usb interface %d:%d\n",
fmt->iface, fmt->altsetting);
subs->interface = fmt->iface;
subs->altset_idx = fmt->altset_idx;
}

subs->data_endpoint = snd_usb_add_endpoint(subs->stream->chip,
alts, fmt->endpoint, subs->direction,
SND_USB_ENDPOINT_TYPE_DATA);
Expand Down Expand Up @@ -387,7 +401,7 @@ static int set_format(struct snd_usb_substream *subs, struct audioformat *fmt)
subs->data_endpoint->sync_master = subs->sync_endpoint;
}

if ((err = snd_usb_init_pitch(subs->stream->chip, subs->interface, alts, fmt)) < 0)
if ((err = snd_usb_init_pitch(subs->stream->chip, fmt->iface, alts, fmt)) < 0)
return err;

subs->cur_audiofmt = fmt;
Expand Down Expand Up @@ -450,7 +464,7 @@ static int snd_usb_hw_params(struct snd_pcm_substream *substream,
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, subs->interface, alts, fmt, rate);
ret = snd_usb_init_sample_rate(subs->stream->chip, fmt->iface, alts, fmt, rate);
if (ret < 0)
return ret;
subs->cur_rate = rate;
Expand All @@ -460,12 +474,6 @@ static int snd_usb_hw_params(struct snd_pcm_substream *substream,
mutex_lock(&subs->stream->chip->shutdown_mutex);
/* format changed */
stop_endpoints(subs, 0, 0, 0);
deactivate_endpoints(subs);

ret = activate_endpoints(subs);
if (ret < 0)
goto unlock;

ret = snd_usb_endpoint_set_params(subs->data_endpoint, hw_params, fmt,
subs->sync_endpoint);
if (ret < 0)
Expand Down Expand Up @@ -500,6 +508,7 @@ static int snd_usb_hw_free(struct snd_pcm_substream *substream)
subs->period_bytes = 0;
mutex_lock(&subs->stream->chip->shutdown_mutex);
stop_endpoints(subs, 0, 1, 1);
deactivate_endpoints(subs);
mutex_unlock(&subs->stream->chip->shutdown_mutex);
return snd_pcm_lib_free_vmalloc_buffer(substream);
}
Expand Down Expand Up @@ -938,16 +947,20 @@ static int snd_usb_pcm_open(struct snd_pcm_substream *substream, int direction)

static int snd_usb_pcm_close(struct snd_pcm_substream *substream, int direction)
{
int ret;
struct snd_usb_stream *as = snd_pcm_substream_chip(substream);
struct snd_usb_substream *subs = &as->substream[direction];

stop_endpoints(subs, 0, 0, 0);
ret = deactivate_endpoints(subs);

if (!as->chip->shutdown && subs->interface >= 0) {
usb_set_interface(subs->dev, subs->interface, 0);
subs->interface = -1;
}

subs->pcm_substream = NULL;
snd_usb_autosuspend(subs->stream->chip);

return ret;
return 0;
}

/* Since a URB can handle only a single linear buffer, we must use double
Expand Down

0 comments on commit 0ccb1b8

Please sign in to comment.