1 /*
2 * Copyright (C) 2022 HiSilicon (Shanghai) Technologies CO., LIMITED.
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 */
18
19 #include <linux/module.h>
20
21 #include "hi_log.h"
22 #include "hi_common.h"
23 #include "hi_drv_gpioi2c.h"
24 #include "hi_osal.h"
25
26 int g_i2c_mode;
27 module_param(g_i2c_mode, int, S_IRUGO);
28
get_var_i2c_mode(void)29 int *get_var_i2c_mode(void)
30 {
31 return &g_i2c_mode;
32 }
33
gpioi2c_drv_mod_init(hi_void)34 hi_s32 gpioi2c_drv_mod_init(hi_void)
35 {
36 hi_s32 ret;
37
38 #ifndef HI_MCE_SUPPORT
39 ret = hi_drv_gpioi2c_init();
40 #endif
41
42 #ifdef MODULE
43 HI_PRINT("Load hi_gpioi2c.ko success.\t(%s)\n", VERSION_STRING);
44 #endif
45 return HI_SUCCESS;
46 }
47
gpioi2c_drv_mod_exit(hi_void)48 hi_void gpioi2c_drv_mod_exit(hi_void)
49 {
50 #ifndef HI_MCE_SUPPORT
51 hi_drv_gpioi2c_de_init();
52 #endif
53
54 return;
55 }
56
57 #ifdef MODULE
58 module_init(gpioi2c_drv_mod_init);
59 module_exit(gpioi2c_drv_mod_exit);
60 #endif
61
62 MODULE_LICENSE("GPL");
63 MODULE_DESCRIPTION("HISILICON");
64