mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-15 15:04:27 +08:00
dcc3ac1381
Simplify adxl345_read_raw() by adding uscale variable to struct adxl345_chip_info. Also convert variables adxl3{4,7}5_uscale to macros and use it in OF/ACPI/ID match table. Drop enum adxl345_device_type as there is no user. Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com> Link: https://lore.kernel.org/r/20230903090051.39274-3-biju.das.jz@bp.renesas.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
34 lines
722 B
C
34 lines
722 B
C
/* SPDX-License-Identifier: GPL-2.0-only */
|
|
/*
|
|
* ADXL345 3-Axis Digital Accelerometer
|
|
*
|
|
* Copyright (c) 2017 Eva Rachel Retuya <eraretuya@gmail.com>
|
|
*/
|
|
|
|
#ifndef _ADXL345_H_
|
|
#define _ADXL345_H_
|
|
|
|
/*
|
|
* In full-resolution mode, scale factor is maintained at ~4 mg/LSB
|
|
* in all g ranges.
|
|
*
|
|
* At +/- 16g with 13-bit resolution, scale is computed as:
|
|
* (16 + 16) * 9.81 / (2^13 - 1) = 0.0383
|
|
*/
|
|
#define ADXL345_USCALE 38300
|
|
|
|
/*
|
|
* The Datasheet lists a resolution of Resolution is ~49 mg per LSB. That's
|
|
* ~480mm/s**2 per LSB.
|
|
*/
|
|
#define ADXL375_USCALE 480000
|
|
|
|
struct adxl345_chip_info {
|
|
const char *name;
|
|
int uscale;
|
|
};
|
|
|
|
int adxl345_core_probe(struct device *dev, struct regmap *regmap);
|
|
|
|
#endif /* _ADXL345_H_ */
|