mirror of https://gitee.com/openkylin/linux.git
iio: accel: st_sensors: add support for LIS2HH12
Add support for STMicroelectronics LISHH12 accelerometer in st_accel framework. https://www.st.com/resource/en/datasheet/lis2hh12.pdf Signed-off-by: Gaëtan André <rvlander@gaetanandre.eu> Reviewed-by: Stephan Gerhold <stephan@gerhold.net> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
This commit is contained in:
parent
9e3fbad5bb
commit
3f4a559bb5
|
@ -238,7 +238,7 @@ config IIO_ST_ACCEL_3AXIS
|
||||||
Say yes here to build support for STMicroelectronics accelerometers:
|
Say yes here to build support for STMicroelectronics accelerometers:
|
||||||
LSM303DLH, LSM303DLHC, LIS3DH, LSM330D, LSM330DL, LSM330DLC,
|
LSM303DLH, LSM303DLHC, LIS3DH, LSM330D, LSM330DL, LSM330DLC,
|
||||||
LIS331DLH, LSM303DL, LSM303DLM, LSM330, LIS2DH12, H3LIS331DL,
|
LIS331DLH, LSM303DL, LSM303DLM, LSM330, LIS2DH12, H3LIS331DL,
|
||||||
LNG2DM, LIS3DE, LIS2DE12
|
LNG2DM, LIS3DE, LIS2DE12, LIS2HH12
|
||||||
|
|
||||||
This driver can also be built as a module. If so, these modules
|
This driver can also be built as a module. If so, these modules
|
||||||
will be created:
|
will be created:
|
||||||
|
|
|
@ -35,6 +35,7 @@ enum st_accel_type {
|
||||||
LIS2DW12,
|
LIS2DW12,
|
||||||
LIS3DHH,
|
LIS3DHH,
|
||||||
LIS2DE12,
|
LIS2DE12,
|
||||||
|
LIS2HH12,
|
||||||
ST_ACCEL_MAX,
|
ST_ACCEL_MAX,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -59,6 +60,7 @@ enum st_accel_type {
|
||||||
#define LIS3DHH_ACCEL_DEV_NAME "lis3dhh"
|
#define LIS3DHH_ACCEL_DEV_NAME "lis3dhh"
|
||||||
#define LIS3DE_ACCEL_DEV_NAME "lis3de"
|
#define LIS3DE_ACCEL_DEV_NAME "lis3de"
|
||||||
#define LIS2DE12_ACCEL_DEV_NAME "lis2de12"
|
#define LIS2DE12_ACCEL_DEV_NAME "lis2de12"
|
||||||
|
#define LIS2HH12_ACCEL_DEV_NAME "lis2hh12"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* struct st_sensors_platform_data - default accel platform data
|
* struct st_sensors_platform_data - default accel platform data
|
||||||
|
|
|
@ -904,6 +904,83 @@ static const struct st_sensor_settings st_accel_sensors_settings[] = {
|
||||||
.multi_read_bit = true,
|
.multi_read_bit = true,
|
||||||
.bootime = 2,
|
.bootime = 2,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
.wai = 0x41,
|
||||||
|
.wai_addr = ST_SENSORS_DEFAULT_WAI_ADDRESS,
|
||||||
|
.sensors_supported = {
|
||||||
|
[0] = LIS2HH12_ACCEL_DEV_NAME,
|
||||||
|
},
|
||||||
|
.ch = (struct iio_chan_spec *)st_accel_16bit_channels,
|
||||||
|
.odr = {
|
||||||
|
.addr = 0x20,
|
||||||
|
.mask = 0x70,
|
||||||
|
.odr_avl = {
|
||||||
|
{ .hz = 10, .value = 0x01, },
|
||||||
|
{ .hz = 50, .value = 0x02, },
|
||||||
|
{ .hz = 100, .value = 0x03, },
|
||||||
|
{ .hz = 200, .value = 0x04, },
|
||||||
|
{ .hz = 400, .value = 0x05, },
|
||||||
|
{ .hz = 800, .value = 0x06, },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
.pw = {
|
||||||
|
.addr = 0x20,
|
||||||
|
.mask = 0x70,
|
||||||
|
.value_off = ST_SENSORS_DEFAULT_POWER_OFF_VALUE,
|
||||||
|
},
|
||||||
|
.enable_axis = {
|
||||||
|
.addr = ST_SENSORS_DEFAULT_AXIS_ADDR,
|
||||||
|
.mask = ST_SENSORS_DEFAULT_AXIS_MASK,
|
||||||
|
},
|
||||||
|
.fs = {
|
||||||
|
.addr = 0x23,
|
||||||
|
.mask = 0x30,
|
||||||
|
.fs_avl = {
|
||||||
|
[0] = {
|
||||||
|
.num = ST_ACCEL_FS_AVL_2G,
|
||||||
|
.value = 0x00,
|
||||||
|
.gain = IIO_G_TO_M_S_2(61),
|
||||||
|
},
|
||||||
|
[1] = {
|
||||||
|
.num = ST_ACCEL_FS_AVL_4G,
|
||||||
|
.value = 0x02,
|
||||||
|
.gain = IIO_G_TO_M_S_2(122),
|
||||||
|
},
|
||||||
|
[2] = {
|
||||||
|
.num = ST_ACCEL_FS_AVL_8G,
|
||||||
|
.value = 0x03,
|
||||||
|
.gain = IIO_G_TO_M_S_2(244),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
.bdu = {
|
||||||
|
.addr = 0x20,
|
||||||
|
.mask = 0x08,
|
||||||
|
},
|
||||||
|
.drdy_irq = {
|
||||||
|
.int1 = {
|
||||||
|
.addr = 0x22,
|
||||||
|
.mask = 0x01,
|
||||||
|
},
|
||||||
|
.int2 = {
|
||||||
|
.addr = 0x25,
|
||||||
|
.mask = 0x01,
|
||||||
|
},
|
||||||
|
.addr_ihl = 0x24,
|
||||||
|
.mask_ihl = 0x02,
|
||||||
|
.stat_drdy = {
|
||||||
|
.addr = ST_SENSORS_DEFAULT_STAT_ADDR,
|
||||||
|
.mask = 0x07,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
.sim = {
|
||||||
|
.addr = 0x23,
|
||||||
|
.value = BIT(0),
|
||||||
|
},
|
||||||
|
.multi_read_bit = true,
|
||||||
|
.bootime = 2,
|
||||||
|
},
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static int st_accel_read_raw(struct iio_dev *indio_dev,
|
static int st_accel_read_raw(struct iio_dev *indio_dev,
|
||||||
|
|
|
@ -104,6 +104,10 @@ static const struct of_device_id st_accel_of_match[] = {
|
||||||
.compatible = "st,lis2de12",
|
.compatible = "st,lis2de12",
|
||||||
.data = LIS2DE12_ACCEL_DEV_NAME,
|
.data = LIS2DE12_ACCEL_DEV_NAME,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
.compatible = "st,lis2hh12",
|
||||||
|
.data = LIS2HH12_ACCEL_DEV_NAME,
|
||||||
|
},
|
||||||
{},
|
{},
|
||||||
};
|
};
|
||||||
MODULE_DEVICE_TABLE(of, st_accel_of_match);
|
MODULE_DEVICE_TABLE(of, st_accel_of_match);
|
||||||
|
@ -138,6 +142,7 @@ static const struct i2c_device_id st_accel_id_table[] = {
|
||||||
{ LIS2DW12_ACCEL_DEV_NAME },
|
{ LIS2DW12_ACCEL_DEV_NAME },
|
||||||
{ LIS3DE_ACCEL_DEV_NAME },
|
{ LIS3DE_ACCEL_DEV_NAME },
|
||||||
{ LIS2DE12_ACCEL_DEV_NAME },
|
{ LIS2DE12_ACCEL_DEV_NAME },
|
||||||
|
{ LIS2HH12_ACCEL_DEV_NAME },
|
||||||
{},
|
{},
|
||||||
};
|
};
|
||||||
MODULE_DEVICE_TABLE(i2c, st_accel_id_table);
|
MODULE_DEVICE_TABLE(i2c, st_accel_id_table);
|
||||||
|
|
Loading…
Reference in New Issue