Asish Bhattacharya | 8e2277f | 2017-07-20 18:31:55 +0530 | [diff] [blame] | 1 | /* Copyright (c) 2016, The Linux Foundation. All rights reserved. |
| 2 | * |
| 3 | * This program is free software; you can redistribute it and/or modify |
| 4 | * it under the terms of the GNU General Public License version 2 and |
| 5 | * only version 2 as published by the Free Software Foundation. |
| 6 | * |
| 7 | * This program is distributed in the hope that it will be useful, |
| 8 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 9 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 10 | * GNU General Public License for more details. |
| 11 | * |
| 12 | */ |
| 13 | |
| 14 | #ifndef __AUDIO_SSR_H_ |
| 15 | #define __AUDIO_SSR_H_ |
| 16 | |
| 17 | enum { |
| 18 | AUDIO_SSR_DOMAIN_ADSP, |
| 19 | AUDIO_SSR_DOMAIN_MODEM, |
| 20 | AUDIO_SSR_DOMAIN_MAX |
| 21 | }; |
| 22 | |
| 23 | #ifdef CONFIG_MSM_QDSP6_SSR |
| 24 | |
| 25 | /* |
| 26 | * Use audio_ssr_register to register with the SSR subsystem |
| 27 | * |
| 28 | * domain_id - Service to use, example: AUDIO_SSR_DOMAIN_ADSP |
| 29 | * *nb - Pointer to a notifier block. Provide a callback function |
| 30 | * to be notified of an event for that service. The ioctls |
| 31 | * used by the callback are defined in subsystem_notif.h. |
| 32 | * |
| 33 | * Returns: Success: Client handle |
| 34 | * Failure: Pointer error code |
| 35 | */ |
| 36 | void *audio_ssr_register(int domain_id, struct notifier_block *nb); |
| 37 | |
| 38 | /* |
| 39 | * Use audio_ssr_deregister to register with the SSR subsystem |
| 40 | * |
| 41 | * handle - Handle received from audio_ssr_register |
| 42 | * *nb - Pointer to a notifier block. Callback function |
| 43 | * Used from audio_ssr_register. |
| 44 | * |
| 45 | * Returns: Success: 0 |
| 46 | * Failure: Error code |
| 47 | */ |
| 48 | int audio_ssr_deregister(void *handle, struct notifier_block *nb); |
| 49 | |
| 50 | |
| 51 | /* |
| 52 | * Use audio_ssr_send_nmi to force a RAM dump on ADSP |
| 53 | * down event. |
| 54 | * |
| 55 | * *ssr_cb_data - *data received from notifier callback |
| 56 | */ |
| 57 | void audio_ssr_send_nmi(void *ssr_cb_data); |
| 58 | |
| 59 | #else |
| 60 | |
| 61 | static inline void *audio_ssr_register(int domain_id, |
| 62 | struct notifier_block *nb) |
| 63 | { |
| 64 | return NULL; |
| 65 | } |
| 66 | |
| 67 | static inline int audio_ssr_deregister(void *handle, struct notifier_block *nb) |
| 68 | { |
| 69 | return 0; |
| 70 | } |
| 71 | |
| 72 | static inline void audio_ssr_send_nmi(void *ssr_cb_data) |
| 73 | { |
| 74 | } |
| 75 | |
| 76 | #endif /* CONFIG_MSM_QDSP6_SSR */ |
| 77 | |
| 78 | #endif |