Merge branch 'for-5.6' of https://git.kernel.org/pub/scm/linux/kernel/git/broonie...
authorMark Brown <broonie@kernel.org>
Fri, 13 Mar 2020 18:52:23 +0000 (18:52 +0000)
committerMark Brown <broonie@kernel.org>
Fri, 13 Mar 2020 18:52:23 +0000 (18:52 +0000)
19 files changed:
MAINTAINERS
include/sound/soc.h
sound/soc/codecs/max98357a.c
sound/soc/codecs/rt5682.c
sound/soc/codecs/wcd9335.c
sound/soc/codecs/wcd9335.h
sound/soc/codecs/wm_adsp.c
sound/soc/intel/boards/skl_nau88l25_ssm4567.c
sound/soc/intel/skylake/bxt-sst.c
sound/soc/intel/skylake/cnl-sst.c
sound/soc/intel/skylake/skl-nhlt.c
sound/soc/intel/skylake/skl-sst-dsp.h
sound/soc/intel/skylake/skl.c
sound/soc/jz4740/jz4740-i2s.c
sound/soc/qcom/qdsp6/q6asm-dai.c
sound/soc/qcom/qdsp6/q6routing.c
sound/soc/soc-core.c
sound/soc/soc-topology.c
sound/soc/sof/intel/hda-stream.c

index a6fbdf3..1b82ee2 100644 (file)
@@ -4021,8 +4021,8 @@ F:        Documentation/devicetree/bindings/sound/google,cros-ec-codec.yaml
 F:     sound/soc/codecs/cros_ec_codec.*
 
 CIRRUS LOGIC AUDIO CODEC DRIVERS
-M:     Brian Austin <brian.austin@cirrus.com>
-M:     Paul Handrigan <Paul.Handrigan@cirrus.com>
+M:     James Schulman <james.schulman@cirrus.com>
+M:     David Rhodes <david.rhodes@cirrus.com>
 L:     alsa-devel@alsa-project.org (moderated for non-subscribers)
 S:     Maintained
 F:     sound/soc/codecs/cs*
@@ -15615,6 +15615,17 @@ F:     sound/soc/
 F:     include/dt-bindings/sound/
 F:     include/sound/soc*
 
+SOUND - SOUND OPEN FIRMWARE (SOF) DRIVERS
+M:     Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
+M:     Liam Girdwood <lgirdwood@gmail.com>
+M:     Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
+M:     Kai Vehmanen <kai.vehmanen@linux.intel.com>
+M:     Daniel Baluta <daniel.baluta@nxp.com>
+L:     sound-open-firmware@alsa-project.org (moderated for non-subscribers)
+W:     https://github.com/thesofproject/linux/
+S:     Supported
+F:     sound/soc/sof/
+
 SOUNDWIRE SUBSYSTEM
 M:     Vinod Koul <vkoul@kernel.org>
 M:     Sanyog Kale <sanyog.r.kale@intel.com>
