1 /* SPDX-License-Identifier: GPL-2.0 */
3 #ifndef _DRIVERS_NVMEM_H
4 #define _DRIVERS_NVMEM_H
6 #include <linux/device.h>
8 #include <linux/kref.h>
9 #include <linux/list.h>
10 #include <linux/nvmem-consumer.h>
11 #include <linux/nvmem-provider.h>
12 #include <linux/gpio/consumer.h>
26 struct bin_attribute eeprom;
27 struct device *base_dev;
28 struct list_head cells;
29 nvmem_reg_read_t reg_read;
30 nvmem_reg_write_t reg_write;
31 struct gpio_desc *wp_gpio;
35 #define to_nvmem_device(d) container_of(d, struct nvmem_device, dev)
36 #define FLAG_COMPAT BIT(0)
38 #ifdef CONFIG_NVMEM_SYSFS
39 const struct attribute_group **nvmem_sysfs_get_groups(void);
40 int nvmem_sysfs_setup_compat(struct nvmem_device *nvmem,
41 const struct nvmem_config *config);
42 void nvmem_sysfs_remove_compat(struct nvmem_device *nvmem,
43 const struct nvmem_config *config);
45 static inline const struct attribute_group **nvmem_sysfs_get_groups(void)
50 static inline int nvmem_sysfs_setup_compat(struct nvmem_device *nvmem,
51 const struct nvmem_config *config)
55 static inline void nvmem_sysfs_remove_compat(struct nvmem_device *nvmem,
56 const struct nvmem_config *config)
59 #endif /* CONFIG_NVMEM_SYSFS */
61 #endif /* _DRIVERS_NVMEM_H */