Asish Bhattacharya | 8e2277f | 2017-07-20 18:31:55 +0530 | [diff] [blame] | 1 | /* |
| 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 Kasam | 605b42f | 2017-08-01 22:02:15 +0530 | [diff] [blame] | 18 | #include <dsp/audio_notifier.h> |
| 19 | #include <ipc/apr.h> |
| 20 | #include <ipc/apr_tal.h> |
Asish Bhattacharya | 8e2277f | 2017-07-20 18:31:55 +0530 | [diff] [blame] | 21 | |
| 22 | #define DEST_ID APR_DEST_MODEM |
| 23 | |
| 24 | enum apr_subsys_state apr_get_subsys_state(void) |
| 25 | { |
| 26 | return apr_get_modem_state(); |
| 27 | } |
Sundara Vinayagam | 3983833 | 2018-05-23 12:04:25 +0530 | [diff] [blame] | 28 | EXPORT_SYMBOL(apr_get_subsys_state); |
Asish Bhattacharya | 8e2277f | 2017-07-20 18:31:55 +0530 | [diff] [blame] | 29 | |
| 30 | void apr_set_subsys_state(void) |
| 31 | { |
| 32 | apr_set_modem_state(APR_SUBSYS_DOWN); |
| 33 | } |
Sundara Vinayagam | 3983833 | 2018-05-23 12:04:25 +0530 | [diff] [blame] | 34 | EXPORT_SYMBOL(apr_set_subsys_state); |
Asish Bhattacharya | 8e2277f | 2017-07-20 18:31:55 +0530 | [diff] [blame] | 35 | |
| 36 | uint16_t apr_get_data_src(struct apr_hdr *hdr) |
| 37 | { |
| 38 | return DEST_ID; |
| 39 | } |
| 40 | |
| 41 | int apr_get_dest_id(char *dest) |
| 42 | { |
| 43 | return DEST_ID; |
| 44 | } |
| 45 | |
| 46 | void 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 Kasam | 8b1366a | 2017-10-05 01:44:16 +0530 | [diff] [blame] | 63 | void 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 Bhattacharya | 8e2277f | 2017-07-20 18:31:55 +0530 | [diff] [blame] | 73 | uint16_t apr_get_reset_domain(uint16_t proc) |
| 74 | { |
| 75 | return APR_DEST_QDSP6; |
| 76 | } |