Banajit Goswami | 0530e2f | 2016-12-09 21:34:37 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2012-2017 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> |
| 18 | #include <linux/qdsp6v2/apr.h> |
| 19 | #include <linux/qdsp6v2/apr_tal.h> |
| 20 | #include <linux/qdsp6v2/dsp_debug.h> |
| 21 | #include <linux/qdsp6v2/audio_notifier.h> |
| 22 | |
| 23 | enum apr_subsys_state apr_get_subsys_state(void) |
| 24 | { |
| 25 | return apr_get_q6_state(); |
| 26 | } |
| 27 | |
| 28 | void apr_set_subsys_state(void) |
| 29 | { |
| 30 | apr_set_q6_state(APR_SUBSYS_DOWN); |
| 31 | apr_set_modem_state(APR_SUBSYS_UP); |
| 32 | } |
| 33 | |
| 34 | uint16_t apr_get_data_src(struct apr_hdr *hdr) |
| 35 | { |
| 36 | if (hdr->src_domain == APR_DOMAIN_MODEM) |
| 37 | return APR_DEST_MODEM; |
| 38 | else if (hdr->src_domain == APR_DOMAIN_ADSP) |
| 39 | return APR_DEST_QDSP6; |
| 40 | |
| 41 | pr_err("APR: Pkt from wrong source: %d\n", hdr->src_domain); |
| 42 | return APR_DEST_MAX; /*RETURN INVALID VALUE*/ |
| 43 | } |
| 44 | |
| 45 | int apr_get_dest_id(char *dest) |
| 46 | { |
| 47 | if (!strcmp(dest, "ADSP")) |
| 48 | return APR_DEST_QDSP6; |
| 49 | else |
| 50 | return APR_DEST_MODEM; |
| 51 | } |
| 52 | |
| 53 | void subsys_notif_register(char *client_name, int domain, |
| 54 | struct notifier_block *nb) |
| 55 | { |
| 56 | int ret; |
| 57 | |
| 58 | ret = audio_notifier_register(client_name, domain, nb); |
| 59 | if (ret < 0) |
| 60 | pr_err("%s: Audio notifier register failed for domain %d ret = %d\n", |
| 61 | __func__, domain, ret); |
| 62 | } |
| 63 | |
| 64 | uint16_t apr_get_reset_domain(uint16_t proc) |
| 65 | { |
| 66 | return proc; |
| 67 | } |