Sudheer Papothi | d889f1a | 2018-04-06 00:51:48 +0530 | [diff] [blame] | 1 | /* Copyright (c) 2015, 2018 The Linux Foundation. All rights reserved. |
Asish Bhattacharya | 8e2277f | 2017-07-20 18:31:55 +0530 | [diff] [blame] | 2 | * |
| 3 | * This program is free software; you can redistribute it and/or modify |
| 4 | * it under the terms of the GNU General Public License version 2 and |
| 5 | * only version 2 as published by the Free Software Foundation. |
| 6 | * |
| 7 | * This program is distributed in the hope that it will be useful, |
| 8 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 9 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 10 | * GNU General Public License for more details. |
| 11 | */ |
| 12 | #ifndef WSA881X_TEMP_SENSOR_H |
| 13 | #define WSA881X_TEMP_SENSOR_H |
| 14 | |
| 15 | #include <linux/thermal.h> |
| 16 | #include <sound/soc.h> |
| 17 | |
| 18 | struct wsa_temp_register { |
| 19 | u8 d1_msb; |
| 20 | u8 d1_lsb; |
| 21 | u8 d2_msb; |
| 22 | u8 d2_lsb; |
| 23 | u8 dmeas_msb; |
| 24 | u8 dmeas_lsb; |
| 25 | }; |
| 26 | typedef int32_t (*wsa_temp_register_read)(struct snd_soc_codec *codec, |
| 27 | struct wsa_temp_register *wsa_temp_reg); |
| 28 | struct wsa881x_tz_priv { |
| 29 | struct thermal_zone_device *tz_dev; |
| 30 | struct snd_soc_codec *codec; |
| 31 | struct wsa_temp_register *wsa_temp_reg; |
| 32 | char name[80]; |
| 33 | wsa_temp_register_read wsa_temp_reg_read; |
Sudheer Papothi | d889f1a | 2018-04-06 00:51:48 +0530 | [diff] [blame] | 34 | struct notifier_block pm_nb; |
| 35 | atomic_t is_suspend_spk; |
| 36 | int t0_init; |
| 37 | int curr_temp; |
Asish Bhattacharya | 8e2277f | 2017-07-20 18:31:55 +0530 | [diff] [blame] | 38 | }; |
| 39 | |
| 40 | int wsa881x_get_temp(struct thermal_zone_device *tz_dev, int *temp); |
| 41 | int wsa881x_init_thermal(struct wsa881x_tz_priv *tz_pdata); |
| 42 | void wsa881x_deinit_thermal(struct thermal_zone_device *tz_dev); |
| 43 | #endif |