Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

iio: imu: inv_icm42600: make timestamp module chip independent

Move icm42600 dependent function inside the core module.
Do some headers cleanup at the same time.

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-2-inv.git-commit@tdk.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

authored by

Jean-Baptiste Maneyrol and committed by
Jonathan Cameron
6e9f2d83 f41f4443

+12 -19
+11
drivers/iio/imu/inv_icm42600/inv_icm42600_core.c
··· 516 516 "inv_icm42600", st); 517 517 } 518 518 519 + static int inv_icm42600_timestamp_setup(struct inv_icm42600_state *st) 520 + { 521 + unsigned int val; 522 + 523 + /* enable timestamp register */ 524 + val = INV_ICM42600_TMST_CONFIG_TMST_TO_REGS_EN | 525 + INV_ICM42600_TMST_CONFIG_TMST_EN; 526 + return regmap_update_bits(st->map, INV_ICM42600_REG_TMST_CONFIG, 527 + INV_ICM42600_TMST_CONFIG_MASK, val); 528 + } 529 + 519 530 static int inv_icm42600_enable_regulator_vddio(struct inv_icm42600_state *st) 520 531 { 521 532 int ret;
+1 -13
drivers/iio/imu/inv_icm42600/inv_icm42600_timestamp.c
··· 3 3 * Copyright (C) 2020 Invensense, Inc. 4 4 */ 5 5 6 + #include <linux/errno.h> 6 7 #include <linux/kernel.h> 7 - #include <linux/regmap.h> 8 8 #include <linux/math64.h> 9 9 10 - #include "inv_icm42600.h" 11 10 #include "inv_icm42600_timestamp.h" 12 11 13 12 /* internal chip period is 32kHz, 31250ns */ ··· 53 54 54 55 /* use theoretical value for chip period */ 55 56 inv_update_acc(&ts->chip_period, INV_ICM42600_TIMESTAMP_PERIOD); 56 - } 57 - 58 - int inv_icm42600_timestamp_setup(struct inv_icm42600_state *st) 59 - { 60 - unsigned int val; 61 - 62 - /* enable timestamp register */ 63 - val = INV_ICM42600_TMST_CONFIG_TMST_TO_REGS_EN | 64 - INV_ICM42600_TMST_CONFIG_TMST_EN; 65 - return regmap_update_bits(st->map, INV_ICM42600_REG_TMST_CONFIG, 66 - INV_ICM42600_TMST_CONFIG_MASK, val); 67 57 } 68 58 69 59 int inv_icm42600_timestamp_update_odr(struct inv_icm42600_timestamp *ts,
-6
drivers/iio/imu/inv_icm42600/inv_icm42600_timestamp.h
··· 6 6 #ifndef INV_ICM42600_TIMESTAMP_H_ 7 7 #define INV_ICM42600_TIMESTAMP_H_ 8 8 9 - #include <linux/kernel.h> 10 - 11 - struct inv_icm42600_state; 12 - 13 9 /** 14 10 * struct inv_icm42600_timestamp_interval - timestamps interval 15 11 * @lo: interval lower bound ··· 48 52 49 53 void inv_icm42600_timestamp_init(struct inv_icm42600_timestamp *ts, 50 54 uint32_t period); 51 - 52 - int inv_icm42600_timestamp_setup(struct inv_icm42600_state *st); 53 55 54 56 int inv_icm42600_timestamp_update_odr(struct inv_icm42600_timestamp *ts, 55 57 uint32_t period, bool fifo);