• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #ifndef __DRV_BASE_EXT_H__
20 #define __DRV_BASE_EXT_H__
21 
22 #include "hi_type.h"
23 
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27 
28 extern struct platform_driver g_hi_virt_pltm_driver;
29 
30 int hi_get_irq_byname(char *name);
31 
32 #ifdef HI_UNIFIED_IMAGE_SUPPORT
33 extern struct platform_driver g_hi_unifiedimg_pltm_driver;
34 /**
35  * hi_get_dts_config_u32array_byname - Used to get the u32 array information from DTS
36  *
37  * @node_name: ptr to node name in device tree, example: panel
38  * @name: ptr to propertiy name in device tree, example: i2c_reg_addr_offset
39  * @out_values: ptr to u32 array
40  * @num: num of u32 array
41  * returns: if fail, return <0, if success, return the real len of array.
42  */
43 hi_s32 hi_get_dts_config_u32array_byname(hi_char *node_name,
44     hi_char *name, hi_u32 *out_values, hi_u32 num);
45 
46 /**
47  * hi_get_dts_config_bool_byname - Used to get the bool information from DTS
48  *
49  * @node_name: ptr to node name in device tree, example: panel
50  * @name: ptr to propertiy name in device tree, example: pwm_support
51  * returns: if exist name, return non-NULL, if not exist name, return NULL.
52  */
53 hi_bool hi_get_dts_config_bool_byname(hi_char *node_name, hi_char *name);
54 
55 /**
56  * hi_get_dts_config_u32_byname - Used to get u32 information from DTS
57  *
58  * @node_name: ptr to node name in device tree, example: panel
59  * @name: ptr to propertiy name in device tree, example: pwm_value
60  * @out_value: ptr to u32 value in device tree
61  * returns: if exist name, return 0, if not exist name, return non 0.
62  */
63 hi_s32 hi_get_dts_config_u32_byname(hi_char *node_name,
64     hi_char *name, hi_u32 *out_value);
65 
66 /**
67  * hi_get_dts_config_string_byname - Used to get string information from DTS
68  *
69  * @node_name: ptr to node name in device tree, example: panel
70  * @name: ptr to propertiy name in device tree, example: pwm_value
71  * @out_string: ptr to string value in device tree
72  * returns: if exist name, return >=0, if not exist name, return <0.
73  */
74 hi_s32 hi_get_dts_config_string_byname(hi_char *node_name,
75     hi_char *name, const hi_char **out_string);
76 #endif
77 
78 #ifdef CMN_TEST_SUPPORTED
79 hi_void hi_drv_test_init(HI_VOID);
80 hi_void hi_drv_test_exit(HI_VOID);
81 #endif
82 
83 #ifdef __cplusplus
84 }
85 #endif
86 
87 #endif
88 
89