drivers/hwmon/lm90.c

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

File Facts

System
Linux kernel
Corpus path
drivers/hwmon/lm90.c
Extension
.c
Size
89289 bytes
Lines
3003
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

struct lm90_params {
	u32 flags;		/* Capabilities */
	u16 alert_alarms;	/* Which alarm bits trigger ALERT# */
				/* Upper 8 bits for max6695/96 */
	u8 max_convrate;	/* Maximum conversion rate register value */
	u8 resolution;		/* 16-bit resolution (default 11 bit) */
	u8 reg_status2;		/* 2nd status register (optional) */
	u8 reg_local_ext;	/* Extended local temp register (optional) */
	u8 faultqueue_mask;	/* fault queue bit mask */
	u8 faultqueue_depth;	/* fault queue depth if mask is used */
};

static const struct lm90_params lm90_params[] = {
	[adm1023] = {
		.flags = LM90_HAVE_ALARMS | LM90_HAVE_OFFSET | LM90_HAVE_BROKEN_ALERT
		  | LM90_HAVE_REM_LIMIT_EXT | LM90_HAVE_LOW | LM90_HAVE_CONVRATE
		  | LM90_HAVE_REMOTE_EXT,
		.alert_alarms = 0x7c,
		.resolution = 8,
		.max_convrate = 7,
	},
	[adm1032] = {
		.flags = LM90_HAVE_OFFSET | LM90_HAVE_REM_LIMIT_EXT
		  | LM90_HAVE_BROKEN_ALERT | LM90_HAVE_CRIT
		  | LM90_HAVE_PARTIAL_PEC | LM90_HAVE_ALARMS
		  | LM90_HAVE_LOW | LM90_HAVE_CONVRATE | LM90_HAVE_REMOTE_EXT
		  | LM90_HAVE_FAULTQUEUE,
		.alert_alarms = 0x7c,
		.max_convrate = 10,
	},
	[adt7461] = {
		/*
		 * Standard temperature range is supposed to be unsigned,
		 * but that does not match reality. Negative temperatures
		 * are always reported.
		 */
		.flags = LM90_HAVE_OFFSET | LM90_HAVE_REM_LIMIT_EXT
		  | LM90_HAVE_BROKEN_ALERT | LM90_HAVE_EXTENDED_TEMP
		  | LM90_HAVE_CRIT | LM90_HAVE_PARTIAL_PEC
		  | LM90_HAVE_ALARMS | LM90_HAVE_LOW | LM90_HAVE_CONVRATE
		  | LM90_HAVE_REMOTE_EXT | LM90_HAVE_FAULTQUEUE,
		.alert_alarms = 0x7c,
		.max_convrate = 10,
		.resolution = 10,
	},
	[adt7461a] = {
		.flags = LM90_HAVE_OFFSET | LM90_HAVE_REM_LIMIT_EXT
		  | LM90_HAVE_BROKEN_ALERT | LM90_HAVE_EXTENDED_TEMP
		  | LM90_HAVE_CRIT | LM90_HAVE_PEC | LM90_HAVE_ALARMS
		  | LM90_HAVE_LOW | LM90_HAVE_CONVRATE | LM90_HAVE_REMOTE_EXT
		  | LM90_HAVE_FAULTQUEUE,
		.alert_alarms = 0x7c,
		.max_convrate = 10,
	},
	[adt7481] = {
		.flags = LM90_HAVE_OFFSET | LM90_HAVE_REM_LIMIT_EXT
		  | LM90_HAVE_BROKEN_ALERT | LM90_HAVE_EXTENDED_TEMP
		  | LM90_HAVE_UNSIGNED_TEMP | LM90_HAVE_PEC
		  | LM90_HAVE_TEMP3 | LM90_HAVE_CRIT | LM90_HAVE_LOW
		  | LM90_HAVE_CONVRATE | LM90_HAVE_REMOTE_EXT
		  | LM90_HAVE_FAULTQUEUE,
		.alert_alarms = 0x1c7c,
		.max_convrate = 11,
		.resolution = 10,
		.reg_status2 = ADT7481_REG_STATUS2,
	},
	[g781] = {
		.flags = LM90_HAVE_OFFSET | LM90_HAVE_REM_LIMIT_EXT
		  | LM90_HAVE_BROKEN_ALERT | LM90_HAVE_CRIT
		  | LM90_HAVE_ALARMS | LM90_HAVE_LOW | LM90_HAVE_CONVRATE
		  | LM90_HAVE_REMOTE_EXT | LM90_HAVE_FAULTQUEUE,
		.alert_alarms = 0x7c,
		.max_convrate = 7,
	},
	[lm84] = {
		.flags = LM90_HAVE_ALARMS,
		.resolution = 8,
	},
	[lm90] = {
		.flags = LM90_HAVE_OFFSET | LM90_HAVE_REM_LIMIT_EXT
		  | LM90_HAVE_CRIT | LM90_HAVE_ALARMS | LM90_HAVE_LOW
		  | LM90_HAVE_CONVRATE | LM90_HAVE_REMOTE_EXT
		  | LM90_HAVE_FAULTQUEUE,
		.alert_alarms = 0x7b,
		.max_convrate = 9,
		.faultqueue_mask = BIT(0),
		.faultqueue_depth = 3,
	},
	[lm99] = {
		.flags = LM90_HAVE_OFFSET | LM90_HAVE_REM_LIMIT_EXT

Annotation

Implementation Notes