wmt_gpio.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. /*
  2. * Copyright (C) 2011-2014 MediaTek Inc.
  3. *
  4. * This program is free software: you can redistribute it and/or modify it under the terms of the
  5. * GNU General Public License version 2 as published by the Free Software Foundation.
  6. *
  7. * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
  8. * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  9. * See the GNU General Public License for more details.
  10. *
  11. * You should have received a copy of the GNU General Public License along with this program.
  12. * If not, see <http://www.gnu.org/licenses/>.
  13. */
  14. #ifndef _WMT_GPIO_H_
  15. #define _WMT_GPIO_H_
  16. #include <linux/of.h>
  17. #include <linux/of_gpio.h>
  18. #include <linux/pinctrl/consumer.h>
  19. #include <linux/pinctrl/pinctrl.h>
  20. #include <linux/gpio.h>
  21. #include <linux/platform_device.h>
  22. #include "osal.h"
  23. /*******************************************************************************
  24. * C O M P I L E R F L A G S
  25. ********************************************************************************
  26. */
  27. /*******************************************************************************
  28. * M A C R O S
  29. ********************************************************************************
  30. */
  31. #define DEFAULT_PIN_ID (0xffffffff)
  32. /*******************************************************************************
  33. * D A T A T Y P E S
  34. ********************************************************************************
  35. */
  36. typedef enum _ENUM_GPIO_PIN_ID {
  37. GPIO_COMBO_LDO_EN_PIN = 0,
  38. GPIO_COMBO_PMUV28_EN_PIN,
  39. GPIO_COMBO_PMU_EN_PIN,
  40. GPIO_COMBO_RST_PIN,
  41. GPIO_COMBO_BGF_EINT_PIN,
  42. GPIO_WIFI_EINT_PIN,
  43. GPIO_COMBO_ALL_EINT_PIN,
  44. GPIO_COMBO_URXD_PIN,
  45. GPIO_COMBO_UTXD_PIN,
  46. GPIO_PCM_DAICLK_PIN,
  47. GPIO_PCM_DAIPCMIN_PIN,
  48. GPIO_PCM_DAIPCMOUT_PIN,
  49. GPIO_PCM_DAISYNC_PIN,
  50. GPIO_COMBO_I2S_CK_PIN,
  51. GPIO_COMBO_I2S_WS_PIN,
  52. GPIO_COMBO_I2S_DAT_PIN,
  53. GPIO_GPS_SYNC_PIN,
  54. GPIO_GPS_LNA_PIN,
  55. GPIO_PIN_ID_MAX
  56. } ENUM_GPIO_PIN_ID, *P_ENUM_GPIO_PIN_ID;
  57. typedef enum _ENUM_GPIO_STATE_ID {
  58. GPIO_PULL_DIS = 0,
  59. GPIO_PULL_DOWN,
  60. GPIO_PULL_UP,
  61. GPIO_OUT_LOW,
  62. GPIO_OUT_HIGH,
  63. GPIO_IN_DIS,
  64. GPIO_IN_EN,
  65. GPIO_IN_PULL_DIS,
  66. GPIO_IN_PULLDOWN,
  67. GPIO_IN_PULLUP,
  68. GPIO_STATE_MAX,
  69. } ENUM_GPIO_STATE_ID, *P_ENUM_GPIO_STATE_ID;
  70. typedef struct _GPIO_CTRL_STATE {
  71. INT32 gpio_num;
  72. struct pinctrl_state *gpio_state[GPIO_STATE_MAX];
  73. } GPIO_CTRL_STATE, *P_GPIO_CTRL_STATE;
  74. typedef struct _GPIO_CTRL_INFO {
  75. struct pinctrl *pinctrl_info;
  76. GPIO_CTRL_STATE gpio_ctrl_state[GPIO_PIN_ID_MAX];
  77. } GPIO_CTRL_INFO, *P_GPIO_CTRL_INFO;
  78. /*******************************************************************************
  79. * E X T E R N A L R E F E R E N C E S
  80. ********************************************************************************
  81. */
  82. extern const PUINT8 gpio_state_name[GPIO_PIN_ID_MAX][GPIO_STATE_MAX];
  83. extern const PUINT8 gpio_pin_name[GPIO_PIN_ID_MAX];
  84. extern GPIO_CTRL_INFO gpio_ctrl_info;
  85. /*******************************************************************************
  86. * F U N C T I O N D E C L A R A T I O N S
  87. ********************************************************************************
  88. */
  89. INT32 wmt_gpio_init(struct platform_device *pdev);
  90. INT32 wmt_gpio_deinit(VOID);
  91. #endif