blob: 01f8ae05f001cf7d9162676e656f3c4f2b59800c [file] [log] [blame]
Asish Bhattacharya8e2277f2017-07-20 18:31:55 +05301/*
2 * Copyright (c) 2013-2016, The Linux Foundation. All rights reserved.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 and
6 * only version 2 as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 */
13
14#include <linux/types.h>
15#include <linux/uaccess.h>
16#include <linux/spinlock.h>
17#include <linux/kernel.h>
Laxminath Kasam605b42f2017-08-01 22:02:15 +053018#include <dsp/audio_notifier.h>
19#include <ipc/apr.h>
20#include <ipc/apr_tal.h>
Asish Bhattacharya8e2277f2017-07-20 18:31:55 +053021
22#define DEST_ID APR_DEST_MODEM
23
24enum apr_subsys_state apr_get_subsys_state(void)
25{
26 return apr_get_modem_state();
27}
Sundara Vinayagam39838332018-05-23 12:04:25 +053028EXPORT_SYMBOL(apr_get_subsys_state);
Asish Bhattacharya8e2277f2017-07-20 18:31:55 +053029
30void apr_set_subsys_state(void)
31{
32 apr_set_modem_state(APR_SUBSYS_DOWN);
33}
Sundara Vinayagam39838332018-05-23 12:04:25 +053034EXPORT_SYMBOL(apr_set_subsys_state);
Asish Bhattacharya8e2277f2017-07-20 18:31:55 +053035
36uint16_t apr_get_data_src(struct apr_hdr *hdr)
37{
38 return DEST_ID;
39}
40
41int apr_get_dest_id(char *dest)
42{
43 return DEST_ID;
44}
45
46void subsys_notif_register(char *client_name, int domain,
47 struct notifier_block *nb)
48{
49 int ret;
50
51 if (domain != AUDIO_NOTIFIER_MODEM_DOMAIN) {
52 pr_debug("%s: Unused domain %d not registering with notifier\n",
53 __func__, domain);
54 return;
55 }
56
57 ret = audio_notifier_register(client_name, domain, nb);
58 if (ret < 0)
59 pr_err("%s: Audio notifier register failed for domain %d ret = %d\n",
60 __func__, domain, ret);
61}
62
Laxminath Kasam8b1366a2017-10-05 01:44:16 +053063void subsys_notif_deregister(char *client_name)
64{
65 int ret;
66
67 ret = audio_notifier_deregister(client_name);
68 if (ret < 0)
69 pr_err("%s: Audio notifier de-register failed for client %s\n",
70 __func__, client_name);
71}
72
Asish Bhattacharya8e2277f2017-07-20 18:31:55 +053073uint16_t apr_get_reset_domain(uint16_t proc)
74{
75 return APR_DEST_QDSP6;
76}