xref: /openbmc/linux/include/linux/mfd/da9063/core.h (revision c9a20383)
1 /* SPDX-License-Identifier: GPL-2.0+ */
2 /*
3  * Definitions for DA9063 MFD driver
4  *
5  * Copyright 2012 Dialog Semiconductor Ltd.
6  *
7  * Author: Michal Hajduk, Dialog Semiconductor
8  * Author: Krystian Garbaciak, Dialog Semiconductor
9  */
10 
11 #ifndef __MFD_DA9063_CORE_H__
12 #define __MFD_DA9063_CORE_H__
13 
14 #include <linux/interrupt.h>
15 #include <linux/mfd/da9063/registers.h>
16 
17 /* DA9063 modules */
18 #define DA9063_DRVNAME_CORE		"da9063-core"
19 #define DA9063_DRVNAME_REGULATORS	"da9063-regulators"
20 #define DA9063_DRVNAME_LEDS		"da9063-leds"
21 #define DA9063_DRVNAME_WATCHDOG		"da9063-watchdog"
22 #define DA9063_DRVNAME_HWMON		"da9063-hwmon"
23 #define DA9063_DRVNAME_ONKEY		"da9063-onkey"
24 #define DA9063_DRVNAME_RTC		"da9063-rtc"
25 #define DA9063_DRVNAME_VIBRATION	"da9063-vibration"
26 
27 #define PMIC_CHIP_ID_DA9063		0x61
28 
29 enum da9063_type {
30 	PMIC_TYPE_DA9063 = 0,
31 	PMIC_TYPE_DA9063L,
32 };
33 
34 enum da9063_variant_codes {
35 	PMIC_DA9063_AD = 0x3,
36 	PMIC_DA9063_BB = 0x5,
37 	PMIC_DA9063_CA = 0x6,
38 	PMIC_DA9063_DA = 0x7,
39 	PMIC_DA9063_EA = 0x8,
40 };
41 
42 /* Interrupts */
43 enum da9063_irqs {
44 	DA9063_IRQ_ONKEY = 0,
45 	DA9063_IRQ_ALARM,
46 	DA9063_IRQ_TICK,
47 	DA9063_IRQ_ADC_RDY,
48 	DA9063_IRQ_SEQ_RDY,
49 	DA9063_IRQ_WAKE,
50 	DA9063_IRQ_TEMP,
51 	DA9063_IRQ_COMP_1V2,
52 	DA9063_IRQ_LDO_LIM,
53 	DA9063_IRQ_REG_UVOV,
54 	DA9063_IRQ_DVC_RDY,
55 	DA9063_IRQ_VDD_MON,
56 	DA9063_IRQ_WARN,
57 	DA9063_IRQ_GPI0,
58 	DA9063_IRQ_GPI1,
59 	DA9063_IRQ_GPI2,
60 	DA9063_IRQ_GPI3,
61 	DA9063_IRQ_GPI4,
62 	DA9063_IRQ_GPI5,
63 	DA9063_IRQ_GPI6,
64 	DA9063_IRQ_GPI7,
65 	DA9063_IRQ_GPI8,
66 	DA9063_IRQ_GPI9,
67 	DA9063_IRQ_GPI10,
68 	DA9063_IRQ_GPI11,
69 	DA9063_IRQ_GPI12,
70 	DA9063_IRQ_GPI13,
71 	DA9063_IRQ_GPI14,
72 	DA9063_IRQ_GPI15,
73 };
74 
75 struct da9063 {
76 	/* Device */
77 	struct device	*dev;
78 	enum da9063_type type;
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 #endif /* __MFD_DA9063_CORE_H__ */
95