include/linux/mfd/wm8350/core.h

Source file repositories/reference/linux-study-clean/include/linux/mfd/wm8350/core.h

File Facts

System
Linux kernel
Corpus path
include/linux/mfd/wm8350/core.h
Extension
.h
Size
25628 bytes
Lines
693
Domain
Core OS
Bucket
Core Kernel Interface
Inferred role
Core OS: implementation source
Status
source implementation candidate

Why This File Exists

Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.

Dependency Surface

Detected Declarations

Annotated Snippet

struct wm8350_hwmon {
	struct platform_device *pdev;
	struct device *classdev;
};

struct wm8350 {
	struct device *dev;

	/* device IO */
	struct regmap *regmap;
	bool unlocked;

	struct mutex auxadc_mutex;
	struct completion auxadc_done;

	/* Interrupt handling */
	struct mutex irq_lock;
	int chip_irq;
	int irq_base;
	u16 irq_masks[WM8350_NUM_IRQ_REGS];

	/* Client devices */
	struct wm8350_codec codec;
	struct wm8350_gpio gpio;
	struct wm8350_hwmon hwmon;
	struct wm8350_pmic pmic;
	struct wm8350_power power;
	struct wm8350_rtc rtc;
	struct wm8350_wdt wdt;
};

/**
 * Data to be supplied by the platform to initialise the WM8350.
 *
 * @init: Function called during driver initialisation.  Should be
 *        used by the platform to configure GPIO functions and similar.
 * @irq_high: Set if WM8350 IRQ is active high.
 * @irq_base: Base IRQ for genirq (not currently used).
 * @gpio_base: Base for gpiolib.
 */
struct wm8350_platform_data {
	int (*init)(struct wm8350 *wm8350);
	int irq_high;
	int irq_base;
	int gpio_base;
};


/*
 * WM8350 device initialisation and exit.
 */
int wm8350_device_init(struct wm8350 *wm8350, int irq,
		       struct wm8350_platform_data *pdata);

/*
 * WM8350 device IO
 */
int wm8350_clear_bits(struct wm8350 *wm8350, u16 reg, u16 mask);
int wm8350_set_bits(struct wm8350 *wm8350, u16 reg, u16 mask);
u16 wm8350_reg_read(struct wm8350 *wm8350, int reg);
int wm8350_reg_write(struct wm8350 *wm8350, int reg, u16 val);
int wm8350_reg_lock(struct wm8350 *wm8350);
int wm8350_reg_unlock(struct wm8350 *wm8350);
int wm8350_block_read(struct wm8350 *wm8350, int reg, int size, u16 *dest);
int wm8350_block_write(struct wm8350 *wm8350, int reg, int size, u16 *src);

/*
 * WM8350 internal interrupts
 */
static inline int wm8350_register_irq(struct wm8350 *wm8350, int irq,
				      irq_handler_t handler,
				      unsigned long flags,
				      const char *name, void *data)
{
	if (!wm8350->irq_base)
		return -ENODEV;

	return request_threaded_irq(irq + wm8350->irq_base, NULL,
				    handler, flags | IRQF_ONESHOT, name, data);
}

static inline void wm8350_free_irq(struct wm8350 *wm8350, int irq, void *data)
{
	free_irq(irq + wm8350->irq_base, data);
}

static inline void wm8350_mask_irq(struct wm8350 *wm8350, int irq)
{
	disable_irq(irq + wm8350->irq_base);
}

Annotation

Implementation Notes