blob: 5b2d6cfb0d847fec42e5b2dbec5c88db46838d73 [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_NFC_H__
14#define __PMIC8058_NFC_H__
15
16struct pm8058_nfc_device;
17
18/* masks, flags and status */
19#define PM_NFC_VDDLDO_MON_LEVEL 0x0003
20#define PM_NFC_VPH_PWR_EN 0x0008
21#define PM_NFC_EXT_VDDLDO_EN 0x0010
22#define PM_NFC_EN 0x0020
23#define PM_NFC_LDO_EN 0x0040
24#define PM_NFC_SUPPORT_EN 0x0080
25
26#define PM_NFC_EXT_EN_HIGH 0x0100
27#define PM_NFC_MBG_EN_HIGH 0x0200
28#define PM_NFC_VDDLDO_OK_HIGH 0x0400
29#define PM_NFC_DTEST1_MODE 0x2000
30#define PM_NFC_ATEST_EN 0x4000
31#define PM_NFC_VDDLDO_MON_EN 0x8000
32
33#define PM_NFC_CTRL_REQ (PM_NFC_SUPPORT_EN |\
34 PM_NFC_LDO_EN |\
35 PM_NFC_EN |\
36 PM_NFC_EXT_VDDLDO_EN |\
37 PM_NFC_VPH_PWR_EN |\
38 PM_NFC_VDDLDO_MON_LEVEL)
39
40#define PM_NFC_TEST_REQ (PM_NFC_VDDLDO_MON_EN |\
41 PM_NFC_DTEST1_MODE |\
42 PM_NFC_ATEST_EN)
43
44#define PM_NFC_TEST_STATUS (PM_NFC_EXT_EN_HIGH |\
45 PM_NFC_MBG_EN_HIGH |\
46 PM_NFC_VDDLDO_OK_HIGH)
47
48/*
49 * pm8058_nfc_request - request a handle to access NFC device
50 */
51struct pm8058_nfc_device *pm8058_nfc_request(void);
52
53/*
54 * pm8058_nfc_config - configure NFC signals
55 *
56 * @nfcdev: the NFC device
57 * @mask: signal mask to configure
58 * @flags: control flags
59 */
60int pm8058_nfc_config(struct pm8058_nfc_device *nfcdev, u32 mask, u32 flags);
61
62/*
63 * pm8058_nfc_get_status - get NFC status
64 *
65 * @nfcdev: the NFC device
66 * @mask: of status mask to read
67 * @status: pointer to the status variable
68 */
69int pm8058_nfc_get_status(struct pm8058_nfc_device *nfcdev,
70 u32 mask, u32 *status);
71
72/*
73 * pm8058_nfc_free - free the NFC device
74 */
75void pm8058_nfc_free(struct pm8058_nfc_device *nfcdev);
76
77#endif /* __PMIC8058_NFC_H__ */