drivers/regulator/fp9931.c

Source file repositories/reference/linux-study-clean/drivers/regulator/fp9931.c

File Facts

System
Linux kernel
Corpus path
drivers/regulator/fp9931.c
Extension
.c
Size
12712 bytes
Lines
557
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.

Dependency Surface

Detected Declarations

Annotated Snippet

struct fp9931_data {
	struct device *dev;
	struct regmap *regmap;
	struct regulator *vin_reg;
	struct gpio_desc *pgood_gpio;
	struct gpio_desc *en_gpio;
	struct gpio_desc *en_ts_gpio;
	struct completion pgood_completion;
	int pgood_irq;
};

static const unsigned int VPOSNEG_table[] = {
	7040000,
	7040000,
	7040000,
	7040000,
	7040000,
	7040000,
	7260000,
	7490000,
	7710000,
	7930000,
	8150000,
	8380000,
	8600000,
	8820000,
	9040000,
	9270000,
	9490000,
	9710000,
	9940000,
	10160000,
	10380000,
	10600000,
	10830000,
	11050000,
	11270000,
	11490000,
	11720000,
	11940000,
	12160000,
	12380000,
	12610000,
	12830000,
	13050000,
	13280000,
	13500000,
	13720000,
	13940000,
	14170000,
	14390000,
	14610000,
	14830000,
	15060000,
};

static const struct hwmon_channel_info *fp9931_info[] = {
	HWMON_CHANNEL_INFO(chip, HWMON_C_REGISTER_TZ),
	HWMON_CHANNEL_INFO(temp, HWMON_T_INPUT),
	NULL
};

static int setup_timings(struct fp9931_data *data)
{
	u32 tdly[4];
	u8 tdlys = 0;
	int i;
	int ret;

	ret = device_property_count_u32(data->dev, "fitipower,tdly-ms");
	if (ret == -EINVAL) /* property is optional */
		return 0;

	if (ret < 0)
		return ret;

	if (ret != ARRAY_SIZE(tdly)) {
		dev_err(data->dev, "invalid delay specification");
		return -EINVAL;
	}

	ret = device_property_read_u32_array(data->dev, "fitipower,tdly-ms",
					     tdly, ARRAY_SIZE(tdly));
	if (ret)
		return ret;

	for (i = ARRAY_SIZE(tdly) - 1; i >= 0; i--) {
		if (tdly[i] > 4 || tdly[i] == 3)
			return -EINVAL;

Annotation

Implementation Notes