summaryrefslogtreecommitdiff
path: root/asoc/codecs/wcd9xxx-core-init.c
blob: cd35a9e24b121bf4c97aa33c3f7a46fb649d5d81 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
// SPDX-License-Identifier: GPL-2.0-only
/* Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
 */

#include <linux/module.h>
#include <asoc/msm-cdc-pinctrl.h>
#include <asoc/wcd9xxx-irq.h>
#include <asoc/core.h>

#define NUM_DRIVERS_REG_RET 3

static int __init wcd9xxx_core_init(void)
{
	int ret[NUM_DRIVERS_REG_RET] = {0};
	int i = 0;

	ret[0] = msm_cdc_pinctrl_drv_init();
	if (ret[0])
		pr_err("%s: Failed init pinctrl drv: %d\n", __func__, ret[0]);

	ret[1] = wcd9xxx_irq_drv_init();
	if (ret[1])
		pr_err("%s: Failed init irq drv: %d\n", __func__, ret[1]);

	ret[2] = wcd9xxx_init();
	if (ret[2])
		pr_err("%s: Failed wcd core drv: %d\n", __func__, ret[2]);

	for (i = 0; i < NUM_DRIVERS_REG_RET; i++) {
		if (ret[i])
			return ret[i];
	}

	return 0;
}
module_init(wcd9xxx_core_init);

static void __exit wcd9xxx_core_exit(void)
{
	wcd9xxx_exit();
	wcd9xxx_irq_drv_exit();
	msm_cdc_pinctrl_drv_exit();
}
module_exit(wcd9xxx_core_exit);

MODULE_DESCRIPTION("WCD9XXX CODEC core init driver");
MODULE_LICENSE("GPL v2");