ipa_qmi.h 2.0 KB

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