mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-01-01 02:33:57 +00:00
iio: move inv_icm42600 timestamp module in common
Create new inv_sensors common modules and move inv_icm42600 timestamp module inside. This module will be used by IMUs and also in the future by other chips. Modify inv_icm42600 driver to use timestamp module and do some headers cleanup. Signed-off-by: Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Link: https://lore.kernel.org/r/20230606162147.79667-3-inv.git-commit@tdk.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
This commit is contained in:
parent
6e9f2d8375
commit
d99ff463ec
@ -5,6 +5,7 @@
|
|||||||
|
|
||||||
source "drivers/iio/common/cros_ec_sensors/Kconfig"
|
source "drivers/iio/common/cros_ec_sensors/Kconfig"
|
||||||
source "drivers/iio/common/hid-sensors/Kconfig"
|
source "drivers/iio/common/hid-sensors/Kconfig"
|
||||||
|
source "drivers/iio/common/inv_sensors/Kconfig"
|
||||||
source "drivers/iio/common/ms_sensors/Kconfig"
|
source "drivers/iio/common/ms_sensors/Kconfig"
|
||||||
source "drivers/iio/common/scmi_sensors/Kconfig"
|
source "drivers/iio/common/scmi_sensors/Kconfig"
|
||||||
source "drivers/iio/common/ssp_sensors/Kconfig"
|
source "drivers/iio/common/ssp_sensors/Kconfig"
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
# When adding new entries keep the list in alphabetical order
|
# When adding new entries keep the list in alphabetical order
|
||||||
obj-y += cros_ec_sensors/
|
obj-y += cros_ec_sensors/
|
||||||
obj-y += hid-sensors/
|
obj-y += hid-sensors/
|
||||||
|
obj-y += inv_sensors/
|
||||||
obj-y += ms_sensors/
|
obj-y += ms_sensors/
|
||||||
obj-y += scmi_sensors/
|
obj-y += scmi_sensors/
|
||||||
obj-y += ssp_sensors/
|
obj-y += ssp_sensors/
|
||||||
|
7
drivers/iio/common/inv_sensors/Kconfig
Normal file
7
drivers/iio/common/inv_sensors/Kconfig
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
# SPDX-License-Identifier: GPL-2.0-only
|
||||||
|
#
|
||||||
|
# TDK-InvenSense sensors common library
|
||||||
|
#
|
||||||
|
|
||||||
|
config IIO_INV_SENSORS_TIMESTAMP
|
||||||
|
tristate
|
6
drivers/iio/common/inv_sensors/Makefile
Normal file
6
drivers/iio/common/inv_sensors/Makefile
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
# SPDX-License-Identifier: GPL-2.0
|
||||||
|
#
|
||||||
|
# Makefile for TDK-InvenSense sensors module.
|
||||||
|
#
|
||||||
|
|
||||||
|
obj-$(CONFIG_IIO_INV_SENSORS_TIMESTAMP) += inv_icm42600_timestamp.o
|
@ -6,8 +6,9 @@
|
|||||||
#include <linux/errno.h>
|
#include <linux/errno.h>
|
||||||
#include <linux/kernel.h>
|
#include <linux/kernel.h>
|
||||||
#include <linux/math64.h>
|
#include <linux/math64.h>
|
||||||
|
#include <linux/module.h>
|
||||||
|
|
||||||
#include "inv_icm42600_timestamp.h"
|
#include <linux/iio/common/inv_icm42600_timestamp.h>
|
||||||
|
|
||||||
/* internal chip period is 32kHz, 31250ns */
|
/* internal chip period is 32kHz, 31250ns */
|
||||||
#define INV_ICM42600_TIMESTAMP_PERIOD 31250
|
#define INV_ICM42600_TIMESTAMP_PERIOD 31250
|
||||||
@ -54,6 +55,7 @@ void inv_icm42600_timestamp_init(struct inv_icm42600_timestamp *ts,
|
|||||||
/* use theoretical value for chip period */
|
/* use theoretical value for chip period */
|
||||||
inv_update_acc(&ts->chip_period, INV_ICM42600_TIMESTAMP_PERIOD);
|
inv_update_acc(&ts->chip_period, INV_ICM42600_TIMESTAMP_PERIOD);
|
||||||
}
|
}
|
||||||
|
EXPORT_SYMBOL_NS_GPL(inv_icm42600_timestamp_init, IIO_INV_SENSORS_TIMESTAMP);
|
||||||
|
|
||||||
int inv_icm42600_timestamp_update_odr(struct inv_icm42600_timestamp *ts,
|
int inv_icm42600_timestamp_update_odr(struct inv_icm42600_timestamp *ts,
|
||||||
uint32_t period, bool fifo)
|
uint32_t period, bool fifo)
|
||||||
@ -66,6 +68,7 @@ int inv_icm42600_timestamp_update_odr(struct inv_icm42600_timestamp *ts,
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
EXPORT_SYMBOL_NS_GPL(inv_icm42600_timestamp_update_odr, IIO_INV_SENSORS_TIMESTAMP);
|
||||||
|
|
||||||
static bool inv_validate_period(uint32_t period, uint32_t mult)
|
static bool inv_validate_period(uint32_t period, uint32_t mult)
|
||||||
{
|
{
|
||||||
@ -153,6 +156,7 @@ void inv_icm42600_timestamp_interrupt(struct inv_icm42600_timestamp *ts,
|
|||||||
if (valid)
|
if (valid)
|
||||||
inv_align_timestamp_it(ts);
|
inv_align_timestamp_it(ts);
|
||||||
}
|
}
|
||||||
|
EXPORT_SYMBOL_NS_GPL(inv_icm42600_timestamp_interrupt, IIO_INV_SENSORS_TIMESTAMP);
|
||||||
|
|
||||||
void inv_icm42600_timestamp_apply_odr(struct inv_icm42600_timestamp *ts,
|
void inv_icm42600_timestamp_apply_odr(struct inv_icm42600_timestamp *ts,
|
||||||
uint32_t fifo_period, size_t fifo_nb,
|
uint32_t fifo_period, size_t fifo_nb,
|
||||||
@ -184,3 +188,8 @@ void inv_icm42600_timestamp_apply_odr(struct inv_icm42600_timestamp *ts,
|
|||||||
ts->timestamp = ts->it.up - interval;
|
ts->timestamp = ts->it.up - interval;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
EXPORT_SYMBOL_NS_GPL(inv_icm42600_timestamp_apply_odr, IIO_INV_SENSORS_TIMESTAMP);
|
||||||
|
|
||||||
|
MODULE_AUTHOR("InvenSense, Inc.");
|
||||||
|
MODULE_DESCRIPTION("InvenSense sensors timestamp module");
|
||||||
|
MODULE_LICENSE("GPL");
|
@ -3,6 +3,7 @@
|
|||||||
config INV_ICM42600
|
config INV_ICM42600
|
||||||
tristate
|
tristate
|
||||||
select IIO_BUFFER
|
select IIO_BUFFER
|
||||||
|
select IIO_INV_SENSORS_TIMESTAMP
|
||||||
|
|
||||||
config INV_ICM42600_I2C
|
config INV_ICM42600_I2C
|
||||||
tristate "InvenSense ICM-426xx I2C driver"
|
tristate "InvenSense ICM-426xx I2C driver"
|
||||||
|
@ -6,7 +6,6 @@ inv-icm42600-y += inv_icm42600_gyro.o
|
|||||||
inv-icm42600-y += inv_icm42600_accel.o
|
inv-icm42600-y += inv_icm42600_accel.o
|
||||||
inv-icm42600-y += inv_icm42600_temp.o
|
inv-icm42600-y += inv_icm42600_temp.o
|
||||||
inv-icm42600-y += inv_icm42600_buffer.o
|
inv-icm42600-y += inv_icm42600_buffer.o
|
||||||
inv-icm42600-y += inv_icm42600_timestamp.o
|
|
||||||
|
|
||||||
obj-$(CONFIG_INV_ICM42600_I2C) += inv-icm42600-i2c.o
|
obj-$(CONFIG_INV_ICM42600_I2C) += inv-icm42600-i2c.o
|
||||||
inv-icm42600-i2c-y += inv_icm42600_i2c.o
|
inv-icm42600-i2c-y += inv_icm42600_i2c.o
|
||||||
|
@ -10,14 +10,15 @@
|
|||||||
#include <linux/regmap.h>
|
#include <linux/regmap.h>
|
||||||
#include <linux/delay.h>
|
#include <linux/delay.h>
|
||||||
#include <linux/math64.h>
|
#include <linux/math64.h>
|
||||||
#include <linux/iio/iio.h>
|
|
||||||
#include <linux/iio/buffer.h>
|
#include <linux/iio/buffer.h>
|
||||||
|
#include <linux/iio/common/inv_icm42600_timestamp.h>
|
||||||
|
#include <linux/iio/iio.h>
|
||||||
#include <linux/iio/kfifo_buf.h>
|
#include <linux/iio/kfifo_buf.h>
|
||||||
|
|
||||||
#include "inv_icm42600.h"
|
#include "inv_icm42600.h"
|
||||||
#include "inv_icm42600_temp.h"
|
#include "inv_icm42600_temp.h"
|
||||||
#include "inv_icm42600_buffer.h"
|
#include "inv_icm42600_buffer.h"
|
||||||
#include "inv_icm42600_timestamp.h"
|
|
||||||
|
|
||||||
#define INV_ICM42600_ACCEL_CHAN(_modifier, _index, _ext_info) \
|
#define INV_ICM42600_ACCEL_CHAN(_modifier, _index, _ext_info) \
|
||||||
{ \
|
{ \
|
||||||
|
@ -9,11 +9,12 @@
|
|||||||
#include <linux/pm_runtime.h>
|
#include <linux/pm_runtime.h>
|
||||||
#include <linux/regmap.h>
|
#include <linux/regmap.h>
|
||||||
#include <linux/delay.h>
|
#include <linux/delay.h>
|
||||||
#include <linux/iio/iio.h>
|
|
||||||
#include <linux/iio/buffer.h>
|
#include <linux/iio/buffer.h>
|
||||||
|
#include <linux/iio/common/inv_icm42600_timestamp.h>
|
||||||
|
#include <linux/iio/iio.h>
|
||||||
|
|
||||||
#include "inv_icm42600.h"
|
#include "inv_icm42600.h"
|
||||||
#include "inv_icm42600_timestamp.h"
|
|
||||||
#include "inv_icm42600_buffer.h"
|
#include "inv_icm42600_buffer.h"
|
||||||
|
|
||||||
/* FIFO header: 1 byte */
|
/* FIFO header: 1 byte */
|
||||||
|
@ -15,11 +15,12 @@
|
|||||||
#include <linux/pm_runtime.h>
|
#include <linux/pm_runtime.h>
|
||||||
#include <linux/property.h>
|
#include <linux/property.h>
|
||||||
#include <linux/regmap.h>
|
#include <linux/regmap.h>
|
||||||
|
|
||||||
|
#include <linux/iio/common/inv_icm42600_timestamp.h>
|
||||||
#include <linux/iio/iio.h>
|
#include <linux/iio/iio.h>
|
||||||
|
|
||||||
#include "inv_icm42600.h"
|
#include "inv_icm42600.h"
|
||||||
#include "inv_icm42600_buffer.h"
|
#include "inv_icm42600_buffer.h"
|
||||||
#include "inv_icm42600_timestamp.h"
|
|
||||||
|
|
||||||
static const struct regmap_range_cfg inv_icm42600_regmap_ranges[] = {
|
static const struct regmap_range_cfg inv_icm42600_regmap_ranges[] = {
|
||||||
{
|
{
|
||||||
@ -799,3 +800,4 @@ EXPORT_NS_GPL_DEV_PM_OPS(inv_icm42600_pm_ops, IIO_ICM42600) = {
|
|||||||
MODULE_AUTHOR("InvenSense, Inc.");
|
MODULE_AUTHOR("InvenSense, Inc.");
|
||||||
MODULE_DESCRIPTION("InvenSense ICM-426xx device driver");
|
MODULE_DESCRIPTION("InvenSense ICM-426xx device driver");
|
||||||
MODULE_LICENSE("GPL");
|
MODULE_LICENSE("GPL");
|
||||||
|
MODULE_IMPORT_NS(IIO_INV_SENSORS_TIMESTAMP);
|
||||||
|
@ -10,14 +10,15 @@
|
|||||||
#include <linux/regmap.h>
|
#include <linux/regmap.h>
|
||||||
#include <linux/delay.h>
|
#include <linux/delay.h>
|
||||||
#include <linux/math64.h>
|
#include <linux/math64.h>
|
||||||
#include <linux/iio/iio.h>
|
|
||||||
#include <linux/iio/buffer.h>
|
#include <linux/iio/buffer.h>
|
||||||
|
#include <linux/iio/common/inv_icm42600_timestamp.h>
|
||||||
|
#include <linux/iio/iio.h>
|
||||||
#include <linux/iio/kfifo_buf.h>
|
#include <linux/iio/kfifo_buf.h>
|
||||||
|
|
||||||
#include "inv_icm42600.h"
|
#include "inv_icm42600.h"
|
||||||
#include "inv_icm42600_temp.h"
|
#include "inv_icm42600_temp.h"
|
||||||
#include "inv_icm42600_buffer.h"
|
#include "inv_icm42600_buffer.h"
|
||||||
#include "inv_icm42600_timestamp.h"
|
|
||||||
|
|
||||||
#define INV_ICM42600_GYRO_CHAN(_modifier, _index, _ext_info) \
|
#define INV_ICM42600_GYRO_CHAN(_modifier, _index, _ext_info) \
|
||||||
{ \
|
{ \
|
||||||
|
Loading…
Reference in New Issue
Block a user