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 | } |
| 28 | |
| 29 | void apr_set_subsys_state(void) |
| 30 | { |
| 31 | apr_set_modem_state(APR_SUBSYS_DOWN); |
| 32 | } |
| 33 | |
| 34 | uint16_t apr_get_data_src(struct apr_hdr *hdr) |
| 35 | { |
| 36 | return DEST_ID; |
| 37 | } |
| 38 | |
| 39 | int apr_get_dest_id(char *dest) |
| 40 | { |
| 41 | return DEST_ID; |
| 42 | } |
| 43 | |
| 44 | void subsys_notif_register(char *client_name, int domain, |
| 45 | struct notifier_block *nb) |
| 46 | { |
| 47 | int ret; |
| 48 | |
| 49 | if (domain != AUDIO_NOTIFIER_MODEM_DOMAIN) { |
| 50 | pr_debug("%s: Unused domain %d not registering with notifier\n", |
| 51 | __func__, domain); |
| 52 | return; |
| 53 | } |
| 54 | |
| 55 | ret = audio_notifier_register(client_name, domain, nb); |
| 56 | if (ret < 0) |
| 57 | pr_err("%s: Audio notifier register failed for domain %d ret = %d\n", |
| 58 | __func__, domain, ret); |
| 59 | } |
| 60 | |
Laxminath Kasam | 8b1366a | 2017-10-05 01:44:16 +0530 | [diff] [blame^] | 61 | void subsys_notif_deregister(char *client_name) |
| 62 | { |
| 63 | int ret; |
| 64 | |
| 65 | ret = audio_notifier_deregister(client_name); |
| 66 | if (ret < 0) |
| 67 | pr_err("%s: Audio notifier de-register failed for client %s\n", |
| 68 | __func__, client_name); |
| 69 | } |
| 70 | |
Asish Bhattacharya | 8e2277f | 2017-07-20 18:31:55 +0530 | [diff] [blame] | 71 | uint16_t apr_get_reset_domain(uint16_t proc) |
| 72 | { |
| 73 | return APR_DEST_QDSP6; |
| 74 | } |