upl.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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_UPL_H__
  14. #define __PM8XXX_UPL_H__
  15. struct pm8xxx_upl_device;
  16. #define PM8XXX_UPL_DEV_NAME "pm8xxx-upl"
  17. /* control masks and flags */
  18. #define PM8XXX_UPL_MOD_ENABLE_MASK (0x10)
  19. #define PM8XXX_UPL_MOD_ENABLE (0x10)
  20. #define PM8XXX_UPL_MOD_DISABLE (0x00)
  21. #define PM8XXX_UPL_OUT_DTEST_MASK (0xE0)
  22. #define PM8XXX_UPL_OUT_GPIO_ONLY (0x00)
  23. #define PM8XXX_UPL_OUT_DTEST_1 (0x80)
  24. #define PM8XXX_UPL_OUT_DTEST_2 (0xA0)
  25. #define PM8XXX_UPL_OUT_DTEST_3 (0xC0)
  26. #define PM8XXX_UPL_OUT_DTEST_4 (0xE0)
  27. #define PM8XXX_UPL_IN_A_MASK (0x01)
  28. #define PM8XXX_UPL_IN_A_GPIO (0x00)
  29. #define PM8XXX_UPL_IN_A_DTEST (0x01)
  30. #define PM8XXX_UPL_IN_B_MASK (0x02)
  31. #define PM8XXX_UPL_IN_B_GPIO (0x00)
  32. #define PM8XXX_UPL_IN_B_DTEST (0x02)
  33. #define PM8XXX_UPL_IN_C_MASK (0x04)
  34. #define PM8XXX_UPL_IN_C_GPIO (0x00)
  35. #define PM8XXX_UPL_IN_C_DTEST (0x04)
  36. #define PM8XXX_UPL_IN_D_MASK (0x08)
  37. #define PM8XXX_UPL_IN_D_GPIO (0x00)
  38. #define PM8XXX_UPL_IN_D_DTEST (0x08)
  39. /*
  40. * pm8xxx_upl_request - request a handle to access UPL device
  41. */
  42. struct pm8xxx_upl_device *pm8xxx_upl_request(void);
  43. int pm8xxx_upl_read_truthtable(struct pm8xxx_upl_device *upldev,
  44. u16 *truthtable);
  45. int pm8xxx_upl_write_truthtable(struct pm8xxx_upl_device *upldev,
  46. u16 truthtable);
  47. /*
  48. * pm8xxx_upl_config - configure UPL I/O settings and UPL enable/disable
  49. *
  50. * @upldev: the UPL device
  51. * @mask: setting mask to configure
  52. * @flags: setting flags
  53. */
  54. int pm8xxx_upl_config(struct pm8xxx_upl_device *upldev, u32 mask, u32 flags);
  55. #endif /* __PM8XXX_UPL_H__ */