aboutsummaryrefslogtreecommitdiff
path: root/include/linux/eeprom-provider.h
blob: 21afdaa8d7af802d5aebbe1430307a9b1ab4a214 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/*
 * EEPROM framework provider.
 *
 * Copyright (C) 2015 Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
 * Copyright (C) 2013 Maxime Ripard <maxime.ripard@free-electrons.com>
 *
 * This file is licensed under the terms of the GNU General Public
 * License version 2.  This program is licensed "as is" without any
 * warranty of any kind, whether express or implied.
 */

#ifndef _LINUX_EEPROM_PROVIDER_H
#define _LINUX_EEPROM_PROVIDER_H

#include <linux/regmap.h>

struct eeprom_device;

struct eeprom_config {
	struct device		*dev;
	struct regmap		*regmap;
	const char		*name;
	int			id;
	int			stride;
	size_t			size;
	struct module		*owner;
};

#if IS_ENABLED(CONFIG_EEPROM)

struct eeprom_device *eeprom_register(struct eeprom_config *cfg);
int eeprom_unregister(struct eeprom_device *eeprom);

#else

static inline struct eeprom_device *eeprom_register(struct eeprom_config *cfg)
{
	return NULL;
}
static inline int eeprom_unregister(struct eeprom_device *eeprom)
{
	return -ENOSYS;
}

#endif /* CONFIG_EEPROM */

#endif  /* ifndef _LINUX_EEPROM_PROVIDER_H */