From 7c9e6150f2e7cbd60e0bc9a19118ca1dc97d2780 Mon Sep 17 00:00:00 2001 From: Shawn Guo Date: Mon, 1 Jul 2013 16:16:10 +0800 Subject: ASoC: mxs: register saif mclk to clock framework Mostly the mxs system design uses saif0 mclk output as the clock source of codec. Since the mclk is implemented as a general divider with the saif clk as the parent clock, let's register the mclk as a basic clk-divider to common clock framework. Then with it being a clock provdier, clk_get() call in codec driver probe function will just work. Signed-off-by: Shawn Guo Signed-off-by: Mark Brown --- sound/soc/mxs/mxs-saif.c | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) (limited to 'sound') diff --git a/sound/soc/mxs/mxs-saif.c b/sound/soc/mxs/mxs-saif.c index d31dc52fa862..9ad6dccf791d 100644 --- a/sound/soc/mxs/mxs-saif.c +++ b/sound/soc/mxs/mxs-saif.c @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include @@ -662,6 +663,33 @@ static irqreturn_t mxs_saif_irq(int irq, void *dev_id) 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) { struct device_node *np = pdev->dev.of_node; @@ -769,6 +797,13 @@ static int mxs_saif_probe(struct platform_device *pdev) 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, &mxs_saif_dai, 1); if (ret) { -- cgit v1.2.3 From 0429ffeff460c4302bd1520e696bafe446e15181 Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Tue, 2 Jul 2013 13:10:28 +0100 Subject: ASoC: samsung: Remove obsolete GPIO based DT pinmuxing Since the Samsung platforms have moved to pinctrl for pin muxing and that is handled in the core the old GPIO based muxing code can just be removed. Something similar had been submitted by Thomas Abraham back in March but a resubmission following review never happened. Signed-off-by: Mark Brown --- sound/soc/samsung/i2s.c | 66 +++---------------------------------------------- 1 file changed, 4 insertions(+), 62 deletions(-) (limited to 'sound') diff --git a/sound/soc/samsung/i2s.c b/sound/soc/samsung/i2s.c index 82ebb1a51479..7a1734697434 100644 --- a/sound/soc/samsung/i2s.c +++ b/sound/soc/samsung/i2s.c @@ -1016,52 +1016,6 @@ static struct i2s_dai *i2s_alloc_dai(struct platform_device *pdev, bool sec) 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 inline int samsung_i2s_get_driver_data(struct platform_device *pdev) @@ -1235,18 +1189,10 @@ static int samsung_i2s_probe(struct platform_device *pdev) pri_dai->sec_dai = sec_dai; } - if (np) { - if (samsung_i2s_parse_dt_gpio(pri_dai)) { - dev_err(&pdev->dev, "Unable to configure gpio\n"); - ret = -EINVAL; - 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; - } + if (i2s_pdata && 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, @@ -1267,14 +1213,10 @@ static int samsung_i2s_remove(struct platform_device *pdev) { struct i2s_dai *i2s, *other; struct resource *res; - struct s3c_audio_pdata *i2s_pdata = pdev->dev.platform_data; i2s = dev_get_drvdata(&pdev->dev); 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) { other->pri_dai = NULL; other->sec_dai = NULL; -- cgit v1.2.3 From 8f0b3b7e222383a21f7d58bd97d5552b3a5dbced Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Thu, 4 Jul 2013 12:54:22 +0200 Subject: ALSA: hda - Fix EAPD vmaster hook for AD1884 & co ad1884_fixup_hp_eapd() tries to set the NID for controlling the speaker EAPD from the pin configuration. But the current code can't work expectedly since it sets spec->eapd_nid before calling the generic parser where the autocfg pins are set up. This patch changes the function to set spec->eapd_nid after the generic parser call while it sets vmaster hook unconditionally. The spec->eapd_nid check is moved in the hook function itself instead. Cc: [v3.9+] Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_analog.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'sound') diff --git a/sound/pci/hda/patch_analog.c b/sound/pci/hda/patch_analog.c index 977b0d878dae..d97f0d61a15b 100644 --- a/sound/pci/hda/patch_analog.c +++ b/sound/pci/hda/patch_analog.c @@ -2112,6 +2112,9 @@ 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); @@ -3601,13 +3604,16 @@ static void ad1884_fixup_hp_eapd(struct hda_codec *codec, { 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) spec->eapd_nid = spec->gen.autocfg.line_out_pins[0]; else spec->eapd_nid = spec->gen.autocfg.speaker_pins[0]; - if (spec->eapd_nid) - spec->gen.vmaster_mute.hook = ad_vmaster_eapd_hook; + break; } } -- cgit v1.2.3 From b3ff04668c5a36c290e5b2849b6c86ceb3aec2c3 Mon Sep 17 00:00:00 2001 From: Sachin Kamat Date: Thu, 4 Jul 2013 16:24:37 +0530 Subject: ASoC: Samsung: Remove redundant comment There is a typo in the filename (i2c mentioned instead of i2s). However, this is a redundant piece of information. Delete it altogether. Signed-off-by: Sachin Kamat Signed-off-by: Mark Brown --- sound/soc/samsung/s3c-i2s-v2.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'sound') diff --git a/sound/soc/samsung/s3c-i2s-v2.c b/sound/soc/samsung/s3c-i2s-v2.c index 20e98d1dded2..e5e81b111001 100644 --- a/sound/soc/samsung/s3c-i2s-v2.c +++ b/sound/soc/samsung/s3c-i2s-v2.c @@ -1,6 +1,4 @@ -/* 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. * Graeme Gregory graeme.gregory@wolfsonmicro.com -- cgit v1.2.3 From 28e5ca73ef9072ed58dbb81cfff6f908be8e3cd4 Mon Sep 17 00:00:00 2001 From: "Arnaud Patard (Rtp)" Date: Thu, 20 Jun 2013 23:20:49 +0200 Subject: ASoC: imx-sgtl5000: return E_PROBE_DEFER if ssi/codec not found If the ssi or codec drivers are not loaded (for instance, because spi or i2c bus drivers are not loaded), returning -EINVAL will for people to unload and then reload the module to get sound working. Returning E_PROBE_DEFER will mitigate this. Signed-off-by: Arnaud Patard Signed-off-by: Mark Brown --- sound/soc/fsl/imx-sgtl5000.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'sound') diff --git a/sound/soc/fsl/imx-sgtl5000.c b/sound/soc/fsl/imx-sgtl5000.c index 7a8bc1220b2e..3f726e4f88db 100644 --- a/sound/soc/fsl/imx-sgtl5000.c +++ b/sound/soc/fsl/imx-sgtl5000.c @@ -113,13 +113,13 @@ static int imx_sgtl5000_probe(struct platform_device *pdev) ssi_pdev = of_find_device_by_node(ssi_np); if (!ssi_pdev) { dev_err(&pdev->dev, "failed to find SSI platform device\n"); - ret = -EINVAL; + ret = -EPROBE_DEFER; goto fail; } codec_dev = of_find_i2c_device_by_node(codec_np); if (!codec_dev) { 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); -- cgit v1.2.3 From 4642aabd21d0491a7d9dcbe789bdf93a596f771c Mon Sep 17 00:00:00 2001 From: Shawn Guo Date: Thu, 4 Jul 2013 23:14:00 +0800 Subject: ASoC: wm8962: fix NULL pdata pointer There is an error in merge commit 384b834 on conflict resolution which causes the following NULL pdata pointer bug. wm8962 0-001a: customer id 0 revision D Unable to handle kernel NULL pointer dereference at virtual address 00000004 pgd = 80004000 [00000004] *pgd=00000000 Internal error: Oops: 5 [#1] SMP ARM Modules linked in: CPU: 0 PID: 1 Comm: swapper/0 Not tainted 3.10.0+ #1 task: bf870000 ti: bf874000 task.ti: bf874000 PC is at wm8962_probe+0x134/0x6c8 LR is at regmap_unlock_mutex+0x10/0x14 pc : [<80452100>] lr : [<80304cf4>] psr: a0000113 sp : bf875c98 ip : 00000000 fp : bf875cd4 r10: 00000000 r9 : bfb1830c r8 : 80779bc4 r7 : 00000000 r6 : 00000001 r5 : bfbac010 r4 : bfb33e00 r3 : 80304ce4 r2 : 00000000 r1 : 00000001 r0 : fffffffb Flags: NzCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment kernel Control: 10c53c7d Table: 1000404a DAC: 00000017 Process swapper/0 (pid: 1, stack limit = 0xbf874238) Stack: (0xbf875c98 to 0xbf876000) ... Fix the error by assigning pdata a correct pointer. Signed-off-by: Shawn Guo Signed-off-by: Mark Brown --- sound/soc/codecs/wm8962.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sound') diff --git a/sound/soc/codecs/wm8962.c b/sound/soc/codecs/wm8962.c index b1dc7d426438..e2de9ecfd641 100644 --- a/sound/soc/codecs/wm8962.c +++ b/sound/soc/codecs/wm8962.c @@ -3377,7 +3377,7 @@ static int wm8962_probe(struct snd_soc_codec *codec) { int ret; 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; bool dmicclk, dmicdat; -- cgit v1.2.3 From cd63a5ffd24214246b1092365c7d6c2cd5aca29b Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Fri, 5 Jul 2013 12:13:59 +0200 Subject: ALSA: hda - Keep halting ALC5505 DSP ALC5505 DSP is enabled even though we don't use the features yet at all. This results in the unnecessarily high power consumption, more than 100mV higher. Until we implement the DSP support, better to bypass DSP for saving more power. Reported-by: Mengdong Lin [Patch modified by Mengdong to cal alc5505_dsp_init() with extra acl5505_dsp_halt().] Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_realtek.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'sound') diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 14ac9b0e740c..8bd226149868 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -37,6 +37,9 @@ #include "hda_jack.h" #include "hda_generic.h" +/* keep halting ALC5505 DSP, for power saving */ +#define HALT_REALTEK_ALC5505 + /* unsol event tags */ #define ALC_DCVOL_EVENT 0x08 @@ -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, 0x00000003); 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 static int alc269_suspend(struct hda_codec *codec) { struct alc_spec *spec = codec->spec; if (spec->has_alc5505_dsp) - alc5505_dsp_halt(codec); + alc5505_dsp_suspend(codec); return alc_suspend(codec); } @@ -2696,7 +2711,7 @@ static int alc269_resume(struct hda_codec *codec) alc_inv_dmic_sync(codec, true); hda_call_check_power_status(codec, 0x01); if (spec->has_alc5505_dsp) - alc5505_dsp_back_from_halt(codec); + alc5505_dsp_resume(codec); return 0; } #endif /* CONFIG_PM */ -- cgit v1.2.3 From 42d4ab832d843b5a512b373c86e70caa43a041c8 Mon Sep 17 00:00:00 2001 From: Eldad Zack Date: Tue, 9 Jul 2013 20:36:15 +0200 Subject: ALSA: usb-audio: fix regression for fixed stream quirk Commit 8f898e92aea2c24c7f379ee265d178f69ebb9c07 removed the redundant reads of bInterfaceProtocol from the descriptors, but introduced a regression to devices with quirks of type QUIRK_AUDIO_FIXED_ENDPOINT, since fp->protocol is not set in setup process. As a consequence, audio streams would not get initialized, as the following logs show: [ 48.923043] setting usb interface 3:1 [ 48.923056] Creating new capture data endpoint #81 [ 48.923484] 4:3:1: cannot set freq 48000 to ep 0x81 This patch sets fp->protocol in create_fixed_stream_quirk() and resolves the regression. Signed-off-by: Eldad Zack Signed-off-by: Takashi Iwai --- sound/usb/quirks.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'sound') diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c index 5b01330b8452..1bc45e71f1fe 100644 --- a/sound/usb/quirks.c +++ b/sound/usb/quirks.c @@ -129,6 +129,7 @@ static int create_fixed_stream_quirk(struct snd_usb_audio *chip, { struct audioformat *fp; struct usb_host_interface *alts; + struct usb_interface_descriptor *altsd; int stream, err; unsigned *rate_table = NULL; @@ -166,6 +167,9 @@ static int create_fixed_stream_quirk(struct snd_usb_audio *chip, return -EINVAL; } alts = &iface->altsetting[fp->altset_idx]; + altsd = get_iface_desc(alts); + fp->protocol = altsd->bInterfaceProtocol; + if (fp->datainterval == 0) fp->datainterval = snd_usb_parse_datainterval(chip, alts); if (fp->maxpacksize == 0) -- cgit v1.2.3