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