nfc.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. /* Copyright (c) 2010,2011 The Linux Foundation. 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 __PM8XXX_NFC_H__
  14. #define __PM8XXX_NFC_H__
  15. struct pm8xxx_nfc_device;
  16. #define PM8XXX_NFC_DEV_NAME "pm8xxx-nfc"
  17. /* masks, flags and status */
  18. #define PM_NFC_VDDLDO_MON_LEVEL 0x0003
  19. #define PM_NFC_VPH_PWR_EN 0x0008
  20. #define PM_NFC_EXT_VDDLDO_EN 0x0010
  21. #define PM_NFC_EN 0x0020
  22. #define PM_NFC_LDO_EN 0x0040
  23. #define PM_NFC_SUPPORT_EN 0x0080
  24. #define PM_NFC_EXT_EN_HIGH 0x0100
  25. #define PM_NFC_MBG_EN_HIGH 0x0200
  26. #define PM_NFC_VDDLDO_OK_HIGH 0x0400
  27. #define PM_NFC_DTEST1_MODE 0x2000
  28. #define PM_NFC_ATEST_EN 0x4000
  29. #define PM_NFC_VDDLDO_MON_EN 0x8000
  30. #define PM_NFC_CTRL_REQ (PM_NFC_SUPPORT_EN |\
  31. PM_NFC_LDO_EN |\
  32. PM_NFC_EN |\
  33. PM_NFC_EXT_VDDLDO_EN |\
  34. PM_NFC_VPH_PWR_EN |\
  35. PM_NFC_VDDLDO_MON_LEVEL)
  36. #define PM_NFC_TEST_REQ (PM_NFC_VDDLDO_MON_EN |\
  37. PM_NFC_DTEST1_MODE |\
  38. PM_NFC_ATEST_EN)
  39. #define PM_NFC_TEST_STATUS (PM_NFC_EXT_EN_HIGH |\
  40. PM_NFC_MBG_EN_HIGH |\
  41. PM_NFC_VDDLDO_OK_HIGH)
  42. /*
  43. * pm8xxx_nfc_request - request a handle to access NFC device
  44. */
  45. struct pm8xxx_nfc_device *pm8xxx_nfc_request(void);
  46. /*
  47. * pm8xxx_nfc_config - configure NFC signals
  48. *
  49. * @nfcdev: the NFC device
  50. * @mask: signal mask to configure
  51. * @flags: control flags
  52. */
  53. int pm8xxx_nfc_config(struct pm8xxx_nfc_device *nfcdev, u32 mask, u32 flags);
  54. /*
  55. * pm8xxx_nfc_get_status - get NFC status
  56. *
  57. * @nfcdev: the NFC device
  58. * @mask: of status mask to read
  59. * @status: pointer to the status variable
  60. */
  61. int pm8xxx_nfc_get_status(struct pm8xxx_nfc_device *nfcdev,
  62. u32 mask, u32 *status);
  63. /*
  64. * pm8xxx_nfc_free - free the NFC device
  65. */
  66. void pm8xxx_nfc_free(struct pm8xxx_nfc_device *nfcdev);
  67. #endif /* __PM8XXX_NFC_H__ */