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