Rishabh Bhatnagar | e9a05bb | 2018-12-10 11:09:45 -0800 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
Rishabh Bhatnagar | f2e94fd | 2018-05-23 16:58:07 -0700 | [diff] [blame] | 2 | /* |
| 3 | * Copyright (c) 2014, 2017-2018, The Linux Foundation. All rights reserved. |
| 4 | */ |
| 5 | #ifndef __ESOC_CLIENT_H_ |
| 6 | #define __ESOC_CLIENT_H_ |
| 7 | |
| 8 | #include <linux/device.h> |
| 9 | #include <linux/esoc_ctrl.h> |
| 10 | #include <linux/notifier.h> |
| 11 | |
| 12 | struct esoc_client_hook { |
| 13 | char *name; |
| 14 | void *priv; |
| 15 | enum esoc_client_hook_prio prio; |
| 16 | int (*esoc_link_power_on)(void *priv, bool mdm_crashed); |
| 17 | void (*esoc_link_power_off)(void *priv, bool mdm_crashed); |
| 18 | u64 (*esoc_link_get_id)(void *priv); |
| 19 | }; |
| 20 | |
| 21 | /* |
| 22 | * struct esoc_desc: Describes an external soc |
| 23 | * @name: external soc name |
| 24 | * @priv: private data for external soc |
| 25 | */ |
| 26 | struct esoc_desc { |
| 27 | const char *name; |
| 28 | const char *link; |
| 29 | const char *link_info; |
| 30 | void *priv; |
| 31 | }; |
| 32 | |
| 33 | #ifdef CONFIG_ESOC_CLIENT |
| 34 | /* Can return probe deferral */ |
| 35 | struct esoc_desc *devm_register_esoc_client(struct device *dev, |
| 36 | const char *name); |
| 37 | void devm_unregister_esoc_client(struct device *dev, |
| 38 | struct esoc_desc *esoc_desc); |
| 39 | int esoc_register_client_notifier(struct notifier_block *nb); |
| 40 | int esoc_register_client_hook(struct esoc_desc *desc, |
| 41 | struct esoc_client_hook *client_hook); |
| 42 | int esoc_unregister_client_hook(struct esoc_desc *desc, |
| 43 | struct esoc_client_hook *client_hook); |
| 44 | #else |
| 45 | static inline struct esoc_desc *devm_register_esoc_client(struct device *dev, |
| 46 | const char *name) |
| 47 | { |
| 48 | return NULL; |
| 49 | } |
| 50 | static inline void devm_unregister_esoc_client(struct device *dev, |
| 51 | struct esoc_desc *esoc_desc) |
| 52 | { |
| 53 | } |
| 54 | static inline int esoc_register_client_notifier(struct notifier_block *nb) |
| 55 | { |
| 56 | return -EIO; |
| 57 | } |
| 58 | static inline int esoc_register_client_hook(struct esoc_desc *desc, |
| 59 | struct esoc_client_hook *client_hook) |
| 60 | { |
| 61 | return -EIO; |
| 62 | } |
| 63 | static inline int esoc_unregister_client_hook(struct esoc_desc *desc, |
| 64 | struct esoc_client_hook *client_hook) |
| 65 | { |
| 66 | return -EIO; |
| 67 | } |
| 68 | #endif |
| 69 | #endif |