blob: a5ded35d9226bcc7bc3be46c972b9b9fc3c31d0f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
/*
* TWL4030 input
*
* Copyright (C) 2015 Paul Kocialkowski <contact@paulk.fr>
*
* SPDX-License-Identifier: GPL-2.0+
*/
#include <twl4030.h>
int twl4030_input_power_button(void)
{
u8 data;
twl4030_i2c_read_u8(TWL4030_CHIP_PM_MASTER,
TWL4030_PM_MASTER_STS_HW_CONDITIONS, &data);
if (data & TWL4030_PM_MASTER_STS_HW_CONDITIONS_PWON)
return 1;
return 0;
}
int twl4030_input_charger(void)
{
u8 data;
twl4030_i2c_read_u8(TWL4030_CHIP_PM_MASTER,
TWL4030_PM_MASTER_STS_HW_CONDITIONS, &data);
if (data & TWL4030_PM_MASTER_STS_HW_CONDITIONS_CHG)
return 1;
return 0;
}
int twl4030_input_usb(void)
{
u8 data;
twl4030_i2c_read_u8(TWL4030_CHIP_PM_MASTER,
TWL4030_PM_MASTER_STS_HW_CONDITIONS, &data);
if (data & TWL4030_PM_MASTER_STS_HW_CONDITIONS_USB ||
data & TWL4030_PM_MASTER_STS_HW_CONDITIONS_VBUS)
return 1;
return 0;
}
|