From 9b7489584281df171c56ea3ae37c1e3710dd2095 Mon Sep 17 00:00:00 2001 From: Siddartha Mohanadoss Date: Wed, 29 Apr 2015 09:51:50 -0700 Subject: thermal: tsens: TSENS driver fixups Add TSENS Thermal driver. Include support to activate a trip type and mode. This snapshot is taken as of msm-3.14 commit 3bc54cf86b (Merge "msm: camera: Add dummy sub module in sensor pipeline") Signed-off-by: Siddartha Mohanadoss Conflicts: drivers/thermal/Kconfig drivers/thermal/Makefile include/linux/thermal.h Change-Id: Ie8a089afc0cf9e45ac000dff425a3e6206c1b9b1 --- include/linux/msm_tsens.h | 69 +++++++++++++++++++++++++++++++++++++++++++++++ include/linux/thermal.h | 10 +++++++ 2 files changed, 79 insertions(+) create mode 100644 include/linux/msm_tsens.h (limited to 'include/linux') diff --git a/include/linux/msm_tsens.h b/include/linux/msm_tsens.h new file mode 100644 index 000000000000..3dfe78b2c29b --- /dev/null +++ b/include/linux/msm_tsens.h @@ -0,0 +1,69 @@ +/* + * Copyright (c) 2011-2014, The Linux Foundation. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 and + * only version 2 as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ +/* + * Qualcomm TSENS Header file + * + */ + +#ifndef __MSM_TSENS_H +#define __MSM_TSENS_H + +enum platform_type { + MSM_8660 = 0, + MSM_8960, + MDM_9615, + APQ_8064, + MSM_TYPE +}; + +#define TSENS_MAX_SENSORS 11 + +struct tsens_platform_data { + int slope[TSENS_MAX_SENSORS]; + int tsens_factor; + uint32_t tsens_num_sensor; + enum platform_type hw_type; +}; + +struct tsens_device { + uint32_t sensor_num; +}; + +int32_t tsens_get_temp(struct tsens_device *dev, unsigned long *temp); +int msm_tsens_early_init(struct tsens_platform_data *pdata); + +#if defined(CONFIG_THERMAL_TSENS8974) +int tsens_is_ready(void); +int __init tsens_tm_init_driver(void); +int tsens_get_sw_id_mapping(int sensor_num, int *sensor_sw_idx); +int tsens_get_hw_id_mapping(int sensor_sw_id, int *sensor_hw_num); +#else +static inline int tsens_is_ready(void) +{ return -ENXIO; } +static inline int __init tsens_tm_init_driver(void) +{ return -ENXIO; } +static inline int tsens_get_sw_id_mapping( + int sensor_num, int *sensor_sw_idx) +{ return -ENXIO; } +static inline int tsens_get_hw_id_mapping( + int sensor_sw_id, int *sensor_hw_num) +{ return -ENXIO; } +#endif + +#if defined(CONFIG_THERMAL_TSENS8974) +int tsens_get_max_sensor_num(uint32_t *tsens_num_sensors); +#else +static inline int tsens_get_max_sensor_num(uint32_t *tsens_num_sensors) +{ return -ENXIO; } +#endif +#endif /*MSM_TSENS_H */ diff --git a/include/linux/thermal.h b/include/linux/thermal.h index 613c29bd6baf..f11670b48878 100644 --- a/include/linux/thermal.h +++ b/include/linux/thermal.h @@ -74,11 +74,19 @@ enum thermal_device_mode { THERMAL_DEVICE_ENABLED, }; +enum thermal_trip_activation_mode { + THERMAL_TRIP_ACTIVATION_DISABLED = 0, + THERMAL_TRIP_ACTIVATION_ENABLED, +}; + enum thermal_trip_type { THERMAL_TRIP_ACTIVE = 0, THERMAL_TRIP_PASSIVE, THERMAL_TRIP_HOT, THERMAL_TRIP_CRITICAL, + THERMAL_TRIP_CONFIGURABLE_HI, + THERMAL_TRIP_CONFIGURABLE_LOW, + THERMAL_TRIP_CRITICAL_LOW, }; enum thermal_trend { @@ -107,6 +115,8 @@ struct thermal_zone_device_ops { int (*set_trip_hyst) (struct thermal_zone_device *, int, int); int (*get_crit_temp) (struct thermal_zone_device *, int *); int (*set_emul_temp) (struct thermal_zone_device *, int); + int (*activate_trip_type) (struct thermal_zone_device *, int, + enum thermal_trip_activation_mode); int (*get_trend) (struct thermal_zone_device *, int, enum thermal_trend *); int (*notify) (struct thermal_zone_device *, int, -- cgit v1.2.3