From 2efc87605edf656afb7225c7469ac8de958cdf38 Mon Sep 17 00:00:00 2001 From: Joerg Roedel Date: Thu, 15 Dec 2011 18:24:54 +0100 Subject: [PATCH] --- yaml --- r: 283962 b: refs/heads/master c: c45471eac2bdc271df40963ac8448d76ac434872 h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/drivers/mfd/wm8994-core.c | 14 ------------- trunk/sound/soc/codecs/wm8993.c | 29 +++++++++++++++++++++++--- trunk/sound/soc/codecs/wm8995.c | 1 - trunk/sound/soc/codecs/wm8996.c | 18 ++++++---------- trunk/sound/soc/codecs/wm9081.c | 1 + trunk/sound/soc/codecs/wm9090.c | 13 +++++++++++- trunk/sound/soc/mid-x86/mfld_machine.c | 2 +- trunk/sound/soc/mid-x86/sst_platform.c | 5 +++-- trunk/sound/soc/samsung/idma.c | 2 +- trunk/sound/soc/samsung/pcm.c | 12 +++++------ trunk/sound/soc/sh/fsi.c | 4 ++++ trunk/sound/soc/sh/sh7760-ac97.c | 4 ++++ trunk/sound/soc/sh/siu_dai.c | 6 ++++++ 14 files changed, 71 insertions(+), 42 deletions(-) diff --git a/[refs] b/[refs] index 0978231e66a7..2a007a614493 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 00c651612ef2b4b6b953059ace6b50afcb8d88c4 +refs/heads/master: c45471eac2bdc271df40963ac8448d76ac434872 diff --git a/trunk/drivers/mfd/wm8994-core.c b/trunk/drivers/mfd/wm8994-core.c index 9b8d1ad28ee1..93f8599aba32 100644 --- a/trunk/drivers/mfd/wm8994-core.c +++ b/trunk/drivers/mfd/wm8994-core.c @@ -241,20 +241,6 @@ static int wm8994_suspend(struct device *dev) break; } - switch (wm8994->type) { - case WM1811: - ret = wm8994_reg_read(wm8994, WM8994_ANTIPOP_2); - if (ret < 0) { - dev_err(dev, "Failed to read jackdet: %d\n", ret); - } else if (ret & WM1811_JACKDET_MODE_MASK) { - dev_dbg(dev, "CODEC still active, ignoring suspend\n"); - return 0; - } - break; - default: - break; - } - /* Disable LDO pulldowns while the device is suspended if we * don't know that something will be driving them. */ if (!wm8994->ldo_ena_always_driven) diff --git a/trunk/sound/soc/codecs/wm8993.c b/trunk/sound/soc/codecs/wm8993.c index 2b40c93601ed..f472ea6ecf6b 100644 --- a/trunk/sound/soc/codecs/wm8993.c +++ b/trunk/sound/soc/codecs/wm8993.c @@ -934,6 +934,28 @@ static const struct snd_soc_dapm_route routes[] = { { "Right Headphone Mux", "DAC", "DACR" }, }; +static void wm8993_cache_restore(struct snd_soc_codec *codec) +{ + u16 *cache = codec->reg_cache; + int i; + + if (!codec->cache_sync) + return; + + /* Reenable hardware writes */ + codec->cache_only = 0; + + /* Restore the register settings */ + for (i = 1; i < WM8993_MAX_REGISTER; i++) { + if (cache[i] == wm8993_reg_defaults[i]) + continue; + snd_soc_write(codec, i, cache[i]); + } + + /* We're in sync again */ + codec->cache_sync = 0; +} + static int wm8993_set_bias_level(struct snd_soc_codec *codec, enum snd_soc_bias_level level) { @@ -957,7 +979,7 @@ static int wm8993_set_bias_level(struct snd_soc_codec *codec, if (ret != 0) return ret; - snd_soc_cache_sync(codec); + wm8993_cache_restore(codec); /* Tune DC servo configuration */ snd_soc_write(codec, 0x44, 3); @@ -1591,8 +1613,7 @@ static __devinit int wm8993_i2c_probe(struct i2c_client *i2c, struct wm8993_priv *wm8993; int ret; - wm8993 = devm_kzalloc(&i2c->dev, sizeof(struct wm8993_priv), - GFP_KERNEL); + wm8993 = kzalloc(sizeof(struct wm8993_priv), GFP_KERNEL); if (wm8993 == NULL) return -ENOMEM; @@ -1600,6 +1621,8 @@ static __devinit int wm8993_i2c_probe(struct i2c_client *i2c, ret = snd_soc_register_codec(&i2c->dev, &soc_codec_dev_wm8993, &wm8993_dai, 1); + if (ret < 0) + kfree(wm8993); return ret; } diff --git a/trunk/sound/soc/codecs/wm8995.c b/trunk/sound/soc/codecs/wm8995.c index c8aada597d70..5863406b459d 100644 --- a/trunk/sound/soc/codecs/wm8995.c +++ b/trunk/sound/soc/codecs/wm8995.c @@ -2051,7 +2051,6 @@ static int wm8995_probe(struct snd_soc_codec *codec) wm8995 = snd_soc_codec_get_drvdata(codec); wm8995->codec = codec; - codec->control_data = wm8995->regmap; ret = snd_soc_codec_set_cache_io(codec, 16, 16, SND_SOC_REGMAP); if (ret < 0) { dev_err(codec->dev, "Failed to set cache i/o: %d\n", ret); diff --git a/trunk/sound/soc/codecs/wm8996.c b/trunk/sound/soc/codecs/wm8996.c index da7acaefa9d9..8f88f5a9c985 100644 --- a/trunk/sound/soc/codecs/wm8996.c +++ b/trunk/sound/soc/codecs/wm8996.c @@ -2572,10 +2572,8 @@ static void wm8996_micd(struct snd_soc_codec *codec) SND_JACK_BTN_0); snd_soc_update_bits(codec, WM8996_MIC_DETECT_1, - WM8996_MICD_RATE_MASK | - WM8996_MICD_BIAS_STARTTIME_MASK, - WM8996_MICD_RATE_MASK | - 9 << WM8996_MICD_BIAS_STARTTIME_SHIFT); + WM8996_MICD_RATE_MASK, + WM8996_MICD_RATE_MASK); return; } @@ -2592,10 +2590,8 @@ static void wm8996_micd(struct snd_soc_codec *codec) /* Increase poll rate to give better responsiveness * for buttons */ snd_soc_update_bits(codec, WM8996_MIC_DETECT_1, - WM8996_MICD_RATE_MASK | - WM8996_MICD_BIAS_STARTTIME_MASK, - 5 << WM8996_MICD_RATE_SHIFT | - 7 << WM8996_MICD_BIAS_STARTTIME_SHIFT); + WM8996_MICD_RATE_MASK, + 5 << WM8996_MICD_RATE_SHIFT); } else { dev_dbg(codec->dev, "Mic button up\n"); snd_soc_jack_report(wm8996->jack, 0, SND_JACK_BTN_0); @@ -2643,10 +2639,8 @@ static void wm8996_micd(struct snd_soc_codec *codec) * responsiveness. */ snd_soc_update_bits(codec, WM8996_MIC_DETECT_1, - WM8996_MICD_RATE_MASK | - WM8996_MICD_BIAS_STARTTIME_MASK, - 7 << WM8996_MICD_RATE_SHIFT | - 7 << WM8996_MICD_BIAS_STARTTIME_SHIFT); + WM8996_MICD_RATE_MASK, + 7 << WM8996_MICD_RATE_SHIFT); } } } diff --git a/trunk/sound/soc/codecs/wm9081.c b/trunk/sound/soc/codecs/wm9081.c index a6bab392700e..1f2672b1e03e 100644 --- a/trunk/sound/soc/codecs/wm9081.c +++ b/trunk/sound/soc/codecs/wm9081.c @@ -31,6 +31,7 @@ #include "wm9081.h" static struct reg_default wm9081_reg[] = { + { 0, 0x9081 }, /* R0 - Software Reset */ { 2, 0x00B9 }, /* R2 - Analogue Lineout */ { 3, 0x00B9 }, /* R3 - Analogue Speaker PGA */ { 4, 0x0001 }, /* R4 - VMID Control */ diff --git a/trunk/sound/soc/codecs/wm9090.c b/trunk/sound/soc/codecs/wm9090.c index 41ebe0dce772..d1d2c703eab2 100644 --- a/trunk/sound/soc/codecs/wm9090.c +++ b/trunk/sound/soc/codecs/wm9090.c @@ -513,7 +513,18 @@ static int wm9090_set_bias_level(struct snd_soc_codec *codec, case SND_SOC_BIAS_STANDBY: if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) { /* Restore the register cache */ - snd_soc_cache_sync(codec); + for (i = 1; i < codec->driver->reg_cache_size; i++) { + if (reg_cache[i] == wm9090_reg_defaults[i]) + continue; + if (wm9090_volatile(codec, i)) + continue; + + ret = snd_soc_write(codec, i, reg_cache[i]); + if (ret != 0) + dev_warn(codec->dev, + "Failed to restore register %d: %d\n", + i, ret); + } } /* We keep VMID off during standby since the combination of diff --git a/trunk/sound/soc/mid-x86/mfld_machine.c b/trunk/sound/soc/mid-x86/mfld_machine.c index 8ae057433968..e53f8e473a78 100644 --- a/trunk/sound/soc/mid-x86/mfld_machine.c +++ b/trunk/sound/soc/mid-x86/mfld_machine.c @@ -281,7 +281,7 @@ static int mfld_init(struct snd_soc_pcm_runtime *runtime) return ret_val; } -static struct snd_soc_dai_link mfld_msic_dailink[] = { +struct snd_soc_dai_link mfld_msic_dailink[] = { { .name = "Medfield Headset", .stream_name = "Headset", diff --git a/trunk/sound/soc/mid-x86/sst_platform.c b/trunk/sound/soc/mid-x86/sst_platform.c index 5b936d5029fe..11c39c548a06 100644 --- a/trunk/sound/soc/mid-x86/sst_platform.c +++ b/trunk/sound/soc/mid-x86/sst_platform.c @@ -267,6 +267,7 @@ static int sst_platform_open(struct snd_pcm_substream *substream) { struct snd_pcm_runtime *runtime = substream->runtime; struct sst_runtime_stream *stream; + int ret_val; pr_debug("sst_platform_open called\n"); @@ -443,7 +444,7 @@ static void sst_pcm_free(struct snd_pcm *pcm) snd_pcm_lib_preallocate_free_for_all(pcm); } -static int sst_pcm_new(struct snd_soc_pcm_runtime *rtd) +int sst_pcm_new(struct snd_soc_pcm_runtime *rtd) { struct snd_soc_dai *dai = rtd->cpu_dai; struct snd_pcm *pcm = rtd->pcm; @@ -463,7 +464,7 @@ static int sst_pcm_new(struct snd_soc_pcm_runtime *rtd) } return retval; } -static struct snd_soc_platform_driver sst_soc_platform_drv = { +struct snd_soc_platform_driver sst_soc_platform_drv = { .ops = &sst_platform_ops, .pcm_new = sst_pcm_new, .pcm_free = sst_pcm_free, diff --git a/trunk/sound/soc/samsung/idma.c b/trunk/sound/soc/samsung/idma.c index 2bcf75815624..baf97ebadd48 100644 --- a/trunk/sound/soc/samsung/idma.c +++ b/trunk/sound/soc/samsung/idma.c @@ -410,7 +410,7 @@ void idma_reg_addr_init(void __iomem *regs, dma_addr_t addr) idma.lp_tx_addr = addr; } -static struct snd_soc_platform_driver asoc_idma_platform = { +struct snd_soc_platform_driver asoc_idma_platform = { .ops = &idma_ops, .pcm_new = idma_new, .pcm_free = idma_free, diff --git a/trunk/sound/soc/samsung/pcm.c b/trunk/sound/soc/samsung/pcm.c index 3a29c268ea5d..beef63fca052 100644 --- a/trunk/sound/soc/samsung/pcm.c +++ b/trunk/sound/soc/samsung/pcm.c @@ -570,6 +570,12 @@ static __devinit int s3c_pcm_dev_probe(struct platform_device *pdev) } clk_enable(pcm->pclk); + ret = snd_soc_register_dai(&pdev->dev, &s3c_pcm_dai[pdev->id]); + if (ret != 0) { + dev_err(&pdev->dev, "failed to get pcm_clock\n"); + goto err5; + } + s3c_pcm_stereo_in[pdev->id].dma_addr = mem_res->start + S3C_PCM_RXFIFO; s3c_pcm_stereo_out[pdev->id].dma_addr = mem_res->start @@ -581,12 +587,6 @@ static __devinit int s3c_pcm_dev_probe(struct platform_device *pdev) pcm->dma_capture = &s3c_pcm_stereo_in[pdev->id]; pcm->dma_playback = &s3c_pcm_stereo_out[pdev->id]; - ret = snd_soc_register_dai(&pdev->dev, &s3c_pcm_dai[pdev->id]); - if (ret != 0) { - dev_err(&pdev->dev, "failed to get register DAI: %d\n", ret); - goto err5; - } - return 0; err5: diff --git a/trunk/sound/soc/sh/fsi.c b/trunk/sound/soc/sh/fsi.c index db6c89a28bda..a27c30636b82 100644 --- a/trunk/sound/soc/sh/fsi.c +++ b/trunk/sound/soc/sh/fsi.c @@ -893,6 +893,8 @@ static int fsi_hw_startup(struct fsi_priv *fsi, u32 flags = fsi_get_info_flags(fsi); u32 data = 0; + pm_runtime_get_sync(dev); + /* clock setting */ if (fsi_is_clk_master(fsi)) data = DIMD | DOMD; @@ -949,6 +951,8 @@ static void fsi_hw_shutdown(struct fsi_priv *fsi, { if (fsi_is_clk_master(fsi)) fsi_set_master_clk(dev, fsi, fsi->rate, 0); + + pm_runtime_put_sync(dev); } static int fsi_dai_startup(struct snd_pcm_substream *substream, diff --git a/trunk/sound/soc/sh/sh7760-ac97.c b/trunk/sound/soc/sh/sh7760-ac97.c index df651e8e38de..c62ae689c4a1 100644 --- a/trunk/sound/soc/sh/sh7760-ac97.c +++ b/trunk/sound/soc/sh/sh7760-ac97.c @@ -16,6 +16,10 @@ #define IPSEL 0xFE400034 +/* platform specific structs can be declared here */ +extern struct snd_soc_dai_driver sh4_hac_dai[2]; +extern struct snd_soc_platform_driver sh7760_soc_platform; + static struct snd_soc_dai_link sh7760_ac97_dai = { .name = "AC97", .stream_name = "AC97 HiFi", diff --git a/trunk/sound/soc/sh/siu_dai.c b/trunk/sound/soc/sh/siu_dai.c index 52d4c17b1232..11c608570820 100644 --- a/trunk/sound/soc/sh/siu_dai.c +++ b/trunk/sound/soc/sh/siu_dai.c @@ -112,6 +112,9 @@ static void siu_dai_start(struct siu_port *port_info) dev_dbg(port_info->pcm->card->dev, "%s\n", __func__); + /* Turn on SIU clock */ + pm_runtime_get_sync(info->dev); + /* Issue software reset to siu */ siu_write32(base + SIU_SRCTL, 0); @@ -155,6 +158,9 @@ static void siu_dai_stop(struct siu_port *port_info) /* SIU software reset */ siu_write32(base + SIU_SRCTL, 0); + + /* Turn off SIU clock */ + pm_runtime_put_sync(info->dev); } static void siu_dai_spbAselect(struct siu_port *port_info)