summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorMaxime Coquelin <maxime.coquelin-nonst@stericsson.com>2011-03-07 11:26:02 +0100
committerLee Jones <lee.jones@linaro.org>2012-01-05 10:05:48 +0000
commitd1fd3592923ffc13e5b82c2f0adb53504f89eb76 (patch)
treed8dbfbd31521b4e56a0e0d29130fadc2f9e33fff /include
parent999453499d05c688e9150577628f2f1a806c44ef (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')
-rw-r--r--include/linux/sys_soc.h50
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 */