blob: a8979f42fc1375d653ffa11c09c3f63a6bdd0aa9 [file] [log] [blame]
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001/* Copyright (c) 2010, Code Aurora Forum. All rights reserved.
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License version 2 and
5 * only version 2 as published by the Free Software Foundation.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 *
12 */
13#ifndef __PMIC8058_UPL_H__
14#define __PMIC8058_UPL_H__
15
16struct pm8058_upl_device;
17
18/* control masks and flags */
19#define PM8058_UPL_MOD_ENABLE_MASK (0x10)
20#define PM8058_UPL_MOD_ENABLE (0x10)
21#define PM8058_UPL_MOD_DISABLE (0x00)
22
23#define PM8058_UPL_OUT_DTEST_MASK (0xE0)
24#define PM8058_UPL_OUT_GPIO_ONLY (0x00)
25#define PM8058_UPL_OUT_DTEST_1 (0x80)
26#define PM8058_UPL_OUT_DTEST_2 (0xA0)
27#define PM8058_UPL_OUT_DTEST_3 (0xC0)
28#define PM8058_UPL_OUT_DTEST_4 (0xE0)
29
30#define PM8058_UPL_IN_A_MASK (0x01)
31#define PM8058_UPL_IN_A_GPIO (0x00)
32#define PM8058_UPL_IN_A_DTEST (0x01)
33#define PM8058_UPL_IN_B_MASK (0x02)
34#define PM8058_UPL_IN_B_GPIO (0x00)
35#define PM8058_UPL_IN_B_DTEST (0x02)
36#define PM8058_UPL_IN_C_MASK (0x04)
37#define PM8058_UPL_IN_C_GPIO (0x00)
38#define PM8058_UPL_IN_C_DTEST (0x04)
39#define PM8058_UPL_IN_D_MASK (0x08)
40#define PM8058_UPL_IN_D_GPIO (0x00)
41#define PM8058_UPL_IN_D_DTEST (0x08)
42
43/*
44 * pm8058_upl_request - request a handle to access UPL device
45 */
46struct pm8058_upl_device *pm8058_upl_request(void);
47
48int pm8058_upl_read_truthtable(struct pm8058_upl_device *upldev,
49 u16 *truthtable);
50
51int pm8058_upl_write_truthtable(struct pm8058_upl_device *upldev,
52 u16 truthtable);
53
54/*
55 * pm8058_upl_config - configure UPL I/O settings and UPL enable/disable
56 *
57 * @upldev: the UPL device
58 * @mask: setting mask to configure
59 * @flags: setting flags
60 */
61int pm8058_upl_config(struct pm8058_upl_device *upldev, u32 mask, u32 flags);
62
63#endif /* __PMIC8058_UPL_H__ */