drivers/iio/adc/88pm886-gpadc.c
Source file repositories/reference/linux-study-clean/drivers/iio/adc/88pm886-gpadc.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/iio/adc/88pm886-gpadc.c- Extension
.c- Size
- 10241 bytes
- Lines
- 394
- Domain
- Driver Families
- Bucket
- drivers/iio
- 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/bits.hlinux/bug.hlinux/delay.hlinux/device.hlinux/err.hlinux/i2c.hlinux/math.hlinux/mod_devicetable.hlinux/module.hlinux/platform_device.hlinux/pm_runtime.hlinux/regmap.hlinux/types.hlinux/units.hasm/byteorder.hlinux/iio/iio.hlinux/iio/types.hlinux/mfd/88pm886.h
Detected Declarations
struct pm886_gpadcenum pm886_gpadc_channelfunction gpadc_get_rawfunction gpadc_set_biasfunction gpadc_find_bias_currentfunction abovefunction gpadc_get_resistance_ohmfunction __pm886_gpadc_read_rawfunction pm886_gpadc_read_rawfunction pm886_gpadc_hw_enablefunction pm886_gpadc_hw_disablefunction pm886_gpadc_probefunction pm886_gpadc_runtime_resumefunction pm886_gpadc_runtime_suspend
Annotated Snippet
struct pm886_gpadc {
struct regmap *map;
};
enum pm886_gpadc_channel {
VSC_CHAN,
VCHG_PWR_CHAN,
VCF_OUT_CHAN,
VBAT_CHAN,
VBAT_SLP_CHAN,
VBUS_CHAN,
GPADC0_CHAN,
GPADC1_CHAN,
GPADC2_CHAN,
GPADC3_CHAN,
GND_DET1_CHAN,
GND_DET2_CHAN,
MIC_DET_CHAN,
TINT_CHAN,
};
static const int pm886_gpadc_regs[] = {
[VSC_CHAN] = PM886_REG_GPADC_VSC,
[VCHG_PWR_CHAN] = PM886_REG_GPADC_VCHG_PWR,
[VCF_OUT_CHAN] = PM886_REG_GPADC_VCF_OUT,
[VBAT_CHAN] = PM886_REG_GPADC_VBAT,
[VBAT_SLP_CHAN] = PM886_REG_GPADC_VBAT_SLP,
[VBUS_CHAN] = PM886_REG_GPADC_VBUS,
[GPADC0_CHAN] = PM886_REG_GPADC_GPADC0,
[GPADC1_CHAN] = PM886_REG_GPADC_GPADC1,
[GPADC2_CHAN] = PM886_REG_GPADC_GPADC2,
[GPADC3_CHAN] = PM886_REG_GPADC_GPADC3,
[GND_DET1_CHAN] = PM886_REG_GPADC_GND_DET1,
[GND_DET2_CHAN] = PM886_REG_GPADC_GND_DET2,
[MIC_DET_CHAN] = PM886_REG_GPADC_MIC_DET,
[TINT_CHAN] = PM886_REG_GPADC_TINT,
};
#define ADC_CHANNEL_VOLTAGE(index, lsb, name) \
{ \
.type = IIO_VOLTAGE, \
.indexed = 1, \
.channel = index, \
.address = lsb, \
.info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | \
BIT(IIO_CHAN_INFO_SCALE), \
.datasheet_name = name, \
}
#define ADC_CHANNEL_RESISTANCE(index, lsb, name) \
{ \
.type = IIO_RESISTANCE, \
.indexed = 1, \
.channel = index, \
.address = lsb, \
.info_mask_separate = BIT(IIO_CHAN_INFO_PROCESSED), \
.datasheet_name = name, \
}
#define ADC_CHANNEL_TEMPERATURE(index, lsb, name) \
{ \
.type = IIO_TEMP, \
.indexed = 1, \
.channel = index, \
.address = lsb, \
.info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | \
BIT(IIO_CHAN_INFO_SCALE) | \
BIT(IIO_CHAN_INFO_OFFSET), \
.datasheet_name = name, \
}
static const struct iio_chan_spec pm886_gpadc_channels[] = {
ADC_CHANNEL_VOLTAGE(VSC_CHAN, 1367, "vsc"),
ADC_CHANNEL_VOLTAGE(VCHG_PWR_CHAN, 1709, "vchg_pwr"),
ADC_CHANNEL_VOLTAGE(VCF_OUT_CHAN, 1367, "vcf_out"),
ADC_CHANNEL_VOLTAGE(VBAT_CHAN, 1367, "vbat"),
ADC_CHANNEL_VOLTAGE(VBAT_SLP_CHAN, 1367, "vbat_slp"),
ADC_CHANNEL_VOLTAGE(VBUS_CHAN, 1709, "vbus"),
ADC_CHANNEL_RESISTANCE(GPADC0_CHAN, 342, "gpadc0"),
ADC_CHANNEL_RESISTANCE(GPADC1_CHAN, 342, "gpadc1"),
ADC_CHANNEL_RESISTANCE(GPADC2_CHAN, 342, "gpadc2"),
ADC_CHANNEL_RESISTANCE(GPADC3_CHAN, 342, "gpadc3"),
Annotation
- Immediate include surface: `linux/bits.h`, `linux/bug.h`, `linux/delay.h`, `linux/device.h`, `linux/err.h`, `linux/i2c.h`, `linux/math.h`, `linux/mod_devicetable.h`.
- Detected declarations: `struct pm886_gpadc`, `enum pm886_gpadc_channel`, `function gpadc_get_raw`, `function gpadc_set_bias`, `function gpadc_find_bias_current`, `function above`, `function gpadc_get_resistance_ohm`, `function __pm886_gpadc_read_raw`, `function pm886_gpadc_read_raw`, `function pm886_gpadc_hw_enable`.
- Atlas domain: Driver Families / drivers/iio.
- 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.