blob: a4fcc90b0f208550561470549d2e0a187dc5b8a4 [file] [log] [blame]
Srinivas Kandagatlaeace75c2015-07-27 12:13:19 +01001/*
2 * nvmem framework provider.
3 *
4 * Copyright (C) 2015 Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
5 * Copyright (C) 2013 Maxime Ripard <maxime.ripard@free-electrons.com>
6 *
7 * This file is licensed under the terms of the GNU General Public
8 * License version 2. This program is licensed "as is" without any
9 * warranty of any kind, whether express or implied.
10 */
11
12#ifndef _LINUX_NVMEM_PROVIDER_H
13#define _LINUX_NVMEM_PROVIDER_H
14
15struct nvmem_device;
16struct nvmem_cell_info;
17
18struct nvmem_config {
19 struct device *dev;
20 const char *name;
21 int id;
22 struct module *owner;
23 const struct nvmem_cell_info *cells;
24 int ncells;
25 bool read_only;
Andrew Lunn811b0d62016-02-26 20:59:18 +010026 bool root_only;
Andrew Lunnb6c217a2016-02-26 20:59:19 +010027 /* To be only used by old driver/misc/eeprom drivers */
28 bool compat;
29 struct device *base_dev;
Srinivas Kandagatlaeace75c2015-07-27 12:13:19 +010030};
31
32#if IS_ENABLED(CONFIG_NVMEM)
33
34struct nvmem_device *nvmem_register(const struct nvmem_config *cfg);
35int nvmem_unregister(struct nvmem_device *nvmem);
36
37#else
38
39static inline struct nvmem_device *nvmem_register(const struct nvmem_config *c)
40{
41 return ERR_PTR(-ENOSYS);
42}
43
44static inline int nvmem_unregister(struct nvmem_device *nvmem)
45{
46 return -ENOSYS;
47}
48
49#endif /* CONFIG_NVMEM */
Srinivas Kandagatlaeace75c2015-07-27 12:13:19 +010050#endif /* ifndef _LINUX_NVMEM_PROVIDER_H */