drivers/mfd/intel_soc_pmic_chtdc_ti.c

Source file repositories/reference/linux-study-clean/drivers/mfd/intel_soc_pmic_chtdc_ti.c

File Facts

System
Linux kernel
Corpus path
drivers/mfd/intel_soc_pmic_chtdc_ti.c
Extension
.c
Size
4672 bytes
Lines
183
Domain
Driver Families
Bucket
drivers/mfd
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
/*
 * Device access for Dollar Cove TI PMIC
 *
 * Copyright (c) 2014, Intel Corporation.
 *   Author: Ramakrishna Pallala <ramakrishna.pallala@intel.com>
 *
 * Cleanup and forward-ported
 *   Copyright (c) 2017 Takashi Iwai <tiwai@suse.de>
 */

#include <linux/acpi.h>
#include <linux/interrupt.h>
#include <linux/i2c.h>
#include <linux/mfd/core.h>
#include <linux/mfd/intel_soc_pmic.h>
#include <linux/module.h>
#include <linux/regmap.h>

#define CHTDC_TI_IRQLVL1	0x01
#define CHTDC_TI_MASK_IRQLVL1	0x02

/* Level 1 IRQs */
enum {
	CHTDC_TI_PWRBTN = 0,	/* power button */
	CHTDC_TI_DIETMPWARN,	/* thermal */
	CHTDC_TI_ADCCMPL,	/* ADC */
	/* No IRQ 3 */
	CHTDC_TI_VBATLOW = 4,	/* battery */
	CHTDC_TI_VBUSDET,	/* power source */
	/* No IRQ 6 */
	CHTDC_TI_CCEOCAL = 7,	/* battery */
};

static const struct resource power_button_resources[] = {
	DEFINE_RES_IRQ(CHTDC_TI_PWRBTN),
};

static const struct resource thermal_resources[] = {
	DEFINE_RES_IRQ(CHTDC_TI_DIETMPWARN),
};

static const struct resource adc_resources[] = {
	DEFINE_RES_IRQ(CHTDC_TI_ADCCMPL),
};

static const struct resource pwrsrc_resources[] = {
	DEFINE_RES_IRQ(CHTDC_TI_VBUSDET),
};

static const struct resource battery_resources[] = {
	DEFINE_RES_IRQ(CHTDC_TI_VBATLOW),
	DEFINE_RES_IRQ(CHTDC_TI_CCEOCAL),
};

static struct mfd_cell chtdc_ti_dev[] = {
	{
		.name = "chtdc_ti_pwrbtn",
		.num_resources = ARRAY_SIZE(power_button_resources),
		.resources = power_button_resources,
	}, {
		.name = "chtdc_ti_adc",
		.num_resources = ARRAY_SIZE(adc_resources),
		.resources = adc_resources,
	}, {
		.name = "chtdc_ti_thermal",
		.num_resources = ARRAY_SIZE(thermal_resources),
		.resources = thermal_resources,
	}, {
		.name = "chtdc_ti_pwrsrc",
		.num_resources = ARRAY_SIZE(pwrsrc_resources),
		.resources = pwrsrc_resources,
	}, {
		.name = "chtdc_ti_battery",
		.num_resources = ARRAY_SIZE(battery_resources),
		.resources = battery_resources,
	},
	{	.name = "chtdc_ti_region", },
};

static const struct regmap_config chtdc_ti_regmap_config = {
	.reg_bits = 8,
	.val_bits = 8,
	.max_register = 0xff,
	/* The hardware does not support reading multiple registers at once */
	.use_single_read = true,
};

static const struct regmap_irq chtdc_ti_irqs[] = {
	REGMAP_IRQ_REG(CHTDC_TI_PWRBTN, 0, BIT(CHTDC_TI_PWRBTN)),

Annotation

Implementation Notes