Merge "ipc: apr: use of_platform_populate to add child node of apr" into audio-drivers.lnx.3.0
This commit is contained in:
commit
5f1a17ddee
1 changed files with 10 additions and 52 deletions
62
ipc/apr.c
62
ipc/apr.c
|
@ -28,6 +28,7 @@
|
|||
#include <linux/of.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/ipc_logging.h>
|
||||
#include <linux/of_platform.h>
|
||||
#include <soc/qcom/subsystem_restart.h>
|
||||
#include <soc/qcom/scm.h>
|
||||
#include <dsp/apr_audio-v2.h>
|
||||
|
@ -62,8 +63,6 @@ struct apr_private {
|
|||
spinlock_t apr_lock;
|
||||
bool is_initial_boot;
|
||||
struct work_struct add_chld_dev_work;
|
||||
spinlock_t apr_chld_lock;
|
||||
struct list_head apr_chlds;
|
||||
};
|
||||
|
||||
static struct apr_private *apr_priv;
|
||||
|
@ -290,7 +289,7 @@ enum apr_subsys_state apr_cmpxchg_q6_state(enum apr_subsys_state prev,
|
|||
|
||||
static void apr_adsp_down(unsigned long opcode)
|
||||
{
|
||||
pr_debug("%s: Q6 is Down\n", __func__);
|
||||
pr_info("%s: Q6 is Down\n", __func__);
|
||||
apr_set_q6_state(APR_SUBSYS_DOWN);
|
||||
dispatch_event(opcode, APR_DEST_QDSP6);
|
||||
}
|
||||
|
@ -298,49 +297,17 @@ static void apr_adsp_down(unsigned long opcode)
|
|||
static void apr_add_child_devices(struct work_struct *work)
|
||||
{
|
||||
int ret;
|
||||
struct device_node *node;
|
||||
struct platform_device *pdev;
|
||||
struct apr_chld_device *apr_chld_dev;
|
||||
|
||||
for_each_child_of_node(apr_priv->dev->of_node, node) {
|
||||
apr_chld_dev = kzalloc(sizeof(*apr_chld_dev), GFP_KERNEL);
|
||||
if (!apr_chld_dev)
|
||||
continue;
|
||||
pdev = platform_device_alloc(node->name, -1);
|
||||
if (!pdev) {
|
||||
dev_err(apr_priv->dev,
|
||||
"%s: pdev memory alloc failed for %s\n",
|
||||
__func__, node->name);
|
||||
kfree(apr_chld_dev);
|
||||
continue;
|
||||
}
|
||||
pdev->dev.parent = apr_priv->dev;
|
||||
pdev->dev.of_node = node;
|
||||
|
||||
ret = platform_device_add(pdev);
|
||||
if (ret) {
|
||||
dev_err(apr_priv->dev,
|
||||
"%s: Cannot add platform device %s\n",
|
||||
__func__, node->name);
|
||||
platform_device_put(pdev);
|
||||
kfree(apr_chld_dev);
|
||||
continue;
|
||||
}
|
||||
|
||||
apr_chld_dev->pdev = pdev;
|
||||
|
||||
spin_lock(&apr_priv->apr_chld_lock);
|
||||
list_add_tail(&apr_chld_dev->node, &apr_priv->apr_chlds);
|
||||
spin_unlock(&apr_priv->apr_chld_lock);
|
||||
|
||||
dev_dbg(apr_priv->dev, "%s: Added APR child dev: %s\n",
|
||||
__func__, dev_name(&pdev->dev));
|
||||
}
|
||||
ret = of_platform_populate(apr_priv->dev->of_node,
|
||||
NULL, NULL, apr_priv->dev);
|
||||
if (ret)
|
||||
dev_err(apr_priv->dev, "%s: failed to add child nodes, ret=%d\n",
|
||||
__func__, ret);
|
||||
}
|
||||
|
||||
static void apr_adsp_up(void)
|
||||
{
|
||||
pr_debug("%s: Q6 is Up\n", __func__);
|
||||
pr_info("%s: Q6 is Up\n", __func__);
|
||||
if (apr_cmpxchg_q6_state(APR_SUBSYS_DOWN, APR_SUBSYS_LOADED) ==
|
||||
APR_SUBSYS_DOWN)
|
||||
wake_up(&dsp_wait);
|
||||
|
@ -1165,6 +1132,7 @@ static void apr_cleanup(void)
|
|||
{
|
||||
int i, j, k;
|
||||
|
||||
of_platform_depopulate(apr_priv->dev);
|
||||
subsys_notif_deregister("apr_modem");
|
||||
subsys_notif_deregister("apr_adsp");
|
||||
if (apr_reset_workqueue) {
|
||||
|
@ -1179,6 +1147,7 @@ static void apr_cleanup(void)
|
|||
mutex_destroy(&client[i][j].svc[k].m_lock);
|
||||
}
|
||||
}
|
||||
debugfs_remove(debugfs_apr_debug);
|
||||
}
|
||||
|
||||
static int apr_probe(struct platform_device *pdev)
|
||||
|
@ -1194,8 +1163,6 @@ static int apr_probe(struct platform_device *pdev)
|
|||
|
||||
apr_priv->dev = &pdev->dev;
|
||||
spin_lock_init(&apr_priv->apr_lock);
|
||||
spin_lock_init(&apr_priv->apr_chld_lock);
|
||||
INIT_LIST_HEAD(&apr_priv->apr_chlds);
|
||||
INIT_WORK(&apr_priv->add_chld_dev_work, apr_add_child_devices);
|
||||
|
||||
for (i = 0; i < APR_DEST_MAX; i++)
|
||||
|
@ -1233,17 +1200,8 @@ static int apr_probe(struct platform_device *pdev)
|
|||
|
||||
static int apr_remove(struct platform_device *pdev)
|
||||
{
|
||||
struct apr_chld_device *chld, *tmp;
|
||||
|
||||
apr_cleanup();
|
||||
apr_tal_exit();
|
||||
spin_lock(&apr_priv->apr_chld_lock);
|
||||
list_for_each_entry_safe(chld, tmp, &apr_priv->apr_chlds, node) {
|
||||
platform_device_unregister(chld->pdev);
|
||||
list_del(&chld->node);
|
||||
kfree(chld);
|
||||
}
|
||||
spin_unlock(&apr_priv->apr_chld_lock);
|
||||
apr_priv = NULL;
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue