blob: ea0b102a484bef2ca11a9bdfae915ec563dc9673 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
|
/* SPDX-License-Identifier: GPL-2.0-only */
/*
* Copyright (c) 2019-2020, The Linux Foundation. All rights reserved.
*/
#ifndef _PMIC_GLINK_H
#define _PMIC_GLINK_H
#include <linux/types.h>
struct pmic_glink_client;
struct device;
enum pmic_glink_state {
PMIC_GLINK_STATE_DOWN,
PMIC_GLINK_STATE_UP,
};
/**
* struct pmic_glink_client_data - pmic_glink client data
* @name: Client name
* @id: Unique id for client for communication
* @priv: private data for client
* @msg_cb: callback function for client to receive the messages that
* are intended to be delivered to it over PMIC Glink
* @state_cb: callback function to notify pmic glink state in the event of
* a subsystem restart (SSR) or a protection domain restart (PDR)
*/
struct pmic_glink_client_data {
const char *name;
u32 id;
void *priv;
int (*msg_cb)(void *priv, void *data, size_t len);
void (*state_cb)(void *priv, enum pmic_glink_state state);
};
/**
* struct pmic_glink_hdr - PMIC Glink message header
* @owner: message owner for a client
* @type: message type
* @opcode: message opcode
*/
struct pmic_glink_hdr {
u32 owner;
u32 type;
u32 opcode;
};
#if IS_ENABLED(CONFIG_QTI_PMIC_GLINK)
struct pmic_glink_client *pmic_glink_register_client(struct device *dev,
const struct pmic_glink_client_data *client_data);
int pmic_glink_unregister_client(struct pmic_glink_client *client);
int pmic_glink_write(struct pmic_glink_client *client, void *data,
size_t len);
#else
static inline struct pmic_glink_client *pmic_glink_register_client(
struct device *dev,
const struct pmic_glink_client_data *client_data)
{
return ERR_PTR(-ENODEV);
}
static inline int pmic_glink_unregister_client(struct pmic_glink_client *client)
{
return -ENODEV;
}
static inline int pmic_glink_write(struct pmic_glink_client *client, void *data,
size_t len)
{
return -ENODEV;
}
#endif
#endif
|