diff --git a/ipc/apr.c b/ipc/apr.c index 6e1f7d3e7935..cb72766a5ff5 100644 --- a/ipc/apr.c +++ b/ipc/apr.c @@ -43,6 +43,7 @@ static struct apr_client client[APR_DEST_MAX][APR_CLIENT_MAX]; static void *apr_pkt_ctx; static wait_queue_head_t modem_wait; static bool is_modem_up; +static char *subsys_name = NULL; /* Subsystem restart: QDSP6 data, functions */ static struct workqueue_struct *apr_reset_workqueue; static void apr_reset_deregister(struct work_struct *work); @@ -1108,8 +1109,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"); + subsys_notif_deregister(subsys_name); if (apr_reset_workqueue) { flush_workqueue(apr_reset_workqueue); destroy_workqueue(apr_reset_workqueue); @@ -1127,7 +1127,7 @@ static void apr_cleanup(void) static int apr_probe(struct platform_device *pdev) { - int i, j, k; + int i, j, k, ret = 0; init_waitqueue_head(&modem_wait); @@ -1163,10 +1163,26 @@ static int apr_probe(struct platform_device *pdev) spin_lock(&apr_priv->apr_lock); apr_priv->is_initial_boot = true; spin_unlock(&apr_priv->apr_lock); - subsys_notif_register("apr_adsp", AUDIO_NOTIFIER_ADSP_DOMAIN, - &adsp_service_nb); - subsys_notif_register("apr_modem", AUDIO_NOTIFIER_MODEM_DOMAIN, - &modem_service_nb); + ret = of_property_read_string(pdev->dev.of_node, + "qcom,subsys-name", + (const char **)(&subsys_name)); + if (ret) { + pr_err("%s: missing subsys-name entry in dt node\n", __func__); + return -EINVAL; + } + + if (!strcmp(subsys_name, "apr_adsp")) { + subsys_notif_register("apr_adsp", + AUDIO_NOTIFIER_ADSP_DOMAIN, + &adsp_service_nb); + } else if (!strcmp(subsys_name, "apr_modem")) { + subsys_notif_register("apr_modem", + AUDIO_NOTIFIER_MODEM_DOMAIN, + &modem_service_nb); + } else { + pr_err("%s: invalid subsys-name %s\n", __func__, subsys_name); + return -EINVAL; + } apr_tal_init(); return apr_debug_init();