summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Brown <broonie@kernel.org>2018-04-16 07:58:21 -0400
committerMark Brown <broonie@kernel.org>2018-04-16 07:58:21 -0400
commit953de782cccf7a84e8a20cea72aea2a056fea3bf (patch)
treedfe61f7d4b7addd15ac6ce7978a4bb632f5bf626
parent3fd391fb7c97ab6dfb9e44926a265566d1d1ab79 (diff)
parentd0f8b9c5a350ca6fa842b52bfb88b77b34ee485b (diff)
Merge branch 'asoc-4.17' into asoc-4.18 to get adau17x1 changes so
further patches can be applied.
-rw-r--r--sound/soc/codecs/adau17x1.c26
-rw-r--r--sound/soc/codecs/adau17x1.h3
-rw-r--r--sound/soc/fsl/fsl_esai.c7
-rw-r--r--sound/soc/fsl/fsl_ssi.c14
-rw-r--r--sound/soc/intel/Kconfig22
-rw-r--r--sound/soc/omap/omap-dmic.c14
-rw-r--r--sound/soc/sh/rcar/core.c4
-rw-r--r--sound/soc/soc-topology.c8
8 files changed, 72 insertions, 26 deletions
diff --git a/sound/soc/codecs/adau17x1.c b/sound/soc/codecs/adau17x1.c
index 80c2a06285bb..12bf24c26818 100644
--- a/sound/soc/codecs/adau17x1.c
+++ b/sound/soc/codecs/adau17x1.c
@@ -502,7 +502,7 @@ static int adau17x1_hw_params(struct snd_pcm_substream *substream,
502 } 502 }
503 503
504 if (adau->sigmadsp) { 504 if (adau->sigmadsp) {
505 ret = adau17x1_setup_firmware(adau, params_rate(params)); 505 ret = adau17x1_setup_firmware(component, params_rate(params));
506 if (ret < 0) 506 if (ret < 0)
507 return ret; 507 return ret;
508 } 508 }
@@ -835,26 +835,40 @@ bool adau17x1_volatile_register(struct device *dev, unsigned int reg)
835} 835}
836EXPORT_SYMBOL_GPL(adau17x1_volatile_register); 836EXPORT_SYMBOL_GPL(adau17x1_volatile_register);
837 837
838int adau17x1_setup_firmware(struct adau *adau, unsigned int rate) 838int adau17x1_setup_firmware(struct snd_soc_component *component,
839 unsigned int rate)
839{ 840{
840 int ret; 841 int ret;
841 int dspsr; 842 int dspsr, dsp_run;
843 struct adau *adau = snd_soc_component_get_drvdata(component);
844 struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component);
845
846 snd_soc_dapm_mutex_lock(dapm);
842 847
843 ret = regmap_read(adau->regmap, ADAU17X1_DSP_SAMPLING_RATE, &dspsr); 848 ret = regmap_read(adau->regmap, ADAU17X1_DSP_SAMPLING_RATE, &dspsr);
844 if (ret) 849 if (ret)
845 return ret; 850 goto err;
851
852 ret = regmap_read(adau->regmap, ADAU17X1_DSP_RUN, &dsp_run);
853 if (ret)
854 goto err;
846 855
847 regmap_write(adau->regmap, ADAU17X1_DSP_ENABLE, 1); 856 regmap_write(adau->regmap, ADAU17X1_DSP_ENABLE, 1);
848 regmap_write(adau->regmap, ADAU17X1_DSP_SAMPLING_RATE, 0xf); 857 regmap_write(adau->regmap, ADAU17X1_DSP_SAMPLING_RATE, 0xf);
858 regmap_write(adau->regmap, ADAU17X1_DSP_RUN, 0);
849 859
850 ret = sigmadsp_setup(adau->sigmadsp, rate); 860 ret = sigmadsp_setup(adau->sigmadsp, rate);
851 if (ret) { 861 if (ret) {
852 regmap_write(adau->regmap, ADAU17X1_DSP_ENABLE, 0); 862 regmap_write(adau->regmap, ADAU17X1_DSP_ENABLE, 0);
853 return ret; 863 goto err;
854 } 864 }
855 regmap_write(adau->regmap, ADAU17X1_DSP_SAMPLING_RATE, dspsr); 865 regmap_write(adau->regmap, ADAU17X1_DSP_SAMPLING_RATE, dspsr);
866 regmap_write(adau->regmap, ADAU17X1_DSP_RUN, dsp_run);
856 867
857 return 0; 868err:
869 snd_soc_dapm_mutex_unlock(dapm);
870
871 return ret;
858} 872}
859EXPORT_SYMBOL_GPL(adau17x1_setup_firmware); 873EXPORT_SYMBOL_GPL(adau17x1_setup_firmware);
860 874
diff --git a/sound/soc/codecs/adau17x1.h b/sound/soc/codecs/adau17x1.h
index a7b1cb770814..e6fe87beec07 100644
--- a/sound/soc/codecs/adau17x1.h
+++ b/sound/soc/codecs/adau17x1.h
@@ -68,7 +68,8 @@ int adau17x1_resume(struct snd_soc_component *component);
68 68
69extern const struct snd_soc_dai_ops adau17x1_dai_ops; 69extern const struct snd_soc_dai_ops adau17x1_dai_ops;
70 70
71int adau17x1_setup_firmware(struct adau *adau, unsigned int rate); 71int adau17x1_setup_firmware(struct snd_soc_component *component,
72 unsigned int rate);
72bool adau17x1_has_dsp(struct adau *adau); 73bool adau17x1_has_dsp(struct adau *adau);
73 74
74#define ADAU17X1_CLOCK_CONTROL 0x4000 75#define ADAU17X1_CLOCK_CONTROL 0x4000
diff --git a/sound/soc/fsl/fsl_esai.c b/sound/soc/fsl/fsl_esai.c
index 40a700493f4c..da8fd98c7f51 100644
--- a/sound/soc/fsl/fsl_esai.c
+++ b/sound/soc/fsl/fsl_esai.c
@@ -144,6 +144,13 @@ static int fsl_esai_divisor_cal(struct snd_soc_dai *dai, bool tx, u32 ratio,
144 144
145 psr = ratio <= 256 * maxfp ? ESAI_xCCR_xPSR_BYPASS : ESAI_xCCR_xPSR_DIV8; 145 psr = ratio <= 256 * maxfp ? ESAI_xCCR_xPSR_BYPASS : ESAI_xCCR_xPSR_DIV8;
146 146
147 /* Do not loop-search if PM (1 ~ 256) alone can serve the ratio */
148 if (ratio <= 256) {
149 pm = ratio;
150 fp = 1;
151 goto out;
152 }
153
147 /* Set the max fluctuation -- 0.1% of the max devisor */ 154 /* Set the max fluctuation -- 0.1% of the max devisor */
148 savesub = (psr ? 1 : 8) * 256 * maxfp / 1000; 155 savesub = (psr ? 1 : 8) * 256 * maxfp / 1000;
149 156
diff --git a/sound/soc/fsl/fsl_ssi.c b/sound/soc/fsl/fsl_ssi.c
index 0823b08923b5..89df2d9f63d7 100644
--- a/sound/soc/fsl/fsl_ssi.c
+++ b/sound/soc/fsl/fsl_ssi.c
@@ -217,6 +217,7 @@ struct fsl_ssi_soc_data {
217 * @dai_fmt: DAI configuration this device is currently used with 217 * @dai_fmt: DAI configuration this device is currently used with
218 * @streams: Mask of current active streams: BIT(TX) and BIT(RX) 218 * @streams: Mask of current active streams: BIT(TX) and BIT(RX)
219 * @i2s_net: I2S and Network mode configurations of SCR register 219 * @i2s_net: I2S and Network mode configurations of SCR register
220 * (this is the initial settings based on the DAI format)
220 * @synchronous: Use synchronous mode - both of TX and RX use STCK and SFCK 221 * @synchronous: Use synchronous mode - both of TX and RX use STCK and SFCK
221 * @use_dma: DMA is used or FIQ with stream filter 222 * @use_dma: DMA is used or FIQ with stream filter
222 * @use_dual_fifo: DMA with support for dual FIFO mode 223 * @use_dual_fifo: DMA with support for dual FIFO mode
@@ -829,16 +830,23 @@ static int fsl_ssi_hw_params(struct snd_pcm_substream *substream,
829 } 830 }
830 831
831 if (!fsl_ssi_is_ac97(ssi)) { 832 if (!fsl_ssi_is_ac97(ssi)) {
833 /*
834 * Keep the ssi->i2s_net intact while having a local variable
835 * to override settings for special use cases. Otherwise, the
836 * ssi->i2s_net will lose the settings for regular use cases.
837 */
838 u8 i2s_net = ssi->i2s_net;
839
832 /* Normal + Network mode to send 16-bit data in 32-bit frames */ 840 /* Normal + Network mode to send 16-bit data in 32-bit frames */
833 if (fsl_ssi_is_i2s_cbm_cfs(ssi) && sample_size == 16) 841 if (fsl_ssi_is_i2s_cbm_cfs(ssi) && sample_size == 16)
834 ssi->i2s_net = SSI_SCR_I2S_MODE_NORMAL | SSI_SCR_NET; 842 i2s_net = SSI_SCR_I2S_MODE_NORMAL | SSI_SCR_NET;
835 843
836 /* Use Normal mode to send mono data at 1st slot of 2 slots */ 844 /* Use Normal mode to send mono data at 1st slot of 2 slots */
837 if (channels == 1) 845 if (channels == 1)
838 ssi->i2s_net = SSI_SCR_I2S_MODE_NORMAL; 846 i2s_net = SSI_SCR_I2S_MODE_NORMAL;
839 847
840 regmap_update_bits(regs, REG_SSI_SCR, 848 regmap_update_bits(regs, REG_SSI_SCR,
841 SSI_SCR_I2S_NET_MASK, ssi->i2s_net); 849 SSI_SCR_I2S_NET_MASK, i2s_net);
842 } 850 }
843 851
844 /* In synchronous mode, the SSI uses STCCR for capture */ 852 /* In synchronous mode, the SSI uses STCCR for capture */
diff --git a/sound/soc/intel/Kconfig b/sound/soc/intel/Kconfig
index ceb105cbd461..addac2a8e52a 100644
--- a/sound/soc/intel/Kconfig
+++ b/sound/soc/intel/Kconfig
@@ -72,24 +72,28 @@ config SND_SOC_INTEL_BAYTRAIL
72 for Baytrail Chromebooks but this option is now deprecated and is 72 for Baytrail Chromebooks but this option is now deprecated and is
73 not recommended, use SND_SST_ATOM_HIFI2_PLATFORM instead. 73 not recommended, use SND_SST_ATOM_HIFI2_PLATFORM instead.
74 74
75config SND_SST_ATOM_HIFI2_PLATFORM
76 tristate
77 select SND_SOC_COMPRESS
78
75config SND_SST_ATOM_HIFI2_PLATFORM_PCI 79config SND_SST_ATOM_HIFI2_PLATFORM_PCI
76 tristate "PCI HiFi2 (Medfield, Merrifield) Platforms" 80 tristate "PCI HiFi2 (Merrifield) Platforms"
77 depends on X86 && PCI 81 depends on X86 && PCI
78 select SND_SST_IPC_PCI 82 select SND_SST_IPC_PCI
79 select SND_SOC_COMPRESS 83 select SND_SST_ATOM_HIFI2_PLATFORM
80 help 84 help
81 If you have a Intel Medfield or Merrifield/Edison platform, then 85 If you have a Intel Merrifield/Edison platform, then
82 enable this option by saying Y or m. Distros will typically not 86 enable this option by saying Y or m. Distros will typically not
83 enable this option: Medfield devices are not available to 87 enable this option: while Merrifield/Edison can run a mainline
84 developers and while Merrifield/Edison can run a mainline kernel with 88 kernel with limited functionality it will require a firmware file
85 limited functionality it will require a firmware file which 89 which is not in the standard firmware tree
86 is not in the standard firmware tree
87 90
88config SND_SST_ATOM_HIFI2_PLATFORM 91config SND_SST_ATOM_HIFI2_PLATFORM_ACPI
89 tristate "ACPI HiFi2 (Baytrail, Cherrytrail) Platforms" 92 tristate "ACPI HiFi2 (Baytrail, Cherrytrail) Platforms"
93 default ACPI
90 depends on X86 && ACPI 94 depends on X86 && ACPI
91 select SND_SST_IPC_ACPI 95 select SND_SST_IPC_ACPI
92 select SND_SOC_COMPRESS 96 select SND_SST_ATOM_HIFI2_PLATFORM
93 select SND_SOC_ACPI_INTEL_MATCH 97 select SND_SOC_ACPI_INTEL_MATCH
94 select IOSF_MBI 98 select IOSF_MBI
95 help 99 help
diff --git a/sound/soc/omap/omap-dmic.c b/sound/soc/omap/omap-dmic.c
index 09db2aec12a3..b2f5d2fa354d 100644
--- a/sound/soc/omap/omap-dmic.c
+++ b/sound/soc/omap/omap-dmic.c
@@ -281,7 +281,7 @@ static int omap_dmic_dai_trigger(struct snd_pcm_substream *substream,
281static int omap_dmic_select_fclk(struct omap_dmic *dmic, int clk_id, 281static int omap_dmic_select_fclk(struct omap_dmic *dmic, int clk_id,
282 unsigned int freq) 282 unsigned int freq)
283{ 283{
284 struct clk *parent_clk; 284 struct clk *parent_clk, *mux;
285 char *parent_clk_name; 285 char *parent_clk_name;
286 int ret = 0; 286 int ret = 0;
287 287
@@ -329,14 +329,21 @@ static int omap_dmic_select_fclk(struct omap_dmic *dmic, int clk_id,
329 return -ENODEV; 329 return -ENODEV;
330 } 330 }
331 331
332 mux = clk_get_parent(dmic->fclk);
333 if (IS_ERR(mux)) {
334 dev_err(dmic->dev, "can't get fck mux parent\n");
335 clk_put(parent_clk);
336 return -ENODEV;
337 }
338
332 mutex_lock(&dmic->mutex); 339 mutex_lock(&dmic->mutex);
333 if (dmic->active) { 340 if (dmic->active) {
334 /* disable clock while reparenting */ 341 /* disable clock while reparenting */
335 pm_runtime_put_sync(dmic->dev); 342 pm_runtime_put_sync(dmic->dev);
336 ret = clk_set_parent(dmic->fclk, parent_clk); 343 ret = clk_set_parent(mux, parent_clk);
337 pm_runtime_get_sync(dmic->dev); 344 pm_runtime_get_sync(dmic->dev);
338 } else { 345 } else {
339 ret = clk_set_parent(dmic->fclk, parent_clk); 346 ret = clk_set_parent(mux, parent_clk);
340 } 347 }
341 mutex_unlock(&dmic->mutex); 348 mutex_unlock(&dmic->mutex);
342 349
@@ -349,6 +356,7 @@ static int omap_dmic_select_fclk(struct omap_dmic *dmic, int clk_id,
349 dmic->fclk_freq = freq; 356 dmic->fclk_freq = freq;
350 357
351err_busy: 358err_busy:
359 clk_put(mux);
352 clk_put(parent_clk); 360 clk_put(parent_clk);
353 361
354 return ret; 362 return ret;
diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c
index f9ac086d8e05..af04d41a4274 100644
--- a/sound/soc/sh/rcar/core.c
+++ b/sound/soc/sh/rcar/core.c
@@ -1573,7 +1573,7 @@ static int rsnd_remove(struct platform_device *pdev)
1573 return ret; 1573 return ret;
1574} 1574}
1575 1575
1576static int rsnd_suspend(struct device *dev) 1576static int __maybe_unused rsnd_suspend(struct device *dev)
1577{ 1577{
1578 struct rsnd_priv *priv = dev_get_drvdata(dev); 1578 struct rsnd_priv *priv = dev_get_drvdata(dev);
1579 1579
@@ -1582,7 +1582,7 @@ static int rsnd_suspend(struct device *dev)
1582 return 0; 1582 return 0;
1583} 1583}
1584 1584
1585static int rsnd_resume(struct device *dev) 1585static int __maybe_unused rsnd_resume(struct device *dev)
1586{ 1586{
1587 struct rsnd_priv *priv = dev_get_drvdata(dev); 1587 struct rsnd_priv *priv = dev_get_drvdata(dev);
1588 1588
diff --git a/sound/soc/soc-topology.c b/sound/soc/soc-topology.c
index fa27d0fca6dc..942c6e5eb4b7 100644
--- a/sound/soc/soc-topology.c
+++ b/sound/soc/soc-topology.c
@@ -1325,8 +1325,10 @@ static struct snd_kcontrol_new *soc_tplg_dapm_widget_denum_create(
1325 ec->hdr.name); 1325 ec->hdr.name);
1326 1326
1327 kc[i].name = kstrdup(ec->hdr.name, GFP_KERNEL); 1327 kc[i].name = kstrdup(ec->hdr.name, GFP_KERNEL);
1328 if (kc[i].name == NULL) 1328 if (kc[i].name == NULL) {
1329 kfree(se);
1329 goto err_se; 1330 goto err_se;
1331 }
1330 kc[i].private_value = (long)se; 1332 kc[i].private_value = (long)se;
1331 kc[i].iface = SNDRV_CTL_ELEM_IFACE_MIXER; 1333 kc[i].iface = SNDRV_CTL_ELEM_IFACE_MIXER;
1332 kc[i].access = ec->hdr.access; 1334 kc[i].access = ec->hdr.access;
@@ -1442,8 +1444,10 @@ static struct snd_kcontrol_new *soc_tplg_dapm_widget_dbytes_create(
1442 be->hdr.name, be->hdr.access); 1444 be->hdr.name, be->hdr.access);
1443 1445
1444 kc[i].name = kstrdup(be->hdr.name, GFP_KERNEL); 1446 kc[i].name = kstrdup(be->hdr.name, GFP_KERNEL);
1445 if (kc[i].name == NULL) 1447 if (kc[i].name == NULL) {
1448 kfree(sbe);
1446 goto err; 1449 goto err;
1450 }
1447 kc[i].private_value = (long)sbe; 1451 kc[i].private_value = (long)sbe;
1448 kc[i].iface = SNDRV_CTL_ELEM_IFACE_MIXER; 1452 kc[i].iface = SNDRV_CTL_ELEM_IFACE_MIXER;
1449 kc[i].access = be->hdr.access; 1453 kc[i].access = be->hdr.access;