diff options
author | Laxman Dewangan <ldewangan@nvidia.com> | 2013-12-31 15:55:23 +0530 |
---|---|---|
committer | Laxman Dewangan <ldewangan@nvidia.com> | 2014-01-01 02:35:15 -0800 |
commit | 0dab3ccc17b6a2a7627ad1e055fce1dbfadc294e (patch) | |
tree | 81303dfd902198fb6a9f74b91d54171c934ec220 /include/dt-bindings | |
parent | 4b9af32c47825ec54613acb52b3d087d87f6a047 (diff) |
dt-binding: add header to define types and conversion
Add a header file to define the macros for type conversion
to be used by DTS file.
Add macro for the S32 to U32 conversion by using 2's complement.
Change-Id: Ia788e50b916b24c350293af4fef41efd25beba11
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: http://git-master/r/350994
Reviewed-by: Kerwin Wan <kerwinw@nvidia.com>
Diffstat (limited to 'include/dt-bindings')
-rw-r--r-- | include/dt-bindings/types.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/include/dt-bindings/types.h b/include/dt-bindings/types.h new file mode 100644 index 000000000000..d91fcae8342a --- /dev/null +++ b/include/dt-bindings/types.h @@ -0,0 +1,18 @@ +/* + * This header provides macros for different types and conversions + */ + +#ifndef _DT_BINDINGS_TYPES_H_ +#define _DT_BINDINGS_TYPES_H_ + +/* + * S32_TO_U32: This macro converts the signed number to 2's complement + * unisgned number. E.g. S32_TO_U32(-3) will be 0xfffffffd and + * S32_TO_U32(3) will be 0x3; + * Use of_property_read_s32() for getting back the correct signed value + * in driver. + */ +#define S32_TO_U32(x) (((x) < 0) ? (((-(x)) ^ 0xFFFFFFFFU) + 1) : (x)) + +#endif + |