文件
android_kernel_samsung_sm86…/qcom/opensource/graphics-kernel/adreno_sysfs.h
David Wronek 880d405719 Add 'qcom/opensource/graphics-kernel/' from commit 'b4fdc4c04295ac59109ae19d64747522740c3f14'
git-subtree-dir: qcom/opensource/graphics-kernel
git-subtree-mainline: 992813d9c1
git-subtree-split: b4fdc4c042
Change-Id:
repo: https://git.codelinaro.org/clo/la/platform/vendor/qcom/opensource/graphics-kernel
tag: GRAPHICS.LA.14.0.r1-07700-lanai.0
2024-10-06 16:44:56 +02:00

79 行
2.6 KiB
C

/* SPDX-License-Identifier: GPL-2.0-only */
/*
* Copyright (c) 2020, The Linux Foundation. All rights reserved.
*/
#ifndef _ADRENO_SYSFS_H_
#define _ADRENO_SYSFS_H_
/*
* struct adreno_sysfs_attribute_u32 - Container for accessing and modifying
* integers in kgsl via sysfs
*/
struct adreno_sysfs_attribute_u32 {
/** #attr: The device attribute corresponding to the sysfs node */
struct device_attribute attr;
/** @show: Function to show the value of the integer */
u32 (*show)(struct adreno_device *adreno_dev);
/** @store: Function to store the value of the integer */
int (*store)(struct adreno_device *adreno_dev, u32 val);
};
/*
* struct adreno_sysfs_attribute_bool - Container for accessing and modifying
* booleans in kgsl via sysfs
*/
struct adreno_sysfs_attribute_bool {
/** #attr: The device attribute corresponding to the sysfs node */
struct device_attribute attr;
/** @show: Function to show the value of the boolean */
bool (*show)(struct adreno_device *adreno_dev);
/** @store: Function to store the value of the boolean */
int (*store)(struct adreno_device *adreno_dev, bool val);
};
/* Helper function to modify an integer in kgsl */
ssize_t adreno_sysfs_store_u32(struct device *dev,
struct device_attribute *attr, const char *buf, size_t count);
/* Helper function to read an integer in kgsl */
ssize_t adreno_sysfs_show_u32(struct device *dev,
struct device_attribute *attr, char *buf);
/* Helper function to modify a boolean in kgsl */
ssize_t adreno_sysfs_store_bool(struct device *dev,
struct device_attribute *attr, const char *buf, size_t count);
/* Helper function to read a boolean in kgsl */
ssize_t adreno_sysfs_show_bool(struct device *dev,
struct device_attribute *attr, char *buf);
#define ADRENO_SYSFS_BOOL(_name) \
const struct adreno_sysfs_attribute_bool adreno_attr_##_name = { \
.attr = __ATTR(_name, 0644, adreno_sysfs_show_bool, \
adreno_sysfs_store_bool), \
.show = _ ## _name ## _show, \
.store = _ ## _name ## _store, \
}
#define ADRENO_SYSFS_RO_BOOL(_name) \
const struct adreno_sysfs_attribute_bool adreno_attr_##_name = { \
.attr = __ATTR(_name, 0444, adreno_sysfs_show_bool, NULL), \
.show = _ ## _name ## _show, \
}
#define ADRENO_SYSFS_U32(_name) \
const struct adreno_sysfs_attribute_u32 adreno_attr_##_name = { \
.attr = __ATTR(_name, 0644, adreno_sysfs_show_u32, \
adreno_sysfs_store_u32), \
.show = _ ## _name ## _show, \
.store = _ ## _name ## _store, \
}
#define ADRENO_SYSFS_RO_U32(_name) \
const struct adreno_sysfs_attribute_u32 adreno_attr_##_name = { \
.attr = __ATTR(_name, 0444, adreno_sysfs_show_u32, NULL), \
.show = _ ## _name ## _show, \
}
#endif