1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 /*
3 * System Control Driver
4 *
5 * Copyright (C) 2012 Freescale Semiconductor, Inc.
6 * Copyright (C) 2012 Linaro Ltd.
7 *
8 * Author: Dong Aisheng <dong.aisheng@linaro.org>
9 */
10
11 #ifndef __LINUX_MFD_SYSCON_H__
12 #define __LINUX_MFD_SYSCON_H__
13
14 #include <linux/err.h>
15 #include <linux/errno.h>
16
17 struct device_node;
18
19 #ifdef CONFIG_MFD_SYSCON
20 extern struct regmap *device_node_to_regmap(struct device_node *np);
21 extern struct regmap *syscon_node_to_regmap(struct device_node *np);
22 extern struct regmap *syscon_regmap_lookup_by_compatible(const char *s);
23 extern struct regmap *syscon_regmap_lookup_by_phandle(
24 struct device_node *np,
25 const char *property);
26 extern struct regmap *syscon_regmap_lookup_by_phandle_args(
27 struct device_node *np,
28 const char *property,
29 int arg_count,
30 unsigned int *out_args);
31 extern struct regmap *syscon_regmap_lookup_by_phandle_optional(
32 struct device_node *np,
33 const char *property);
34 #else
device_node_to_regmap(struct device_node * np)35 static inline struct regmap *device_node_to_regmap(struct device_node *np)
36 {
37 return ERR_PTR(-ENOTSUPP);
38 }
39
syscon_node_to_regmap(struct device_node * np)40 static inline struct regmap *syscon_node_to_regmap(struct device_node *np)
41 {
42 return ERR_PTR(-ENOTSUPP);
43 }
44
syscon_regmap_lookup_by_compatible(const char * s)45 static inline struct regmap *syscon_regmap_lookup_by_compatible(const char *s)
46 {
47 return ERR_PTR(-ENOTSUPP);
48 }
49
syscon_regmap_lookup_by_phandle(struct device_node * np,const char * property)50 static inline struct regmap *syscon_regmap_lookup_by_phandle(
51 struct device_node *np,
52 const char *property)
53 {
54 return ERR_PTR(-ENOTSUPP);
55 }
56
syscon_regmap_lookup_by_phandle_args(struct device_node * np,const char * property,int arg_count,unsigned int * out_args)57 static inline struct regmap *syscon_regmap_lookup_by_phandle_args(
58 struct device_node *np,
59 const char *property,
60 int arg_count,
61 unsigned int *out_args)
62 {
63 return ERR_PTR(-ENOTSUPP);
64 }
65
syscon_regmap_lookup_by_phandle_optional(struct device_node * np,const char * property)66 static inline struct regmap *syscon_regmap_lookup_by_phandle_optional(
67 struct device_node *np,
68 const char *property)
69 {
70 return NULL;
71 }
72
73 #endif
74
75 #endif /* __LINUX_MFD_SYSCON_H__ */
76