aboutsummaryrefslogtreecommitdiff
path: root/include/linux/mdm_ctrl.h
blob: 84ed4ffeb45abdc5396af499e7aaa03407b716db (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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
/*
 * mdm_ctrl.h
 *
 * Intel Mobile Communication modem boot driver
 *
 * Copyright (C) 2012 Intel Corporation. All rights reserved.
 *
 * Contact: Faouaz Tenoutit <faouazx.tenoutit@intel.com>
 *          Frederic Berat <fredericx.berat@intel.com>
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * version 2 as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA
 */
#ifndef _MDM_CTRL_H
#define _MDM_CTRL_H

#include <linux/ioctl.h>

/* Modem state */
enum {
	MDM_CTRL_STATE_UNKNOWN			= 0x0000,
	MDM_CTRL_STATE_OFF			= 0x0001,
	MDM_CTRL_STATE_COLD_BOOT		= 0x0002,
	MDM_CTRL_STATE_WARM_BOOT		= 0x0004,
	MDM_CTRL_STATE_COREDUMP			= 0x0008,
	MDM_CTRL_STATE_IPC_READY		= 0x0010,
	MDM_CTRL_STATE_FW_DOWNLOAD_READY	= 0x0020,
};

/* Backward compatibility with previous patches */
#define MDM_CTRL_STATE_NONE MDM_CTRL_STATE_UNKNOWN

/* Modem hanging up reasons */
enum {
	MDM_CTRL_NO_HU		= 0x00,
	MDM_CTRL_HU_RESET	= 0x01,
	MDM_CTRL_HU_COREDUMP	= 0x02,
};

enum {
	MDM_TIMER_FLASH_ENABLE,
	MDM_TIMER_FLASH_DISABLE,
	MDM_TIMER_DEFAULT
};

/* Supported Modem IDs*/
enum mdm_ctrl_mdm_type {
	MODEM_UNSUP,
	MODEM_2230,
	MODEM_6260,
	MODEM_6268,
	MODEM_6360,
	MODEM_7160,
	MODEM_7260
};

/* Type of modem board */
enum mdm_ctrl_board_type {
	BOARD_UNSUP,
	BOARD_AOB,
	BOARD_NGFF,
	BOARD_PCIE,
};

/* Type of power on control */
enum mdm_ctrl_pwr_on_type {
	POWER_ON_UNSUP,
	POWER_ON_PMIC,
	POWER_ON_GPIO
};
/**
 * struct mdm_ctrl_cmd - Command parameters
 *
 * @timeout: the command timeout duration
 * @curr_state: the current modem state
 * @expected_state: the modem state to wait for
 */
struct mdm_ctrl_cmd {
	unsigned int param;
	unsigned int timeout;
};

/**
 * struct mdm_ctrl_cfg - MCD configuration
 *
 * @board board type
 * @type modem family type
 * @pwr_on_ctrl power on method
 * @usb_hub_ctrl usage of usb hub ctrl
 */
struct mdm_ctrl_cfg {
	enum mdm_ctrl_board_type board;
	enum mdm_ctrl_mdm_type type;
	enum mdm_ctrl_pwr_on_type pwr_on;
	unsigned int usb_hub;
};

#define MDM_CTRL_MAGIC	0x87 /* FIXME: Revisit */

/* IOCTL commands list */
#define MDM_CTRL_POWER_OFF		_IO(MDM_CTRL_MAGIC, 0)
#define MDM_CTRL_POWER_ON		_IO(MDM_CTRL_MAGIC, 1)
#define MDM_CTRL_WARM_RESET		_IO(MDM_CTRL_MAGIC, 2)
#define MDM_CTRL_COLD_RESET		_IO(MDM_CTRL_MAGIC, 3)
#define MDM_CTRL_SET_STATE		_IO(MDM_CTRL_MAGIC, 4)
#define MDM_CTRL_GET_STATE		_IO(MDM_CTRL_MAGIC, 5)
#define MDM_CTRL_RESERVED		_IO(MDM_CTRL_MAGIC, 6)
#define MDM_CTRL_FLASHING_WARM_RESET	_IO(MDM_CTRL_MAGIC, 7)
#define MDM_CTRL_GET_HANGUP_REASONS	_IO(MDM_CTRL_MAGIC, 8)
#define MDM_CTRL_CLEAR_HANGUP_REASONS	_IO(MDM_CTRL_MAGIC, 9)
#define MDM_CTRL_SET_POLLED_STATES	_IO(MDM_CTRL_MAGIC, 10)
#define MDM_CTRL_SET_CFG		_IO(MDM_CTRL_MAGIC, 11)
#define MDM_CTRL_AP_REQ_COREDUMP        _IO(MDM_CTRL_MAGIC, 12)
#endif /* _MDM_CTRL_H */