wcd9xxx-core-init.c 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /* Copyright (c) 2017, 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. #include <linux/module.h>
  13. #include "msm-cdc-pinctrl.h"
  14. #include "wcd9xxx-irq.h"
  15. #include "core.h"
  16. #define NUM_DRIVERS_REG_RET 3
  17. static int __init wcd9xxx_core_init(void)
  18. {
  19. int ret[NUM_DRIVERS_REG_RET] = {0};
  20. int i = 0;
  21. ret[0] = msm_cdc_pinctrl_drv_init();
  22. if (ret[0])
  23. pr_err("%s: Failed init pinctrl drv: %d\n", __func__, ret[0]);
  24. ret[1] = wcd9xxx_irq_drv_init();
  25. if (ret[1])
  26. pr_err("%s: Failed init irq drv: %d\n", __func__, ret[1]);
  27. ret[2] = wcd9xxx_init();
  28. if (ret[2])
  29. pr_err("%s: Failed wcd core drv: %d\n", __func__, ret[2]);
  30. for (i = 0; i < NUM_DRIVERS_REG_RET; i++) {
  31. if (ret[i])
  32. return ret[i];
  33. }
  34. return 0;
  35. }
  36. module_init(wcd9xxx_core_init);
  37. static void __exit wcd9xxx_core_exit(void)
  38. {
  39. wcd9xxx_exit();
  40. wcd9xxx_irq_drv_exit();
  41. msm_cdc_pinctrl_drv_exit();
  42. }
  43. module_exit(wcd9xxx_core_exit);
  44. MODULE_DESCRIPTION("WCD9XXX CODEC core init driver");
  45. MODULE_LICENSE("GPL v2");