Merge tag 'mm-hotfixes-stable-2025-07-11-16-16' of git://git.kernel.org/pub/scm/linux...
[linux-2.6-block.git] / include / linux / mfd / syscon.h
CommitLineData
2874c5fd 1/* SPDX-License-Identifier: GPL-2.0-or-later */
87d68730
DA
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>
87d68730
DA
9 */
10
11#ifndef __LINUX_MFD_SYSCON_H__
12#define __LINUX_MFD_SYSCON_H__
13
3d237990 14#include <linux/err.h>
adae28c5 15#include <linux/errno.h>
3d237990 16
5fb1c2dd
SN
17struct device_node;
18
df73de9b 19#ifdef CONFIG_MFD_SYSCON
0db017f8
PG
20struct regmap *device_node_to_regmap(struct device_node *np);
21struct regmap *syscon_node_to_regmap(struct device_node *np);
22struct regmap *syscon_regmap_lookup_by_compatible(const char *s);
23struct regmap *syscon_regmap_lookup_by_phandle(struct device_node *np,
24 const char *property);
25struct regmap *syscon_regmap_lookup_by_phandle_args(struct device_node *np,
26 const char *property,
27 int arg_count,
28 unsigned int *out_args);
29struct regmap *syscon_regmap_lookup_by_phandle_optional(struct device_node *np,
30 const char *property);
769cb631
PG
31int of_syscon_register_regmap(struct device_node *np,
32 struct regmap *regmap);
df73de9b 33#else
39233b7c
PC
34static inline struct regmap *device_node_to_regmap(struct device_node *np)
35{
36 return ERR_PTR(-ENOTSUPP);
37}
38
df73de9b
PC
39static inline struct regmap *syscon_node_to_regmap(struct device_node *np)
40{
8c037e0c 41 return ERR_PTR(-ENOTSUPP);
df73de9b
PC
42}
43
44static inline struct regmap *syscon_regmap_lookup_by_compatible(const char *s)
45{
8c037e0c 46 return ERR_PTR(-ENOTSUPP);
df73de9b
PC
47}
48
df73de9b
PC
49static inline struct regmap *syscon_regmap_lookup_by_phandle(
50 struct device_node *np,
51 const char *property)
52{
8c037e0c 53 return ERR_PTR(-ENOTSUPP);
df73de9b 54}
6a24f567 55
5312f321 56static inline struct regmap *syscon_regmap_lookup_by_phandle_args(
6a24f567
OZ
57 struct device_node *np,
58 const char *property,
59 int arg_count,
60 unsigned int *out_args)
61{
62 return ERR_PTR(-ENOTSUPP);
63}
86b9d170
EBS
64
65static inline struct regmap *syscon_regmap_lookup_by_phandle_optional(
66 struct device_node *np,
67 const char *property)
68{
69 return NULL;
70}
71
769cb631
PG
72static inline int of_syscon_register_regmap(struct device_node *np,
73 struct regmap *regmap)
74{
75 return -EOPNOTSUPP;
76}
77
df73de9b
PC
78#endif
79
87d68730 80#endif /* __LINUX_MFD_SYSCON_H__ */