Srinivas Kandagatla | eace75c | 2015-07-27 12:13:19 +0100 | [diff] [blame] | 1 | /* |
| 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 | |
| 15 | struct nvmem_device; |
| 16 | struct nvmem_cell_info; |
| 17 | |
| 18 | struct 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 Lunn | 811b0d6 | 2016-02-26 20:59:18 +0100 | [diff] [blame^] | 26 | bool root_only; |
Srinivas Kandagatla | eace75c | 2015-07-27 12:13:19 +0100 | [diff] [blame] | 27 | }; |
| 28 | |
| 29 | #if IS_ENABLED(CONFIG_NVMEM) |
| 30 | |
| 31 | struct nvmem_device *nvmem_register(const struct nvmem_config *cfg); |
| 32 | int nvmem_unregister(struct nvmem_device *nvmem); |
| 33 | |
| 34 | #else |
| 35 | |
| 36 | static inline struct nvmem_device *nvmem_register(const struct nvmem_config *c) |
| 37 | { |
| 38 | return ERR_PTR(-ENOSYS); |
| 39 | } |
| 40 | |
| 41 | static inline int nvmem_unregister(struct nvmem_device *nvmem) |
| 42 | { |
| 43 | return -ENOSYS; |
| 44 | } |
| 45 | |
| 46 | #endif /* CONFIG_NVMEM */ |
| 47 | |
| 48 | #endif /* ifndef _LINUX_NVMEM_PROVIDER_H */ |