qcom_rproc.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
  4. */
  5. #ifndef __QCOM_RPROC_H__
  6. #define __QCOM_RPROC_H__
  7. #include <linux/remoteproc.h>
  8. struct notifier_block;
  9. struct rproc;
  10. #if IS_ENABLED(CONFIG_SEC_SENSORS_SSC)
  11. struct device_node;
  12. #endif
  13. /**
  14. * enum qcom_ssr_notify_type - Startup/Shutdown events related to a remoteproc
  15. * processor.
  16. *
  17. * @QCOM_SSR_BEFORE_POWERUP: Remoteproc about to start (prepare stage)
  18. * @QCOM_SSR_AFTER_POWERUP: Remoteproc is running (start stage)
  19. * @QCOM_SSR_BEFORE_SHUTDOWN: Remoteproc crashed or shutting down (stop stage)
  20. * @QCOM_SSR_AFTER_SHUTDOWN: Remoteproc is down (unprepare stage)
  21. */
  22. enum qcom_ssr_notify_type {
  23. QCOM_SSR_BEFORE_POWERUP,
  24. QCOM_SSR_AFTER_POWERUP,
  25. QCOM_SSR_BEFORE_SHUTDOWN,
  26. QCOM_SSR_AFTER_SHUTDOWN,
  27. };
  28. struct qcom_ssr_notify_data {
  29. const char *name;
  30. bool crashed;
  31. };
  32. #if IS_ENABLED(CONFIG_QCOM_RPROC_COMMON)
  33. void *qcom_register_ssr_notifier(const char *name, struct notifier_block *nb);
  34. void *qcom_register_early_ssr_notifier(const char *name, struct notifier_block *nb);
  35. int qcom_unregister_early_ssr_notifier(void *notify, struct notifier_block *nb);
  36. int qcom_unregister_ssr_notifier(void *notify, struct notifier_block *nb);
  37. int qcom_rproc_set_dtb_firmware(struct rproc *rproc, const char *dtb_fw_name);
  38. int rproc_set_state(struct rproc *rproc, bool state);
  39. #else
  40. static inline void *qcom_register_ssr_notifier(const char *name,
  41. struct notifier_block *nb)
  42. {
  43. return NULL;
  44. }
  45. static inline void *qcom_register_early_ssr_notifier(const char *name, struct notifier_block *nb)
  46. {
  47. return NULL;
  48. }
  49. static inline int qcom_unregister_early_ssr_notifier(void *notify,
  50. struct notifier_block *nb)
  51. {
  52. return 0;
  53. }
  54. static inline int qcom_unregister_ssr_notifier(void *notify,
  55. struct notifier_block *nb)
  56. {
  57. return 0;
  58. }
  59. static inline int qcom_rproc_set_dtb_firmware(struct rproc *rproc, const char *dtb_fw_name)
  60. {
  61. return -EINVAL;
  62. }
  63. static inline int rproc_set_state(struct rproc *rproc, bool state)
  64. {
  65. return 0;
  66. }
  67. #endif
  68. #if IS_ENABLED(CONFIG_SEC_SENSORS_SSC)
  69. int adsp_init_subsensor_regulator(struct rproc *rproc, struct device_node *sub_sns_reg_np);
  70. #endif
  71. #endif