thermal_minidump.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
  4. */
  5. #ifndef __QCOM_THERMAL_MINIDUMP_H__
  6. #define __QCOM_THERMAL_MINIDUMP_H__
  7. #include <linux/kernel.h>
  8. #include <linux/thermal.h>
  9. #include <linux/types.h>
  10. #include <soc/qcom/minidump.h>
  11. /* The amount of thermal data stored in the minidump */
  12. #define MD_NUM 50
  13. struct sensor_type {
  14. char sensor_type[THERMAL_NAME_LENGTH];
  15. };
  16. /**
  17. * struct minidump_data - Thermal data stored in minidump
  18. * @type: The type of sensor, this data must be the second item
  19. * of the structure, otherwise the parsing will fail
  20. * @temp: The temp of sensor, this data must be the second item
  21. * of the structure, otherwise the parsing will fail
  22. * @md_count: flag for minidump data store count, this data must
  23. * be the third item of the structure, otherwise the
  24. * parsing will fail
  25. * @md_entry: Minidump table entry
  26. * @region: region number, entry position in minidump tables
  27. */
  28. struct minidump_data {
  29. struct sensor_type type[MD_NUM];
  30. int temp[MD_NUM];
  31. u32 md_count;
  32. struct md_region md_entry;
  33. int region;
  34. spinlock_t update_md_lock;
  35. };
  36. #if IS_ENABLED(CONFIG_QTI_THERMAL_MINIDUMP)
  37. int thermal_minidump_update_data(struct minidump_data *md,
  38. char *type, int *temp);
  39. struct minidump_data *thermal_minidump_register(const char *name);
  40. void thermal_minidump_unregister(struct minidump_data *md);
  41. #else
  42. static inline int thermal_minidump_update_data(
  43. struct minidump_data *md, char *type, int *temp)
  44. { return -ENXIO; }
  45. static inline struct minidump_data *thermal_minidump_register(const char *name)
  46. { return NULL; }
  47. static inline void thermal_minidump_unregister(struct minidump_data *md) { }
  48. #endif
  49. #endif