Merge branch 'asoc-4.18' into asoc-4.19 wmadsp dep
authorMark Brown <broonie@kernel.org>
Wed, 8 Aug 2018 16:32:10 +0000 (17:32 +0100)
committerMark Brown <broonie@kernel.org>
Wed, 8 Aug 2018 16:32:10 +0000 (17:32 +0100)
sound/soc/codecs/hdmi-codec.c
sound/soc/codecs/max98373.c
sound/soc/codecs/rt5514.c
sound/soc/codecs/wm8988.c
sound/soc/codecs/wm_adsp.c
sound/soc/qcom/qdsp6/q6afe-dai.c
sound/soc/qcom/qdsp6/q6asm-dai.c
sound/soc/qcom/qdsp6/q6routing.c
sound/soc/soc-pcm.c
sound/soc/soc-utils.c
sound/soc/tegra/tegra30_i2s.h

index 38e4a8515709743c75befa77addca1b491c7979b..d00734d31e0429bf3df8c12b0bcc118ccefb3ec2 100644 (file)
@@ -291,10 +291,6 @@ static const struct snd_soc_dapm_widget hdmi_widgets[] = {
        SND_SOC_DAPM_OUTPUT("TX"),
 };
 
-static const struct snd_soc_dapm_route hdmi_routes[] = {
-       { "TX", NULL, "Playback" },
-};
-
 enum {
        DAI_ID_I2S = 0,
        DAI_ID_SPDIF,
@@ -689,9 +685,23 @@ static int hdmi_codec_pcm_new(struct snd_soc_pcm_runtime *rtd,
        return snd_ctl_add(rtd->card->snd_card, kctl);
 }
 
+static int hdmi_dai_probe(struct snd_soc_dai *dai)
+{
+       struct snd_soc_dapm_context *dapm;
+       struct snd_soc_dapm_route route = {
+               .sink = "TX",
+               .source = dai->driver->playback.stream_name,
+       };
+
+       dapm = snd_soc_component_get_dapm(dai->component);
+
+       return snd_soc_dapm_add_routes(dapm, &route, 1);
+}
+
 static const struct snd_soc_dai_driver hdmi_i2s_dai = {
        .name = "i2s-hifi",
        .id = DAI_ID_I2S,
+       .probe = hdmi_dai_probe,
        .playback = {
                .stream_name = "I2S Playback",
                .channels_min = 2,
@@ -707,6 +717,7 @@ static const struct snd_soc_dai_driver hdmi_i2s_dai = {
 static const struct snd_soc_dai_driver hdmi_spdif_dai = {
        .name = "spdif-hifi",
        .id = DAI_ID_SPDIF,
+       .probe = hdmi_dai_probe,
        .playback = {
                .stream_name = "SPDIF Playback",
                .channels_min = 2,
@@ -733,8 +744,6 @@ static int hdmi_of_xlate_dai_id(struct snd_soc_component *component,
 static const struct snd_soc_component_driver hdmi_driver = {
        .dapm_widgets           = hdmi_widgets,
        .num_dapm_widgets       = ARRAY_SIZE(hdmi_widgets),
-       .dapm_routes            = hdmi_routes,
-       .num_dapm_routes        = ARRAY_SIZE(hdmi_routes),
        .of_xlate_dai_id        = hdmi_of_xlate_dai_id,
        .idle_bias_on           = 1,
        .use_pmdown_time        = 1,
index a92586106932f848a8aaeaa465f794287742b449..92b7125ea16911b2de4dda0182cacef93d7cd4e2 100644 (file)
@@ -488,6 +488,7 @@ static const DECLARE_TLV_DB_RANGE(max98373_bde_gain_tlv,
 static bool max98373_readable_register(struct device *dev, unsigned int reg)
 {
        switch (reg) {
+       case MAX98373_R2000_SW_RESET:
        case MAX98373_R2001_INT_RAW1 ... MAX98373_R200C_INT_EN3:
        case MAX98373_R2010_IRQ_CTRL:
        case MAX98373_R2014_THERM_WARN_THRESH
index 1570b91bf018f9421c91a4c66631d819a800876c..dca82dd6e3bfeb7cb23d3e3a478983e3c4b36b2e 100644 (file)
@@ -64,8 +64,8 @@ static const struct reg_sequence rt5514_patch[] = {
        {RT5514_ANA_CTRL_LDO10,         0x00028604},
        {RT5514_ANA_CTRL_ADCFED,        0x00000800},
        {RT5514_ASRC_IN_CTRL1,          0x00000003},
-       {RT5514_DOWNFILTER0_CTRL3,      0x10000362},
-       {RT5514_DOWNFILTER1_CTRL3,      0x10000362},
+       {RT5514_DOWNFILTER0_CTRL3,      0x10000352},
+       {RT5514_DOWNFILTER1_CTRL3,      0x10000352},
 };
 
 static const struct reg_default rt5514_reg[] = {
@@ -92,10 +92,10 @@ static const struct reg_default rt5514_reg[] = {
        {RT5514_ASRC_IN_CTRL1,          0x00000003},
        {RT5514_DOWNFILTER0_CTRL1,      0x00020c2f},
        {RT5514_DOWNFILTER0_CTRL2,      0x00020c2f},
-       {RT5514_DOWNFILTER0_CTRL3,      0x10000362},
+       {RT5514_DOWNFILTER0_CTRL3,      0x10000352},
        {RT5514_DOWNFILTER1_CTRL1,      0x00020c2f},
        {RT5514_DOWNFILTER1_CTRL2,      0x00020c2f},
-       {RT5514_DOWNFILTER1_CTRL3,      0x10000362},
+       {RT5514_DOWNFILTER1_CTRL3,      0x10000352},
        {RT5514_ANA_CTRL_LDO10,         0x00028604},
        {RT5514_ANA_CTRL_LDO18_16,      0x02000345},
        {RT5514_ANA_CTRL_ADC12,         0x0000a2a8},
index 62200117444bea2ad1d192663a8fb6941250502c..6e52c6a8bab3d0b654d59b089b84b878ae56cf69 100644 (file)
@@ -522,7 +522,7 @@ static inline int get_coeff(int mclk, int rate)
 /* The set of rates we can generate from the above for each SYSCLK */
 
 static const unsigned int rates_12288[] = {
-       8000, 12000, 16000, 24000, 24000, 32000, 48000, 96000,
+       8000, 12000, 16000, 24000, 32000, 48000, 96000,
 };
 
 static const struct snd_pcm_hw_constraint_list constraints_12288 = {
@@ -540,7 +540,7 @@ static const struct snd_pcm_hw_constraint_list constraints_112896 = {
 };
 
 static const unsigned int rates_12[] = {
-       8000, 11025, 12000, 16000, 22050, 2400, 32000, 41100, 48000,
+       8000, 11025, 12000, 16000, 22050, 24000, 32000, 41100, 48000,
        48000, 88235, 96000,
 };
 
index fbd0515c49d79011762de1d2dd836d6d73d02d12..1c12c78dbcce841962d57cfa0ea6bc46970cc413 100644 (file)
@@ -2650,7 +2650,10 @@ int wm_adsp2_preloader_get(struct snd_kcontrol *kcontrol,
                           struct snd_ctl_elem_value *ucontrol)
 {
        struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
-       struct wm_adsp *dsp = snd_soc_component_get_drvdata(component);
+       struct wm_adsp *dsps = snd_soc_component_get_drvdata(component);
+       struct soc_mixer_control *mc =
+               (struct soc_mixer_control *)kcontrol->private_value;
+       struct wm_adsp *dsp = &dsps[mc->shift - 1];
 
        ucontrol->value.integer.value[0] = dsp->preloaded;
 
@@ -2662,10 +2665,11 @@ int wm_adsp2_preloader_put(struct snd_kcontrol *kcontrol,
                           struct snd_ctl_elem_value *ucontrol)
 {
        struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
-       struct wm_adsp *dsp = snd_soc_component_get_drvdata(component);
+       struct wm_adsp *dsps = snd_soc_component_get_drvdata(component);
        struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component);
        struct soc_mixer_control *mc =
                (struct soc_mixer_control *)kcontrol->private_value;
+       struct wm_adsp *dsp = &dsps[mc->shift - 1];
        char preload[32];
 
        snprintf(preload, ARRAY_SIZE(preload), "DSP%u Preload", mc->shift);
@@ -2679,6 +2683,8 @@ int wm_adsp2_preloader_put(struct snd_kcontrol *kcontrol,
 
        snd_soc_dapm_sync(dapm);
 
+       flush_work(&dsp->boot_work);
+
        return 0;
 }
 EXPORT_SYMBOL_GPL(wm_adsp2_preloader_put);
index 139d24be3fb99bedf9d062476045ad8c6be5e817..60ff4a2d35774eebdaced12f36a275ce2738f5f2 100644 (file)
@@ -313,6 +313,9 @@ static void q6afe_dai_shutdown(struct snd_pcm_substream *substream,
        struct q6afe_dai_data *dai_data = dev_get_drvdata(dai->dev);
        int rc;
 
+       if (!dai_data->is_port_started[dai->id])
+               return;
+
        rc = q6afe_port_stop(dai_data->port[dai->id]);
        if (rc < 0)
                dev_err(dai->dev, "fail to close AFE port (%d)\n", rc);
@@ -1332,7 +1335,7 @@ static void of_q6afe_parse_dai_data(struct device *dev,
                int id, i, num_lines;
 
                ret = of_property_read_u32(node, "reg", &id);
-               if (ret || id > AFE_PORT_MAX) {
+               if (ret || id < 0 || id >= AFE_PORT_MAX) {
                        dev_err(dev, "valid dai id not found:%d\n", ret);
                        continue;
                }
index acf96c6549fc4f2e661eaadcdf8e6282e1dd6a8f..9db9a2944ef26d23bb1bd95b33a1af6ac2a1517c 100644 (file)
@@ -389,7 +389,9 @@ static int q6asm_dai_close(struct snd_pcm_substream *substream)
        struct q6asm_dai_rtd *prtd = runtime->private_data;
 
        if (prtd->audio_client) {
-               q6asm_cmd(prtd->audio_client, CMD_CLOSE);
+               if (prtd->state)
+                       q6asm_cmd(prtd->audio_client, CMD_CLOSE);
+
                q6asm_unmap_memory_regions(substream->stream,
                                           prtd->audio_client);
                q6asm_audio_client_free(prtd->audio_client);
index 1d33b00e5b44e5d1e30019e7364be02066d492b2..dc94c5c53788b044b183f2406df7a5d9234cc5fc 100644 (file)
@@ -926,7 +926,7 @@ static int routing_hw_params(struct snd_pcm_substream *substream,
        else
                path_type = ADM_PATH_LIVE_REC;
 
-       if (be_id > AFE_MAX_PORTS)
+       if (be_id >= AFE_MAX_PORTS)
                return -EINVAL;
 
        session = &data->port_data[be_id];
index 9833e53754cb2120caf63f147ba661532000fb19..e8b98bfd4cf13bcb56d118a4c87a6e08ce5139e2 100644 (file)
@@ -1712,6 +1712,14 @@ static void dpcm_runtime_merge_format(struct snd_pcm_substream *substream,
                int i;
 
                for (i = 0; i < be->num_codecs; i++) {
+                       /*
+                        * Skip CODECs which don't support the current stream
+                        * type. See soc_pcm_init_runtime_hw() for more details
+                        */
+                       if (!snd_soc_dai_stream_valid(be->codec_dais[i],
+                                                     stream))
+                               continue;
+
                        codec_dai_drv = be->codec_dais[i]->driver;
                        if (stream == SNDRV_PCM_STREAM_PLAYBACK)
                                codec_stream = &codec_dai_drv->playback;
index ea024236c6433b9bcfc86449fb41126fbf0a17e6..e0c93496c0cda699cef17f07386ae479b758fc03 100644 (file)
@@ -375,6 +375,6 @@ int __init snd_soc_util_init(void)
 
 void __exit snd_soc_util_exit(void)
 {
-       platform_device_unregister(soc_dummy_dev);
        platform_driver_unregister(&soc_dummy_driver);
+       platform_device_unregister(soc_dummy_dev);
 }
index 774fc6ad202697efaa7d3417d1fc48612934b59f..2e561e946de25456978b813998d528a14dcc0a5b 100644 (file)
 /* Number of slots in frame, minus 1 */
 #define TEGRA30_I2S_SLOT_CTRL_TOTAL_SLOTS_SHIFT                16
 #define TEGRA30_I2S_SLOT_CTRL_TOTAL_SLOTS_MASK_US      7
-#define TEGRA30_I2S_SLOT_CTRL_TOTAL_SLOTS_MASK         (TEGRA30_I2S_SLOT_CTRL_TOTAL_SLOT_MASK_US << TEGRA30_I2S_SLOT_CTRL_TOTAL_SLOT_SHIFT)
+#define TEGRA30_I2S_SLOT_CTRL_TOTAL_SLOTS_MASK         (TEGRA30_I2S_SLOT_CTRL_TOTAL_SLOTS_MASK_US << TEGRA30_I2S_SLOT_CTRL_TOTAL_SLOTS_SHIFT)
 
 /* TDM mode slot enable bitmask */
 #define TEGRA30_I2S_SLOT_CTRL_RX_SLOT_ENABLES_SHIFT    8