xref: /linux-6.15/include/linux/mfd/da9063/core.h (revision ef264cf0)
1 /*
2  * Definitions for DA9063 MFD driver
3  *
4  * Copyright 2012 Dialog Semiconductor Ltd.
5  *
6  * Author: Michal Hajduk <[email protected]>
7  *	   Krystian Garbaciak <[email protected]>
8  *
9  *  This program is free software; you can redistribute  it and/or modify it
10  *  under  the terms of  the GNU General  Public License as published by the
11  *  Free Software Foundation;  either version 2 of the  License, or (at your
12  *  option) any later version.
13  *
14  */
15 
16 #ifndef __MFD_DA9063_CORE_H__
17 #define __MFD_DA9063_CORE_H__
18 
19 #include <linux/interrupt.h>
20 #include <linux/mfd/da9063/registers.h>
21 
22 /* DA9063 modules */
23 #define DA9063_DRVNAME_CORE		"da9063-core"
24 #define DA9063_DRVNAME_REGULATORS	"da9063-regulators"
25 #define DA9063_DRVNAME_LEDS		"da9063-leds"
26 #define DA9063_DRVNAME_WATCHDOG		"da9063-watchdog"
27 #define DA9063_DRVNAME_HWMON		"da9063-hwmon"
28 #define DA9063_DRVNAME_ONKEY		"da9063-onkey"
29 #define DA9063_DRVNAME_RTC		"da9063-rtc"
30 #define DA9063_DRVNAME_VIBRATION	"da9063-vibration"
31 
32 enum da9063_models {
33 	PMIC_DA9063 = 0x61,
34 };
35 
36 enum da9063_variant_codes {
37 	PMIC_DA9063_BB = 0x5
38 };
39 
40 /* Interrupts */
41 enum da9063_irqs {
42 	DA9063_IRQ_ONKEY = 0,
43 	DA9063_IRQ_ALARM,
44 	DA9063_IRQ_TICK,
45 	DA9063_IRQ_ADC_RDY,
46 	DA9063_IRQ_SEQ_RDY,
47 	DA9063_IRQ_WAKE,
48 	DA9063_IRQ_TEMP,
49 	DA9063_IRQ_COMP_1V2,
50 	DA9063_IRQ_LDO_LIM,
51 	DA9063_IRQ_REG_UVOV,
52 	DA9063_IRQ_VDD_MON,
53 	DA9063_IRQ_WARN,
54 	DA9063_IRQ_GPI0,
55 	DA9063_IRQ_GPI1,
56 	DA9063_IRQ_GPI2,
57 	DA9063_IRQ_GPI3,
58 	DA9063_IRQ_GPI4,
59 	DA9063_IRQ_GPI5,
60 	DA9063_IRQ_GPI6,
61 	DA9063_IRQ_GPI7,
62 	DA9063_IRQ_GPI8,
63 	DA9063_IRQ_GPI9,
64 	DA9063_IRQ_GPI10,
65 	DA9063_IRQ_GPI11,
66 	DA9063_IRQ_GPI12,
67 	DA9063_IRQ_GPI13,
68 	DA9063_IRQ_GPI14,
69 	DA9063_IRQ_GPI15,
70 };
71 
72 #define DA9063_IRQ_BASE_OFFSET	0
73 #define DA9063_NUM_IRQ		(DA9063_IRQ_GPI15 + 1 - DA9063_IRQ_BASE_OFFSET)
74 
75 struct da9063 {
76 	/* Device */
77 	struct device	*dev;
78 	unsigned short	model;
79 	unsigned char	variant_code;
80 	unsigned int	flags;
81 
82 	/* Control interface */
83 	struct regmap	*regmap;
84 
85 	/* Interrupts */
86 	int		chip_irq;
87 	unsigned int	irq_base;
88 	struct regmap_irq_chip_data *regmap_irq;
89 };
90 
91 int da9063_device_init(struct da9063 *da9063, unsigned int irq);
92 int da9063_irq_init(struct da9063 *da9063);
93 
94 void da9063_device_exit(struct da9063 *da9063);
95 void da9063_irq_exit(struct da9063 *da9063);
96 
97 #endif /* __MFD_DA9063_CORE_H__ */
98