mdm_private.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. /* Copyright (c) 2011-2013, 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. #ifndef _ARCH_ARM_MACH_MSM_MDM_PRIVATE_H
  13. #define _ARCH_ARM_MACH_MSM_MDM_PRIVATE_H
  14. #define MDM_DEBUG_MASK_VDDMIN_SETUP (0x00000002)
  15. #define MDM_DEBUG_MASK_SHDN_LOG (0x00000004)
  16. #define INVALID_GPIO (-1)
  17. #define GPIO_IS_VALID(gpio) \
  18. (gpio != INVALID_GPIO)
  19. #define MDM_GPIO(i) \
  20. (mdm_drv->gpios[i])
  21. struct mdm_modem_drv;
  22. enum {
  23. MDM2AP_ERRFATAL = 0,
  24. AP2MDM_ERRFATAL,
  25. MDM2AP_STATUS,
  26. AP2MDM_STATUS,
  27. AP2MDM_SOFT_RESET,
  28. MDM2AP_WAKEUP,
  29. AP2MDM_WAKEUP,
  30. AP2MDM_CHNLRDY,
  31. AP2MDM_KPDPWR,
  32. AP2MDM_PMIC_PWR_EN,
  33. MDM2AP_PBLRDY,
  34. USB_SW,
  35. AP2MDM_VDDMIN,
  36. MDM2AP_VDDMIN,
  37. GPIO_TOTAL
  38. };
  39. struct mdm_ops {
  40. void (*power_on_mdm_cb)(struct mdm_modem_drv *mdm_drv);
  41. void (*reset_mdm_cb)(struct mdm_modem_drv *mdm_drv);
  42. void (*atomic_reset_mdm_cb)(struct mdm_modem_drv *mdm_drv);
  43. void (*normal_boot_done_cb)(struct mdm_modem_drv *mdm_drv);
  44. void (*power_down_mdm_cb)(struct mdm_modem_drv *mdm_drv);
  45. void (*debug_state_changed_cb)(int value);
  46. void (*status_cb)(struct mdm_modem_drv *mdm_drv, int value);
  47. void (*image_upgrade_cb)(struct mdm_modem_drv *mdm_drv, int type);
  48. };
  49. /* Private mdm2 data structure */
  50. struct mdm_modem_drv {
  51. unsigned gpios[GPIO_TOTAL];
  52. atomic_t mdm_ready;
  53. int mdm_boot_status;
  54. int mdm_ram_dump_status;
  55. enum charm_boot_type boot_type;
  56. int mdm_debug_on;
  57. int mdm_unexpected_reset_occurred;
  58. int disable_status_check;
  59. unsigned int dump_timeout_ms;
  60. int power_on_count;
  61. int peripheral_status;
  62. struct mutex peripheral_status_lock;
  63. int device_id;
  64. bool need_clean_reset;
  65. struct mdm_platform_data *pdata;
  66. };
  67. int mdm_get_ops(struct mdm_ops **mdm_ops);
  68. #endif