diff options
author | Maxime Coquelin <maxime.coquelin-nonst@stericsson.com> | 2011-03-07 11:26:02 +0100 |
---|---|---|
committer | Henrik Aberg <henrik.aberg@stericsson.com> | 2011-05-18 09:39:43 +0200 |
commit | 94ca56f383c33270730c87d0523db5a0ec450c69 (patch) | |
tree | c887e0cacf4c8d6a1e0f8e88a28cdbee0a333ec6 /include/linux | |
parent | 8dbd6ddb4bb1f21edd3489c53b2c92164a974b15 (diff) |
Export SoC info through sysfs
Common base to export System-on-Chip related informations through sysfs.
Creation of a "socinfo" directory under /sys/.
Creation of SoC information entries.
Signed-off-by: Maxime COQUELIN <maxime.coquelin-nonst@stericsson.com>
Change-Id: I8f9cbccbed07293d26974e9df3bf1102d42e561c
Reviewed-on: http://gerrit.lud.stericsson.com/gerrit/18178
Reviewed-by: Linus WALLEIJ <linus.walleij@stericsson.com>
Diffstat (limited to 'include/linux')
-rw-r--r-- | include/linux/sys_soc.h | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/include/linux/sys_soc.h b/include/linux/sys_soc.h new file mode 100644 index 00000000000..05e5529a6aa --- /dev/null +++ b/include/linux/sys_soc.h @@ -0,0 +1,50 @@ +/* + * Copyright (C) ST-Ericsson SA 2011 + * Author: Maxime Coquelin <maxime.coquelin-nonst@stericsson.com> for ST-Ericsson. + * License terms: GNU General Public License (GPL), version 2 + */ +#ifndef __SYS_SOC_H +#define __SYS_SOC_H + +#include <linux/kobject.h> + +/** + * struct sys_soc_info - SoC exports related informations + * @name: name of the export + * @info: pointer on the key to export + * @get_info: callback to retrieve key if info field is NULL + * @attr: export's sysdev class attribute + */ +struct sysfs_soc_info { + const char *info; + ssize_t (*get_info)(char *buf, struct sysfs_soc_info *); + struct kobj_attribute attr; +}; + +ssize_t show_soc_info(struct kobject *, struct kobj_attribute *, char *); + +#define SYSFS_SOC_ATTR_VALUE(_name, _value) { \ + .attr.attr.name = _name, \ + .attr.attr.mode = S_IRUGO, \ + .attr.show = show_soc_info, \ + .info = _value, \ +} + +#define SYSFS_SOC_ATTR_CALLBACK(_name, _callback) { \ + .attr.attr.name = _name, \ + .attr.attr.mode = S_IRUGO, \ + .attr.show = show_soc_info, \ + .get_info = _callback, \ +} + +/** + * register_sys_soc - register the soc information + * @name: name of the machine + * @info: pointer on the info table to export + * @num: number of info to export + * + * NOTE: This function must only be called once + */ +int register_sysfs_soc(struct sysfs_soc_info *info, size_t num); + +#endif /* __SYS_SOC_H */ |