Protik Biswas | 30f1c28 | 2020-01-07 16:09:23 +0530 | [diff] [blame] | 1 | /* Copyright (c) 2018-2020, The Linux Foundation. All rights reserved. |
Ramesh Yadav Javadi | 43ff877 | 2018-04-06 13:13:53 +0530 | [diff] [blame] | 2 | * |
| 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 Kumar | 51fd240 | 2018-05-15 14:40:20 +0530 | [diff] [blame] | 22 | #define BGCOM_TWM_EXIT 8 |
Ajit Kumar | c43c800 | 2019-05-02 12:51:34 +0530 | [diff] [blame] | 23 | #define BGCOM_BG_APP_RUNNING 9 |
Protik Biswas | 30f1c28 | 2020-01-07 16:09:23 +0530 | [diff] [blame] | 24 | #define BGCOM_ADSP_DOWN2_BG 10 |
Ajit Kumar | f9f4644 | 2020-01-27 17:00:45 +0530 | [diff] [blame] | 25 | #define BGCOM_BG_WEAR_LOAD 11 |
| 26 | #define BGCOM_BG_WEAR_TWM_LOAD 12 |
| 27 | #define BGCOM_BG_WEAR_UNLOAD 13 |
Ramesh Yadav Javadi | 43ff877 | 2018-04-06 13:13:53 +0530 | [diff] [blame] | 28 | #define EXCHANGE_CODE 'V' |
| 29 | |
| 30 | struct 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 | |
| 38 | enum bg_event_type { |
| 39 | BG_BEFORE_POWER_DOWN = 1, |
Ajit Kumar | f9f4644 | 2020-01-27 17:00:45 +0530 | [diff] [blame] | 40 | BG_AFTER_POWER_DOWN, |
| 41 | BG_BEFORE_POWER_UP, |
Ramesh Yadav Javadi | 43ff877 | 2018-04-06 13:13:53 +0530 | [diff] [blame] | 42 | BG_AFTER_POWER_UP, |
| 43 | MODEM_BEFORE_POWER_DOWN, |
| 44 | MODEM_AFTER_POWER_UP, |
Protik Biswas | 30f1c28 | 2020-01-07 16:09:23 +0530 | [diff] [blame] | 45 | ADSP_BEFORE_POWER_DOWN, |
| 46 | ADSP_AFTER_POWER_UP, |
Ganesh Keethol | 4632a3b | 2020-03-04 16:40:54 +0530 | [diff] [blame] | 47 | TWM_BG_AFTER_POWER_UP, |
Ramesh Yadav Javadi | 43ff877 | 2018-04-06 13:13:53 +0530 | [diff] [blame] | 48 | }; |
| 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 Kumar | 51fd240 | 2018-05-15 14:40:20 +0530 | [diff] [blame] | 71 | #define BG_TWM_EXIT \ |
| 72 | _IOWR(EXCHANGE_CODE, BGCOM_TWM_EXIT, \ |
| 73 | struct bg_ui_data) |
Ajit Kumar | c43c800 | 2019-05-02 12:51:34 +0530 | [diff] [blame] | 74 | #define BG_APP_RUNNING \ |
| 75 | _IOWR(EXCHANGE_CODE, BGCOM_BG_APP_RUNNING, \ |
| 76 | struct bg_ui_data) |
Ramesh Yadav Javadi | 43ff877 | 2018-04-06 13:13:53 +0530 | [diff] [blame] | 77 | #define BG_MODEM_DOWN2_BG_DONE \ |
| 78 | _IOWR(EXCHANGE_CODE, BGCOM_MODEM_DOWN2_BG, \ |
| 79 | struct bg_ui_data) |
Ajit Kumar | f9f4644 | 2020-01-27 17:00:45 +0530 | [diff] [blame] | 80 | #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 Biswas | 30f1c28 | 2020-01-07 16:09:23 +0530 | [diff] [blame] | 89 | #define BG_ADSP_DOWN2_BG_DONE \ |
| 90 | _IOWR(EXCHANGE_CODE, BGCOM_ADSP_DOWN2_BG, \ |
| 91 | struct bg_ui_data) |
Ramesh Yadav Javadi | 43ff877 | 2018-04-06 13:13:53 +0530 | [diff] [blame] | 92 | #endif |