Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

at v5.1-rc2 99 lines 2.7 kB view raw
1/* SPDX-License-Identifier: GPL-2.0 */ 2/* 3 * Copyright (c) 2015, The Linux Foundation. All rights reserved. 4 */ 5 6#ifndef __QCOM_TSENS_H__ 7#define __QCOM_TSENS_H__ 8 9#define ONE_PT_CALIB 0x1 10#define ONE_PT_CALIB2 0x2 11#define TWO_PT_CALIB 0x3 12 13#include <linux/thermal.h> 14 15struct tsens_device; 16 17struct tsens_sensor { 18 struct tsens_device *tmdev; 19 struct thermal_zone_device *tzd; 20 int offset; 21 int id; 22 int hw_id; 23 int slope; 24 u32 status; 25}; 26 27/** 28 * struct tsens_ops - operations as supported by the tsens device 29 * @init: Function to initialize the tsens device 30 * @calibrate: Function to calibrate the tsens device 31 * @get_temp: Function which returns the temp in millidegC 32 * @enable: Function to enable (clocks/power) tsens device 33 * @disable: Function to disable the tsens device 34 * @suspend: Function to suspend the tsens device 35 * @resume: Function to resume the tsens device 36 * @get_trend: Function to get the thermal/temp trend 37 */ 38struct tsens_ops { 39 /* mandatory callbacks */ 40 int (*init)(struct tsens_device *); 41 int (*calibrate)(struct tsens_device *); 42 int (*get_temp)(struct tsens_device *, int, int *); 43 /* optional callbacks */ 44 int (*enable)(struct tsens_device *, int); 45 void (*disable)(struct tsens_device *); 46 int (*suspend)(struct tsens_device *); 47 int (*resume)(struct tsens_device *); 48 int (*get_trend)(struct tsens_device *, int, enum thermal_trend *); 49}; 50 51enum reg_list { 52 SROT_CTRL_OFFSET, 53 54 REG_ARRAY_SIZE, 55}; 56 57/** 58 * struct tsens_data - tsens instance specific data 59 * @num_sensors: Max number of sensors supported by platform 60 * @ops: operations the tsens instance supports 61 * @hw_ids: Subset of sensors ids supported by platform, if not the first n 62 * @reg_offsets: Register offsets for commonly used registers 63 */ 64struct tsens_data { 65 const u32 num_sensors; 66 const struct tsens_ops *ops; 67 const u16 reg_offsets[REG_ARRAY_SIZE]; 68 unsigned int *hw_ids; 69}; 70 71/* Registers to be saved/restored across a context loss */ 72struct tsens_context { 73 int threshold; 74 int control; 75}; 76 77struct tsens_device { 78 struct device *dev; 79 u32 num_sensors; 80 struct regmap *tm_map; 81 struct regmap *srot_map; 82 u32 tm_offset; 83 u16 reg_offsets[REG_ARRAY_SIZE]; 84 struct tsens_context ctx; 85 const struct tsens_ops *ops; 86 struct tsens_sensor sensor[0]; 87}; 88 89char *qfprom_read(struct device *, const char *); 90void compute_intercept_slope(struct tsens_device *, u32 *, u32 *, u32); 91int init_common(struct tsens_device *); 92int get_temp_common(struct tsens_device *, int, int *); 93 94/* TSENS v1 targets */ 95extern const struct tsens_data data_8916, data_8974, data_8960; 96/* TSENS v2 targets */ 97extern const struct tsens_data data_8996, data_tsens_v2; 98 99#endif /* __QCOM_TSENS_H__ */