diff options
author | Peter De Schrijver <pdeschrijver@nvidia.com> | 2012-06-11 20:43:59 +0300 |
---|---|---|
committer | Simone Willett <swillett@nvidia.com> | 2012-07-03 16:58:09 -0700 |
commit | 890a7b1b7409d3f867033533f691179f1daab633 (patch) | |
tree | 1f70114183808bd3ff122af87398b453e62257de /include | |
parent | 233acfbfe5910956f09ba9b9541ce0f1996ca190 (diff) |
ARM: tegra: add sysfs support for tegra cpuquiet driver
Change-Id: I215c5de8e98d139a93113978e1e27adb5a6b252c
Signed-off-by: Sai Charan Gurrappadi <sgurrappadi@nvidia.com>
Reviewed-on: http://git-master/r/111283
Reviewed-by: Simone Willett <swillett@nvidia.com>
Tested-by: Simone Willett <swillett@nvidia.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/cpuquiet.h | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/include/linux/cpuquiet.h b/include/linux/cpuquiet.h index 8459af7aad74..fe5a03727739 100644 --- a/include/linux/cpuquiet.h +++ b/include/linux/cpuquiet.h @@ -50,4 +50,56 @@ extern void cpuquiet_remove_group(struct attribute_group *attrs); int cpuquiet_kobject_init(struct kobject *kobj, struct kobj_type *type, char *name); extern unsigned int nr_cluster_ids; + +/* Sysfs support */ +struct cpuquiet_attribute { + struct attribute attr; + ssize_t (*show)(struct cpuquiet_attribute *attr, char *buf); + ssize_t (*store)(struct cpuquiet_attribute *attr, const char *buf, + size_t count); + /* Optional. Called after store is called */ + void (*store_callback)(struct cpuquiet_attribute *attr); + void *param; +}; + +#define CPQ_ATTRIBUTE(_name, _mode, _type, _callback) \ + static struct cpuquiet_attribute _name ## _attr = { \ + .attr = {.name = __stringify(_name), .mode = _mode }, \ + .show = show_ ## _type ## _attribute, \ + .store = store_ ## _type ## _attribute, \ + .store_callback = _callback, \ + .param = &_name, \ +} + +#define CPQ_BASIC_ATTRIBUTE(_name, _mode, _type) \ + CPQ_ATTRIBUTE(_name, _mode, _type, NULL) + +#define CPQ_ATTRIBUTE_CUSTOM(_name, _mode, _show, _store) \ + static struct cpuquiet_attribute _name ## _attr = { \ + .attr = {.name = __stringify(_name), .mode = _mode }, \ + .show = _show, \ + .store = _store \ + .store_callback = NULL, \ + .param = &_name, \ +} + + +extern ssize_t show_int_attribute(struct cpuquiet_attribute *cattr, char *buf); +extern ssize_t store_int_attribute(struct cpuquiet_attribute *cattr, + const char *buf, size_t count); +extern ssize_t show_bool_attribute(struct cpuquiet_attribute *cattr, char *buf); +extern ssize_t store_bool_attribute(struct cpuquiet_attribute *cattr, + const char *buf, size_t count); +extern ssize_t store_uint_attribute(struct cpuquiet_attribute *cattr, + const char *buf, size_t count); +extern ssize_t show_uint_attribute(struct cpuquiet_attribute *cattr, char *buf); +extern ssize_t store_ulong_attribute(struct cpuquiet_attribute *cattr, + const char *buf, size_t count); +extern ssize_t show_ulong_attribute(struct cpuquiet_attribute *cattr, + char *buf); +extern ssize_t cpuquiet_auto_sysfs_show(struct kobject *kobj, + struct attribute *attr, char *buf); +extern ssize_t cpuquiet_auto_sysfs_store(struct kobject *kobj, + struct attribute *attr, const char *buf, + size_t count); #endif |