Commit 56b03b4c authored by Kuninori Morimoto's avatar Kuninori Morimoto Committed by Mark Brown

ASoC: intel: skylake: replace platform to component

Now platform can be replaced to component, let's do it.
Signed-off-by: default avatarKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tested-by: default avatar"Kp, Jeeja" <jeeja.kp@intel.com>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 6840962b
...@@ -231,7 +231,7 @@ struct skl_debug *skl_debugfs_init(struct skl *skl) ...@@ -231,7 +231,7 @@ struct skl_debug *skl_debugfs_init(struct skl *skl)
/* create the debugfs dir with platform component's debugfs as parent */ /* create the debugfs dir with platform component's debugfs as parent */
d->fs = debugfs_create_dir("dsp", d->fs = debugfs_create_dir("dsp",
skl->platform->component.debugfs_root); skl->component->debugfs_root);
if (IS_ERR(d->fs) || !d->fs) { if (IS_ERR(d->fs) || !d->fs) {
dev_err(&skl->pci->dev, "debugfs root creation failed\n"); dev_err(&skl->pci->dev, "debugfs root creation failed\n");
return NULL; return NULL;
......
...@@ -1313,23 +1313,23 @@ static int skl_populate_modules(struct skl *skl) ...@@ -1313,23 +1313,23 @@ static int skl_populate_modules(struct skl *skl)
return ret; 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); struct skl *skl = ebus_to_skl(ebus);
const struct skl_dsp_ops *ops; const struct skl_dsp_ops *ops;
int ret; int ret;
pm_runtime_get_sync(platform->dev); pm_runtime_get_sync(component->dev);
if ((ebus_to_hbus(ebus))->ppcap) { if ((ebus_to_hbus(ebus))->ppcap) {
skl->platform = platform; skl->component = component;
/* init debugfs */ /* init debugfs */
skl->debugfs = skl_debugfs_init(skl); skl->debugfs = skl_debugfs_init(skl);
ret = skl_tplg_init(platform, ebus); ret = skl_tplg_init(component, ebus);
if (ret < 0) { if (ret < 0) {
dev_err(platform->dev, "Failed to init topology!\n"); dev_err(component->dev, "Failed to init topology!\n");
return ret; return ret;
} }
...@@ -1339,17 +1339,17 @@ static int skl_platform_soc_probe(struct snd_soc_platform *platform) ...@@ -1339,17 +1339,17 @@ static int skl_platform_soc_probe(struct snd_soc_platform *platform)
return -EIO; return -EIO;
if (skl->skl_sst->is_first_boot == false) { 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; return -EIO;
} }
/* disable dynamic clock gating during fw and lib download */ /* 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); ret = ops->init_fw(component->dev, skl->skl_sst);
skl->skl_sst->enable_miscbdcge(platform->dev, true); skl->skl_sst->enable_miscbdcge(component->dev, true);
if (ret < 0) { 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; return ret;
} }
skl_populate_modules(skl); skl_populate_modules(skl);
...@@ -1362,22 +1362,20 @@ static int skl_platform_soc_probe(struct snd_soc_platform *platform) ...@@ -1362,22 +1362,20 @@ static int skl_platform_soc_probe(struct snd_soc_platform *platform)
skl->cfg.astate_cfg); skl->cfg.astate_cfg);
} }
} }
pm_runtime_mark_last_busy(platform->dev); pm_runtime_mark_last_busy(component->dev);
pm_runtime_put_autosuspend(platform->dev); pm_runtime_put_autosuspend(component->dev);
return 0; 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, .probe = skl_platform_soc_probe,
.ops = &skl_platform_ops, .ops = &skl_platform_ops,
.pcm_new = skl_pcm_new, .pcm_new = skl_pcm_new,
.pcm_free = skl_pcm_free, .pcm_free = skl_pcm_free,
}; };
static const struct snd_soc_component_driver skl_component = {
.name = "pcm",
};
int skl_platform_register(struct device *dev) int skl_platform_register(struct device *dev)
{ {
int ret; int ret;
...@@ -1389,12 +1387,6 @@ int skl_platform_register(struct device *dev) ...@@ -1389,12 +1387,6 @@ int skl_platform_register(struct device *dev)
INIT_LIST_HEAD(&skl->ppl_list); INIT_LIST_HEAD(&skl->ppl_list);
INIT_LIST_HEAD(&skl->bind_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), skl->dais = kmemdup(skl_platform_dai, sizeof(skl_platform_dai),
GFP_KERNEL); GFP_KERNEL);
if (!skl->dais) { if (!skl->dais) {
...@@ -1416,18 +1408,12 @@ int skl_platform_register(struct device *dev) ...@@ -1416,18 +1408,12 @@ int skl_platform_register(struct device *dev)
num_dais += ARRAY_SIZE(skl_fe_dai); 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); skl->dais, num_dais);
if (ret) { if (ret)
dev_err(dev, "soc component registration failed %d\n", ret); dev_err(dev, "soc component registration failed %d\n", ret);
goto err;
}
return 0;
err: err:
snd_soc_unregister_platform(dev);
return ret; return ret;
} }
int skl_platform_unregister(struct device *dev) int skl_platform_unregister(struct device *dev)
...@@ -1443,8 +1429,6 @@ 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); kfree(skl->dais);
return 0; return 0;
......
...@@ -2710,15 +2710,15 @@ static int skl_tplg_get_pvt_data(struct snd_soc_tplg_dapm_widget *tplg_w, ...@@ -2710,15 +2710,15 @@ static int skl_tplg_get_pvt_data(struct snd_soc_tplg_dapm_widget *tplg_w,
return 0; 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) struct snd_soc_dapm_widget *w)
{ {
int i; int i;
struct skl_module_cfg *mconfig; struct skl_module_cfg *mconfig;
struct skl_pipe *pipe; struct skl_pipe *pipe;
if (!strncmp(w->dapm->component->name, platform->component.name, if (!strncmp(w->dapm->component->name, component->name,
strlen(platform->component.name))) { strlen(component->name))) {
mconfig = w->priv; mconfig = w->priv;
pipe = mconfig->pipe; pipe = mconfig->pipe;
for (i = 0; i < mconfig->module->max_input_pins; i++) { 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, ...@@ -2737,14 +2737,14 @@ static void skl_clear_pin_config(struct snd_soc_platform *platform,
void skl_cleanup_resources(struct skl *skl) void skl_cleanup_resources(struct skl *skl)
{ {
struct skl_sst *ctx = skl->skl_sst; 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_dapm_widget *w;
struct snd_soc_card *card; struct snd_soc_card *card;
if (soc_platform == NULL) if (soc_component == NULL)
return; return;
card = soc_platform->component.card; card = soc_component->card;
if (!card || !card->instantiated) if (!card || !card->instantiated)
return; return;
...@@ -2753,7 +2753,7 @@ void skl_cleanup_resources(struct skl *skl) ...@@ -2753,7 +2753,7 @@ void skl_cleanup_resources(struct skl *skl)
list_for_each_entry(w, &card->widgets, list) { list_for_each_entry(w, &card->widgets, list) {
if (is_skl_dsp_widget_type(w) && (w->priv != NULL)) 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); skl_clear_module_cnt(ctx->dsp);
...@@ -3400,19 +3400,19 @@ static struct snd_soc_tplg_ops skl_tplg_ops = { ...@@ -3400,19 +3400,19 @@ static struct snd_soc_tplg_ops skl_tplg_ops = {
* widgets in a pipelines, so this helper - skl_tplg_create_pipe_widget_list() * widgets in a pipelines, so this helper - skl_tplg_create_pipe_widget_list()
* helps to get the SKL type widgets in that pipeline * 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 snd_soc_dapm_widget *w;
struct skl_module_cfg *mcfg = NULL; struct skl_module_cfg *mcfg = NULL;
struct skl_pipe_module *p_module = NULL; struct skl_pipe_module *p_module = NULL;
struct skl_pipe *pipe; 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) { if (is_skl_dsp_widget_type(w) && w->priv != NULL) {
mcfg = w->priv; mcfg = w->priv;
pipe = mcfg->pipe; pipe = mcfg->pipe;
p_module = devm_kzalloc(platform->dev, p_module = devm_kzalloc(component->dev,
sizeof(*p_module), GFP_KERNEL); sizeof(*p_module), GFP_KERNEL);
if (!p_module) if (!p_module)
return -ENOMEM; return -ENOMEM;
...@@ -3455,7 +3455,7 @@ static void skl_tplg_set_pipe_type(struct skl *skl, struct skl_pipe *pipe) ...@@ -3455,7 +3455,7 @@ static void skl_tplg_set_pipe_type(struct skl *skl, struct skl_pipe *pipe)
/* /*
* SKL topology init routine * 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; int ret;
const struct firmware *fw; const struct firmware *fw;
...@@ -3479,7 +3479,7 @@ int skl_tplg_init(struct snd_soc_platform *platform, struct hdac_ext_bus *ebus) ...@@ -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 * The complete tplg for SKL is loaded as index 0, we don't use
* any other index * any other index
*/ */
ret = snd_soc_tplg_component_load(&platform->component, ret = snd_soc_tplg_component_load(component,
&skl_tplg_ops, fw, 0); &skl_tplg_ops, fw, 0);
if (ret < 0) { if (ret < 0) {
dev_err(bus->dev, "tplg component load failed%d\n", ret); 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) ...@@ -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->resource.max_mem = SKL_FW_MAX_MEM;
skl->tplg = fw; skl->tplg = fw;
ret = skl_tplg_create_pipe_widget_list(platform); ret = skl_tplg_create_pipe_widget_list(component);
if (ret < 0) if (ret < 0)
return ret; return ret;
......
...@@ -460,7 +460,7 @@ int skl_dsp_set_dma_control(struct skl_sst *ctx, u32 *caps, ...@@ -460,7 +460,7 @@ int skl_dsp_set_dma_control(struct skl_sst *ctx, u32 *caps,
u32 caps_size, u32 node_id); u32 caps_size, u32 node_id);
void skl_tplg_set_be_dmic_config(struct snd_soc_dai *dai, void skl_tplg_set_be_dmic_config(struct snd_soc_dai *dai,
struct skl_pipe_params *params, int stream); 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 hdac_ext_bus *ebus);
struct skl_module_cfg *skl_tplg_fe_get_cpr_module( struct skl_module_cfg *skl_tplg_fe_get_cpr_module(
struct snd_soc_dai *dai, int stream); struct snd_soc_dai *dai, int stream);
......
...@@ -74,7 +74,7 @@ struct skl { ...@@ -74,7 +74,7 @@ struct skl {
struct platform_device *dmic_dev; struct platform_device *dmic_dev;
struct platform_device *i2s_dev; struct platform_device *i2s_dev;
struct platform_device *clk_dev; struct platform_device *clk_dev;
struct snd_soc_platform *platform; struct snd_soc_component *component;
struct snd_soc_dai_driver *dais; struct snd_soc_dai_driver *dais;
struct nhlt_acpi_table *nhlt; /* nhlt ptr */ struct nhlt_acpi_table *nhlt; /* nhlt ptr */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment