aboutsummaryrefslogtreecommitdiff
path: root/drivers/misc/mediatek/dual_ccci/include/ccci_pmic.h
blob: c9bf53050a48b890c87b6ab56b75e000a5d8b397 (plain) (blame)
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
76
77
78
79
80
81
82
83
84
#ifndef __CCCI_PMIC_H__
#define __CCCI_PMIC_H__

typedef enum
{
    PMIC6326_VSIM_ENABLE = 0,
    PMIC6326_VSIM_SET_AND_ENABLE = 1,
    PMIC6236_LOCK = 2,
    PMIC6326_UNLOCK = 3,
    PMIC6326_VSIM2_ENABLE = 4,
    PMIC6326_VSIM2_SET_AND_ENABLE = 5,
    PMIC6326_MAX
}pmic6326_ccci_op;

typedef enum
{
    PMIC6326_REQ = 0,        // Local side send request to remote side
    PMIC6326_RES = 1        // Remote side send response to local side
}pmic6326_ccci_type;

/*
    The CCCI message format (CCIF Mailbox port)
    | 4 bytes        | 4 bytes       | 4 bytes            | 4 bytes         |
      Magic number     Message ID      Logical channel      Reserved
                       PMIC msg                             PMIC msg info
*/

/*
    PMIC msg format
    (MSB)                                                      (LSB)
    |  1 byte        | 1 byte        | 1 byte        | 1 byte      |
       Param2          Param1          Type            Op
*/

/*
    PMIC msg info format
    (MSB)                                                (LSB)
    |  1 byte        | 1 byte        | 2 bytes               |
       Param2          Param1          Exec_time
*/



typedef struct
{
    unsigned short    pmic6326_op;        // Operation
    unsigned short    pmic6326_type;        // message type: Request or Response
    unsigned short    pmic6326_param1;
    unsigned short    pmic6326_param2;
}pmic6326_ccci_msg;

typedef struct
{
    unsigned int     pmic6326_exec_time;        // Operation execution time (In ms)
    unsigned short    pmic6326_param1;
    unsigned short    pmic6326_param2;
}pmic6326_ccci_msg_info;

/*
    PMIC share memory
    (MSB)                                                   (LSB)
    |  1 byte        | 1 byte        | 1 byte        | 1 byte   |
       Param2          Param1          Type            Op
    |  1 byte        | 1 byte        | 2 bytes                  |
       Param2          Param1          Exec_time
*/

typedef struct
{
    pmic6326_ccci_msg ccci_msg;
    pmic6326_ccci_msg_info ccci_msg_info;
}pmic6326_share_mem_info;

typedef struct
{
    pmic6326_ccci_msg      ccci_msg;
    pmic6326_ccci_msg_info ccci_msg_info;
} shared_mem_pmic_t;

int __init ccci_pmic_init(void);
void __exit ccci_pmic_exit(void);

#define CCCI_PMIC_SMEM_SIZE sizeof(shared_mem_pmic_t)
#endif // __CCCI_PMIC_H__