blob: 904ec69d520f3640fda45cc660e3178dee7c0b12 [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
Ramesh Yadav Javadi43ff8772018-04-06 13:13:53 +053025#define EXCHANGE_CODE 'V'
26
27struct bg_ui_data {
28 uint64_t __user write;
29 uint64_t __user result;
30 uint32_t bg_address;
31 uint32_t cmd;
32 uint32_t num_of_words;
33};
34
35enum bg_event_type {
36 BG_BEFORE_POWER_DOWN = 1,
37 BG_AFTER_POWER_UP,
38 MODEM_BEFORE_POWER_DOWN,
39 MODEM_AFTER_POWER_UP,
Protik Biswas30f1c282020-01-07 16:09:23 +053040 ADSP_BEFORE_POWER_DOWN,
41 ADSP_AFTER_POWER_UP,
Ramesh Yadav Javadi43ff8772018-04-06 13:13:53 +053042};
43
44#define REG_READ \
45 _IOWR(EXCHANGE_CODE, BGCOM_REG_READ, \
46 struct bg_ui_data)
47#define AHB_READ \
48 _IOWR(EXCHANGE_CODE, BGCOM_AHB_READ, \
49 struct bg_ui_data)
50#define AHB_WRITE \
51 _IOW(EXCHANGE_CODE, BGCOM_AHB_WRITE, \
52 struct bg_ui_data)
53#define SET_SPI_FREE \
54 _IOR(EXCHANGE_CODE, BGCOM_SET_SPI_FREE, \
55 struct bg_ui_data)
56#define SET_SPI_BUSY \
57 _IOR(EXCHANGE_CODE, BGCOM_SET_SPI_BUSY, \
58 struct bg_ui_data)
59#define REG_WRITE \
60 _IOWR(EXCHANGE_CODE, BGCOM_REG_WRITE, \
61 struct bg_ui_data)
62#define BG_SOFT_RESET \
63 _IOWR(EXCHANGE_CODE, BGCOM_SOFT_RESET, \
64 struct bg_ui_data)
Ajit Kumar51fd2402018-05-15 14:40:20 +053065#define BG_TWM_EXIT \
66 _IOWR(EXCHANGE_CODE, BGCOM_TWM_EXIT, \
67 struct bg_ui_data)
Ajit Kumarc43c8002019-05-02 12:51:34 +053068#define BG_APP_RUNNING \
69 _IOWR(EXCHANGE_CODE, BGCOM_BG_APP_RUNNING, \
70 struct bg_ui_data)
Ramesh Yadav Javadi43ff8772018-04-06 13:13:53 +053071#define BG_MODEM_DOWN2_BG_DONE \
72 _IOWR(EXCHANGE_CODE, BGCOM_MODEM_DOWN2_BG, \
73 struct bg_ui_data)
Protik Biswas30f1c282020-01-07 16:09:23 +053074#define BG_ADSP_DOWN2_BG_DONE \
75 _IOWR(EXCHANGE_CODE, BGCOM_ADSP_DOWN2_BG, \
76 struct bg_ui_data)
Ramesh Yadav Javadi43ff8772018-04-06 13:13:53 +053077#endif