1/*
2 * DA9150 MFD Driver - Core Data
3 *
4 * Copyright (c) 2014 Dialog Semiconductor
5 *
6 * Author: Adam Thomson <Adam.Thomson.Opensource@diasemi.com>
7 *
8 * This program is free software; you can redistribute  it and/or modify it
9 * under  the terms of  the GNU General  Public License as published by the
10 * Free Software Foundation;  either version 2 of the  License, or (at your
11 * option) any later version.
12 */
13
14#ifndef __DA9150_CORE_H
15#define __DA9150_CORE_H
16
17#include <linux/device.h>
18#include <linux/interrupt.h>
19#include <linux/regmap.h>
20
21/* I2C address paging */
22#define DA9150_REG_PAGE_SHIFT	8
23#define DA9150_REG_PAGE_MASK	0xFF
24
25/* IRQs */
26#define DA9150_NUM_IRQ_REGS	4
27#define DA9150_IRQ_VBUS		0
28#define DA9150_IRQ_CHG		1
29#define DA9150_IRQ_TCLASS	2
30#define DA9150_IRQ_TJUNC	3
31#define DA9150_IRQ_VFAULT	4
32#define DA9150_IRQ_CONF		5
33#define DA9150_IRQ_DAT		6
34#define DA9150_IRQ_DTYPE	7
35#define DA9150_IRQ_ID		8
36#define DA9150_IRQ_ADP		9
37#define DA9150_IRQ_SESS_END	10
38#define DA9150_IRQ_SESS_VLD	11
39#define DA9150_IRQ_FG		12
40#define DA9150_IRQ_GP		13
41#define DA9150_IRQ_TBAT		14
42#define DA9150_IRQ_GPIOA	15
43#define DA9150_IRQ_GPIOB	16
44#define DA9150_IRQ_GPIOC	17
45#define DA9150_IRQ_GPIOD	18
46#define DA9150_IRQ_GPADC	19
47#define DA9150_IRQ_WKUP		20
48
49struct da9150_pdata {
50	int irq_base;
51};
52
53struct da9150 {
54	struct device *dev;
55	struct regmap *regmap;
56	struct regmap_irq_chip_data *regmap_irq_data;
57	int irq;
58	int irq_base;
59};
60
61/* Device I/O */
62u8 da9150_reg_read(struct da9150 *da9150, u16 reg);
63void da9150_reg_write(struct da9150 *da9150, u16 reg, u8 val);
64void da9150_set_bits(struct da9150 *da9150, u16 reg, u8 mask, u8 val);
65
66void da9150_bulk_read(struct da9150 *da9150, u16 reg, int count, u8 *buf);
67void da9150_bulk_write(struct da9150 *da9150, u16 reg, int count, const u8 *buf);
68#endif /* __DA9150_CORE_H */
69