diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2016-06-14 09:13:26 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2016-06-14 09:13:26 +0200 |
commit | 5f987cd3f76585e2d538100ac8c6d46033f55851 (patch) | |
tree | 890b31ed806830bdfda73e1644d5f84a49403e1a /include | |
parent | 7fe927ca774c96f5f6a8fa4dd2eb9494032468ff (diff) | |
parent | f7c9c149e5c7cde467ceba3b471b6834972e28a3 (diff) | |
download | barebox-5f987cd3f76585e2d538100ac8c6d46033f55851.tar.gz barebox-5f987cd3f76585e2d538100ac8c6d46033f55851.tar.xz |
Merge branch 'for-next/aiodev'
Diffstat (limited to 'include')
-rw-r--r-- | include/aiodev.h | 59 | ||||
-rw-r--r-- | include/mfd/syscon.h | 4 |
2 files changed, 61 insertions, 2 deletions
diff --git a/include/aiodev.h b/include/aiodev.h new file mode 100644 index 0000000000..0d4f7a2940 --- /dev/null +++ b/include/aiodev.h @@ -0,0 +1,59 @@ +/* + * core.c - Code implementing core functionality of AIODEV susbsystem + * + * Copyright (c) 2015 Sascha Hauer <s.hauer@pengutronix.de>, Pengutronix + * Copyright (c) 2015 Zodiac Inflight Innovation + * + * See file CREDITS for list of people who contributed to this + * project. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#ifndef __AIODEVICE_H +#define __AIODEVICE_H + +struct aiodevice; +struct aiochannel { + int index; + char *unit; + struct aiodevice *aiodev; + + int value; + char *name; +}; + +struct aiodevice { + const char *name; + int (*read)(struct aiochannel *, int *val); + struct device_d dev; + struct device_d *hwdev; + struct aiochannel **channels; + int num_channels; + struct list_head list; +}; + +int aiodevice_register(struct aiodevice *aiodev); + +struct aiochannel *aiochannel_get(struct device_d *dev, int index); +struct aiochannel *aiochannel_get_by_name(const char *name); + +int aiochannel_get_value(struct aiochannel *aiochan, int *value); +int aiochannel_get_index(struct aiochannel *aiochan); + +static inline const char *aiochannel_get_unit(struct aiochannel *aiochan) +{ + return aiochan->unit; +} + +extern struct list_head aiodevices; +#define for_each_aiodevice(aiodevice) list_for_each_entry(aiodevice, &aiodevices, list) + +#endif diff --git a/include/mfd/syscon.h b/include/mfd/syscon.h index 20445202b2..651d4c267c 100644 --- a/include/mfd/syscon.h +++ b/include/mfd/syscon.h @@ -21,13 +21,13 @@ void __iomem *syscon_base_lookup_by_phandle #else static inline void __iomem *syscon_base_lookup_by_pdevname(const char *s) { - return NULL; + return ERR_PTR(-ENOSYS); } static inline void __iomem *syscon_base_lookup_by_phandle (struct device_node *np, const char *property) { - return NULL; + return ERR_PTR(-ENOSYS); } #endif |