Meng Wang | 688a867 | 2019-01-29 13:43:33 +0800 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
Meng Wang | 61af684 | 2018-09-10 17:47:55 +0800 | [diff] [blame] | 2 | /* |
| 3 | * Copyright (c) 2016, The Linux Foundation. All rights reserved. |
Asish Bhattacharya | 8e2277f | 2017-07-20 18:31:55 +0530 | [diff] [blame] | 4 | */ |
| 5 | |
| 6 | #ifndef __AUDIO_SSR_H_ |
| 7 | #define __AUDIO_SSR_H_ |
| 8 | |
| 9 | enum { |
| 10 | AUDIO_SSR_DOMAIN_ADSP, |
| 11 | AUDIO_SSR_DOMAIN_MODEM, |
| 12 | AUDIO_SSR_DOMAIN_MAX |
| 13 | }; |
| 14 | |
| 15 | #ifdef CONFIG_MSM_QDSP6_SSR |
| 16 | |
| 17 | /* |
| 18 | * Use audio_ssr_register to register with the SSR subsystem |
| 19 | * |
| 20 | * domain_id - Service to use, example: AUDIO_SSR_DOMAIN_ADSP |
| 21 | * *nb - Pointer to a notifier block. Provide a callback function |
| 22 | * to be notified of an event for that service. The ioctls |
| 23 | * used by the callback are defined in subsystem_notif.h. |
| 24 | * |
| 25 | * Returns: Success: Client handle |
| 26 | * Failure: Pointer error code |
| 27 | */ |
| 28 | void *audio_ssr_register(int domain_id, struct notifier_block *nb); |
| 29 | |
| 30 | /* |
| 31 | * Use audio_ssr_deregister to register with the SSR subsystem |
| 32 | * |
| 33 | * handle - Handle received from audio_ssr_register |
| 34 | * *nb - Pointer to a notifier block. Callback function |
| 35 | * Used from audio_ssr_register. |
| 36 | * |
| 37 | * Returns: Success: 0 |
| 38 | * Failure: Error code |
| 39 | */ |
| 40 | int audio_ssr_deregister(void *handle, struct notifier_block *nb); |
| 41 | |
| 42 | |
| 43 | /* |
| 44 | * Use audio_ssr_send_nmi to force a RAM dump on ADSP |
| 45 | * down event. |
| 46 | * |
| 47 | * *ssr_cb_data - *data received from notifier callback |
| 48 | */ |
| 49 | void audio_ssr_send_nmi(void *ssr_cb_data); |
| 50 | |
| 51 | #else |
| 52 | |
| 53 | static inline void *audio_ssr_register(int domain_id, |
| 54 | struct notifier_block *nb) |
| 55 | { |
| 56 | return NULL; |
| 57 | } |
| 58 | |
| 59 | static inline int audio_ssr_deregister(void *handle, struct notifier_block *nb) |
| 60 | { |
| 61 | return 0; |
| 62 | } |
| 63 | |
| 64 | static inline void audio_ssr_send_nmi(void *ssr_cb_data) |
| 65 | { |
| 66 | } |
| 67 | |
| 68 | #endif /* CONFIG_MSM_QDSP6_SSR */ |
| 69 | |
| 70 | #endif |