blob: e58e0a90be4fdacbbb1d1d76056f1aff8f15c293 [file] [log] [blame]
Anirudh Ghayalc2019332011-11-12 06:29:10 +05301/* Copyright (c) 2010,2011 Code Aurora Forum. All rights reserved.
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002 *
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 */
Anirudh Ghayalc2019332011-11-12 06:29:10 +053013#ifndef __PM8XXX_NFC_H__
14#define __PM8XXX_NFC_H__
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070015
Anirudh Ghayalc2019332011-11-12 06:29:10 +053016struct pm8xxx_nfc_device;
17
18#define PM8XXX_NFC_DEV_NAME "pm8xxx-nfc"
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070019
20/* masks, flags and status */
21#define PM_NFC_VDDLDO_MON_LEVEL 0x0003
22#define PM_NFC_VPH_PWR_EN 0x0008
23#define PM_NFC_EXT_VDDLDO_EN 0x0010
24#define PM_NFC_EN 0x0020
25#define PM_NFC_LDO_EN 0x0040
26#define PM_NFC_SUPPORT_EN 0x0080
27
28#define PM_NFC_EXT_EN_HIGH 0x0100
29#define PM_NFC_MBG_EN_HIGH 0x0200
30#define PM_NFC_VDDLDO_OK_HIGH 0x0400
31#define PM_NFC_DTEST1_MODE 0x2000
32#define PM_NFC_ATEST_EN 0x4000
33#define PM_NFC_VDDLDO_MON_EN 0x8000
34
35#define PM_NFC_CTRL_REQ (PM_NFC_SUPPORT_EN |\
36 PM_NFC_LDO_EN |\
37 PM_NFC_EN |\
38 PM_NFC_EXT_VDDLDO_EN |\
39 PM_NFC_VPH_PWR_EN |\
40 PM_NFC_VDDLDO_MON_LEVEL)
41
42#define PM_NFC_TEST_REQ (PM_NFC_VDDLDO_MON_EN |\
43 PM_NFC_DTEST1_MODE |\
44 PM_NFC_ATEST_EN)
45
46#define PM_NFC_TEST_STATUS (PM_NFC_EXT_EN_HIGH |\
47 PM_NFC_MBG_EN_HIGH |\
48 PM_NFC_VDDLDO_OK_HIGH)
49
50/*
Anirudh Ghayalc2019332011-11-12 06:29:10 +053051 * pm8xxx_nfc_request - request a handle to access NFC device
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070052 */
Anirudh Ghayalc2019332011-11-12 06:29:10 +053053struct pm8xxx_nfc_device *pm8xxx_nfc_request(void);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070054
55/*
Anirudh Ghayalc2019332011-11-12 06:29:10 +053056 * pm8xxx_nfc_config - configure NFC signals
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070057 *
58 * @nfcdev: the NFC device
59 * @mask: signal mask to configure
60 * @flags: control flags
61 */
Anirudh Ghayalc2019332011-11-12 06:29:10 +053062int pm8xxx_nfc_config(struct pm8xxx_nfc_device *nfcdev, u32 mask, u32 flags);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070063
64/*
Anirudh Ghayalc2019332011-11-12 06:29:10 +053065 * pm8xxx_nfc_get_status - get NFC status
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070066 *
67 * @nfcdev: the NFC device
68 * @mask: of status mask to read
69 * @status: pointer to the status variable
70 */
Anirudh Ghayalc2019332011-11-12 06:29:10 +053071int pm8xxx_nfc_get_status(struct pm8xxx_nfc_device *nfcdev,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070072 u32 mask, u32 *status);
73
74/*
Anirudh Ghayalc2019332011-11-12 06:29:10 +053075 * pm8xxx_nfc_free - free the NFC device
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070076 */
Anirudh Ghayalc2019332011-11-12 06:29:10 +053077void pm8xxx_nfc_free(struct pm8xxx_nfc_device *nfcdev);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070078
Anirudh Ghayalc2019332011-11-12 06:29:10 +053079#endif /* __PM8XXX_NFC_H__ */