blob: 17130ec116b0f8af85a63af1abfa8e8f5feb94e3 [file] [log] [blame]
Protik Biswas30f1c282020-01-07 16:09:23 +05301/* Copyright (c) 2018-2020, The Linux Foundation. All rights reserved.
Ramesh Yadav Javadi43ff8772018-04-06 13:13:53 +05302 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License version 2 and
5 * only version 2 as published by the Free Software Foundation.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
10 * GNU General Public License for more details.
11 */
12#ifndef LINUX_BG_CHAR_H
13#define LINUX_BG_CHAR_H
14#define BGCOM_REG_READ 0
15#define BGCOM_AHB_READ 1
16#define BGCOM_AHB_WRITE 2
17#define BGCOM_SET_SPI_FREE 3
18#define BGCOM_SET_SPI_BUSY 4
19#define BGCOM_REG_WRITE 5
20#define BGCOM_SOFT_RESET 6
21#define BGCOM_MODEM_DOWN2_BG 7
Ajit Kumar51fd2402018-05-15 14:40:20 +053022#define BGCOM_TWM_EXIT 8
Ajit Kumarc43c8002019-05-02 12:51:34 +053023#define BGCOM_BG_APP_RUNNING 9
Protik Biswas30f1c282020-01-07 16:09:23 +053024#define BGCOM_ADSP_DOWN2_BG 10
Ajit Kumarf9f46442020-01-27 17:00:45 +053025#define BGCOM_BG_WEAR_LOAD 11
26#define BGCOM_BG_WEAR_TWM_LOAD 12
27#define BGCOM_BG_WEAR_UNLOAD 13
Ramesh Yadav Javadi43ff8772018-04-06 13:13:53 +053028#define EXCHANGE_CODE 'V'
29
30struct bg_ui_data {
31 uint64_t __user write;
32 uint64_t __user result;
33 uint32_t bg_address;
34 uint32_t cmd;
35 uint32_t num_of_words;
36};
37
38enum bg_event_type {
39 BG_BEFORE_POWER_DOWN = 1,
Ajit Kumarf9f46442020-01-27 17:00:45 +053040 BG_AFTER_POWER_DOWN,
41 BG_BEFORE_POWER_UP,
Ramesh Yadav Javadi43ff8772018-04-06 13:13:53 +053042 BG_AFTER_POWER_UP,
43 MODEM_BEFORE_POWER_DOWN,
44 MODEM_AFTER_POWER_UP,
Protik Biswas30f1c282020-01-07 16:09:23 +053045 ADSP_BEFORE_POWER_DOWN,
46 ADSP_AFTER_POWER_UP,
Ganesh Keethol4632a3b2020-03-04 16:40:54 +053047 TWM_BG_AFTER_POWER_UP,
Ramesh Yadav Javadi43ff8772018-04-06 13:13:53 +053048};
49
50#define REG_READ \
51 _IOWR(EXCHANGE_CODE, BGCOM_REG_READ, \
52 struct bg_ui_data)
53#define AHB_READ \
54 _IOWR(EXCHANGE_CODE, BGCOM_AHB_READ, \
55 struct bg_ui_data)
56#define AHB_WRITE \
57 _IOW(EXCHANGE_CODE, BGCOM_AHB_WRITE, \
58 struct bg_ui_data)
59#define SET_SPI_FREE \
60 _IOR(EXCHANGE_CODE, BGCOM_SET_SPI_FREE, \
61 struct bg_ui_data)
62#define SET_SPI_BUSY \
63 _IOR(EXCHANGE_CODE, BGCOM_SET_SPI_BUSY, \
64 struct bg_ui_data)
65#define REG_WRITE \
66 _IOWR(EXCHANGE_CODE, BGCOM_REG_WRITE, \
67 struct bg_ui_data)
68#define BG_SOFT_RESET \
69 _IOWR(EXCHANGE_CODE, BGCOM_SOFT_RESET, \
70 struct bg_ui_data)
Ajit Kumar51fd2402018-05-15 14:40:20 +053071#define BG_TWM_EXIT \
72 _IOWR(EXCHANGE_CODE, BGCOM_TWM_EXIT, \
73 struct bg_ui_data)
Ajit Kumarc43c8002019-05-02 12:51:34 +053074#define BG_APP_RUNNING \
75 _IOWR(EXCHANGE_CODE, BGCOM_BG_APP_RUNNING, \
76 struct bg_ui_data)
Ramesh Yadav Javadi43ff8772018-04-06 13:13:53 +053077#define BG_MODEM_DOWN2_BG_DONE \
78 _IOWR(EXCHANGE_CODE, BGCOM_MODEM_DOWN2_BG, \
79 struct bg_ui_data)
Ajit Kumarf9f46442020-01-27 17:00:45 +053080#define BG_WEAR_LOAD \
81 _IOWR(EXCHANGE_CODE, BGCOM_BG_WEAR_LOAD, \
82 struct bg_ui_data)
83#define BG_WEAR_TWM_LOAD \
84 _IOWR(EXCHANGE_CODE, BGCOM_BG_WEAR_TWM_LOAD, \
85 struct bg_ui_data)
86#define BG_WEAR_UNLOAD \
87 _IOWR(EXCHANGE_CODE, BGCOM_BG_WEAR_UNLOAD, \
88 struct bg_ui_data)
Protik Biswas30f1c282020-01-07 16:09:23 +053089#define BG_ADSP_DOWN2_BG_DONE \
90 _IOWR(EXCHANGE_CODE, BGCOM_ADSP_DOWN2_BG, \
91 struct bg_ui_data)
Ramesh Yadav Javadi43ff8772018-04-06 13:13:53 +053092#endif