From mboxrd@z Thu Jan 1 00:00:00 1970 From: Kuninori Morimoto Subject: [PATCH v2 05/39] ASoC: intel: skylake: replace platform to component Date: Mon, 29 Jan 2018 02:41:43 +0000 Message-ID: <87wp0175gu.wl%kuninori.morimoto.gx@renesas.com> References: <87607l8k9i.wl%kuninori.morimoto.gx@renesas.com> <874ln58k4s.wl%kuninori.morimoto.gx@renesas.com> Mime-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from relmlie3.idc.renesas.com (relmlor4.renesas.com [210.160.252.174]) by alsa0.perex.cz (Postfix) with ESMTP id C27B026734F for ; Mon, 29 Jan 2018 03:41:49 +0100 (CET) In-Reply-To: <874ln58k4s.wl%kuninori.morimoto.gx@renesas.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org To: Mark Brown Cc: Linux-ALSA List-Id: alsa-devel@alsa-project.org From: Kuninori Morimoto Now platform can be replaced to component, let's do it. Signed-off-by: Kuninori Morimoto Tested-by: "Kp, Jeeja" --- sound/soc/intel/skylake/skl-debug.c | 2 +- sound/soc/intel/skylake/skl-pcm.c | 52 ++++++++++++---------------------- sound/soc/intel/skylake/skl-topology.c | 26 ++++++++--------- sound/soc/intel/skylake/skl-topology.h | 2 +- sound/soc/intel/skylake/skl.h | 2 +- 5 files changed, 34 insertions(+), 50 deletions(-) diff --git a/sound/soc/intel/skylake/skl-debug.c b/sound/soc/intel/skylake/skl-debug.c index dc20d91..a016455 100644 --- a/sound/soc/intel/skylake/skl-debug.c +++ b/sound/soc/intel/skylake/skl-debug.c @@ -231,7 +231,7 @@ struct skl_debug *skl_debugfs_init(struct skl *skl) /* create the debugfs dir with platform component's debugfs as parent */ d->fs = debugfs_create_dir("dsp", - skl->platform->component.debugfs_root); + skl->component->debugfs_root); if (IS_ERR(d->fs) || !d->fs) { dev_err(&skl->pci->dev, "debugfs root creation failed\n"); return NULL; diff --git a/sound/soc/intel/skylake/skl-pcm.c b/sound/soc/intel/skylake/skl-pcm.c index e468285..36a5215 100644 --- a/sound/soc/intel/skylake/skl-pcm.c +++ b/sound/soc/intel/skylake/skl-pcm.c @@ -1313,23 +1313,23 @@ static int skl_populate_modules(struct skl *skl) return ret; } -static int skl_platform_soc_probe(struct snd_soc_platform *platform) +static int skl_platform_soc_probe(struct snd_soc_component *component) { - struct hdac_ext_bus *ebus = dev_get_drvdata(platform->dev); + struct hdac_ext_bus *ebus = dev_get_drvdata(component->dev); struct skl *skl = ebus_to_skl(ebus); const struct skl_dsp_ops *ops; int ret; - pm_runtime_get_sync(platform->dev); + pm_runtime_get_sync(component->dev); if ((ebus_to_hbus(ebus))->ppcap) { - skl->platform = platform; + skl->component = component; /* init debugfs */ skl->debugfs = skl_debugfs_init(skl); - ret = skl_tplg_init(platform, ebus); + ret = skl_tplg_init(component, ebus); if (ret < 0) { - dev_err(platform->dev, "Failed to init topology!\n"); + dev_err(component->dev, "Failed to init topology!\n"); return ret; } @@ -1339,17 +1339,17 @@ static int skl_platform_soc_probe(struct snd_soc_platform *platform) return -EIO; if (skl->skl_sst->is_first_boot == false) { - dev_err(platform->dev, "DSP reports first boot done!!!\n"); + dev_err(component->dev, "DSP reports first boot done!!!\n"); return -EIO; } /* disable dynamic clock gating during fw and lib download */ - skl->skl_sst->enable_miscbdcge(platform->dev, false); + skl->skl_sst->enable_miscbdcge(component->dev, false); - ret = ops->init_fw(platform->dev, skl->skl_sst); - skl->skl_sst->enable_miscbdcge(platform->dev, true); + ret = ops->init_fw(component->dev, skl->skl_sst); + skl->skl_sst->enable_miscbdcge(component->dev, true); if (ret < 0) { - dev_err(platform->dev, "Failed to boot first fw: %d\n", ret); + dev_err(component->dev, "Failed to boot first fw: %d\n", ret); return ret; } skl_populate_modules(skl); @@ -1362,22 +1362,20 @@ static int skl_platform_soc_probe(struct snd_soc_platform *platform) skl->cfg.astate_cfg); } } - pm_runtime_mark_last_busy(platform->dev); - pm_runtime_put_autosuspend(platform->dev); + pm_runtime_mark_last_busy(component->dev); + pm_runtime_put_autosuspend(component->dev); return 0; } -static const struct snd_soc_platform_driver skl_platform_drv = { + +static const struct snd_soc_component_driver skl_component = { + .name = "pcm", .probe = skl_platform_soc_probe, .ops = &skl_platform_ops, .pcm_new = skl_pcm_new, .pcm_free = skl_pcm_free, }; -static const struct snd_soc_component_driver skl_component = { - .name = "pcm", -}; - int skl_platform_register(struct device *dev) { int ret; @@ -1389,12 +1387,6 @@ int skl_platform_register(struct device *dev) INIT_LIST_HEAD(&skl->ppl_list); INIT_LIST_HEAD(&skl->bind_list); - ret = snd_soc_register_platform(dev, &skl_platform_drv); - if (ret) { - dev_err(dev, "soc platform registration failed %d\n", ret); - return ret; - } - skl->dais = kmemdup(skl_platform_dai, sizeof(skl_platform_dai), GFP_KERNEL); if (!skl->dais) { @@ -1416,18 +1408,12 @@ int skl_platform_register(struct device *dev) num_dais += ARRAY_SIZE(skl_fe_dai); } - ret = snd_soc_register_component(dev, &skl_component, + ret = devm_snd_soc_register_component(dev, &skl_component, skl->dais, num_dais); - if (ret) { + if (ret) dev_err(dev, "soc component registration failed %d\n", ret); - goto err; - } - - return 0; err: - snd_soc_unregister_platform(dev); return ret; - } int skl_platform_unregister(struct device *dev) @@ -1443,8 +1429,6 @@ int skl_platform_unregister(struct device *dev) } } - snd_soc_unregister_component(dev); - snd_soc_unregister_platform(dev); kfree(skl->dais); return 0; diff --git a/sound/soc/intel/skylake/skl-topology.c b/sound/soc/intel/skylake/skl-topology.c index 73af6e1..515e4b6 100644 --- a/sound/soc/intel/skylake/skl-topology.c +++ b/sound/soc/intel/skylake/skl-topology.c @@ -2710,15 +2710,15 @@ static int skl_tplg_get_pvt_data(struct snd_soc_tplg_dapm_widget *tplg_w, return 0; } -static void skl_clear_pin_config(struct snd_soc_platform *platform, +static void skl_clear_pin_config(struct snd_soc_component *component, struct snd_soc_dapm_widget *w) { int i; struct skl_module_cfg *mconfig; struct skl_pipe *pipe; - if (!strncmp(w->dapm->component->name, platform->component.name, - strlen(platform->component.name))) { + if (!strncmp(w->dapm->component->name, component->name, + strlen(component->name))) { mconfig = w->priv; pipe = mconfig->pipe; for (i = 0; i < mconfig->module->max_input_pins; i++) { @@ -2737,14 +2737,14 @@ static void skl_clear_pin_config(struct snd_soc_platform *platform, void skl_cleanup_resources(struct skl *skl) { struct skl_sst *ctx = skl->skl_sst; - struct snd_soc_platform *soc_platform = skl->platform; + struct snd_soc_component *soc_component = skl->component; struct snd_soc_dapm_widget *w; struct snd_soc_card *card; - if (soc_platform == NULL) + if (soc_component == NULL) return; - card = soc_platform->component.card; + card = soc_component->card; if (!card || !card->instantiated) return; @@ -2753,7 +2753,7 @@ void skl_cleanup_resources(struct skl *skl) list_for_each_entry(w, &card->widgets, list) { if (is_skl_dsp_widget_type(w) && (w->priv != NULL)) - skl_clear_pin_config(soc_platform, w); + skl_clear_pin_config(soc_component, w); } skl_clear_module_cnt(ctx->dsp); @@ -3400,19 +3400,19 @@ static int skl_manifest_load(struct snd_soc_component *cmpnt, * widgets in a pipelines, so this helper - skl_tplg_create_pipe_widget_list() * helps to get the SKL type widgets in that pipeline */ -static int skl_tplg_create_pipe_widget_list(struct snd_soc_platform *platform) +static int skl_tplg_create_pipe_widget_list(struct snd_soc_component *component) { struct snd_soc_dapm_widget *w; struct skl_module_cfg *mcfg = NULL; struct skl_pipe_module *p_module = NULL; struct skl_pipe *pipe; - list_for_each_entry(w, &platform->component.card->widgets, list) { + list_for_each_entry(w, &component->card->widgets, list) { if (is_skl_dsp_widget_type(w) && w->priv != NULL) { mcfg = w->priv; pipe = mcfg->pipe; - p_module = devm_kzalloc(platform->dev, + p_module = devm_kzalloc(component->dev, sizeof(*p_module), GFP_KERNEL); if (!p_module) return -ENOMEM; @@ -3455,7 +3455,7 @@ static void skl_tplg_set_pipe_type(struct skl *skl, struct skl_pipe *pipe) /* * SKL topology init routine */ -int skl_tplg_init(struct snd_soc_platform *platform, struct hdac_ext_bus *ebus) +int skl_tplg_init(struct snd_soc_component *component, struct hdac_ext_bus *ebus) { int ret; const struct firmware *fw; @@ -3479,7 +3479,7 @@ int skl_tplg_init(struct snd_soc_platform *platform, struct hdac_ext_bus *ebus) * The complete tplg for SKL is loaded as index 0, we don't use * any other index */ - ret = snd_soc_tplg_component_load(&platform->component, + ret = snd_soc_tplg_component_load(component, &skl_tplg_ops, fw, 0); if (ret < 0) { dev_err(bus->dev, "tplg component load failed%d\n", ret); @@ -3491,7 +3491,7 @@ int skl_tplg_init(struct snd_soc_platform *platform, struct hdac_ext_bus *ebus) skl->resource.max_mem = SKL_FW_MAX_MEM; skl->tplg = fw; - ret = skl_tplg_create_pipe_widget_list(platform); + ret = skl_tplg_create_pipe_widget_list(component); if (ret < 0) return ret; diff --git a/sound/soc/intel/skylake/skl-topology.h b/sound/soc/intel/skylake/skl-topology.h index b649651..87c9468 100644 --- a/sound/soc/intel/skylake/skl-topology.h +++ b/sound/soc/intel/skylake/skl-topology.h @@ -460,7 +460,7 @@ int skl_dsp_set_dma_control(struct skl_sst *ctx, u32 *caps, u32 caps_size, u32 node_id); void skl_tplg_set_be_dmic_config(struct snd_soc_dai *dai, struct skl_pipe_params *params, int stream); -int skl_tplg_init(struct snd_soc_platform *platform, +int skl_tplg_init(struct snd_soc_component *component, struct hdac_ext_bus *ebus); struct skl_module_cfg *skl_tplg_fe_get_cpr_module( struct snd_soc_dai *dai, int stream); diff --git a/sound/soc/intel/skylake/skl.h b/sound/soc/intel/skylake/skl.h index 2d13f3f..ca46ad1 100644 --- a/sound/soc/intel/skylake/skl.h +++ b/sound/soc/intel/skylake/skl.h @@ -74,7 +74,7 @@ struct skl { struct platform_device *dmic_dev; struct platform_device *i2s_dev; struct platform_device *clk_dev; - struct snd_soc_platform *platform; + struct snd_soc_component *component; struct snd_soc_dai_driver *dais; struct nhlt_acpi_table *nhlt; /* nhlt ptr */ -- 1.9.1