drivers/thermal/qcom/tsens-v1.c
Source file repositories/reference/linux-study-clean/drivers/thermal/qcom/tsens-v1.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/thermal/qcom/tsens-v1.c- Extension
.c- Size
- 7213 bytes
- Lines
- 259
- Domain
- Driver Families
- Bucket
- drivers/thermal
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/bitops.hlinux/regmap.hlinux/delay.hlinux/slab.htsens.h
Detected Declarations
function calibrate_v1function init_8956function init_tsens_v1_no_rpm
Annotated Snippet
static int __init init_8956(struct tsens_priv *priv) {
priv->sensor[0].slope = 3313;
priv->sensor[1].slope = 3275;
priv->sensor[2].slope = 3320;
priv->sensor[3].slope = 3246;
priv->sensor[4].slope = 3279;
priv->sensor[5].slope = 3257;
priv->sensor[6].slope = 3234;
priv->sensor[7].slope = 3269;
priv->sensor[8].slope = 3255;
priv->sensor[9].slope = 3239;
priv->sensor[10].slope = 3286;
return init_common(priv);
}
static int __init init_tsens_v1_no_rpm(struct tsens_priv *priv)
{
int i, ret;
u32 mask = 0;
ret = init_common(priv);
if (ret < 0) {
dev_err(priv->dev, "Init common failed %d\n", ret);
return ret;
}
ret = regmap_field_write(priv->rf[TSENS_SW_RST], 1);
if (ret) {
dev_err(priv->dev, "Reset failed\n");
return ret;
}
for (i = 0; i < priv->num_sensors; i++)
mask |= BIT(priv->sensor[i].hw_id);
ret = regmap_field_update_bits(priv->rf[SENSOR_EN], mask, mask);
if (ret) {
dev_err(priv->dev, "Sensor Enable failed\n");
return ret;
}
ret = regmap_field_write(priv->rf[TSENS_EN], 1);
if (ret) {
dev_err(priv->dev, "Enable failed\n");
return ret;
}
ret = regmap_field_write(priv->rf[TSENS_SW_RST], 0);
return ret;
}
static const struct tsens_ops ops_generic_v1 = {
.init = init_common,
.calibrate = calibrate_v1,
.get_temp = get_temp_tsens_valid,
};
struct tsens_plat_data data_tsens_v1 = {
.ops = &ops_generic_v1,
.feat = &tsens_v1_feat,
.fields = tsens_v1_regfields,
};
static const struct tsens_ops ops_common = {
.init = init_common,
.calibrate = tsens_calibrate_common,
.get_temp = get_temp_tsens_valid,
};
struct tsens_plat_data data_8937 = {
.num_sensors = 11,
.ops = &ops_common,
.feat = &tsens_v1_feat,
.fields = tsens_v1_regfields,
};
static const struct tsens_ops ops_8956 = {
.init = init_8956,
.calibrate = tsens_calibrate_common,
.get_temp = get_temp_tsens_valid,
};
struct tsens_plat_data data_8956 = {
.num_sensors = 11,
.ops = &ops_8956,
.feat = &tsens_v1_feat,
.fields = tsens_v1_regfields,
};
Annotation
- Immediate include surface: `linux/bitops.h`, `linux/regmap.h`, `linux/delay.h`, `linux/slab.h`, `tsens.h`.
- Detected declarations: `function calibrate_v1`, `function init_8956`, `function init_tsens_v1_no_rpm`.
- Atlas domain: Driver Families / drivers/thermal.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.