drivers/regulator/tps65185.c
Source file repositories/reference/linux-study-clean/drivers/regulator/tps65185.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/regulator/tps65185.c- Extension
.c- Size
- 11967 bytes
- Lines
- 458
- Domain
- Driver Families
- Bucket
- drivers/regulator
- 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.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/cleanup.hlinux/completion.hlinux/gpio/consumer.hlinux/i2c.hlinux/module.hlinux/mutex.hlinux/hwmon.hlinux/pm_runtime.hlinux/property.hlinux/regulator/consumer.hlinux/regulator/driver.hlinux/regulator/machine.hlinux/regmap.h
Detected Declarations
struct tps65185_datafunction tps65185_hwmon_readfunction tps65185_hwmon_is_visiblefunction tps65185_volatile_regfunction tps65185_check_powergoodfunction tps65185_vposneg_get_voltage_selfunction tps65185_vposneg_set_voltage_selfunction pgood_handlerfunction tps65185_vposneg_enablefunction tps65185_vposneg_disablefunction tps65185_vcom_set_voltage_selfunction tps65185_vcom_get_voltage_selfunction tps65185_irq_threadfunction tps65185_probe
Annotated Snippet
struct tps65185_data {
struct device *dev;
struct regmap *regmap;
struct gpio_desc *pgood_gpio;
struct gpio_desc *pwrup_gpio;
struct gpio_desc *vcom_ctrl_gpio;
struct gpio_desc *wakeup_gpio;
struct completion pgood_completion;
int pgood_irq;
struct completion tmst_completion;
};
static const struct hwmon_channel_info *tps65185_info[] = {
HWMON_CHANNEL_INFO(chip, HWMON_C_REGISTER_TZ),
HWMON_CHANNEL_INFO(temp, HWMON_T_INPUT),
NULL
};
static int tps65185_hwmon_read(struct device *dev, enum hwmon_sensor_types type,
u32 attr, int channel, long *temp)
{
struct tps65185_data *data = dev_get_drvdata(dev);
unsigned int val;
int ret;
reinit_completion(&data->tmst_completion);
/* start acquisition */
regmap_update_bits(data->regmap, TPS65185_REG_TMST1,
TPS65185_READ_THERM, TPS65185_READ_THERM);
wait_for_completion_timeout(&data->tmst_completion,
msecs_to_jiffies(PGOOD_TIMEOUT_MSECS));
ret = regmap_read(data->regmap, TPS65185_REG_TMST1, &val);
if (!(val & TPS65185_CONV_END))
return -ETIMEDOUT;
ret = regmap_read(data->regmap, TPS65185_REG_TMST_VALUE, &val);
if (ret)
return ret;
*temp = (s8)val * 1000;
return 0;
}
static umode_t tps65185_hwmon_is_visible(const void *data,
enum hwmon_sensor_types type,
u32 attr, int channel)
{
return 0444;
}
static const struct hwmon_ops tps65185_hwmon_ops = {
.is_visible = tps65185_hwmon_is_visible,
.read = tps65185_hwmon_read,
};
static const struct hwmon_chip_info tps65185_chip_info = {
.ops = &tps65185_hwmon_ops,
.info = tps65185_info,
};
static bool tps65185_volatile_reg(struct device *dev, unsigned int reg)
{
switch (reg) {
case TPS65185_REG_TMST_VALUE:
case TPS65185_REG_ENABLE:
case TPS65185_REG_VCOM2:
case TPS65185_REG_INT1:
case TPS65185_REG_INT2:
case TPS65185_REG_TMST1:
return true;
default:
return false;
}
}
static const struct regmap_config regmap_config = {
.reg_bits = 8,
.val_bits = 8,
.max_register = 0x10,
.cache_type = REGCACHE_MAPLE,
.volatile_reg = tps65185_volatile_reg,
};
static const struct regulator_ops tps65185_v3p3ops = {
.list_voltage = regulator_list_voltage_linear,
.enable = regulator_enable_regmap,
.disable = regulator_disable_regmap,
.is_enabled = regulator_is_enabled_regmap,
};
Annotation
- Immediate include surface: `linux/cleanup.h`, `linux/completion.h`, `linux/gpio/consumer.h`, `linux/i2c.h`, `linux/module.h`, `linux/mutex.h`, `linux/hwmon.h`, `linux/pm_runtime.h`.
- Detected declarations: `struct tps65185_data`, `function tps65185_hwmon_read`, `function tps65185_hwmon_is_visible`, `function tps65185_volatile_reg`, `function tps65185_check_powergood`, `function tps65185_vposneg_get_voltage_sel`, `function tps65185_vposneg_set_voltage_sel`, `function pgood_handler`, `function tps65185_vposneg_enable`, `function tps65185_vposneg_disable`.
- Atlas domain: Driver Families / drivers/regulator.
- Implementation status: source implementation candidate.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
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.