Loading...
1/* SPDX-License-Identifier: GPL-2.0 */
2
3/* Copyright (c) 2018, The Linux Foundation. All rights reserved.
4 * Copyright (C) 2018-2022 Linaro Ltd.
5 */
6#ifndef _IPA_QMI_H_
7#define _IPA_QMI_H_
8
9#include <linux/types.h>
10#include <linux/soc/qcom/qmi.h>
11
12struct ipa;
13
14/**
15 * struct ipa_qmi - QMI state associated with an IPA
16 * @client_handle: Used to send an QMI requests to the modem
17 * @server_handle: Used to handle QMI requests from the modem
18 * @modem_sq: QMAP socket address for the modem QMI server
19 * @init_driver_work: Work structure used for INIT_DRIVER message handling
20 * @initial_boot: True if first boot has not yet completed
21 * @uc_ready: True once DRIVER_INIT_COMPLETE request received
22 * @modem_ready: True when INIT_DRIVER response received
23 * @indication_requested: True when INDICATION_REGISTER request received
24 * @indication_sent: True when INIT_COMPLETE indication sent
25 */
26struct ipa_qmi {
27 struct qmi_handle client_handle;
28 struct qmi_handle server_handle;
29
30 /* Information used for the client handle */
31 struct sockaddr_qrtr modem_sq;
32 struct work_struct init_driver_work;
33
34 /* Flags used in negotiating readiness */
35 bool initial_boot;
36 bool uc_ready;
37 bool modem_ready;
38 bool indication_requested;
39 bool indication_sent;
40};
41
42/**
43 * ipa_qmi_setup() - Set up for QMI message exchange
44 * @ipa: IPA pointer
45 *
46 * This is called at the end of ipa_setup(), to prepare for the exchange
47 * of QMI messages that perform a "handshake" between the AP and modem.
48 * When the modem QMI server announces its presence, an AP request message
49 * supplies operating parameters to be used to the modem, and the modem
50 * acknowledges receipt of those parameters. The modem will not touch the
51 * IPA hardware until this handshake is complete.
52 *
53 * If the modem crashes (or shuts down) a new handshake begins when the
54 * modem's QMI server is started again.
55 */
56int ipa_qmi_setup(struct ipa *ipa);
57
58/**
59 * ipa_qmi_teardown() - Tear down IPA QMI handles
60 * @ipa: IPA pointer
61 */
62void ipa_qmi_teardown(struct ipa *ipa);
63
64#endif /* !_IPA_QMI_H_ */
1/* SPDX-License-Identifier: GPL-2.0 */
2
3/* Copyright (c) 2018, The Linux Foundation. All rights reserved.
4 * Copyright (C) 2018-2024 Linaro Ltd.
5 */
6#ifndef _IPA_QMI_H_
7#define _IPA_QMI_H_
8
9#include <linux/types.h>
10#include <linux/workqueue.h>
11
12#include <linux/soc/qcom/qmi.h>
13
14struct ipa;
15
16/**
17 * struct ipa_qmi - QMI state associated with an IPA
18 * @client_handle: Used to send an QMI requests to the modem
19 * @server_handle: Used to handle QMI requests from the modem
20 * @modem_sq: QMAP socket address for the modem QMI server
21 * @init_driver_work: Work structure used for INIT_DRIVER message handling
22 * @initial_boot: True if first boot has not yet completed
23 * @uc_ready: True once DRIVER_INIT_COMPLETE request received
24 * @modem_ready: True when INIT_DRIVER response received
25 * @indication_requested: True when INDICATION_REGISTER request received
26 * @indication_sent: True when INIT_COMPLETE indication sent
27 */
28struct ipa_qmi {
29 struct qmi_handle client_handle;
30 struct qmi_handle server_handle;
31
32 /* Information used for the client handle */
33 struct sockaddr_qrtr modem_sq;
34 struct work_struct init_driver_work;
35
36 /* Flags used in negotiating readiness */
37 bool initial_boot;
38 bool uc_ready;
39 bool modem_ready;
40 bool indication_requested;
41 bool indication_sent;
42};
43
44/**
45 * ipa_qmi_setup() - Set up for QMI message exchange
46 * @ipa: IPA pointer
47 *
48 * This is called at the end of ipa_setup(), to prepare for the exchange
49 * of QMI messages that perform a "handshake" between the AP and modem.
50 * When the modem QMI server announces its presence, an AP request message
51 * supplies operating parameters to be used to the modem, and the modem
52 * acknowledges receipt of those parameters. The modem will not touch the
53 * IPA hardware until this handshake is complete.
54 *
55 * If the modem crashes (or shuts down) a new handshake begins when the
56 * modem's QMI server is started again.
57 */
58int ipa_qmi_setup(struct ipa *ipa);
59
60/**
61 * ipa_qmi_teardown() - Tear down IPA QMI handles
62 * @ipa: IPA pointer
63 */
64void ipa_qmi_teardown(struct ipa *ipa);
65
66#endif /* !_IPA_QMI_H_ */