Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit 9f4354d2 authored by Manaf Meethalavalappu Pallikunhi's avatar Manaf Meethalavalappu Pallikunhi
Browse files

msm: thermal: Add support for sensor manager in KTM



Add and export sensor manager framework APIs for kernel clients
who are interested in thermal sensors. Sensor manager allows
multiple clients to set and get notification for a threshold.
Clients can also use multiple sensors to trigger a single
mitigation action.

Below are main sensor manager APIs to monitor sensor thresholds.

1.int sensor_mgr_init_threshold(struct threshold_info *thresh_inp,
			int sensor_id, int32_t high_temp,
			int32_t low_temp,
			void (*callback)(struct therm_threshold *))

API to initialize thresholds data structure for sensor(s) with high
and low thresholds and threshold callback.
@thresh_inp: Client threshold data structure.
@sensor_id: Sensor h/w ID to be monitored. Use MONITOR_ALL_TSENS to
            monitor all temperature sensor.
@high_temp: Trigger threshold value for sensor_id or all sensors.
@low_temp: Clear threshold value for sensor_id or all sensors.
@callback: Callback pointer for threshold notification.

Returns zero on success, negative error number on failure.

2.int sensor_mgr_set_threshold(uint32_t zone_id,
			struct sensor_threshold *threshold)

It sets thermal threshold trips for a sensor.
@zone_id: Thermal zone id for the sensor.
@threshold: Threshold info for the sensor.

Returns which threshold is set on success, negative error number
on failure. MACRO IS_HI_THRESHOLD_SET/IS_LOW_THRESHOLD_SET can be
used to decipher which threshold being set.

3.int sensor_mgr_convert_id_and_set_threshold(
			struct threshold_info *thresh_inp)

It accepts sensor HW id, converts it to sensor zone id and sets
thermal threshold for those sensors listed in threshold info.
@thresh_inp: Client threshold data structure.

Returns zero on success, negative error number on failure.

4.void sensor_mgr_remove_threshold(struct threshold_info *thresh_inp)

It cancels threshold notification and removes threshold from sensor
manager threshold list.
@thresh_inp: Threshold info which needs to be removed.

Change-Id: I916104bde472bd9b45bdb66d81b09cd850e11fba
Signed-off-by: default avatarManaf Meethalavalappu Pallikunhi <manafm@codeaurora.org>
parent c3a7a22a
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment