/* IP version numbers in ascending order */ enum tsens_ver {
VER_0 = 0,
VER_0_1,
VER_1_X,
VER_1_X_NO_RPM,
VER_2_X,
VER_2_X_NO_RPM,
};
enum tsens_irq_type {
LOWER,
UPPER,
CRITICAL,
};
/** * struct tsens_sensor - data for each sensor connected to the tsens device * @priv: tsens device instance that this sensor is connected to * @tzd: pointer to the thermal zone that this sensor is in * @offset: offset of temperature adjustment curve * @hw_id: HW ID can be used in case of platform-specific IDs * @slope: slope of temperature adjustment curve * @status: 8960-specific variable to track 8960 and 8660 status register offset
*/ struct tsens_sensor { struct tsens_priv *priv; struct thermal_zone_device *tzd; int offset; unsignedint hw_id; int slope;
u32 status; int p1_calib_offset; int p2_calib_offset;
};
/** * struct tsens_ops - operations as supported by the tsens device * @init: Function to initialize the tsens device * @calibrate: Function to calibrate the tsens device * @get_temp: Function which returns the temp in millidegC * @enable: Function to enable (clocks/power) tsens device * @disable: Function to disable the tsens device * @suspend: Function to suspend the tsens device * @resume: Function to resume the tsens device
*/ struct tsens_ops { /* mandatory callbacks */ int (*init)(struct tsens_priv *priv); int (*calibrate)(struct tsens_priv *priv); int (*get_temp)(conststruct tsens_sensor *s, int *temp); /* optional callbacks */ int (*enable)(struct tsens_priv *priv, int i); void (*disable)(struct tsens_priv *priv); int (*suspend)(struct tsens_priv *priv); int (*resume)(struct tsens_priv *priv);
};
/* * reg_field IDs to use as an index into an array * If you change the order of the entries, check the devm_regmap_field_alloc() * calls in init_common()
*/ enum regfield_ids { /* ----- SROT ------ */ /* HW_VER */
VER_MAJOR,
VER_MINOR,
VER_STEP, /* CTRL_OFFSET */
TSENS_EN,
TSENS_SW_RST,
SENSOR_EN,
CODE_OR_TEMP,
MAIN_MEASURE_PERIOD,
/** * struct tsens_features - Features supported by the IP * @ver_major: Major number of IP version * @crit_int: does the IP support critical interrupts? * @combo_int: does the IP use one IRQ for up, low and critical thresholds? * @adc: do the sensors only output adc code (instead of temperature)? * @srot_split: does the IP neatly splits the register space into SROT and TM, * with SROT only being available to secure boot firmware? * @has_watchdog: does this IP support watchdog functionality? * @max_sensors: maximum sensors supported by this version of the IP * @trip_min_temp: minimum trip temperature supported by this version of the IP * @trip_max_temp: maximum trip temperature supported by this version of the IP
*/ struct tsens_features { unsignedint ver_major; unsignedint crit_int:1; unsignedint combo_int:1; unsignedint adc:1; unsignedint srot_split:1; unsignedint has_watchdog:1; unsignedint max_sensors; int trip_min_temp; int trip_max_temp;
};
/** * struct tsens_plat_data - tsens compile-time platform data * @num_sensors: Number of sensors supported by platform * @ops: operations the tsens instance supports * @hw_ids: Subset of sensors ids supported by platform, if not the first n * @feat: features of the IP * @fields: bitfield locations
*/ struct tsens_plat_data { const u32 num_sensors; conststruct tsens_ops *ops; unsignedint *hw_ids; struct tsens_features *feat; conststruct reg_field *fields;
};
/** * struct tsens_context - Registers to be saved/restored across a context loss * @threshold: Threshold register value * @control: Control register value
*/ struct tsens_context { int threshold; int control;
};
/** * struct tsens_priv - private data for each instance of the tsens IP * @dev: pointer to struct device * @num_sensors: number of sensors enabled on this device * @tm_map: pointer to TM register address space * @srot_map: pointer to SROT register address space * @tm_offset: deal with old device trees that don't address TM and SROT * address space separately * @ul_lock: lock while processing upper/lower threshold interrupts * @crit_lock: lock while processing critical threshold interrupts * @rf: array of regmap_fields used to store value of the field * @ctx: registers to be saved and restored during suspend/resume * @feat: features of the IP * @fields: bitfield locations * @ops: pointer to list of callbacks supported by this device * @debug_root: pointer to debugfs dentry for all tsens * @debug: pointer to debugfs dentry for tsens controller * @sensor: list of sensors attached to this device
*/ struct tsens_priv { struct device *dev;
u32 num_sensors; struct regmap *tm_map; struct regmap *srot_map;
u32 tm_offset;
/* lock for upper/lower threshold interrupts */
spinlock_t ul_lock;
/** * struct tsens_single_value - internal representation of a single field inside nvmem calibration data * @idx: index into the u32 data array * @shift: the shift of the first bit in the value * @blob: index of the data blob to use for this cell
*/ struct tsens_single_value {
u8 idx;
u8 shift;
u8 blob;
};
/** * struct tsens_legacy_calibration_format - description of calibration data used when parsing the legacy nvmem blob * @base_len: the length of the base fields inside calibration data * @base_shift: the shift to be applied to base data * @sp_len: the length of the sN_pM fields inside calibration data * @mode: descriptor of the calibration mode field * @invalid: descriptor of the calibration mode invalid field * @base: descriptors of the base0 and base1 fields * @sp: descriptors of the sN_pM fields
*/ struct tsens_legacy_calibration_format { unsignedint base_len; unsignedint base_shift; unsignedint sp_len; /* just two bits */ struct tsens_single_value mode; /* on all platforms except 8974 invalid is the third bit of what downstream calls 'mode' */ struct tsens_single_value invalid; struct tsens_single_value base[2]; struct tsens_single_value sp[][2];
};
char *qfprom_read(struct device *dev, constchar *cname); int tsens_read_calibration_legacy(struct tsens_priv *priv, conststruct tsens_legacy_calibration_format *format,
u32 *p1, u32 *p2,
u32 *cdata, u32 *csel); int tsens_read_calibration(struct tsens_priv *priv, int shift, u32 *p1, u32 *p2, bool backup); int tsens_calibrate_nvmem(struct tsens_priv *priv, int shift); int tsens_calibrate_common(struct tsens_priv *priv); void compute_intercept_slope(struct tsens_priv *priv, u32 *pt1, u32 *pt2, u32 mode); int init_common(struct tsens_priv *priv); int get_temp_tsens_valid(conststruct tsens_sensor *s, int *temp); int get_temp_common(conststruct tsens_sensor *s, int *temp); #ifdef CONFIG_SUSPEND int tsens_resume_common(struct tsens_priv *priv); #else #define tsens_resume_common NULL #endif
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.