Linux Kernel
3.7.1
Main Page
Related Pages
Modules
Namespaces
Data Structures
Files
File List
Globals
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Groups
Pages
include
linux
mfd
da9055
core.h
Go to the documentation of this file.
1
/*
2
* da9055 declarations for DA9055 PMICs.
3
*
4
* Copyright(c) 2012 Dialog Semiconductor Ltd.
5
*
6
* Author: David Dajun Chen <
[email protected]
>
7
*
8
* This program is free software; you can redistribute it and/or modify
9
* it under the terms of the GNU General Public License as published by
10
* the Free Software Foundation; either version 2 of the License, or
11
* (at your option) any later version.
12
*
13
* This program is distributed in the hope that it will be useful,
14
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
* GNU General Public License for more details.
17
*
18
* You should have received a copy of the GNU General Public License
19
* along with this program; if not, write to the Free Software
20
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21
*
22
*/
23
24
#ifndef __DA9055_CORE_H
25
#define __DA9055_CORE_H
26
27
#include <
linux/interrupt.h
>
28
#include <
linux/regmap.h
>
29
30
/*
31
* PMIC IRQ
32
*/
33
#define DA9055_IRQ_ALARM 0x01
34
#define DA9055_IRQ_TICK 0x02
35
#define DA9055_IRQ_NONKEY 0x00
36
#define DA9055_IRQ_REGULATOR 0x0B
37
#define DA9055_IRQ_HWMON 0x03
38
39
struct
da9055_pdata
;
40
41
struct
da9055
{
42
struct
regmap
*
regmap
;
43
struct
regmap_irq_chip_data
*
irq_data
;
44
struct
device
*
dev
;
45
struct
i2c_client
*
i2c_client
;
46
47
int
irq_base
;
48
int
chip_irq
;
49
};
50
51
/* Device I/O */
52
static
inline
int
da9055_reg_read(
struct
da9055
*
da9055
,
unsigned
char
reg
)
53
{
54
int
val
,
ret
;
55
56
ret =
regmap_read
(da9055->
regmap
, reg, &val);
57
if
(ret < 0)
58
return
ret
;
59
60
return
val
;
61
}
62
63
static
inline
int
da9055_reg_write(
struct
da9055
*
da9055
,
unsigned
char
reg
,
64
unsigned
char
val
)
65
{
66
return
regmap_write
(da9055->
regmap
, reg, val);
67
}
68
69
static
inline
int
da9055_group_read(
struct
da9055
*
da9055
,
unsigned
char
reg
,
70
unsigned
reg_cnt,
unsigned
char
*
val
)
71
{
72
return
regmap_bulk_read
(da9055->
regmap
, reg, val, reg_cnt);
73
}
74
75
static
inline
int
da9055_group_write(
struct
da9055
*
da9055
,
unsigned
char
reg
,
76
unsigned
reg_cnt,
unsigned
char
*
val
)
77
{
78
return
regmap_raw_write
(da9055->
regmap
, reg, val, reg_cnt);
79
}
80
81
static
inline
int
da9055_reg_update(
struct
da9055
*
da9055
,
unsigned
char
reg
,
82
unsigned
char
bit_mask,
83
unsigned
char
reg_val
)
84
{
85
return
regmap_update_bits
(da9055->
regmap
, reg, bit_mask, reg_val);
86
}
87
88
/* Generic Device API */
89
int
da9055_device_init
(
struct
da9055
*
da9055
);
90
void
da9055_device_exit
(
struct
da9055
*
da9055
);
91
92
extern
struct
regmap_config
da9055_regmap_config
;
93
94
#endif
/* __DA9055_CORE_H */
Generated on Thu Jan 10 2013 12:58:11 for Linux Kernel by
1.8.2