blob: 5c3f963bb07eb0ebc7359461e73edc6d769228c6 [file] [log] [blame]
Rishabh Bhatnagare9a05bb2018-12-10 11:09:45 -08001/* SPDX-License-Identifier: GPL-2.0-only */
Rishabh Bhatnagarf2e94fd2018-05-23 16:58:07 -07002/*
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
12struct 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 */
26struct 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 */
35struct esoc_desc *devm_register_esoc_client(struct device *dev,
36 const char *name);
37void devm_unregister_esoc_client(struct device *dev,
38 struct esoc_desc *esoc_desc);
39int esoc_register_client_notifier(struct notifier_block *nb);
40int esoc_register_client_hook(struct esoc_desc *desc,
41 struct esoc_client_hook *client_hook);
42int esoc_unregister_client_hook(struct esoc_desc *desc,
43 struct esoc_client_hook *client_hook);
44#else
45static inline struct esoc_desc *devm_register_esoc_client(struct device *dev,
46 const char *name)
47{
48 return NULL;
49}
50static inline void devm_unregister_esoc_client(struct device *dev,
51 struct esoc_desc *esoc_desc)
52{
53}
54static inline int esoc_register_client_notifier(struct notifier_block *nb)
55{
56 return -EIO;
57}
58static inline int esoc_register_client_hook(struct esoc_desc *desc,
59 struct esoc_client_hook *client_hook)
60{
61 return -EIO;
62}
63static 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