drivers/hwmon/pmbus/adp1050.c

Source file repositories/reference/linux-study-clean/drivers/hwmon/pmbus/adp1050.c

File Facts

System
Linux kernel
Corpus path
drivers/hwmon/pmbus/adp1050.c
Extension
.c
Size
3544 bytes
Lines
123
Domain
Driver Families
Bucket
drivers/hwmon
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

// SPDX-License-Identifier: GPL-2.0
/*
 * Hardware monitoring driver for Analog Devices ADP1050
 *
 * Copyright (C) 2024 Analog Devices, Inc.
 */
#include <linux/bits.h>
#include <linux/i2c.h>
#include <linux/mod_devicetable.h>
#include <linux/module.h>

#include "pmbus.h"

#if IS_ENABLED(CONFIG_SENSORS_ADP1050_REGULATOR)
static const struct regulator_desc adp1050_reg_desc[] = {
	PMBUS_REGULATOR_ONE("vout"),
};
#endif /* CONFIG_SENSORS_ADP1050_REGULATOR */

static struct pmbus_driver_info adp1050_info = {
	.pages = 1,
	.format[PSC_VOLTAGE_IN] = linear,
	.format[PSC_VOLTAGE_OUT] = linear,
	.format[PSC_CURRENT_IN] = linear,
	.format[PSC_TEMPERATURE] = linear,
	.func[0] = PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT
		| PMBUS_HAVE_VIN | PMBUS_HAVE_STATUS_INPUT
		| PMBUS_HAVE_IIN | PMBUS_HAVE_TEMP
		| PMBUS_HAVE_STATUS_TEMP,
};

static struct pmbus_driver_info adp1051_info = {
	.pages = 1,
	.format[PSC_VOLTAGE_IN] = linear,
	.format[PSC_VOLTAGE_OUT] = linear,
	.format[PSC_CURRENT_IN] = linear,
	.format[PSC_TEMPERATURE] = linear,
	.func[0] = PMBUS_HAVE_VIN | PMBUS_HAVE_IIN
		| PMBUS_HAVE_VOUT | PMBUS_HAVE_IOUT
		| PMBUS_HAVE_TEMP
		| PMBUS_HAVE_STATUS_VOUT | PMBUS_HAVE_STATUS_IOUT
		| PMBUS_HAVE_STATUS_INPUT
		| PMBUS_HAVE_STATUS_TEMP,
};

static struct pmbus_driver_info adp1055_info = {
	.pages = 1,
	.format[PSC_VOLTAGE_IN] = linear,
	.format[PSC_VOLTAGE_OUT] = linear,
	.format[PSC_CURRENT_IN] = linear,
	.format[PSC_TEMPERATURE] = linear,
	.func[0] = PMBUS_HAVE_VIN | PMBUS_HAVE_IIN
		| PMBUS_HAVE_VOUT | PMBUS_HAVE_IOUT
		| PMBUS_HAVE_TEMP2 | PMBUS_HAVE_TEMP3
		| PMBUS_HAVE_POUT
		| PMBUS_HAVE_STATUS_VOUT | PMBUS_HAVE_STATUS_IOUT
		| PMBUS_HAVE_STATUS_INPUT
		| PMBUS_HAVE_STATUS_TEMP,
};

static struct pmbus_driver_info ltp8800_info = {
	.pages = 1,
	.format[PSC_VOLTAGE_IN] = linear,
	.format[PSC_VOLTAGE_OUT] = linear,
	.format[PSC_CURRENT_IN] = linear,
	.format[PSC_TEMPERATURE] = linear,
	.func[0] = PMBUS_HAVE_VIN | PMBUS_HAVE_IIN
		| PMBUS_HAVE_VOUT | PMBUS_HAVE_IOUT
		| PMBUS_HAVE_TEMP
		| PMBUS_HAVE_POUT
		| PMBUS_HAVE_STATUS_VOUT
		| PMBUS_HAVE_STATUS_INPUT
		| PMBUS_HAVE_STATUS_TEMP,
#if IS_ENABLED(CONFIG_SENSORS_ADP1050_REGULATOR)
	.num_regulators = 1,
	.reg_desc = adp1050_reg_desc,
#endif
};

static int adp1050_probe(struct i2c_client *client)
{
	struct pmbus_driver_info *info;

	info = (struct pmbus_driver_info *)i2c_get_match_data(client);
	if (!info)
		return -ENODEV;

	return pmbus_do_probe(client, info);
}

Annotation

Implementation Notes