Commit 0fb3767b authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'sound-3.11' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound

Pull sound fixes from Takashi Iwai:
 "A few small fixes (and cleanups) for HD-audio, USB-audio and ASoC"

* tag 'sound-3.11' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound:
  ALSA: usb-audio: fix regression for fixed stream quirk
  ALSA: hda - Keep halting ALC5505 DSP
  ASoC: wm8962: fix NULL pdata pointer
  ASoC: imx-sgtl5000: return E_PROBE_DEFER if ssi/codec not found
  ASoC: Samsung: Remove redundant comment
  ALSA: hda - Fix EAPD vmaster hook for AD1884 & co
  ASoC: samsung: Remove obsolete GPIO based DT pinmuxing
  ASoC: mxs: register saif mclk to clock framework
parents 0edcd16a 42d4ab83
...@@ -2112,6 +2112,9 @@ static void ad_vmaster_eapd_hook(void *private_data, int enabled) ...@@ -2112,6 +2112,9 @@ static void ad_vmaster_eapd_hook(void *private_data, int enabled)
{ {
struct hda_codec *codec = private_data; struct hda_codec *codec = private_data;
struct ad198x_spec *spec = codec->spec; struct ad198x_spec *spec = codec->spec;
if (!spec->eapd_nid)
return;
snd_hda_codec_update_cache(codec, spec->eapd_nid, 0, snd_hda_codec_update_cache(codec, spec->eapd_nid, 0,
AC_VERB_SET_EAPD_BTLENABLE, AC_VERB_SET_EAPD_BTLENABLE,
enabled ? 0x02 : 0x00); enabled ? 0x02 : 0x00);
...@@ -3601,13 +3604,16 @@ static void ad1884_fixup_hp_eapd(struct hda_codec *codec, ...@@ -3601,13 +3604,16 @@ static void ad1884_fixup_hp_eapd(struct hda_codec *codec,
{ {
struct ad198x_spec *spec = codec->spec; struct ad198x_spec *spec = codec->spec;
if (action == HDA_FIXUP_ACT_PRE_PROBE) { switch (action) {
case HDA_FIXUP_ACT_PRE_PROBE:
spec->gen.vmaster_mute.hook = ad_vmaster_eapd_hook;
break;
case HDA_FIXUP_ACT_PROBE:
if (spec->gen.autocfg.line_out_type == AUTO_PIN_SPEAKER_OUT) if (spec->gen.autocfg.line_out_type == AUTO_PIN_SPEAKER_OUT)
spec->eapd_nid = spec->gen.autocfg.line_out_pins[0]; spec->eapd_nid = spec->gen.autocfg.line_out_pins[0];
else else
spec->eapd_nid = spec->gen.autocfg.speaker_pins[0]; spec->eapd_nid = spec->gen.autocfg.speaker_pins[0];
if (spec->eapd_nid) break;
spec->gen.vmaster_mute.hook = ad_vmaster_eapd_hook;
} }
} }
......
...@@ -37,6 +37,9 @@ ...@@ -37,6 +37,9 @@
#include "hda_jack.h" #include "hda_jack.h"
#include "hda_generic.h" #include "hda_generic.h"
/* keep halting ALC5505 DSP, for power saving */
#define HALT_REALTEK_ALC5505
/* unsol event tags */ /* unsol event tags */
#define ALC_DCVOL_EVENT 0x08 #define ALC_DCVOL_EVENT 0x08
...@@ -2659,15 +2662,27 @@ static void alc5505_dsp_init(struct hda_codec *codec) ...@@ -2659,15 +2662,27 @@ static void alc5505_dsp_init(struct hda_codec *codec)
alc5505_coef_set(codec, 0x880c, 0x00000004); /* DRAM Function control */ alc5505_coef_set(codec, 0x880c, 0x00000004); /* DRAM Function control */
alc5505_coef_set(codec, 0x880c, 0x00000003); alc5505_coef_set(codec, 0x880c, 0x00000003);
alc5505_coef_set(codec, 0x880c, 0x00000010); alc5505_coef_set(codec, 0x880c, 0x00000010);
#ifdef HALT_REALTEK_ALC5505
alc5505_dsp_halt(codec);
#endif
} }
#ifdef HALT_REALTEK_ALC5505
#define alc5505_dsp_suspend(codec) /* NOP */
#define alc5505_dsp_resume(codec) /* NOP */
#else
#define alc5505_dsp_suspend(codec) alc5505_dsp_halt(codec)
#define alc5505_dsp_resume(codec) alc5505_dsp_back_from_halt(codec)
#endif
#ifdef CONFIG_PM #ifdef CONFIG_PM
static int alc269_suspend(struct hda_codec *codec) static int alc269_suspend(struct hda_codec *codec)
{ {
struct alc_spec *spec = codec->spec; struct alc_spec *spec = codec->spec;
if (spec->has_alc5505_dsp) if (spec->has_alc5505_dsp)
alc5505_dsp_halt(codec); alc5505_dsp_suspend(codec);
return alc_suspend(codec); return alc_suspend(codec);
} }
...@@ -2696,7 +2711,7 @@ static int alc269_resume(struct hda_codec *codec) ...@@ -2696,7 +2711,7 @@ static int alc269_resume(struct hda_codec *codec)
alc_inv_dmic_sync(codec, true); alc_inv_dmic_sync(codec, true);
hda_call_check_power_status(codec, 0x01); hda_call_check_power_status(codec, 0x01);
if (spec->has_alc5505_dsp) if (spec->has_alc5505_dsp)
alc5505_dsp_back_from_halt(codec); alc5505_dsp_resume(codec);
return 0; return 0;
} }
#endif /* CONFIG_PM */ #endif /* CONFIG_PM */
......
...@@ -3377,7 +3377,7 @@ static int wm8962_probe(struct snd_soc_codec *codec) ...@@ -3377,7 +3377,7 @@ static int wm8962_probe(struct snd_soc_codec *codec)
{ {
int ret; int ret;
struct wm8962_priv *wm8962 = snd_soc_codec_get_drvdata(codec); struct wm8962_priv *wm8962 = snd_soc_codec_get_drvdata(codec);
struct wm8962_pdata *pdata = dev_get_platdata(codec->dev); struct wm8962_pdata *pdata = &wm8962->pdata;
int i, trigger, irq_pol; int i, trigger, irq_pol;
bool dmicclk, dmicdat; bool dmicclk, dmicdat;
......
...@@ -113,13 +113,13 @@ static int imx_sgtl5000_probe(struct platform_device *pdev) ...@@ -113,13 +113,13 @@ static int imx_sgtl5000_probe(struct platform_device *pdev)
ssi_pdev = of_find_device_by_node(ssi_np); ssi_pdev = of_find_device_by_node(ssi_np);
if (!ssi_pdev) { if (!ssi_pdev) {
dev_err(&pdev->dev, "failed to find SSI platform device\n"); dev_err(&pdev->dev, "failed to find SSI platform device\n");
ret = -EINVAL; ret = -EPROBE_DEFER;
goto fail; goto fail;
} }
codec_dev = of_find_i2c_device_by_node(codec_np); codec_dev = of_find_i2c_device_by_node(codec_np);
if (!codec_dev) { if (!codec_dev) {
dev_err(&pdev->dev, "failed to find codec platform device\n"); dev_err(&pdev->dev, "failed to find codec platform device\n");
return -EINVAL; return -EPROBE_DEFER;
} }
data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL); data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL);
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/dma-mapping.h> #include <linux/dma-mapping.h>
#include <linux/clk.h> #include <linux/clk.h>
#include <linux/clk-provider.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/time.h> #include <linux/time.h>
#include <sound/core.h> #include <sound/core.h>
...@@ -658,6 +659,33 @@ static irqreturn_t mxs_saif_irq(int irq, void *dev_id) ...@@ -658,6 +659,33 @@ static irqreturn_t mxs_saif_irq(int irq, void *dev_id)
return IRQ_HANDLED; return IRQ_HANDLED;
} }
static int mxs_saif_mclk_init(struct platform_device *pdev)
{
struct mxs_saif *saif = platform_get_drvdata(pdev);
struct device_node *np = pdev->dev.of_node;
struct clk *clk;
int ret;
clk = clk_register_divider(&pdev->dev, "mxs_saif_mclk",
__clk_get_name(saif->clk), 0,
saif->base + SAIF_CTRL,
BP_SAIF_CTRL_BITCLK_MULT_RATE, 3,
0, NULL);
if (IS_ERR(clk)) {
ret = PTR_ERR(clk);
if (ret == -EEXIST)
return 0;
dev_err(&pdev->dev, "failed to register mclk: %d\n", ret);
return PTR_ERR(clk);
}
ret = of_clk_add_provider(np, of_clk_src_simple_get, clk);
if (ret)
return ret;
return 0;
}
static int mxs_saif_probe(struct platform_device *pdev) static int mxs_saif_probe(struct platform_device *pdev)
{ {
struct device_node *np = pdev->dev.of_node; struct device_node *np = pdev->dev.of_node;
...@@ -734,6 +762,13 @@ static int mxs_saif_probe(struct platform_device *pdev) ...@@ -734,6 +762,13 @@ static int mxs_saif_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, saif); platform_set_drvdata(pdev, saif);
/* We only support saif0 being tx and clock master */
if (saif->id == 0) {
ret = mxs_saif_mclk_init(pdev);
if (ret)
dev_warn(&pdev->dev, "failed to init clocks\n");
}
ret = snd_soc_register_component(&pdev->dev, &mxs_saif_component, ret = snd_soc_register_component(&pdev->dev, &mxs_saif_component,
&mxs_saif_dai, 1); &mxs_saif_dai, 1);
if (ret) { if (ret) {
......
...@@ -1016,52 +1016,6 @@ static struct i2s_dai *i2s_alloc_dai(struct platform_device *pdev, bool sec) ...@@ -1016,52 +1016,6 @@ static struct i2s_dai *i2s_alloc_dai(struct platform_device *pdev, bool sec)
return i2s; return i2s;
} }
#ifdef CONFIG_OF
static int samsung_i2s_parse_dt_gpio(struct i2s_dai *i2s)
{
struct device *dev = &i2s->pdev->dev;
int index, gpio, ret;
for (index = 0; index < 7; index++) {
gpio = of_get_gpio(dev->of_node, index);
if (!gpio_is_valid(gpio)) {
dev_err(dev, "invalid gpio[%d]: %d\n", index, gpio);
goto free_gpio;
}
ret = gpio_request(gpio, dev_name(dev));
if (ret) {
dev_err(dev, "gpio [%d] request failed\n", gpio);
goto free_gpio;
}
i2s->gpios[index] = gpio;
}
return 0;
free_gpio:
while (--index >= 0)
gpio_free(i2s->gpios[index]);
return -EINVAL;
}
static void samsung_i2s_dt_gpio_free(struct i2s_dai *i2s)
{
unsigned int index;
for (index = 0; index < 7; index++)
gpio_free(i2s->gpios[index]);
}
#else
static int samsung_i2s_parse_dt_gpio(struct i2s_dai *dai)
{
return -EINVAL;
}
static void samsung_i2s_dt_gpio_free(struct i2s_dai *dai)
{
}
#endif
static const struct of_device_id exynos_i2s_match[]; static const struct of_device_id exynos_i2s_match[];
static inline int samsung_i2s_get_driver_data(struct platform_device *pdev) static inline int samsung_i2s_get_driver_data(struct platform_device *pdev)
...@@ -1235,18 +1189,10 @@ static int samsung_i2s_probe(struct platform_device *pdev) ...@@ -1235,18 +1189,10 @@ static int samsung_i2s_probe(struct platform_device *pdev)
pri_dai->sec_dai = sec_dai; pri_dai->sec_dai = sec_dai;
} }
if (np) { if (i2s_pdata && i2s_pdata->cfg_gpio && i2s_pdata->cfg_gpio(pdev)) {
if (samsung_i2s_parse_dt_gpio(pri_dai)) { dev_err(&pdev->dev, "Unable to configure gpio\n");
dev_err(&pdev->dev, "Unable to configure gpio\n"); ret = -EINVAL;
ret = -EINVAL; goto err;
goto err;
}
} else {
if (i2s_pdata->cfg_gpio && i2s_pdata->cfg_gpio(pdev)) {
dev_err(&pdev->dev, "Unable to configure gpio\n");
ret = -EINVAL;
goto err;
}
} }
snd_soc_register_component(&pri_dai->pdev->dev, &samsung_i2s_component, snd_soc_register_component(&pri_dai->pdev->dev, &samsung_i2s_component,
...@@ -1267,14 +1213,10 @@ static int samsung_i2s_remove(struct platform_device *pdev) ...@@ -1267,14 +1213,10 @@ static int samsung_i2s_remove(struct platform_device *pdev)
{ {
struct i2s_dai *i2s, *other; struct i2s_dai *i2s, *other;
struct resource *res; struct resource *res;
struct s3c_audio_pdata *i2s_pdata = pdev->dev.platform_data;
i2s = dev_get_drvdata(&pdev->dev); i2s = dev_get_drvdata(&pdev->dev);
other = i2s->pri_dai ? : i2s->sec_dai; other = i2s->pri_dai ? : i2s->sec_dai;
if (!i2s_pdata->cfg_gpio && pdev->dev.of_node)
samsung_i2s_dt_gpio_free(i2s->pri_dai);
if (other) { if (other) {
other->pri_dai = NULL; other->pri_dai = NULL;
other->sec_dai = NULL; other->sec_dai = NULL;
......
/* sound/soc/samsung/s3c-i2c-v2.c /* ALSA Soc Audio Layer - I2S core for newer Samsung SoCs.
*
* ALSA Soc Audio Layer - I2S core for newer Samsung SoCs.
* *
* Copyright (c) 2006 Wolfson Microelectronics PLC. * Copyright (c) 2006 Wolfson Microelectronics PLC.
* Graeme Gregory graeme.gregory@wolfsonmicro.com * Graeme Gregory graeme.gregory@wolfsonmicro.com
......
...@@ -129,6 +129,7 @@ static int create_fixed_stream_quirk(struct snd_usb_audio *chip, ...@@ -129,6 +129,7 @@ static int create_fixed_stream_quirk(struct snd_usb_audio *chip,
{ {
struct audioformat *fp; struct audioformat *fp;
struct usb_host_interface *alts; struct usb_host_interface *alts;
struct usb_interface_descriptor *altsd;
int stream, err; int stream, err;
unsigned *rate_table = NULL; unsigned *rate_table = NULL;
...@@ -166,6 +167,9 @@ static int create_fixed_stream_quirk(struct snd_usb_audio *chip, ...@@ -166,6 +167,9 @@ static int create_fixed_stream_quirk(struct snd_usb_audio *chip,
return -EINVAL; return -EINVAL;
} }
alts = &iface->altsetting[fp->altset_idx]; alts = &iface->altsetting[fp->altset_idx];
altsd = get_iface_desc(alts);
fp->protocol = altsd->bInterfaceProtocol;
if (fp->datainterval == 0) if (fp->datainterval == 0)
fp->datainterval = snd_usb_parse_datainterval(chip, alts); fp->datainterval = snd_usb_parse_datainterval(chip, alts);
if (fp->maxpacksize == 0) if (fp->maxpacksize == 0)
......
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