esoc_client.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Copyright (c) 2014, 2017-2020, The Linux Foundation. All rights reserved.
  4. * Copyright (c) 2022, Qualcomm Innovation Center, Inc. All rights reserved.
  5. */
  6. #ifndef __ESOC_CLIENT_H_
  7. #define __ESOC_CLIENT_H_
  8. #include <linux/device.h>
  9. #include <linux/esoc_ctrl.h>
  10. #include <linux/notifier.h>
  11. /* Flag values used with the power_on and power_off hooks */
  12. #define ESOC_HOOK_MDM_CRASH 0x0001 /* In crash handling path */
  13. #define ESOC_HOOK_MDM_DOWN 0x0002 /* MDM about to go down */
  14. struct esoc_client_hook {
  15. char *name;
  16. void *priv;
  17. enum esoc_client_hook_prio prio;
  18. int (*esoc_link_power_on)(void *priv, unsigned int flags);
  19. void (*esoc_link_power_off)(void *priv, unsigned int flags);
  20. u64 (*esoc_link_get_id)(void *priv);
  21. void (*esoc_link_mdm_crash)(void *priv);
  22. };
  23. /*
  24. * struct esoc_desc: Describes an external soc
  25. * @name: external soc name
  26. * @priv: private data for external soc
  27. */
  28. struct esoc_desc {
  29. const char *name;
  30. const char *link;
  31. const char *link_info;
  32. void *priv;
  33. };
  34. #if IS_ENABLED(CONFIG_QCOM_ESOC_CLIENT)
  35. /* Can return probe deferral */
  36. struct esoc_desc *devm_register_esoc_client(struct device *dev,
  37. const char *name);
  38. void devm_unregister_esoc_client(struct device *dev,
  39. struct esoc_desc *esoc_desc);
  40. int esoc_register_client_notifier(struct notifier_block *nb);
  41. int esoc_register_client_hook(struct esoc_desc *desc,
  42. struct esoc_client_hook *client_hook);
  43. int esoc_unregister_client_hook(struct esoc_desc *desc,
  44. struct esoc_client_hook *client_hook);
  45. #else
  46. struct esoc_desc *devm_register_esoc_client(struct device *dev,
  47. const char *name)
  48. {
  49. return NULL;
  50. }
  51. void devm_unregister_esoc_client(struct device *dev,
  52. struct esoc_desc *esoc_desc)
  53. {
  54. }
  55. int esoc_register_client_notifier(struct notifier_block *nb)
  56. {
  57. return -EPERM;
  58. }
  59. int esoc_register_client_hook(struct esoc_desc *desc,
  60. struct esoc_client_hook *client_hook)
  61. {
  62. return -EPERM;
  63. }
  64. int esoc_unregister_client_hook(struct esoc_desc *desc,
  65. struct esoc_client_hook *client_hook)
  66. {
  67. return -EPERM;
  68. }
  69. #endif
  70. #endif