blob: e575e0d3472e671ab863ce75ae59a29bebd445d8 [file] [log] [blame]
Asish Bhattacharya8e2277f2017-07-20 18:31:55 +05301/* 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>
Laxminath Kasam605b42f2017-08-01 22:02:15 +053014#include "msm-cdc-pinctrl.h"
15#include "wcd9xxx-irq.h"
16#include "core.h"
Asish Bhattacharya8e2277f2017-07-20 18:31:55 +053017
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");