index 03054bf..d97c4aa 100644 (file)
@@ -1066,6 +1066,7 @@ struct snd_soc_card {
        const struct snd_soc_dapm_route *of_dapm_routes;
        int num_of_dapm_routes;
        bool fully_routed;
+       bool disable_route_checks;
 
        /* lists of probed devices belonging to this card */
        struct list_head component_dev_list;
index 74f2011..a8bd793 100644 (file)
@@ -133,6 +133,7 @@ MODULE_DEVICE_TABLE(of, max98357a_device_id);
 #ifdef CONFIG_ACPI
 static const struct acpi_device_id max98357a_acpi_match[] = {
        { "MX98357A", 0 },
+       { "MX98360A", 0 },
        {},
 };
 MODULE_DEVICE_TABLE(acpi, max98357a_acpi_match);
index f4b8af1..7ca02a5 100644 (file)
@@ -1166,7 +1166,7 @@ static void rt5682_jack_detect_handler(struct work_struct *work)
 static const struct snd_kcontrol_new rt5682_snd_controls[] = {
        /* DAC Digital Volume */
        SOC_DOUBLE_TLV("DAC1 Playback Volume", RT5682_DAC1_DIG_VOL,
-               RT5682_L_VOL_SFT + 1, RT5682_R_VOL_SFT + 1, 86, 0, dac_vol_tlv),
+               RT5682_L_VOL_SFT + 1, RT5682_R_VOL_SFT + 1, 87, 0, dac_vol_tlv),
 
        /* IN Boost Volume */
        SOC_SINGLE_TLV("CBJ Boost Volume", RT5682_CBJ_BST_CTRL,
index f11ffa2..700cc12 100644 (file)
@@ -4926,11 +4926,11 @@ static const struct regmap_range_cfg wcd9335_ranges[] = {
                .name = "WCD9335",
                .range_min =  0x0,
                .range_max =  WCD9335_MAX_REGISTER,
-               .selector_reg = WCD9335_REG(0x0, 0),
+               .selector_reg = WCD9335_SEL_REGISTER,
                .selector_mask = 0xff,
                .selector_shift = 0,
-               .window_start = 0x0,
-               .window_len = 0x1000,
+               .window_start = 0x800,
+               .window_len = 0x100,
        },
 };
 
@@ -4968,12 +4968,12 @@ static const struct regmap_range_cfg wcd9335_ifc_ranges[] = {
        {
                .name = "WCD9335-IFC-DEV",
                .range_min =  0x0,
-               .range_max = WCD9335_REG(0, 0x7ff),
-               .selector_reg = WCD9335_REG(0, 0x0),
-               .selector_mask = 0xff,
+               .range_max = WCD9335_MAX_REGISTER,
+               .selector_reg = WCD9335_SEL_REGISTER,
+               .selector_mask = 0xfff,
                .selector_shift = 0,
-               .window_start = 0x0,
-               .window_len = 0x1000,
+               .window_start = 0x800,
+               .window_len = 0x400,
        },
 };
 
@@ -4981,7 +4981,7 @@ static struct regmap_config wcd9335_ifc_regmap_config = {
        .reg_bits = 16,
        .val_bits = 8,
        .can_multi_write = true,
-       .max_register = WCD9335_REG(0, 0x7FF),
+       .max_register = WCD9335_MAX_REGISTER,
        .ranges = wcd9335_ifc_ranges,
        .num_ranges = ARRAY_SIZE(wcd9335_ifc_ranges),
 };
index 4d9be24..7206082 100644 (file)
@@ -8,9 +8,9 @@
  * in slimbus mode the reg base starts from 0x800
  * in i2s/i2c mode the reg base is 0x0
  */
-#define WCD9335_REG(pg, r)     ((pg << 12) | (r) | 0x800)
+#define WCD9335_REG(pg, r)     ((pg << 8) | (r))
 #define WCD9335_REG_OFFSET(r)  (r & 0xFF)
-#define WCD9335_PAGE_OFFSET(r) ((r >> 12) & 0xFF)
+#define WCD9335_PAGE_OFFSET(r) ((r >> 8) & 0xFF)
 
 /* Page-0 Registers */
 #define WCD9335_PAGE0_PAGE_REGISTER            WCD9335_REG(0x00, 0x000)
 #define WCD9335_CDC_CLK_RST_CTRL_FS_CNT_ENABLE BIT(0)
 #define WCD9335_CDC_CLK_RST_CTRL_FS_CNT_DISABLE        0
 #define WCD9335_CDC_TOP_TOP_CFG1       WCD9335_REG(0x0d, 0x082)
-#define WCD9335_MAX_REGISTER   WCD9335_REG(0x80, 0x0FF)
+#define WCD9335_MAX_REGISTER   0xffff
+#define WCD9335_SEL_REGISTER   0x800
 
 /* SLIMBUS Slave Registers */
 #define WCD9335_SLIM_PGD_PORT_INT_EN0  WCD9335_REG(0, 0x30)
index d3d32b5..ffb9836 100644 (file)
@@ -1436,12 +1436,12 @@ static int wm_adsp_create_control(struct wm_adsp *dsp,
                subname = NULL; /* don't append subname */
                break;
        case 2:
-               ret = snprintf(name, SNDRV_CTL_ELEM_ID_NAME_MAXLEN,
+               ret = scnprintf(name, SNDRV_CTL_ELEM_ID_NAME_MAXLEN,
                                "%s%c %.12s %x", dsp->name, *region_name,
                                wm_adsp_fw_text[dsp->fw], alg_region->alg);
                break;
        default:
-               ret = snprintf(name, SNDRV_CTL_ELEM_ID_NAME_MAXLEN,
+               ret = scnprintf(name, SNDRV_CTL_ELEM_ID_NAME_MAXLEN,
                                "%s %.12s %x", dsp->name,
                                wm_adsp_fw_text[dsp->fw], alg_region->alg);
                break;
index 6f68712..40f8eb5 100644 (file)
@@ -686,6 +686,7 @@ static struct snd_soc_card skylake_audio_card = {
        .codec_conf = ssm4567_codec_conf,
        .num_configs = ARRAY_SIZE(ssm4567_codec_conf),
        .fully_routed = true,
+       .disable_route_checks = true,
        .late_probe = skylake_card_late_probe,
 };
 
index 92a82e6..38b9d74 100644 (file)
@@ -17,7 +17,6 @@
 #include "skl.h"
 
 #define BXT_BASEFW_TIMEOUT     3000
-#define BXT_INIT_TIMEOUT       300
 #define BXT_ROM_INIT_TIMEOUT   70
 #define BXT_IPC_PURGE_FW       0x01004000
 
@@ -38,8 +37,6 @@
 /* Delay before scheduling D0i3 entry */
 #define BXT_D0I3_DELAY 5000
 
-#define BXT_FW_ROM_INIT_RETRY 3
-
 static unsigned int bxt_get_errorcode(struct sst_dsp *ctx)
 {
         return sst_dsp_shim_read(ctx, BXT_ADSP_ERROR_CODE);
index 4f64f09..c6abcd5 100644 (file)
@@ -57,18 +57,34 @@ static int cnl_prepare_fw(struct sst_dsp *ctx, const void *fwdata, u32 fwsize)
        ctx->dsp_ops.stream_tag = stream_tag;
        memcpy(ctx->dmab.area, fwdata, fwsize);
 
+       ret = skl_dsp_core_power_up(ctx, SKL_DSP_CORE0_MASK);
+       if (ret < 0) {
+               dev_err(ctx->dev, "dsp core0 power up failed\n");
+               ret = -EIO;
+               goto base_fw_load_failed;
+       }
+
        /* purge FW request */
        sst_dsp_shim_write(ctx, CNL_ADSP_REG_HIPCIDR,
                           CNL_ADSP_REG_HIPCIDR_BUSY | (CNL_IPC_PURGE |
                           ((stream_tag - 1) << CNL_ROM_CTRL_DMA_ID)));
 
-       ret = cnl_dsp_enable_core(ctx, SKL_DSP_CORE0_MASK);
+       ret = skl_dsp_start_core(ctx, SKL_DSP_CORE0_MASK);
        if (ret < 0) {
-               dev_err(ctx->dev, "dsp boot core failed ret: %d\n", ret);
+               dev_err(ctx->dev, "Start dsp core failed ret: %d\n", ret);
                ret = -EIO;
                goto base_fw_load_failed;
        }
 
+       ret = sst_dsp_register_poll(ctx, CNL_ADSP_REG_HIPCIDA,
+                                   CNL_ADSP_REG_HIPCIDA_DONE,
+                                   CNL_ADSP_REG_HIPCIDA_DONE,
+                                   BXT_INIT_TIMEOUT, "HIPCIDA Done");
+       if (ret < 0) {
+               dev_err(ctx->dev, "timeout for purge request: %d\n", ret);
+               goto base_fw_load_failed;
+       }
+
        /* enable interrupt */
        cnl_ipc_int_enable(ctx);
        cnl_ipc_op_int_enable(ctx);
@@ -109,7 +125,7 @@ static int cnl_load_base_firmware(struct sst_dsp *ctx)
 {
        struct firmware stripped_fw;
        struct skl_dev *cnl = ctx->thread_context;
-       int ret;
+       int ret, i;
 
        if (!ctx->fw) {
                ret = request_firmware(&ctx->fw, ctx->fw_name, ctx->dev);
@@ -131,12 +147,16 @@ static int cnl_load_base_firmware(struct sst_dsp *ctx)
        stripped_fw.size = ctx->fw->size;
        skl_dsp_strip_extended_manifest(&stripped_fw);
 
-       ret = cnl_prepare_fw(ctx, stripped_fw.data, stripped_fw.size);
-       if (ret < 0) {
-               dev_err(ctx->dev, "prepare firmware failed: %d\n", ret);
-               goto cnl_load_base_firmware_failed;
+       for (i = 0; i < BXT_FW_ROM_INIT_RETRY; i++) {
+               ret = cnl_prepare_fw(ctx, stripped_fw.data, stripped_fw.size);
+               if (!ret)
+                       break;
+               dev_dbg(ctx->dev, "prepare firmware failed: %d\n", ret);
        }
 
+       if (ret < 0)
+               goto cnl_load_base_firmware_failed;
+
        ret = sst_transfer_fw_host_dma(ctx);
        if (ret < 0) {
                dev_err(ctx->dev, "transfer firmware failed: %d\n", ret);
@@ -158,6 +178,7 @@ static int cnl_load_base_firmware(struct sst_dsp *ctx)
        return 0;
 
 cnl_load_base_firmware_failed:
+       dev_err(ctx->dev, "firmware load failed: %d\n", ret);
        release_firmware(ctx->fw);
        ctx->fw = NULL;
 
index 19f328d..d9c8f5c 100644 (file)
@@ -182,7 +182,8 @@ void skl_nhlt_remove_sysfs(struct skl_dev *skl)
 {
        struct device *dev = &skl->pci->dev;
 
-       sysfs_remove_file(&dev->kobj, &dev_attr_platform_id.attr);
+       if (skl->nhlt)
+               sysfs_remove_file(&dev->kobj, &dev_attr_platform_id.attr);
 }
 
 /*
index cdfec0f..1df9ef4 100644 (file)
@@ -67,6 +67,8 @@ struct skl_dev;
 
 #define SKL_FW_INIT                    0x1
 #define SKL_FW_RFW_START               0xf
+#define BXT_FW_ROM_INIT_RETRY          3
+#define BXT_INIT_TIMEOUT               300
 
 #define SKL_ADSPIC_IPC                 1
 #define SKL_ADSPIS_IPC                 1
index 1aa8114..63182bf 100644 (file)
@@ -130,6 +130,7 @@ static int skl_init_chip(struct hdac_bus *bus, bool full_reset)
        struct hdac_ext_link *hlink;
        int ret;
 
+       snd_hdac_set_codec_wakeup(bus, true);
        skl_enable_miscbdcge(bus->dev, false);
        ret = snd_hdac_bus_init_chip(bus, full_reset);
 
@@ -138,6 +139,7 @@ static int skl_init_chip(struct hdac_bus *bus, bool full_reset)
                writel(0, hlink->ml_addr + AZX_REG_ML_LOSIDV);
 
        skl_enable_miscbdcge(bus->dev, true);
+       snd_hdac_set_codec_wakeup(bus, false);
 
        return ret;
 }
@@ -481,13 +483,8 @@ static struct skl_ssp_clk skl_ssp_clks[] = {
 static struct snd_soc_acpi_mach *skl_find_hda_machine(struct skl_dev *skl,
                                        struct snd_soc_acpi_mach *machines)
 {
-       struct hdac_bus *bus = skl_to_bus(skl);
        struct snd_soc_acpi_mach *mach;
 
-       /* check if we have any codecs detected on bus */
-       if (bus->codec_mask == 0)
-               return NULL;
-
        /* point to common table */
        mach = snd_soc_acpi_intel_hda_machines;
 
@@ -636,6 +633,9 @@ static int skl_clock_device_register(struct skl_dev *skl)
        struct platform_device_info pdevinfo = {NULL};
        struct skl_clk_pdata *clk_pdata;
 
+       if (!skl->nhlt)
+               return 0;
+
        clk_pdata = devm_kzalloc(&skl->pci->dev, sizeof(*clk_pdata),
                                                        GFP_KERNEL);
        if (!clk_pdata)
@@ -803,6 +803,9 @@ static void skl_probe_work(struct work_struct *work)
                        return;
        }
 
+       skl_init_pci(skl);
+       skl_dum_set(bus);
+
        err = skl_init_chip(bus, true);
        if (err < 0) {
                dev_err(bus->dev, "Init chip failed with err: %d\n", err);
@@ -918,8 +921,6 @@ static int skl_first_init(struct hdac_bus *bus)
                return -ENXIO;
        }
 
-       snd_hdac_bus_reset_link(bus, true);
-
        snd_hdac_bus_parse_capabilities(bus);
 
        /* check if PPCAP exists */
@@ -967,11 +968,7 @@ static int skl_first_init(struct hdac_bus *bus)
        if (err < 0)
                return err;
 
-       /* initialize chip */
-       skl_init_pci(skl);
-       skl_dum_set(bus);
-
-       return skl_init_chip(bus, true);
+       return 0;
 }
 
 static int skl_probe(struct pci_dev *pci,
@@ -1064,8 +1061,6 @@ static int skl_probe(struct pci_dev *pci,
        if (bus->mlcap)
                snd_hdac_ext_bus_get_ml_capabilities(bus);
 
-       snd_hdac_bus_stop_chip(bus);
-
        /* create device for soc dmic */
        err = skl_dmic_device_register(skl);
        if (err < 0) {
@@ -1082,7 +1077,8 @@ out_dsp_free:
 out_clk_free:
        skl_clock_device_unregister(skl);
 out_nhlt_free:
-       intel_nhlt_free(skl->nhlt);
+       if (skl->nhlt)
+               intel_nhlt_free(skl->nhlt);
 out_free:
        skl_free(bus);
 
@@ -1131,7 +1127,8 @@ static void skl_remove(struct pci_dev *pci)
        skl_dmic_device_unregister(skl);
        skl_clock_device_unregister(skl);
        skl_nhlt_remove_sysfs(skl);
-       intel_nhlt_free(skl->nhlt);
+       if (skl->nhlt)
+               intel_nhlt_free(skl->nhlt);
        skl_free(bus);
        dev_set_drvdata(&pci->dev, NULL);
 }
index d1512d4..3f9b2e1 100644 (file)
@@ -83,7 +83,7 @@
 #define JZ_AIC_I2S_STATUS_BUSY BIT(2)
 
 #define JZ_AIC_CLK_DIV_MASK 0xf
-#define I2SDIV_DV_SHIFT 8
+#define I2SDIV_DV_SHIFT 0
 #define I2SDIV_DV_MASK (0xf << I2SDIV_DV_SHIFT)
 #define I2SDIV_IDV_SHIFT 8
 #define I2SDIV_IDV_MASK (0xf << I2SDIV_IDV_SHIFT)
index c0d422d..8b48815 100644 (file)
@@ -69,6 +69,8 @@ struct q6asm_dai_rtd {
 };
 
 struct q6asm_dai_data {
+       struct snd_soc_dai_driver *dais;
+       int num_dais;
        long long int sid;
 };
 
@@ -889,7 +891,7 @@ static const struct snd_soc_component_driver q6asm_fe_dai_component = {
        .compr_ops      = &q6asm_dai_compr_ops,
 };
 
-static struct snd_soc_dai_driver q6asm_fe_dais[] = {
+static struct snd_soc_dai_driver q6asm_fe_dais_template[] = {
        Q6ASM_FEDAI_DRIVER(1),
        Q6ASM_FEDAI_DRIVER(2),
        Q6ASM_FEDAI_DRIVER(3),
@@ -903,10 +905,22 @@ static struct snd_soc_dai_driver q6asm_fe_dais[] = {
 static int of_q6asm_parse_dai_data(struct device *dev,
                                    struct q6asm_dai_data *pdata)
 {
-       static struct snd_soc_dai_driver *dai_drv;
+       struct snd_soc_dai_driver *dai_drv;
        struct snd_soc_pcm_stream empty_stream;
        struct device_node *node;
-       int ret, id, dir;
+       int ret, id, dir, idx = 0;
+
+
+       pdata->num_dais = of_get_child_count(dev->of_node);
+       if (!pdata->num_dais) {
+               dev_err(dev, "No dais found in DT\n");
+               return -EINVAL;
+       }
+
+       pdata->dais = devm_kcalloc(dev, pdata->num_dais, sizeof(*dai_drv),
+                                  GFP_KERNEL);
+       if (!pdata->dais)
+               return -ENOMEM;
 
        memset(&empty_stream, 0, sizeof(empty_stream));
 
@@ -917,7 +931,8 @@ static int of_q6asm_parse_dai_data(struct device *dev,
                        continue;
                }
 
-               dai_drv = &q6asm_fe_dais[id];
+               dai_drv = &pdata->dais[idx++];
+               *dai_drv = q6asm_fe_dais_template[id];
 
                ret = of_property_read_u32(node, "direction", &dir);
                if (ret)
@@ -955,11 +970,12 @@ static int q6asm_dai_probe(struct platform_device *pdev)
 
        dev_set_drvdata(dev, pdata);
 
-       of_q6asm_parse_dai_data(dev, pdata);
+       rc = of_q6asm_parse_dai_data(dev, pdata);
+       if (rc)
+               return rc;
 
        return devm_snd_soc_register_component(dev, &q6asm_fe_dai_component,
-                                       q6asm_fe_dais,
-                                       ARRAY_SIZE(q6asm_fe_dais));
+                                              pdata->dais, pdata->num_dais);
 }
 
 static const struct of_device_id q6asm_dai_device_id[] = {
index 2072410..4d5915b 100644 (file)
@@ -918,25 +918,6 @@ static const struct snd_soc_dapm_route intercon[] = {
        {"MM_UL6", NULL, "MultiMedia6 Mixer"},
        {"MM_UL7", NULL, "MultiMedia7 Mixer"},
        {"MM_UL8", NULL, "MultiMedia8 Mixer"},
-
-       {"MM_DL1",  NULL, "MultiMedia1 Playback" },
-       {"MM_DL2",  NULL, "MultiMedia2 Playback" },
-       {"MM_DL3",  NULL, "MultiMedia3 Playback" },
-       {"MM_DL4",  NULL, "MultiMedia4 Playback" },
-       {"MM_DL5",  NULL, "MultiMedia5 Playback" },
-       {"MM_DL6",  NULL, "MultiMedia6 Playback" },
-       {"MM_DL7",  NULL, "MultiMedia7 Playback" },
-       {"MM_DL8",  NULL, "MultiMedia8 Playback" },
-
-       {"MultiMedia1 Capture", NULL, "MM_UL1"},
-       {"MultiMedia2 Capture", NULL, "MM_UL2"},
-       {"MultiMedia3 Capture", NULL, "MM_UL3"},
-       {"MultiMedia4 Capture", NULL, "MM_UL4"},
-       {"MultiMedia5 Capture", NULL, "MM_UL5"},
-       {"MultiMedia6 Capture", NULL, "MM_UL6"},
-       {"MultiMedia7 Capture", NULL, "MM_UL7"},
-       {"MultiMedia8 Capture", NULL, "MM_UL8"},
-
 };
 
 static int routing_hw_params(struct snd_soc_component *component,
index 4e0f555..e7e70b4 100644 (file)
@@ -1260,8 +1260,18 @@ static int soc_probe_component(struct snd_soc_card *card,
        ret = snd_soc_dapm_add_routes(dapm,
                                      component->driver->dapm_routes,
                                      component->driver->num_dapm_routes);
-       if (ret < 0)
-               goto err_probe;
+       if (ret < 0) {
+               if (card->disable_route_checks) {
+                       dev_info(card->dev,
+                                "%s: disable_route_checks set, ignoring errors on add_routes\n",
+                                __func__);
+               } else {
+                       dev_err(card->dev,
+                               "%s: snd_soc_dapm_add_routes failed: %d\n",
+                               __func__, ret);
+                       goto err_probe;
+               }
+       }
 
        /* see for_each_card_components */
        list_add(&component->card_list, &card->component_dev_list);
@@ -1948,8 +1958,18 @@ static int snd_soc_bind_card(struct snd_soc_card *card)
 
        ret = snd_soc_dapm_add_routes(&card->dapm, card->dapm_routes,
                                      card->num_dapm_routes);
-       if (ret < 0)
-               goto probe_end;
+       if (ret < 0) {
+               if (card->disable_route_checks) {
+                       dev_info(card->dev,
+                                "%s: disable_route_checks set, ignoring errors on add_routes\n",
+                                __func__);
+               } else {
+                       dev_err(card->dev,
+                                "%s: snd_soc_dapm_add_routes failed: %d\n",
+                                __func__, ret);
+                       goto probe_end;
+               }
+       }
 
        ret = snd_soc_dapm_add_routes(&card->dapm, card->of_dapm_routes,
                                      card->num_of_dapm_routes);
index 33909af..1f81cd2 100644 (file)
@@ -251,7 +251,7 @@ static int soc_tplg_vendor_load_(struct soc_tplg *tplg,
 {
        int ret = 0;
 
-       if (tplg->comp && tplg->ops && tplg->ops->vendor_load)
+       if (tplg->ops && tplg->ops->vendor_load)
                ret = tplg->ops->vendor_load(tplg->comp, tplg->index, hdr);
        else {
                dev_err(tplg->dev, "ASoC: no vendor load callback for ID %d\n",
@@ -283,7 +283,7 @@ static int soc_tplg_vendor_load(struct soc_tplg *tplg,
 static int soc_tplg_widget_load(struct soc_tplg *tplg,
        struct snd_soc_dapm_widget *w, struct snd_soc_tplg_dapm_widget *tplg_w)
 {
-       if (tplg->comp && tplg->ops && tplg->ops->widget_load)
+       if (tplg->ops && tplg->ops->widget_load)
                return tplg->ops->widget_load(tplg->comp, tplg->index, w,
                        tplg_w);
 
@@ -295,7 +295,7 @@ static int soc_tplg_widget_load(struct soc_tplg *tplg,
 static int soc_tplg_widget_ready(struct soc_tplg *tplg,
        struct snd_soc_dapm_widget *w, struct snd_soc_tplg_dapm_widget *tplg_w)
 {
-       if (tplg->comp && tplg->ops && tplg->ops->widget_ready)
+       if (tplg->ops && tplg->ops->widget_ready)
                return tplg->ops->widget_ready(tplg->comp, tplg->index, w,
                        tplg_w);
 
@@ -307,7 +307,7 @@ static int soc_tplg_dai_load(struct soc_tplg *tplg,
        struct snd_soc_dai_driver *dai_drv,
        struct snd_soc_tplg_pcm *pcm, struct snd_soc_dai *dai)
 {
-       if (tplg->comp && tplg->ops && tplg->ops->dai_load)
+       if (tplg->ops && tplg->ops->dai_load)
                return tplg->ops->dai_load(tplg->comp, tplg->index, dai_drv,
                        pcm, dai);
 
@@ -318,7 +318,7 @@ static int soc_tplg_dai_load(struct soc_tplg *tplg,
 static int soc_tplg_dai_link_load(struct soc_tplg *tplg,
        struct snd_soc_dai_link *link, struct snd_soc_tplg_link_config *cfg)
 {
-       if (tplg->comp && tplg->ops && tplg->ops->link_load)
+       if (tplg->ops && tplg->ops->link_load)
                return tplg->ops->link_load(tplg->comp, tplg->index, link, cfg);
 
        return 0;
@@ -327,7 +327,7 @@ static int soc_tplg_dai_link_load(struct soc_tplg *tplg,
 /* tell the component driver that all firmware has been loaded in this request */
 static void soc_tplg_complete(struct soc_tplg *tplg)
 {
-       if (tplg->comp && tplg->ops && tplg->ops->complete)
+       if (tplg->ops && tplg->ops->complete)
                tplg->ops->complete(tplg->comp);
 }
 
@@ -684,7 +684,7 @@ EXPORT_SYMBOL_GPL(snd_soc_tplg_widget_bind_event);
 static int soc_tplg_init_kcontrol(struct soc_tplg *tplg,
        struct snd_kcontrol_new *k, struct snd_soc_tplg_ctl_hdr *hdr)
 {
-       if (tplg->comp && tplg->ops && tplg->ops->control_load)
+       if (tplg->ops && tplg->ops->control_load)
                return tplg->ops->control_load(tplg->comp, tplg->index, k,
                        hdr);
 
@@ -1174,7 +1174,7 @@ static int soc_tplg_kcontrol_elems_load(struct soc_tplg *tplg,
 static int soc_tplg_add_route(struct soc_tplg *tplg,
        struct snd_soc_dapm_route *route)
 {
-       if (tplg->comp && tplg->ops && tplg->ops->dapm_route_load)
+       if (tplg->ops && tplg->ops->dapm_route_load)
                return tplg->ops->dapm_route_load(tplg->comp, tplg->index,
                        route);
 
@@ -2564,7 +2564,7 @@ static int soc_tplg_manifest_load(struct soc_tplg *tplg,
        }
 
        /* pass control to component driver for optional further init */
-       if (tplg->comp && tplg->ops && tplg->ops->manifest)
+       if (tplg->ops && tplg->ops->manifest)
                ret = tplg->ops->manifest(tplg->comp, tplg->index, _manifest);
 
        if (!abi_match) /* free the duplicated one */
@@ -2736,6 +2736,10 @@ int snd_soc_tplg_component_load(struct snd_soc_component *comp,
        struct soc_tplg tplg;
        int ret;
 
+       /* component needs to exist to keep and reference data while parsing */
+       if (!comp)
+               return -EINVAL;
+
        /* setup parsing context */
        memset(&tplg, 0, sizeof(tplg));
        tplg.fw = fw;
index 7daa913..5d38695 100644 (file)
@@ -547,6 +547,8 @@ int hda_dsp_stream_hw_free(struct snd_sof_dev *sdev,
                                        SOF_HDA_REG_PP_PPCTL, mask, 0);
        spin_unlock_irq(&bus->reg_lock);
 
+       stream->substream = NULL;
+
        return 0;
 }