wsa881x-temp-sensor.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /* Copyright (c) 2015, 2018, 2020 The Linux Foundation. All rights reserved.
  3. */
  4. #ifndef WSA881X_TEMP_SENSOR_H
  5. #define WSA881X_TEMP_SENSOR_H
  6. #include <linux/thermal.h>
  7. #include <sound/soc.h>
  8. struct wsa_temp_register {
  9. u8 d1_msb;
  10. u8 d1_lsb;
  11. u8 d2_msb;
  12. u8 d2_lsb;
  13. u8 dmeas_msb;
  14. u8 dmeas_lsb;
  15. };
  16. typedef int32_t (*wsa_temp_register_read)(struct snd_soc_component *component,
  17. struct wsa_temp_register *wsa_temp_reg);
  18. struct wsa881x_tz_priv {
  19. struct thermal_zone_device *tz_dev;
  20. struct snd_soc_component *component;
  21. struct wsa_temp_register *wsa_temp_reg;
  22. char name[80];
  23. wsa_temp_register_read wsa_temp_reg_read;
  24. struct notifier_block pm_nb;
  25. atomic_t is_suspend_spk;
  26. int t0_init;
  27. int curr_temp;
  28. };
  29. #ifndef CONFIG_WSA881X_TEMP_SENSOR_DISABLE
  30. int wsa881x_init_thermal(struct wsa881x_tz_priv *tz_pdata);
  31. void wsa881x_deinit_thermal(struct thermal_zone_device *tz_dev);
  32. int wsa881x_get_temp(struct thermal_zone_device *tz_dev, int *temp);
  33. #else
  34. int wsa881x_init_thermal(struct wsa881x_tz_priv *tz_pdata){ return 0; }
  35. void wsa881x_deinit_thermal(struct thermal_zone_device *tz_dev){}
  36. int wsa881x_get_temp(struct thermal_zone_device *tz_dev, int *temp){ return 0; }
  37. #endif
  38. #endif