Anirudh Ghayal | c201933 | 2011-11-12 06:29:10 +0530 | [diff] [blame] | 1 | /* Copyright (c) 2010,2011 Code Aurora Forum. All rights reserved. |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 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 | */ |
Anirudh Ghayal | c201933 | 2011-11-12 06:29:10 +0530 | [diff] [blame] | 13 | #ifndef __PM8XXX_NFC_H__ |
| 14 | #define __PM8XXX_NFC_H__ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 15 | |
Anirudh Ghayal | c201933 | 2011-11-12 06:29:10 +0530 | [diff] [blame] | 16 | struct pm8xxx_nfc_device; |
| 17 | |
| 18 | #define PM8XXX_NFC_DEV_NAME "pm8xxx-nfc" |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 19 | |
| 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 Ghayal | c201933 | 2011-11-12 06:29:10 +0530 | [diff] [blame] | 51 | * pm8xxx_nfc_request - request a handle to access NFC device |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 52 | */ |
Anirudh Ghayal | c201933 | 2011-11-12 06:29:10 +0530 | [diff] [blame] | 53 | struct pm8xxx_nfc_device *pm8xxx_nfc_request(void); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 54 | |
| 55 | /* |
Anirudh Ghayal | c201933 | 2011-11-12 06:29:10 +0530 | [diff] [blame] | 56 | * pm8xxx_nfc_config - configure NFC signals |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 57 | * |
| 58 | * @nfcdev: the NFC device |
| 59 | * @mask: signal mask to configure |
| 60 | * @flags: control flags |
| 61 | */ |
Anirudh Ghayal | c201933 | 2011-11-12 06:29:10 +0530 | [diff] [blame] | 62 | int pm8xxx_nfc_config(struct pm8xxx_nfc_device *nfcdev, u32 mask, u32 flags); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 63 | |
| 64 | /* |
Anirudh Ghayal | c201933 | 2011-11-12 06:29:10 +0530 | [diff] [blame] | 65 | * pm8xxx_nfc_get_status - get NFC status |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 66 | * |
| 67 | * @nfcdev: the NFC device |
| 68 | * @mask: of status mask to read |
| 69 | * @status: pointer to the status variable |
| 70 | */ |
Anirudh Ghayal | c201933 | 2011-11-12 06:29:10 +0530 | [diff] [blame] | 71 | int pm8xxx_nfc_get_status(struct pm8xxx_nfc_device *nfcdev, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 72 | u32 mask, u32 *status); |
| 73 | |
| 74 | /* |
Anirudh Ghayal | c201933 | 2011-11-12 06:29:10 +0530 | [diff] [blame] | 75 | * pm8xxx_nfc_free - free the NFC device |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 76 | */ |
Anirudh Ghayal | c201933 | 2011-11-12 06:29:10 +0530 | [diff] [blame] | 77 | void pm8xxx_nfc_free(struct pm8xxx_nfc_device *nfcdev); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 78 | |
Anirudh Ghayal | c201933 | 2011-11-12 06:29:10 +0530 | [diff] [blame] | 79 | #endif /* __PM8XXX_NFC_H__ */ |